From 37b322a7ae90dd9fbf9fa021e15266e9c17dea4e Mon Sep 17 00:00:00 2001 From: XueMoMo <2681350846@qq.com> Date: Tue, 3 Dec 2024 07:23:38 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20crustio/?= =?UTF-8?q?crust-files@d529d1f25c0c1aee16cd3ec29b4e18175b9525a3=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/404.html | 2 +- docs/404/index.html | 2 +- .../_buildManifest.js | 2 +- .../_ssgManifest.js | 0 ...b913d6f740c78e.js => 170-f408fde76cc2ecca.js} | 2 +- ...d864112ca84c96.js => 432-75487bd505c87cbb.js} | 2 +- ...a61d05b018e87.js => _app-fadaa055520693af.js} | 4 ++-- ...fbde0967fe7b.js => files-27b05728de287997.js} | 2 +- ...a78a1a91d6cc.js => vault-203e50891b2a387f.js} | 2 +- ...19a5fb16522e.js => index-ba7be9a50a522fa7.js} | 2 +- ...f659bd8373.js => setting-26cd25b7476448f2.js} | 2 +- ...5c33d0de86ff.js => share-8c05fecc490eac7a.js} | 2 +- ...36bb3f6.js => share-earn-beccb98470914ff6.js} | 2 +- ...229e0ec8eec89.js => user-0629671841c0061c.js} | 2 +- docs/docs/CrustFiles_DeveloperGuide/index.html | 2 +- docs/docs/CrustFiles_FAQ/index.html | 2 +- docs/docs/CrustFiles_ShareandEarn/index.html | 2 +- docs/docs/CrustFiles_Users/index.html | 2 +- docs/docs/CrustFiles_Welcome/index.html | 2 +- docs/files/index.html | 2 +- docs/files/vault/index.html | 2 +- docs/home/index.html | 2 +- docs/images/chain/u2u.png | Bin 0 -> 5225 bytes docs/index.html | 2 +- docs/invite_bonus_guide/index.html | 2 +- docs/mobile/index.html | 2 +- docs/rewards_history/index.html | 2 +- docs/setting/index.html | 2 +- docs/share-earn/index.html | 2 +- docs/share/index.html | 2 +- docs/user/index.html | 2 +- 31 files changed, 30 insertions(+), 30 deletions(-) rename docs/_next/static/{3CyGAAS2ZW74_V0I6Jh2y => LdLRNDpInKM4CwbwszNTk}/_buildManifest.js (73%) rename docs/_next/static/{3CyGAAS2ZW74_V0I6Jh2y => LdLRNDpInKM4CwbwszNTk}/_ssgManifest.js (100%) rename docs/_next/static/chunks/{170-15b913d6f740c78e.js => 170-f408fde76cc2ecca.js} (51%) rename docs/_next/static/chunks/{432-d3d864112ca84c96.js => 432-75487bd505c87cbb.js} (99%) rename docs/_next/static/chunks/pages/{_app-e7ca61d05b018e87.js => _app-fadaa055520693af.js} (64%) rename docs/_next/static/chunks/pages/{files-9903fbde0967fe7b.js => files-27b05728de287997.js} (97%) rename docs/_next/static/chunks/pages/files/{vault-a447a78a1a91d6cc.js => vault-203e50891b2a387f.js} (98%) rename docs/_next/static/chunks/pages/{index-7fa319a5fb16522e.js => index-ba7be9a50a522fa7.js} (99%) rename docs/_next/static/chunks/pages/{setting-22d786f659bd8373.js => setting-26cd25b7476448f2.js} (99%) rename docs/_next/static/chunks/pages/{share-73855c33d0de86ff.js => share-8c05fecc490eac7a.js} (99%) rename docs/_next/static/chunks/pages/{share-earn-54a88e15436bb3f6.js => share-earn-beccb98470914ff6.js} (99%) rename docs/_next/static/chunks/pages/{user-5d0229e0ec8eec89.js => user-0629671841c0061c.js} (99%) create mode 100644 docs/images/chain/u2u.png diff --git a/docs/404.html b/docs/404.html index 66fe3dad..a0b5b351 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/404/index.html b/docs/404/index.html index 66fe3dad..a0b5b351 100644 --- a/docs/404/index.html +++ b/docs/404/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/_next/static/3CyGAAS2ZW74_V0I6Jh2y/_buildManifest.js b/docs/_next/static/LdLRNDpInKM4CwbwszNTk/_buildManifest.js similarity index 73% rename from docs/_next/static/3CyGAAS2ZW74_V0I6Jh2y/_buildManifest.js rename to docs/_next/static/LdLRNDpInKM4CwbwszNTk/_buildManifest.js index 98058c26..fd7f6057 100644 --- a/docs/_next/static/3CyGAAS2ZW74_V0I6Jh2y/_buildManifest.js +++ b/docs/_next/static/LdLRNDpInKM4CwbwszNTk/_buildManifest.js @@ -1 +1 @@ -self.__BUILD_MANIFEST=function(s,e,a,c,t,i,r,u,d,n,f){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,"static/chunks/pages/index-7fa319a5fb16522e.js"],"/_error":["static/chunks/pages/_error-05873c5139c562bf.js"],"/docs/CrustFiles_DeveloperGuide":["static/chunks/pages/docs/CrustFiles_DeveloperGuide-9cffff6061512dd7.js"],"/docs/CrustFiles_FAQ":["static/chunks/pages/docs/CrustFiles_FAQ-122eb88b02e5c790.js"],"/docs/CrustFiles_ShareandEarn":["static/chunks/pages/docs/CrustFiles_ShareandEarn-ed9c6da4edc82550.js"],"/docs/CrustFiles_Users":["static/chunks/pages/docs/CrustFiles_Users-0ee05a113f58aabd.js"],"/docs/CrustFiles_Welcome":["static/chunks/pages/docs/CrustFiles_Welcome-bcf0f2f83dc2f430.js"],"/files":[s,e,a,c,i,r,d,t,u,n,"static/chunks/pages/files-9903fbde0967fe7b.js"],"/files/vault":[s,e,a,c,i,r,d,t,u,n,"static/chunks/pages/files/vault-a447a78a1a91d6cc.js"],"/home":[s,e,a,t,"static/chunks/pages/home-a660afde2c3870a0.js"],"/invite_bonus_guide":["static/chunks/pages/invite_bonus_guide-37d64d32ca460a95.js"],"/mobile":["static/chunks/pages/mobile-84c6b53fe3596e3b.js"],"/rewards_history":[e,"static/chunks/pages/rewards_history-0be6293db70a339d.js"],"/setting":["static/chunks/de297ff1-a13fd0c5ccf262f0.js",s,e,a,c,i,f,"static/chunks/24-6b8c80b8a90e78eb.js",t,"static/chunks/pages/setting-22d786f659bd8373.js"],"/share":[c,r,"static/chunks/pages/share-73855c33d0de86ff.js"],"/share-earn":[s,e,a,c,t,"static/chunks/pages/share-earn-54a88e15436bb3f6.js"],"/user":[s,e,a,c,i,f,"static/chunks/558-ccb8e96304591da9.js",t,u,"static/chunks/pages/user-5d0229e0ec8eec89.js"],sortedPages:["/","/_app","/_error","/docs/CrustFiles_DeveloperGuide","/docs/CrustFiles_FAQ","/docs/CrustFiles_ShareandEarn","/docs/CrustFiles_Users","/docs/CrustFiles_Welcome","/files","/files/vault","/home","/invite_bonus_guide","/mobile","/rewards_history","/setting","/share","/share-earn","/user"]}}("static/chunks/219-d79d2a31d9745eb2.js","static/chunks/795-2e4721c9f2de64fa.js","static/chunks/292-508efb6e93a4f458.js","static/chunks/786-386f3cfc19b9da37.js","static/chunks/170-15b913d6f740c78e.js","static/chunks/994-51897477958182ee.js","static/chunks/519-0b6dec2e69335829.js","static/chunks/491-13fc1ba22dac9e6e.js","static/chunks/426-1f55f0724a684bf1.js","static/chunks/432-d3d864112ca84c96.js","static/chunks/751-843e6708b9d05e9b.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file +self.__BUILD_MANIFEST=function(s,e,a,c,t,i,r,u,d,n,f){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,"static/chunks/pages/index-ba7be9a50a522fa7.js"],"/_error":["static/chunks/pages/_error-05873c5139c562bf.js"],"/docs/CrustFiles_DeveloperGuide":["static/chunks/pages/docs/CrustFiles_DeveloperGuide-9cffff6061512dd7.js"],"/docs/CrustFiles_FAQ":["static/chunks/pages/docs/CrustFiles_FAQ-122eb88b02e5c790.js"],"/docs/CrustFiles_ShareandEarn":["static/chunks/pages/docs/CrustFiles_ShareandEarn-ed9c6da4edc82550.js"],"/docs/CrustFiles_Users":["static/chunks/pages/docs/CrustFiles_Users-0ee05a113f58aabd.js"],"/docs/CrustFiles_Welcome":["static/chunks/pages/docs/CrustFiles_Welcome-bcf0f2f83dc2f430.js"],"/files":[s,e,a,c,i,r,d,t,u,n,"static/chunks/pages/files-27b05728de287997.js"],"/files/vault":[s,e,a,c,i,r,d,t,u,n,"static/chunks/pages/files/vault-203e50891b2a387f.js"],"/home":[s,e,a,t,"static/chunks/pages/home-a660afde2c3870a0.js"],"/invite_bonus_guide":["static/chunks/pages/invite_bonus_guide-37d64d32ca460a95.js"],"/mobile":["static/chunks/pages/mobile-84c6b53fe3596e3b.js"],"/rewards_history":[e,"static/chunks/pages/rewards_history-0be6293db70a339d.js"],"/setting":["static/chunks/de297ff1-a13fd0c5ccf262f0.js",s,e,a,c,i,f,"static/chunks/24-6b8c80b8a90e78eb.js",t,"static/chunks/pages/setting-26cd25b7476448f2.js"],"/share":[c,r,"static/chunks/pages/share-8c05fecc490eac7a.js"],"/share-earn":[s,e,a,c,t,"static/chunks/pages/share-earn-beccb98470914ff6.js"],"/user":[s,e,a,c,i,f,"static/chunks/558-ccb8e96304591da9.js",t,u,"static/chunks/pages/user-0629671841c0061c.js"],sortedPages:["/","/_app","/_error","/docs/CrustFiles_DeveloperGuide","/docs/CrustFiles_FAQ","/docs/CrustFiles_ShareandEarn","/docs/CrustFiles_Users","/docs/CrustFiles_Welcome","/files","/files/vault","/home","/invite_bonus_guide","/mobile","/rewards_history","/setting","/share","/share-earn","/user"]}}("static/chunks/219-d79d2a31d9745eb2.js","static/chunks/795-2e4721c9f2de64fa.js","static/chunks/292-508efb6e93a4f458.js","static/chunks/786-386f3cfc19b9da37.js","static/chunks/170-f408fde76cc2ecca.js","static/chunks/994-51897477958182ee.js","static/chunks/519-0b6dec2e69335829.js","static/chunks/491-13fc1ba22dac9e6e.js","static/chunks/426-1f55f0724a684bf1.js","static/chunks/432-75487bd505c87cbb.js","static/chunks/751-843e6708b9d05e9b.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/docs/_next/static/3CyGAAS2ZW74_V0I6Jh2y/_ssgManifest.js b/docs/_next/static/LdLRNDpInKM4CwbwszNTk/_ssgManifest.js similarity index 100% rename from docs/_next/static/3CyGAAS2ZW74_V0I6Jh2y/_ssgManifest.js rename to docs/_next/static/LdLRNDpInKM4CwbwszNTk/_ssgManifest.js diff --git a/docs/_next/static/chunks/170-15b913d6f740c78e.js b/docs/_next/static/chunks/170-f408fde76cc2ecca.js similarity index 51% rename from docs/_next/static/chunks/170-15b913d6f740c78e.js rename to docs/_next/static/chunks/170-f408fde76cc2ecca.js index 1849d3a9..65a156d2 100644 --- a/docs/_next/static/chunks/170-15b913d6f740c78e.js +++ b/docs/_next/static/chunks/170-f408fde76cc2ecca.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[170],{19676:function(e,n,t){t.d(n,{y:function(){return s},z:function(){return l}});var r=t(54335),i=(t(67294),t(85893)),a=32,o=function(e){return"number"===typeof e?"".concat(e,"px"):e};function c(e){var n=e.className;return(0,i.jsxs)("div",{className:n,children:[(0,i.jsx)("a",{href:"https://discord.gg/XeY9FKBzdK",target:"_blank",rel:"noreferrer"}),(0,i.jsx)("a",{href:"https://twitter.com/CrustNetwork",target:"_blank",rel:"noreferrer"}),(0,i.jsx)("a",{href:"https://t.me/CrustNetwork",target:"_blank",rel:"noreferrer"}),(0,i.jsx)("a",{href:"https://crust.network",target:"_blank",rel:"noreferrer"})]})}var s=(0,r.ZP)(c).withConfig({displayName:"Links",componentId:"sc-1efqffp-0"})(["height:",";align-items:flex-start;flex-shrink:0;display:flex;a{margin-right:",";background-size:contain;background-repeat:no-repeat;background-position:center;width:",";height:",";}a:nth-child(1){background-image:url('/images/icon_discord.png');}a:nth-child(2){background-image:url('/images/icon_twitter.png');}a:nth-child(3){background-image:url('/images/icon_telegram.png');}a:nth-child(4){background-image:url('/images/icon_crust.png');}a:last-child{margin-right:0;}&.dark{filter:invert(80%);}"],(function(e){var n=e.size;return o(void 0===n?a:n)}),(function(e){var n=e.space;return o(void 0===n?40:n)}),(function(e){var n=e.size;return o(void 0===n?a:n)}),(function(e){var n=e.size;return o(void 0===n?a:n)})),l=(0,r.ZP)(c).withConfig({displayName:"Links__Links2",componentId:"sc-1efqffp-1"})(["height:",";align-items:flex-start;flex-shrink:0;display:flex;a{margin-right:",";background-size:contain;background-repeat:no-repeat;background-position:center;width:",";height:",";}a:nth-child(1){background-image:url('/images/icon_discord.svg');}a:nth-child(2){background-image:url('/images/icon_twitter.svg');}a:nth-child(3){background-image:url('/images/icon_telegram.svg');}a:nth-child(4){background-image:url('/images/icon_crust.svg');}a:last-child{margin-right:0;}"],(function(e){var n=e.size;return o(void 0===n?a:n)}),(function(e){var n=e.space;return o(void 0===n?40:n)}),(function(e){var n=e.size;return o(void 0===n?a:n)}),(function(e){var n=e.size;return o(void 0===n?a:n)}))},61708:function(e,n,t){var r=t(67294),i=t(54335),a=t(85893);n.Z=r.memo((0,i.ZP)((function(e){var n=e.src,t=void 0===n?"/images/logo_22x.png":n,r=e.className;return(0,a.jsx)("div",{className:r,children:(0,a.jsx)("img",{src:t})})})).withConfig({displayName:"Logo",componentId:"sc-lchex5-0"})(["display:inline-block;img{display:inline-block;height:2.5rem;width:auto;object-fit:contain;}span{font-size:2.45rem;font-weight:400;line-height:2.45rem;color:white;display:inline-block;}"]))},66170:function(e,n,t){t.d(n,{Z:function(){return ne}});var r=t(67294),i=t(54335),a=t(83966),o=t(59499),c=t(16835),s=t(94184),l=t.n(s),u=t(11163),d=t(61651),m=t(44623),p=t(18005),g=t(10720);var f=t(91302),h=t(61708),b=t(85893);function x(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function v(e){for(var n=1;n50){var e=C().chunk(n.accounts,50);return Promise.all(e.map((function(e){return(0,M.zv)(e)}))).then((function(e){return C().flatten(e)}))}return(0,M.zv)(n.accounts)}),[n.accounts,"crust"===n.wallet]),m=(0,c.Z)(d,1)[0],p=(0,r.useMemo)((function(){var e,t=C().keyBy(m||[],"address");return((null===(e=n.useWallet)||void 0===e?void 0:e.accounts)||[]).map((function(e){return{text:function(){return(0,b.jsxs)(b.Fragment,{children:[(0,D.lS)(e)," ",(0,b.jsx)("span",{style:{float:"right"},children:C().get(t,"".concat(e,".nick_name"),"")})]})},value:e}}))}),[n,m]);return(0,b.jsxs)(A.Z,X(X({closeIcon:(0,b.jsx)("span",{className:"close icon cru-fo-x"}),onClose:function(){return t(!1)}},i),{},{children:[(0,b.jsx)(A.Z.Header,{content:"Select Account"}),(0,b.jsxs)(A.Z.Content,{children:[(0,b.jsx)(P.Z,{fluid:!0,selection:!0,icon:(0,b.jsx)("span",{className:"icon cru-fo cru-fo-chevron-down"}),defaultValue:o,options:p,onChange:l}),(0,b.jsxs)("div",{className:"btns",children:[(0,b.jsx)(V.Z,{content:"Confirm",onClick:u}),(0,b.jsx)(V.Z,{content:"Cancel",onClick:function(){return t(!1)}})]})]})]}))})).withConfig({displayName:"ModalSelectAccount",componentId:"sc-h6smcy-0"})(["overflow:unset !important;width:34.3rem !important;.header{height:3.93rem;font-size:1.3rem !important;padding:0 1.14rem !important;font-weight:600 !important;line-height:3.93rem !important;border-top-right-radius:0.6rem !important;border-top-left-radius:0.6rem !important;}.close.icon{top:0.5rem;right:0.6rem;color:#666666;}.content{padding:1rem !important;border-bottom-right-radius:0.6rem !important;border-bottom-left-radius:0.6rem !important;.btns{padding-top:2.3rem;button{width:calc(50% - 0.5rem) !important;margin:unset;}button:first-child{margin-right:1rem;}}.ui.dropdown{border-radius:0.57rem !important;border:0.07rem solid #cccccc !important;box-shadow:unset !important;.icon{position:absolute;right:0.8rem;top:0.7rem;}.text{font-weight:500 !important;color:var(--main-color) !important;font-family:OpenSans-Medium sans-serif !important;}.menu{background:#ffffff;box-shadow:0 0.57rem 1.43rem 0 rgba(0,0,0,0.1) !important;border-radius:0.57rem !important;border:0.07rem solid #eeeeee !important;padding:unset !important;top:calc(100% + 0.6rem);.item{padding:1rem 0.8rem !important;border-radius:unset !important;border-top:1px solid #eeeeee;font-weight:500;color:var(--main-color) !important;font-family:OpenSans-Medium sans-serif;&:active{background-color:#eeeeee;}}.item:first-child{border-top:unset !important;}}}}"]));function K(e){switch(e.wallet){case"crust":return"/images/wallet_crust.png";case"polkadot-js":return"/images/group_wallet_polkadot.png";case"subWallet":return"/images/subwallet.png";case"metamask":return"/images/wallet_metamask.png";case"solana":return"/images/wallet_solana.png";case"elrond":return"/images/wallet_elrond.png";case"algorand":return"/images/wallet_algorand.png";case"metax":return"/images/wallet_metax.png";case"flow":return"/images/wallet_flow.png";case"aptos-martian":return"/images/martian.png";case"aptos-petra":return"/images/aptos.svg";case"talisman":return"/images/talisman.png";case"oasis":return"/images/oasis.png";case"wallet-connect":var n=C().get(e.walletConnect.connect,"peerMeta.icons");return C().size(n)?n[0]:"/images/wallet_connect.png";case"mimir":return"/images/wallet_mimir.svg";default:return""}}var Y=i.ZP.div.withConfig({displayName:"User__TwoText",componentId:"sc-sox225-0"})([".title-text{font-size:16px;line-height:24px;font-family:OpenSans-Medium;font-weight:500;color:var(--main-color);strong{font-family:OpenSans-SemiBold;color:black;}}.primary{color:var(--primary-color);}.go-to{cursor:pointer;&:nth-child(n + 2){margin-left:6px;}text-decoration:underline;color:var(--primary-color);font-size:10px;font-weight:normal;}.sub-text{font-size:12px;line-height:24px;font-family:OpenSans-Regular;color:var(--secend-color);strong{color:black;font-family:OpenSans-SemiBold;}.cru-fo{cursor:pointer;position:relative;top:4px;margin-left:8px;}}"]),q=i.ZP.div.withConfig({displayName:"User__Line",componentId:"sc-sox225-1"})(["width:100%;height:1px;background-color:#eeeeee;margin:12px 0;"]),Q=i.ZP.div.withConfig({displayName:"User__MBtns",componentId:"sc-sox225-2"})(["display:flex;margin-top:24px;.btn{flex:1;height:40px;line-height:40px;border:1px solid black;border-radius:8px;color:var(--main-color);font-size:16px;font-weight:500;cursor:pointer;text-align:center;}.btn:nth-child(2){margin-left:8px;}"]);var $=(0,i.ZP)((function(e){var n,t=(0,E.O)(),i=(0,c.Z)(t,2),a=i[0],o=i[1],s=(0,S.V)(),l=(0,I.S)(),d=l.isPremiumUser,p=l.isCrust,g=l.user,f=(0,r.useMemo)((function(){return[(0,D.lS)(g.account),(0,D.lS)(g.account,14)]}),[g]),h=f[0],x=f[1],v=(0,r.useCallback)(g.logout,[g]),w="crust"===g.wallet||"polkadot-js"===g.wallet,_=(0,E.O)(),k=(0,c.Z)(_,2),y=k[0],j=k[1];(0,r.useEffect)((function(){a&&j(!0)}),[a]);var C=(0,Z.X)((function(){return(0,M.zo)(g.account)}),[g.account,p,y],"getEarnRewards"),F=(0,c.Z)(C,1)[0],A=(0,U.ms)({key:"rewards",value:F}).rewards,T=(0,D.yn)(A,"total.total"),W=(0,u.useRouter)(),V=(0,r.useMemo)((function(){return[{name:"Ethereum",image:"/images/chain/ethereum.png",chainId:L.aB.mainnet.id,chain:L.aB.mainnet},{name:"Optimism",image:"/images/chain/optimism.png",chainId:L.aB.optimism.id,chain:L.aB.optimism},{name:"Arbitrum",image:"/images/chain/arbitrum.png",chainId:L.aB.arbitrum.id,chain:L.aB.arbitrum},{name:"zkSync",image:"/images/chain/zksync.png",chainId:L.aB.zkSync.id,chain:L.aB.zkSync},{name:"Blast",image:"/images/chain/blast.png",chainId:L.aB.blast.id,chain:L.aB.blast},{name:"Base",image:"/images/chain/base.png",chainId:L.aB.base.id,chain:L.aB.base},{name:"Crust EVM Parachain",image:"/images/chain/crust_evm_test.png",chainId:L.aB.crustEvmParachainTest.id,chain:L.aB.crustEvmParachainTest}]}),[]),G=function(){return(0,b.jsx)("span",{className:"go-to",onClick:function(){return W.push("/user")},children:"Get Premium"})},J=(0,r.useState)(!1),X=J[0],$=J[1],ee=(0,B.Z)((function(){return X&&$(!1)})),ne=(0,r.useMemo)((function(){return g.metamask.chainId}),[g]);return(0,b.jsxs)(m.Z,{basic:!0,textAlign:"right",className:e.className,children:[a&&(0,b.jsx)(H,{size:"tiny",open:!0,user:g,toggleOpen:o}),(0,b.jsx)(z.Z.Group,{children:(0,b.jsxs)(z.Z,{style:{justifyContent:"flex-end",alignItems:"center"},children:[(0,b.jsx)(R.z,{space:20,size:24}),(0,b.jsx)("div",{className:"docs",onClick:function(){window.open("".concat(window.location.origin,"/docs/CrustFiles_Welcome"),"_blank")},children:(0,b.jsx)("span",{className:"cru-fo cru-fo-file-text"})}),(0,b.jsxs)("div",{ref:ee,style:{display:"flex",alignItems:"center",cursor:"pointer",position:"relative"},onClick:function(){return g&&"metamask"===g.wallet&&$(!X)},children:[(0,b.jsx)(z.Z.Image,{src:K(g),size:"tiny"}),(0,b.jsx)("div",{style:{fontSize:24,visibility:"metamask"===g.wallet?"visible":"hidden"},children:X?(0,b.jsx)(N.rH8,{}):(0,b.jsx)(N.bTu,{})}),X&&(0,b.jsx)("div",{style:{position:"absolute",top:"100%",zIndex:1e3,right:0,background:"white",boxShadow:"0 0.57rem 1.43rem 0 rgba(0, 0, 0, 0.1)",borderRadius:14,width:"max-content",gap:10,display:"flex",flexDirection:"column",border:"0.07rem solid #eeeeee",padding:16,whiteSpace:"nowrap"},children:V.map((function(e,n){return(0,b.jsxs)("div",{onClick:function(){ne!==e.chainId&&g.metamask.switchAndInstallChain({chainId:(0,O.eC)(e.chainId),chainName:e.chain.name,nativeCurrency:e.chain.nativeCurrency,rpcUrls:e.chain.rpcUrls.default.http,blockExplorerUrls:[e.chain.blockExplorers.default.url]}).catch((function(e){console.info("error:",e)}))},style:{display:"flex",gap:10,alignItems:"center",cursor:"pointer"},children:[(0,b.jsx)("img",{src:e.image,style:{height:24}}),(0,b.jsx)("span",{children:e.name}),(0,b.jsx)("div",{style:{flex:"1"}}),ne===e.chainId&&(0,b.jsx)(N.UgA,{style:{fontSize:24,color:"#FC7823"}})]},"mi_".concat(n))}))})]}),(0,b.jsx)(z.Z.Content,{verticalAlign:"middle",style:{flex:"unset",paddingLeft:"0.7rem"},children:(0,b.jsx)(P.Z,{pointing:"top right",icon:(0,b.jsx)("span",{className:"cru-fo cru-fo-chevron-down"}),basic:!0,text:g.nickName||h,children:(0,b.jsxs)(P.Z.Menu,{children:[(0,b.jsxs)(Y,{children:[(0,b.jsxs)("div",{className:"title-text",children:["Sign-in Wallet : ",null===(n=g.useWallet)||void 0===n?void 0:n.name]}),(0,b.jsxs)("div",{className:"sub-text",children:[x,(0,b.jsx)("span",{onClick:function(){return s(g.account)},className:"cru-fo cru-fo-copy"})]})]}),(0,b.jsx)(q,{}),(0,b.jsxs)(Y,{children:[d?(0,b.jsxs)("div",{className:"title-text primary",children:[(0,b.jsx)("strong",{children:g.nickName})," Premium User"]}):p?(0,b.jsxs)("div",{className:"title-text",children:[(0,b.jsx)("strong",{children:g.nickName})," Trial User ",G()]}):(0,b.jsx)("div",{className:"title-text",children:"Trial User"}),p?(0,b.jsxs)("div",{className:"sub-text",children:["Total Share-and-Earn Rewards: ",(0,b.jsx)("strong",{children:T})," CRU"]}):(0,b.jsx)("div",{className:"sub-text",children:G()})]}),(0,b.jsxs)(Q,{children:[w&&(0,b.jsx)("div",{className:"btn",onClick:function(){return o(!0)},children:"Switch Account"}),(0,b.jsx)("div",{className:"btn",onClick:v,children:"Log Out"})]})]})})})]})})]})})).withConfig({displayName:"User__StyleUser",componentId:"sc-sox225-3"})(["border-bottom:1px solid var(--line-color) !important;margin:unset !important;padding:1.1rem !important;width:100%;flex-shrink:0;.docs{margin-left:20px;display:inline-block;color:var(--secend-color);height:24px;margin-right:30px;cursor:pointer;font-size:24px;.cru-fo{position:relative;top:1px;margin-right:10px;}padding-right:30px;border-right:1px solid #eeeeee;}.tiny.image{width:50px !important;height:50px !important;margin-right:1rem !important;}.items > .item.tiny{width:4.3rem;}.ui.dropdown{.cru-fo{font-size:18px;margin-left:1.1rem;}.text{font-family:OpenSans-Medium;font-size:18px;}.menu::after{display:none;}.menu{background:#ffffff;box-shadow:0 0.57rem 1.43rem 0 rgba(0,0,0,0.1);border-radius:0.86rem;width:328px;border:0.07rem solid #eeeeee;padding:16px;margin-top:1.6rem !important;}}"]),ee=r.memo($);var ne=r.memo((0,i.ZP)((function(e){var n=e.path,t=e.className,r=e.children;return(0,b.jsx)(y,{path:n,className:t,children:(0,b.jsxs)(a.Oc,{className:"full",children:[(0,b.jsx)(ee,{}),(0,b.jsx)(a.oy,{className:"pusl_center_flex",children:(0,b.jsx)(a.Oc,{className:"pusl_center_flex_content",children:r})})]})})})).withConfig({displayName:"PageUserSideLayout",componentId:"sc-1wn03y0-0"})([".pusl_center_flex{width:100%;overflow:auto;flex:1;position:relative;}.pusl_center_flex_content{flex-shrink:0;max-width:90rem;width:100%;min-width:70rem;padding:2.29rem;height:max-content;}"]))},91302:function(e,n,t){t.d(n,{Cj:function(){return g},G3:function(){return b},JV:function(){return m},xe:function(){return x}});var r=t(94184),i=t.n(r),a=t(67294),o=t(54335),c=t(96486),s=t.n(c),l=t(85893),u=function(e,n){return"string"===typeof e?e:n?"".concat(s().round(e),"px"):"".concat(s().round(e,4),"rem")},d=function(e){return"number"===typeof e||e.endsWith("px")};var m=(0,o.ZP)((function(e){var n=e.className,t=e.position,r=void 0===t?"left":t,o=e.fullH,c=void 0!==o&&o,m=e.count,p=void 0===m?3:m,g=e.width,f=void 0===g?120:g,h=e.color,b=void 0===h?"#191919":h,x=e.fillColor,v=void 0===x?"#000000":x,w=e.type,_=void 0===w?2:w,k=c?p+1:p,y=d(f),j="number"===typeof f?f:s().toNumber(f.replace("px","").replace("rem","")),C=(0,a.useMemo)((function(){return j/k}),[f,k]),N=(0,a.useMemo)((function(){return(2*(k-1)+_)*C}),[k,_,C]),z=(0,a.useMemo)((function(){for(var e=[],n=0;n1&&void 0!==arguments[1]?arguments[1]:1;return Math.ceil(.725*e*n)},b=o.ZP.div.withConfig({displayName:"Pixels__PixelBtn1",componentId:"sc-1vz4at9-2"})(["color:white;font-family:'OpenSans-SemiBold';font-size:32px;line-height:","px;height:","px;text-align:center;width:357px;cursor:pointer;transition:all ease-in-out 200ms;background-image:url('/images/btn/btn_bg_l.png'),url('/images/btn/btn_bg_c.png'),url('/images/btn/btn_bg_r.png');background-position:0 0,","px 0,right center;background-repeat:no-repeat;background-attachment:scroll;background-size:","px 100%,calc(100% - ","px) 100%,","px 100%;&.dark{background-image:url('/images/btn/btn_dark_bg_l.png'),url('/images/btn/btn_dark_bg_c.png'),url('/images/btn/btn_dark_bg_r.png');}transform-origin:center top;&.style_left{transform-origin:right top;background-image:url('/images/btn/btn_bg_l.png'),url('/images/btn/btn_bg_c.png'),url('/images/btn/btn_bg_r2.png');&.dark{background-image:url('/images/btn/btn_dark_bg_l.png'),url('/images/btn/btn_dark_bg_c.png'),url('/images/btn/btn_dark_bg_r2.png');}}&.style_right{transform-origin:left top;background-image:url('/images/btn/btn_bg_l2.png'),url('/images/btn/btn_bg_c.png'),url('/images/btn/btn_bg_r.png');&.dark{background-image:url('/images/btn/btn_dark_bg_l2.png'),url('/images/btn/btn_dark_bg_c.png'),url('/images/btn/btn_dark_bg_r.png');}}@media screen and (max-width:1440px){transform:scale(0.9);}@media screen and (max-width:1296px){transform:scale(0.8);}"],(function(e){var n=e.height;return void 0===n?f:n}),(function(e){var n=e.height;return void 0===n?f:n}),(function(e){var n=e.height;return h(void 0===n?f:n)-2}),(function(e){var n=e.height;return h(void 0===n?f:n)}),(function(e){var n=e.height;return h(void 0===n?f:n,2)-4}),(function(e){var n=e.height;return h(void 0===n?f:n)})),x=o.ZP.div.attrs((function(e){return{board_size:e.board_size||12}})).withConfig({displayName:"Pixels__PixelBoard",componentId:"sc-1vz4at9-3"})(["padding:","px;background-repeat:no-repeat;background-size:calc(100% - ","px) ","px,calc(100% - ","px) ","px,","px calc(100% - ","px),","px calc(100% - ","px);background-position:","px top,","px bottom,left ","px,right ","px;background-image:linear-gradient(0deg,black,black),linear-gradient(0deg,black,black),linear-gradient(0deg,black,black),linear-gradient(0deg,black,black);"],(function(e){return e.board_size}),(function(e){return 2*e.board_size}),(function(e){return e.board_size}),(function(e){return 2*e.board_size}),(function(e){return e.board_size}),(function(e){return e.board_size}),(function(e){return 2*e.board_size}),(function(e){return e.board_size}),(function(e){return 2*e.board_size}),(function(e){return e.board_size}),(function(e){return e.board_size}),(function(e){return e.board_size}),(function(e){return e.board_size}))},31798:function(e,n,t){t.d(n,{V:function(){return c}});var r=t(67294),i=t(90356),a=t(20640),o=t.n(a);function c(){var e=(0,r.useContext)(i.Il).alert;return(0,r.useCallback)((function(n){o()(n),e.alert({msg:"Copied",type:"success"})}),[e])}},92080:function(e,n,t){t.d(n,{X:function(){return a}});var r=t(67294),i={};function a(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2?arguments[2]:void 0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:800,o=(0,r.useState)(),c=o[0],s=o[1],l=(0,r.useState)(!1),u=l[0],d=l[1];(0,r.useEffect)((function(){var e={cancel:!1};return p(e),function(){e.cancel=!0}}),n);var m=function(){if(t){var n=(new Date).getTime(),r=i[t],o=!r||n-r.time>a,c=o?e():r.get;return i[t]={time:o?n:r.time,get:c},c}return e()},p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cancel:!1};if(n.length&&n.some((function(e){return!e})))return Promise.resolve(c);s(void 0),d(!0);var r=m();return r.then?r.then((function(n){return t&&console.info("cache:",t,n),e.cancel||s(n),n})).catch(console.error).then((function(n){return e.cancel||d(!1),n})):void 0};return[c,p,u]}},26111:function(e,n,t){t.d(n,{S:function(){return s}});var r=t(16835),i=t(61509),a=t(69168),o=t(47687),c=t(92080);function s(){var e=(0,o.WY)(),n=e.account,t=e.wallet,s=e.member,l="crust"===t,u=(0,c.X)((function(){return(0,i.Y1)(n)}),[n,l],"getDeposit"),d=(0,r.Z)(u,3),m=d[0],p=d[1],g=d[2],f=(0,a.ms)({key:"deposit",value:m}).deposit,h=!!(f&&f.deposit&&f.deposit.id);return{isPremiumUser:!(!s||1!==s.member_state)||h,deposit:f,loading:g,depositDto:null===f||void 0===f?void 0:f.deposit,hasDeposit:h,doGetDeposit:p,isCrust:l,user:e}}},51542:function(e,n,t){t.d(n,{Z:function(){return i}});var r=t(67294);function i(e){var n=(0,r.useRef)(null),t=(0,r.useRef)(e);return(0,r.useLayoutEffect)((function(){t.current=e}),[e]),(0,r.useEffect)((function(){var e,r,i=function(e){console.info("handleClick:",!n.current,n.current===e.target,n.current.contains(e.target)),n.current&&n.current!==e.target&&!n.current.contains(e.target)&&t.current&&t.current(e)};return null===(e=document)||void 0===e||e.addEventListener("mousedown",i),null===(r=document)||void 0===r||r.addEventListener("touchstart",i),function(){var e,n;null===(e=document)||void 0===e||e.removeEventListener("mousedown",i),null===(n=document)||void 0===n||n.removeEventListener("touchend",i)}}),[n.current]),n}},77572:function(e,n,t){t.d(n,{O:function(){return i}});var r=t(67294);function i(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=(0,r.useState)(e),t=n[0],i=n[1],a=(0,r.useCallback)((function(e){i(void 0!==e?e:function(e){return!e})}),[]);return[t,a]}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[170],{19676:function(e,n,t){t.d(n,{y:function(){return s},z:function(){return l}});var r=t(54335),i=(t(67294),t(85893)),a=32,o=function(e){return"number"===typeof e?"".concat(e,"px"):e};function c(e){var n=e.className;return(0,i.jsxs)("div",{className:n,children:[(0,i.jsx)("a",{href:"https://discord.gg/XeY9FKBzdK",target:"_blank",rel:"noreferrer"}),(0,i.jsx)("a",{href:"https://twitter.com/CrustNetwork",target:"_blank",rel:"noreferrer"}),(0,i.jsx)("a",{href:"https://t.me/CrustNetwork",target:"_blank",rel:"noreferrer"}),(0,i.jsx)("a",{href:"https://crust.network",target:"_blank",rel:"noreferrer"})]})}var s=(0,r.ZP)(c).withConfig({displayName:"Links",componentId:"sc-1efqffp-0"})(["height:",";align-items:flex-start;flex-shrink:0;display:flex;a{margin-right:",";background-size:contain;background-repeat:no-repeat;background-position:center;width:",";height:",";}a:nth-child(1){background-image:url('/images/icon_discord.png');}a:nth-child(2){background-image:url('/images/icon_twitter.png');}a:nth-child(3){background-image:url('/images/icon_telegram.png');}a:nth-child(4){background-image:url('/images/icon_crust.png');}a:last-child{margin-right:0;}&.dark{filter:invert(80%);}"],(function(e){var n=e.size;return o(void 0===n?a:n)}),(function(e){var n=e.space;return o(void 0===n?40:n)}),(function(e){var n=e.size;return o(void 0===n?a:n)}),(function(e){var n=e.size;return o(void 0===n?a:n)})),l=(0,r.ZP)(c).withConfig({displayName:"Links__Links2",componentId:"sc-1efqffp-1"})(["height:",";align-items:flex-start;flex-shrink:0;display:flex;a{margin-right:",";background-size:contain;background-repeat:no-repeat;background-position:center;width:",";height:",";}a:nth-child(1){background-image:url('/images/icon_discord.svg');}a:nth-child(2){background-image:url('/images/icon_twitter.svg');}a:nth-child(3){background-image:url('/images/icon_telegram.svg');}a:nth-child(4){background-image:url('/images/icon_crust.svg');}a:last-child{margin-right:0;}"],(function(e){var n=e.size;return o(void 0===n?a:n)}),(function(e){var n=e.space;return o(void 0===n?40:n)}),(function(e){var n=e.size;return o(void 0===n?a:n)}),(function(e){var n=e.size;return o(void 0===n?a:n)}))},61708:function(e,n,t){var r=t(67294),i=t(54335),a=t(85893);n.Z=r.memo((0,i.ZP)((function(e){var n=e.src,t=void 0===n?"/images/logo_22x.png":n,r=e.className;return(0,a.jsx)("div",{className:r,children:(0,a.jsx)("img",{src:t})})})).withConfig({displayName:"Logo",componentId:"sc-lchex5-0"})(["display:inline-block;img{display:inline-block;height:2.5rem;width:auto;object-fit:contain;}span{font-size:2.45rem;font-weight:400;line-height:2.45rem;color:white;display:inline-block;}"]))},66170:function(e,n,t){t.d(n,{Z:function(){return ne}});var r=t(67294),i=t(54335),a=t(83966),o=t(59499),c=t(16835),s=t(94184),l=t.n(s),u=t(11163),d=t(61651),m=t(44623),p=t(18005),g=t(10720);var f=t(91302),h=t(61708),b=t(85893);function x(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function v(e){for(var n=1;n50){var e=C().chunk(n.accounts,50);return Promise.all(e.map((function(e){return(0,M.zv)(e)}))).then((function(e){return C().flatten(e)}))}return(0,M.zv)(n.accounts)}),[n.accounts,"crust"===n.wallet]),m=(0,c.Z)(d,1)[0],p=(0,r.useMemo)((function(){var e,t=C().keyBy(m||[],"address");return((null===(e=n.useWallet)||void 0===e?void 0:e.accounts)||[]).map((function(e){return{text:function(){return(0,b.jsxs)(b.Fragment,{children:[(0,D.lS)(e)," ",(0,b.jsx)("span",{style:{float:"right"},children:C().get(t,"".concat(e,".nick_name"),"")})]})},value:e}}))}),[n,m]);return(0,b.jsxs)(A.Z,X(X({closeIcon:(0,b.jsx)("span",{className:"close icon cru-fo-x"}),onClose:function(){return t(!1)}},i),{},{children:[(0,b.jsx)(A.Z.Header,{content:"Select Account"}),(0,b.jsxs)(A.Z.Content,{children:[(0,b.jsx)(P.Z,{fluid:!0,selection:!0,icon:(0,b.jsx)("span",{className:"icon cru-fo cru-fo-chevron-down"}),defaultValue:o,options:p,onChange:l}),(0,b.jsxs)("div",{className:"btns",children:[(0,b.jsx)(V.Z,{content:"Confirm",onClick:u}),(0,b.jsx)(V.Z,{content:"Cancel",onClick:function(){return t(!1)}})]})]})]}))})).withConfig({displayName:"ModalSelectAccount",componentId:"sc-h6smcy-0"})(["overflow:unset !important;width:34.3rem !important;.header{height:3.93rem;font-size:1.3rem !important;padding:0 1.14rem !important;font-weight:600 !important;line-height:3.93rem !important;border-top-right-radius:0.6rem !important;border-top-left-radius:0.6rem !important;}.close.icon{top:0.5rem;right:0.6rem;color:#666666;}.content{padding:1rem !important;border-bottom-right-radius:0.6rem !important;border-bottom-left-radius:0.6rem !important;.btns{padding-top:2.3rem;button{width:calc(50% - 0.5rem) !important;margin:unset;}button:first-child{margin-right:1rem;}}.ui.dropdown{border-radius:0.57rem !important;border:0.07rem solid #cccccc !important;box-shadow:unset !important;.icon{position:absolute;right:0.8rem;top:0.7rem;}.text{font-weight:500 !important;color:var(--main-color) !important;font-family:OpenSans-Medium sans-serif !important;}.menu{background:#ffffff;box-shadow:0 0.57rem 1.43rem 0 rgba(0,0,0,0.1) !important;border-radius:0.57rem !important;border:0.07rem solid #eeeeee !important;padding:unset !important;top:calc(100% + 0.6rem);.item{padding:1rem 0.8rem !important;border-radius:unset !important;border-top:1px solid #eeeeee;font-weight:500;color:var(--main-color) !important;font-family:OpenSans-Medium sans-serif;&:active{background-color:#eeeeee;}}.item:first-child{border-top:unset !important;}}}}"]));function K(e){switch(e.wallet){case"crust":return"/images/wallet_crust.png";case"polkadot-js":return"/images/group_wallet_polkadot.png";case"subWallet":return"/images/subwallet.png";case"metamask":return"/images/wallet_metamask.png";case"solana":return"/images/wallet_solana.png";case"elrond":return"/images/wallet_elrond.png";case"algorand":return"/images/wallet_algorand.png";case"metax":return"/images/wallet_metax.png";case"flow":return"/images/wallet_flow.png";case"aptos-martian":return"/images/martian.png";case"aptos-petra":return"/images/aptos.svg";case"talisman":return"/images/talisman.png";case"oasis":return"/images/oasis.png";case"wallet-connect":var n=C().get(e.walletConnect.connect,"peerMeta.icons");return C().size(n)?n[0]:"/images/wallet_connect.png";case"mimir":return"/images/wallet_mimir.svg";default:return""}}var Y=i.ZP.div.withConfig({displayName:"User__TwoText",componentId:"sc-sox225-0"})([".title-text{font-size:16px;line-height:24px;font-family:OpenSans-Medium;font-weight:500;color:var(--main-color);strong{font-family:OpenSans-SemiBold;color:black;}}.primary{color:var(--primary-color);}.go-to{cursor:pointer;&:nth-child(n + 2){margin-left:6px;}text-decoration:underline;color:var(--primary-color);font-size:10px;font-weight:normal;}.sub-text{font-size:12px;line-height:24px;font-family:OpenSans-Regular;color:var(--secend-color);strong{color:black;font-family:OpenSans-SemiBold;}.cru-fo{cursor:pointer;position:relative;top:4px;margin-left:8px;}}"]),q=i.ZP.div.withConfig({displayName:"User__Line",componentId:"sc-sox225-1"})(["width:100%;height:1px;background-color:#eeeeee;margin:12px 0;"]),Q=i.ZP.div.withConfig({displayName:"User__MBtns",componentId:"sc-sox225-2"})(["display:flex;margin-top:24px;.btn{flex:1;height:40px;line-height:40px;border:1px solid black;border-radius:8px;color:var(--main-color);font-size:16px;font-weight:500;cursor:pointer;text-align:center;}.btn:nth-child(2){margin-left:8px;}"]);var $=(0,i.ZP)((function(e){var n,t=(0,E.O)(),i=(0,c.Z)(t,2),a=i[0],o=i[1],s=(0,S.V)(),l=(0,I.S)(),d=l.isPremiumUser,p=l.isCrust,g=l.user,f=(0,r.useMemo)((function(){return[(0,D.lS)(g.account),(0,D.lS)(g.account,14)]}),[g]),h=f[0],x=f[1],v=(0,r.useCallback)(g.logout,[g]),w="crust"===g.wallet||"polkadot-js"===g.wallet,_=(0,E.O)(),k=(0,c.Z)(_,2),y=k[0],j=k[1];(0,r.useEffect)((function(){a&&j(!0)}),[a]);var C=(0,Z.X)((function(){return(0,M.zo)(g.account)}),[g.account,p,y],"getEarnRewards"),F=(0,c.Z)(C,1)[0],A=(0,U.ms)({key:"rewards",value:F}).rewards,T=(0,D.yn)(A,"total.total"),W=(0,u.useRouter)(),V=(0,r.useMemo)((function(){return[{name:"Ethereum",image:"/images/chain/ethereum.png",chainId:L.aB.mainnet.id,chain:L.aB.mainnet},{name:"Optimism",image:"/images/chain/optimism.png",chainId:L.aB.optimism.id,chain:L.aB.optimism},{name:"Arbitrum",image:"/images/chain/arbitrum.png",chainId:L.aB.arbitrum.id,chain:L.aB.arbitrum},{name:"zkSync",image:"/images/chain/zksync.png",chainId:L.aB.zkSync.id,chain:L.aB.zkSync},{name:"Blast",image:"/images/chain/blast.png",chainId:L.aB.blast.id,chain:L.aB.blast},{name:"Base",image:"/images/chain/base.png",chainId:L.aB.base.id,chain:L.aB.base},{name:"Crust EVM Parachain",image:"/images/chain/crust_evm_test.png",chainId:L.aB.crustEvmParachainTest.id,chain:L.aB.crustEvmParachainTest},{name:L.aB.u2uMainnet.name,image:"/images/chain/u2u.png",chainId:L.aB.u2uMainnet.id,chain:L.aB.u2uMainnet}]}),[]),G=function(){return(0,b.jsx)("span",{className:"go-to",onClick:function(){return W.push("/user")},children:"Get Premium"})},J=(0,r.useState)(!1),X=J[0],$=J[1],ee=(0,B.Z)((function(){return X&&$(!1)})),ne=(0,r.useMemo)((function(){return g.metamask.chainId}),[g]);return(0,b.jsxs)(m.Z,{basic:!0,textAlign:"right",className:e.className,children:[a&&(0,b.jsx)(H,{size:"tiny",open:!0,user:g,toggleOpen:o}),(0,b.jsx)(z.Z.Group,{children:(0,b.jsxs)(z.Z,{style:{justifyContent:"flex-end",alignItems:"center"},children:[(0,b.jsx)(R.z,{space:20,size:24}),(0,b.jsx)("div",{className:"docs",onClick:function(){window.open("".concat(window.location.origin,"/docs/CrustFiles_Welcome"),"_blank")},children:(0,b.jsx)("span",{className:"cru-fo cru-fo-file-text"})}),(0,b.jsxs)("div",{ref:ee,style:{display:"flex",alignItems:"center",cursor:"pointer",position:"relative"},onClick:function(){return g&&"metamask"===g.wallet&&$(!X)},children:[(0,b.jsx)(z.Z.Image,{src:K(g),size:"tiny"}),(0,b.jsx)("div",{style:{fontSize:24,visibility:"metamask"===g.wallet?"visible":"hidden"},children:X?(0,b.jsx)(N.rH8,{}):(0,b.jsx)(N.bTu,{})}),X&&(0,b.jsx)("div",{style:{position:"absolute",top:"100%",zIndex:1e3,right:0,background:"white",boxShadow:"0 0.57rem 1.43rem 0 rgba(0, 0, 0, 0.1)",borderRadius:14,width:"max-content",gap:10,display:"flex",flexDirection:"column",border:"0.07rem solid #eeeeee",padding:16,whiteSpace:"nowrap"},children:V.map((function(e,n){return(0,b.jsxs)("div",{onClick:function(){ne!==e.chainId&&g.metamask.switchAndInstallChain({chainId:(0,O.eC)(e.chainId),chainName:e.chain.name,nativeCurrency:e.chain.nativeCurrency,rpcUrls:e.chain.rpcUrls.default.http,blockExplorerUrls:[e.chain.blockExplorers.default.url]}).catch((function(e){console.info("error:",e)}))},style:{display:"flex",gap:10,alignItems:"center",cursor:"pointer"},children:[(0,b.jsx)("img",{src:e.image,style:{height:24}}),(0,b.jsx)("span",{children:e.name}),(0,b.jsx)("div",{style:{flex:"1"}}),ne===e.chainId&&(0,b.jsx)(N.UgA,{style:{fontSize:24,color:"#FC7823"}})]},"mi_".concat(n))}))})]}),(0,b.jsx)(z.Z.Content,{verticalAlign:"middle",style:{flex:"unset",paddingLeft:"0.7rem"},children:(0,b.jsx)(P.Z,{pointing:"top right",icon:(0,b.jsx)("span",{className:"cru-fo cru-fo-chevron-down"}),basic:!0,text:g.nickName||h,children:(0,b.jsxs)(P.Z.Menu,{children:[(0,b.jsxs)(Y,{children:[(0,b.jsxs)("div",{className:"title-text",children:["Sign-in Wallet : ",null===(n=g.useWallet)||void 0===n?void 0:n.name]}),(0,b.jsxs)("div",{className:"sub-text",children:[x,(0,b.jsx)("span",{onClick:function(){return s(g.account)},className:"cru-fo cru-fo-copy"})]})]}),(0,b.jsx)(q,{}),(0,b.jsxs)(Y,{children:[d?(0,b.jsxs)("div",{className:"title-text primary",children:[(0,b.jsx)("strong",{children:g.nickName})," Premium User"]}):p?(0,b.jsxs)("div",{className:"title-text",children:[(0,b.jsx)("strong",{children:g.nickName})," Trial User ",G()]}):(0,b.jsx)("div",{className:"title-text",children:"Trial User"}),p?(0,b.jsxs)("div",{className:"sub-text",children:["Total Share-and-Earn Rewards: ",(0,b.jsx)("strong",{children:T})," CRU"]}):(0,b.jsx)("div",{className:"sub-text",children:G()})]}),(0,b.jsxs)(Q,{children:[w&&(0,b.jsx)("div",{className:"btn",onClick:function(){return o(!0)},children:"Switch Account"}),(0,b.jsx)("div",{className:"btn",onClick:v,children:"Log Out"})]})]})})})]})})]})})).withConfig({displayName:"User__StyleUser",componentId:"sc-sox225-3"})(["border-bottom:1px solid var(--line-color) !important;margin:unset !important;padding:1.1rem !important;width:100%;flex-shrink:0;.docs{margin-left:20px;display:inline-block;color:var(--secend-color);height:24px;margin-right:30px;cursor:pointer;font-size:24px;.cru-fo{position:relative;top:1px;margin-right:10px;}padding-right:30px;border-right:1px solid #eeeeee;}.tiny.image{width:50px !important;height:50px !important;margin-right:1rem !important;}.items > .item.tiny{width:4.3rem;}.ui.dropdown{.cru-fo{font-size:18px;margin-left:1.1rem;}.text{font-family:OpenSans-Medium;font-size:18px;}.menu::after{display:none;}.menu{background:#ffffff;box-shadow:0 0.57rem 1.43rem 0 rgba(0,0,0,0.1);border-radius:0.86rem;width:328px;border:0.07rem solid #eeeeee;padding:16px;margin-top:1.6rem !important;}}"]),ee=r.memo($);var ne=r.memo((0,i.ZP)((function(e){var n=e.path,t=e.className,r=e.children;return(0,b.jsx)(y,{path:n,className:t,children:(0,b.jsxs)(a.Oc,{className:"full",children:[(0,b.jsx)(ee,{}),(0,b.jsx)(a.oy,{className:"pusl_center_flex",children:(0,b.jsx)(a.Oc,{className:"pusl_center_flex_content",children:r})})]})})})).withConfig({displayName:"PageUserSideLayout",componentId:"sc-1wn03y0-0"})([".pusl_center_flex{width:100%;overflow:auto;flex:1;position:relative;}.pusl_center_flex_content{flex-shrink:0;max-width:90rem;width:100%;min-width:70rem;padding:2.29rem;height:max-content;}"]))},91302:function(e,n,t){t.d(n,{Cj:function(){return g},G3:function(){return b},JV:function(){return m},xe:function(){return x}});var r=t(94184),i=t.n(r),a=t(67294),o=t(54335),c=t(96486),s=t.n(c),l=t(85893),u=function(e,n){return"string"===typeof e?e:n?"".concat(s().round(e),"px"):"".concat(s().round(e,4),"rem")},d=function(e){return"number"===typeof e||e.endsWith("px")};var m=(0,o.ZP)((function(e){var n=e.className,t=e.position,r=void 0===t?"left":t,o=e.fullH,c=void 0!==o&&o,m=e.count,p=void 0===m?3:m,g=e.width,f=void 0===g?120:g,h=e.color,b=void 0===h?"#191919":h,x=e.fillColor,v=void 0===x?"#000000":x,w=e.type,_=void 0===w?2:w,k=c?p+1:p,y=d(f),j="number"===typeof f?f:s().toNumber(f.replace("px","").replace("rem","")),C=(0,a.useMemo)((function(){return j/k}),[f,k]),N=(0,a.useMemo)((function(){return(2*(k-1)+_)*C}),[k,_,C]),z=(0,a.useMemo)((function(){for(var e=[],n=0;n1&&void 0!==arguments[1]?arguments[1]:1;return Math.ceil(.725*e*n)},b=o.ZP.div.withConfig({displayName:"Pixels__PixelBtn1",componentId:"sc-1vz4at9-2"})(["color:white;font-family:'OpenSans-SemiBold';font-size:32px;line-height:","px;height:","px;text-align:center;width:357px;cursor:pointer;transition:all ease-in-out 200ms;background-image:url('/images/btn/btn_bg_l.png'),url('/images/btn/btn_bg_c.png'),url('/images/btn/btn_bg_r.png');background-position:0 0,","px 0,right center;background-repeat:no-repeat;background-attachment:scroll;background-size:","px 100%,calc(100% - ","px) 100%,","px 100%;&.dark{background-image:url('/images/btn/btn_dark_bg_l.png'),url('/images/btn/btn_dark_bg_c.png'),url('/images/btn/btn_dark_bg_r.png');}transform-origin:center top;&.style_left{transform-origin:right top;background-image:url('/images/btn/btn_bg_l.png'),url('/images/btn/btn_bg_c.png'),url('/images/btn/btn_bg_r2.png');&.dark{background-image:url('/images/btn/btn_dark_bg_l.png'),url('/images/btn/btn_dark_bg_c.png'),url('/images/btn/btn_dark_bg_r2.png');}}&.style_right{transform-origin:left top;background-image:url('/images/btn/btn_bg_l2.png'),url('/images/btn/btn_bg_c.png'),url('/images/btn/btn_bg_r.png');&.dark{background-image:url('/images/btn/btn_dark_bg_l2.png'),url('/images/btn/btn_dark_bg_c.png'),url('/images/btn/btn_dark_bg_r.png');}}@media screen and (max-width:1440px){transform:scale(0.9);}@media screen and (max-width:1296px){transform:scale(0.8);}"],(function(e){var n=e.height;return void 0===n?f:n}),(function(e){var n=e.height;return void 0===n?f:n}),(function(e){var n=e.height;return h(void 0===n?f:n)-2}),(function(e){var n=e.height;return h(void 0===n?f:n)}),(function(e){var n=e.height;return h(void 0===n?f:n,2)-4}),(function(e){var n=e.height;return h(void 0===n?f:n)})),x=o.ZP.div.attrs((function(e){return{board_size:e.board_size||12}})).withConfig({displayName:"Pixels__PixelBoard",componentId:"sc-1vz4at9-3"})(["padding:","px;background-repeat:no-repeat;background-size:calc(100% - ","px) ","px,calc(100% - ","px) ","px,","px calc(100% - ","px),","px calc(100% - ","px);background-position:","px top,","px bottom,left ","px,right ","px;background-image:linear-gradient(0deg,black,black),linear-gradient(0deg,black,black),linear-gradient(0deg,black,black),linear-gradient(0deg,black,black);"],(function(e){return e.board_size}),(function(e){return 2*e.board_size}),(function(e){return e.board_size}),(function(e){return 2*e.board_size}),(function(e){return e.board_size}),(function(e){return e.board_size}),(function(e){return 2*e.board_size}),(function(e){return e.board_size}),(function(e){return 2*e.board_size}),(function(e){return e.board_size}),(function(e){return e.board_size}),(function(e){return e.board_size}),(function(e){return e.board_size}))},31798:function(e,n,t){t.d(n,{V:function(){return c}});var r=t(67294),i=t(90356),a=t(20640),o=t.n(a);function c(){var e=(0,r.useContext)(i.Il).alert;return(0,r.useCallback)((function(n){o()(n),e.alert({msg:"Copied",type:"success"})}),[e])}},92080:function(e,n,t){t.d(n,{X:function(){return a}});var r=t(67294),i={};function a(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2?arguments[2]:void 0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:800,o=(0,r.useState)(),c=o[0],s=o[1],l=(0,r.useState)(!1),u=l[0],d=l[1];(0,r.useEffect)((function(){var e={cancel:!1};return p(e),function(){e.cancel=!0}}),n);var m=function(){if(t){var n=(new Date).getTime(),r=i[t],o=!r||n-r.time>a,c=o?e():r.get;return i[t]={time:o?n:r.time,get:c},c}return e()},p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cancel:!1};if(n.length&&n.some((function(e){return!e})))return Promise.resolve(c);s(void 0),d(!0);var r=m();return r.then?r.then((function(n){return t&&console.info("cache:",t,n),e.cancel||s(n),n})).catch(console.error).then((function(n){return e.cancel||d(!1),n})):void 0};return[c,p,u]}},26111:function(e,n,t){t.d(n,{S:function(){return s}});var r=t(16835),i=t(61509),a=t(69168),o=t(98936),c=t(92080);function s(){var e=(0,o.WY)(),n=e.account,t=e.wallet,s=e.member,l="crust"===t,u=(0,c.X)((function(){return(0,i.Y1)(n)}),[n,l],"getDeposit"),d=(0,r.Z)(u,3),m=d[0],p=d[1],g=d[2],f=(0,a.ms)({key:"deposit",value:m}).deposit,h=!!(f&&f.deposit&&f.deposit.id);return{isPremiumUser:!(!s||1!==s.member_state)||h,deposit:f,loading:g,depositDto:null===f||void 0===f?void 0:f.deposit,hasDeposit:h,doGetDeposit:p,isCrust:l,user:e}}},51542:function(e,n,t){t.d(n,{Z:function(){return i}});var r=t(67294);function i(e){var n=(0,r.useRef)(null),t=(0,r.useRef)(e);return(0,r.useLayoutEffect)((function(){t.current=e}),[e]),(0,r.useEffect)((function(){var e,r,i=function(e){console.info("handleClick:",!n.current,n.current===e.target,n.current.contains(e.target)),n.current&&n.current!==e.target&&!n.current.contains(e.target)&&t.current&&t.current(e)};return null===(e=document)||void 0===e||e.addEventListener("mousedown",i),null===(r=document)||void 0===r||r.addEventListener("touchstart",i),function(){var e,n;null===(e=document)||void 0===e||e.removeEventListener("mousedown",i),null===(n=document)||void 0===n||n.removeEventListener("touchend",i)}}),[n.current]),n}},77572:function(e,n,t){t.d(n,{O:function(){return i}});var r=t(67294);function i(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=(0,r.useState)(e),t=n[0],i=n[1],a=(0,r.useCallback)((function(e){i(void 0!==e?e:function(e){return!e})}),[]);return[t,a]}}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/432-d3d864112ca84c96.js b/docs/_next/static/chunks/432-75487bd505c87cbb.js similarity index 99% rename from docs/_next/static/chunks/432-d3d864112ca84c96.js rename to docs/_next/static/chunks/432-75487bd505c87cbb.js index 15b23866..27ef19f6 100644 --- a/docs/_next/static/chunks/432-d3d864112ca84c96.js +++ b/docs/_next/static/chunks/432-75487bd505c87cbb.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[432],{32169:function(e,t,n){n.d(t,{U:function(){return l}});var r=n(67294),a=n(54335),i=n(20370),o=n(94184),s=n.n(o),c=n(85893);var l=r.memo((0,a.ZP)((function(e){var t=e.className,n=e.onClickUpFile,r=e.onClickUpFolder,a=e.disabled;return r?(0,c.jsx)(i.Z,{className:s()(t,{disabled:a}),pointing:"top",icon:null,basic:!0,text:"Upload",children:(0,c.jsxs)(i.Z.Menu,{children:[(0,c.jsx)(i.Z.Item,{text:"File",icon:(0,c.jsx)("span",{className:"icon cru-fo-file"}),onClick:n}),(0,c.jsx)(i.Z.Item,{text:"Folder",icon:(0,c.jsx)("span",{className:"icon cru-fo-folder"}),onClick:r})]})}):(0,c.jsx)("div",{className:s()("btn-upload",{disabled:a},t),onClick:n,children:"Upload"})})).withConfig({displayName:"BtnUpload",componentId:"sc-wp55x1-0"})(["&.btn-upload,&.ui.dropdown>.text.divider{padding:0 4.285714rem;font-family:OpenSans-Medium;font-size:2.571429rem;line-height:6.428571rem;cursor:pointer;border:2px solid #000000;box-sizing:border-box;border-radius:1.714286rem;}&.disabled{background:#EEEEEE;border:unset !important;color:#AAAAAA;cursor:not-allowed;}&.ui.dropdown{.cru-fo{font-size:1.3rem;margin-left:1.1rem;}.menu::after{display:none;}.menu{width:100%;background:#FFFFFF;box-shadow:0 0.57rem 1.43rem 0 rgba(0,0,0,0.1);border:1px solid #EEEEEE;border-radius:0.86rem;padding:0.57rem;.icon{margin-left:1.144286rem;margin-right:1.714286rem;}.item{padding:0.78rem 0.57rem !important;border-radius:0.57rem;font-size:1.285714rem;&:active{background-color:#EEEEEE;}}}}"]))},19636:function(e,t,n){n.d(t,{N:function(){return P}});var r=n(50029),a=n(87794),i=n.n(a),o=n(6169),s=n(9669),c=n.n(s),l=n(93162),u=n(56755),p=n.n(u),d=n(96486),f=n.n(d),m=n(67294),h=n(65927),g=n(33938),v=n(45150),y=n(54335),b=n(90356),x=n(51117),w=n(38558),k=n(31798),j=n(65572),Z=n(56593),C=n(61509),_=n(31031),S=n(62020),I=n(47687),N=n(98255),E=n(85893),P=["https://crustipfs.live","https://crustipfs.art","https://crustipfs.info","https://web3files.world","https://web3files.live","https://storagefiles.site","https://storagefiles.space","https://crustipfs.tech"];function A(e,t,n){return"".concat(n,"/ipfs/").concat(e.Hash,"?filename=").concat(e.Name)}function F(e,t){return z.apply(this,arguments)}function z(){return(z=(0,r.Z)(i().mark((function e(t,n){var r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,C.Cn)(t.Hash,{name:t.Name,encrypted:t.Encrypted,gateway:t.UpEndpoint,fromAccount:n.account,fromWallet:n.wallet,from:n.nickName,isDir:!!t.items});case 2:return r=e.sent,(0,Z.H)({type:3,walletType:n.wallet,address:n.account,data:{cid:t.Hash,fileType:t.items?1:0,strategy:t.Encrypted?1:0,shareType:0}}),e.abrupt("return","".concat(window.location.origin,"/share?code=").concat(r));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){try{return JSON.parse(JSON.stringify(e))}catch(t){return{expired_at:0,reported_replica_count:0,amount:0,file_size:0,prepaid:!1}}}t.Z=m.memo((0,y.ZP)((function(e){var t,n,a,s,u=e.file,d=e.className,y=e.uc,Z=e.onDelete,C=e.type,P="public"===(void 0===C?"public":C),z=(0,k.V)(),D=(0,m.useContext)(b.Il),T=D.api,H=D.alert,U=D.loading,B=(0,_.T)().endpoints,M=(0,j.z)().gateway,W=(0,m.useCallback)((0,r.Z)(i().mark((function e(){var t,n,r,a,o,s;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!u.Encrypted||0!==f().size(u.items)){e.next=29;break}if(e.prev=1,y.secret){e.next=4;break}return e.abrupt("return");case 4:return U.show(),t=A(u,0,M),e.next=8,c().get(t,{responseType:"arraybuffer"});case 8:return n=e.sent,console.info("res::",n),r=(new Date).getTime(),e.next=13,(0,x.n)(n.data,y.secret);case 13:if(a=e.sent,console.info("decrypt:",((new Date).getTime()-r)/1e3),a){e.next=17;break}throw"error";case 17:console.info("de:",a),o=new File([a],u.Name,{type:n.headers["content-type"]}),(0,l.saveAs)(o,u.Name),U.hide(),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(1),U.hide(),H.error("Decrypt error");case 27:e.next=31;break;case 29:s=A(u,0,M),window.open(s,"_blank");case 31:case"end":return e.stop()}}),e,null,[[1,23]])}))),[y,u,B,M]),R=(0,I.WY)(),$=function(){var e=(0,r.Z)(i().mark((function e(){var t;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,F(u,R);case 3:t=e.sent,window.open(t,"_blank"),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),H.error((0,S.az)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=(0,r.Z)(i().mark((function e(){var t,n,r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,F(u,R);case 3:t=e.sent,n=R.nickName?"Check out what '".concat(R.nickName,"' is sharing on Crust Files!"):"Check out what I am sharing on Crust Files!",r="https://twitter.com/intent/tweet?text=".concat(encodeURI(n),"&url=").concat(encodeURIComponent(t),"&hashtags=web3,ipfs,crustnetwork,metaverse,crustfiles"),window.open(r,"_blank"),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),H.error((0,S.az)(e.t0));case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}(),G=T&&(null===(t=T.query)||void 0===t?void 0:t.market)&&((0,o.m)(T.query.market.filesV2)?T.query.market.filesV2:T.query.market.files),q=T&&(null===(n=T.query)||void 0===n?void 0:n.market)&&T.query.market.files,V=!!G,Y=(0,w.W7)(G,[u.Hash]),J=(0,w.W7)(q,[u.Hash]),X=(0,w.W7)(null===T||void 0===T||null===(a=T.derive)||void 0===a||null===(s=a.chain)||void 0===s?void 0:s.bestNumber),K=X&&X.toNumber(),Q=(0,m.useMemo)((function(){var e={status:"Submitted"};if(J&&!J.isEmpty){var t=O(J),n=t.expired_at,r=t.reported_replica_count,a=t.amount,i=t.file_size,o=t.prepaid;e.expireTime=n,e.amount=a,e.startTime=n?n-216e3:0,e.fileSize=i,e.confirmedReplicas=r,e.prepaid=o,n&&nK&&r>0&&(e.status="Success")}else if(Y&&!Y.isEmpty){var s=O(Y),c=s.expired_at,l=s.reported_replica_count,p=s.amount,d=s.file_size,f=s.prepaid;e.expireTime=c,e.amount=p,e.startTime=c?c-216e3:0,e.fileSize=d,e.confirmedReplicas=l,e.prepaid=f,c&&cK&&l>0&&(e.status="Success")}else V&&(new Date).getTime()-u.PinTime>=72e5&&(e.status="Failed");return K||(e.status="Loading"),e}),[J,Y,K]);return(0,E.jsxs)(h.Z.Row,{className:d,children:[(0,E.jsxs)(h.Z.Cell,{className:"fileName",children:[(0,S.lS)(u.Name),u.items&&(0,E.jsx)("span",{className:"icon cru-fo-folder"}),u.Encrypted&&(0,E.jsx)(g.Z,{trigger:(0,E.jsx)("span",{className:"icon cru-fo-key"}),content:"Encrypted",position:"top center"})]}),(0,E.jsxs)(h.Z.Cell,{textAlign:"right",children:[(0,S.lS)(u.Hash),(0,E.jsx)(g.Z,{position:"top center",content:"Copy File CID",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-copy",onClick:function(){return z(u.Hash)},style:{marginLeft:"1.8rem"}})})]}),(0,E.jsx)(h.Z.Cell,{textAlign:"center",style:{textTransform:"uppercase"},children:p()(Number(u.Size),{round:2})}),(0,E.jsxs)(h.Z.Cell,{textAlign:"center",children:["Loading"===Q.status&&(0,E.jsx)(v.Z,{loading:!0,name:"spinner"}),"Submitted"===Q.status&&Q.status,"Expired"===Q.status&&Q.status,"Failed"===Q.status&&Q.status,"Success"===Q.status&&"".concat(Q.status," (").concat(Q.confirmedReplicas," Replicas)")]}),(0,E.jsxs)(h.Z.Cell,{textAlign:"center",children:[(0,E.jsx)(g.Z,{position:"top center",content:"Open",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-external-link",style:{marginLeft:"1rem"},onClick:W})}),(0,E.jsx)(g.Z,{position:"top center",content:"Delete",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-trash-2",style:{marginLeft:"1rem"},onClick:function(){Z(u)}})}),(0,E.jsx)(g.Z,{position:"top center",content:"IPFS Scan",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-search",style:{marginLeft:"1rem"},onClick:function(){window.open("https://ipfs-scan.io?cid=".concat(u.Hash),"_blank")}})})]}),P&&(0,E.jsx)(h.Z.Cell,{textAlign:"center",children:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(N.Z,{className:"item-share-btn",onClick:$,children:"Share"}),(0,E.jsx)(g.Z,{position:"top center",content:"Quick Tweet",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-twitter",onClick:L,style:{marginLeft:"0.5rem",top:"0.2rem"}})})]})})]})})).withConfig({displayName:"FileItem",componentId:"sc-3bbeav-0"})(["color:var(--secend-color) !important;.cru-fo,.icon{cursor:pointer;font-size:1.3rem;position:relative;top:0.3rem;}.fileName{.icon{margin-left:0.6rem;}}.item-share-btn{padding:5px 11px !important;border-radius:8px !important;}"]))},83234:function(e,t,n){n.d(t,{ZP:function(){return h}});var r=n(67294),a=n(65927),i=n(93598),o=n(45150),s=n(82675),c=n(96486),l=n.n(c);var u=n(19636),p=n(54335),d=n(11163),f=n(85893);var m=r.memo((0,p.ZP)((function(e){var t=e.className,n=e.pageCount,c=void 0===n?7:n,p=e.files,m=e.type,h=void 0===m?"public":m,g=e.onDeleteItem,v=(0,d.useRouter)(),y="public"===h,b=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=(0,r.useState)(1),a=n[0],i=n[1];return(0,r.useMemo)((function(){var n=l().chunk(e,t);return{totalPage:n.length,pageList:n[a-1]||[],setPage:i,page:a}}),[e,a])}((0,r.useMemo)((function(){return p.filter((function(e){return"public"===h?!e.Encrypted:e.Encrypted}))}),[p,h]),c),x=(0,s.MH)(),w=b.totalPage>1?2:5,k=y?w+1:w;return(0,f.jsxs)(a.Z,{basic:"very",className:t,children:[(0,f.jsx)(a.Z.Header,{className:"font-sans-semibold",children:(0,f.jsxs)(a.Z.Row,{children:[(0,f.jsx)(a.Z.HeaderCell,{children:"File Name"}),(0,f.jsx)(a.Z.HeaderCell,{width:"2",textAlign:"center",children:"File CID"}),(0,f.jsx)(a.Z.HeaderCell,{width:"2",textAlign:"center",children:"File Size"}),(0,f.jsx)(a.Z.HeaderCell,{width:"3",textAlign:"center",children:"Status"}),(0,f.jsx)(a.Z.HeaderCell,{width:"2",textAlign:"center",children:"Action"}),y&&(0,f.jsx)(a.Z.HeaderCell,{width:"2"})]})}),(0,f.jsx)(a.Z.Body,{className:"font-sans-regular",children:b.pageList.map((function(e,t){return(0,f.jsx)(u.Z,{type:h,onDelete:g,uc:x,file:e},"files_item_".concat(t))}))}),(0,f.jsx)(a.Z.Footer,{children:(0,f.jsxs)(a.Z.Row,{children:[(0,f.jsx)(a.Z.HeaderCell,{colSpan:k,className:"btns",children:(0,f.jsxs)("div",{className:"files-tip",children:["The file list is locally cached. If you want to keep this list when switching to another device, please go to ",(0,f.jsx)("span",{onClick:function(){return v.push("/setting")},children:"Settings->User Data Management"})," to migrate your user data."]})}),b.totalPage>1&&(0,f.jsx)(a.Z.HeaderCell,{colSpan:"3",textAlign:"right",children:(0,f.jsx)(i.Z,{totalPages:b.totalPage,activePage:b.page,firstItem:null,lastItem:null,prevItem:{content:(0,f.jsx)(o.Z,{name:"angle left"}),icon:!0},nextItem:{content:(0,f.jsx)(o.Z,{name:"angle right"}),icon:!0},secondary:!0,onPageChange:function(e,t){var n=t.activePage;return b.setPage(n)}})})]})})]})})).withConfig({displayName:"FilesTable",componentId:"sc-dquu9o-0"})(["padding:1rem 2rem;width:100%;thead{font-size:1.29rem;font-weight:600;th:first-child{padding-left:0.57rem !important;}th{border-bottom:unset !important;}}tbody{color:var(--secend-color);tr,td{border-top:unset !important;}tr > td:first-child{padding-left:0.57rem !important;}tr:nth-child(2n - 1){background-color:#f8f8f8;td:first-child{overflow:hidden;border-top-left-radius:0.57rem;border-bottom-left-radius:0.57rem;}td:last-child{overflow:hidden;border-top-right-radius:0.57rem;border-bottom-right-radius:0.57rem;}}}tfoot{.btns > button{margin-right:1rem !important;}th{border-top:unset !important;}.btns{span{cursor:pointer;color:#808080;}}.btns > i{color:var(--secend-color);cursor:pointer;}.pagination > .item{color:var(--secend-color);padding:0.8rem 1rem !important;min-width:unset !important;border-radius:5rem !important;margin:unset;}.files-tip{font-size:13px;line-height:22px;color:#999999;padding-left:0.57rem;span{color:var(--primary-color);}}}"])),h=m},51646:function(e,t,n){n.d(t,{R:function(){return x}});var r=n(16835),a=n(50029),i=n(87794),o=n.n(i),s=n(94184),c=n.n(s),l=n(67294),u=n(73935),p=n(54335),d=n(77572),f=n(85893);function m(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n .card{margin:0.5rem !important;.content > .header{font-size:1rem;font-weight:unset !important;color:var(--main-color);font-weight:600;font-family:OpenSans-SemiBold;}.content > .description{font-size:1rem;color:#999999;font-family:OpenSans-Regular;}}.ui.cards > .card:first-child{margin-top:1rem !important;}.toggle-options{cursor:pointer;font-size:10px;color:#999999;line-height:14px;margin-top:8px;margin-left:1.51rem;.cru-fo{font-size:14px;position:relative;top:2px;margin-left:6px;}}.actions{height:4.8rem;padding:0.5rem 1rem 0 1rem !important;border-top:unset !important;background:unset !important;.button{margin-left:unset !important;}}.uploading{height:4rem;display:flex;align-items:center;.progress{margin:0 1rem 0 0 !important;vertical-align:baseline;background:unset !important;border:1px solid orange;flex:1;.bar{min-width:unset !important;height:2.5rem;}}}.card.encryption{position:relative;.toggle{position:absolute;top:calc(50% - 0.75rem);right:1rem;input[type="radio"]:checked + label:before{background-color:#2ed158 !important;}}}']))},65572:function(e,t,n){n.d(t,{z:function(){return d}});var r=n(59499),a=n(16835),i=n(67294),o=n(58971),s=n.n(o),c=n(92080);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];l.current&&(l.current.webkitdirectory=e,l.current.multiple=e,l.current.click())}),[l]),p=(0,a.useCallback)((function(){return u(!1)}),[u]),d=(0,a.useCallback)((function(){return u(!0)}),[u]),f=(0,a.useCallback)((function(n){var a=n.target.files;if(a)if(a.length>2e3)t.alert({title:e("Upload"),msg:e("Please do not upload more than 2000 files"),type:"error"});else if(0!==a.length){if(n.target.webkitdirectory){if(a.length>=1){for(var i=[],o=0;o.text.divider{padding:0 4.285714rem;font-family:OpenSans-Medium;font-size:2.571429rem;line-height:6.428571rem;cursor:pointer;border:2px solid #000000;box-sizing:border-box;border-radius:1.714286rem;}&.disabled{background:#EEEEEE;border:unset !important;color:#AAAAAA;cursor:not-allowed;}&.ui.dropdown{.cru-fo{font-size:1.3rem;margin-left:1.1rem;}.menu::after{display:none;}.menu{width:100%;background:#FFFFFF;box-shadow:0 0.57rem 1.43rem 0 rgba(0,0,0,0.1);border:1px solid #EEEEEE;border-radius:0.86rem;padding:0.57rem;.icon{margin-left:1.144286rem;margin-right:1.714286rem;}.item{padding:0.78rem 0.57rem !important;border-radius:0.57rem;font-size:1.285714rem;&:active{background-color:#EEEEEE;}}}}"]))},19636:function(e,t,n){n.d(t,{N:function(){return P}});var r=n(50029),a=n(87794),i=n.n(a),o=n(6169),s=n(9669),c=n.n(s),l=n(93162),u=n(56755),p=n.n(u),d=n(96486),f=n.n(d),m=n(67294),h=n(65927),g=n(33938),v=n(45150),y=n(54335),b=n(90356),x=n(51117),w=n(38558),k=n(31798),j=n(65572),Z=n(56593),C=n(61509),_=n(31031),S=n(62020),I=n(98936),N=n(98255),E=n(85893),P=["https://crustipfs.live","https://crustipfs.art","https://crustipfs.info","https://web3files.world","https://web3files.live","https://storagefiles.site","https://storagefiles.space","https://crustipfs.tech"];function A(e,t,n){return"".concat(n,"/ipfs/").concat(e.Hash,"?filename=").concat(e.Name)}function F(e,t){return z.apply(this,arguments)}function z(){return(z=(0,r.Z)(i().mark((function e(t,n){var r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,C.Cn)(t.Hash,{name:t.Name,encrypted:t.Encrypted,gateway:t.UpEndpoint,fromAccount:n.account,fromWallet:n.wallet,from:n.nickName,isDir:!!t.items});case 2:return r=e.sent,(0,Z.H)({type:3,walletType:n.wallet,address:n.account,data:{cid:t.Hash,fileType:t.items?1:0,strategy:t.Encrypted?1:0,shareType:0}}),e.abrupt("return","".concat(window.location.origin,"/share?code=").concat(r));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){try{return JSON.parse(JSON.stringify(e))}catch(t){return{expired_at:0,reported_replica_count:0,amount:0,file_size:0,prepaid:!1}}}t.Z=m.memo((0,y.ZP)((function(e){var t,n,a,s,u=e.file,d=e.className,y=e.uc,Z=e.onDelete,C=e.type,P="public"===(void 0===C?"public":C),z=(0,k.V)(),D=(0,m.useContext)(b.Il),T=D.api,H=D.alert,U=D.loading,B=(0,_.T)().endpoints,M=(0,j.z)().gateway,W=(0,m.useCallback)((0,r.Z)(i().mark((function e(){var t,n,r,a,o,s;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!u.Encrypted||0!==f().size(u.items)){e.next=29;break}if(e.prev=1,y.secret){e.next=4;break}return e.abrupt("return");case 4:return U.show(),t=A(u,0,M),e.next=8,c().get(t,{responseType:"arraybuffer"});case 8:return n=e.sent,console.info("res::",n),r=(new Date).getTime(),e.next=13,(0,x.n)(n.data,y.secret);case 13:if(a=e.sent,console.info("decrypt:",((new Date).getTime()-r)/1e3),a){e.next=17;break}throw"error";case 17:console.info("de:",a),o=new File([a],u.Name,{type:n.headers["content-type"]}),(0,l.saveAs)(o,u.Name),U.hide(),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(1),U.hide(),H.error("Decrypt error");case 27:e.next=31;break;case 29:s=A(u,0,M),window.open(s,"_blank");case 31:case"end":return e.stop()}}),e,null,[[1,23]])}))),[y,u,B,M]),R=(0,I.WY)(),$=function(){var e=(0,r.Z)(i().mark((function e(){var t;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,F(u,R);case 3:t=e.sent,window.open(t,"_blank"),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),H.error((0,S.az)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=(0,r.Z)(i().mark((function e(){var t,n,r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,F(u,R);case 3:t=e.sent,n=R.nickName?"Check out what '".concat(R.nickName,"' is sharing on Crust Files!"):"Check out what I am sharing on Crust Files!",r="https://twitter.com/intent/tweet?text=".concat(encodeURI(n),"&url=").concat(encodeURIComponent(t),"&hashtags=web3,ipfs,crustnetwork,metaverse,crustfiles"),window.open(r,"_blank"),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),H.error((0,S.az)(e.t0));case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}(),G=T&&(null===(t=T.query)||void 0===t?void 0:t.market)&&((0,o.m)(T.query.market.filesV2)?T.query.market.filesV2:T.query.market.files),q=T&&(null===(n=T.query)||void 0===n?void 0:n.market)&&T.query.market.files,V=!!G,Y=(0,w.W7)(G,[u.Hash]),J=(0,w.W7)(q,[u.Hash]),X=(0,w.W7)(null===T||void 0===T||null===(a=T.derive)||void 0===a||null===(s=a.chain)||void 0===s?void 0:s.bestNumber),K=X&&X.toNumber(),Q=(0,m.useMemo)((function(){var e={status:"Submitted"};if(J&&!J.isEmpty){var t=O(J),n=t.expired_at,r=t.reported_replica_count,a=t.amount,i=t.file_size,o=t.prepaid;e.expireTime=n,e.amount=a,e.startTime=n?n-216e3:0,e.fileSize=i,e.confirmedReplicas=r,e.prepaid=o,n&&nK&&r>0&&(e.status="Success")}else if(Y&&!Y.isEmpty){var s=O(Y),c=s.expired_at,l=s.reported_replica_count,p=s.amount,d=s.file_size,f=s.prepaid;e.expireTime=c,e.amount=p,e.startTime=c?c-216e3:0,e.fileSize=d,e.confirmedReplicas=l,e.prepaid=f,c&&cK&&l>0&&(e.status="Success")}else V&&(new Date).getTime()-u.PinTime>=72e5&&(e.status="Failed");return K||(e.status="Loading"),e}),[J,Y,K]);return(0,E.jsxs)(h.Z.Row,{className:d,children:[(0,E.jsxs)(h.Z.Cell,{className:"fileName",children:[(0,S.lS)(u.Name),u.items&&(0,E.jsx)("span",{className:"icon cru-fo-folder"}),u.Encrypted&&(0,E.jsx)(g.Z,{trigger:(0,E.jsx)("span",{className:"icon cru-fo-key"}),content:"Encrypted",position:"top center"})]}),(0,E.jsxs)(h.Z.Cell,{textAlign:"right",children:[(0,S.lS)(u.Hash),(0,E.jsx)(g.Z,{position:"top center",content:"Copy File CID",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-copy",onClick:function(){return z(u.Hash)},style:{marginLeft:"1.8rem"}})})]}),(0,E.jsx)(h.Z.Cell,{textAlign:"center",style:{textTransform:"uppercase"},children:p()(Number(u.Size),{round:2})}),(0,E.jsxs)(h.Z.Cell,{textAlign:"center",children:["Loading"===Q.status&&(0,E.jsx)(v.Z,{loading:!0,name:"spinner"}),"Submitted"===Q.status&&Q.status,"Expired"===Q.status&&Q.status,"Failed"===Q.status&&Q.status,"Success"===Q.status&&"".concat(Q.status," (").concat(Q.confirmedReplicas," Replicas)")]}),(0,E.jsxs)(h.Z.Cell,{textAlign:"center",children:[(0,E.jsx)(g.Z,{position:"top center",content:"Open",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-external-link",style:{marginLeft:"1rem"},onClick:W})}),(0,E.jsx)(g.Z,{position:"top center",content:"Delete",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-trash-2",style:{marginLeft:"1rem"},onClick:function(){Z(u)}})}),(0,E.jsx)(g.Z,{position:"top center",content:"IPFS Scan",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-search",style:{marginLeft:"1rem"},onClick:function(){window.open("https://ipfs-scan.io?cid=".concat(u.Hash),"_blank")}})})]}),P&&(0,E.jsx)(h.Z.Cell,{textAlign:"center",children:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(N.Z,{className:"item-share-btn",onClick:$,children:"Share"}),(0,E.jsx)(g.Z,{position:"top center",content:"Quick Tweet",trigger:(0,E.jsx)("span",{className:"cru-fo cru-fo-twitter",onClick:L,style:{marginLeft:"0.5rem",top:"0.2rem"}})})]})})]})})).withConfig({displayName:"FileItem",componentId:"sc-3bbeav-0"})(["color:var(--secend-color) !important;.cru-fo,.icon{cursor:pointer;font-size:1.3rem;position:relative;top:0.3rem;}.fileName{.icon{margin-left:0.6rem;}}.item-share-btn{padding:5px 11px !important;border-radius:8px !important;}"]))},83234:function(e,t,n){n.d(t,{ZP:function(){return h}});var r=n(67294),a=n(65927),i=n(93598),o=n(45150),s=n(82675),c=n(96486),l=n.n(c);var u=n(19636),p=n(54335),d=n(11163),f=n(85893);var m=r.memo((0,p.ZP)((function(e){var t=e.className,n=e.pageCount,c=void 0===n?7:n,p=e.files,m=e.type,h=void 0===m?"public":m,g=e.onDeleteItem,v=(0,d.useRouter)(),y="public"===h,b=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=(0,r.useState)(1),a=n[0],i=n[1];return(0,r.useMemo)((function(){var n=l().chunk(e,t);return{totalPage:n.length,pageList:n[a-1]||[],setPage:i,page:a}}),[e,a])}((0,r.useMemo)((function(){return p.filter((function(e){return"public"===h?!e.Encrypted:e.Encrypted}))}),[p,h]),c),x=(0,s.MH)(),w=b.totalPage>1?2:5,k=y?w+1:w;return(0,f.jsxs)(a.Z,{basic:"very",className:t,children:[(0,f.jsx)(a.Z.Header,{className:"font-sans-semibold",children:(0,f.jsxs)(a.Z.Row,{children:[(0,f.jsx)(a.Z.HeaderCell,{children:"File Name"}),(0,f.jsx)(a.Z.HeaderCell,{width:"2",textAlign:"center",children:"File CID"}),(0,f.jsx)(a.Z.HeaderCell,{width:"2",textAlign:"center",children:"File Size"}),(0,f.jsx)(a.Z.HeaderCell,{width:"3",textAlign:"center",children:"Status"}),(0,f.jsx)(a.Z.HeaderCell,{width:"2",textAlign:"center",children:"Action"}),y&&(0,f.jsx)(a.Z.HeaderCell,{width:"2"})]})}),(0,f.jsx)(a.Z.Body,{className:"font-sans-regular",children:b.pageList.map((function(e,t){return(0,f.jsx)(u.Z,{type:h,onDelete:g,uc:x,file:e},"files_item_".concat(t))}))}),(0,f.jsx)(a.Z.Footer,{children:(0,f.jsxs)(a.Z.Row,{children:[(0,f.jsx)(a.Z.HeaderCell,{colSpan:k,className:"btns",children:(0,f.jsxs)("div",{className:"files-tip",children:["The file list is locally cached. If you want to keep this list when switching to another device, please go to ",(0,f.jsx)("span",{onClick:function(){return v.push("/setting")},children:"Settings->User Data Management"})," to migrate your user data."]})}),b.totalPage>1&&(0,f.jsx)(a.Z.HeaderCell,{colSpan:"3",textAlign:"right",children:(0,f.jsx)(i.Z,{totalPages:b.totalPage,activePage:b.page,firstItem:null,lastItem:null,prevItem:{content:(0,f.jsx)(o.Z,{name:"angle left"}),icon:!0},nextItem:{content:(0,f.jsx)(o.Z,{name:"angle right"}),icon:!0},secondary:!0,onPageChange:function(e,t){var n=t.activePage;return b.setPage(n)}})})]})})]})})).withConfig({displayName:"FilesTable",componentId:"sc-dquu9o-0"})(["padding:1rem 2rem;width:100%;thead{font-size:1.29rem;font-weight:600;th:first-child{padding-left:0.57rem !important;}th{border-bottom:unset !important;}}tbody{color:var(--secend-color);tr,td{border-top:unset !important;}tr > td:first-child{padding-left:0.57rem !important;}tr:nth-child(2n - 1){background-color:#f8f8f8;td:first-child{overflow:hidden;border-top-left-radius:0.57rem;border-bottom-left-radius:0.57rem;}td:last-child{overflow:hidden;border-top-right-radius:0.57rem;border-bottom-right-radius:0.57rem;}}}tfoot{.btns > button{margin-right:1rem !important;}th{border-top:unset !important;}.btns{span{cursor:pointer;color:#808080;}}.btns > i{color:var(--secend-color);cursor:pointer;}.pagination > .item{color:var(--secend-color);padding:0.8rem 1rem !important;min-width:unset !important;border-radius:5rem !important;margin:unset;}.files-tip{font-size:13px;line-height:22px;color:#999999;padding-left:0.57rem;span{color:var(--primary-color);}}}"])),h=m},51646:function(e,t,n){n.d(t,{R:function(){return x}});var r=n(16835),a=n(50029),i=n(87794),o=n.n(i),s=n(94184),c=n.n(s),l=n(67294),u=n(73935),p=n(54335),d=n(77572),f=n(85893);function m(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n .card{margin:0.5rem !important;.content > .header{font-size:1rem;font-weight:unset !important;color:var(--main-color);font-weight:600;font-family:OpenSans-SemiBold;}.content > .description{font-size:1rem;color:#999999;font-family:OpenSans-Regular;}}.ui.cards > .card:first-child{margin-top:1rem !important;}.toggle-options{cursor:pointer;font-size:10px;color:#999999;line-height:14px;margin-top:8px;margin-left:1.51rem;.cru-fo{font-size:14px;position:relative;top:2px;margin-left:6px;}}.actions{height:4.8rem;padding:0.5rem 1rem 0 1rem !important;border-top:unset !important;background:unset !important;.button{margin-left:unset !important;}}.uploading{height:4rem;display:flex;align-items:center;.progress{margin:0 1rem 0 0 !important;vertical-align:baseline;background:unset !important;border:1px solid orange;flex:1;.bar{min-width:unset !important;height:2.5rem;}}}.card.encryption{position:relative;.toggle{position:absolute;top:calc(50% - 0.75rem);right:1rem;input[type="radio"]:checked + label:before{background-color:#2ed158 !important;}}}']))},65572:function(e,t,n){n.d(t,{z:function(){return d}});var r=n(59499),a=n(16835),i=n(67294),o=n(58971),s=n.n(o),c=n(92080);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];l.current&&(l.current.webkitdirectory=e,l.current.multiple=e,l.current.click())}),[l]),p=(0,a.useCallback)((function(){return u(!1)}),[u]),d=(0,a.useCallback)((function(){return u(!0)}),[u]),f=(0,a.useCallback)((function(n){var a=n.target.files;if(a)if(a.length>2e3)t.alert({title:e("Upload"),msg:e("Please do not upload more than 2000 files"),type:"error"});else if(0!==a.length){if(n.target.webkitdirectory){if(a.length>=1){for(var i=[],o=0;o",LookupSource:"AccountId"}}},80663:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{EraBenefits:{total_fee_reduction_quota:"Compact",total_market_active_funds:"Compact",used_fee_reduction_quota:"Compact",active_era:"Compact"},FundsType:{_enum:["SWORK","MARKET"]},FundsUnlockChunk:{value:"Compact",era:"Compact"},MarketBenefit:{total_funds:"Compact",active_funds:"Compact",used_fee_reduction_quota:"Compact",file_reward:"Compact",refreshed_at:"Compact",unlocking_funds:"Vec>"},SworkBenefit:{total_funds:"Compact",active_funds:"Compact",total_fee_reduction_count:"u32",used_fee_reduction_count:"u32",refreshed_at:"Compact",unlocking_funds:"Vec>"}}}},50503:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{BridgeChainId:"u8",ChainId:"u8",ResourceId:"H256",DepositNonce:"u64",ProposalStatus:{_enum:["Initiated","Approved","Rejected"]},ProposalVotes:{votes_for:"Vec",votes_against:"Vec",status:"ProposalStatus",expiry:"BlockNumber"},Erc721Token:{id:"TokenId",metadata:"Vec"},TokenId:"U256"}}},65664:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{ETHAddress:"Vec",EthereumTxHash:"H256"}}},27774:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.typesBundleForPolkadot=t.typesAlias=t.rpc=t.types=t.crustTypes=void 0;const i=r(n(9609)),o=r(n(80663)),s=r(n(50503)),a=r(n(65664)),c=n(16450),u=r(n(72252)),l=r(n(22397)),d=r(n(23426)),f=r(n(78424));t.crustTypes={base:i.default,benefit:o.default,bridge:s.default,claims:a.default,locks:u.default,market:l.default,staking:d.default,swork:f.default},t.types=Object.assign({},c.typesFromDefs(t.crustTypes)),t.rpc=c.jsonrpcFromDefs(t.crustTypes),t.typesAlias=c.typesAliasFromDefs(t.crustTypes);const h={rpc:t.rpc,types:[{minmax:[void 0,void 0],types:Object.assign({},t.types)}],alias:t.typesAlias};t.typesBundleForPolkadot={spec:{crust:h}}},72252:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{Lock:{total:"Compact",last_unlock_at:"BlockNumber",lock_type:"LockType"},LockType:{delay:"BlockNumber",lock_period:"u32"}}}},22397:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{FileInfo:{file_size:"u64",spower:"u64",expired_at:"BlockNumber",calculated_at:"BlockNumber",amount:"Compact",prepaid:"Compact",reported_replica_count:"u32",replicas:"Vec>"},FileInfoV2:{file_size:"u64",spower:"u64",expired_at:"BlockNumber",calculated_at:"BlockNumber",amount:"Compact",prepaid:"Compact",reported_replica_count:"u32",remaining_paid_count:"u32",replicas:"BTreeMap>"},Replica:{who:"AccountId",valid_at:"BlockNumber",anchor:"SworkerAnchor",is_reported:"bool",created_at:"Option"}}}},23426:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{Guarantee:{targets:"Vec>",total:"Compact",submitted_in:"EraIndex",suppressed:"bool"},ValidatorPrefs:{guarantee_fee:"Compact"}}}},78424:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{Group:{members:"BTreeSet",allowlist:"BTreeSet"},IASSig:"Vec",Identity:{anchor:"SworkerAnchor",punishment_deadline:"u64",group:"Option"},ISVBody:"Vec",MerkleRoot:"Vec",ReportSlot:"u64",PKInfo:{code:"SworkerCode",anchor:"Option"},SworkerAnchor:"Vec",SworkerCert:"Vec",SworkerCode:"Vec",SworkerPubKey:"Vec",SworkerSignature:"Vec",WorkReport:{report_slot:"u64",spower:"u64",free:"u64",reported_files_size:"u64",reported_srd_root:"MerkleRoot",reported_files_root:"MerkleRoot"}}}},81556:function(e,t,n){"use strict";n.d(t,{Sg:function(){return c},zt:function(){return u}});var r=n(2593),i=n(6881),o=n(1581);var s=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const a=new o.Logger("abstract-provider/5.7.0");class c extends i.Description{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class u{constructor(){a.checkAbstract(new.target,u),(0,i.defineReadOnly)(this,"_isProvider",!0)}getFeeData(){return s(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield(0,i.resolveProperties)({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let n=null,o=null,s=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,s=r.O$.from("1500000000"),o=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:n,maxFeePerGas:o,maxPriorityFeePerGas:s,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}},48088:function(e,t,n){"use strict";n.d(t,{E:function(){return u},b:function(){return l}});var r=n(6881),i=n(1581);var o=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const s=new i.Logger("abstract-signer/5.7.0"),a=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],c=[i.Logger.errors.INSUFFICIENT_FUNDS,i.Logger.errors.NONCE_EXPIRED,i.Logger.errors.REPLACEMENT_UNDERPRICED];class u{constructor(){s.checkAbstract(new.target,u),(0,r.defineReadOnly)(this,"_isSigner",!0)}getBalance(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return o(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield(0,r.resolveProperties)(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return o(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield(0,r.resolveProperties)(this.checkTransaction(e));return yield this.provider.call(n,t)}))}sendTransaction(e){return o(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),n=yield this.signTransaction(t);return yield this.provider.sendTransaction(n)}))}getChainId(){return o(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const n in e)-1===a.indexOf(n)&&s.throwArgumentError("invalid transaction key: "+n,"transaction",e);const t=(0,r.shallowCopy)(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&s.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return o(this,void 0,void 0,(function*(){const t=yield(0,r.resolveProperties)(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>o(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&s.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const n=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!n?0!==t.type&&1!==t.type||!n||s.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):s.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(n&&s.throwError("network does not support EIP-1559",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):s.throwError("failed to get consistent fee data",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(c.indexOf(e.code)>=0)throw e;return s.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&s.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield(0,r.resolveProperties)(t)}))}_checkProvider(e){this.provider||s.throwError("missing provider",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class l extends u{constructor(e,t){super(),(0,r.defineReadOnly)(this,"address",e),(0,r.defineReadOnly)(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{s.throwError(e,i.Logger.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new l(this.address,e)}}},19485:function(e,t,n){"use strict";n.r(t),n.d(t,{getAddress:function(){return h},getContractAddress:function(){return m},getCreate2Address:function(){return b},getIcapAddress:function(){return g},isAddress:function(){return p}});var r=n(16441),i=n(2593),o=n(38197),s=n(59052);const a=new(n(1581).Logger)("address/5.7.0");function c(e){(0,r.isHexString)(e,20)||a.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let r=0;r<40;r++)n[r]=t[r].charCodeAt(0);const i=(0,r.arrayify)((0,o.keccak256)(n));for(let r=0;r<40;r+=2)i[r>>1]>>4>=8&&(t[r]=t[r].toUpperCase()),(15&i[r>>1])>=8&&(t[r+1]=t[r+1].toUpperCase());return"0x"+t.join("")}const u={};for(let y=0;y<10;y++)u[String(y)]=String(y);for(let y=0;y<26;y++)u[String.fromCharCode(65+y)]=String(10+y);const l=Math.floor((d=9007199254740991,Math.log10?Math.log10(d):Math.log(d)/Math.LN10));var d;function f(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>u[e])).join("");for(;t.length>=l;){let e=t.substring(0,l);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}function h(e){let t=null;if("string"!==typeof e&&a.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=c(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&a.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==f(e)&&a.throwArgumentError("bad icap checksum","address",e),t=(0,i.g$)(e.substring(4));t.length<40;)t="0"+t;t=c("0x"+t)}else a.throwArgumentError("invalid address","address",e);return t}function p(e){try{return h(e),!0}catch(t){}return!1}function g(e){let t=(0,i.t2)(h(e).substring(2)).toUpperCase();for(;t.length<30;)t="0"+t;return"XE"+f("XE00"+t)+t}function m(e){let t=null;try{t=h(e.from)}catch(c){a.throwArgumentError("missing from address","transaction",e)}const n=(0,r.stripZeros)((0,r.arrayify)(i.O$.from(e.nonce).toHexString()));return h((0,r.hexDataSlice)((0,o.keccak256)((0,s.encode)([t,n])),12))}function b(e,t,n){return 32!==(0,r.hexDataLength)(t)&&a.throwArgumentError("salt must be 32 bytes","salt",t),32!==(0,r.hexDataLength)(n)&&a.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",n),h((0,r.hexDataSlice)((0,o.keccak256)((0,r.concat)(["0xff",h(e),t,n])),12))}},59567:function(e,t,n){"use strict";n.d(t,{J:function(){return i},c:function(){return o}});var r=n(16441);function i(e){e=atob(e);const t=[];for(let n=0;n0;)n.push(e%this.base),e=e/this.base|0}let i="";for(let r=0;0===t[r]&&r=0;--r)i+=this.alphabet[n[r]];return i}decode(e){if("string"!==typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let n=0;n>=8;for(;i>0;)t.push(255&i),i>>=8}for(let n=0;e[n]===this._leader&&n0&&(10===arguments[0]?h||(h=!0,u.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?u.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",s.Logger.errors.UNEXPECTED_ARGUMENT,{}):u.throwError("BigNumber.toString does not accept parameters",s.Logger.errors.UNEXPECTED_ARGUMENT,{})),b(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof p)return e;if("string"===typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new p(l,g(e)):e.match(/^-?[0-9]+$/)?new p(l,g(new c(e))):u.throwArgumentError("invalid BigNumber string","value",e);if("number"===typeof e)return e%1&&y("underflow","BigNumber.from",e),(e>=d||e<=-d)&&y("overflow","BigNumber.from",e),p.from(String(e));const t=e;if("bigint"===typeof t)return p.from(t.toString());if((0,o.isBytes)(t))return p.from((0,o.hexlify)(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"===typeof e)return p.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"===typeof e&&((0,o.isHexString)(e)||"-"===e[0]&&(0,o.isHexString)(e.substring(1))))return p.from(e)}return u.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function g(e){if("string"!==typeof e)return g(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&u.throwArgumentError("invalid hex","value",e),"0x00"===(e=g(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function m(e){return p.from(g(e))}function b(e){const t=p.from(e).toHexString();return"-"===t[0]?new c("-"+t.substring(3),16):new c(t.substring(2),16)}function y(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),u.throwError(e,s.Logger.errors.NUMERIC_FAULT,r)}function v(e){return new c(e,36).toString(16)}function w(e){return new c(e,16).toString(36)}},83877:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:n(88677).Buffer}catch(k){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,c=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch(k){o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=p[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modrn(l).toString(e);n=(d=d.idivn(l)).isZero()?g+n:f[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function b(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(e,t,n){return b(e,t,n)}function v(e,t){this.x=e,this.y=t}Math.imul||(m=g),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?g(this,e,t):n<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},v.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new C(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}x.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(S,x),S.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new A;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return w[e]=t,t},C.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},C.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},C.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},C.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},C.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},C.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},C.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},C.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},C.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new I(e)},i(I,C),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},16441:function(e,t,n){"use strict";n.r(t),n.d(t,{arrayify:function(){return u},concat:function(){return l},hexConcat:function(){return y},hexDataLength:function(){return m},hexDataSlice:function(){return b},hexStripZeros:function(){return w},hexValue:function(){return v},hexZeroPad:function(){return x},hexlify:function(){return g},isBytes:function(){return c},isBytesLike:function(){return s},isHexString:function(){return h},joinSignature:function(){return A},splitSignature:function(){return S},stripZeros:function(){return d},zeroPad:function(){return f}});const r=new(n(1581).Logger)("bytes/5.7.0");function i(e){return!!e.toHexString}function o(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function s(e){return h(e)&&!(e.length%2)||c(e)}function a(e){return"number"===typeof e&&e==e&&e%1===0}function c(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!a(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function u(e,t){if(t||(t={}),"number"===typeof e){r.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),o(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e)&&(e=e.toHexString()),h(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":r.throwArgumentError("hex data is odd-length","value",e));const i=[];for(let e=0;eu(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),o(r)}function d(e){let t=u(e);if(0===t.length)return t;let n=0;for(;nt&&r.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),o(n)}function h(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const p="0123456789abcdef";function g(e,t){if(t||(t={}),"number"===typeof e){r.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=p[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"===typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e))return e.toHexString();if(h(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":r.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(c(e)){let t="0x";for(let n=0;n>4]+p[15&r]}return t}return r.throwArgumentError("invalid hexlify value","value",e)}function m(e){if("string"!==typeof e)e=g(e);else if(!h(e)||e.length%2)return null;return(e.length-2)/2}function b(e,t,n){return"string"!==typeof e?e=g(e):(!h(e)||e.length%2)&&r.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function y(e){let t="0x";return e.forEach((e=>{t+=g(e).substring(2)})),t}function v(e){const t=w(g(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function w(e){"string"!==typeof e&&(e=g(e)),h(e)||r.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t2*t+2&&r.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function S(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(s(e)){let n=u(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=g(n.slice(0,32)),t.s=g(n.slice(32,64))):65===n.length?(t.r=g(n.slice(0,32)),t.s=g(n.slice(32,64)),t.v=n[64]):r.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:r.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=g(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=f(u(t._vs),32);t._vs=g(n);const i=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&r.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const o=g(n);null==t.s?t.s=o:t.s!==o&&r.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?r.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&r.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&h(t.r)?t.r=x(t.r,32):r.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&h(t.s)?t.s=x(t.s,32):r.throwArgumentError("signature missing or invalid s","signature",e);const n=u(t.s);n[0]>=128&&r.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const i=g(n);t._vs&&(h(t._vs)||r.throwArgumentError("signature invalid _vs","signature",e),t._vs=x(t._vs,32)),null==t._vs?t._vs=i:t._vs!==i&&r.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function A(e){return g(l([(e=S(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},21046:function(e,t,n){"use strict";n.d(t,{Bz:function(){return a},_Y:function(){return o},fh:function(){return s},tL:function(){return i}});var r=n(2593);const i=r.O$.from(-1),o=r.O$.from(0),s=r.O$.from(1),a=r.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},57218:function(e,t,n){"use strict";n.d(t,{R:function(){return r}});const r="0x0000000000000000000000000000000000000000000000000000000000000000"},35644:function(e,t,n){"use strict";n.d(t,{i:function(){return r}});const r="hash/5.7.0"},32046:function(e,t,n){"use strict";n.d(t,{id:function(){return o}});var r=n(38197),i=n(29251);function o(e){return(0,r.keccak256)((0,i.Y0)(e))}},93684:function(e,t,n){"use strict";n.d(t,{B:function(){return s},r:function(){return a}});var r=n(16441),i=n(38197),o=n(29251);const s="\x19Ethereum Signed Message:\n";function a(e){return"string"===typeof e&&(e=(0,o.Y0)(e)),(0,i.keccak256)((0,r.concat)([(0,o.Y0)(s),(0,o.Y0)(String(e.length)),e]))}},27586:function(e,t,n){"use strict";n.d(t,{Kn:function(){return N},w3:function(){return P},r1:function(){return O},VM:function(){return R}});var r=n(16441),i=n(29251),o=n(38197),s=n(1581),a=n(35644);function c(e,t){null==t&&(t=1);const n=[],r=n.forEach,i=function(e,t){r.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):n.push(e)}))};return i(e,t),n}function u(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function n(){return e[t++]<<8|e[t++]}let r=n(),i=1,o=[0,1];for(let w=1;w>--c&1}const d=Math.pow(2,31),f=d>>>1,h=f>>1,p=d-1;let g=0;for(let w=0;w<31;w++)g=g<<1|l();let m=[],b=0,y=d;for(;;){let e=Math.floor(((g-b+1)*i-1)/y),t=0,n=r;for(;n-t>1;){let r=t+n>>>1;e>>1|l(),s=s<<1^f,a=(a^f)<<1|f|1;b=s,y=1+a-s}let v=r-4;return m.map((t=>{switch(t-v){case 3:return v+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return v+256+(e[a++]<<8|e[a++]);case 1:return v+e[a++];default:return t-1}}))}(e))}function l(e){return 1&e?~e>>1:e>>1}function d(e,t){let n=Array(e);for(let r=0,i=-1;rt[e])):n}function p(e,t,n){let r=Array(e).fill(void 0).map((()=>[]));for(let i=0;ir[t].push(e)));return r}function g(e,t){let n=1+t(),r=t(),i=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(n)}return t}(t);return c(p(i.length,1+e,t).map(((e,t)=>{const o=e[0],s=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*r;return[o+t*n,s.map((e=>e+i))]}))})))}function m(e,t){return p(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const b=u((0,n(59567).J)("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),y=new Set(h(b)),v=new Set(h(b)),w=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(g(n,e))}for(;;){let n=e()-1;if(n<0)break;t.push(m(n,e))}return function(e){const t={};for(let n=0;ne-t));return function n(){let r=[];for(;;){let i=h(e,t);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((e,t)=>t.set.size-e.set.size));let i=e(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:r,valid:o,fe0f:s,save:1==i,check:2==i}}()}(b);function S(e){return(0,i.XL)(e)}function A(e){return e.filter((e=>65039!=e))}function E(e){for(let n of e.split(".")){let e=S(n);try{for(let t=e.lastIndexOf(95)-1;t>=0;t--)if(95!==e[t])throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&45===e[2]&&45===e[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${n}": ${t.message}`)}}return e}function _(e){return E(function(e,t){let n=S(e).reverse(),r=[];for(;n.length;){let e=C(n);if(e){r.push(...t(e));continue}let i=n.pop();if(y.has(i)){r.push(i);continue}if(v.has(i))continue;let o=w[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return E((i=String.fromCodePoint(...r),i.normalize("NFC")));var i}(e,A))}function C(e,t){var n;let r,i,o=x,s=[],a=e.length;for(t&&(t.length=0);a;){let c=e[--a];if(o=null===(n=o.branches.find((e=>e.set.has(c))))||void 0===n?void 0:n.node,!o)break;if(o.save)i=c;else if(o.check&&c===i)break;s.push(c),o.fe0f&&(s.push(65039),a>0&&65039==e[a-1]&&a--),o.valid&&(r=s.slice(),2==o.valid&&r.splice(1,1),t&&t.push(...e.slice(a).reverse()),e.length=a)}return r}const I=new s.Logger(a.i),k=new Uint8Array(32);function T(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function M(e){const t=(0,i.Y0)(_(e)),n=[];if(0===e.length)return n;let r=0;for(let i=0;i=t.length)throw new Error("invalid ENS name; empty component");return n.push(T(t.slice(r))),n}function P(e){return M(e).map((e=>(0,i.ZN)(e))).join(".")}function O(e){try{return 0!==M(e).length}catch(t){}return!1}function R(e){"string"!==typeof e&&I.throwArgumentError("invalid ENS name; not a string","name",e);let t=k;const n=M(e);for(;n.length;)t=(0,o.keccak256)((0,r.concat)([t,(0,o.keccak256)(n.pop())]));return(0,r.hexlify)(t)}function N(e){return(0,r.hexlify)((0,r.concat)(M(e).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}k.fill(0)},67827:function(e,t,n){"use strict";n.d(t,{E:function(){return C}});var r=n(19485),i=n(2593),o=n(16441),s=n(38197),a=n(6881),c=n(1581),u=n(35644),l=n(32046),d=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const f=new c.Logger(u.i),h=new Uint8Array(32);h.fill(0);const p=i.O$.from(-1),g=i.O$.from(0),m=i.O$.from(1),b=i.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const y=(0,o.hexZeroPad)(m.toHexString(),32),v=(0,o.hexZeroPad)(g.toHexString(),32),w={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},x=["name","version","chainId","verifyingContract","salt"];function S(e){return function(t){return"string"!==typeof t&&f.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const A={name:S("name"),version:S("version"),chainId:function(e){try{return i.O$.from(e).toString()}catch(t){}return f.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return(0,r.getAddress)(e).toLowerCase()}catch(t){}return f.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=(0,o.arrayify)(e);if(32!==t.length)throw new Error("bad length");return(0,o.hexlify)(t)}catch(t){}return f.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function E(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],r=parseInt(t[2]||"256");(r%8!==0||r>256||t[2]&&t[2]!==String(r))&&f.throwArgumentError("invalid numeric width","type",e);const s=b.mask(n?r-1:r),a=n?s.add(m).mul(p):g;return function(t){const n=i.O$.from(t);return(n.lt(a)||n.gt(s))&&f.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),(0,o.hexZeroPad)(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const n=parseInt(t[1]);return(0===n||n>32||t[1]!==String(n))&&f.throwArgumentError("invalid bytes width","type",e),function(t){return(0,o.arrayify)(t).length!==n&&f.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=(0,o.arrayify)(e),n=t.length%32;return n?(0,o.hexConcat)([t,h.slice(n)]):(0,o.hexlify)(t)}(t)}}}switch(e){case"address":return function(e){return(0,o.hexZeroPad)((0,r.getAddress)(e),32)};case"bool":return function(e){return e?y:v};case"bytes":return function(e){return(0,s.keccak256)(e)};case"string":return function(e){return(0,l.id)(e)}}return null}function _(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class C{constructor(e){(0,a.defineReadOnly)(this,"types",Object.freeze((0,a.deepCopy)(e))),(0,a.defineReadOnly)(this,"_encoderCache",{}),(0,a.defineReadOnly)(this,"_types",{});const t={},n={},r={};Object.keys(e).forEach((e=>{t[e]={},n[e]=[],r[e]={}}));for(const o in e){const r={};e[o].forEach((i=>{r[i.name]&&f.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(o)}`,"types",e),r[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===o&&f.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e);E(s)||(n[s]||f.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",e),n[s].push(o),t[o][s]=!0)}))}const i=Object.keys(n).filter((e=>0===n[e].length));0===i.length?f.throwArgumentError("missing primary type","types",e):i.length>1&&f.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),(0,a.defineReadOnly)(this,"primaryType",i[0]),function i(o,s){s[o]&&f.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),s[o]=!0,Object.keys(t[o]).forEach((e=>{n[e]&&(i(e,s),Object.keys(s).forEach((t=>{r[t][e]=!0})))})),delete s[o]}(this.primaryType,{});for(const o in r){const t=Object.keys(r[o]);t.sort(),this._types[o]=_(o,e[o])+t.map((t=>_(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=E(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],n=this.getEncoder(e),r=parseInt(t[3]);return t=>{r>=0&&t.length!==r&&f.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(n);return this._types[e]&&(i=i.map(s.keccak256)),(0,s.keccak256)((0,o.hexConcat)(i))}}const n=this.types[e];if(n){const t=(0,l.id)(this._types[e]);return e=>{const r=n.map((({name:t,type:n})=>{const r=this.getEncoder(n)(e[t]);return this._types[n]?(0,s.keccak256)(r):r}));return r.unshift(t),(0,o.hexConcat)(r)}}return f.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||f.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return(0,s.keccak256)(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(E(e))return n(e,t);const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const e=r[1],i=parseInt(r[3]);return i>=0&&t.length!==i&&f.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,n)))}const i=this.types[e];return i?i.reduce(((e,{name:r,type:i})=>(e[r]=this._visit(i,t[r],n),e)),{}):f.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new C(e)}static getPrimaryType(e){return C.from(e).primaryType}static hashStruct(e,t,n){return C.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){const r=w[n];r||f.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:r})}return t.sort(((e,t)=>x.indexOf(e.name)-x.indexOf(t.name))),C.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return(0,o.hexConcat)(["0x1901",C.hashDomain(e),C.from(t).hash(n)])}static hash(e,t,n){return(0,s.keccak256)(C.encode(e,t,n))}static resolveNames(e,t,n,r){return d(this,void 0,void 0,(function*(){e=(0,a.shallowCopy)(e);const i={};e.verifyingContract&&!(0,o.isHexString)(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=C.from(t);s.visit(n,((e,t)=>("address"!==e||(0,o.isHexString)(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield r(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=s.visit(n,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:n}}))}static getPayload(e,t,n){C.hashDomain(e);const r={},s=[];x.forEach((t=>{const n=e[t];null!=n&&(r[t]=A[t](n),s.push({name:t,type:w[t]}))}));const c=C.from(t),u=(0,a.shallowCopy)(t);return u.EIP712Domain?f.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):u.EIP712Domain=s,c.encode(n),{types:u,domain:r,primaryType:c.primaryType,message:c.visit(n,((e,t)=>{if(e.match(/^bytes(\d*)/))return(0,o.hexlify)((0,o.arrayify)(t));if(e.match(/^u?int/))return i.O$.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!==typeof t&&f.throwArgumentError("invalid string","value",t),t}return f.throwArgumentError("unsupported type","type",e)}))}}}},38197:function(e,t,n){"use strict";n.r(t),n.d(t,{keccak256:function(){return s}});var r=n(91094),i=n.n(r),o=n(16441);function s(e){return"0x"+i().keccak_256((0,o.arrayify)(e))}},1581:function(e,t,n){"use strict";n.r(t),n.d(t,{ErrorCode:function(){return l},LogLevel:function(){return u},Logger:function(){return f}});let r=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,a=null;const c=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var u,l;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(u||(u={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(l||(l={}));const d="0123456789abcdef";class f{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==o[n]&&this.throwArgumentError("invalid log level name","logLevel",e),s>o[n]||console.log.apply(console,t)}debug(...e){this._log(f.levels.DEBUG,e)}info(...e){this._log(f.levels.INFO,e)}warn(...e){this._log(f.levels.WARNING,e)}makeError(e,t,n){if(i)return this.makeError("censored error",t,{});t||(t=f.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e>4],n+=d[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(a){r.push(e+"="+JSON.stringify(n[e].toString()))}})),r.push(`code=${t}`),r.push(`version=${this.version}`);const o=e;let s="";switch(t){case l.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case l.CALL_EXCEPTION:case l.INSUFFICIENT_FUNDS:case l.MISSING_NEW:case l.NONCE_EXPIRED:case l.REPLACEMENT_UNDERPRICED:case l.TRANSACTION_REPLACED:case l.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const a=new Error(e);return a.reason=o,a.code=t,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,f.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),c&&this.throwError("platform missing String.prototype.normalize",f.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:c})}checkSafeUint53(e,t){"number"===typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",et&&this.throwError("too many arguments"+n,f.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",f.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",f.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",f.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return a||(a=new f("logger/5.7.0")),a}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),r){if(!e)return;this.globalLogger().throwError("error censorship permanent",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!e,r=!!t}static setLogLevel(e){const t=o[e.toLowerCase()];null!=t?s=t:f.globalLogger().warn("invalid log level - "+e)}static from(e){return new f(e)}}f.errors=l,f.levels=u},6881:function(e,t,n){"use strict";n.r(t),n.d(t,{Description:function(){return g},checkProperties:function(){return u},deepCopy:function(){return p},defineReadOnly:function(){return s},getStatic:function(){return a},resolveProperties:function(){return c},shallowCopy:function(){return l}});var r=n(1581);var i=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const o=new r.Logger("properties/5.7.0");function s(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function a(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!==typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function c(e){return i(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const n=e[t];return Promise.resolve(n).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function u(e,t){e&&"object"===typeof e||o.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((n=>{t[n]||o.throwArgumentError("invalid object key - "+n,"transaction:"+n,e)}))}function l(e){const t={};for(const n in e)t[n]=e[n];return t}const d={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function f(e){if(void 0===e||null===e||d[typeof e])return!0;if(Array.isArray(e)||"object"===typeof e){if(!Object.isFrozen(e))return!1;const n=Object.keys(e);for(let r=0;rp(e))));if("object"===typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&s(t,n,p(r))}return t}return o.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function p(e){return h(e)}class g{constructor(e){for(const t in e)this[t]=p(e[t])}}},59052:function(e,t,n){"use strict";n.r(t),n.d(t,{decode:function(){return f},encode:function(){return u}});var r=n(16441),i=n(1581);const o=new i.Logger("rlp/5.7.0");function s(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function a(e,t,n){let r=0;for(let i=0;it+1+r&&o.throwError("child data too short",i.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:s}}function d(e,t){if(0===e.length&&o.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&o.throwError("data short segment too short",i.Logger.errors.BUFFER_OVERRUN,{});const r=a(e,t+1,n);return t+1+n+r>e.length&&o.throwError("data long segment too short",i.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{});const s=a(e,t+1,n);t+1+n+s>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+n+s,result:(0,r.hexlify)(e.slice(t+1+n,t+1+n+s))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&o.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:(0,r.hexlify)(e.slice(t+1,t+1+n))}}return{consumed:1,result:(0,r.hexlify)(e[t])}}function f(e){const t=(0,r.arrayify)(e),n=d(t,0);return n.consumed!==t.length&&o.throwArgumentError("invalid rlp data","data",e),n.result}},2006:function(e,t,n){"use strict";n.d(t,{Gy:function(){return f},bP:function(){return u},JQ:function(){return l},o:function(){return d}});var r=n(33715),i=n.n(r),o=n(16441),s=n(21261),a=n(1581);const c=new a.Logger("sha2/5.7.0");function u(e){return"0x"+i().ripemd160().update((0,o.arrayify)(e)).digest("hex")}function l(e){return"0x"+i().sha256().update((0,o.arrayify)(e)).digest("hex")}function d(e){return"0x"+i().sha512().update((0,o.arrayify)(e)).digest("hex")}function f(e,t,n){return s.p[e]||c.throwError("unsupported algorithm "+e,a.Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+i().hmac(i()[e],(0,o.arrayify)(t)).update((0,o.arrayify)(n)).digest("hex")}},21261:function(e,t,n){"use strict";var r;n.d(t,{p:function(){return r}}),function(e){e.sha256="sha256",e.sha512="sha512"}(r||(r={}))},67669:function(e,t,n){"use strict";n.r(t),n.d(t,{SigningKey:function(){return K},computePublicKey:function(){return Y},recoverPublicKey:function(){return X}});var r=n(42500),i=n.n(r),o=n(33715),s=n.n(o);"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self&&self;function a(e,t,n){return n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&n.path)}},e(n,n.exports),n.exports}var c=u;function u(e,t){if(!e)throw new Error(t||"Assertion failed")}u.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var l=a((function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}})),d=a((function(e,t){var n=t;n.assert=c,n.toArray=l.toArray,n.zero2=l.zero2,n.toHex=l.toHex,n.encode=l.encode,n.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,r[s]=a,o.iushrn(1)}return r},n.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0===(1&c)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==u?c:-c,n[0].push(s),a=0===(1&u)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==c?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"===typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new(i())(e,"hex","le")}})),f=d.getNAF,h=d.getJSF,p=d.assert;function g(e,t){this.type=e,this.p=new(i())(t.p,16),this.red=t.prime?i().red(t.prime):i().mont(this.p),this.zero=new(i())(0).toRed(this.red),this.one=new(i())(1).toRed(this.red),this.two=new(i())(2).toRed(this.red),this.n=t.n&&new(i())(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var m=g;function b(e,t){this.curve=e,this.type=t,this.precomputed=null}g.prototype.point=function(){throw new Error("Not implemented")},g.prototype.validate=function(){throw new Error("Not implemented")},g.prototype._fixedNafMul=function(e,t){p(e.precomputed);var n=e._getDoubles(),r=f(t,1,this._bitLength),i=(1<=o;c--)s=(s<<1)+r[c];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;a--){for(var c=0;a>=0&&0===o[a];a--)c++;if(a>=0&&c++,s=s.dblp(c),a<0)break;var u=o[a];p(0!==u),s="affine"===e.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},g.prototype._wnafMulAdd=function(e,t,n,r,i){var o,s,a,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(o=0;o=1;o-=2){var g=o-1,m=o;if(1===c[g]&&1===c[m]){var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=h(n[g],n[m]);for(d=Math.max(v[0].length,d),l[g]=new Array(d),l[m]=new Array(d),s=0;s=0;o--){for(var E=0;o>=0;){var _=!0;for(s=0;s=0&&E++,S=S.dblp(E),o<0)break;for(s=0;s0?a=u[s][C-1>>1]:C<0&&(a=u[s][-C-1>>1].neg()),S="affine"===a.type?S.mixedAdd(a):S.add(a))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},b.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},w.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},w.prototype.pointFromX=function(e,t){(e=new(i())(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},w.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},w.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},S.prototype.isInfinity=function(){return this.inf},S.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},S.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},S.prototype.getX=function(){return this.x.fromRed()},S.prototype.getY=function(){return this.y.fromRed()},S.prototype.mul=function(e){return e=new(i())(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},S.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},S.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},S.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},S.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},S.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},y(A,m.BasePoint),w.prototype.jpoint=function(e,t,n){return new A(this,e,t,n)},A.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},A.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},A.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},A.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},A.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},A.prototype.inspect=function(){return this.isInfinity()?"":""},A.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var E=a((function(e,t){var n=t;n.base=m,n.short=x,n.mont=null,n.edwards=null})),_=a((function(e,t){var n,r=t,i=d.assert;function o(e){"short"===e.type?this.curve=new E.short(e):"edwards"===e.type?this.curve=new E.edwards(e):this.curve=new E.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new o(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(c){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function C(e){if(!(this instanceof C))return new C(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=l.toArray(e.entropy,e.entropyEnc||"hex"),n=l.toArray(e.nonce,e.nonceEnc||"hex"),r=l.toArray(e.pers,e.persEnc||"hex");c(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var I=C;C.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},C.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(r=n,n=t,t=null),n&&(n=l.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var P=d.assert;function O(e,t){if(e instanceof O)return e;this._importDER(e,t)||(P(e.r&&e.s,"Signature without r or s"),this.r=new(i())(e.r,16),this.s=new(i())(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var R=O;function N(){this.place=0}function B(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function L(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}O.prototype._importDER=function(e,t){e=d.toArray(e,t);var n=new N;if(48!==e[n.place++])return!1;var r=B(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var o=B(e,n);if(!1===o)return!1;var s=e.slice(n.place,o+n.place);if(n.place+=o,2!==e[n.place++])return!1;var a=B(e,n);if(!1===a)return!1;if(e.length!==a+n.place)return!1;var c=e.slice(n.place,a+n.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new(i())(s),this.s=new(i())(c),this.recoveryParam=null,!0},O.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=L(t),n=L(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];D(r,t.length),(r=r.concat(t)).push(2),D(r,n.length);var i=r.concat(n),o=[48];return D(o,i.length),o=o.concat(i),d.encode(o,e)};var U=function(){throw new Error("unsupported")},j=d.assert;function F(e){if(!(this instanceof F))return new F(e);"string"===typeof e&&(j(Object.prototype.hasOwnProperty.call(_,e),"Unknown curve "+e),e=_[e]),e instanceof _.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var V=F;F.prototype.keyPair=function(e){return new M(this,e)},F.prototype.keyFromPrivate=function(e,t){return M.fromPrivate(this,e,t)},F.prototype.keyFromPublic=function(e,t){return M.fromPublic(this,e,t)},F.prototype.genKeyPair=function(e){e||(e={});for(var t=new I({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||U(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new(i())(2));;){var o=new(i())(t.generate(n));if(!(o.cmp(r)>0))return o.iaddn(1),this.keyFromPrivate(o)}},F.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},F.prototype.sign=function(e,t,n,r){"object"===typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new(i())(e,16));for(var o=this.n.byteLength(),s=t.getPrivate().toArray("be",o),a=e.toArray("be",o),c=new I({hash:this.hash,entropy:s,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new(i())(1)),l=0;;l++){var d=r.k?r.k(l):new(i())(c.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(u)>=0)){var f=this.g.mul(d);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(0!==p.cmpn(0)){var g=d.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==h.cmp(p)?2:0);return r.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),m^=1),new R({r:p,s:g,recoveryParam:m})}}}}}},F.prototype.verify=function(e,t,n,r){e=this._truncateToN(new(i())(e,16)),n=this.keyFromPublic(n,r);var o=(t=new R(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),l=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},F.prototype.recoverPubKey=function(e,t,n,r){j((3&n)===n,"The recovery param is more than two bits"),t=new R(t,r);var o=this.n,s=new(i())(e),a=t.r,c=t.s,u=1&n,l=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var d=t.r.invm(o),f=o.sub(s).mul(d).umod(o),h=c.mul(d).umod(o);return this.g.mulAdd(f,a,h)},F.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new R(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var q=a((function(e,t){var n=t;n.version="6.5.4",n.utils=d,n.rand=function(){throw new Error("unsupported")},n.curve=E,n.curves=_,n.ec=V,n.eddsa=null})).ec,z=n(16441),H=n(6881);const W=new(n(1581).Logger)("signing-key/5.7.0");let G=null;function Z(){return G||(G=new q("secp256k1")),G}class K{constructor(e){(0,H.defineReadOnly)(this,"curve","secp256k1"),(0,H.defineReadOnly)(this,"privateKey",(0,z.hexlify)(e)),32!==(0,z.hexDataLength)(this.privateKey)&&W.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Z().keyFromPrivate((0,z.arrayify)(this.privateKey));(0,H.defineReadOnly)(this,"publicKey","0x"+t.getPublic(!1,"hex")),(0,H.defineReadOnly)(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),(0,H.defineReadOnly)(this,"_isSigningKey",!0)}_addPoint(e){const t=Z().keyFromPublic((0,z.arrayify)(this.publicKey)),n=Z().keyFromPublic((0,z.arrayify)(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const t=Z().keyFromPrivate((0,z.arrayify)(this.privateKey)),n=(0,z.arrayify)(e);32!==n.length&&W.throwArgumentError("bad digest length","digest",e);const r=t.sign(n,{canonical:!0});return(0,z.splitSignature)({recoveryParam:r.recoveryParam,r:(0,z.hexZeroPad)("0x"+r.r.toString(16),32),s:(0,z.hexZeroPad)("0x"+r.s.toString(16),32)})}computeSharedSecret(e){const t=Z().keyFromPrivate((0,z.arrayify)(this.privateKey)),n=Z().keyFromPublic((0,z.arrayify)(Y(e)));return(0,z.hexZeroPad)("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function X(e,t){const n=(0,z.splitSignature)(t),r={r:(0,z.arrayify)(n.r),s:(0,z.arrayify)(n.s)};return"0x"+Z().recoverPubKey((0,z.arrayify)(e),r,n.recoveryParam).encode("hex",!1)}function Y(e,t){const n=(0,z.arrayify)(e);if(32===n.length){const e=new K(n);return t?"0x"+Z().keyFromPrivate(n).getPublic(!0,"hex"):e.publicKey}return 33===n.length?t?(0,z.hexlify)(n):"0x"+Z().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?t?"0x"+Z().keyFromPublic(n).getPublic(!0,"hex"):(0,z.hexlify)(n):W.throwArgumentError("invalid public or private key","key","[REDACTED]")}},42500:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:n(62808).Buffer}catch(k){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,c=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch(k){o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=p[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modrn(l).toString(e);n=(d=d.idivn(l)).isZero()?g+n:f[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function b(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(e,t,n){return b(e,t,n)}function v(e,t){this.x=e,this.y=t}Math.imul||(m=g),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?g(this,e,t):n<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},v.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new C(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}x.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(S,x),S.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new A;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return w[e]=t,t},C.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},C.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},C.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},C.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},C.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},C.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},C.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},C.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},C.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new I(e)},i(I,C),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},29251:function(e,t,n){"use strict";n.d(t,{Uj:function(){return o},te:function(){return c},Uw:function(){return s},U$:function(){return f},uu:function(){return h},Y0:function(){return l},XL:function(){return g},ZN:function(){return p}});var r=n(16441);const i=new(n(1581).Logger)("strings/5.7.0");var o,s;function a(e,t,n,r,i){if(e===s.BAD_PREFIX||e===s.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r>6===2;r++)e++;return e}return e===s.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(o||(o={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(s||(s={}));const c=Object.freeze({error:function(e,t,n,r,o){return i.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)},ignore:a,replace:function(e,t,n,r,i){return e===s.OVERLONG?(r.push(i),0):(r.push(65533),a(e,t,n))}});function u(e,t){null==t&&(t=c.error),e=(0,r.arrayify)(e);const n=[];let i=0;for(;i>7===0){n.push(r);continue}let o=null,a=null;if(192===(224&r))o=1,a=127;else if(224===(240&r))o=2,a=2047;else{if(240!==(248&r)){i+=t(128===(192&r)?s.UNEXPECTED_CONTINUE:s.BAD_PREFIX,i-1,e,n);continue}o=3,a=65535}if(i-1+o>=e.length){i+=t(s.OVERRUN,i-1,e,n);continue}let c=r&(1<<8-o-1)-1;for(let u=0;u1114111?i+=t(s.OUT_OF_RANGE,i-1-o,e,n,c):c>=55296&&c<=57343?i+=t(s.UTF16_SURROGATE,i-1-o,e,n,c):c<=a?i+=t(s.OVERLONG,i-1-o,e,n,c):n.push(c))}return n}function l(e,t=o.current){t!=o.current&&(i.checkNormalize(),e=e.normalize(t));let n=[];for(let r=0;r>6|192),n.push(63&t|128);else if(55296==(64512&t)){r++;const i=e.charCodeAt(r);if(r>=e.length||56320!==(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&t)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(t>>12|224),n.push(t>>6&63|128),n.push(63&t|128)}return(0,r.arrayify)(n)}function d(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function f(e,t){return'"'+u(e,t).map((e=>{if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?d(e):d(55296+((e-=65536)>>10&1023))+d(56320+(1023&e))})).join("")+'"'}function h(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function p(e,t){return h(u(e,t))}function g(e,t=o.current){return u(l(e,t))}},83875:function(e,t,n){"use strict";n.r(t),n.d(t,{TransactionTypes:function(){return h},accessListify:function(){return S},computeAddress:function(){return y},parse:function(){return k},recoverAddress:function(){return v},serialize:function(){return C}});var r=n(19485),i=n(2593),o=n(16441),s=n(21046),a=n(38197),c=n(6881),u=n(59052),l=n(67669),d=n(1581);const f=new d.Logger("transactions/5.7.0");var h;function p(e){return"0x"===e?null:(0,r.getAddress)(e)}function g(e){return"0x"===e?s._Y:i.O$.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(h||(h={}));const m=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],b={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function y(e){const t=(0,l.computePublicKey)(e);return(0,r.getAddress)((0,o.hexDataSlice)((0,a.keccak256)((0,o.hexDataSlice)(t,1)),12))}function v(e,t){return y((0,l.recoverPublicKey)((0,o.arrayify)(e),t))}function w(e,t){const n=(0,o.stripZeros)(i.O$.from(e).toHexString());return n.length>32&&f.throwArgumentError("invalid length for "+t,"transaction:"+t,e),n}function x(e,t){return{address:(0,r.getAddress)(e),storageKeys:(t||[]).map(((t,n)=>(32!==(0,o.hexDataLength)(t)&&f.throwArgumentError("invalid access list storageKey",`accessList[${e}:${n}]`,t),t.toLowerCase())))}}function S(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&f.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),x(e[0],e[1])):x(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const n=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return x(t,Object.keys(n).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function A(e){return S(e).map((e=>[e.address,e.storageKeys]))}function E(e,t){if(null!=e.gasPrice){const t=i.O$.from(e.gasPrice),n=i.O$.from(e.maxFeePerGas||0);t.eq(n)||f.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:n})}const n=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),w(e.maxFeePerGas||0,"maxFeePerGas"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,r.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",A(e.accessList||[])];if(t){const e=(0,o.splitSignature)(t);n.push(w(e.recoveryParam,"recoveryParam")),n.push((0,o.stripZeros)(e.r)),n.push((0,o.stripZeros)(e.s))}return(0,o.hexConcat)(["0x02",u.encode(n)])}function _(e,t){const n=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.gasPrice||0,"gasPrice"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,r.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",A(e.accessList||[])];if(t){const e=(0,o.splitSignature)(t);n.push(w(e.recoveryParam,"recoveryParam")),n.push((0,o.stripZeros)(e.r)),n.push((0,o.stripZeros)(e.s))}return(0,o.hexConcat)(["0x01",u.encode(n)])}function C(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&f.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){(0,c.checkProperties)(e,b);const n=[];m.forEach((function(t){let r=e[t.name]||[];const i={};t.numeric&&(i.hexPad="left"),r=(0,o.arrayify)((0,o.hexlify)(r,i)),t.length&&r.length!==t.length&&r.length>0&&f.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,r),t.maxLength&&(r=(0,o.stripZeros)(r),r.length>t.maxLength&&f.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,r)),n.push((0,o.hexlify)(r))}));let r=0;if(null!=e.chainId?(r=e.chainId,"number"!==typeof r&&f.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!(0,o.isBytesLike)(t)&&t.v>28&&(r=Math.floor((t.v-35)/2)),0!==r&&(n.push((0,o.hexlify)(r)),n.push("0x"),n.push("0x")),!t)return u.encode(n);const i=(0,o.splitSignature)(t);let s=27+i.recoveryParam;return 0!==r?(n.pop(),n.pop(),n.pop(),s+=2*r+8,i.v>28&&i.v!==s&&f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==s&&f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),n.push((0,o.hexlify)(s)),n.push((0,o.stripZeros)((0,o.arrayify)(i.r))),n.push((0,o.stripZeros)((0,o.arrayify)(i.s))),u.encode(n)}(e,t);switch(e.type){case 1:return _(e,t);case 2:return E(e,t)}return f.throwError(`unsupported transaction type: ${e.type}`,d.Logger.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function I(e,t,n){try{const n=g(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(r){f.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=(0,o.hexZeroPad)(t[1],32),e.s=(0,o.hexZeroPad)(t[2],32);try{const t=(0,a.keccak256)(n(e));e.from=v(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(r){}}function k(e){const t=(0,o.arrayify)(e);if(t[0]>127)return function(e){const t=u.decode(e);9!==t.length&&6!==t.length&&f.throwArgumentError("invalid raw transaction","rawTransaction",e);const n={nonce:g(t[0]).toNumber(),gasPrice:g(t[1]),gasLimit:g(t[2]),to:p(t[3]),value:g(t[4]),data:t[5],chainId:0};if(6===t.length)return n;try{n.v=i.O$.from(t[6]).toNumber()}catch(r){return n}if(n.r=(0,o.hexZeroPad)(t[7],32),n.s=(0,o.hexZeroPad)(t[8],32),i.O$.from(n.r).isZero()&&i.O$.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let i=n.v-27;const s=t.slice(0,6);0!==n.chainId&&(s.push((0,o.hexlify)(n.chainId)),s.push("0x"),s.push("0x"),i-=2*n.chainId+8);const c=(0,a.keccak256)(u.encode(s));try{n.from=v(c,{r:(0,o.hexlify)(n.r),s:(0,o.hexlify)(n.s),recoveryParam:i})}catch(r){}n.hash=(0,a.keccak256)(e)}return n.type=null,n}(t);switch(t[0]){case 1:return function(e){const t=u.decode(e.slice(1));8!==t.length&&11!==t.length&&f.throwArgumentError("invalid component count for transaction type: 1","payload",(0,o.hexlify)(e));const n={type:1,chainId:g(t[0]).toNumber(),nonce:g(t[1]).toNumber(),gasPrice:g(t[2]),gasLimit:g(t[3]),to:p(t[4]),value:g(t[5]),data:t[6],accessList:S(t[7])};return 8===t.length||(n.hash=(0,a.keccak256)(e),I(n,t.slice(8),_)),n}(t);case 2:return function(e){const t=u.decode(e.slice(1));9!==t.length&&12!==t.length&&f.throwArgumentError("invalid component count for transaction type: 2","payload",(0,o.hexlify)(e));const n=g(t[2]),r=g(t[3]),i={type:2,chainId:g(t[0]).toNumber(),nonce:g(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:g(t[4]),to:p(t[5]),value:g(t[6]),data:t[7],accessList:S(t[8])};return 9===t.length||(i.hash=(0,a.keccak256)(e),I(i,t.slice(9),E)),i}(t)}return f.throwError(`unsupported transaction type: ${t[0]}`,d.Logger.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}},37707:function(e,t,n){"use strict";n.r(t),n.d(t,{_fetchData:function(){return p},fetchJson:function(){return g},poll:function(){return m}});var r=n(59567),i=n(16441),o=n(6881),s=n(29251),a=n(1581);var c=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};function u(e,t){return c(this,void 0,void 0,(function*(){null==t&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(n.mode=e.mode),e.cache&&(n.cache=e.cache),e.credentials&&(n.credentials=e.credentials),e.redirect&&(n.redirect=e.redirect),e.referrer&&(n.referrer=e.referrer)}const r=yield fetch(e,n),o=yield r.arrayBuffer(),s={};return r.headers.forEach?r.headers.forEach(((e,t)=>{s[t.toLowerCase()]=e})):r.headers.keys().forEach((e=>{s[e.toLowerCase()]=r.headers.get(e)})),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:(0,i.arrayify)(new Uint8Array(o))}}))}var l=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const d=new a.Logger("web/5.7.1");function f(e){return new Promise((t=>{setTimeout(t,e)}))}function h(e,t){if(null==e)return null;if("string"===typeof e)return e;if((0,i.isBytesLike)(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return(0,s.ZN)(e)}catch(n){}return(0,i.hexlify)(e)}return e}function p(e,t,n){const i="object"===typeof e&&null!=e.throttleLimit?e.throttleLimit:12;d.assertArgument(i>0&&i%1===0,"invalid connection throttle limit","connection.throttleLimit",i);const c="object"===typeof e?e.throttleCallback:null,p="object"===typeof e&&"number"===typeof e.throttleSlotInterval?e.throttleSlotInterval:100;d.assertArgument(p>0&&p%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",p);const g="object"===typeof e&&!!e.errorPassThrough,m={};let b=null;const y={method:"GET"};let v=!1,w=12e4;if("string"===typeof e)b=e;else if("object"===typeof e){if(null!=e&&null!=e.url||d.throwArgumentError("missing URL","connection.url",e),b=e.url,"number"===typeof e.timeout&&e.timeout>0&&(w=e.timeout),e.headers)for(const t in e.headers)m[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(v=!0);if(y.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==b.substring(0,6)&&!0!==e.allowInsecureAuthentication&&d.throwError("basic authentication requires a secure https url",a.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:b,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;m.authorization={key:"Authorization",value:"Basic "+(0,r.c)((0,s.Y0)(t))}}null!=e.skipFetchSetup&&(y.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(y.fetchOptions=(0,o.shallowCopy)(e.fetchOptions))}const x=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),S=b?b.match(x):null;if(S)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":S[1]||"text/plain"},body:S[2]?(0,r.J)(S[3]):(A=S[3],(0,s.Y0)(A.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return n&&(t=n(e.body,e)),Promise.resolve(t)}catch(I){d.throwError("processing response error",a.Logger.errors.SERVER_ERROR,{body:h(S[1],S[2]),error:I,requestBody:null,requestMethod:"GET",url:b})}var A;t&&(y.method="POST",y.body=t,null==m["content-type"]&&(m["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==m["content-length"]&&(m["content-length"]={key:"Content-Length",value:String(t.length)}));const E={};Object.keys(m).forEach((e=>{const t=m[e];E[t.key]=t.value})),y.headers=E;const _=function(){let e=null;return{promise:new Promise((function(t,n){w&&(e=setTimeout((()=>{null!=e&&(e=null,n(d.makeError("timeout",a.Logger.errors.TIMEOUT,{requestBody:h(y.body,E["content-type"]),requestMethod:y.method,timeout:w,url:b})))}),w))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),C=function(){return l(this,void 0,void 0,(function*(){for(let e=0;e=300)&&(_.cancel(),d.throwError("bad response",a.Logger.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:h(r,t.headers?t.headers["content-type"]:null),requestBody:h(y.body,E["content-type"]),requestMethod:y.method,url:b})),n)try{const e=yield n(r,t);return _.cancel(),e}catch(I){if(I.throttleRetry&&e"content-type"===e.toLowerCase())).length||(n.headers=(0,o.shallowCopy)(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return p(e,r,((e,t)=>{let r=null;if(null!=e)try{r=JSON.parse((0,s.ZN)(e))}catch(i){d.throwError("invalid JSON",a.Logger.errors.SERVER_ERROR,{body:e,error:i})}return n&&(r=n(r,t)),r}))}function m(e,t){return t||(t={}),null==(t=(0,o.shallowCopy)(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(n,r){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{s()&&r(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let c=0;!function i(){return e().then((function(e){if(void 0!==e)s()&&n(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(c++,c>a)return void(s()&&r(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));et.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){s()&&r(e)}))}()}))}},73627:function(e,t,n){var r,i;"undefined"!==typeof navigator&&(i=window||{},r=function(){return function(e){"use strict";var t,n="http://www.w3.org/2000/svg",r="",i=-999999,o=!1,s=!0,a="",c=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),u=Math.pow,l=Math.sqrt,d=Math.floor,f=(Math.max,Math.min),h={};function p(){return{}}(function(){var e,t=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],n=t.length;for(e=0;e1?n[1]=1:n[1]<=0&&(n[1]=0),I(n[0],n[1],n[2])}function M(e,t){var n=k(255*e[0],255*e[1],255*e[2]);return n[2]+=t,n[2]>1?n[2]=1:n[2]<0&&(n[2]=0),I(n[0],n[1],n[2])}function P(e,t){var n=k(255*e[0],255*e[1],255*e[2]);return n[0]+=t/360,n[0]>1?n[0]-=1:n[0]<0&&(n[0]+=1),I(n[0],n[1],n[2])}var O=function(){var e,t,n=[];for(e=0;e<256;e+=1)t=e.toString(16),n[e]=1===t.length?"0"+t:t;return function(e,t,r){return e<0&&(e=0),t<0&&(t=0),r<0&&(r=0),"#"+n[e]+n[t]+n[r]}}();function R(){}R.prototype={triggerEvent:function(e,t){if(this._cbs[e])for(var n=this._cbs[e],r=0;r0||e>-1e-6&&e<0?r(e*t)/t:e}function O(){var e=this.props;return"matrix("+P(e[0])+","+P(e[1])+","+P(e[4])+","+P(e[5])+","+P(e[12])+","+P(e[13])+")"}return function(){this.reset=i,this.rotate=o,this.rotateX=s,this.rotateY=a,this.rotateZ=c,this.skew=l,this.skewFromAxis=d,this.shear=u,this.scale=f,this.setTransform=h,this.translate=p,this.transform=g,this.applyToPoint=w,this.applyToX=x,this.applyToY=S,this.applyToZ=A,this.applyToPointArray=k,this.applyToTriplePoints=I,this.applyToPointStringified=T,this.toCSS=M,this.to2dCSS=O,this.clone=y,this.cloneFromProps=v,this.equals=b,this.inversePoints=C,this.inversePoint=_,this.getInverseMatrix=E,this._t=this.transform,this.isIdentity=m,this._identity=!0,this._identityCalculated=!1,this.props=N("float32",16),this.reset()}}();!function(e,t){var n,r=this,i=256,o=6,s=52,a="random",c=t.pow(i,o),u=t.pow(2,s),l=2*u,d=i-1;function f(n,r,s){var d=[],f=m(g((r=!0===r?{entropy:!0}:r||{}).entropy?[n,y(e)]:null===n?b():n,3),d),v=new h(d),w=function(){for(var e=v.g(o),t=c,n=0;e=l;)e/=2,t/=2,n>>>=1;return(e+n)/t};return w.int32=function(){return 0|v.g(4)},w.quick=function(){return v.g(4)/4294967296},w.double=w,m(y(v.S),e),(r.pass||s||function(e,n,r,i){return i&&(i.S&&p(i,v),e.state=function(){return p(v,{})}),r?(t[a]=e,n):e})(w,f,"global"in r?r.global:this==t,r.state)}function h(e){var t,n=e.length,r=this,o=0,s=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o0?n=c:t=c}while(Math.abs(a)>o&&++u=i?m(e,l,t,n):0===d?l:g(e,o,o+c,t,n)}},e}();function H(e,t){var n,r,i=e.length;for(n=0;n-.001&&s<.001}function n(n,r,i,o,s,a,c,u,l){if(0===i&&0===a&&0===l)return t(n,r,o,s,c,u);var d,f=e.sqrt(e.pow(o-n,2)+e.pow(s-r,2)+e.pow(a-i,2)),h=e.sqrt(e.pow(c-n,2)+e.pow(u-r,2)+e.pow(l-i,2)),p=e.sqrt(e.pow(c-o,2)+e.pow(u-s,2)+e.pow(l-a,2));return(d=f>h?f>p?f-h-p:p-h-f:p>h?p-h-f:h-f-p)>-1e-4&&d<1e-4}var r=function(e,t,n,r){var i,o,s,a,c,d,f=g,h=0,p=[],m=[],b=Ce.newElement();for(s=n.length,i=0;is?-1:1,u=!0;u;)if(r[o]<=s&&r[o+1]>s?(a=(s-r[o])/(r[o+1]-r[o]),u=!1):o+=c,o<0||o>=i-1){if(o===i-1)return n[o];u=!1}return n[o]+(n[o+1]-n[o])*a}function f(t,n,r,i,o,s){var a=c(o,s),u=1-a;return[e.round(1e3*(u*u*u*t[0]+(a*u*u+u*a*u+u*u*a)*r[0]+(a*a*u+u*a*a+a*u*a)*i[0]+a*a*a*n[0]))/1e3,e.round(1e3*(u*u*u*t[1]+(a*u*u+u*a*u+u*u*a)*r[1]+(a*a*u+u*a*a+a*u*a)*i[1]+a*a*a*n[1]))/1e3]}var h=N("float32",8);function p(t,n,r,i,o,s,a){o<0?o=0:o>1&&(o=1);var u,l=c(o,a),d=c(s=s>1?1:s,a),f=t.length,p=1-l,g=1-d,m=p*p*p,b=l*p*p*3,y=l*l*p*3,v=l*l*l,w=p*p*g,x=l*p*g+p*l*g+p*p*d,S=l*l*g+p*l*d+l*p*d,A=l*l*d,E=p*g*g,_=l*g*g+p*d*g+p*g*d,C=l*d*g+p*d*d+l*g*d,I=l*d*d,k=g*g*g,T=d*g*g+g*d*g+g*g*d,M=d*d*g+g*d*d+d*g*d,P=d*d*d;for(u=0;u=0;t-=1)if("sh"===e[t].ty)if(e[t].ks.k.i)r(e[t].ks.k);else for(o=e[t].ks.k.length,i=0;in[0]||!(n[0]>e[0])&&(e[1]>n[1]||!(n[1]>e[1])&&(e[2]>n[2]||!(n[2]>e[2])&&null))}var o=function(){var e=[4,4,14];function t(e){var t=e.t.d;e.t.d={k:[{s:t,t:0}]}}function n(e){var n,r=e.length;for(n=0;n=0;n-=1)if("sh"===e[n].ty)if(e[n].ks.k.i)e[n].ks.k.c=e[n].closed;else for(i=e[n].ks.k.length,r=0;r0&&(l=!1),l){var d=D("style");d.setAttribute("f-forigin",r[n].fOrigin),d.setAttribute("f-origin",r[n].origin),d.setAttribute("f-family",r[n].fFamily),d.type="text/css",d.innerText="@font-face {font-family: "+r[n].fFamily+"; font-style: normal; src: url('"+r[n].fPath+"');}",t.appendChild(d)}}else if("g"===r[n].fOrigin||1===r[n].origin){for(a=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),u=0;u=c.t-i){a.h&&(a=c),m=0;break}if(c.t-i>e){m=b;break}b=x||e=x?A.points.length-1:0;for(d=A.points[E].point.length,l=0;l=I&&C=x?(n[0]=w[0],n[1]=w[1],n[2]=w[2]):e<=S?(n[0]=a.s[0],n[1]=a.s[1],n[2]=a.s[2]):o(n,r(s(a.s),s(w),(e-S)/(x-S)));else for(b=0;b=x?f=1:e1e-6?(r=Math.acos(i),o=Math.sin(r),s=Math.sin((1-n)*r)/o,a=Math.sin(n*r)/o):(s=1-n,a=n),c[0]=s*u+a*h,c[1]=s*l+a*p,c[2]=s*d+a*g,c[3]=s*f+a*m,c}function o(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],s=Math.atan2(2*r*o-2*n*i,1-2*r*r-2*i*i),a=Math.asin(2*n*r+2*i*o),c=Math.atan2(2*n*o-2*r*i,1-2*n*n-2*i*i);e[0]=s/m,e[1]=a/m,e[2]=c/m}function s(e){var t=e[0]*m,n=e[1]*m,r=e[2]*m,i=Math.cos(t/2),o=Math.cos(n/2),s=Math.cos(r/2),a=Math.sin(t/2),c=Math.sin(n/2),u=Math.sin(r/2);return[a*c*s+i*o*u,a*o*s+i*c*u,i*c*s-a*o*u,i*o*s-a*c*u]}function a(){var t=this.comp.renderedFrame-this.offsetTime,n=this.keyframes[0].t-this.offsetTime,r=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(t===this._caching.lastFrame||this._caching.lastFrame!==e&&(this._caching.lastFrame>=r&&t>=r||this._caching.lastFrame=t&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var i=this.interpolateValue(t,this._caching);this.pv=i}return this._caching.lastFrame=t,this.pv}function c(e){var n;if("unidimensional"===this.propType)n=e*this.mult,t(this.v-n)>1e-5&&(this.v=n,this._mdf=!0);else for(var r=0,i=this.v.length;r1e-5&&(this.v[r]=n,this._mdf=!0),r+=1}function u(){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{var e;this.lock=!0,this._mdf=this._isFirstFrame;var t=this.effectsSequence.length,n=this.kf?this.pv:this.data.k;for(e=0;e=this.p.keyframes[this.p.keyframes.length-1].t?(r=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/n,0),i=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/n,0)):(r=this.p.pv,i=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/n,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){r=[],i=[];var o=this.px,s=this.py;o._caching.lastFrame+o.offsetTime<=o.keyframes[0].t?(r[0]=o.getValueAtTime((o.keyframes[0].t+.01)/n,0),r[1]=s.getValueAtTime((s.keyframes[0].t+.01)/n,0),i[0]=o.getValueAtTime(o.keyframes[0].t/n,0),i[1]=s.getValueAtTime(s.keyframes[0].t/n,0)):o._caching.lastFrame+o.offsetTime>=o.keyframes[o.keyframes.length-1].t?(r[0]=o.getValueAtTime(o.keyframes[o.keyframes.length-1].t/n,0),r[1]=s.getValueAtTime(s.keyframes[s.keyframes.length-1].t/n,0),i[0]=o.getValueAtTime((o.keyframes[o.keyframes.length-1].t-.01)/n,0),i[1]=s.getValueAtTime((s.keyframes[s.keyframes.length-1].t-.01)/n,0)):(r=[o.pv,s.pv],i[0]=o.getValueAtTime((o._caching.lastFrame+o.offsetTime-.01)/n,o.offsetTime),i[1]=s.getValueAtTime((s._caching.lastFrame+s.offsetTime-.01)/n,s.offsetTime))}else r=i=e;this.v.rotate(-Math.atan2(r[1]-i[1],r[0]-i[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function r(){if(!this.a.k&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}}function i(){}function o(e){this._addDynamicProperty(e),this.elem.addDynamicProperty(e),this._isDirty=!0}function s(e,t,n){if(this.elem=e,this.frameId=-1,this.propType="transform",this.data=t,this.v=new q,this.pre=new q,this.appliedTransformations=0,this.initDynamicPropertyContainer(n||e),t.p&&t.p.s?(this.px=J.getProp(e,t.p.x,0,0,this),this.py=J.getProp(e,t.p.y,0,0,this),t.p.z&&(this.pz=J.getProp(e,t.p.z,0,0,this))):this.p=J.getProp(e,t.p||{k:[0,0,0]},1,0,this),t.rx){if(this.rx=J.getProp(e,t.rx,0,m,this),this.ry=J.getProp(e,t.ry,0,m,this),this.rz=J.getProp(e,t.rz,0,m,this),t.or.k[0].ti){var r,i=t.or.k.length;for(r=0;r=this._maxLength&&this.doubleArrayLength(),n){case"v":o=this.v;break;case"i":o=this.i;break;case"o":o=this.o;break;default:o=[]}(!o[r]||o[r]&&!i)&&(o[r]=Se.newElement()),o[r][0]=e,o[r][1]=t},$.prototype.setTripleAt=function(e,t,n,r,i,o,s,a){this.setXYAt(e,t,"v",s,a),this.setXYAt(n,r,"o",s,a),this.setXYAt(i,o,"i",s,a)},$.prototype.reverse=function(){var e=new $;e.setPathData(this.c,this._length);var t=this.v,n=this.o,r=this.i,i=0;this.c&&(e.setTripleAt(t[0][0],t[0][1],r[0][0],r[0][1],n[0][0],n[0][1],0,!1),i=1);var o,s=this._length-1,a=this._length;for(o=i;o=h[h.length-1].t-this.offsetTime)r=h[h.length-1].s?h[h.length-1].s[0]:h[h.length-2].e[0],o=!0;else{for(var p,g,m,b=f,y=h.length-1,v=!0;v&&(p=h[b],!((g=h[b+1]).t-this.offsetTime>e));)b=g.t-this.offsetTime)l=1;else if(er&&t>r)||(this._caching.lastIndex=i=1?o.push({s:e-1,e:t-1}):(o.push({s:e,e:1}),o.push({s:0,e:t-1}));var s,a,c=[],u=o.length;for(s=0;sr+n||(l=a.s*i<=r?0:(a.s*i-r)/n,d=a.e*i>=r+n?1:(a.e*i-r)/n,c.push([l,d]))}return c.length||c.push([0,0]),c},re.prototype.releasePathsData=function(e){var t,n=e.length;for(t=0;t1?1+o:this.s.v<0?0+o:this.s.v+o)>(n=this.e.v>1?1+o:this.e.v<0?0+o:this.e.v+o)){var s=t;t=n,n=s}t=1e-4*Math.round(1e4*t),n=1e-4*Math.round(1e4*n),this.sValue=t,this.eValue=n}else t=this.sValue,n=this.eValue;var a,c,u,l,d,f=this.shapes.length,h=0;if(n===t)for(i=0;i=0;i-=1)if((p=this.shapes[i]).shape._mdf){for((g=p.localShapeCollection).releaseShapes(),2===this.m&&f>1?(b=this.calculateShapeEdges(t,n,p.totalShapeLength,w,h),w+=p.totalShapeLength):b=[[y,v]],c=b.length,a=0;a=1?m.push({s:p.totalShapeLength*(y-1),e:p.totalShapeLength*(v-1)}):(m.push({s:p.totalShapeLength*y,e:p.totalShapeLength}),m.push({s:0,e:p.totalShapeLength*(v-1)}));var x=this.addShapes(p,m[0]);if(m[0].s!==m[0].e){if(m.length>1)if(p.shape.paths.shapes[p.shape.paths._length-1].c){var S=x.pop();this.addPaths(x,g),x=this.addShapes(p,m[1],S)}else this.addPaths(x,g),x=this.addShapes(p,m[1]);this.addPaths(x,g)}}p.shape.paths=g}}},re.prototype.addPaths=function(e,t){var n,r=e.length;for(n=0;nt.e){n.c=!1;break}t.s<=p&&t.e>=p+s.addedLength?(this.addSegment(f[r].v[i-1],f[r].o[i-1],f[r].i[i],f[r].v[i],n,a,m),m=!1):(u=Z.getNewSegment(f[r].v[i-1],f[r].v[i],f[r].o[i-1],f[r].i[i],(t.s-p)/s.addedLength,(t.e-p)/s.addedLength,c[i-1]),this.addSegmentFromArray(u,n,a,m),m=!1,n.c=!1),p+=s.addedLength,a+=1}if(f[r].c&&c.length){if(s=c[i-1],p<=t.e){var b=c[i-1].addedLength;t.s<=p&&t.e>=p+b?(this.addSegment(f[r].v[i-1],f[r].o[i-1],f[r].i[0],f[r].v[0],n,a,m),m=!1):(u=Z.getNewSegment(f[r].v[i-1],f[r].v[0],f[r].o[i-1],f[r].i[0],(t.s-p)/b,(t.e-p)/b,c[i-1]),this.addSegmentFromArray(u,n,a,m),m=!1,n.c=!1)}else n.c=!1;p+=s.addedLength,a+=1}if(n._length&&(n.setXYAt(n.v[l][0],n.v[l][1],"i",l),n.setXYAt(n.v[n._length-1][0],n.v[n._length-1][1],"o",n._length-1)),p>t.e)break;r0;)n-=1,this._elements.unshift(t[n]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},se.prototype.resetElements=function(e){var t,n=e.length;for(t=0;t0?Math.floor(f):Math.ceil(f),g=this.pMatrix.props,m=this.rMatrix.props,b=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var y,v,w=0;if(f>0){for(;wp;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),w-=1;h&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-h,!0),w-=h)}for(r=1===this.data.m?0:this._currentCopies-1,i=1===this.data.m?1:-1,o=this._currentCopies;o;){if(v=(n=(t=this.elemsData[r].it)[t.length-1].transform.mProps.v.props).length,t[t.length-1].transform.mProps._mdf=!0,t[t.length-1].transform.op._mdf=!0,t[t.length-1].transform.op.v=1===this._currentCopies?this.so.v:this.so.v+(this.eo.v-this.so.v)*(r/(this._currentCopies-1)),0!==w){for((0!==r&&1===i||r!==this._currentCopies-1&&-1===i)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15]),this.matrix.transform(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]),this.matrix.transform(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]),y=0;y.01)return!1;n+=1}return!0},ue.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var e=0,t=this.data.k.k.length;e500)&&(this._imageLoaded(),clearInterval(n)),t+=1}.bind(this),50)}function o(t){var n=r(t,this.assetsPath,this.path),i=L("image");c?this.testImageLoaded(i):i.addEventListener("load",this._imageLoaded,!1),i.addEventListener("error",function(){o.img=e,this._imageLoaded()}.bind(this),!1),i.setAttributeNS("http://www.w3.org/1999/xlink","href",n),this._elementHelper.append?this._elementHelper.append(i):this._elementHelper.appendChild(i);var o={img:i,assetData:t};return o}function s(t){var n=r(t,this.assetsPath,this.path),i=D("img");i.crossOrigin="anonymous",i.addEventListener("load",this._imageLoaded,!1),i.addEventListener("error",function(){o.img=e,this._imageLoaded()}.bind(this),!1),i.src=n;var o={img:i,assetData:t};return o}function a(e){var t={assetData:e},n=r(e,this.assetsPath,this.path);return K.loadData(n,function(e){t.img=e,this._footageLoaded()}.bind(this),function(){t.img={},this._footageLoaded()}.bind(this)),t}function u(e,t){var n;this.imagesLoadedCb=t;var r=e.length;for(n=0;n=a+de||!p?(y=(a+de-u)/c.partialLength,V=h.point[0]+(c.point[0]-h.point[0])*y,q=h.point[1]+(c.point[1]-h.point[1])*y,E.translate(-x[0]*I[i].an*.005,-x[1]*U*.01),l=!1):p&&(u+=c.partialLength,(d+=1)>=p.length&&(d=0,g[f+=1]?p=g[f].points:w.v.c?(d=0,p=g[f=0].points):(u-=c.partialLength,p=null)),p&&(h=c,m=(c=p[d]).partialLength));F=I[i].an/2-I[i].add,E.translate(-F,0,0)}else F=I[i].an/2-I[i].add,E.translate(-F,0,0),E.translate(-x[0]*I[i].an*.005,-x[1]*U*.01,0);for(N=0;N1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},ye.prototype.addEffect=function(e){this.effectsSequence.push(e),this.elem.addDynamicProperty(this)},ye.prototype.getValue=function(e){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length||e){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var t=this.currentData,n=this.keysIndex;if(this.lock)this.setCurrentData(this.currentData);else{var r;this.lock=!0,this._mdf=!1;var i=this.effectsSequence.length,o=e||this.data.d.k[this.keysIndex].s;for(r=0;rt);)n+=1;return this.keysIndex!==n&&(this.keysIndex=n),this.data.d.k[this.keysIndex].s},ye.prototype.buildFinalText=function(e){for(var t,n,r=[],i=0,o=e.length,s=!1;i=55296&&t<=56319?(n=e.charCodeAt(i+1))>=56320&&n<=57343?(s||Y.isModifier(t,n)?(r[r.length-1]+=e.substr(i,2),s=!1):r.push(e.substr(i,2)),i+=1):r.push(e.charAt(i)):t>56319?(n=e.charCodeAt(i+1),Y.isZeroWidthJoiner(t,n)?(s=!0,r[r.length-1]+=e.substr(i,2),i+=1):r.push(e.charAt(i))):Y.isZeroWidthJoiner(t)?(r[r.length-1]+=e.charAt(i),s=!0):r.push(e.charAt(i)),i+=1;return r},ye.prototype.completeTextData=function(e){e.__complete=!0;var t,n,r,i,o,s,a,c=this.elem.globalData.fontManager,u=this.data,l=[],d=0,f=u.m.g,h=0,p=0,g=0,m=[],b=0,y=0,v=c.getFontByName(e.f),w=0,x=X(v);e.fWeight=x.weight,e.fStyle=x.style,e.finalSize=e.s,e.finalText=this.buildFinalText(e.t),n=e.finalText.length,e.finalLineHeight=e.lh;var S,A=e.tr/1e3*e.finalSize;if(e.sz)for(var E,_,C=!0,I=e.sz[0],k=e.sz[1];C;){E=0,b=0,n=(_=this.buildFinalText(e.t)).length,A=e.tr/1e3*e.finalSize;var T=-1;for(t=0;tI&&" "!==_[t]?(-1===T?n+=1:t=T,E+=e.finalLineHeight||1.2*e.finalSize,_.splice(t,T===t?1:0,"\r"),T=-1,b=0):(b+=w,b+=A);E+=v.ascent*e.finalSize/100,this.canResize&&e.finalSize>this.minimumFontSize&&ky?b:y,b=-2*A,i="",r=!0,g+=1):i=M,c.chars?(a=c.getCharData(M,v.fStyle,c.getFontByName(e.f).fFamily),w=r?0:a.w*e.finalSize/100):w=c.measureText(i,e.f,e.finalSize)," "===M?P+=w+A:(b+=w+A+P,P=0),l.push({l:w,an:w,add:h,n:r,anIndexes:[],val:i,line:g,animatorJustifyOffset:0}),2==f){if(h+=w,""===i||" "===i||t===n-1){for(""!==i&&" "!==i||(h-=w);p<=t;)l[p].an=h,l[p].ind=d,l[p].extra=w,p+=1;d+=1,h=0}}else if(3==f){if(h+=w,""===i||t===n-1){for(""===i&&(h-=w);p<=t;)l[p].an=h,l[p].ind=d,l[p].extra=w,p+=1;h=0,d+=1}}else l[d].ind=d,l[d].extra=0,d+=1;if(e.l=l,y=b>y?b:y,m.push(b),e.sz)e.boxWidth=e.sz[0],e.justifyOffset=0;else switch(e.boxWidth=y,e.j){case 1:e.justifyOffset=-e.boxWidth;break;case 2:e.justifyOffset=-e.boxWidth/2;break;default:e.justifyOffset=0}e.lineWidths=m;var O,R,N,B,L=u.a;s=L.length;var D=[];for(o=0;o0?i=this.ne.v/100:o=-this.ne.v/100,this.xe.v>0?s=1-this.xe.v/100:a=1+this.xe.v/100;var c=z.getBezierEasing(i,o,s,a).get,u=0,l=this.finalS,d=this.finalE,f=this.data.sh;if(2===f)u=c(u=d===l?r>=d?1:0:e(0,t(.5/(d-l)+(r-l)/(d-l),1)));else if(3===f)u=c(u=d===l?r>=d?0:1:1-e(0,t(.5/(d-l)+(r-l)/(d-l),1)));else if(4===f)d===l?u=0:(u=e(0,t(.5/(d-l)+(r-l)/(d-l),1)))<.5?u*=2:u=1-2*(u-.5),u=c(u);else if(5===f){if(d===l)u=0;else{var h=d-l,p=-h/2+(r=t(e(0,r+.5-l),d-l)),g=h/2;u=Math.sqrt(1-p*p/(g*g))}u=c(u)}else 6===f?(d===l?u=0:(r=t(e(0,r+.5-l),d-l),u=(1+Math.cos(Math.PI+2*Math.PI*r/(d-l)))/2),u=c(u)):(r>=n(l)&&(u=e(0,t(r-l<0?t(d,1)-(l-r):d-r,1))),u=c(u));if(100!==this.sm.v){var m=.01*this.sm.v;0===m&&(m=1e-8);var b=.5-.5*m;u1&&(u=1)}return u*this.a.v},getValue:function(e){this.iterateDynamicProperties(),this._mdf=e||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,e&&2===this.data.r&&(this.e.v=this._currentTextLength);var t=2===this.data.r?1:100/this.data.totalChars,n=this.o.v/t,r=this.s.v/t+n,i=this.e.v/t+n;if(r>i){var o=r;r=i,i=o}this.finalS=r,this.finalE=i}},H([U],r),{getTextSelectorProp:i}}(),we=function(e,t,n){var r=0,i=e,o=B(i);function s(){return r?o[r-=1]:t()}function a(e){r===i&&(o=xe.double(o),i*=2),n&&n(e),o[r]=e,r+=1}return{newElement:s,release:a}},xe=function(){function e(e){return e.concat(B(e.length))}return{double:e}}(),Se=function(){function e(){return N("float32",2)}return we(8,e)}(),Ae=function(){function e(){return new $}function t(e){var t,n=e._length;for(t=0;t0&&(this.maskElement.setAttribute("id",b),this.element.maskedElement.setAttribute(v,"url("+r+"#"+b+")"),s.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}function Pe(){}function Oe(){}function Re(){}function Ne(){}function Be(){}function Le(e,t){this.elem=e,this.pos=t}function De(e,t){this.data=e,this.type=e.ty,this.d="",this.lvl=t,this._mdf=!1,this.closed=!0===e.hd,this.pElem=L("path"),this.msElem=null}function Ue(e,t,n){this.caches=[],this.styles=[],this.transformers=e,this.lStr="",this.sh=n,this.lvl=t,this._isAnimated=!!n.k;for(var r=0,i=e.length;r=0;t-=1)this.elements[t]||(n=this.layers[t]).ip-n.st<=e-this.layers[t].st&&n.op-n.st>e-this.layers[t].st&&this.buildItem(t),this.completeLayers=!!this.elements[t]&&this.completeLayers;this.checkPendingElements()},ke.prototype.createItem=function(e){switch(e.ty){case 2:return this.createImage(e);case 0:return this.createComp(e);case 1:return this.createSolid(e);case 3:default:return this.createNull(e);case 4:return this.createShape(e);case 5:return this.createText(e);case 6:return this.createAudio(e);case 13:return this.createCamera(e);case 15:return this.createFootage(e)}},ke.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},ke.prototype.createAudio=function(e){return new tt(e,this.globalData,this)},ke.prototype.createFootage=function(e){return new FootageElement(e,this.globalData,this)},ke.prototype.buildAllItems=function(){var e,t=this.layers.length;for(e=0;e=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].prepareFrame(e-this.layers[t].st);if(this.globalData._mdf)for(t=0;t1&&(o+=" C"+t.o[r-1][0]+","+t.o[r-1][1]+" "+t.i[0][0]+","+t.i[0][1]+" "+t.v[0][0]+","+t.v[0][1]),n.lastPath!==o){var s="";n.elem&&(t.c&&(s=e.inv?this.solidPath+o:o),n.elem.setAttribute("d",s)),n.lastPath=o}},Me.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null},Pe.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(e){this.hierarchy=e},setAsParent:function(){this._isParent=!0},checkParenting:function(){void 0!==this.data.parent&&this.comp.buildElementParenting(this,this.data.parent,[])}},Oe.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(e,t){var n,r=this.dynamicProperties.length;for(n=0;ne?!0!==this.isInRange&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):!1!==this.isInRange&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,t=this.renderableComponents.length;for(e=0;e0;)c=r.transformers[g].mProps._mdf||c,p-=1,g-=1;if(c)for(p=b-r.styles[l].lvl,g=r.transformers.length-1;p>0;)h=r.transformers[g].mProps.v.props,f.transform(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]),p-=1,g-=1}else f=e;if(s=(d=r.sh.paths)._length,c){for(a="",o=0;o=1?y=.99:y<=-1&&(y=-.99);var v=a*y,w=Math.cos(b+t.a.v)*v+l[0],x=Math.sin(b+t.a.v)*v+l[1];c.setAttribute("fx",w),c.setAttribute("fy",x),u&&!t.g._collapsable&&(t.of.setAttribute("fx",w),t.of.setAttribute("fy",x))}}function c(e,t,n){var r=t.style,i=t.d;i&&(i._mdf||n)&&i.dashStr&&(r.pElem.setAttribute("stroke-dasharray",i.dashStr),r.pElem.setAttribute("stroke-dashoffset",i.dashoffset[0])),t.c&&(t.c._mdf||n)&&r.pElem.setAttribute("stroke","rgb("+d(t.c.v[0])+","+d(t.c.v[1])+","+d(t.c.v[2])+")"),(t.o._mdf||n)&&r.pElem.setAttribute("stroke-opacity",t.o.v),(t.w._mdf||n)&&(r.pElem.setAttribute("stroke-width",t.w.v),r.msElem&&r.msElem.setAttribute("stroke-width",t.w.v))}return{createRenderFunction:n}}();function Ge(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}function Ze(){}function Ke(e,t,n){this.initFrame(),this.initBaseData(e,t,n),this.initFrame(),this.initTransform(e,t,n),this.initHierarchy()}function Xe(){}function Ye(){}function Je(){}function Qe(){}function $e(e,t,n){this.assetData=t.getAssetData(e.refId),this.initElement(e,t,n),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}function et(e,t,n){this.initElement(e,t,n)}function tt(e,t,n){this.initFrame(),this.initRenderable(),this.assetData=t.getAssetData(e.refId),this.initBaseData(e,t,n),this._isPlaying=!1,this._canPlay=!1;var r=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(r),this._currentTime=0,this.globalData.audioController.addAudio(this),this.tm=e.tm?J.getProp(this,e.tm,0,t.frameRate,this):{_placeholder:!0}}function nt(e,t,n){this.layers=e.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?B(this.layers.length):[],this.initElement(e,t,n),this.tm=e.tm?J.getProp(this,e.tm,0,t.frameRate,this):{_placeholder:!0}}function rt(e,t,n){this.textSpans=[],this.renderType="svg",this.initElement(e,t,n)}function it(e,t,n){this.shapes=[],this.shapesData=e.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(e,t,n),this.prevViewData=[]}function ot(e,t){this.filterManager=t;var n=L("feColorMatrix");if(n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","linearRGB"),n.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),n.setAttribute("result","f1"),e.appendChild(n),(n=L("feColorMatrix")).setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),n.setAttribute("result","f2"),e.appendChild(n),this.matrixFilter=n,100!==t.effectElements[2].p.v||t.effectElements[2].p.k){var r,i=L("feMerge");e.appendChild(i),(r=L("feMergeNode")).setAttribute("in","SourceGraphic"),i.appendChild(r),(r=L("feMergeNode")).setAttribute("in","f2"),i.appendChild(r)}}function st(e,t){this.filterManager=t;var n=L("feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),e.appendChild(n),this.matrixFilter=n}function at(e,t){e.setAttribute("x","-100%"),e.setAttribute("y","-100%"),e.setAttribute("width","300%"),e.setAttribute("height","300%"),this.filterManager=t;var n=L("feGaussianBlur");e.appendChild(n),this.feGaussianBlur=n}function ct(e,t){this.initialized=!1,this.filterManager=t,this.elem=e,this.paths=[]}function ut(e,t){this.filterManager=t;var n=L("feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","linearRGB"),n.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),n.setAttribute("result","f1"),e.appendChild(n);var r=L("feComponentTransfer");r.setAttribute("color-interpolation-filters","sRGB"),e.appendChild(r),this.matrixFilter=r;var i=L("feFuncR");i.setAttribute("type","table"),r.appendChild(i),this.feFuncR=i;var o=L("feFuncG");o.setAttribute("type","table"),r.appendChild(o),this.feFuncG=o;var s=L("feFuncB");s.setAttribute("type","table"),r.appendChild(s),this.feFuncB=s}function lt(e,t){this.filterManager=t;var n=this.filterManager.effectElements,r=L("feComponentTransfer");(n[10].p.k||0!==n[10].p.v||n[11].p.k||1!==n[11].p.v||n[12].p.k||1!==n[12].p.v||n[13].p.k||0!==n[13].p.v||n[14].p.k||1!==n[14].p.v)&&(this.feFuncR=this.createFeFunc("feFuncR",r)),(n[17].p.k||0!==n[17].p.v||n[18].p.k||1!==n[18].p.v||n[19].p.k||1!==n[19].p.v||n[20].p.k||0!==n[20].p.v||n[21].p.k||1!==n[21].p.v)&&(this.feFuncG=this.createFeFunc("feFuncG",r)),(n[24].p.k||0!==n[24].p.v||n[25].p.k||1!==n[25].p.v||n[26].p.k||1!==n[26].p.v||n[27].p.k||0!==n[27].p.v||n[28].p.k||1!==n[28].p.v)&&(this.feFuncB=this.createFeFunc("feFuncB",r)),(n[31].p.k||0!==n[31].p.v||n[32].p.k||1!==n[32].p.v||n[33].p.k||1!==n[33].p.v||n[34].p.k||0!==n[34].p.v||n[35].p.k||1!==n[35].p.v)&&(this.feFuncA=this.createFeFunc("feFuncA",r)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(r.setAttribute("color-interpolation-filters","sRGB"),e.appendChild(r),r=L("feComponentTransfer")),(n[3].p.k||0!==n[3].p.v||n[4].p.k||1!==n[4].p.v||n[5].p.k||1!==n[5].p.v||n[6].p.k||0!==n[6].p.v||n[7].p.k||1!==n[7].p.v)&&(r.setAttribute("color-interpolation-filters","sRGB"),e.appendChild(r),this.feFuncRComposed=this.createFeFunc("feFuncR",r),this.feFuncGComposed=this.createFeFunc("feFuncG",r),this.feFuncBComposed=this.createFeFunc("feFuncB",r))}function dt(e,t){var n=t.container.globalData.renderConfig.filterSize;e.setAttribute("x",n.x),e.setAttribute("y",n.y),e.setAttribute("width",n.width),e.setAttribute("height",n.height),this.filterManager=t;var r=L("feGaussianBlur");r.setAttribute("in","SourceAlpha"),r.setAttribute("result","drop_shadow_1"),r.setAttribute("stdDeviation","0"),this.feGaussianBlur=r,e.appendChild(r);var i=L("feOffset");i.setAttribute("dx","25"),i.setAttribute("dy","0"),i.setAttribute("in","drop_shadow_1"),i.setAttribute("result","drop_shadow_2"),this.feOffset=i,e.appendChild(i);var o=L("feFlood");o.setAttribute("flood-color","#00ff00"),o.setAttribute("flood-opacity","1"),o.setAttribute("result","drop_shadow_3"),this.feFlood=o,e.appendChild(o);var s=L("feComposite");s.setAttribute("in","drop_shadow_3"),s.setAttribute("in2","drop_shadow_2"),s.setAttribute("operator","in"),s.setAttribute("result","drop_shadow_4"),e.appendChild(s);var a,c=L("feMerge");e.appendChild(c),a=L("feMergeNode"),c.appendChild(a),(a=L("feMergeNode")).setAttribute("in","SourceGraphic"),this.feMergeNode=a,this.feMerge=c,this.originalNodeAdded=!1,c.appendChild(a)}Ge.prototype={addTransformSequence:function(e){var t,n=e.length,r="_";for(t=0;t=0;r-=1)n=e.transforms[r].transform.mProps.v.props,e.finalTransform.transform(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15]);e._mdf=o},processSequences:function(e){var t,n=this.sequenceList.length;for(t=0;t=0&&!this.shapeModifiers[e].processShapes(this._isFirstFrame);e-=1);}},searchProcessedElement:function(e){for(var t=this.processedElements,n=0,r=t.length;n=0;n-=1)(this.completeLayers||this.elements[n])&&(this.elements[n].prepareFrame(this.renderedFrame-this.layers[n].st),this.elements[n]._mdf&&(this._mdf=!0))}},Qe.prototype.renderInnerContent=function(){var e,t=this.layers.length;for(e=0;e.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},tt.prototype.show=function(){},tt.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},tt.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},tt.prototype.resume=function(){this._canPlay=!0},tt.prototype.setRate=function(e){this.audio.rate(e)},tt.prototype.volume=function(e){this.audio.volume(e)},tt.prototype.getBaseElement=function(){return null},tt.prototype.destroy=function(){},tt.prototype.sourceRectAtTime=function(){},tt.prototype.initExpressions=function(){},H([Te,Qe,Xe],nt),H([Ze,Re,Xe,Pe,Oe,Be,Je],rt),rt.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=L("text"))},rt.prototype.buildTextContents=function(e){for(var t=0,n=e.length,r=[],i="";te?this.textSpans[e]:L(c?"path":"text"),v<=e&&(s.setAttribute("stroke-linecap","butt"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("stroke-miterlimit","4"),this.textSpans[e]=s,this.layerElement.appendChild(s)),s.style.display="inherit"),l.reset(),l.scale(n.finalSize/100,n.finalSize/100),f&&(a[e].n&&(h=-m,p+=n.yOffset,p+=g?1:0,g=!1),this.applyTextPropertiesToMatrix(n,l,a[e].line,h,p),h+=a[e].l||0,h+=m),c?(u=(b=(y=this.globalData.fontManager.getCharData(n.finalText[e],r.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily))&&y.data||{}).shapes?b.shapes[0].it:[],f?d+=this.createPathShape(l,u):s.setAttribute("d",this.createPathShape(l,u))):(f&&s.setAttribute("transform","translate("+l.props[12]+","+l.props[13]+")"),s.textContent=a[e].val,s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"));f&&s&&s.setAttribute("d",d)}else{var w=this.textContainer,x="start";switch(n.j){case 1:x="end";break;case 2:x="middle";break;default:x="start"}w.setAttribute("text-anchor",x),w.setAttribute("letter-spacing",m);var S=this.buildTextContents(n.finalText);for(t=S.length,p=n.ps?n.ps[1]+n.ascent:0,e=0;e1&&a&&this.setShapesAsAnimated(s)}},it.prototype.setShapesAsAnimated=function(e){var t,n=e.length;for(t=0;t=0;a-=1){if((f=this.searchProcessedElement(e[a]))?t[a]=n[f-1]:e[a]._render=s,"fl"===e[a].ty||"st"===e[a].ty||"gf"===e[a].ty||"gs"===e[a].ty)f?t[a].style.closed=!1:t[a]=this.createStyleElement(e[a],i),e[a]._render&&t[a].style.pElem.parentNode!==r&&r.appendChild(t[a].style.pElem),g.push(t[a].style);else if("gr"===e[a].ty){if(f)for(u=t[a].it.length,c=0;c=l?p<0?r:i:r+h*Math.pow((o-e)/p,1/n),d[f]=s,f+=1,a+=256/(c-1);return d.join(" ")},lt.prototype.renderFrame=function(e){if(e||this.filterManager._mdf){var t,n=this.filterManager.effectElements;this.feFuncRComposed&&(e||n[3].p._mdf||n[4].p._mdf||n[5].p._mdf||n[6].p._mdf||n[7].p._mdf)&&(t=this.getTableValue(n[3].p.v,n[4].p.v,n[5].p.v,n[6].p.v,n[7].p.v),this.feFuncRComposed.setAttribute("tableValues",t),this.feFuncGComposed.setAttribute("tableValues",t),this.feFuncBComposed.setAttribute("tableValues",t)),this.feFuncR&&(e||n[10].p._mdf||n[11].p._mdf||n[12].p._mdf||n[13].p._mdf||n[14].p._mdf)&&(t=this.getTableValue(n[10].p.v,n[11].p.v,n[12].p.v,n[13].p.v,n[14].p.v),this.feFuncR.setAttribute("tableValues",t)),this.feFuncG&&(e||n[17].p._mdf||n[18].p._mdf||n[19].p._mdf||n[20].p._mdf||n[21].p._mdf)&&(t=this.getTableValue(n[17].p.v,n[18].p.v,n[19].p.v,n[20].p.v,n[21].p.v),this.feFuncG.setAttribute("tableValues",t)),this.feFuncB&&(e||n[24].p._mdf||n[25].p._mdf||n[26].p._mdf||n[27].p._mdf||n[28].p._mdf)&&(t=this.getTableValue(n[24].p.v,n[25].p.v,n[26].p.v,n[27].p.v,n[28].p.v),this.feFuncB.setAttribute("tableValues",t)),this.feFuncA&&(e||n[31].p._mdf||n[32].p._mdf||n[33].p._mdf||n[34].p._mdf||n[35].p._mdf)&&(t=this.getTableValue(n[31].p.v,n[32].p.v,n[33].p.v,n[34].p.v,n[35].p.v),this.feFuncA.setAttribute("tableValues",t))}},dt.prototype.renderFrame=function(e){if(e||this.filterManager._mdf){if((e||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),e||this.filterManager.effectElements[0].p._mdf){var t=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",O(Math.round(255*t[0]),Math.round(255*t[1]),Math.round(255*t[2])))}if((e||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),e||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var n=this.filterManager.effectElements[3].p.v,r=(this.filterManager.effectElements[2].p.v-90)*m,i=n*Math.cos(r),o=n*Math.sin(r);this.feOffset.setAttribute("dx",i),this.feOffset.setAttribute("dy",o)}}};var ft=[];function ht(e,t,n){this.initialized=!1,this.filterManager=t,this.filterElem=e,this.elem=n,n.matteElement=L("g"),n.matteElement.appendChild(n.layerElement),n.matteElement.appendChild(n.transformedElement),n.baseElement=n.matteElement}function pt(){}ht.prototype.findSymbol=function(e){for(var t=0,n=ft.length;t=0;t-=1)n[t].animation.destroy(e)}function _(e,t,n){var r,i=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),o=i.length;for(r=0;rthis.animationData.op&&(this.animationData.op=e.op,this.totalFrames=Math.floor(e.op-this.animationData.ip));var t,n,r=this.animationData.layers,i=r.length,o=e.layers,s=o.length;for(n=0;nthis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},mt.prototype.renderFrame=function(){if(!1!==this.isLoaded&&this.renderer)try{this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(e){this.triggerRenderFrameError(e)}},mt.prototype.play=function(e){e&&this.name!==e||!0===this.isPaused&&(this.isPaused=!1,this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},mt.prototype.pause=function(e){e&&this.name!==e||!1===this.isPaused&&(this.isPaused=!0,this._idle=!0,this.trigger("_idle"),this.audioController.pause())},mt.prototype.togglePause=function(e){e&&this.name!==e||(!0===this.isPaused?this.play():this.pause())},mt.prototype.stop=function(e){e&&this.name!==e||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},mt.prototype.getMarkerData=function(e){for(var t,n=0;n=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?t>=this.totalFrames?(this.playCount+=1,this.checkSegments(t%this.totalFrames)||(this.setCurrentRawFrameValue(t%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(t):this.checkSegments(t>this.totalFrames?t%this.totalFrames:0)||(n=!0,t=this.totalFrames-1):t<0?this.checkSegments(t%this.totalFrames)||(!this.loop||this.playCount--<=0&&!0!==this.loop?(n=!0,t=0):(this.setCurrentRawFrameValue(this.totalFrames+t%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(t),n&&(this.setCurrentRawFrameValue(t),this.pause(),this.trigger("complete"))}},mt.prototype.adjustSegment=function(e,t){this.playCount=0,e[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=e[0]-e[1],this.timeCompleted=this.totalFrames,this.firstFrame=e[1],this.setCurrentRawFrameValue(this.totalFrames-.001-t)):e[1]>e[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=e[1]-e[0],this.timeCompleted=this.totalFrames,this.firstFrame=e[0],this.setCurrentRawFrameValue(.001+t)),this.trigger("segmentStart")},mt.prototype.setSegment=function(e,t){var n=-1;this.isPaused&&(this.currentRawFrame+this.firstFramet&&(n=t-e)),this.firstFrame=e,this.totalFrames=t-e,this.timeCompleted=this.totalFrames,-1!==n&&this.goToAndStop(n,!0)},mt.prototype.playSegments=function(e,t){if(t&&(this.segments.length=0),"object"===typeof e[0]){var n,r=e.length;for(n=0;n1&&(g=e);y(!(g>=50))}function _t(){return"undefined"!==typeof navigator}function Ct(e,n){"expressions"===e&&(t=n)}function It(e){switch(e){case"propertyFactory":return J;case"shapePropertyFactory":return ee;case"matrix":return q;default:return null}}function kt(){"complete"===document.readyState&&(clearInterval(Lt),wt())}function Tt(e){for(var t=Mt.split("&"),n=0;n=0||(i[n]=e[n]);return i}(e,d),s=r.Children.only(t),a=i.isForwardRef(s)?l:u,c=s&&o&&Object.keys(o).length>0?r.cloneElement(s,o):s;return r.createElement(a,{innerRef:n},c)}},34714:function(e,t,n){"use strict";n.d(t,{I:function(){return i},n:function(){return r}});var r=function(e,t){"function"!==typeof e?null!==e&&"object"===typeof e&&(e.current=t):e(t)},i=function(e){return null!==e&&"object"===typeof e&&e.hasOwnProperty("current")}},46702:function(e,t,n){"use strict";var r=n(64836),i=r(n(18698)),o=r(n(56690)),s=r(n(89728)),a=r(n(66115)),c=r(n(61655)),u=r(n(94993)),l=r(n(73808));function d(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=(0,l.default)(e);if(t){var i=(0,l.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var f=n(67294),h=n(99309).generateQuery,p=[],g=!1,m=function(e){(0,c.default)(n,e);var t=d(n);function n(e){var r;(0,o.default)(this,n),(r=t.call(this,e)).renderCaptcha=r.renderCaptcha.bind((0,a.default)(r)),r.resetCaptcha=r.resetCaptcha.bind((0,a.default)(r)),r.removeCaptcha=r.removeCaptcha.bind((0,a.default)(r)),r.handleOnLoad=r.handleOnLoad.bind((0,a.default)(r)),r.handleSubmit=r.handleSubmit.bind((0,a.default)(r)),r.handleExpire=r.handleExpire.bind((0,a.default)(r)),r.handleError=r.handleError.bind((0,a.default)(r));var i="undefined"!==typeof hcaptcha;return r.ref=f.createRef(),r.state={isApiReady:i,isRemoved:!1,elementId:e.id,captchaId:""},r}return(0,s.default)(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.apihost,n=e.assethost,r=e.endpoint,i=e.host,o=e.imghost,s=e.languageOverride,a=e.reCaptchaCompat,c=e.reportapi,u=e.sentry,l=e.custom;this.state.isApiReady?this.renderCaptcha():(g||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g=!0,window.hcaptchaOnLoad=function(){p=p.filter((function(e){return e(),!1}))};var t=e.apihost||"https://js.hcaptcha.com";delete e.apihost;var n=document.createElement("script");n.src="".concat(t,"/1/api.js?render=explicit&onload=hcaptchaOnLoad"),n.async=!0;var r=h(e);n.src+=""!==r?"&".concat(r):"",document.head.appendChild(n)}({apihost:t,assethost:n,endpoint:r,hl:s,host:i,imghost:o,recaptchacompat:!1===a?"off":null,reportapi:c,sentry:u,custom:l}),p.push(this.handleOnLoad))}},{key:"componentWillUnmount",value:function(){var e=this.state,t=e.isApiReady,n=e.isRemoved,r=e.captchaId;t&&!n&&(hcaptcha.reset(r),hcaptcha.remove(r))}},{key:"shouldComponentUpdate",value:function(e,t){return this.state.isApiReady===t.isApiReady&&this.state.isRemoved===t.isRemoved}},{key:"componentDidUpdate",value:function(e){var t=this;["sitekey","size","theme","tabindex","languageOverride","endpoint"].every((function(n){return e[n]===t.props[n]}))||this.removeCaptcha((function(){t.renderCaptcha()}))}},{key:"renderCaptcha",value:function(e){if(this.state.isApiReady){var t=Object.assign({"error-callback":this.handleError,"expired-callback":this.handleExpire,callback:this.handleSubmit},this.props,{hl:this.props.hl||this.props.languageOverride,languageOverride:void 0}),n=hcaptcha.render(this.ref.current,t);this.setState({isRemoved:!1,captchaId:n},(function(){e&&e()}))}}},{key:"resetCaptcha",value:function(){var e=this.state,t=e.isApiReady,n=e.isRemoved,r=e.captchaId;t&&!n&&hcaptcha.reset(r)}},{key:"removeCaptcha",value:function(e){var t=this.state,n=t.isApiReady,r=t.isRemoved,i=t.captchaId;n&&!r&&this.setState({isRemoved:!0},(function(){hcaptcha.remove(i),e&&e()}))}},{key:"handleOnLoad",value:function(){var e=this;this.setState({isApiReady:!0},(function(){e.renderCaptcha((function(){var t=e.props.onLoad;t&&t()}))}))}},{key:"handleSubmit",value:function(e){var t=this.props.onVerify,n=this.state,r=n.isRemoved,i=n.captchaId;"undefined"===typeof hcaptcha||r||t(hcaptcha.getResponse(i),hcaptcha.getRespKey(i))}},{key:"handleExpire",value:function(){var e=this.props.onExpire,t=this.state,n=t.isApiReady,r=t.isRemoved,i=t.captchaId;n&&!r&&(hcaptcha.reset(i),e&&e())}},{key:"handleError",value:function(e){var t=this.props.onError,n=this.state,r=n.isApiReady,i=n.isRemoved,o=n.captchaId;r&&!i&&(hcaptcha.reset(o),t&&t(e))}},{key:"execute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.state,n=t.isApiReady,r=t.isRemoved,o=t.captchaId;if(n&&!r)return e&&"object"!==(0,i.default)(e)&&(e=null),hcaptcha.execute(o,e)}},{key:"render",value:function(){var e=this.state.elementId;return f.createElement("div",{ref:this.ref,id:e})}}]),n}(f.Component);e.exports=m},99309:function(e,t,n){"use strict";var r=n(64836)(n(27424));e.exports={generateQuery:function(e){return Object.entries(e).filter((function(e){var t=(0,r.default)(e,2),n=(t[0],t[1]);return n||!1===n})).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(i))})).join("&")}}},33037:function(e){e.exports=function(){return e={418:function(e,t){!function(e,t){for(var n in t)e[n]=t[n]}(t,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={splitValues:!1});var n,i=this;this.headersMap={},e&&("undefined"!=typeof Headers&&e instanceof Headers?r.getHeaderKeys(e).forEach((function(n){r.getHeaderValues(e,n).forEach((function(e){t.splitValues?i.append(n,r.splitHeaderValue(e)):i.append(n,e)}))})):"object"==typeof(n=e)&&"object"==typeof n.headersMap&&"function"==typeof n.forEach?e.forEach((function(e,t){i.append(e,t)})):"undefined"!=typeof Map&&e instanceof Map?e.forEach((function(e,t){i.append(t,e)})):"string"==typeof e?this.appendFromString(e):"object"==typeof e&&Object.getOwnPropertyNames(e).forEach((function(t){var n=e[t];Array.isArray(n)?n.forEach((function(e){i.append(t,e)})):i.append(t,n)})))}return e.prototype.appendFromString=function(e){for(var t=e.split("\r\n"),n=0;n0){var o=r.substring(0,i).trim(),s=r.substring(i+1).trim();this.append(o,s)}}},e.prototype.delete=function(e,t){var n=r.normalizeName(e);if(void 0===t)delete this.headersMap[n];else{var i=this.headersMap[n];if(i){var o=i.indexOf(t);o>=0&&i.splice(o,1),0===i.length&&delete this.headersMap[n]}}},e.prototype.append=function(e,t){var n=this,i=r.normalizeName(e);Array.isArray(this.headersMap[i])||(this.headersMap[i]=[]),Array.isArray(t)?t.forEach((function(e){n.headersMap[i].push(r.normalizeValue(e))})):this.headersMap[i].push(r.normalizeValue(t))},e.prototype.set=function(e,t){var n=r.normalizeName(e);if(Array.isArray(t)){var i=[];t.forEach((function(e){i.push(r.normalizeValue(e))})),this.headersMap[n]=i}else this.headersMap[n]=[r.normalizeValue(t)]},e.prototype.has=function(e,t){var n=this.headersMap[r.normalizeName(e)];if(!Array.isArray(n))return!1;if(void 0!==t){var i=r.normalizeValue(t);return n.indexOf(i)>=0}return!0},e.prototype.get=function(e){var t=this.headersMap[r.normalizeName(e)];return void 0!==t?t.concat():[]},e.prototype.forEach=function(e){var t=this;Object.getOwnPropertyNames(this.headersMap).forEach((function(n){e(n,t.headersMap[n])}),this)},e.prototype.toHeaders=function(){if("undefined"!=typeof Headers){var e=new Headers;return this.forEach((function(t,n){n.forEach((function(n){e.append(t,n)}))})),e}throw new Error("Headers class is not defined")},e}();t.BrowserHeaders=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);t.BrowserHeaders=r.BrowserHeaders},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iterateHeaders=function(e,t){for(var n=e[Symbol.iterator](),r=n.next();!r.done;)t(r.value[0]),r=n.next()},t.iterateHeadersKeys=function(e,t){for(var n=e.keys(),r=n.next();!r.done;)t(r.value),r=n.next()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.normalizeName=function(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()},t.normalizeValue=function(e){return"string"!=typeof e&&(e=String(e)),e},t.getHeaderValues=function(e,t){var n=e;if(n instanceof Headers&&n.getAll)return n.getAll(t);var r=n.get(t);return r&&"string"==typeof r?[r]:r},t.getHeaderKeys=function(e){var t=e,n={},i=[];return t.keys?r.iterateHeadersKeys(t,(function(e){n[e]||(n[e]=!0,i.push(e))})):t.forEach?t.forEach((function(e,t){n[t]||(n[t]=!0,i.push(t))})):r.iterateHeaders(t,(function(e){var t=e[0];n[t]||(n[t]=!0,i.push(t))})),i},t.splitHeaderValue=function(e){var t=[];return e.split(", ").forEach((function(e){e.split(",").forEach((function(e){t.push(e)}))})),t}}]))},617:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChunkParser=t.ChunkType=t.encodeASCII=t.decodeASCII=void 0;var r,i=n(65);function o(e){return 9===(t=e)||10===t||13===t||e>=32&&e<=126;var t}function s(e){for(var t=0;t!==e.length;++t)if(!o(e[t]))throw new Error("Metadata is not valid (printable) ASCII");return String.fromCharCode.apply(String,Array.prototype.slice.call(e))}function a(e){return 128==(128&e.getUint8(0))}function c(e){return e.getUint32(1,!1)}function u(e,t,n){return e.byteLength-t>=n}function l(e,t,n){if(e.slice)return e.slice(t,n);var r=e.length;void 0!==n&&(r=n);for(var i=new Uint8Array(r-t),o=0,s=t;s=0?n:o.httpStatusToCode(t);this.props.debug&&s.debug("onHeaders.code",r);var i=e.get("grpc-message")||[];if(this.props.debug&&s.debug("onHeaders.gRPCMessage",i),this.rawOnHeaders(e),r!==o.Code.OK){var a=this.decodeGRPCStatus(i[0]);this.rawOnError(r,a,e)}}},e.prototype.onTransportChunk=function(e){var t=this;if(this.closed)this.props.debug&&s.debug("grpc.onChunk received after request was closed - ignoring");else{var n=[];try{n=this.parser.parse(e)}catch(e){return this.props.debug&&s.debug("onChunk.parsing error",e,e.message),void this.rawOnError(o.Code.Internal,"parsing error: "+e.message)}n.forEach((function(e){if(e.chunkType===i.ChunkType.MESSAGE){var n=t.methodDefinition.responseType.deserializeBinary(e.data);t.rawOnMessage(n)}else e.chunkType===i.ChunkType.TRAILERS&&(t.responseHeaders?(t.responseTrailers=new r.Metadata(e.trailers),t.props.debug&&s.debug("onChunk.trailers",t.responseTrailers)):(t.responseHeaders=new r.Metadata(e.trailers),t.rawOnHeaders(t.responseHeaders)))}))}},e.prototype.onTransportEnd=function(){if(this.props.debug&&s.debug("grpc.onEnd"),this.closed)this.props.debug&&s.debug("grpc.onEnd received after request was closed - ignoring");else if(void 0!==this.responseTrailers){var e=l(this.responseTrailers);if(null!==e){var t=this.responseTrailers.get("grpc-message"),n=this.decodeGRPCStatus(t[0]);this.rawOnEnd(e,n,this.responseTrailers)}else this.rawOnError(o.Code.Internal,"Response closed without grpc-status (Trailers provided)")}else{if(void 0===this.responseHeaders)return void this.rawOnError(o.Code.Unknown,"Response closed without headers");var r=l(this.responseHeaders),i=this.responseHeaders.get("grpc-message");if(this.props.debug&&s.debug("grpc.headers only response ",r,i),null===r)return void this.rawOnEnd(o.Code.Unknown,"Response closed without grpc-status (Headers only)",this.responseHeaders);var a=this.decodeGRPCStatus(i[0]);this.rawOnEnd(r,a,this.responseHeaders)}},e.prototype.decodeGRPCStatus=function(e){if(!e)return"";try{return decodeURIComponent(e)}catch(t){return e}},e.prototype.rawOnEnd=function(e,t,n){var r=this;this.props.debug&&s.debug("rawOnEnd",e,t,n),this.completed||(this.completed=!0,this.onEndCallbacks.forEach((function(i){if(!r.closed)try{i(e,t,n)}catch(e){setTimeout((function(){throw e}),0)}})))},e.prototype.rawOnHeaders=function(e){this.props.debug&&s.debug("rawOnHeaders",e),this.completed||this.onHeadersCallbacks.forEach((function(t){try{t(e)}catch(e){setTimeout((function(){throw e}),0)}}))},e.prototype.rawOnError=function(e,t,n){var i=this;void 0===n&&(n=new r.Metadata),this.props.debug&&s.debug("rawOnError",e,t),this.completed||(this.completed=!0,this.onEndCallbacks.forEach((function(r){if(!i.closed)try{r(e,t,n)}catch(e){setTimeout((function(){throw e}),0)}})))},e.prototype.rawOnMessage=function(e){var t=this;this.props.debug&&s.debug("rawOnMessage",e.toObject()),this.completed||this.closed||this.onMessageCallbacks.forEach((function(n){if(!t.closed)try{n(e)}catch(e){setTimeout((function(){throw e}),0)}}))},e.prototype.onHeaders=function(e){this.onHeadersCallbacks.push(e)},e.prototype.onMessage=function(e){this.onMessageCallbacks.push(e)},e.prototype.onEnd=function(e){this.onEndCallbacks.push(e)},e.prototype.start=function(e){if(this.started)throw new Error("Client already started - cannot .start()");this.started=!0;var t=new r.Metadata(e||{});t.set("content-type","application/grpc-web+proto"),t.set("x-grpc-web","1"),this.transport.start(t)},e.prototype.send=function(e){if(!this.started)throw new Error("Client not started - .start() must be called before .send()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .send()");if(!this.methodDefinition.requestStream&&this.sentFirstMessage)throw new Error("Message already sent for non-client-streaming method - cannot .send()");this.sentFirstMessage=!0;var t=c.frameRequest(e);this.transport.sendMessage(t)},e.prototype.finishSend=function(){if(!this.started)throw new Error("Client not started - .finishSend() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .finishSend()");this.finishedSending=!0,this.transport.finishSend()},e.prototype.close=function(){if(!this.started)throw new Error("Client not started - .start() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .close()");this.closed=!0,this.props.debug&&s.debug("request.abort aborting request"),this.transport.cancel()},e}();function l(e){var t=e.get("grpc-status")||[];if(t.length>0)try{var n=t[0];return parseInt(n,10)}catch(e){return null}return null}},346:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debug=void 0,t.debug=function(){for(var e=[],t=0;t=55296&&n<=56319){var r=e.charCodeAt(t+1);r>=56320&&r<=57343&&(n=65536+(n-55296<<10)+(r-56320))}return n}function d(e){for(var t=new Uint8Array(e.length),n=0,r=0;rs)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},55051:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeFormula=void 0;t.TypeFormula=class{constructor(e,t,n){this.name=e,this.typeParameters=t,this.metadata=n}toString(){const e=this.typeParameters.length>0?`<${this.typeParameters.map((e=>e.toString())).join(", ")}>`:"",t=`${this.name}${e}`;return void 0!==this.metadata?`${t}*${this.metadata}*`:t}}},71154:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeFormulaParser=void 0;const r=n(55051);class i{parseExpression(e){e=e.trim();const t=this.tokenizeExpression(e).filter((e=>e!==i.COMMA)),n=[];for(const r of t)if(this.isPunctuation(r))if(this.isEndOfTypeParameters(r)){const e=this.acquireTypeWithParameters(n);n.push(e)}else{if(!this.isBeginningOfTypeParameters(r))throw new Error(`Unexpected token (punctuation): ${r}`);n.push(r)}else n.push(r);if(1!==n.length)throw new Error(`Unexpected stack length at end of parsing: ${n.length}`);if(i.PUNCTUATION.includes(n[0]))throw new Error("Unexpected root element.");const o=n[0];if(o instanceof r.TypeFormula)return o;if("string"===typeof o)return new r.TypeFormula(o,[]);throw new Error(`Unexpected item on stack: ${o}`)}tokenizeExpression(e){const t=[];let n="";for(const r of e)this.isPunctuation(r)?(n&&(t.push(n.trim()),n=""),t.push(r)):n+=r;return n&&t.push(n.trim()),t}acquireTypeWithParameters(e){const t=this.acquireTypeParameters(e),n=e.pop();if("ManagedDecimal"===n||"ManagedDecimalSigned"===n){const e=t[0].name;return new r.TypeFormula(n,[],e)}return new r.TypeFormula(n,t.reverse())}acquireTypeParameters(e){const t=[];for(;;){const n=e.pop();if(void 0===n)throw new Error("Badly specified type parameters");if(this.isBeginningOfTypeParameters(n))break;if(n instanceof r.TypeFormula)t.push(n);else{if("string"!==typeof n)throw new Error(`Unexpected type parameter object in stack: ${n}`);t.push(new r.TypeFormula(n,[]))}}return t}isPunctuation(e){return i.PUNCTUATION.includes(e)}isEndOfTypeParameters(e){return e===i.END_TYPE_PARAMETERS}isBeginningOfTypeParameters(e){return e===i.BEGIN_TYPE_PARAMETERS}}t.TypeFormulaParser=i,i.BEGIN_TYPE_PARAMETERS="<",i.END_TYPE_PARAMETERS=">",i.COMMA=",",i.PUNCTUATION=[i.COMMA,i.BEGIN_TYPE_PARAMETERS,i.END_TYPE_PARAMETERS]},37570:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const r=n(36946);t.Account=class{constructor(e){this.address=r.Address.empty(),this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}}},80968:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(87698),t)},87698:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.QueryRunnerAdapter=void 0;const i=n(36946),o=n(79793);t.QueryRunnerAdapter=class{constructor(e){this.networkProvider=e.networkProvider}async runQuery(e){const t={address:i.Address.fromBech32(e.contract),caller:e.caller?i.Address.fromBech32(e.caller):void 0,func:e.function,value:e.value,getEncodedArguments:()=>e.arguments.map((e=>r.from(e).toString("hex")))},n=await this.networkProvider.queryContract(t);return new o.SmartContractQueryResponse({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.getReturnDataParts()})}}},36946:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AddressComputer=t.Address=void 0;const c=s(n(92882)),u=a(n(44431)),l=n(71289),d=n(63025),f=s(n(25145)),h=n(82357),p=n(95811),g="0".repeat(16);class m{constructor(e,t){if(!e)return this.publicKey=r.from([]),void(this.hrp=t||l.LibraryConfig.DefaultAddressHrp);if(ArrayBuffer.isView(e)){if(32!=e.length)throw new f.ErrAddressCannotCreate(e);return this.publicKey=r.from(e),void(this.hrp=t||l.LibraryConfig.DefaultAddressHrp)}if(e instanceof m){if(t)throw new f.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");return this.publicKey=e.publicKey,void(this.hrp=e.hrp)}if("string"===typeof e){if(m.isValidHex(e))return this.publicKey=r.from(e,"hex"),void(this.hrp=t||l.LibraryConfig.DefaultAddressHrp);if(t)throw new f.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");const{hrp:n,pubkey:i}=b({value:e,allowCustomHrp:!1});return this.publicKey=i,void(this.hrp=n)}throw new f.ErrAddressCannotCreate(e)}static newFromBech32(e){const{hrp:t,pubkey:n}=b({value:e,allowCustomHrp:!0});return new m(n,t)}static fromBech32(e){const{hrp:t,pubkey:n}=b({value:e,allowCustomHrp:!1});return new m(n,t)}static newFromHex(e,t){if(!m.isValidHex(e))throw new f.ErrAddressCannotCreate(e);return new m(r.from(e,"hex"),t)}static fromHex(e,t){return m.newFromHex(e,t)}static fromAddress(e){return new m(e)}static fromBuffer(e,t){return new m(e,t)}static fromString(e,t){return new m(e,t)}static isValidHex(e){return 32==r.from(e,"hex").length}static empty(){return new m("")}static isValid(e){const t=c.decodeUnsafe(e),n=t?.prefix,i=t?r.from(c.fromWords(t.words)):void 0;return n===l.LibraryConfig.DefaultAddressHrp&&32===i?.length}hex(){return this.toHex()}toHex(){return this.isEmpty()?"":this.publicKey.toString("hex")}bech32(){return this.toBech32()}toBech32(){if(this.isEmpty())return"";let e=c.toWords(this.pubkey());return c.encode(this.hrp,e)}pubkey(){return this.getPublicKey()}getPublicKey(){return this.publicKey}getHrp(){return this.hrp}isEmpty(){return 0==this.publicKey.length}equals(e){return!!e&&this.publicKey.toString()==e.publicKey.toString()}toString(){return this.toBech32()}toJSON(){return{bech32:this.toBech32(),pubkey:this.toHex()}}static Zero(){return new m("0".repeat(64))}isContractAddress(){return this.isSmartContract()}isSmartContract(){return this.toHex().startsWith(g)}}t.Address=m;function b(e){const t=e.value,n=e.allowCustomHrp;let i,o;try{const e=c.decode(t);i=e.prefix,o=r.from(c.fromWords(e.words))}catch(s){throw new f.ErrAddressCannotCreate(t,s)}if(!n&&i!=l.LibraryConfig.DefaultAddressHrp)throw new f.ErrAddressBadHrp(l.LibraryConfig.DefaultAddressHrp,i);return{hrp:i,pubkey:o}}t.AddressComputer=class{constructor(e){this.numberOfShardsWithoutMeta=e||d.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META}computeContractAddress(e,t){const n=r.alloc(8,0),i=e.getPublicKey(),o=i.slice(30),s=r.alloc(8),a=new u.default(t.toString()),c=h.bigIntToBuffer(a);s.write(c.reverse().toString("hex"),"hex");const l=r.concat([i,s]),f=p("keccak256").update(l).digest(),g=r.from(d.WasmVirtualMachine,"hex"),b=r.concat([n,g,f.slice(10,30),o]);return new m(b)}getShardOfAddress(e){return this.getShardOfPubkey(e.getPublicKey(),this.numberOfShardsWithoutMeta)}getShardOfPubkey(e,t){const n=parseInt("11",2),r=parseInt("01",2),i=e[31];if(this.isPubkeyOfMetachain(e))return d.METACHAIN_ID;let o=i&n;return o>t-1&&(o=i&r),o}isPubkeyOfMetachain(e){const t=r.from([0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=r.from(e).slice(0,t.length);if(t.equals(n))return!0;return!!r.alloc(32).equals(r.from(e))}}},70449:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncTimer=void 0;const s=o(n(25145)),a=n(25145),c=n(1853);t.AsyncTimer=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new s.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,c.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise(((t,n)=>{this.rejectionFunc=n;this.timeoutHandle=setTimeout((()=>{this.rejectionFunc=null,this.stop(),t()}),e)}))}abort(){c.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new a.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(c.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}}},89364:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Compatibility=void 0;const r=n(36946);t.Compatibility=class{static guardAddressIsSetAndNonZero(e,t,n){e&&""!=e.bech32()?e.bech32()==r.Address.Zero().bech32()&&console.warn(`${t}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`):console.warn(`${t}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`)}}},71289:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LibraryConfig=void 0;class n{}t.LibraryConfig=n,n.DefaultAddressHrp="erd"},63025:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ESDT_CONTRACT_ADDRESS=t.DELEGATION_MANAGER_SC_ADDRESS=t.CONTRACT_DEPLOY_ADDRESS=t.BECH32_ADDRESS_LENGTH=t.DEFAULT_HRP=t.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER=t.UNKNOWN_SIGNER=t.SDK_JS_SIGNER=t.METACHAIN_ID=t.WasmVirtualMachine=t.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=t.HEX_TRANSACTION_HASH_LENGTH=t.MESSAGE_PREFIX=t.DEFAULT_MESSAGE_VERSION=t.ESDT_CONTRACT_ADDRESS_HEX=t.DELEGATION_MANAGER_SC_ADDRESS_HEX=t.CONTRACT_DEPLOY_ADDRESS_HEX=t.VM_TYPE_WASM_VM=t.ARGUMENTS_SEPARATOR=t.ESDT_TRANSFER_VALUE=t.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=t.ESDTNFT_TRANSFER_FUNCTION_NAME=t.ESDT_TRANSFER_FUNCTION_NAME=t.ESDT_TRANSFER_GAS_LIMIT=t.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=t.TRANSACTION_VERSION_DEFAULT=t.TRANSACTION_OPTIONS_TX_GUARDED=t.TRANSACTION_OPTIONS_TX_HASH_SIGN=t.TRANSACTION_OPTIONS_DEFAULT=t.TRANSACTION_MIN_GAS_PRICE=void 0,t.TRANSACTION_MIN_GAS_PRICE=1e9,t.TRANSACTION_OPTIONS_DEFAULT=0,t.TRANSACTION_OPTIONS_TX_HASH_SIGN=1,t.TRANSACTION_OPTIONS_TX_GUARDED=2,t.TRANSACTION_VERSION_DEFAULT=2,t.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=2,t.ESDT_TRANSFER_GAS_LIMIT=5e5,t.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer",t.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer",t.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer",t.ESDT_TRANSFER_VALUE="0",t.ARGUMENTS_SEPARATOR="@",t.VM_TYPE_WASM_VM=new Uint8Array([5,0]),t.CONTRACT_DEPLOY_ADDRESS_HEX="0000000000000000000000000000000000000000000000000000000000000000",t.DELEGATION_MANAGER_SC_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000004ffff",t.ESDT_CONTRACT_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000002ffff",t.DEFAULT_MESSAGE_VERSION=1,t.MESSAGE_PREFIX="\x17Elrond Signed Message:\n",t.HEX_TRANSACTION_HASH_LENGTH=64,t.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=3,t.WasmVirtualMachine="0500",t.METACHAIN_ID=4294967295,t.SDK_JS_SIGNER="sdk-js",t.UNKNOWN_SIGNER="unknown",t.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER="EGLD-000000",t.DEFAULT_HRP="erd",t.BECH32_ADDRESS_LENGTH=62,t.CONTRACT_DEPLOY_ADDRESS="erd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gq4hu",t.DELEGATION_MANAGER_SC_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqylllslmq6y6",t.ESDT_CONTRACT_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"},42315:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(10545),t)},10545:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionsConverter=void 0;const i=n(47480),o=n(66679),s=n(73416);t.TransactionsConverter=class{transactionToPlainObject(e){return{nonce:Number(e.nonce),value:e.value.toString(),receiver:e.receiver,sender:e.sender,senderUsername:this.toBase64OrUndefined(e.senderUsername),receiverUsername:this.toBase64OrUndefined(e.receiverUsername),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:this.toBase64OrUndefined(e.data),chainID:e.chainID.valueOf(),version:e.version,options:0==e.options?void 0:e.options,guardian:e.guardian?e.guardian:void 0,signature:this.toHexOrUndefined(e.signature),guardianSignature:this.toHexOrUndefined(e.guardianSignature),relayer:e.relayer?e.relayer:void 0,innerTransactions:e.innerTransactions.length?e.innerTransactions.map((e=>this.transactionToPlainObject(e))):void 0}}toBase64OrUndefined(e){return e&&e.length?r.from(e).toString("base64"):void 0}toHexOrUndefined(e){return e&&e.length?r.from(e).toString("hex"):void 0}plainObjectToTransaction(e){return new o.Transaction({nonce:BigInt(e.nonce),value:BigInt(e.value||""),receiver:e.receiver,receiverUsername:this.bufferFromBase64(e.receiverUsername).toString(),sender:e.sender,senderUsername:this.bufferFromBase64(e.senderUsername).toString(),guardian:e.guardian,gasPrice:BigInt(e.gasPrice),gasLimit:BigInt(e.gasLimit),data:this.bufferFromBase64(e.data),chainID:String(e.chainID),version:Number(e.version),options:Number(e.options),signature:this.bufferFromHex(e.signature),guardianSignature:this.bufferFromHex(e.guardianSignature),relayer:e.relayer,innerTransactions:e.innerTransactions?e.innerTransactions.map((e=>this.plainObjectToTransaction(e))):void 0})}bufferFromBase64(e){return r.from(e||"","base64")}bufferFromHex(e){return r.from(e||"","hex")}transactionOnNetworkToOutcome(e){const t=(new i.ResultsParser).parseUntypedOutcome(e),n=new s.SmartContractCallOutcome({function:e.function,returnCode:t.returnCode.toString(),returnMessage:t.returnMessage,returnDataParts:t.values}),r=e.contractResults.items.map((e=>this.smartContractResultOnNetworkToSmartContractResult(e))),o=new s.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map((e=>this.eventOnNetworkToEvent(e)))});return new s.TransactionOutcome({logs:o,smartContractResults:r,directSmartContractCallOutcome:n})}smartContractResultOnNetworkToSmartContractResult(e){return new s.SmartContractResult({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:r.from(e.data),logs:new s.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map((e=>this.eventOnNetworkToEvent(e)))})})}eventOnNetworkToEvent(e){const t=e.dataPayload?.valueOf()||r.from(e.data||""),n=e.additionalData?.map((e=>r.from(e.valueOf())))||[];return 0===n.length&&t.length&&n.push(r.from(t)),new s.TransactionEvent({address:e.address.bech32(),identifier:e.identifier,topics:e.topics.map((e=>r.from(e.hex(),"hex"))),dataItems:n})}}},25145:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrSmartContractQuery=t.ErrParseTransactionOutcome=t.ErrInvalidInnerTransaction=t.ErrBadUsage=t.ErrInvalidTokenIdentifier=t.ErrIsCompletedFieldIsMissingOnTransaction=t.ErrGasLimitShouldBe0ForInnerTransaction=t.ErrInvalidRelayedV2BuilderArguments=t.ErrInvalidRelayedV1BuilderArguments=t.ErrNotImplemented=t.ErrContractInteraction=t.ErrCodec=t.ErrCannotParseTransactionOutcome=t.ErrCannotParseContractResults=t.ErrMissingFieldOnEnum=t.ErrMissingFieldOnStruct=t.ErrTypingSystem=t.ErrMock=t.ErrContractHasNoAddress=t.ErrContract=t.ErrExpectedTransactionEventsNotFound=t.ErrExpectedTransactionStatusNotReached=t.ErrTransactionWatcherTimeout=t.ErrAsyncTimerAborted=t.ErrAsyncTimerAlreadyRunning=t.ErrInvalidFunctionName=t.ErrSignatureCannotCreate=t.ErrTransactionOptionsInvalid=t.ErrTransactionVersionInvalid=t.ErrNonceInvalid=t.ErrNotEnoughGas=t.ErrAddressEmpty=t.ErrAddressBadHrp=t.ErrAddressCannotCreate=t.ErrUnexpectedCondition=t.ErrInvariantFailed=t.ErrBadType=t.ErrUnsupportedOperation=t.ErrInvalidArgument=t.Err=void 0;class n extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}summary(){let e=[];e.push({name:this.name,message:this.message});let t=this.inner;for(;t;)e.push({name:t.name,message:t.message}),t=t.inner;return e}}t.Err=n;t.ErrInvalidArgument=class extends n{constructor(e,t){super(`Invalid argument: ${e}`,t)}};t.ErrUnsupportedOperation=class extends n{constructor(e,t="not specified"){super(`Operation "${e}" not supported. Reason: ${t}`)}};t.ErrBadType=class extends n{constructor(e,t,n){super(`Bad type of "${e}": ${n}. Expected type: ${t}`)}};t.ErrInvariantFailed=class extends n{constructor(e){super(`Invariant failed: [${e}]`)}};t.ErrUnexpectedCondition=class extends n{constructor(e){super(`Unexpected condition: [${e}]`)}};t.ErrAddressCannotCreate=class extends n{constructor(e,t){super(`Cannot create address from: ${e}`,t)}};t.ErrAddressBadHrp=class extends n{constructor(e,t){super(`Wrong address HRP. Expected: ${e}, got ${t}`)}};t.ErrAddressEmpty=class extends n{constructor(){super("Address is empty")}};t.ErrNotEnoughGas=class extends n{constructor(e){super(`Not enough gas provided: ${e}`)}};t.ErrNonceInvalid=class extends n{constructor(e){super(`Invalid nonce: ${e}`)}};t.ErrTransactionVersionInvalid=class extends n{constructor(e){super(`Invalid transaction version: ${e}`)}};t.ErrTransactionOptionsInvalid=class extends n{constructor(e){super(`Invalid transaction options: ${e}`)}};t.ErrSignatureCannotCreate=class extends n{constructor(e,t){super(`Cannot create signature from: ${e}`,t)}};t.ErrInvalidFunctionName=class extends n{constructor(){super("Invalid function name")}};t.ErrAsyncTimerAlreadyRunning=class extends n{constructor(){super("Async timer already running")}};t.ErrAsyncTimerAborted=class extends n{constructor(){super("Async timer aborted")}};t.ErrTransactionWatcherTimeout=class extends n{constructor(){super("TransactionWatcher has timed out")}};t.ErrExpectedTransactionStatusNotReached=class extends n{constructor(){super("Expected transaction status not reached")}};t.ErrExpectedTransactionEventsNotFound=class extends n{constructor(){super("Expected transaction events not found")}};class r extends n{constructor(e){super(e)}}t.ErrContract=r;t.ErrContractHasNoAddress=class extends r{constructor(){super("\nThe smart contract has no address set. Make sure you provide the address in the constructor, or call setAddress() appropriately.\nIf you need to recompute the address of the contract, make use of SmartContract.computeAddress() (static method). \n")}};t.ErrMock=class extends n{constructor(e){super(e)}};t.ErrTypingSystem=class extends n{constructor(e){super(e)}};t.ErrMissingFieldOnStruct=class extends n{constructor(e,t){super(`field ${e} does not exist on struct ${t}`)}};t.ErrMissingFieldOnEnum=class extends n{constructor(e,t){super(`field ${e} does not exist on enum ${t}`)}};t.ErrCannotParseContractResults=class extends n{constructor(e){super(`cannot parse contract results: ${e}`)}};t.ErrCannotParseTransactionOutcome=class extends n{constructor(e,t){super(`cannot parse outcome of transaction ${e}: ${t}`)}};t.ErrCodec=class extends n{constructor(e){super(e)}};t.ErrContractInteraction=class extends n{constructor(e){super(e)}};t.ErrNotImplemented=class extends n{constructor(){super("Method not yet implemented")}};t.ErrInvalidRelayedV1BuilderArguments=class extends n{constructor(){super("invalid arguments for relayed v1 builder")}};t.ErrInvalidRelayedV2BuilderArguments=class extends n{constructor(){super("invalid arguments for relayed v2 builder")}};t.ErrGasLimitShouldBe0ForInnerTransaction=class extends n{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};t.ErrIsCompletedFieldIsMissingOnTransaction=class extends n{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};t.ErrInvalidTokenIdentifier=class extends n{constructor(e){super(e)}};t.ErrBadUsage=class extends n{constructor(e){super(e)}};t.ErrInvalidInnerTransaction=class extends n{constructor(e){super(e)}};t.ErrParseTransactionOutcome=class extends n{constructor(e){super(e)}};t.ErrSmartContractQuery=class extends n{constructor(e,t){super(t),this.returnCode=e}}},5884:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GasEstimator=t.DefaultGasConfiguration=void 0,t.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};const n=8e5;t.GasEstimator=class{constructor(e){this.gasConfiguration=e||t.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+1e5}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+n}forMultiESDTNFTTransfer(e,t){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+n)*t+this.gasConfiguration.gasPerDataByte*e}}},57136:function(e,t,n){"use strict";n.g.Buffer||(n.g.Buffer=n(47115).lW)},93827:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=void 0;const a=s(n(25145));class c{constructor(e){if(e)if(e instanceof r)this.hash=e;else{if("string"!==typeof e)throw new a.ErrBadType("hash","buffer | string",e);this.hash=r.from(e,"hex")}else this.hash=r.from([])}static empty(){return new c(r.from([]))}isEmpty(){return 0==this.hash.length}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}}t.Hash=c},3053:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(57136),i(n(37570),t),i(n(80968),t),i(n(36946),t),i(n(70449),t),i(n(71289),t),i(n(42315),t),i(n(25145),t),i(n(5884),t),i(n(28445),t),i(n(3879),t),i(n(1853),t),i(n(60173),t),i(n(43186),t),i(n(59903),t),i(n(77312),t),i(n(40655),t),i(n(90788),t),i(n(47480),t),i(n(23787),t),i(n(43927),t),i(n(66679),t),i(n(86030),t),i(n(94712),t),i(n(9465),t),i(n(91808),t),i(n(15360),t),i(n(44425),t),i(n(59670),t)},28445:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3879:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1853:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=t.LogLevel=void 0,function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error",e[e.None=5]="None"}(n=t.LogLevel||(t.LogLevel={}));class r{static setLevel(e){r.logLevel=e}static trace(e,...t){r.logLevel>=n.Debug||console.debug(e,t)}static debug(e,...t){r.logLevel>=n.Debug||console.debug(e,t)}static info(e,...t){r.logLevel>=n.Info||console.log(e,t)}static warn(e,...t){r.logLevel>=n.Warn||console.warn(e,t)}static error(e,...t){r.logLevel>=n.Error||console.error(e,t)}}t.Logger=r,r.logLevel=n.Debug},60173:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.MessageComputer=t.Message=void 0;const i=n(63025),o=n(36946),s=n(95811);class a{constructor(e){this.data=e.data,this.signature=e.signature,this.address=e.address,this.version=e.version||i.DEFAULT_MESSAGE_VERSION,this.signer=e.signer||i.SDK_JS_SIGNER}}t.Message=a;t.MessageComputer=class{constructor(){}computeBytesForSigning(e){const t=r.from(e.data.length.toString()),n=r.concat([t,e.data]);let o=r.concat([r.from(i.MESSAGE_PREFIX),n]);return s("keccak256").update(o).digest()}computeBytesForVerifying(e){return this.computeBytesForSigning(e)}packMessage(e){return{message:r.from(e.data).toString("hex"),signature:e.signature?r.from(e.signature).toString("hex"):"",address:e.address?e.address.bech32():"",version:e.version,signer:e.signer}}unpackMessage(e){const t=this.trimHexPrefix(e.message),n=r.from(t,"hex"),s=this.trimHexPrefix(e.signature||""),c=r.from(s,"hex");let u;e.address&&(u=o.Address.fromBech32(e.address));const l=e.version||i.DEFAULT_MESSAGE_VERSION,d=e.signer||i.UNKNOWN_SIGNER;return new a({data:n,signature:c,address:u,version:l,signer:d})}trimHexPrefix(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}}},43186:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionOptions=t.TransactionVersion=void 0;const s=n(63025),a=o(n(25145));class c{constructor(e){if((e=Number(e))<1)throw new a.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new c(s.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new c(s.TRANSACTION_VERSION_DEFAULT)}valueOf(){return this.value}}t.TransactionVersion=c;class u{constructor(e){if((e=Number(e))<0)throw new a.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new u(s.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let t=0;return e.hashSign&&(t|=s.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(t|=s.TRANSACTION_OPTIONS_TX_GUARDED),new u(t)}isWithHashSign(){return(this.value&s.TRANSACTION_OPTIONS_TX_HASH_SIGN)==s.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&s.TRANSACTION_OPTIONS_TX_GUARDED)==s.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=s.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=s.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}}t.TransactionOptions=u},98454:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GuardianData=t.AccountOnNetwork=void 0;const i=r(n(44431)),o=n(18682);class s{constructor(e){this.address=new o.Address(""),this.nonce=0,this.balance=new i.default(0),this.code="",this.userName="",Object.assign(this,e)}static fromHttpResponse(e){let t=new s;return t.address=new o.Address(e.address||""),t.nonce=Number(e.nonce||0),t.balance=new i.default(e.balance||0),t.code=e.code||"",t.userName=e.username||"",t}}t.AccountOnNetwork=s;class a{constructor(e){this.guarded=!1,Object.assign(this,e)}static fromHttpResponse(e){const t=new a;return t.guarded=e.guarded||!1,e.activeGuardian&&(t.activeGuardian=c.fromHttpResponse(e.activeGuardian)),e.pendingGuardian&&(t.pendingGuardian=c.fromHttpResponse(e.pendingGuardian)),t}getCurrentGuardianAddress(){if(this.guarded)return this.activeGuardian?.address}}t.GuardianData=a;class c{constructor(){this.activationEpoch=0,this.address=new o.Address(""),this.serviceUID=""}static fromHttpResponse(e){const t=new c;return t.activationEpoch=Number(e.activationEpoch||0),t.address=new o.Address(e.address||""),t.serviceUID=e.serviceUID||"",t}}},41829:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApiNetworkProvider=void 0;const i=r(n(9669)),o=n(98454),s=n(64402),a=n(94241),c=n(45145),u=n(37207),l=n(10417),d=n(11775),f=n(46733),h=n(40221),p=n(18682),g=n(24704),m=n(49238),b=n(57912),y=n(35190),v=n(4613),w=n(61196);t.ApiNetworkProvider=class{constructor(e,t){this.userAgentPrefix=`${a.BaseUserAgent}/api`,this.url=e;let n=this.getProxyConfig(t);this.config={...s.defaultAxiosConfig,...t},this.backingProxyNetworkProvider=new g.ProxyNetworkProvider(e,n),w.extendUserAgent(this.userAgentPrefix,this.config)}getProxyConfig(e){let t=JSON.parse(JSON.stringify(e||{}));return t={...s.defaultAxiosConfig,...t},t}async getNetworkConfig(){return await this.backingProxyNetworkProvider.getNetworkConfig()}async getNetworkStatus(){return await this.backingProxyNetworkProvider.getNetworkStatus()}async getNetworkStakeStatistics(){let e=await this.doGetGeneric("stake");return f.NetworkStake.fromHttpResponse(e)}async getNetworkGeneralStatistics(){let e=await this.doGetGeneric("stats");return d.NetworkGeneralStatistics.fromHttpResponse(e)}async getAccount(e){let t=await this.doGetGeneric(`accounts/${e.bech32()}`);return o.AccountOnNetwork.fromHttpResponse(t)}async getGuardianData(e){return await this.backingProxyNetworkProvider.getGuardianData(e)}async getFungibleTokensOfAccount(e,t){t=t||s.defaultPagination;let n=`accounts/${e.bech32()}/tokens?${this.buildPaginationParams(t)}`,r=(await this.doGetGeneric(n)).map((e=>b.FungibleTokenOfAccountOnNetwork.fromHttpResponse(e)));return r.sort(((e,t)=>e.identifier.localeCompare(t.identifier))),r}async getNonFungibleTokensOfAccount(e,t){t=t||s.defaultPagination;let n=`accounts/${e.bech32()}/nfts?${this.buildPaginationParams(t)}`,r=(await this.doGetGeneric(n)).map((e=>b.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(e)));return r.sort(((e,t)=>e.identifier.localeCompare(t.identifier))),r}async getFungibleTokenOfAccount(e,t){let n=await this.doGetGeneric(`accounts/${e.bech32()}/tokens/${t}`);return b.FungibleTokenOfAccountOnNetwork.fromHttpResponse(n)}async getNonFungibleTokenOfAccount(e,t,n){let r=new p.Nonce(n).hex(),i=await this.doGetGeneric(`accounts/${e.bech32()}/nfts/${t}-${r}`);return b.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(i)}async getMexPairs(e){let t="mex/pairs";return e&&(t=`${t}?from=${e.from}&size=${e.size}`),(await this.doGetGeneric(t)).map((e=>h.PairOnNetwork.fromApiHttpResponse(e)))}async getTransaction(e){let t=await this.doGetGeneric(`transactions/${e}`);return y.TransactionOnNetwork.fromApiHttpResponse(e,t)}async getTransactionStatus(e){let t=await this.doGetGeneric(`transactions/${e}?fields=status`);return new v.TransactionStatus(t.status)}async sendTransaction(e){const t=y.prepareTransactionForBroadcasting(e);return(await this.doPostGeneric("transactions",t)).txHash}async sendTransactions(e){return await this.backingProxyNetworkProvider.sendTransactions(e)}async simulateTransaction(e){return await this.backingProxyNetworkProvider.simulateTransaction(e)}async queryContract(e){try{let t=new c.ContractQueryRequest(e).toHttpRequest(),n=await this.doPostGeneric("query",t);return u.ContractQueryResponse.fromHttpResponse(n)}catch(t){throw new l.ErrContractQuery(t)}}async getDefinitionOfFungibleToken(e){let t=await this.doGetGeneric(`tokens/${e}`);return m.DefinitionOfFungibleTokenOnNetwork.fromApiHttpResponse(t)}async getDefinitionOfTokenCollection(e){let t=await this.doGetGeneric(`collections/${e}`);return m.DefinitionOfTokenCollectionOnNetwork.fromApiHttpResponse(t)}async getNonFungibleToken(e,t){let n=new p.Nonce(t).hex(),r=await this.doGetGeneric(`nfts/${e}-${n}`);return b.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(r)}async doGetGeneric(e){return await this.doGet(e)}async doPostGeneric(e,t){return await this.doPost(e,t)}buildPaginationParams(e){return`from=${e.from}&size=${e.size}`}async doGet(e){let t=`${this.url}/${e}`;try{return(await i.default.get(t,this.config)).data}catch(n){this.handleApiError(n,e)}}async doPost(e,t){let n=`${this.url}/${e}`;try{return(await i.default.post(n,t,{...this.config,headers:{"Content-Type":"application/json",...this.config.headers}})).data}catch(r){this.handleApiError(r,e)}}handleApiError(e,t){if(!e.response)throw new l.ErrNetworkProvider(t,e.toString(),e);const n=e.response.data,r=n.message||n.error||JSON.stringify(n);throw new l.ErrNetworkProvider(t,r,e)}}},64402:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultPagination=t.defaultAxiosConfig=void 0;const r=n(4400)({constructorAction:"ignore"});t.defaultAxiosConfig={timeout:5e3,transformResponse:[function(e){return r.parse(e)}]},t.defaultPagination={from:0,size:100}},94241:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.UnknownClientName=t.BaseUserAgent=t.EsdtContractAddress=t.MaxUint64AsBigNumber=void 0;const i=r(n(44431)),o=n(18682);t.MaxUint64AsBigNumber=new i.default("18446744073709551615"),t.EsdtContractAddress=new o.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),t.BaseUserAgent="multiversx-sdk",t.UnknownClientName="unknown"},45145:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractQueryRequest=void 0;t.ContractQueryRequest=class{constructor(e){this.query=e}toHttpRequest(){let e={},t=this.query;return e.scAddress=t.address.bech32(),e.caller=t.caller?.bech32()?t.caller.bech32():void 0,e.funcName=t.func.toString(),e.value=t.value?t.value.toString():void 0,e.args=t.getEncodedArguments(),e}}},37207:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ContractQueryResponse=void 0;const o=i(n(44431)),s=n(94241);class a{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let t=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,r=e.returnMessage||e.ReturnMessage,i=new o.default(e.gasRemaining||e.GasRemaining||0),c=s.MaxUint64AsBigNumber.minus(i).toNumber();return new a({returnData:t,returnCode:n,returnMessage:r,gasUsed:c})}getReturnDataParts(){return this.returnData.map((e=>r.from(e||"","base64")))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}}t.ContractQueryResponse=a},73673:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.ContractResultItem=t.ContractResults=void 0;const i=n(6271),o=n(18682);class s{constructor(e){this.items=e,this.items.sort((function(e,t){return e.nonce.valueOf()-t.nonce.valueOf()}))}static fromProxyHttpResponse(e){let t=e.map((e=>a.fromProxyHttpResponse(e)));return new s(t)}static fromApiHttpResponse(e){let t=e.map((e=>a.fromApiHttpResponse(e)));return new s(t)}}t.ContractResults=s;class a{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new o.Address(""),this.sender=new o.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new i.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return a.fromHttpResponse(e)}static fromApiHttpResponse(e){let t=a.fromHttpResponse(e);return t.data=r.from(t.data,"base64").toString(),t.callType=Number(t.callType),t}static fromHttpResponse(e){let t=new a;return t.hash=e.hash,t.nonce=Number(e.nonce||0),t.value=(e.value||0).toString(),t.receiver=new o.Address(e.receiver),t.sender=new o.Address(e.sender),t.previousHash=e.prevTxHash,t.originalHash=e.originalTxHash,t.gasLimit=Number(e.gasLimit||0),t.gasPrice=Number(e.gasPrice||0),t.data=e.data||"",t.callType=e.callType,t.returnMessage=e.returnMessage,t.logs=i.TransactionLogs.fromHttpResponse(e.logs||{}),t}}t.ContractResultItem=a},10417:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrContractQuery=t.ErrNetworkProvider=t.ErrUnexpectedCondition=t.Err=void 0;class n extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}}t.Err=n;t.ErrUnexpectedCondition=class extends n{constructor(e){super(`Unexpected condition: [${e}]`)}};t.ErrNetworkProvider=class extends n{constructor(e,t,n){super(`Request error on url [${e}]: [${t}]`,n)}};t.ErrContractQuery=class extends n{constructor(e){super(e.message.replace("executeQuery:",""))}}},59670:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkStatus=t.NetworkStake=t.NetworkGeneralStatistics=t.NetworkConfig=t.NonFungibleTokenOfAccountOnNetwork=t.FungibleTokenOfAccountOnNetwork=t.DefinitionOfTokenCollectionOnNetwork=t.DefinitionOfFungibleTokenOnNetwork=t.TransactionOnNetwork=t.TransactionStatus=t.TransactionReceipt=t.TransactionLogsOnNetwork=t.TransactionEventTopic=t.TransactionEventData=t.TransactionEventOnNetwork=t.ContractResults=t.ContractResultItem=t.ContractQueryResponse=t.AccountOnNetwork=t.ProxyNetworkProvider=t.ApiNetworkProvider=void 0;var r=n(41829);Object.defineProperty(t,"ApiNetworkProvider",{enumerable:!0,get:function(){return r.ApiNetworkProvider}});var i=n(24704);Object.defineProperty(t,"ProxyNetworkProvider",{enumerable:!0,get:function(){return i.ProxyNetworkProvider}});var o=n(98454);Object.defineProperty(t,"AccountOnNetwork",{enumerable:!0,get:function(){return o.AccountOnNetwork}});var s=n(37207);Object.defineProperty(t,"ContractQueryResponse",{enumerable:!0,get:function(){return s.ContractQueryResponse}});var a=n(73673);Object.defineProperty(t,"ContractResultItem",{enumerable:!0,get:function(){return a.ContractResultItem}}),Object.defineProperty(t,"ContractResults",{enumerable:!0,get:function(){return a.ContractResults}});var c=n(18751);Object.defineProperty(t,"TransactionEventOnNetwork",{enumerable:!0,get:function(){return c.TransactionEvent}}),Object.defineProperty(t,"TransactionEventData",{enumerable:!0,get:function(){return c.TransactionEventData}}),Object.defineProperty(t,"TransactionEventTopic",{enumerable:!0,get:function(){return c.TransactionEventTopic}});var u=n(6271);Object.defineProperty(t,"TransactionLogsOnNetwork",{enumerable:!0,get:function(){return u.TransactionLogs}});var l=n(62958);Object.defineProperty(t,"TransactionReceipt",{enumerable:!0,get:function(){return l.TransactionReceipt}});var d=n(4613);Object.defineProperty(t,"TransactionStatus",{enumerable:!0,get:function(){return d.TransactionStatus}});var f=n(35190);Object.defineProperty(t,"TransactionOnNetwork",{enumerable:!0,get:function(){return f.TransactionOnNetwork}});var h=n(49238);Object.defineProperty(t,"DefinitionOfFungibleTokenOnNetwork",{enumerable:!0,get:function(){return h.DefinitionOfFungibleTokenOnNetwork}}),Object.defineProperty(t,"DefinitionOfTokenCollectionOnNetwork",{enumerable:!0,get:function(){return h.DefinitionOfTokenCollectionOnNetwork}});var p=n(57912);Object.defineProperty(t,"FungibleTokenOfAccountOnNetwork",{enumerable:!0,get:function(){return p.FungibleTokenOfAccountOnNetwork}}),Object.defineProperty(t,"NonFungibleTokenOfAccountOnNetwork",{enumerable:!0,get:function(){return p.NonFungibleTokenOfAccountOnNetwork}});var g=n(89553);Object.defineProperty(t,"NetworkConfig",{enumerable:!0,get:function(){return g.NetworkConfig}});var m=n(11775);Object.defineProperty(t,"NetworkGeneralStatistics",{enumerable:!0,get:function(){return m.NetworkGeneralStatistics}});var b=n(46733);Object.defineProperty(t,"NetworkStake",{enumerable:!0,get:function(){return b.NetworkStake}});var y=n(34547);Object.defineProperty(t,"NetworkStatus",{enumerable:!0,get:function(){return y.NetworkStatus}})},89553:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkConfig=void 0;const i=r(n(44431));class o{constructor(){this.ChainID="T",this.GasPerDataByte=1500,this.TopUpFactor=0,this.RoundDuration=0,this.RoundsPerEpoch=0,this.TopUpRewardsGradientPoint=new i.default(0),this.MinGasLimit=5e4,this.MinGasPrice=1e9,this.GasPriceModifier=1,this.MinTransactionVersion=1}static fromHttpResponse(e){let t=new o;return t.ChainID=String(e.erd_chain_id),t.GasPerDataByte=Number(e.erd_gas_per_data_byte),t.TopUpFactor=Number(e.erd_top_up_factor),t.RoundDuration=Number(e.erd_round_duration),t.RoundsPerEpoch=Number(e.erd_rounds_per_epoch),t.TopUpRewardsGradientPoint=new i.default(e.erd_rewards_top_up_gradient_point),t.MinGasLimit=Number(e.erd_min_gas_limit),t.MinGasPrice=Number(e.erd_min_gas_price),t.MinTransactionVersion=Number(e.erd_min_transaction_version),t.GasPriceModifier=Number(e.erd_gas_price_modifier),t}}t.NetworkConfig=o},11775:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkGeneralStatistics=void 0;class n{constructor(){this.Shards=0,this.Blocks=0,this.Accounts=0,this.Transactions=0,this.RefreshRate=0,this.Epoch=0,this.RoundsPassed=0,this.RoundsPerEpoch=0}static fromHttpResponse(e){let t=new n;return t.Shards=Number(e.shards),t.Blocks=Number(e.blocks),t.Accounts=Number(e.accounts),t.Transactions=Number(e.transactions),t.RefreshRate=Number(e.refreshRate),t.Epoch=Number(e.epoch),t.RoundsPassed=Number(e.roundsPassed),t.RoundsPerEpoch=Number(e.roundsPerEpoch),t}}t.NetworkGeneralStatistics=n},46733:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkStake=void 0;const i=r(n(44431));class o{constructor(){this.TotalValidators=0,this.ActiveValidators=0,this.QueueSize=0,this.TotalStaked=new i.default(0)}static fromHttpResponse(e){let t=new o;return t.TotalValidators=Number(e.totalValidators),t.ActiveValidators=Number(e.activeValidators),t.QueueSize=Number(e.queueSize),t.TotalStaked=new i.default(e.totalStaked),t}}t.NetworkStake=o},34547:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkStatus=void 0;class n{constructor(){this.CurrentRound=0,this.EpochNumber=0,this.HighestFinalNonce=0,this.Nonce=0,this.NonceAtEpochStart=0,this.NoncesPassedInCurrentEpoch=0,this.RoundAtEpochStart=0,this.RoundsPassedInCurrentEpoch=0,this.RoundsPerEpoch=0}static fromHttpResponse(e){let t=new n;return t.CurrentRound=Number(e.erd_current_round),t.EpochNumber=Number(e.erd_epoch_number),t.HighestFinalNonce=Number(e.erd_highest_final_nonce),t.Nonce=Number(e.erd_nonce),t.NonceAtEpochStart=Number(e.erd_nonce_at_epoch_start),t.NoncesPassedInCurrentEpoch=Number(e.erd_nonces_passed_in_current_epoch),t.RoundAtEpochStart=Number(e.erd_round_at_epoch_start),t.RoundsPassedInCurrentEpoch=Number(e.erd_rounds_passed_in_current_epoch),t.RoundsPerEpoch=Number(e.erd_rounds_per_epoch),t}}t.NetworkStatus=n},40221:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PairOnNetwork=void 0;const i=n(18682),o=r(n(44431));class s{constructor(e){this.address=new i.Address(""),this.id="",this.symbol="",this.name="",this.price=new o.default(0),this.baseId="",this.basePrice=new o.default(0),this.baseSymbol="",this.baseName="",this.quoteId="",this.quotePrice=new o.default(0),this.quoteSymbol="",this.quoteName="",this.totalValue=new o.default(0),this.volume24h=new o.default(0),this.state="",this.type="",this.rawResponse={},Object.assign(this,e)}static fromApiHttpResponse(e){let t=new s;return t.address=new i.Address(e.address||""),t.id=e.id||"",t.symbol=e.symbol||"",t.name=e.name||"",t.price=new o.default(e.price||0),t.baseId=e.baseId||"",t.basePrice=new o.default(e.basePrice||0),t.baseSymbol=e.baseSymbol||"",t.baseName=e.baseName||"",t.quoteId=e.quoteId||"",t.quotePrice=new o.default(e.quotePrice||0),t.quoteSymbol=e.quoteSymbol||"",t.quoteName=e.quoteName||"",t.totalValue=new o.default(e.totalValue||0),t.volume24h=new o.default(e.volume24h||0),t.state=e.state||"",t.type=e.type||"",t.rawResponse=e,t}}t.PairOnNetwork=s},18682:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.zeroPadStringIfOddLength=t.isPaddedHex=t.numberToPaddedHex=t.Nonce=t.Address=void 0;const a=s(n(92882));class c{constructor(e){this.value=e}static fromPubkey(e){let t=a.toWords(e),n=a.encode("erd",t);return new c(n)}bech32(){return this.value}toString(){return this.bech32()}}t.Address=c;function u(e){return l(e.toString(16))}function l(e){return(e=e||"").length%2==1?"0"+e:e}t.Nonce=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return u(this.value)}},t.numberToPaddedHex=u,t.isPaddedHex=function(e){e=e||"";let t=r.from(e,"hex").toString("hex");return e.toUpperCase()==t.toUpperCase()},t.zeroPadStringIfOddLength=l},24704:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyNetworkProvider=void 0;const o=i(n(9669)),s=n(98454),a=n(64402),c=n(94241),u=n(45145),l=n(37207),d=n(10417),f=n(89553),h=n(34547),p=n(49238),g=n(57912),m=n(35190),b=n(4613),y=n(61196);t.ProxyNetworkProvider=class{constructor(e,t){this.userAgentPrefix=`${c.BaseUserAgent}/proxy`,this.url=e,this.config={...a.defaultAxiosConfig,...t},y.extendUserAgent(this.userAgentPrefix,this.config)}async getNetworkConfig(){let e=await this.doGetGeneric("network/config");return f.NetworkConfig.fromHttpResponse(e.config)}async getNetworkStatus(){let e=await this.doGetGeneric("network/status/4294967295");return h.NetworkStatus.fromHttpResponse(e.status)}async getNetworkStakeStatistics(){throw new Error("Method not implemented.")}async getNetworkGeneralStatistics(){throw new Error("Method not implemented.")}async getAccount(e){let t=await this.doGetGeneric(`address/${e.bech32()}`);return s.AccountOnNetwork.fromHttpResponse(t.account)}async getGuardianData(e){const t=await this.doGetGeneric(`address/${e.bech32()}/guardian-data`);return s.GuardianData.fromHttpResponse(t.guardianData)}async getFungibleTokensOfAccount(e,t){let n=`address/${e.bech32()}/esdt`,r=await this.doGetGeneric(n),i=Object.values(r.esdts).filter((e=>!e.nonce)).map((e=>g.FungibleTokenOfAccountOnNetwork.fromHttpResponse(e)));return i.sort(((e,t)=>e.identifier.localeCompare(t.identifier))),i}async getNonFungibleTokensOfAccount(e,t){let n=`address/${e.bech32()}/esdt`,r=await this.doGetGeneric(n),i=Object.values(r.esdts).filter((e=>e.nonce>=0)).map((e=>g.NonFungibleTokenOfAccountOnNetwork.fromProxyHttpResponse(e)));return i.sort(((e,t)=>e.identifier.localeCompare(t.identifier))),i}async getFungibleTokenOfAccount(e,t){let n=await this.doGetGeneric(`address/${e.bech32()}/esdt/${t}`);return g.FungibleTokenOfAccountOnNetwork.fromHttpResponse(n.tokenData)}async getNonFungibleTokenOfAccount(e,t,n){let r=await this.doGetGeneric(`address/${e.bech32()}/nft/${t}/nonce/${n.valueOf()}`);return g.NonFungibleTokenOfAccountOnNetwork.fromProxyHttpResponseByNonce(r.tokenData)}async getTransaction(e,t){let n;!0===t&&(n=this.getTransactionStatus(e));let r=this.buildUrlWithQueryParameters(`transaction/${e}`,{withResults:"true"}),i=await this.doGetGeneric(r);if(n){const t=await n;return m.TransactionOnNetwork.fromProxyHttpResponse(e,i.transaction,t)}return m.TransactionOnNetwork.fromProxyHttpResponse(e,i.transaction)}async getTransactionStatus(e){let t=await this.doGetGeneric(`transaction/${e}/process-status`);return new b.TransactionStatus(t.status)}async sendTransaction(e){const t=m.prepareTransactionForBroadcasting(e);return(await this.doPostGeneric("transaction/send",t)).txHash}async sendTransactions(e){const t=e.map((e=>m.prepareTransactionForBroadcasting(e))),n=await this.doPostGeneric("transaction/send-multiple",t),r=Array(e.length).fill(null);for(let i=0;i[t]})).getReturnDataParts()}async getDefinitionOfTokenCollection(e){let t=await this.getTokenProperties(e);return p.DefinitionOfTokenCollectionOnNetwork.fromResponseOfGetTokenProperties(e,t)}async getNonFungibleToken(e,t){throw new Error("Method not implemented.")}async doGetGeneric(e){return await this.doGet(e)}async doPostGeneric(e,t){return await this.doPost(e,t)}async doGet(e){let t=`${this.url}/${e}`;try{return(await o.default.get(t,this.config)).data.data}catch(n){this.handleApiError(n,e)}}async doPost(e,t){let n=`${this.url}/${e}`;try{return(await o.default.post(n,t,{...this.config,headers:{"Content-Type":"application/json",...this.config.headers}})).data.data}catch(r){this.handleApiError(r,e)}}buildUrlWithQueryParameters(e,t){let n=new URLSearchParams;for(let[r,i]of Object.entries(t))i&&n.append(r,i);return`${e}?${n.toString()}`}handleApiError(e,t){if(!e.response)throw new d.ErrNetworkProvider(t,e.toString(),e);const n=e.response.data,r=n.message||n.error||JSON.stringify(n);throw new d.ErrNetworkProvider(t,r,e)}}},49238:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DefinitionOfTokenCollectionOnNetwork=t.DefinitionOfFungibleTokenOnNetwork=void 0;const i=r(n(44431)),o=n(18682);class s{constructor(){this.identifier="",this.name="",this.ticker="",this.owner=new o.Address(""),this.decimals=0,this.supply=new i.default(0),this.isPaused=!1,this.canUpgrade=!1,this.canMint=!1,this.canBurn=!1,this.canChangeOwner=!1,this.canPause=!1,this.canFreeze=!1,this.canWipe=!1,this.canAddSpecialRoles=!1,this.assets={}}static fromApiHttpResponse(e){let t=new s;return t.identifier=e.identifier||"",t.name=e.name||"",t.ticker=e.ticker||"",t.owner=new o.Address(e.owner||""),t.decimals=e.decimals||0,t.supply=new i.default(e.supply||"0"),t.isPaused=e.isPaused||!1,t.canUpgrade=e.canUpgrade||!1,t.canMint=e.canMint||!1,t.canBurn=e.canBurn||!1,t.canChangeOwner=e.canChangeOwner||!1,t.canPause=e.canPause||!1,t.canFreeze=e.canFreeze||!1,t.canWipe=e.canWipe||!1,t.assets=e.assets||{},t}static fromResponseOfGetTokenProperties(e,t){let n=new s,[r,a,u,l,...d]=t,f=c(d);return n.identifier=e,n.name=r.toString(),n.ticker=e,n.owner=o.Address.fromPubkey(u),n.decimals=f.NumDecimals.toNumber(),n.supply=new i.default(l.toString()).shiftedBy(-n.decimals),n.isPaused=f.IsPaused,n.canUpgrade=f.CanUpgrade,n.canMint=f.CanMint,n.canBurn=f.CanBurn,n.canChangeOwner=f.CanChangeOwner,n.canPause=f.CanPause,n.canFreeze=f.CanFreeze,n.canWipe=f.CanWipe,n}}t.DefinitionOfFungibleTokenOnNetwork=s;class a{constructor(){this.collection="",this.type="",this.name="",this.ticker="",this.owner=new o.Address(""),this.decimals=0,this.canPause=!1,this.canFreeze=!1,this.canWipe=!1,this.canUpgrade=!1,this.canChangeOwner=!1,this.canAddSpecialRoles=!1,this.canTransferNftCreateRole=!1,this.canCreateMultiShard=!1}static fromApiHttpResponse(e){let t=new a;return t.collection=e.collection||"",t.type=e.type||"",t.name=e.name||"",t.ticker=e.ticker||"",t.owner=new o.Address(e.owner||""),t.decimals=e.decimals||0,t.canPause=e.canPause||!1,t.canFreeze=e.canFreeze||!1,t.canWipe=e.canWipe||!1,t.canUpgrade=e.canUpgrade||!1,t.canAddSpecialRoles=e.canAddSpecialRoles||!1,t.canTransferNftCreateRole=e.canTransferNftCreateRole||!1,t}static fromResponseOfGetTokenProperties(e,t){let n=new a,[r,i,s,u,l,...d]=t,f=c(d);return n.collection=e,n.type=i.toString(),n.name=r.toString(),n.ticker=e,n.owner=o.Address.fromPubkey(s),n.decimals=f.NumDecimals.toNumber()??0,n.canPause=f.CanPause||!1,n.canFreeze=f.CanFreeze||!1,n.canWipe=f.CanWipe||!1,n.canUpgrade=f.CanUpgrade||!1,n.canChangeOwner=f.CanChangeOwner||!1,n.canAddSpecialRoles=f.CanAddSpecialRoles||!1,n.canTransferNftCreateRole=f.CanTransferNFTCreateRole||!1,n.canCreateMultiShard=f.CanCreateMultiShard||!1,n}}function c(e){let t={};for(let n of e){let[e,r]=n.toString().split("-");t[e]=u(r)}return t}function u(e){switch(e){case"true":return!0;case"false":return!1;default:return new i.default(e)}}t.DefinitionOfTokenCollectionOnNetwork=a},57912:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.NonFungibleTokenOfAccountOnNetwork=t.FungibleTokenOfAccountOnNetwork=void 0;const i=n(44431),o=n(18682);class s{constructor(){this.identifier="",this.balance=new i.BigNumber(0),this.rawResponse={}}static fromHttpResponse(e){let t=new s;return t.identifier=e.tokenIdentifier||e.identifier||"",t.balance=new i.BigNumber(e.balance||0),t.rawResponse=e,t}}t.FungibleTokenOfAccountOnNetwork=s;class a{constructor(e){this.identifier="",this.collection="",this.timestamp=0,this.attributes=r.from([]),this.nonce=0,this.type="",this.name="",this.creator=new o.Address(""),this.supply=new i.BigNumber(0),this.decimals=0,this.royalties=new i.BigNumber(0),this.assets=[],this.balance=new i.BigNumber(0),Object.assign(this,e)}static fromProxyHttpResponse(e){let t=a.fromHttpResponse(e);return t.identifier=e.tokenIdentifier||"",t.collection=a.parseCollectionFromIdentifier(t.identifier),t.royalties=new i.BigNumber(e.royalties||0).div(100),t}static fromProxyHttpResponseByNonce(e){let t=a.fromHttpResponse(e),n=new o.Nonce(t.nonce).hex();return t.identifier=`${e.tokenIdentifier}-${n}`,t.collection=e.tokenIdentifier||"",t.royalties=new i.BigNumber(e.royalties||0).div(100),t}static fromApiHttpResponse(e){let t=a.fromHttpResponse(e);return t.identifier=e.identifier||"",t.collection=e.collection||"",t}static fromHttpResponse(e){let t=new a;return t.timestamp=Number(e.timestamp||0),t.attributes=r.from(e.attributes||"","base64"),t.nonce=e.nonce||0,t.type=e.type||"",t.name=e.name||"",t.creator=new o.Address(e.creator||""),t.decimals=Number(e.decimals||0),t.supply=new i.BigNumber(e.balance||1),t.royalties=new i.BigNumber(e.royalties||0),t.assets=e.assets||[],t.balance=new i.BigNumber(e.balance||1),t}static parseCollectionFromIdentifier(e){return e.split("-").slice(0,2).join("-")}}t.NonFungibleTokenOfAccountOnNetwork=a},18751:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionEventTopic=t.TransactionEventData=t.TransactionEvent=void 0;const i=n(18682);class o{constructor(e){this.address=new i.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new s(r.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new o;return t.address=new i.Address(e.address),t.identifier=e.identifier||"",t.topics=(e.topics||[]).map((e=>new a(e))),t.dataPayload=s.fromBase64(e.data),t.additionalData=(e.additionalData||[]).map(s.fromBase64),t.data=t.dataPayload.toString(),t}findFirstOrNoneTopic(e){return this.topics.filter((t=>e(t)))[0]}getLastTopic(){return this.topics[this.topics.length-1]}}t.TransactionEvent=o;class s{constructor(e){this.raw=e}static fromBase64(e){return new s(r.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}}t.TransactionEventData=s;class a{constructor(e){this.raw=r.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}}t.TransactionEventTopic=a},6271:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionLogs=void 0;const r=n(10417),i=n(18682),o=n(18751);class s{constructor(e){this.address=new i.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new s;return t.address=new i.Address(e.address),t.events=(e.events||[]).map((e=>o.TransactionEvent.fromHttpResponse(e))),t}findSingleOrNoneEvent(e,t){let n=this.findEvents(e,t);if(n.length>1)throw new r.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,t){return this.findEvents(e,t)[0]}findEvents(e,t){let n=this.events.filter((t=>t.identifier==e));return t&&(n=n.filter((e=>t(e)))),n}}t.TransactionLogs=s},62958:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionReceipt=void 0;const r=n(18682);class i{constructor(){this.value="",this.sender=new r.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let t=new i;return t.value=(e.value||0).toString(),t.sender=new r.Address(e.sender),t.data=e.data,t.hash=e.txHash,t}}t.TransactionReceipt=i},4613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionStatus=void 0;class n{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new n("unknown")}isPending(){return"received"==this.status||"pending"==this.status}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return"executed"==this.status||"success"==this.status||"successful"==this.status}isFailed(){return"fail"==this.status||"failed"==this.status||"unsuccessful"==this.status||this.isInvalid()}isInvalid(){return"invalid"==this.status}toString(){return this.status}valueOf(){return this.status}equals(e){return!!e&&this.status==e.status}}t.TransactionStatus=n},35190:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionOnNetwork=t.prepareTransactionForBroadcasting=void 0;const i=n(4613),o=n(73673),s=n(18682),a=n(6271),c=n(62958);t.prepareTransactionForBroadcasting=function(e){return"toSendable"in e?e.toSendable():{nonce:Number(e.nonce),value:e.value.toString(),receiver:e.receiver,sender:e.sender,senderUsername:e.senderUsername?r.from(e.senderUsername).toString("base64"):void 0,receiverUsername:e.receiverUsername?r.from(e.receiverUsername).toString("base64"):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:0===e.data.length?void 0:r.from(e.data).toString("base64"),chainID:e.chainID,version:e.version,options:e.options,guardian:e.guardian||void 0,signature:r.from(e.signature).toString("hex"),guardianSignature:0===e.guardianSignature.length?void 0:r.from(e.guardianSignature).toString("hex")}};class u{constructor(e){this.hash="",this.type="",this.nonce=0,this.round=0,this.epoch=0,this.value="",this.receiver=new s.Address(""),this.sender=new s.Address(""),this.gasLimit=0,this.gasPrice=0,this.function="",this.data=r.from([]),this.signature="",this.status=i.TransactionStatus.createUnknown(),this.timestamp=0,this.blockNonce=0,this.hyperblockNonce=0,this.hyperblockHash="",this.receipt=new c.TransactionReceipt,this.contractResults=new o.ContractResults([]),this.logs=new a.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e,t,n){let r=u.fromHttpResponse(e,t);return r.contractResults=o.ContractResults.fromProxyHttpResponse(t.smartContractResults||[]),n&&(r.status=n,r.isCompleted=r.status.isSuccessful()||r.status.isFailed()),r}static fromApiHttpResponse(e,t){let n=u.fromHttpResponse(e,t);return n.contractResults=o.ContractResults.fromApiHttpResponse(t.results||[]),n.isCompleted=!n.status.isPending(),n}static fromHttpResponse(e,t){let n=new u;return n.hash=e,n.type=t.type||"",n.nonce=t.nonce||0,n.round=t.round,n.epoch=t.epoch||0,n.value=(t.value||0).toString(),n.sender=new s.Address(t.sender),n.receiver=new s.Address(t.receiver),n.gasPrice=t.gasPrice||0,n.gasLimit=t.gasLimit||0,n.function=t.function||"",n.data=r.from(t.data||"","base64"),n.status=new i.TransactionStatus(t.status),n.timestamp=t.timestamp||0,n.blockNonce=t.blockNonce||0,n.hyperblockNonce=t.hyperblockNonce||0,n.hyperblockHash=t.hyperblockHash||"",n.receipt=c.TransactionReceipt.fromHttpResponse(t.receipt||{}),n.logs=a.TransactionLogs.fromHttpResponse(t.logs||{}),n}getDateTime(){return new Date(1e3*this.timestamp)}}t.TransactionOnNetwork=u},61196:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendUserAgent=void 0;const r=n(9669),i=n(94241);t.extendUserAgent=function(e,t){t.headers||(t.headers=new r.AxiosHeaders({})),t.clientName||console.log("Can you please provide the client name of the application that uses the SDK? It will be used for metrics.");const n=r.AxiosHeaders.from(t.headers).normalize(!0),o=t.clientName||i.UnknownClientName,s=n.hasUserAgent()?n.getUserAgent():"",a=s?`${s} ${e}/${o}`:`${e}/${o}`;n.setUserAgent(a,!0)}},38299:function(e,t,n){"use strict";var r,i,o;i=[n(62100)],void 0===(o="function"===typeof(r=function(e){var t=e.Reader,n=e.Writer,r=e.util,i=e.roots.default||(e.roots.default={});return i.proto=function(){var o={};return o.Transaction=function(){function o(e){if(this.InnerTransactions=[],e)for(var t=Object.keys(e),n=0;n>>3){case 1:o.Nonce=e.uint64();break;case 2:o.Value=e.bytes();break;case 3:o.RcvAddr=e.bytes();break;case 4:o.RcvUserName=e.bytes();break;case 5:o.SndAddr=e.bytes();break;case 6:o.SndUserName=e.bytes();break;case 7:o.GasPrice=e.uint64();break;case 8:o.GasLimit=e.uint64();break;case 9:o.Data=e.bytes();break;case 10:o.ChainID=e.bytes();break;case 11:o.Version=e.uint32();break;case 12:o.Signature=e.bytes();break;case 13:o.Options=e.uint32();break;case 14:o.GuardianAddr=e.bytes();break;case 15:o.GuardianSignature=e.bytes();break;case 16:o.Relayer=e.bytes();break;case 17:o.InnerTransactions&&o.InnerTransactions.length||(o.InnerTransactions=[]),o.InnerTransactions.push(i.proto.Transaction.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof t||(e=new t(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!==typeof e||null===e)return"object expected";if(null!=e.Nonce&&e.hasOwnProperty("Nonce")&&!r.isInteger(e.Nonce)&&!(e.Nonce&&r.isInteger(e.Nonce.low)&&r.isInteger(e.Nonce.high)))return"Nonce: integer|Long expected";if(null!=e.Value&&e.hasOwnProperty("Value")&&!(e.Value&&"number"===typeof e.Value.length||r.isString(e.Value)))return"Value: buffer expected";if(null!=e.RcvAddr&&e.hasOwnProperty("RcvAddr")&&!(e.RcvAddr&&"number"===typeof e.RcvAddr.length||r.isString(e.RcvAddr)))return"RcvAddr: buffer expected";if(null!=e.RcvUserName&&e.hasOwnProperty("RcvUserName")&&!(e.RcvUserName&&"number"===typeof e.RcvUserName.length||r.isString(e.RcvUserName)))return"RcvUserName: buffer expected";if(null!=e.SndAddr&&e.hasOwnProperty("SndAddr")&&!(e.SndAddr&&"number"===typeof e.SndAddr.length||r.isString(e.SndAddr)))return"SndAddr: buffer expected";if(null!=e.SndUserName&&e.hasOwnProperty("SndUserName")&&!(e.SndUserName&&"number"===typeof e.SndUserName.length||r.isString(e.SndUserName)))return"SndUserName: buffer expected";if(null!=e.GasPrice&&e.hasOwnProperty("GasPrice")&&!r.isInteger(e.GasPrice)&&!(e.GasPrice&&r.isInteger(e.GasPrice.low)&&r.isInteger(e.GasPrice.high)))return"GasPrice: integer|Long expected";if(null!=e.GasLimit&&e.hasOwnProperty("GasLimit")&&!r.isInteger(e.GasLimit)&&!(e.GasLimit&&r.isInteger(e.GasLimit.low)&&r.isInteger(e.GasLimit.high)))return"GasLimit: integer|Long expected";if(null!=e.Data&&e.hasOwnProperty("Data")&&!(e.Data&&"number"===typeof e.Data.length||r.isString(e.Data)))return"Data: buffer expected";if(null!=e.ChainID&&e.hasOwnProperty("ChainID")&&!(e.ChainID&&"number"===typeof e.ChainID.length||r.isString(e.ChainID)))return"ChainID: buffer expected";if(null!=e.Version&&e.hasOwnProperty("Version")&&!r.isInteger(e.Version))return"Version: integer expected";if(null!=e.Signature&&e.hasOwnProperty("Signature")&&!(e.Signature&&"number"===typeof e.Signature.length||r.isString(e.Signature)))return"Signature: buffer expected";if(null!=e.Options&&e.hasOwnProperty("Options")&&!r.isInteger(e.Options))return"Options: integer expected";if(null!=e.GuardianAddr&&e.hasOwnProperty("GuardianAddr")&&!(e.GuardianAddr&&"number"===typeof e.GuardianAddr.length||r.isString(e.GuardianAddr)))return"GuardianAddr: buffer expected";if(null!=e.GuardianSignature&&e.hasOwnProperty("GuardianSignature")&&!(e.GuardianSignature&&"number"===typeof e.GuardianSignature.length||r.isString(e.GuardianSignature)))return"GuardianSignature: buffer expected";if(null!=e.Relayer&&e.hasOwnProperty("Relayer")&&!(e.Relayer&&"number"===typeof e.Relayer.length||r.isString(e.Relayer)))return"Relayer: buffer expected";if(null!=e.InnerTransactions&&e.hasOwnProperty("InnerTransactions")){if(!Array.isArray(e.InnerTransactions))return"InnerTransactions: array expected";for(var t=0;t>>0,e.Nonce.high>>>0).toNumber(!0))),null!=e.Value&&("string"===typeof e.Value?r.base64.decode(e.Value,t.Value=r.newBuffer(r.base64.length(e.Value)),0):e.Value.length>=0&&(t.Value=e.Value)),null!=e.RcvAddr&&("string"===typeof e.RcvAddr?r.base64.decode(e.RcvAddr,t.RcvAddr=r.newBuffer(r.base64.length(e.RcvAddr)),0):e.RcvAddr.length>=0&&(t.RcvAddr=e.RcvAddr)),null!=e.RcvUserName&&("string"===typeof e.RcvUserName?r.base64.decode(e.RcvUserName,t.RcvUserName=r.newBuffer(r.base64.length(e.RcvUserName)),0):e.RcvUserName.length>=0&&(t.RcvUserName=e.RcvUserName)),null!=e.SndAddr&&("string"===typeof e.SndAddr?r.base64.decode(e.SndAddr,t.SndAddr=r.newBuffer(r.base64.length(e.SndAddr)),0):e.SndAddr.length>=0&&(t.SndAddr=e.SndAddr)),null!=e.SndUserName&&("string"===typeof e.SndUserName?r.base64.decode(e.SndUserName,t.SndUserName=r.newBuffer(r.base64.length(e.SndUserName)),0):e.SndUserName.length>=0&&(t.SndUserName=e.SndUserName)),null!=e.GasPrice&&(r.Long?(t.GasPrice=r.Long.fromValue(e.GasPrice)).unsigned=!0:"string"===typeof e.GasPrice?t.GasPrice=parseInt(e.GasPrice,10):"number"===typeof e.GasPrice?t.GasPrice=e.GasPrice:"object"===typeof e.GasPrice&&(t.GasPrice=new r.LongBits(e.GasPrice.low>>>0,e.GasPrice.high>>>0).toNumber(!0))),null!=e.GasLimit&&(r.Long?(t.GasLimit=r.Long.fromValue(e.GasLimit)).unsigned=!0:"string"===typeof e.GasLimit?t.GasLimit=parseInt(e.GasLimit,10):"number"===typeof e.GasLimit?t.GasLimit=e.GasLimit:"object"===typeof e.GasLimit&&(t.GasLimit=new r.LongBits(e.GasLimit.low>>>0,e.GasLimit.high>>>0).toNumber(!0))),null!=e.Data&&("string"===typeof e.Data?r.base64.decode(e.Data,t.Data=r.newBuffer(r.base64.length(e.Data)),0):e.Data.length>=0&&(t.Data=e.Data)),null!=e.ChainID&&("string"===typeof e.ChainID?r.base64.decode(e.ChainID,t.ChainID=r.newBuffer(r.base64.length(e.ChainID)),0):e.ChainID.length>=0&&(t.ChainID=e.ChainID)),null!=e.Version&&(t.Version=e.Version>>>0),null!=e.Signature&&("string"===typeof e.Signature?r.base64.decode(e.Signature,t.Signature=r.newBuffer(r.base64.length(e.Signature)),0):e.Signature.length>=0&&(t.Signature=e.Signature)),null!=e.Options&&(t.Options=e.Options>>>0),null!=e.GuardianAddr&&("string"===typeof e.GuardianAddr?r.base64.decode(e.GuardianAddr,t.GuardianAddr=r.newBuffer(r.base64.length(e.GuardianAddr)),0):e.GuardianAddr.length>=0&&(t.GuardianAddr=e.GuardianAddr)),null!=e.GuardianSignature&&("string"===typeof e.GuardianSignature?r.base64.decode(e.GuardianSignature,t.GuardianSignature=r.newBuffer(r.base64.length(e.GuardianSignature)),0):e.GuardianSignature.length>=0&&(t.GuardianSignature=e.GuardianSignature)),null!=e.Relayer&&("string"===typeof e.Relayer?r.base64.decode(e.Relayer,t.Relayer=r.newBuffer(r.base64.length(e.Relayer)),0):e.Relayer.length>=0&&(t.Relayer=e.Relayer)),e.InnerTransactions){if(!Array.isArray(e.InnerTransactions))throw TypeError(".proto.Transaction.InnerTransactions: array expected");t.InnerTransactions=[];for(var n=0;n>>0,e.Nonce.high>>>0).toNumber(!0):e.Nonce),null!=e.Value&&e.hasOwnProperty("Value")&&(n.Value=t.bytes===String?r.base64.encode(e.Value,0,e.Value.length):t.bytes===Array?Array.prototype.slice.call(e.Value):e.Value),null!=e.RcvAddr&&e.hasOwnProperty("RcvAddr")&&(n.RcvAddr=t.bytes===String?r.base64.encode(e.RcvAddr,0,e.RcvAddr.length):t.bytes===Array?Array.prototype.slice.call(e.RcvAddr):e.RcvAddr),null!=e.RcvUserName&&e.hasOwnProperty("RcvUserName")&&(n.RcvUserName=t.bytes===String?r.base64.encode(e.RcvUserName,0,e.RcvUserName.length):t.bytes===Array?Array.prototype.slice.call(e.RcvUserName):e.RcvUserName),null!=e.SndAddr&&e.hasOwnProperty("SndAddr")&&(n.SndAddr=t.bytes===String?r.base64.encode(e.SndAddr,0,e.SndAddr.length):t.bytes===Array?Array.prototype.slice.call(e.SndAddr):e.SndAddr),null!=e.SndUserName&&e.hasOwnProperty("SndUserName")&&(n.SndUserName=t.bytes===String?r.base64.encode(e.SndUserName,0,e.SndUserName.length):t.bytes===Array?Array.prototype.slice.call(e.SndUserName):e.SndUserName),null!=e.GasPrice&&e.hasOwnProperty("GasPrice")&&("number"===typeof e.GasPrice?n.GasPrice=t.longs===String?String(e.GasPrice):e.GasPrice:n.GasPrice=t.longs===String?r.Long.prototype.toString.call(e.GasPrice):t.longs===Number?new r.LongBits(e.GasPrice.low>>>0,e.GasPrice.high>>>0).toNumber(!0):e.GasPrice),null!=e.GasLimit&&e.hasOwnProperty("GasLimit")&&("number"===typeof e.GasLimit?n.GasLimit=t.longs===String?String(e.GasLimit):e.GasLimit:n.GasLimit=t.longs===String?r.Long.prototype.toString.call(e.GasLimit):t.longs===Number?new r.LongBits(e.GasLimit.low>>>0,e.GasLimit.high>>>0).toNumber(!0):e.GasLimit),null!=e.Data&&e.hasOwnProperty("Data")&&(n.Data=t.bytes===String?r.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),null!=e.ChainID&&e.hasOwnProperty("ChainID")&&(n.ChainID=t.bytes===String?r.base64.encode(e.ChainID,0,e.ChainID.length):t.bytes===Array?Array.prototype.slice.call(e.ChainID):e.ChainID),null!=e.Version&&e.hasOwnProperty("Version")&&(n.Version=e.Version),null!=e.Signature&&e.hasOwnProperty("Signature")&&(n.Signature=t.bytes===String?r.base64.encode(e.Signature,0,e.Signature.length):t.bytes===Array?Array.prototype.slice.call(e.Signature):e.Signature),null!=e.Options&&e.hasOwnProperty("Options")&&(n.Options=e.Options),null!=e.GuardianAddr&&e.hasOwnProperty("GuardianAddr")&&(n.GuardianAddr=t.bytes===String?r.base64.encode(e.GuardianAddr,0,e.GuardianAddr.length):t.bytes===Array?Array.prototype.slice.call(e.GuardianAddr):e.GuardianAddr),null!=e.GuardianSignature&&e.hasOwnProperty("GuardianSignature")&&(n.GuardianSignature=t.bytes===String?r.base64.encode(e.GuardianSignature,0,e.GuardianSignature.length):t.bytes===Array?Array.prototype.slice.call(e.GuardianSignature):e.GuardianSignature),null!=e.Relayer&&e.hasOwnProperty("Relayer")&&(n.Relayer=t.bytes===String?r.base64.encode(e.Relayer,0,e.Relayer.length):t.bytes===Array?Array.prototype.slice.call(e.Relayer):e.Relayer),e.InnerTransactions&&e.InnerTransactions.length){n.InnerTransactions=[];for(var s=0;sthis.convertToProtoMessage(e))),s}serializeTransactionValue(e){let t=new c.default(e.toString());if(t.isZero())return r.from([0,0]);let n=f.bigIntToBuffer(t);return n=r.concat([r.from([0]),n]),n}isGuardedTransaction(e){const t=e.guardian.length>0,n=e.guardianSignature.length>0;return this.isWithGuardian(e)&&t&&n}isWithGuardian(e){return(e.options&l.TRANSACTION_OPTIONS_TX_GUARDED)==l.TRANSACTION_OPTIONS_TX_GUARDED}deserializeTransaction(e){throw new d.ErrUnsupportedOperation("deserializeTransaction")}}},4317:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavascriptPrototypesInHierarchy=void 0,t.getJavascriptPrototypesInHierarchy=function(e,t){let n=[],r=Object.getPrototypeOf(e);for(;r&&t(r);)n.push(r),r=Object.getPrototypeOf(r);return n}},59903:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.RelayedTransactionV1Builder=void 0;const i=n(36946),o=n(25145),s=n(66679),a=n(94712),c=n(4400);t.RelayedTransactionV1Builder=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new o.ErrInvalidRelayedV1BuilderArguments;const e=this.prepareInnerTransaction(),t=`relayedTx@${r.from(e).toString("hex")}`,n=new a.TransactionPayload(t),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf();let c=new s.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&c.setNonce(this.relayerNonce),c}prepareInnerTransaction(){if(!this.innerTransaction)return"";const e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new i.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new i.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:BigInt(this.innerTransaction.getValue().toString()),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:r.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:0==this.innerTransaction.getOptions().valueOf()?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new i.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?r.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?r.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return c.stringify(e)}}},77312:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelayedTransactionV2Builder=void 0;const r=n(25145),i=n(47480),o=n(66679),s=n(94712);t.RelayedTransactionV2Builder=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new r.ErrInvalidRelayedV2BuilderArguments;if(0!=this.innerTransaction.getGasLimit())throw new r.ErrGasLimitShouldBe0ForInnerTransaction;const{argumentsString:e}=(new i.ArgSerializer).valuesToString([new i.AddressValue(this.innerTransaction.getReceiver()),new i.U64Value(this.innerTransaction.getNonce().valueOf()),new i.BytesValue(this.innerTransaction.getData().valueOf()),new i.BytesValue(this.innerTransaction.getSignature())]),t=`relayedTxV2@${e}`,n=new s.TransactionPayload(t);let a=new o.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID,version:this.innerTransaction.getVersion(),options:this.innerTransaction.getOptions()});return this.relayerNonce&&a.setNonce(this.relayerNonce),a}}},40655:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.SignableMessage=void 0;const i=n(36946),o=n(40188),s=n(63025),a=n(95811);t.SignableMessage=class{constructor(e){this.message=r.from([]),this.signature=r.from([]),this.version=1,this.signer="ErdJS",this.address=i.Address.empty(),Object.assign(this,e)}serializeForSigning(){const e=r.from(this.message.length.toString()),t=r.concat([e,this.message]);let n=r.concat([r.from(s.MESSAGE_PREFIX),t]);return a("keccak256").update(n).digest()}serializeForSigningRaw(){return r.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=o.interpretSignatureAsBuffer(e)}getMessageSize(){const e=r.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}}},40188:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.interpretSignatureAsBuffer=t.Signature=void 0;const a=s(n(25145));class c{constructor(e){if(this.valueHex="",e)return"string"===typeof e?c.fromHex(e):e instanceof r?c.fromBuffer(e):void 0}static empty(){return new c}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!c.isValidHex(e))throw new a.ErrSignatureCannotCreate(e);return c.fromValidHex(e)}static isValidHex(e){return 64==r.from(e,"hex").length}static fromValidHex(e){let t=new c;return t.valueHex=e,t}static fromBuffer(e){if(64!=e.length)throw new a.ErrSignatureCannotCreate(e);return c.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}}t.Signature=c,t.interpretSignatureAsBuffer=function(e){if(ArrayBuffer.isView(e))return r.from(e);if(null!=e.hex)return r.from(e.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${e}`)}},90788:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.SmartContractQueriesController=void 0;const i=n(25145),o=n(79793),s=n(47480),a=n(6058);t.SmartContractQueriesController=class{constructor(e){this.abi=e.abi,this.queryRunner=e.queryRunner,this.legacyResultsParser=new s.ResultsParser}async query(e){const t=this.createQuery(e),n=await this.runQuery(t);return this.raiseForStatus(n),this.parseQueryResponse(n)}raiseForStatus(e){if(!("ok"===e.returnCode))throw new i.ErrSmartContractQuery(e.returnCode,e.returnMessage)}createQuery(e){const t=this.encodeArguments(e.function,e.arguments);return new o.SmartContractQuery({contract:e.contract,caller:e.caller,function:e.function,arguments:t,value:e.value})}encodeArguments(e,t){const n=this.abi?.getEndpoint(e);if(n){const e=s.NativeSerializer.nativeToTypedValues(t,n);return(new s.ArgSerializer).valuesToBuffers(e)}if(this.areArgsOfTypedValue(t))return(new s.ArgSerializer).valuesToBuffers(t);if(this.areArgsBuffers(t))return t.map((e=>r.from(e)));throw new i.Err("cannot encode arguments: when ABI is not available, they must be either typed values or buffers")}areArgsOfTypedValue(e){return e.every((e=>a.isTyped(e)))}areArgsBuffers(e){for(const t of e)if(!ArrayBuffer.isView(t))return!1;return!0}async runQuery(e){return await this.queryRunner.runQuery(e)}parseQueryResponse(e){if(!this.abi)return e.returnDataParts;const t={returnCode:e.returnCode,returnMessage:e.returnMessage,getReturnDataParts:()=>e.returnDataParts.map((e=>r.from(e)))},n=e.function,i=this.abi.getEndpoint(n);return this.legacyResultsParser.parseQueryResponse(t,i).values.map((e=>e.valueOf()))}}},79793:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SmartContractQueryResponse=t.SmartContractQuery=void 0;t.SmartContractQuery=class{constructor(e){this.contract=e.contract,this.caller=e.caller,this.value=e.value,this.function=e.function,this.arguments=e.arguments}};t.SmartContractQueryResponse=class{constructor(e){this.function=e.function,this.returnCode=e.returnCode,this.returnMessage=e.returnMessage,this.returnDataParts=e.returnDataParts}}},14558:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.ArgSerializer=void 0;const i=n(63025),o=n(92377),s=n(6058),a=n(79967),c=n(46522),u=n(79554),l={codec:new o.BinaryCodec};t.ArgSerializer=class{constructor(e){e={...l,...e},this.codec=e.codec}stringToValues(e,t){let n=this.stringToBuffers(e);return this.buffersToValues(n,t)}stringToBuffers(e){return e.split(i.ARGUMENTS_SEPARATOR).map((e=>r.from(e,"hex")))}buffersToValues(e,t){const n=this;let r=[],i=0,o=(e=e||[]).length;for(let s=0;s=o}return r}valuesToString(e){let t=this.valuesToStrings(e);return{argumentsString:t.join(i.ARGUMENTS_SEPARATOR),count:t.length}}valuesToStrings(e){return this.valuesToBuffers(e).map((e=>e.toString("hex")))}valuesToBuffers(e){const t=this,n=[];for(const i of e)r(i);function r(e){if(e.hasExactClass(a.OptionalValue.ClassName)){const t=e;return void(t.isSet()&&r(t.getTypedValue()))}if(e.hasExactClass(u.VariadicValue.ClassName))return void function(e){if(e.getType().isCounted){const r=new s.U32Value(e.getItems().length);n.push(t.codec.encodeTopLevel(r))}for(const t of e.getItems())r(t)}(e);if(e.hasExactClass(c.CompositeValue.ClassName)){const t=e;for(const e of t.getItems())r(e);return}const i=t.codec.encodeTopLevel(e);n.push(i)}return n}}},73913:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentErrorContext=void 0;const r=n(25145);t.ArgumentErrorContext=class{constructor(e,t,n){this.endpointName=e,this.argumentIndex=t,this.parameterDefinition=n}throwError(e){throw new r.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type})\nNested error: ${e}`)}convertError(e,t){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${t})`)}unhandledType(e,t){this.throwError(`Unhandled type (function: ${e}, type: ${t})`)}guardSameLength(e,t){(e=e||[]).length!=t.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${t.length} (argument: ${e})`)}guardHasField(e,t){t in(e=e||{})||this.throwError(`Struct argument does not contain a field named "${t}" (argument: ${JSON.stringify(e)})`)}}},37327:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.Code=void 0;const i=n(17462);class o{constructor(e){this.hex=e}static fromBuffer(e){return new o(e.toString("hex"))}static fromHex(e){return new o(e)}toString(){return this.hex}valueOf(){return r.from(this.hex,"hex")}computeHash(){const e=i(32).update(this.valueOf()).digest();return r.from(e)}}t.Code=o},69259:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.CodeMetadata=void 0;class i{constructor(e=!0,t=!1,n=!1,r=!1){this.upgradeable=e,this.readable=t,this.payable=n,this.payableBySc=r}static fromBytes(e){return i.fromBuffer(r.from(e))}static fromBuffer(e){if(e.lengththis.optionCodec.decodeTopLevel(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,t),onArray:()=>this.arrayCodec.decodeTopLevel(e,t),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,t),onStruct:()=>this.structCodec.decodeTopLevel(e,t),onTuple:()=>this.tupleCodec.decodeTopLevel(e,t),onEnum:()=>this.enumCodec.decodeTopLevel(e,t),onManagedDecimal:()=>this.managedDecimalCodec.decodeTopLevel(e,t),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.decodeTopLevel(e,t)})}decodeNested(e,t){this.constraints.checkBufferLength(e);let[n,r]=a.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeNested(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,t),onArray:()=>this.arrayCodec.decodeNested(e,t),onPrimitive:()=>this.primitiveCodec.decodeNested(e,t),onStruct:()=>this.structCodec.decodeNested(e,t),onTuple:()=>this.tupleCodec.decodeNested(e,t),onEnum:()=>this.enumCodec.decodeNested(e,t),onManagedDecimal:()=>this.managedDecimalCodec.decodeNested(e,t),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.decodeNested(e,t)});return[n,r]}encodeNested(e){return c.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),a.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e),onManagedDecimal:()=>this.managedDecimalCodec.encodeNested(e),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.encodeNested(e)})}encodeTopLevel(e){return c.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),a.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e),onManagedDecimal:()=>this.managedDecimalCodec.encodeTopLevel(e),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.encodeTopLevel(e)})}};class y{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new s.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new s.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}}t.BinaryCodecConstraints=y},71572:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeBigNumber=t.decodeString=t.decodeBool=t.decodeUnsignedNumber=void 0;const i=r(n(44431)),o=n(6058),s=new(n(33831).BinaryCodec);t.decodeUnsignedNumber=function(e){let t=s.decodeTopLevel(e,new o.BigUIntType);return Number(t.valueOf())},t.decodeBool=function(e){let t=s.decodeTopLevel(e,new o.BooleanType);return Boolean(t.valueOf())},t.decodeString=function(e){let t=s.decodeTopLevel(e,new o.BytesType);return String(t.valueOf())},t.decodeBigNumber=function(e){let t=s.decodeTopLevel(e,new o.BigUIntType);return new i.default(t.valueOf())}},70895:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanBinaryCodec=void 0;const a=s(n(25145)),c=n(6058);class u{decodeNested(e){let t=e.readUInt8(0);return[new c.BooleanValue(t==u.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new a.ErrInvalidArgument("buffer should be of size <= 1");let t=e[0];return new c.BooleanValue(t==u.TRUE)}encodeNested(e){return e.isTrue()?r.from([u.TRUE]):r.from([u.FALSE])}encodeTopLevel(e){return e.isTrue()?r.from([u.TRUE]):r.from([])}}t.BooleanBinaryCodec=u,u.TRUE=1,u.FALSE=0},12523:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.BytesBinaryCodec=void 0;const i=n(4212),o=n(4413);t.BytesBinaryCodec=class{decodeNested(e){let t=e.readUInt32BE(0),n=e.slice(o.SizeOfU32,o.SizeOfU32+t);return[new i.BytesValue(n),o.SizeOfU32+t]}decodeTopLevel(e){return new i.BytesValue(e)}encodeNested(e){let t=r.alloc(o.SizeOfU32);return t.writeUInt32BE(e.getLength()),r.concat([t,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}}},87270:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeMetadataCodec=void 0;const r=n(69259),i=n(93242);t.CodeMetadataCodec=class{decodeNested(e){const t=r.CodeMetadata.fromBuffer(e);return[new i.CodeMetadataValue(t),length]}decodeTopLevel(e){const t=r.CodeMetadata.fromBuffer(e);return new i.CodeMetadataValue(t)}encodeNested(e){return e.valueOf().toBuffer()}encodeTopLevel(e){return e.valueOf().toBuffer()}}},4413:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SizeOfU32=void 0,t.SizeOfU32=4},54424:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.EnumBinaryCodec=void 0;const i=n(6058),o=n(30418);t.EnumBinaryCodec=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new o.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[n]=this.decodeNested(e,t);return n}decodeNested(e,t){let[n,r]=this.readDiscriminant(e);e=e.slice(r);let o=t.getVariantByDiscriminant(n),s=o.getFieldsDefinitions(),[a,c]=this.fieldsCodec.decodeNested(e,s);return[new i.EnumValue(t,o,a),r+c]}readDiscriminant(e){let[t,n]=this.binaryCodec.decodeNested(e,new i.U8Type);return[t.valueOf(),n]}encodeNested(e){let t=new i.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(t),o=e.getFields(),s=this.fieldsCodec.encodeNested(o);return r.concat([n,s])}encodeTopLevel(e){let t=e.getFields(),n=t.length>0,o=this.fieldsCodec.encodeNested(t),s=new i.U8Value(e.discriminant),a=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return r.concat([a,o])}}},30418:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.FieldsBinaryCodec=void 0;const i=n(6058);t.FieldsBinaryCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let n=[],r=0;for(const o of t){let[t,s]=this.binaryCodec.decodeNested(e,o.type);e=e.slice(s),r+=s;let a=new i.Field(t,o.name);n.push(a)}return[n,r]}encodeNested(e){let t=[];for(const n of e){let e=this.binaryCodec.encodeNested(n.value);t.push(e)}return r.concat(t)}}},65407:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.H256BinaryCodec=void 0;const r=n(22779);t.H256BinaryCodec=class{decodeNested(e){let t=e.slice(0,32);return[new r.H256Value(t),32]}decodeTopLevel(e){let[t,n]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}}},92377:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(33831),t),i(n(71572),t)},33530:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.ListBinaryCodec=void 0;const i=n(6058),o=n(4413);t.ListBinaryCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let n=t.getFirstTypeParameter(),r=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let a=e,c=o.SizeOfU32;e=a.slice(c);for(let i=0;i0;){let[t,i]=this.binaryCodec.decodeNested(e,n);r.push(t),s+=i,e=o.slice(s),this.binaryCodec.constraints.checkListLength(r.length)}return new i.List(t,r)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=r.alloc(o.SizeOfU32);t.writeUInt32BE(e.getLength());let n=[];for(const r of e.getItems()){let e=this.binaryCodec.encodeNested(r);n.push(e)}return r.concat([t,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=[];for(const n of e.getItems()){let e=this.binaryCodec.encodeNested(n);t.push(e)}return r.concat(t)}}},93972:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagedDecimalCodec=void 0;const o=i(n(44431)),s=n(6058),a=n(68683),c=n(4413);t.ManagedDecimalCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){const n=e.readUInt32BE(0),r=e.slice(0,n);return[this.decodeTopLevel(r,t),n]}decodeTopLevel(e,t){if(0===e.length)return new s.ManagedDecimalValue(new o.default(0),0);if(t.isVariable()){const t=e.length-c.SizeOfU32,[n]=this.binaryCodec.decodeNested(e.slice(0,t),new s.BigUIntType),r=e.readUInt32BE(t);return new s.ManagedDecimalValue(n.valueOf().shiftedBy(-r),r)}const n=a.bufferToBigInt(e),r=t.getMetadata(),i="usize"!==r?parseInt(r.toString()):0;return new s.ManagedDecimalValue(n.shiftedBy(-i),i)}encodeNested(e){let t=[];const n=new s.BigUIntValue(e.valueOf().shiftedBy(e.getScale()));return e.isVariable()?(t.push(r.from(this.binaryCodec.encodeNested(n))),t.push(r.from(this.binaryCodec.encodeNested(new s.U32Value(e.getScale()))))):t.push(this.binaryCodec.encodeTopLevel(n)),r.concat(t)}encodeTopLevel(e){return this.encodeNested(e)}}},82245:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagedDecimalSignedCodec=void 0;const o=i(n(44431)),s=n(6058),a=n(68683),c=n(4413);t.ManagedDecimalSignedCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){const n=e.readUInt32BE(0),r=e.slice(0,n);return[this.decodeTopLevel(r,t),n]}decodeTopLevel(e,t){if(0===e.length)return new s.ManagedDecimalSignedValue(new o.default(0),0);if(t.isVariable()){const t=e.length-c.SizeOfU32,[n]=this.binaryCodec.decodeNested(e.slice(0,t),new s.BigIntType),r=e.readUInt32BE(t);return new s.ManagedDecimalSignedValue(n.valueOf().shiftedBy(-r),r)}const n=a.bufferToBigInt(e),r=t.getMetadata(),i="usize"!==r?parseInt(r.toString()):0;return new s.ManagedDecimalSignedValue(n.shiftedBy(-i),i)}encodeNested(e){let t=[];const n=new s.BigIntValue(e.valueOf().shiftedBy(e.getScale()));return e.isVariable()?(t.push(r.from(this.binaryCodec.encodeNested(n))),t.push(r.from(this.binaryCodec.encodeNested(new s.U32Value(e.getScale()))))):t.push(r.from(this.binaryCodec.encodeTopLevel(n))),r.concat(t)}encodeTopLevel(e){return this.encodeNested(e)}}},68649:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.NothingCodec=void 0;const i=n(6058);t.NothingCodec=class{decodeNested(){return[new i.NothingValue,0]}decodeTopLevel(){return new i.NothingValue}encodeNested(){return r.from([])}encodeTopLevel(){return r.from([])}}},84925:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericalBinaryCodec=void 0;const o=i(n(44431)),s=n(6058),a=n(4413),c=n(68683);t.NumericalBinaryCodec=class{decodeNested(e,t){let n=0,r=t.sizeInBytes;r||(n=a.SizeOfU32,r=e.readUInt32BE(0));let i=e.slice(n,n+r);return[this.decodeTopLevel(i,t),r+n]}decodeTopLevel(e,t){let n=c.cloneBuffer(e);if(0==e.length)return new s.NumericalValue(t,new o.default(0));if(!t.withSign||c.isMsbZero(n)){let e=c.bufferToBigInt(n);return new s.NumericalValue(t,e)}c.flipBufferBitsInPlace(n);let r=c.bufferToBigInt(n).multipliedBy(new o.default(-1)).minus(new o.default(1));return new s.NumericalValue(t,r)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let t=this.encodeTopLevel(e),n=r.alloc(a.SizeOfU32);return n.writeUInt32BE(t.length),r.concat([n,t])}encodeNestedFixedSize(e,t){if(e.value.isZero())return r.alloc(t,0);if(!e.withSign){const n=c.bigIntToBuffer(e.value),i=r.alloc(t-n.length,0);return r.concat([i,n])}if(e.value.isPositive()){let n=c.bigIntToBuffer(e.value);c.isMsbOne(n)&&(n=c.prependByteToBuffer(n,0));const i=r.alloc(t-n.length,0);return r.concat([i,n])}let n=e.value.plus(new o.default(1)),i=c.bigIntToBuffer(n);c.flipBufferBitsInPlace(i),c.isMsbZero(i)&&(i=c.prependByteToBuffer(i,255));const s=r.alloc(t-i.length,255);return r.concat([s,i])}encodeTopLevel(e){let t=e.withSign;return e.value.isZero()?r.alloc(0):t?this.encodePrimitive(e):c.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let t=c.bigIntToBuffer(e.value);return c.isMsbOne(t)&&(t=c.prependByteToBuffer(t,0)),t}let t=e.value.plus(new o.default(1)),n=c.bigIntToBuffer(t);return c.flipBufferBitsInPlace(n),c.isMsbZero(n)&&(n=c.prependByteToBuffer(n,255)),n}}},76726:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.OptionValueBinaryCodec=void 0;const a=s(n(25145)),c=n(6058);t.OptionValueBinaryCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){if(0==e[0])return[c.OptionValue.newMissingTyped(t),1];if(1!=e[0])throw new a.ErrCodec("invalid buffer for optional value");let[n,r]=this.binaryCodec.decodeNested(e.slice(1),t);return[c.OptionValue.newProvided(n),r+1]}decodeTopLevel(e,t){if(0==e.length)return new c.OptionValue(t);if(1!=e[0])throw new a.ErrCodec("invalid buffer for optional value");let[n,r]=this.binaryCodec.decodeNested(e.slice(1),t);return new c.OptionValue(t,n)}encodeNested(e){return e.isSet()?r.concat([r.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):r.from([0])}encodeTopLevel(e){return e.isSet()?r.concat([r.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):r.from([])}}},43840:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PrimitiveBinaryCodec=void 0;const r=n(6058),i=n(54284),o=n(70895),s=n(84925),a=n(65407),c=n(12523),u=n(77856),l=n(87270),d=n(68649),f=n(50218);t.PrimitiveBinaryCodec=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new o.BooleanBinaryCodec,this.numericalCodec=new s.NumericalBinaryCodec,this.addressCodec=new i.AddressBinaryCodec,this.h256Codec=new a.H256BinaryCodec,this.bytesCodec=new c.BytesBinaryCodec,this.stringCodec=new f.StringBinaryCodec,this.tokenIdentifierCodec=new u.TokenIdentifierCodec,this.codeMetadataCodec=new l.CodeMetadataCodec,this.nothingCodec=new d.NothingCodec}decodeNested(e,t){return r.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,t),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onCodeMetadata:()=>this.codeMetadataCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,t){return r.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,t),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onCodeMetadata:()=>this.codeMetadataCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return r.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onCodeMetadata:()=>this.codeMetadataCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return r.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onCodeMetadata:()=>this.codeMetadataCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}}},50218:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.StringBinaryCodec=void 0;const i=n(6058),o=n(4212),s=n(12523);t.StringBinaryCodec=class{constructor(){this.bytesBinaryCodec=new s.BytesBinaryCodec}decodeNested(e){let[t,n]=this.bytesBinaryCodec.decodeNested(e);return[new i.StringValue(t.valueOf().toString()),n]}decodeTopLevel(e){return new i.StringValue(e.toString())}encodeNested(e){let t=o.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(t)}encodeTopLevel(e){return r.from(e.valueOf())}}},61327:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StructBinaryCodec=void 0;const r=n(6058),i=n(30418);t.StructBinaryCodec=class{constructor(e){this.fieldsCodec=new i.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[n]=this.decodeNested(e,t);return n}decodeNested(e,t){let n=t.getFieldsDefinitions(),[i,o]=this.fieldsCodec.decodeNested(e,n);return[new r.Struct(t,i),o]}encodeNested(e){let t=e.getFields();return this.fieldsCodec.encodeNested(t)}encodeTopLevel(e){return this.encodeNested(e)}}},77856:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenIdentifierCodec=void 0;const i=n(4212),o=n(38433),s=n(12523);t.TokenIdentifierCodec=class{constructor(){this.bytesCodec=new s.BytesBinaryCodec}decodeNested(e){let[t,n]=this.bytesCodec.decodeNested(e);return[new o.TokenIdentifierValue(t.toString()),n]}decodeTopLevel(e){let t=this.bytesCodec.decodeTopLevel(e);return new o.TokenIdentifierValue(t.toString())}encodeNested(e){let t=i.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(t)}encodeTopLevel(e){return r.from(e.valueOf())}}},17362:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TupleBinaryCodec=void 0;const r=n(61327);t.TupleBinaryCodec=class{constructor(e){this.structCodec=new r.StructBinaryCodec(e)}decodeTopLevel(e,t){return this.structCodec.decodeTopLevel(e,t)}decodeNested(e,t){return this.structCodec.decodeNested(e,t)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}}},68683:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.prependByteToBuffer=t.flipBufferBitsInPlace=t.getHexMagnitudeOfBigInt=t.bigIntToBuffer=t.bufferToBigInt=t.cloneBuffer=t.isMsbZero=t.isMsbOne=void 0;const o=i(n(44431)),s=n(89439);function a(e,t=0){return 1==e[t]>>7}function c(e){return(e=new o.default(e))?(e.isNegative()&&(e=e.multipliedBy(new o.default(-1))),s.numberToPaddedHex(e)):""}t.isMsbOne=a,t.isMsbZero=function(e,t=0){return!a(e,t)},t.cloneBuffer=function(e){let t=r.alloc(e.length);return e.copy(t),t},t.bufferToBigInt=function(e){let t=e.toString("hex");return new o.default(`0x${t}`,16)},t.bigIntToBuffer=function(e){let t=c(e);return r.from(t,"hex")},t.getHexMagnitudeOfBigInt=c,t.flipBufferBitsInPlace=function(e){for(let t=0;tnew s.TokenTransfer(e))),this}withSingleESDTNFTTransfer(e){return this.tokenTransfers=[e].map((e=>new s.TokenTransfer(e))),this}withMultiESDTNFTTransfer(e){return this.tokenTransfers=e.map((e=>new s.TokenTransfer(e))),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withVersion(e){return this.version=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return(new c.InteractionChecker).checkInteraction(this,this.getEndpoint()),this}}},46038:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionChecker=void 0;const a=o(n(25145)),c=s(n(44431));t.InteractionChecker=class{checkInteraction(e,t){this.checkPayable(e,t),this.checkArguments(e,t)}checkPayable(e,t){let n=!new c.default(e.getValue().toString()).isZero(),r=t.modifiers.isPayableInEGLD();if(n&&!r)throw new a.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,t){let n=t.input,r=e.getArguments(),i=n.length,o=r.length;if(i!=o)throw new a.ErrContractInteraction(`bad arguments, expected: ${i}, got: ${o}`);for(let s=0;s0&&t[0].type.getCardinality().isComposite()&&(r=1/0,i=!0);for(let o of t){if(o.type.getCardinality().isSingular())break;n-=1}return{min:n,max:r,variadic:i}}function n(e,t,s){return e&&l.isTyped(e)?e:t instanceof l.OptionType?function(e,t,r){if(null==e)return l.OptionValue.newMissing();let i=n(e,t.getFirstTypeParameter(),r);return l.OptionValue.newProvided(i)}(e,t,s):t instanceof l.OptionalType?function(e,t,r){if(null==e)return new l.OptionalValue(t);let i=n(e,t.getFirstTypeParameter(),r);return new l.OptionalValue(t,i)}(e,t,s):t instanceof l.VariadicType?function(e,t,r){if(t.isCounted)throw new a.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');null==e&&(e=[]);void 0===e.map&&r.convertError(e,"Variadic");let i=e.map((function(e){return n(e,t.getFirstTypeParameter(),r)}));return new l.VariadicValue(t,i)}(e,t,s):t instanceof l.CompositeType?function(e,t,r){let i=[],o=t.getTypeParameters();r.guardSameLength(e,o);for(let s=0;s0!=e.nonce.valueOf()&&e.data.startsWith("@")));if(!t)return null;let{returnCode:n,returnDataParts:r}=this.sliceDataFieldInParts(t.data),i=t.returnMessage||n.toString();return{returnCode:n,returnMessage:i,values:r}}createBundleOnSignalError(e){let t=e.findSingleOrNoneEvent(l.OnSignalError);if(!t)return null;let{returnCode:n,returnDataParts:r}=this.sliceDataFieldInParts(t.data),i=t.getLastTopic()?.toString()||n.toString();return{returnCode:n,returnMessage:i,values:r}}createBundleOnTooMuchGasWarning(e){let t=e.findSingleOrNoneEvent(l.OnWriteLog,(e=>void 0!=e.findFirstOrNoneTopic((e=>e.toString().startsWith(d.TooMuchGas)))));if(!t)return null;let{returnCode:n,returnDataParts:r}=this.sliceDataFieldInParts(t.data);return{returnCode:n,returnMessage:n.toString(),values:r}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,t){let n=new o.Address(t.bech32()).hex(),r=e.findSingleOrNoneEvent(l.OnWriteLog,(e=>void 0!=e.findFirstOrNoneTopic((e=>e.hex()==n))));if(!r)return null;let{returnCode:i,returnDataParts:s}=this.sliceDataFieldInParts(r.data),a=i.toString();return{returnCode:i,returnMessage:a,values:s}}createBundleWithCustomHeuristics(e,t){return null}createBundleWithFallbackHeuristics(e,t){let n=new o.Address(t.receiver);for(const r of e.contractResults.items){let t=r.logs.findSingleOrNoneEvent(l.OnWriteLog,(t=>{let r=t.address.bech32()==e.sender.bech32(),i=t.topics[0]?.hex()==n.hex();return r&&i}));if(t){let{returnCode:e,returnDataParts:n}=this.sliceDataFieldInParts(t.data),r=e.toString();return{returnCode:e,returnMessage:r,values:n}}}for(const r of e.contractResults.items){let e=r.logs.findSingleOrNoneEvent(l.OnWriteLog,(e=>e.address.bech32()==n.toBech32()));if(e){const{returnCode:t,returnDataParts:n}=this.sliceDataFieldInParts(e.data),r=t.toString();return{returnCode:t,returnMessage:r,values:n}}}return null}sliceDataFieldInParts(e){let t=1;e.startsWith("ESDTTransfer")&&(t=3);let n=this.argsSerializer.stringToBuffers(e),i=n[t]||r.from([]),o=n.slice(t+1);if(0==i.length)throw new s.ErrCannotParseContractResults("no return code");return{returnCode:u.ReturnCode.fromBuffer(i),returnDataParts:o}}parseEvent(e,t){const n=e.topics.map((e=>r.from(e.valueOf()))).slice(1),i=e.dataPayload?.valueOf()||r.from([]),o=e.additionalData?.map((e=>r.from(e.valueOf())))||[];return 0===o.length&&i.length&&o.push(r.from(i)),this.doParseEvent({topics:n,dataItems:o,eventDefinition:t})}doParseEvent(e){const t={},n=e.eventDefinition.inputs.filter((e=>e.indexed)),r=this.argsSerializer.buffersToValues(e.topics,n);for(let s=0;s!e.indexed)),o=this.argsSerializer.buffersToValues(e.dataItems,i);for(let s=0;sc.EndpointDefinition.fromJSON(e))),m=[];for(const c in o){const e=o[c];if("struct"==e.type)m.push(d.StructType.fromJSON({name:c,fields:e.fields}));else{if("enum"!=e.type&&"explicit-enum"!=e.type)throw new s.ErrTypingSystem(`Cannot handle custom type: ${c}`);m.push(u.EnumType.fromJSON({name:c,variants:e.variants}))}}const b=a.map((e=>l.EventDefinition.fromJSON(e)));return new h({name:t,constructorDefinition:f,upgradeConstructorDefinition:p,endpoints:g,customTypes:m,events:b}).remapToKnownTypes()}getCustomType(e){const t=this.customTypes.find((t=>t.getName()==e));return a.guardValueIsSetWithMessage(`custom type [${e}] not found`,t),t}getStruct(e){const t=this.customTypes.find((t=>t.getName()==e&&t.hasExactClass(d.StructType.ClassName)));return a.guardValueIsSetWithMessage(`struct [${e}] not found`,t),t}getStructs(e){return e.map((e=>this.getStruct(e)))}getEnum(e){const t=this.customTypes.find((t=>t.getName()==e&&t.hasExactClass(u.EnumType.ClassName)));return a.guardValueIsSetWithMessage(`enum [${e}] not found`,t),t}getEnums(e){return e.map((e=>this.getEnum(e)))}getEndpoints(){return this.endpoints}getEndpoint(e){const t=this.endpoints.find((t=>t.name==e));return a.guardValueIsSetWithMessage(`endpoint [${e}] not found`,t),t}getEvent(e){const t=this.events.find((t=>t.identifier==e));return a.guardValueIsSetWithMessage(`event [${e}] not found`,t),t}remapToKnownTypes(){const e=new f.TypeMapper([]),t=[];for(const s of this.customTypes)this.mapCustomTypeDepthFirst(s,this.customTypes,e,t);if(this.customTypes.length!=t.length)throw new s.ErrTypingSystem("Did not re-map all custom types");const n=p(this.constructorDefinition,e),r=this.upgradeConstructorDefinition?p(this.upgradeConstructorDefinition,e):void 0,i=[];for(const s of this.endpoints)i.push(p(s,e));const o=this.events.map((t=>function(e,t){const n=e.inputs.map((e=>new l.EventTopicDefinition({name:e.name,type:t.mapType(e.type),indexed:e.indexed})));return new l.EventDefinition(e.identifier,n)}(t,e)));return new h({name:this.name,constructorDefinition:n,upgradeConstructorDefinition:r,endpoints:i,customTypes:t,events:o})}mapCustomTypeDepthFirst(e,t,n,r){if(r.findIndex((t=>t.getName()==e.getName()))>=0)return;for(const o of e.getNamesOfDependencies()){const e=t.find((e=>e.getName()==o));e&&this.mapCustomTypeDepthFirst(e,t,n,r)}const i=n.mapType(e);r.push(i)}}function p(e,t){const n=e.input.map((e=>new c.EndpointParameterDefinition(e.name,e.description,t.mapType(e.type)))),r=e.output.map((e=>new c.EndpointParameterDefinition(e.name,e.description,t.mapType(e.type))));return new c.EndpointDefinition(e.name,n,r,e.modifiers,e.title)}t.AbiRegistry=h},88740:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddressValue=t.AddressType=void 0;const r=n(36946),i=n(31479);class o extends i.PrimitiveType{constructor(){super("Address")}getClassName(){return o.ClassName}}t.AddressType=o,o.ClassName="AddressType";class s extends i.PrimitiveValue{constructor(e){super(new o),this.value=r.Address.newFromBech32(e.bech32())}getClassName(){return s.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}}t.AddressValue=s,s.ClassName="AddressValue"},79967:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalValue=t.OptionalType=void 0;const r=n(44425),i=n(31479);class o extends i.Type{constructor(e){super("Optional",[e],i.TypeCardinality.variable(1))}getClassName(){return o.ClassName}isAssignableFrom(e){if(!e.hasExactClass(o.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(i.NullType.ClassName);return t||n}}t.OptionalType=o,o.ClassName="OptionalType";class s extends i.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return s.ClassName}static newMissing(){let e=new o(new i.NullType);return new s(e)}isSet(){return!!this.value}getTypedValue(){return r.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}}t.OptionalValue=s,s.ClassName="OptionalValue"},43726:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanValue=t.BooleanType=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("bool")}getClassName(){return i.ClassName}}t.BooleanType=i,i.ClassName="BooleanType";class o extends r.PrimitiveValue{constructor(e){super(new i),this.value=e}getClassName(){return o.ClassName}equals(e){return this.value===e.value}isTrue(){return!0===this.value}isFalse(){return!this.isTrue()}valueOf(){return this.value}}t.BooleanValue=o,o.ClassName="BooleanValue"},4212:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.BytesValue=t.BytesType=void 0;const i=n(31479);class o extends i.PrimitiveType{constructor(){super("bytes")}getClassName(){return o.ClassName}}t.BytesType=o,o.ClassName="BytesType";class s extends i.PrimitiveValue{constructor(e){super(new o),this.value=e}getClassName(){return s.ClassName}static fromUTF8(e){let t=r.from(e,"utf-8");return new s(t)}static fromHex(e){let t=r.from(e,"hex");return new s(t)}getLength(){return this.value.length}equals(e){return this.getLength()==e.getLength()&&this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}}t.BytesValue=s,s.ClassName="BytesValue"},93242:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeMetadataValue=t.CodeMetadataType=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("CodeMetadata")}}t.CodeMetadataType=i;class o extends r.PrimitiveValue{constructor(e){super(new i),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}}t.CodeMetadataValue=o},37471:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CollectionOfTypedValues=void 0;t.CollectionOfTypedValues=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map((e=>e.valueOf()))}equals(e){if(this.getLength()!=e.getLength())return!1;for(let t=0;te.getType())),n=new o(...t);return new s(n,e)}getItems(){return this.items}valueOf(){return this.items.map((e=>e?.valueOf()))}equals(e){if(this.getType().differs(e.getType()))return!1;for(let t=0;ts.fromJSON(e))),n=e.outputs.map((e=>s.fromJSON(e))),r=new o(e.mutability,e.payableInTokens,e.onlyOwner);return new i(e.name,t,n,r,e.title)}}t.EndpointDefinition=i;class o{constructor(e,t,n){this.mutability=e||"",this.payableInTokens=t||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return!!this.payableInTokens.includes(e)||!this.payableInTokens.includes(`!${e}`)&&!!this.payableInTokens.includes("*")}isPayable(){return 0!=this.payableInTokens.length}isReadonly(){return"readonly"==this.mutability}isOnlyOwner(){return this.onlyOwner}}t.EndpointModifiers=o;class s{constructor(e,t,n){this.name=e,this.description=t,this.type=n}static fromJSON(e){let t=(new r.TypeExpressionParser).parse(e.type);return new s(e.name||"?",e.description||"N / A",t)}}t.EndpointParameterDefinition=s},3913:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EnumValue=t.EnumVariantDefinition=t.EnumType=void 0;const r=n(25145),i=n(44425),o=n(43149),s=n(31479);class a extends s.CustomType{constructor(e,t){super(e),this.variants=[],this.variants=t}getClassName(){return a.ClassName}static fromJSON(e){const t=a.assignMissingDiscriminants(e.variants||[]).map((e=>c.fromJSON(e)));return new a(e.name,t)}static assignMissingDiscriminants(e){return e.every((e=>void 0==e.discriminant))?e.map(((e,t)=>({...e,discriminant:t}))):e}getVariantByDiscriminant(e){let t=this.variants.find((t=>t.discriminant==e));return i.guardValueIsSet(`variant by discriminant (${e})`,t),t}getVariantByName(e){let t=this.variants.find((t=>t.name==e));return i.guardValueIsSet(`variant by name (${e})`,t),t}getNamesOfDependencies(){const e=[];for(const t of this.variants)e.push(...t.getNamesOfDependencies());return[...new Set(e)]}}t.EnumType=a,a.ClassName="EnumType";class c{constructor(e,t,n=[]){this.fieldsDefinitions=[],i.guardTrue(t<256,"discriminant for simple enum should be less than 256"),this.name=e,this.discriminant=t,this.fieldsDefinitions=n}static fromJSON(e){let t=(e.fields||[]).map((e=>o.FieldDefinition.fromJSON(e)));return new c(e.name,e.discriminant,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find((t=>t.name==e))}getNamesOfDependencies(){return o.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}}t.EnumVariantDefinition=c;class u extends s.TypedValue{constructor(e,t,n){super(e),this.fields=[],this.name=t.name,this.discriminant=t.discriminant,this.fields=n,this.fieldsByName=new Map(n.map((e=>[e.name,e])));let r=t.getFieldsDefinitions();o.Fields.checkTyping(this.fields,r)}getClassName(){return u.ClassName}static fromName(e,t){let n=e.getVariantByName(t);return new u(e,n,[])}static fromDiscriminant(e,t){let n=e.getVariantByDiscriminant(t);return new u(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),n=e.getFields();const r=this.name==e.name,i=this.discriminant==e.discriminant,s=o.Fields.equals(t,n);return r&&i&&s}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new r.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(((t,n)=>e.fields[n]=t.value.valueOf())),e}}t.EnumValue=u,u.ClassName="EnumValue"},32746:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTopicDefinition=t.EventDefinition=void 0;const r=n(65955);class i{constructor(e,t){this.inputs=[],this.identifier=e,this.inputs=t||[]}static fromJSON(e){e.identifier=null==e.identifier?"?":e.identifier,e.inputs=e.inputs||[];const t=e.inputs.map((e=>o.fromJSON(e)));return new i(e.identifier,t)}}t.EventDefinition=i;class o{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){const t=(new r.TypeExpressionParser).parse(e.type);return new o({name:e.name||"?",type:t,indexed:e.indexed})}}t.EventTopicDefinition=o},88316:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createListOfTokenIdentifiers=t.createListOfAddresses=void 0;const r=n(88740),i=n(75902),o=n(38433);t.createListOfAddresses=function(e){let t=e.map((e=>new r.AddressValue(e)));return i.List.fromItems(t)},t.createListOfTokenIdentifiers=function(e){let t=e.map((e=>new o.TokenIdentifierValue(e)));return i.List.fromItems(t)}},43149:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Fields=t.Field=t.FieldDefinition=void 0;const s=o(n(25145)),a=n(65955);class c{constructor(e,t,n){this.name=e,this.description=t,this.type=n}static fromJSON(e){let t=(new a.TypeExpressionParser).parse(e.type);return new c(e.name,e.description,t)}}t.FieldDefinition=c;t.Field=class{constructor(e,t=""){this.value=e,this.name=t}checkTyping(e){const t=this.value.getType();if(!t.equals(e.type))throw new s.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${t}"`);if(this.name!=e.name)throw new s.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};t.Fields=class{static checkTyping(e,t){if(e.length!=t.length)throw new s.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n0,"array length > 0"),this.length=e}getClassName(){return s.ClassName}}t.ArrayVecType=s,s.ClassName="ArrayVecType";class a extends o.TypedValue{constructor(e,t){super(e),r.guardLength(t,e.length),this.backingCollection=new i.CollectionOfTypedValues(t)}getClassName(){return a.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}}t.ArrayVec=a,a.ClassName="ArrayVec"},22779:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.H256Value=t.H256Type=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("H256")}getClassName(){return i.ClassName}}t.H256Type=i,i.ClassName="H256Type";class o extends r.PrimitiveValue{constructor(e){super(new i),this.value=e}getClassName(){return o.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}}t.H256Value=o,o.ClassName="H256Value"},6058:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(89676),t),i(n(88740),t),i(n(79967),t),i(n(43726),t),i(n(4212),t),i(n(93242),t),i(n(46522),t),i(n(78891),t),i(n(3913),t),i(n(88316),t),i(n(43149),t),i(n(75902),t),i(n(87762),t),i(n(22779),t),i(n(30594),t),i(n(69511),t),i(n(69754),t),i(n(67706),t),i(n(272),t),i(n(38433),t),i(n(43802),t),i(n(65955),t),i(n(52725),t),i(n(31479),t),i(n(79554),t),i(n(79027),t),i(n(95218),t)},79027:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagedDecimalValue=t.ManagedDecimalType=void 0;const i=r(n(44431)),o=n(31479);class s extends o.Type{constructor(e){super("ManagedDecimal",void 0,void 0,e)}getClassName(){return s.ClassName}getMetadata(){return this.metadata}isVariable(){return"usize"==this.metadata}}t.ManagedDecimalType=s,s.ClassName="ManagedDecimalType";class a extends o.TypedValue{constructor(e,t,n=!1){super(new s(n?"usize":t)),this.value=new i.default(e),this.scale=t,this.variable=n}getClassName(){return a.ClassName}getScale(){return this.scale}getPrecision(){return this.value.toFixed(this.scale).replace(".","").length}equals(e){return this.getPrecision()==e.getPrecision()&&new i.default(this.value).eq(e.value)}valueOf(){return this.value}toString(){return this.value.toFixed(this.scale)}isVariable(){return this.variable}}t.ManagedDecimalValue=a,a.ClassName="ManagedDecimalValue"},95218:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagedDecimalSignedValue=t.ManagedDecimalSignedType=void 0;const i=r(n(44431)),o=n(31479);class s extends o.Type{constructor(e){super("ManagedDecimalSigned",void 0,void 0,e)}getClassName(){return s.ClassName}getMetadata(){return this.metadata}isVariable(){return"usize"==this.metadata}}t.ManagedDecimalSignedType=s,s.ClassName="ManagedDecimalSignedType";class a extends o.TypedValue{constructor(e,t,n=!1){super(new s(n?"usize":t)),this.value=new i.default(e),this.scale=t,this.variable=n}getClassName(){return a.ClassName}getPrecision(){return this.value.toFixed(this.scale).replace(".","").length}getScale(){return this.scale}equals(e){return this.getPrecision()==e.getPrecision()&&new i.default(this.value).eq(e.value)}valueOf(){return this.value}toString(){return this.value.toFixed(this.scale)}isVariable(){return this.variable}}t.ManagedDecimalSignedValue=a,a.ClassName="ManagedDecimalSignedValue"},30594:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.onPrimitiveTypeSelect=t.onPrimitiveValueSelect=t.onTypedValueSelect=t.onTypeSelect=void 0;const s=o(n(25145)),a=n(88740),c=n(43726),u=n(4212),l=n(93242),d=n(3913),f=n(75902),h=n(22779),p=n(69754),g=n(69511),m=n(272),b=n(38433),y=n(43802),v=n(31479),w=n(87762),x=n(67706),S=n(79027),A=n(95218);t.onTypeSelect=function(e,t){if(e.hasExactClass(f.OptionType.ClassName))return t.onOption();if(e.hasExactClass(f.ListType.ClassName))return t.onList();if(e.hasExactClass(w.ArrayVecType.ClassName))return t.onArray();if(e.hasClassOrSuperclass(v.PrimitiveType.ClassName))return t.onPrimitive();if(e.hasExactClass(m.StructType.ClassName))return t.onStruct();if(e.hasExactClass(y.TupleType.ClassName))return t.onTuple();if(e.hasExactClass(d.EnumType.ClassName))return t.onEnum();if(e.hasExactClass(S.ManagedDecimalType.ClassName))return t.onManagedDecimal();if(e.hasExactClass(A.ManagedDecimalSignedType.ClassName))return t.onManagedDecimalSigned();if(t.onOther)return t.onOther();throw new s.ErrTypingSystem(`type isn't known: ${e}`)},t.onTypedValueSelect=function(e,t){if(e.hasClassOrSuperclass(v.PrimitiveValue.ClassName))return t.onPrimitive();if(e.hasExactClass(f.OptionValue.ClassName))return t.onOption();if(e.hasExactClass(f.List.ClassName))return t.onList();if(e.hasExactClass(w.ArrayVec.ClassName))return t.onArray();if(e.hasExactClass(m.Struct.ClassName))return t.onStruct();if(e.hasExactClass(y.Tuple.ClassName))return t.onTuple();if(e.hasExactClass(d.EnumValue.ClassName))return t.onEnum();if(e.hasExactClass(S.ManagedDecimalValue.ClassName))return t.onManagedDecimal();if(e.hasExactClass(A.ManagedDecimalSignedValue.ClassName))return t.onManagedDecimalSigned();if(t.onOther)return t.onOther();throw new s.ErrTypingSystem(`value isn't typed: ${e}`)},t.onPrimitiveValueSelect=function(e,t){if(e.hasExactClass(c.BooleanValue.ClassName))return t.onBoolean();if(e.hasClassOrSuperclass(p.NumericalValue.ClassName))return t.onNumerical();if(e.hasExactClass(a.AddressValue.ClassName))return t.onAddress();if(e.hasExactClass(u.BytesValue.ClassName))return t.onBytes();if(e.hasExactClass(x.StringValue.ClassName))return t.onString();if(e.hasExactClass(h.H256Value.ClassName))return t.onH256();if(e.hasExactClass(b.TokenIdentifierValue.ClassName))return t.onTypeIdentifier();if(e.hasExactClass(l.CodeMetadataValue.ClassName))return t.onCodeMetadata();if(e.hasExactClass(g.NothingValue.ClassName))return t.onNothing();if(t.onOther)return t.onOther();throw new s.ErrTypingSystem(`value isn't a primitive: ${e.getType()}`)},t.onPrimitiveTypeSelect=function(e,t){if(e.hasExactClass(c.BooleanType.ClassName))return t.onBoolean();if(e.hasClassOrSuperclass(p.NumericalType.ClassName))return t.onNumerical();if(e.hasExactClass(a.AddressType.ClassName))return t.onAddress();if(e.hasExactClass(u.BytesType.ClassName))return t.onBytes();if(e.hasExactClass(x.StringType.ClassName))return t.onString();if(e.hasExactClass(h.H256Type.ClassName))return t.onH256();if(e.hasExactClass(b.TokenIdentifierType.ClassName))return t.onTokenIndetifier();if(e.hasExactClass(l.CodeMetadataType.ClassName))return t.onCodeMetadata();if(e.hasExactClass(g.NothingType.ClassName))return t.onNothing();if(t.onOther)return t.onOther();throw new s.ErrTypingSystem(`type isn't a known primitive: ${e}`)}},69511:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NothingValue=t.NothingType=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("nothing")}getClassName(){return i.ClassName}}t.NothingType=i,i.ClassName="NothingType";class o extends r.PrimitiveValue{constructor(){super(new i)}getClassName(){return o.ClassName}equals(e){return!1}valueOf(){return{}}}t.NothingValue=o,o.ClassName="NothingValue"},69754:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BigIntValue=t.BigUIntValue=t.I64Value=t.U64Value=t.I32Value=t.U32Value=t.I16Value=t.U16Value=t.I8Value=t.U8Value=t.NumericalValue=t.BigIntType=t.BigUIntType=t.I64Type=t.U64Type=t.I32Type=t.U32Type=t.I16Type=t.U16Type=t.I8Type=t.U8Type=t.NumericalType=void 0;const a=s(n(44431)),c=o(n(25145)),u=n(31479);class l extends u.PrimitiveType{constructor(e,t,n){super(e),this.sizeInBytes=t,this.withSign=n}getClassName(){return l.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}}t.NumericalType=l,l.ClassName="NumericalType";class d extends l{constructor(){super("u8",1,!1)}getClassName(){return d.ClassName}}t.U8Type=d,d.ClassName="U8Type";class f extends l{constructor(){super("i8",1,!0)}getClassName(){return f.ClassName}}t.I8Type=f,f.ClassName="I8Type";class h extends l{constructor(){super("u16",2,!1)}getClassName(){return h.ClassName}}t.U16Type=h,h.ClassName="U16Type";class p extends l{constructor(){super("i16",2,!0)}getClassName(){return p.ClassName}}t.I16Type=p,p.ClassName="I16Type";class g extends l{constructor(){super("u32",4,!1)}getClassName(){return g.ClassName}}t.U32Type=g,g.ClassName="U32Type";class m extends l{constructor(){super("i32",4,!0)}getClassName(){return m.ClassName}}t.I32Type=m,m.ClassName="I32Type";class b extends l{constructor(){super("u64",8,!1)}getClassName(){return b.ClassName}}t.U64Type=b,b.ClassName="U64Type";class y extends l{constructor(){super("i64",8,!0)}getClassName(){return y.ClassName}}t.I64Type=y,y.ClassName="I64Type";class v extends l{constructor(){super("BigUint",0,!1)}getClassName(){return v.ClassName}}t.BigUIntType=v,v.ClassName="BigUIntType";class w extends l{constructor(){super("Bigint",0,!0)}getClassName(){return w.ClassName}}t.BigIntType=w,w.ClassName="BigIntType";class x extends u.PrimitiveValue{constructor(e,t){if(super(e),"bigint"===typeof t&&(t=t.toString()),this.value=new a.default(t),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new c.ErrInvalidArgument(`not a number: ${t}`);if(!this.withSign&&this.value.isNegative())throw new c.ErrInvalidArgument(`negative, but type is unsigned: ${t}`)}getClassName(){return x.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}}t.NumericalValue=x,x.ClassName="NumericalValue";class S extends x{constructor(e){super(new d,e)}getClassName(){return S.ClassName}}t.U8Value=S,S.ClassName="U8Value";class A extends x{constructor(e){super(new f,e)}getClassName(){return A.ClassName}}t.I8Value=A,A.ClassName="I8Value";class E extends x{constructor(e){super(new h,e)}getClassName(){return E.ClassName}}t.U16Value=E,E.ClassName="U16Value";class _ extends x{constructor(e){super(new p,e)}getClassName(){return _.ClassName}}t.I16Value=_,_.ClassName="I16Value";class C extends x{constructor(e){super(new g,e)}getClassName(){return C.ClassName}}t.U32Value=C,C.ClassName="U32Value";class I extends x{constructor(e){super(new m,e)}getClassName(){return I.ClassName}}t.I32Value=I,I.ClassName="I32Value";class k extends x{constructor(e){super(new b,e)}getClassName(){return k.ClassName}}t.U64Value=k,k.ClassName="U64Value";class T extends x{constructor(e){super(new y,e)}getClassName(){return T.ClassName}}t.I64Value=T,T.ClassName="I64Value";class M extends x{constructor(e){super(new v,e)}getClassName(){return M.ClassName}}t.BigUIntValue=M,M.ClassName="BigUIntValue";class P extends x{constructor(e){super(new w,e)}getClassName(){return P.ClassName}}t.BigIntValue=P,P.ClassName="BigIntValue"},67706:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.StringValue=t.StringType=void 0;const i=n(31479);class o extends i.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return o.ClassName}}t.StringType=o,o.ClassName="StringType";class s extends i.PrimitiveValue{constructor(e){super(new o),this.value=e}getClassName(){return s.ClassName}static fromUTF8(e){return new s(e)}static fromHex(e){let t=r.from(e,"hex").toString();return new s(t)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}}t.StringValue=s,s.ClassName="StringValue"},272:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Struct=t.StructType=void 0;const r=n(25145),i=n(43149),o=n(31479);class s extends o.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return s.ClassName}static fromJSON(e){let t=(e.fields||[]).map((e=>i.FieldDefinition.fromJSON(e)));return new s(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find((t=>t.name==e))}getNamesOfDependencies(){return i.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}}t.StructType=s,s.ClassName="StructType";class a extends o.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map((e=>[e.name,e]))),this.checkTyping()}getClassName(){return a.ClassName}checkTyping(){let e=this.getType().getFieldsDefinitions();i.Fields.checkTyping(this.fields,e)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new r.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(const t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),n=e.getFields();return i.Fields.equals(t,n)}}t.Struct=a,a.ClassName="Struct"},38433:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenIdentifierValue=t.TokenIdentifierType=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return i.ClassName}}t.TokenIdentifierType=i,i.ClassName="TokenIdentifierType";class o extends r.PrimitiveValue{constructor(e){super(new i),this.value=e}static egld(){return new o("EGLD")}static esdtTokenIdentifier(e){return new o(e)}getClassName(){return o.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()==e.getLength()&&this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}}t.TokenIdentifierValue=o,o.ClassName="TokenIdentifierValue"},43802:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Tuple=t.TupleType=void 0;const s=o(n(25145)),a=n(43149),c=n(272);class u extends c.StructType{constructor(...e){super(u.prepareName(e),u.prepareFieldDefinitions(e))}getClassName(){return u.ClassName}static prepareName(e){return`tuple<${e.map((e=>e.toString())).join(", ")}>`}static prepareFieldDefinitions(e){return e.map(((e,t)=>new a.FieldDefinition(l(t),"anonymous tuple field",e)))}}function l(e){return`field${e}`}t.TupleType=u,u.ClassName="TupleType";class d extends c.Struct{constructor(e,t){super(e,t)}getClassName(){return d.ClassName}static fromItems(e){if(e.length<1)throw new s.ErrTypingSystem("bad tuple items");let t=e.map((e=>e.getType())),n=new u(...t),r=e.map(((e,t)=>new a.Field(e,l(t))));return new d(n,r)}}t.Tuple=d,d.ClassName="Tuple"},65955:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeExpressionParser=void 0;const r=n(71154),i=n(25145),o=n(31479);t.TypeExpressionParser=class{constructor(){this.backingTypeFormulaParser=new r.TypeFormulaParser}parse(e){try{return this.doParse(e)}catch(t){throw new i.ErrTypingSystem(`Failed to parse type expression: ${e}. Error: ${t}`)}}doParse(e){const t=this.backingTypeFormulaParser.parseExpression(e);return this.typeFormulaToType(t)}typeFormulaToType(e){const t=e.typeParameters.map((e=>this.typeFormulaToType(e)));return new o.Type(e.name,t,void 0,e.metadata)}}},52725:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TypeMapper=void 0;const s=o(n(25145)),a=n(88740),c=n(79967),u=n(43726),l=n(4212),d=n(93242),f=n(46522),h=n(3913),p=n(43149),g=n(75902),m=n(87762),b=n(22779),y=n(79027),v=n(95218),w=n(69511),x=n(69754),S=n(67706),A=n(272),E=n(38433),_=n(43802),C=n(79554);t.TypeMapper=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...e)=>new g.OptionType(e[0])],["List",(...e)=>new g.ListType(e[0])],["VarArgs",(...e)=>new C.VariadicType(e[0])],["MultiResultVec",(...e)=>new C.VariadicType(e[0])],["variadic",(...e)=>new C.VariadicType(e[0])],["counted-variadic",(...e)=>new C.VariadicType(e[0],!0)],["OptionalArg",(...e)=>new c.OptionalType(e[0])],["optional",(...e)=>new c.OptionalType(e[0])],["OptionalResult",(...e)=>new c.OptionalType(e[0])],["multi",(...e)=>new f.CompositeType(...e)],["MultiArg",(...e)=>new f.CompositeType(...e)],["MultiResult",(...e)=>new f.CompositeType(...e)],["multi",(...e)=>new f.CompositeType(...e)],["tuple",(...e)=>new _.TupleType(...e)],["tuple2",(...e)=>new _.TupleType(...e)],["tuple3",(...e)=>new _.TupleType(...e)],["tuple4",(...e)=>new _.TupleType(...e)],["tuple5",(...e)=>new _.TupleType(...e)],["tuple6",(...e)=>new _.TupleType(...e)],["tuple7",(...e)=>new _.TupleType(...e)],["tuple8",(...e)=>new _.TupleType(...e)],["array2",(...e)=>new m.ArrayVecType(2,e[0])],["array8",(...e)=>new m.ArrayVecType(8,e[0])],["array16",(...e)=>new m.ArrayVecType(16,e[0])],["array20",(...e)=>new m.ArrayVecType(20,e[0])],["array32",(...e)=>new m.ArrayVecType(32,e[0])],["array46",(...e)=>new m.ArrayVecType(46,e[0])],["array48",(...e)=>new m.ArrayVecType(48,e[0])],["array64",(...e)=>new m.ArrayVecType(64,e[0])],["array128",(...e)=>new m.ArrayVecType(128,e[0])],["array256",(...e)=>new m.ArrayVecType(256,e[0])],["ManagedDecimal",(...e)=>new y.ManagedDecimalType(e)],["ManagedDecimalSigned",(...e)=>new v.ManagedDecimalSignedType(e)]]),this.closedTypesMap=new Map([["u8",new x.U8Type],["u16",new x.U16Type],["u32",new x.U32Type],["u64",new x.U64Type],["U64",new x.U64Type],["BigUint",new x.BigUIntType],["i8",new x.I8Type],["i16",new x.I16Type],["i32",new x.I32Type],["i64",new x.I64Type],["Bigint",new x.BigIntType],["BigInt",new x.BigIntType],["bool",new u.BooleanType],["bytes",new l.BytesType],["Address",new a.AddressType],["H256",new b.H256Type],["utf-8 string",new S.StringType],["TokenIdentifier",new E.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new E.TokenIdentifierType],["CodeMetadata",new d.CodeMetadataType],["nothing",new w.NothingType],["AsyncCall",new w.NothingType]]),this.learnedTypesMap=new Map;for(const t of e)"ManagedDecimal"===t.getName()||"ManagedDecimalSigned"===t.getName()?this.learnedTypesMap.set(`${t.getName()}_${t.getMetadata()}`,t):this.learnedTypesMap.set(t.getName(),t)}mapType(e){let t=this.mapTypeRecursively(e);if(t)return t.isGenericType()||this.learnType(t),t;throw new s.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let t=e.isGenericType(),n=e.hasMetadata(),r=this.learnedTypesMap.get(e.getName());if(r)return r;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(h.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(A.StructType.ClassName)?this.mapStructType(e):t||n?this.mapGenericType(e):null)}learnType(e){if("ManagedDecimal"===e.getName()||"ManagedDecimalSigned"===e.getName()){const t=`${e.getName()}_${e.getMetadata()}`;this.learnedTypesMap.delete(t),this.learnedTypesMap.set(t,e)}else{const t=e.getName();this.learnedTypesMap.delete(t),this.learnedTypesMap.set(t,e)}}mapStructType(e){let t=this.mappedFields(e.getFieldsDefinitions());return new A.StructType(e.getName(),t)}mapEnumType(e){let t=e.variants.map((e=>new h.EnumVariantDefinition(e.name,e.discriminant,this.mappedFields(e.getFieldsDefinitions()))));return new h.EnumType(e.getName(),t)}mappedFields(e){return e.map((e=>new p.FieldDefinition(e.name,e.description,this.mapType(e.type))))}mapGenericType(e){let t=e.getTypeParameters().map((e=>this.mapType(e))),n=this.openTypesFactories.get(e.getName());if(!n)throw new s.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return e.hasMetadata()?n(e.getMetadata()):n(...t)}}},31479:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NullType=t.TypePlaceholder=t.isTyped=t.PrimitiveValue=t.TypedValue=t.CustomType=t.PrimitiveType=t.TypeCardinality=t.Type=void 0;const r=n(4317),i=n(44425);class o{constructor(e,t=[],n=s.fixed(1),r){i.guardValueIsSet("name",e),this.name=e,this.typeParameters=t,this.cardinality=n,this.metadata=r}getName(){return this.name}getClassName(){return o.ClassName}getClassHierarchy(){return r.getJavascriptPrototypesInHierarchy(this,(e=>e.belongsToTypesystem)).map((e=>e.getClassName())).reverse()}getFullyQualifiedName(){return this.isGenericType()||this.hasMetadata()?this.getFullNameForGeneric():`multiversx:types:${this.getName()}`}getFullNameForGeneric(){const e=this.getTypeParameters().length>0,t=e?`${this.getTypeParameters().map((e=>e.getFullyQualifiedName())).join(", ")}`:"";let n=`multiversx:types:${this.getName()}`;return e&&(n=`${n}<${t}>`),void 0!==this.metadata&&(n=`${n}*${this.metadata}*`),n}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}getMetadata(){return this.metadata}isGenericType(){return this.typeParameters.length>0}hasMetadata(){return!!this.metadata}getFirstTypeParameter(){return i.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map((e=>e.toString())).join(", "),t=e?`<${e}>`:"";return`${this.name}${t}`}equals(e){return o.equals(this,e)}static equals(e,t){return e.getFullyQualifiedName()==t.getFullyQualifiedName()}static equalsMany(e,t){return e.every(((e,n)=>e.equals(t[n])))}static isAssignableFromMany(e,t){return e.every(((e,n)=>e.isAssignableFrom(t[n])))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!o.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let t=this.getFullyQualifiedName();return!!o.getFullyQualifiedNamesInHierarchy(e).includes(t)||e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return r.getJavascriptPrototypesInHierarchy(e,(e=>e.belongsToTypesystem)).map((t=>t.getFullyQualifiedName.call(e)))}getNamesOfDependencies(){const e=[];for(const t of this.typeParameters)e.push(t.getName()),e.push(...t.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map((e=>e.toJSON()))}}getCardinality(){return this.cardinality}belongsToTypesystem(){}}t.Type=o,o.ClassName="Type";class s{constructor(e,t){this.lowerBound=e,this.upperBound=t}static fixed(e){return new s(e,e)}static variable(e){return new s(0,e)}isSingular(){return 1==this.lowerBound&&1==this.upperBound}isSingularOrNone(){return 0==this.lowerBound&&1==this.upperBound}isComposite(){return 1!=this.upperBound}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||s.MaxCardinality}}t.TypeCardinality=s,s.MaxCardinality=4096;class a extends o{constructor(e){super(e)}getClassName(){return a.ClassName}}t.PrimitiveType=a,a.ClassName="PrimitiveType";class c extends o{getClassName(){return c.ClassName}}t.CustomType=c,c.ClassName="CustomType";class u{constructor(e){this.type=e}getClassName(){return u.ClassName}getClassHierarchy(){return r.getJavascriptPrototypesInHierarchy(this,(e=>e.belongsToTypesystem)).map((e=>e.getClassName())).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}}t.TypedValue=u,u.ClassName="TypedValue";class l extends u{constructor(e){super(e)}getClassName(){return l.ClassName}}t.PrimitiveValue=l,l.ClassName="PrimitiveValue",t.isTyped=function(e){return void 0!==e.belongsToTypesystem};class d extends o{constructor(){super("...")}getClassName(){return d.ClassName}}t.TypePlaceholder=d,d.ClassName="TypePlaceholder";class f extends o{constructor(){super("?")}getClassName(){return f.ClassName}}t.NullType=f,f.ClassName="NullType"},79554:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VariadicValue=t.CountedVariadicType=t.VariadicType=void 0;const r=n(31479);class i extends r.Type{constructor(e,t=!1){super("Variadic",[e],r.TypeCardinality.variable()),this.isCounted=t}getClassName(){return i.ClassName}}t.VariadicType=i,i.ClassName="VariadicType";class o extends r.Type{constructor(e){super("Variadic",[e],r.TypeCardinality.variable())}getClassName(){return i.ClassName}}t.CountedVariadicType=o,o.ClassName="VariadicType";class s extends r.TypedValue{constructor(e,t){super(e),this.items=t}getClassName(){return s.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,t){if(0==e.length)return new s(new i(new r.TypePlaceholder,t),[]);const n=e[0].getType();return new s(new i(n,t),e)}getItems(){return this.items}valueOf(){return this.items.map((e=>e.valueOf()))}equals(e){if(this.getType().differs(e.getType()))return!1;for(let t=0;te.valueOf().toString()))}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTSetRole");return{userAddress:t.address.toString(),tokenIdentifier:this.extractTokenIdentifier(t),roles:t.topics.slice(3).map((e=>e.valueOf().toString()))}}parseNFTCreate(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTNFTCreate");return{tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),initialQuantity:this.extractAmount(t)}}parseLocalMint(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTLocalMint");return{userAddress:t.address.toString(),tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),mintedSupply:this.extractAmount(t)}}parseLocalBurn(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTLocalBurn");return{userAddress:t.address.toString(),tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),burntSupply:this.extractAmount(t)}}parsePause(e){this.ensureNoError(e);this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(t),r=this.extractNonce(t),i=this.extractAmount(t);return{userAddress:this.extractAddress(t),tokenIdentifier:n,nonce:r,balance:i}}parseUnfreeze(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(t),r=this.extractNonce(t),i=this.extractAmount(t);return{userAddress:this.extractAddress(t),tokenIdentifier:n,nonce:r,balance:i}}parseWipe(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(t),r=this.extractNonce(t),i=this.extractAmount(t);return{userAddress:this.extractAddress(t),tokenIdentifier:n,nonce:r,balance:i}}parseUpdateAttributes(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),n=this.extractTokenIdentifier(t),r=this.extractNonce(t),i=t.topics[3]?.valueOf();return{tokenIdentifier:n,nonce:r,attributes:i}}parseAddQuantity(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity");return{tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),addedQuantity:this.extractAmount(t)}}parseBurnQuantity(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTNFTBurn");return{tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),burntQuantity:this.extractAmount(t)}}ensureNoError(e){for(const t of e.logs.events)if("signalError"==t.identifier){const n=r.from(t.data.substring(1),"hex").toString(),i=t.topics[1]?.valueOf().toString();throw new o.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${i} (${n})`)}}findSingleEventByIdentifier(e,t){const n=this.gatherAllEvents(e).filter((e=>e.identifier==t));if(0==n.length)throw new o.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${t}`);if(n.length>1)throw new o.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${t}`);return n[0]}gatherAllEvents(e){const t=[];t.push(...e.logs.events);for(const n of e.contractResults.items)t.push(...n.logs.events);return t}extractTokenIdentifier(e){return e.topics[0]?.valueOf().toString()}extractNonce(e){return s.bufferToBigInt(e.topics[1]?.valueOf()).toFixed(0)}extractAmount(e){return s.bufferToBigInt(e.topics[2]?.valueOf()).toFixed(0)}extractAddress(e){return i.Address.fromBuffer(e.topics[3]?.valueOf()).toString()}}},43927:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenPayment=t.TokenComputer=t.TokenTransfer=t.Token=void 0;const o=i(n(44431)),s=n(25145),a=n(63025),c="EGLD";o.default.set({ROUNDING_MODE:1});class u{constructor(e){this.identifier=e.identifier,this.nonce=e.nonce||0n}}t.Token=u;class l{constructor(e){if(this.isLegacyTokenTransferOptions(e)){const t=new o.default(e.amountAsBigInteger);if(!t.isInteger()||t.isNegative())throw new s.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=t,this.numDecimals=e.numDecimals||0,this.token=new u({identifier:e.tokenIdentifier,nonce:BigInt(e.nonce)}),this.amount=BigInt(this.amountAsBigInteger.toFixed(0))}else this.token=e.token,this.amount=e.amount,this.tokenIdentifier=e.token.identifier,this.nonce=Number(e.token.nonce),this.amountAsBigInteger=new o.default(this.amount.toString()),this.numDecimals=0}static newFromEgldAmount(e){const t=new u({identifier:a.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER});return new l({token:t,amount:e})}isLegacyTokenTransferOptions(e){return void 0!==e.tokenIdentifier}static egldFromAmount(e){const t=new o.default(e).shiftedBy(18).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new l({tokenIdentifier:c,nonce:0,amountAsBigInteger:e,numDecimals:18})}static fungibleFromAmount(e,t,n){const r=new o.default(t).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,r,n)}static fungibleFromBigInteger(e,t,n=0){return new l({tokenIdentifier:e,nonce:0,amountAsBigInteger:t,numDecimals:n})}static nonFungible(e,t){return new l({tokenIdentifier:e,nonce:t,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,t,n){return new l({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,t,n,r){const i=new o.default(n).shiftedBy(r).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,i,r)}static metaEsdtFromBigInteger(e,t,n,r=0){return new l({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:r})}toString(){return this.amount.toString()}valueOf(){return new o.default(this.amount.toString())}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.token.identifier==c}isFungible(){return 0n==this.token.nonce}}t.TokenTransfer=l;t.TokenComputer=class{constructor(){}isFungible(e){return 0n===e.nonce}extractNonceFromExtendedIdentifier(e){const t=e.split("-");if(this.checkIfExtendedIdentifierWasProvided(t),this.checkLengthOfRandomSequence(t[1]),2==t.length)return 0;const n=r.from(t[2],"hex");return(i=n).readUIntBE(0,i.length);var i}extractIdentifierFromExtendedIdentifier(e){const t=e.split("-");return this.checkIfExtendedIdentifierWasProvided(t),this.ensureTokenTickerValidity(t[0]),this.checkLengthOfRandomSequence(t[1]),t[0]+"-"+t[1]}checkIfExtendedIdentifierWasProvided(e){if(e.length<2||e.length>3)throw new s.ErrInvalidTokenIdentifier("Invalid extended token identifier provided")}checkLengthOfRandomSequence(e){if(6!==e.length)throw new s.ErrInvalidTokenIdentifier("The identifier is not valid. The random sequence does not have the right length")}ensureTokenTickerValidity(e){if(e.length<3||e.length>10)throw new s.ErrInvalidTokenIdentifier("The token ticker should be between 3 and 10 characters");if(!e.match(/^[a-zA-Z0-9]+$/))throw new s.ErrInvalidTokenIdentifier("The token ticker should only contain alphanumeric characters");if(e!=e.toUpperCase())throw new s.ErrInvalidTokenIdentifier("The token ticker should be upper case")}};t.TokenPayment=class extends l{constructor(e,t,n,r){super({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:r})}}},66679:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionHash=t.Transaction=void 0;const i=n(44431),o=n(36946),s=n(63025),a=n(10545),c=n(93827),u=n(43186),l=n(40188),d=n(94712),f=n(86030);t.Transaction=class{constructor(e){this.nonce=BigInt(e.nonce?.valueOf()||0n),this.value=e.value?BigInt(new i.BigNumber(e.value.toString()).toFixed(0)):0n,this.sender=this.addressAsBech32(e.sender),this.receiver=this.addressAsBech32(e.receiver),this.senderUsername=e.senderUsername||"",this.receiverUsername=e.receiverUsername||"",this.gasPrice=BigInt(e.gasPrice?.valueOf()||s.TRANSACTION_MIN_GAS_PRICE),this.gasLimit=BigInt(e.gasLimit.valueOf()),this.data=e.data?.valueOf()||new Uint8Array,this.chainID=e.chainID.valueOf(),this.version=Number(e.version?.valueOf()||s.TRANSACTION_VERSION_DEFAULT),this.options=Number(e.options?.valueOf()||s.TRANSACTION_OPTIONS_DEFAULT),this.guardian=e.guardian?this.addressAsBech32(e.guardian):"",this.signature=e.signature||r.from([]),this.guardianSignature=e.guardianSignature||r.from([]),this.relayer=e.relayer||"",this.innerTransactions=e.innerTransactions||[]}addressAsBech32(e){return"string"===typeof e?e:e.bech32()}getNonce(){return Number(this.nonce)}setNonce(e){this.nonce=BigInt(e.valueOf())}getValue(){return this.value}setValue(e){this.value=BigInt(e.toString())}getSender(){return o.Address.fromBech32(this.sender)}setSender(e){this.sender="string"===typeof e?e:e.bech32()}getReceiver(){return o.Address.fromBech32(this.receiver)}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return new o.Address(this.guardian)}getGasPrice(){return Number(this.gasPrice)}setGasPrice(e){this.gasPrice=BigInt(e.valueOf())}getGasLimit(){return Number(this.gasLimit)}setGasLimit(e){this.gasLimit=BigInt(e.valueOf())}getData(){return new d.TransactionPayload(r.from(this.data))}getChainID(){return this.chainID}setChainID(e){this.chainID=e.valueOf()}getVersion(){return new u.TransactionVersion(this.version)}setVersion(e){this.version=e.valueOf()}getOptions(){return new u.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=e.valueOf()}getSignature(){return r.from(this.signature)}getGuardianSignature(){return r.from(this.guardianSignature)}setGuardian(e){this.guardian="string"===typeof e?e:e.bech32()}getHash(){return h.compute(this)}serializeForSigning(){const e=(new f.TransactionComputer).computeBytesForSigning(this);return r.from(e)}isGuardedTransaction(){const e=this.guardian.length>0,t=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&t}toPlainObject(){return(new a.TransactionsConverter).transactionToPlainObject(this)}static fromPlainObject(e){return(new a.TransactionsConverter).plainObjectToTransaction(e)}applySignature(e){this.signature=l.interpretSignatureAsBuffer(e)}applyGuardianSignature(e){this.guardianSignature=l.interpretSignatureAsBuffer(e)}toSendable(){return this.toPlainObject()}computeFee(e){const t=(new f.TransactionComputer).computeTransactionFee(this,e);return new i.BigNumber(t.toString())}};class h extends c.Hash{constructor(e){super(e)}static compute(e){const t=(new f.TransactionComputer).computeTransactionHash(e);return new h(r.from(t).toString("hex"))}}t.TransactionHash=h},86030:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionComputer=void 0;const c=a(n(44431)),u=n(63025),l=s(n(25145)),d=n(87748),f=n(66679),h=n(17462),p=n(95811);t.TransactionComputer=class{constructor(){}computeTransactionFee(e,t){const n=BigInt(t.MinGasLimit+e.data.length*t.GasPerDataByte);if(n>e.gasLimit)throw new l.ErrNotEnoughGas(parseInt(e.gasLimit.toString(),10));const r=e.gasPrice,i=n*r;if(n===e.gasLimit)return i;return i+(e.gasLimit-n)*BigInt(new c.default(r.toString()).multipliedBy(new c.default(t.GasPriceModifier)).toFixed(0))}computeBytesForSigning(e){this.ensureValidTransactionFields(e);const t=this.toPlainObject(e),n=JSON.stringify(t);return new Uint8Array(r.from(n))}computeBytesForVerifying(e){return this.hasOptionsSetForHashSigning(e)?this.computeHashForSigning(e):this.computeBytesForSigning(e)}computeHashForSigning(e){const t=this.toPlainObject(e),n=r.from(JSON.stringify(t));return p("keccak256").update(n).digest()}computeTransactionHash(e){const t=(new d.ProtoSerializer).serializeTransaction(new f.Transaction(e)),n=h(32).update(t).digest("hex");return r.from(n,"hex")}hasOptionsSetForGuardedTransaction(e){return(e.options&u.TRANSACTION_OPTIONS_TX_GUARDED)==u.TRANSACTION_OPTIONS_TX_GUARDED}hasOptionsSetForHashSigning(e){return(e.options&u.TRANSACTION_OPTIONS_TX_HASH_SIGN)==u.TRANSACTION_OPTIONS_TX_HASH_SIGN}applyGuardian(e,t){e.versionthis.toPlainObject(e,!0))):void 0,n}toHexOrUndefined(e){return e&&e.length?r.from(e).toString("hex"):void 0}toBase64OrUndefined(e){return e&&e.length?r.from(e).toString("base64"):void 0}ensureValidTransactionFields(e){if(!e.chainID.length)throw new l.ErrBadUsage("The `chainID` field is not set");if(e.version= ${u.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS}`)}}},94712:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionPayload=void 0;class i{constructor(e){this.data=r.from(e||[])}static fromEncoded(e){if(!e)return new i("");let t=r.from(e,"base64").toString();return new i(t)}isEmpty(){return 0==this.data.length}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map((e=>r.from(e,"hex")))}length(){return r.from(this.data).length}}t.TransactionPayload=i},9465:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionWatcher=void 0;const r=n(70449),i=n(63025),o=n(25145),s=n(1853);class a{constructor(e,t={}){this.fetcher=new c(e),this.pollingIntervalMilliseconds=t.pollingIntervalMilliseconds||a.DefaultPollingInterval,this.timeoutMilliseconds=t.timeoutMilliseconds||a.DefaultTimeout,this.patienceMilliseconds=t.patienceMilliseconds||a.DefaultPatience}async awaitPending(e){return this.awaitConditionally((e=>e.status.isPending()),(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionStatusNotReached))}async awaitCompleted(e){return this.awaitConditionally((e=>{if(void 0===e.isCompleted)throw new o.ErrIsCompletedFieldIsMissingOnTransaction;return e.isCompleted}),(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionStatusNotReached))}async awaitAllEvents(e,t){return this.awaitConditionally((e=>{const n=this.getAllTransactionEvents(e).map((e=>e.identifier));return t.every((e=>n.includes(e)))}),(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionEventsNotFound))}async awaitAnyEvent(e,t){return this.awaitConditionally((e=>{const n=this.getAllTransactionEvents(e).map((e=>e.identifier));return void 0!=t.find((e=>n.includes(e)))}),(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionEventsNotFound))}async awaitOnCondition(e,t){return this.awaitConditionally(t,(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionStatusNotReached))}transactionOrTxHashToTxHash(e){const t="string"===typeof e?e:e.getHash().hex();if(t.length!==i.HEX_TRANSACTION_HASH_LENGTH)throw new o.Err(`Invalid transaction hash length. The length of a hex encoded hash should be ${i.HEX_TRANSACTION_HASH_LENGTH}.`);return t}async awaitConditionally(e,t,n){const i=new r.AsyncTimer("watcher:periodic"),a=new r.AsyncTimer("watcher:patience"),c=new r.AsyncTimer("watcher:timeout");let u,l=!1,d=!1;for(c.start(this.timeoutMilliseconds).finally((()=>{c.stop(),l=!0}));!l;){await i.start(this.pollingIntervalMilliseconds);try{if(u=await t(),d=e(u),d||l)break}catch(f){if(s.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof o.ErrIsCompletedFieldIsMissingOnTransaction)throw f;if(!(f instanceof o.Err))throw f}}if(d&&await a.start(this.patienceMilliseconds),c.isStopped()||c.stop(),!u||!d)throw n();return u}getAllTransactionEvents(e){const t=[...e.logs.events];for(const n of e.contractResults.items)t.push(...n.logs.events);return t}}t.TransactionWatcher=a,a.DefaultPollingInterval=6e3,a.DefaultTimeout=15*a.DefaultPollingInterval,a.DefaultPatience=0,a.NoopOnStatusReceived=e=>{};class c{constructor(e){this.fetcher=e}async getTransaction(e){return s.Logger.debug(`transactionWatcher, getTransaction(${e})`),await this.fetcher.getTransaction(e)}}},69043:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.AccountTransactionsFactory=void 0;const i=n(36946),o=n(87926);t.AccountTransactionsFactory=class{constructor(e){this.config=e.config}createTransactionForSavingKeyValue(e){const t=["SaveKeyValue",...this.computeDataPartsForSavingKeyValue(e.keyValuePairs)],n=this.computeExtraGasForSavingKeyValue(e.keyValuePairs);return new o.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:n,addDataMovementGas:!0}).build()}computeExtraGasForSavingKeyValue(e){let t=0n;return e.forEach(((e,n)=>{t+=this.config.gasLimitPersistPerByte*BigInt(n.length+e.length)+this.config.gasLimitStorePerByte*BigInt(e.length)})),t+this.config.gasLimitSaveKeyValue}computeDataPartsForSavingKeyValue(e){const t=[];return e.forEach(((e,n)=>{t.push(r.from(n).toString("hex"),r.from(e).toString("hex"))})),t}createTransactionForSettingGuardian(e){const t=["SetGuardian",i.Address.fromBech32(e.guardianAddress.bech32()).toHex(),r.from(e.serviceID).toString("hex")];return new o.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitSetGuardian,addDataMovementGas:!0}).build()}createTransactionForGuardingAccount(e){return new o.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:["GuardAccount"],gasLimit:this.config.gasLimitGuardAccount,addDataMovementGas:!0}).build()}createTransactionForUnguardingAccount(e){return new o.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:["UnGuardAccount"],gasLimit:this.config.gasLimitUnguardAccount,addDataMovementGas:!0}).build()}}},85149:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationTransactionsFactory=void 0;const i=n(36946),o=n(63025),s=n(25145),a=n(47480),c=n(87926);t.DelegationTransactionsFactory=class{constructor(e){this.config=e.config,this.argSerializer=new a.ArgSerializer,this.delegationManagerAddress=i.Address.fromHex(o.DELEGATION_MANAGER_SC_ADDRESS_HEX,this.config.addressHrp)}createTransactionForNewDelegationContract(e){const t=["createNewDelegationContract",...this.argSerializer.valuesToStrings([new a.BigUIntValue(e.totalDelegationCap),new a.BigUIntValue(e.serviceFee)])],n=this.config.gasLimitCreateDelegationContract+this.config.additionalGasLimitForDelegationOperations;return new c.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.delegationManagerAddress,dataParts:t,gasLimit:n,addDataMovementGas:!0,amount:e.amount}).build()}createTransactionForAddingNodes(e){if(e.publicKeys.length!==e.signedMessages.length)throw new s.Err("The number of public keys should match the number of signed messages");const t=e.signedMessages.map((e=>new a.BytesValue(r.from(e)))),n=this.argSerializer.valuesToStrings(t),i=e.publicKeys.length,o=["addNodes"];for(let r=0;r1&&(s=this.dataArgsBuilder.buildDataPartsForMultiESDTNFTTransfer(o,n),o=e.sender);s.push(s.length?d.utf8ToHex(e.function):e.function);const a=this.abi?.getEndpoint(e.function),c=this.argsToDataParts(t,a);return s.push(...c),new h.TransactionBuilder({config:this.config,sender:e.sender,receiver:o,dataParts:s,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}createTransactionForUpgrade(e){const t=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,r=e.isReadable??!0,i=e.isPayable??!1,o=e.isPayableBySmartContract??!0,s=e.arguments||[],c=new a.CodeMetadata(n,r,i,o),u=["upgradeContract",d.byteArrayToHex(e.bytecode),c.toString()],l=this.getEndpointForUpgrade(),f=this.argsToDataParts(s,l);return u.push(...f),new h.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:u,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:t}).build()}getEndpointForUpgrade(){if(this.abi){if(this.abi.upgradeConstructorDefinition)return this.abi.upgradeConstructorDefinition;try{return this.abi.getEndpoint("upgrade")}catch(e){return s.Logger.warn("In the ABI, cannot find the 'upgrade' endpoint definition. Will use the constructor definition (fallback)."),this.abi.constructorDefinition}}}createTransactionForClaimingDeveloperRewards(e){return new h.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:["ClaimDeveloperRewards"],gasLimit:this.config.gasLimitClaimDeveloperRewards,addDataMovementGas:!1}).build()}createTransactionForChangingOwnerAddress(e){const t=["ChangeOwnerAddress",r.Address.fromBech32(e.newOwner.bech32()).toHex()];return new h.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:t,gasLimit:this.config.gasLimitChangeOwnerAddress,addDataMovementGas:!1}).build()}argsToDataParts(e,t){if(t){const n=c.NativeSerializer.nativeToTypedValues(e,t);return(new a.ArgSerializer).valuesToStrings(n)}if(this.areArgsOfTypedValue(e))return(new a.ArgSerializer).valuesToStrings(e);throw new o.Err("Can't convert args to TypedValues")}areArgsOfTypedValue(e){return e.every((e=>u.isTyped(e)))}}},11158:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenManagementTransactionsFactory=void 0;const i=n(36946),o=n(63025),s=n(25145),a=n(1853),c=n(47480),u=n(87926);t.TokenManagementTransactionsFactory=class{constructor(e){this.config=e.config,this.argSerializer=new c.ArgSerializer,this.trueAsString="true",this.falseAsString="false",this.esdtContractAddress=i.Address.fromHex(o.ESDT_CONTRACT_ADDRESS_HEX,this.config.addressHrp)}createTransactionForIssuingFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=[new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.BigUIntValue(e.initialSupply),new c.BigUIntValue(e.numDecimals),new c.StringValue("canFreeze"),new c.StringValue(this.boolToString(e.canFreeze)),new c.StringValue("canWipe"),new c.StringValue(this.boolToString(e.canWipe)),new c.StringValue("canPause"),new c.StringValue(this.boolToString(e.canPause)),new c.StringValue("canChangeOwner"),new c.StringValue(this.boolToString(e.canChangeOwner)),new c.StringValue("canUpgrade"),new c.StringValue(this.boolToString(e.canUpgrade)),new c.StringValue("canAddSpecialRoles"),new c.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issue",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=[new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue("canFreeze"),new c.StringValue(this.boolToString(e.canFreeze)),new c.StringValue("canWipe"),new c.StringValue(this.boolToString(e.canWipe)),new c.StringValue("canPause"),new c.StringValue(this.boolToString(e.canPause)),new c.StringValue("canTransferNFTCreateRole"),new c.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new c.StringValue("canChangeOwner"),new c.StringValue(this.boolToString(e.canChangeOwner)),new c.StringValue("canUpgrade"),new c.StringValue(this.boolToString(e.canUpgrade)),new c.StringValue("canAddSpecialRoles"),new c.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueSemiFungible",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=[new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue("canFreeze"),new c.StringValue(this.boolToString(e.canFreeze)),new c.StringValue("canWipe"),new c.StringValue(this.boolToString(e.canWipe)),new c.StringValue("canPause"),new c.StringValue(this.boolToString(e.canPause)),new c.StringValue("canTransferNFTCreateRole"),new c.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new c.StringValue("canChangeOwner"),new c.StringValue(this.boolToString(e.canChangeOwner)),new c.StringValue("canUpgrade"),new c.StringValue(this.boolToString(e.canUpgrade)),new c.StringValue("canAddSpecialRoles"),new c.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueNonFungible",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=[new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.BigUIntValue(e.numDecimals),new c.StringValue("canFreeze"),new c.StringValue(this.boolToString(e.canFreeze)),new c.StringValue("canWipe"),new c.StringValue(this.boolToString(e.canWipe)),new c.StringValue("canPause"),new c.StringValue(this.boolToString(e.canPause)),new c.StringValue("canTransferNFTCreateRole"),new c.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new c.StringValue("canChangeOwner"),new c.StringValue(this.boolToString(e.canChangeOwner)),new c.StringValue("canUpgrade"),new c.StringValue(this.boolToString(e.canUpgrade)),new c.StringValue("canAddSpecialRoles"),new c.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["registerMetaESDT",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringAndSettingRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=["registerAndSetAllRoles",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue(e.tokenType),new c.BigUIntValue(e.numDecimals)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForSettingBurnRoleGlobally(e){const t=["setBurnRoleGlobally",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForUnsettingBurnRoleGlobally(e){const t=["unsetBurnRoleGlobally",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnFungibleToken(e){const t=[new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)];e.addRoleLocalMint&&t.push(new c.StringValue("ESDTRoleLocalMint")),e.addRoleLocalBurn&&t.push(new c.StringValue("ESDTRoleLocalBurn")),e.addRoleESDTTransferRole&&t.push(new c.StringValue("ESDTTransferRole"));const n=["setSpecialRole",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnSemiFungibleToken(e){const t=[new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)];e.addRoleNFTCreate&&t.push(new c.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&t.push(new c.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTAddQuantity&&t.push(new c.StringValue("ESDTRoleNFTAddQuantity")),e.addRoleESDTTransferRole&&t.push(new c.StringValue("ESDTTransferRole")),e.addRoleESDTModifyCreator&&t.push(new c.StringValue("ESDTRoleModifyCreator"));const n=["setSpecialRole",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnMetaESDT(e){return this.createTransactionForSettingSpecialRoleOnSemiFungibleToken(e)}createTransactionForSettingSpecialRoleOnNonFungibleToken(e){const t=[new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)];e.addRoleNFTCreate&&t.push(new c.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&t.push(new c.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTUpdateAttributes&&t.push(new c.StringValue("ESDTRoleNFTUpdateAttributes")),e.addRoleNFTAddURI&&t.push(new c.StringValue("ESDTRoleNFTAddURI")),e.addRoleESDTTransferRole&&t.push(new c.StringValue("ESDTTransferRole")),e.addRoleESDTModifyCreator&&t.push(new c.StringValue("ESDTRoleModifyCreator")),e.addRoleNFTRecreate&&t.push(new c.StringValue("ESDTRoleNFTRecreate")),e.addRoleESDTSetNewURI&&t.push(new c.StringValue("ESDTRoleSetNewURI")),e.addRoleESDTModifyRoyalties&&t.push(new c.StringValue("ESDTRoleModifyRoyalties"));const n=["setSpecialRole",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForCreatingNFT(e){const t=["ESDTNFTCreate",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.initialQuantity),new c.StringValue(e.name),new c.BigUIntValue(e.royalties),new c.StringValue(e.hash),new c.BytesValue(r.from(e.attributes)),...e.uris.map((e=>new c.StringValue(e)))])],n=e.name+e.hash+e.attributes+e.uris.join(""),i=this.config.gasLimitStorePerByte+BigInt(n.length);return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtNftCreate+i,addDataMovementGas:!0}).build()}createTransactionForPausing(e){const t=["pause",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForUnpausing(e){const t=["unPause",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForFreezing(e){const t=["freeze",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForUnfreezing(e){const t=["UnFreeze",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForWiping(e){const t=["wipe",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitWiping,addDataMovementGas:!0}).build()}createTransactionForLocalMint(e){const t=["ESDTLocalMint",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.supplyToMint)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtLocalMint,addDataMovementGas:!0}).build()}createTransactionForLocalBurning(e){const t=["ESDTLocalBurn",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.supplyToBurn)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtLocalBurn,addDataMovementGas:!0}).build()}createTransactionForUpdatingAttributes(e){const t=["ESDTNFTUpdateAttributes",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),new c.BytesValue(r.from(e.attributes))])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtNftUpdateAttributes,addDataMovementGas:!0}).build()}createTransactionForAddingQuantity(e){const t=["ESDTNFTAddQuantity",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),new c.BigUIntValue(e.quantityToAdd)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtNftAddQuantity,addDataMovementGas:!0}).build()}createTransactionForBurningQuantity(e){const t=["ESDTNFTBurn",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),new c.BigUIntValue(e.quantityToBurn)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtNftBurn,addDataMovementGas:!0}).build()}createTransactionForModifyingRoyalties(e){const t=["ESDTModifyRoyalties",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),new c.BigUIntValue(e.newRoyalties)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtModifyRoyalties,addDataMovementGas:!0}).build()}createTransactionForSettingNewUris(e){if(!e.newUris.length)throw new s.ErrBadUsage("No URIs provided");const t=["ESDTSetNewURIs",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),...e.newUris.map((e=>new c.StringValue(e)))])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitSetNewUris,addDataMovementGas:!0}).build()}createTransactionForModifyingCreator(e){const t=["ESDTModifyCreator",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtModifyCreator,addDataMovementGas:!0}).build()}createTransactionForUpdatingMetadata(e){const t=["ESDTMetaDataUpdate",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),...e.newTokenName?[new c.StringValue(e.newTokenName)]:[],...e.newRoyalties?[new c.BigUIntValue(e.newRoyalties)]:[],...e.newHash?[new c.StringValue(e.newHash)]:[],...e.newAttributes?[new c.BytesValue(r.from(e.newAttributes))]:[],...e.newUris?e.newUris.map((e=>new c.StringValue(e))):[]])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtMetadataUpdate,addDataMovementGas:!0}).build()}createTransactionForMetadataRecreate(e){const t=["ESDTMetaDataRecreate",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),...e.newTokenName?[new c.StringValue(e.newTokenName)]:[],...e.newRoyalties?[new c.BigUIntValue(e.newRoyalties)]:[],...e.newHash?[new c.StringValue(e.newHash)]:[],...e.newAttributes?[new c.BytesValue(r.from(e.newAttributes))]:[],...e.newUris?e.newUris.map((e=>new c.StringValue(e))):[]])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitNftMetadataRecreate,addDataMovementGas:!0}).build()}createTransactionForChangingTokenToDynamic(e){const t=["changeToDynamic",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitNftChangeToDynamic,addDataMovementGas:!0}).build()}createTransactionForUpdatingTokenId(e){const t=["updateTokenID",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitUpdateTokenId,addDataMovementGas:!0}).build()}createTransactionForRegisteringDynamicToken(e){const t=["registerDynamic",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue(e.tokenType)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitRegisterDynamic,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringDynamicAndSettingRoles(e){const t=["registerAndSetAllRolesDynamic",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue(e.tokenType)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitRegisterDynamic,addDataMovementGas:!0,amount:this.config.issueCost}).build()}notifyAboutUnsettingBurnRoleGlobally(){a.Logger.info('\n==========\nIMPORTANT!\n==========\nYou are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally).\nOnce the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).')}boolToString(e){return e?this.trueAsString:this.falseAsString}}},95312:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenTransfersDataBuilder=void 0;const r=n(14558),i=n(6058),o=n(43927);t.TokenTransfersDataBuilder=class{constructor(){this.tokenComputer=new o.TokenComputer,this.argsSerializer=new r.ArgSerializer}buildDataPartsForESDTTransfer(e){return["ESDTTransfer",...this.argsSerializer.valuesToStrings([new i.TokenIdentifierValue(e.token.identifier),new i.BigUIntValue(e.amount)])]}buildDataPartsForSingleESDTNFTTransfer(e,t){const n=e.token,r=this.tokenComputer.extractIdentifierFromExtendedIdentifier(n.identifier);return["ESDTNFTTransfer",...this.argsSerializer.valuesToStrings([new i.TokenIdentifierValue(r),new i.BigUIntValue(n.nonce),new i.BigUIntValue(e.amount),new i.AddressValue(t)])]}buildDataPartsForMultiESDTNFTTransfer(e,t){const n=[new i.AddressValue(e),new i.U32Value(t.length)];for(const r of t){const e=this.tokenComputer.extractIdentifierFromExtendedIdentifier(r.token.identifier);n.push(new i.TokenIdentifierValue(e),new i.BigUIntValue(r.token.nonce),new i.BigUIntValue(r.amount))}return["MultiESDTNFTTransfer",...this.argsSerializer.valuesToStrings(n)]}}},87926:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionBuilder=void 0;const r=n(63025),i=n(66679),o=n(94712);t.TransactionBuilder=class{constructor(e){this.config=e.config,this.sender=e.sender,this.receiver=e.receiver,this.dataParts=e.dataParts,this.providedGasLimit=e.gasLimit,this.addDataMovementGas=e.addDataMovementGas,this.amount=e.amount}computeGasLimit(e){if(!this.addDataMovementGas)return this.providedGasLimit;return this.config.minGasLimit+this.config.gasLimitPerByte*BigInt(e.length())+this.providedGasLimit}buildTransactionPayload(){const e=this.dataParts.join(r.ARGUMENTS_SEPARATOR);return new o.TransactionPayload(e)}build(){const e=this.buildTransactionPayload(),t=this.computeGasLimit(e);return new i.Transaction({sender:this.sender.bech32(),receiver:this.receiver.bech32(),gasLimit:t,value:this.amount||0n,data:e.valueOf(),chainID:this.config.chainID})}}},70556:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionsFactoryConfig=void 0;const r=n(71289);t.TransactionsFactoryConfig=class{constructor(e){this.chainID=e.chainID,this.addressHrp=r.LibraryConfig.DefaultAddressHrp,this.minGasLimit=50000n,this.gasLimitPerByte=1500n,this.gasLimitIssue=60000000n,this.gasLimitToggleBurnRoleGlobally=60000000n,this.gasLimitEsdtLocalMint=300000n,this.gasLimitEsdtLocalBurn=300000n,this.gasLimitSetSpecialRole=60000000n,this.gasLimitPausing=60000000n,this.gasLimitFreezing=60000000n,this.gasLimitWiping=60000000n,this.gasLimitEsdtNftCreate=3000000n,this.gasLimitEsdtNftUpdateAttributes=1000000n,this.gasLimitEsdtNftAddQuantity=1000000n,this.gasLimitEsdtNftBurn=1000000n,this.gasLimitStorePerByte=10000n,this.issueCost=50000000000000000n,this.gasLimitEsdtModifyRoyalties=60000000n,this.gasLimitEsdtModifyCreator=60000000n,this.gasLimitEsdtMetadataUpdate=60000000n,this.gasLimitSetNewUris=60000000n,this.gasLimitNftMetadataRecreate=60000000n,this.gasLimitNftChangeToDynamic=60000000n,this.gasLimitUpdateTokenId=60000000n,this.gasLimitRegisterDynamic=60000000n,this.gasLimitStake=5000000n,this.gasLimitUnstake=5000000n,this.gasLimitUnbond=5000000n,this.gasLimitCreateDelegationContract=50000000n,this.gasLimitDelegationOperations=1000000n,this.additionalGasLimitPerValidatorNode=6000000n,this.additionalGasLimitForDelegationOperations=10000000n,this.gasLimitSaveKeyValue=100000n,this.gasLimitPersistPerByte=1000n,this.gasLimitSetGuardian=250000n,this.gasLimitGuardAccount=250000n,this.gasLimitUnguardAccount=250000n,this.gasLimitESDTTransfer=200000n,this.gasLimitESDTNFTTransfer=200000n,this.gasLimitMultiESDTNFTTransfer=200000n,this.gasLimitClaimDeveloperRewards=6000000n,this.gasLimitChangeOwnerAddress=6000000n}}},159:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransferTransactionsFactory=void 0;const r=n(25145),i=n(47480),o=n(43927),s=n(66679),a=n(94712),c=n(95312),u=n(87926),l=8e5;t.TransferTransactionsFactory=class{constructor(e){this.isGasEstimator(e)?this.gasEstimator=e:(this.config=e.config,this.tokenComputer=new o.TokenComputer,this.tokenTransfersDataBuilder=new c.TokenTransfersDataBuilder)}isGasEstimator(e){return"object"===typeof e&&"function"===typeof e.forEGLDTransfer&&"function"===typeof e.forESDTTransfer&&"function"===typeof e.forESDTNFTTransfer&&"function"===typeof e.forMultiESDTNFTTransfer}isGasEstimatorDefined(){return void 0!==this.gasEstimator}ensureConfigIsDefined(){if(void 0===this.config)throw new r.Err("'config' is not defined")}createTransactionForNativeTokenTransfer(e){this.ensureConfigIsDefined();const t=e.data||new Uint8Array;return new s.Transaction({sender:e.sender.bech32(),receiver:e.receiver.bech32(),chainID:this.config.chainID,gasLimit:this.computeGasForMoveBalance(this.config,t),data:t,value:e.nativeAmount})}createTransactionForESDTTokenTransfer(e){this.ensureConfigIsDefined();const t=e.tokenTransfers.length;if(0===t)throw new r.ErrBadUsage("No token transfer has been provided");if(1===t)return this.createSingleESDTTransferTransaction(e);const n=this.tokenTransfersDataBuilder.buildDataPartsForMultiESDTNFTTransfer(e.receiver,e.tokenTransfers),i=this.config.gasLimitMultiESDTNFTTransfer*BigInt(t)+BigInt(l);return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:n,gasLimit:i,addDataMovementGas:!0}).build()}createTransactionForTransfer(e){const t=e.nativeAmount??0n;let n=e.tokenTransfers?[...e.tokenTransfers]:[];const i=n.length;if(i&&e.data?.length)throw new r.ErrBadUsage("Can't set data field when sending esdt tokens");if(t&&0===i||e.data)return this.createTransactionForNativeTokenTransfer({sender:e.sender,receiver:e.receiver,nativeAmount:t,data:e.data});const s=t?o.TokenTransfer.newFromEgldAmount(t):void 0;return s&&n.push(s),this.createTransactionForESDTTokenTransfer({sender:e.sender,receiver:e.receiver,tokenTransfers:n})}createEGLDTransfer(e){if(!this.isGasEstimatorDefined())throw new r.Err("You are calling a legacy function to create an EGLD transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForNativeTokenTransfer` method.");const t=e.data?.length()||0,n=this.gasEstimator.forEGLDTransfer(t);return new s.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||n,data:e.data,chainID:e.chainID})}createESDTTransfer(e){if(!this.isGasEstimatorDefined())throw new r.Err("You are calling a legacy function to create an ESDT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");const{argumentsString:t}=(new i.ArgSerializer).valuesToString([i.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new i.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${t}`,o=new a.TransactionPayload(n),c=o.length()||0,u=this.gasEstimator.forESDTTransfer(c);return new s.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||u,data:o,chainID:e.chainID})}createESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new r.Err("You are calling a legacy function to create an ESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");const{argumentsString:t}=(new i.ArgSerializer).valuesToString([i.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new i.U64Value(e.tokenTransfer.nonce),new i.BigUIntValue(e.tokenTransfer.valueOf()),new i.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${t}`,o=new a.TransactionPayload(n),c=o.length()||0,u=this.gasEstimator.forESDTNFTTransfer(c);return new s.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||u,data:o,chainID:e.chainID})}createMultiESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new r.Err("You are calling a legacy function to create a MultiESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");const t=[new i.AddressValue(e.destination),new i.U16Value(e.tokenTransfers.length)];for(const r of e.tokenTransfers)t.push(i.BytesValue.fromUTF8(r.tokenIdentifier),new i.U64Value(r.nonce),new i.BigUIntValue(r.valueOf()));const{argumentsString:n}=(new i.ArgSerializer).valuesToString(t),o=`MultiESDTNFTTransfer@${n}`,c=new a.TransactionPayload(o),u=c.length()||0,l=this.gasEstimator.forMultiESDTNFTTransfer(u,e.tokenTransfers.length);return new s.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||l,data:c,chainID:e.chainID})}createSingleESDTTransferTransaction(e){this.ensureConfigIsDefined();let t=[];const n=e.tokenTransfers[0];let r=0n,i=e.receiver;return this.tokenComputer.isFungible(n.token)?(t=this.tokenTransfersDataBuilder.buildDataPartsForESDTTransfer(n),r=this.config.gasLimitESDTTransfer+BigInt(1e5)):(t=this.tokenTransfersDataBuilder.buildDataPartsForSingleESDTNFTTransfer(n,i),r=this.config.gasLimitESDTNFTTransfer+BigInt(l),i=e.sender),new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:i,dataParts:t,gasLimit:r,addDataMovementGas:!0}).build()}computeGasForMoveBalance(e,t){return e.minGasLimit+e.gasLimitPerByte*BigInt(t.length)}}},38917:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationTransactionsOutcomeParser=void 0;const i=n(36946),o=n(10545),s=n(25145),a=n(73416);t.DelegationTransactionsOutcomeParser=class{constructor(){}parseCreateNewDelegationContract(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return a.findEventsByIdentifier(e,"SCDeploy").map((e=>({contractAddress:this.extractContractAddress(e)})))}ensureTransactionOutcome(e){return"hash"in e?(new o.TransactionsConverter).transactionOnNetworkToOutcome(e):e}ensureNoError(e){for(const t of e)if("signalError"==t.identifier){const e=r.from(t.dataItems[0]?.toString().slice(1)).toString()||"",n=this.decodeTopicAsString(t.topics[1]);throw new s.ErrParseTransactionOutcome(`encountered signalError: ${n} (${r.from(e,"hex").toString()})`)}}extractContractAddress(e){if(!e.topics[0]?.length)return"";const t=r.from(e.topics[0]);return i.Address.fromBuffer(t).bech32()}decodeTopicAsString(e){return r.from(e).toString()}}},15360:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(38917),t),i(n(73416),t),i(n(92067),t),i(n(20517),t),i(n(64886),t)},73416:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gatherAllEvents=t.findEventsByFirstTopic=t.findEventsByIdentifier=t.findEventsByPredicate=t.SmartContractCallOutcome=t.TransactionOutcome=t.SmartContractResult=t.TransactionLogs=t.TransactionEvent=void 0;t.TransactionEvent=class{constructor(e){this.address="",this.identifier="",this.topics=[],this.dataItems=[],Object.assign(this,e)}};class n{constructor(e){this.address="",this.events=[],Object.assign(this,e)}}t.TransactionLogs=n;t.SmartContractResult=class{constructor(e){this.sender="",this.receiver="",this.data=new Uint8Array,this.logs=new n({}),Object.assign(this,e)}};t.TransactionOutcome=class{constructor(e){this.directSmartContractCallOutcome=new r({}),this.smartContractResults=[],this.logs=new n({}),Object.assign(this,e)}};class r{constructor(e){this.function="",this.returnDataParts=[],this.returnMessage="",this.returnCode="",Object.assign(this,e)}}function i(e,t){return o(e).filter(t)}function o(e){const t=[];t.push(...e.logs.events);for(const n of e.smartContractResults)t.push(...n.logs.events);return t}t.SmartContractCallOutcome=r,t.findEventsByPredicate=i,t.findEventsByIdentifier=function(e,t){return i(e,(e=>e.identifier==t))},t.findEventsByFirstTopic=function(e,t){return i(e,(e=>e.topics[0]?.toString()==t))},t.gatherAllEvents=o},92067:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.SmartContractTransactionsOutcomeParser=void 0;const i=n(36946),o=n(63025),s=n(25145),a=n(47480),c=n(73416);var u;!function(e){e.SCDeploy="SCDeploy",e.SignalError="signalError",e.WriteLog="writeLog"}(u||(u={}));t.SmartContractTransactionsOutcomeParser=class{constructor(e){this.abi=e?.abi,this.legacyResultsParser=e?.legacyResultsParser||new a.ResultsParser}parseDeploy(e){return"transactionOutcome"in e?this.parseDeployGivenTransactionOutcome(e.transactionOutcome):this.parseDeployGivenTransactionOnNetwork(e.transactionOnNetwork)}parseDeployGivenTransactionOutcome(e){const t=e.directSmartContractCallOutcome,n=c.findEventsByIdentifier(e,u.SCDeploy).map((e=>this.parseScDeployEvent(e)));return{returnCode:t.returnCode,returnMessage:t.returnMessage,contracts:n}}parseDeployGivenTransactionOnNetwork(e){const t=this.findDirectSmartContractCallOutcome(e),n=e.logs.events.concat(e.contractResults.items.flatMap((e=>e.logs.events))).filter((e=>e.identifier===u.SCDeploy)).map((e=>this.parseScDeployEvent({topics:e.topics.map((e=>r.from(e.hex(),"hex")))})));return{returnCode:t.returnCode,returnMessage:t.returnMessage,contracts:n}}parseScDeployEvent(e){const t=e.topics[0],n=e.topics[1],r=e.topics[2];return{address:t?.length?new i.Address(t).toBech32():"",ownerAddress:n?.length?new i.Address(n).toBech32():"",codeHash:r}}parseExecute(e){return"transactionOutcome"in e?this.parseExecuteGivenTransactionOutcome(e.transactionOutcome,e.function):this.parseExecuteGivenTransactionOnNetwork(e.transactionOnNetwork,e.function)}parseExecuteGivenTransactionOutcome(e,t){const n=e.directSmartContractCallOutcome;if(!this.abi)return{values:n.returnDataParts,returnCode:n.returnCode,returnMessage:n.returnMessage};if(!(t=t||n.function))throw new s.Err('Function name is not available in the transaction outcome, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');const i=this.abi.getEndpoint(t),o={returnCode:new a.ReturnCode(n.returnCode),returnMessage:n.returnMessage,values:n.returnDataParts.map((e=>r.from(e)))},c=this.legacyResultsParser.parseOutcomeFromUntypedBundle(o,i);return{values:c.values.map((e=>e.valueOf())),returnCode:c.returnCode.toString(),returnMessage:c.returnMessage}}parseExecuteGivenTransactionOnNetwork(e,t){const n=this.findDirectSmartContractCallOutcome(e);if(!this.abi)return{values:n.returnDataParts,returnCode:n.returnCode,returnMessage:n.returnMessage};if(!(t=t||n.function))throw new s.Err('Function name is not available in the transaction, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');const i=new a.ArgSerializer,o=this.abi.getEndpoint(t),c=n.returnDataParts.map((e=>r.from(e))),u=i.buffersToValues(c,o.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:u}}findDirectSmartContractCallOutcome(e){let t=this.findDirectSmartContractCallOutcomeWithinSmartContractResults(e);return t||(t=this.findDirectSmartContractCallOutcomeIfError(e),t||(t=this.findDirectSmartContractCallOutcomeWithinWriteLogEvents(e),t||new c.SmartContractCallOutcome({function:e.function,returnCode:"",returnMessage:"",returnDataParts:[]})))}findDirectSmartContractCallOutcomeWithinSmartContractResults(e){const t=new a.ArgSerializer,n=[];for(const a of e.contractResults.items){const t=a.data.startsWith(o.ARGUMENTS_SEPARATOR),r=a.receiver.bech32()===e.sender.bech32(),i=a.previousHash===e.hash;t&&r&&i&&n.push(a)}if(0===n.length)return null;if(n.length>1)throw new Error(`More than one smart contract result (holding the return data) found for transaction: ${e.hash}`);const[r]=n,[i,s,...u]=t.stringToBuffers(r.data);return new c.SmartContractCallOutcome({function:e.function,returnCode:s?.toString(),returnMessage:r.returnMessage||s?.toString(),returnDataParts:u})}findDirectSmartContractCallOutcomeIfError(e){const t=new a.ArgSerializer,n=u.SignalError,r=[];r.push(...e.logs.events.filter((e=>e.identifier===n)));for(const a of e.contractResults.items)a.previousHash==e.hash&&r.push(...a.logs.events.filter((e=>e.identifier===n)));if(0===r.length)return null;if(r.length>1)throw new Error(`More than one "${n}" event found for transaction: ${e.hash}`);const[i]=r,o=i.dataPayload?.valueOf().toString()||"",s=i.getLastTopic()?.toString(),l=t.stringToBuffers(o),d=l[l.length-1];return new c.SmartContractCallOutcome({function:e.function,returnCode:d?.toString()||n,returnMessage:s||d?.toString()||n,returnDataParts:[]})}findDirectSmartContractCallOutcomeWithinWriteLogEvents(e){const t=new a.ArgSerializer,n=u.WriteLog,r=[];r.push(...e.logs.events.filter((e=>e.identifier===n)));for(const a of e.contractResults.items)a.previousHash==e.hash&&r.push(...a.logs.events.filter((e=>e.identifier===n)));if(0===r.length)return null;if(r.length>1)throw new Error(`More than one "${n}" event found for transaction: ${e.hash}`);const[i]=r,o=i.dataPayload?.valueOf().toString()||"",[s,l,...d]=t.stringToBuffers(o);return new c.SmartContractCallOutcome({function:e.function,returnCode:l?.toString(),returnMessage:l?.toString(),returnDataParts:d})}}},20517:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenManagementTransactionsOutcomeParser=void 0;const i=n(36946),o=n(10545),s=n(25145),a=n(68683),c=n(73416);t.TokenManagementTransactionsOutcomeParser=class{constructor(){}parseIssueFungible(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"issue").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseIssueNonFungible(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"issueNonFungible").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseIssueSemiFungible(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"issueSemiFungible").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseRegisterMetaEsdt(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"registerMetaESDT").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseRegisterAndSetAllRoles(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);const t=c.findEventsByIdentifier(e,"registerAndSetAllRoles"),n=c.findEventsByIdentifier(e,"ESDTSetRole");if(t.length!==n.length)throw new s.ErrParseTransactionOutcome("Register Events and Set Role events mismatch. Should have the same number of events.");return t.map(((e,t)=>({tokenIdentifier:this.extractTokenIdentifier(e),roles:n[t].topics.slice(3).map((e=>this.decodeTopicAsString(e)))})))}parseSetBurnRoleGlobally(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events)}parseUnsetBurnRoleGlobally(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events)}parseSetSpecialRole(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTSetRole").map((e=>this.getOutputForSetSpecialRoleEvent(e)))}getOutputForSetSpecialRoleEvent(e){return{userAddress:e.address,tokenIdentifier:this.extractTokenIdentifier(e),roles:e.topics.slice(3).map((e=>this.decodeTopicAsString(e)))}}parseNftCreate(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTNFTCreate").map((e=>this.getOutputForNftCreateEvent(e)))}getOutputForNftCreateEvent(e){return{tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),initialQuantity:this.extractAmount(e)}}parseLocalMint(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTLocalMint").map((e=>this.getOutputForLocalMintEvent(e)))}getOutputForLocalMintEvent(e){return{userAddress:e.address,tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),mintedSupply:this.extractAmount(e)}}parseLocalBurn(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTLocalBurn").map((e=>this.getOutputForLocalBurnEvent(e)))}getOutputForLocalBurnEvent(e){return{userAddress:e.address,tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),burntSupply:this.extractAmount(e)}}parsePause(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTPause").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseUnpause(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTUnPause").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseFreeze(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTFreeze").map((e=>this.getOutputForFreezeEvent(e)))}getOutputForFreezeEvent(e){return{userAddress:this.extractAddress(e),tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),balance:this.extractAmount(e)}}parseUnfreeze(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTUnFreeze").map((e=>this.getOutputForUnfreezeEvent(e)))}getOutputForUnfreezeEvent(e){return{userAddress:this.extractAddress(e),tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),balance:this.extractAmount(e)}}parseWipe(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTWipe").map((e=>this.getOutputForWipeEvent(e)))}getOutputForWipeEvent(e){return{userAddress:this.extractAddress(e),tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),balance:this.extractAmount(e)}}parseUpdateAttributes(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTNFTUpdateAttributes").map((e=>this.getOutputForUpdateAttributesEvent(e)))}getOutputForUpdateAttributesEvent(e){return{tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),attributes:e.topics[3]?e.topics[3]:new Uint8Array}}parseAddQuantity(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTNFTAddQuantity").map((e=>this.getOutputForAddQuantityEvent(e)))}getOutputForAddQuantityEvent(e){return{tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),addedQuantity:this.extractAmount(e)}}parseBurnQuantity(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTNFTBurn").map((e=>this.getOutputForBurnQuantityEvent(e)))}getOutputForBurnQuantityEvent(e){return{tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),burntQuantity:this.extractAmount(e)}}ensureTransactionOutcome(e){return"hash"in e?(new o.TransactionsConverter).transactionOnNetworkToOutcome(e):e}ensureNoError(e){for(const t of e)if("signalError"==t.identifier){const e=r.from(t.dataItems[0]?.toString().slice(1)).toString()||"",n=this.decodeTopicAsString(t.topics[1]);throw new s.ErrParseTransactionOutcome(`encountered signalError: ${n} (${r.from(e,"hex").toString()})`)}}extractTokenIdentifier(e){return e.topics[0]?.length?this.decodeTopicAsString(e.topics[0]):""}extractNonce(e){if(!e.topics[1]?.length)return BigInt(0);const t=r.from(e.topics[1]);return BigInt(a.bufferToBigInt(t).toFixed(0))}extractAmount(e){if(!e.topics[2]?.length)return BigInt(0);const t=r.from(e.topics[2]);return BigInt(a.bufferToBigInt(t).toFixed(0))}extractAddress(e){if(!e.topics[3]?.length)return"";const t=r.from(e.topics[3]);return i.Address.fromBuffer(t).bech32()}decodeTopicAsString(e){return r.from(e).toString()}}},64886:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionEventsParser=void 0;const i=n(47480);t.TransactionEventsParser=class{constructor(e){this.legacyResultsParser=new i.ResultsParser,this.abi=e.abi,this.firstTopicIsIdentifier=e.firstTopicIsIdentifier??!0}parseEvents(e){const t=[];for(const n of e.events){const e=this.parseEvent({event:n});t.push(e)}return t}parseEvent(e){const t=e.event.topics.map((e=>r.from(e))),n=this.firstTopicIsIdentifier?t[0]?.toString():e.event.identifier;this.firstTopicIsIdentifier&&t.shift();const i=e.event.dataItems.map((e=>r.from(e))),o=this.abi.getEvent(n);return this.legacyResultsParser.doParseEvent({topics:t,dataItems:i,eventDefinition:o})}}},89439:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.addressToHex=t.bigIntToHex=t.byteArrayToHex=t.boolToHex=t.utf8ToHex=t.zeroPadStringIfOddLength=t.isPaddedHex=t.numberToPaddedHex=void 0;const c=a(n(44431)),u=n(36946),l=s(n(68683));function d(e){return(e=e||"").length%2==1?"0"+e:e}function f(e){return d(r.from(e).toString("hex"))}t.numberToPaddedHex=function(e){let t;return t="bigint"===typeof e||"number"===typeof e?e:new c.default(e),d(t.toString(16))},t.isPaddedHex=function(e){e=e||"";let t=r.from(e,"hex").toString("hex");return e.toUpperCase()==t.toUpperCase()},t.zeroPadStringIfOddLength=d,t.utf8ToHex=f,t.boolToHex=function(e){return f(e.toString())},t.byteArrayToHex=function(e){return d(r.from(e).toString("hex"))},t.bigIntToHex=function(e){return 0==e?"":l.getHexMagnitudeOfBigInt(e)},t.addressToHex=function(e){return u.Address.fromBech32(e.toString()).pubkey().toString("hex")}},44425:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=t.guardEmpty=t.guardNotEmpty=t.guardLength=t.guardSameLength=t.guardValueIsSetWithMessage=t.guardValueIsSet=t.guardTrue=void 0;const s=o(n(25145));function a(e,t){if(null==t||void 0===t)throw new s.ErrInvariantFailed(e)}function c(e){return e.isEmpty?e.isEmpty():0===e.length}t.guardTrue=function(e,t){if(!e)throw new s.ErrInvariantFailed(`[<${t}>] isn't true`)},t.guardValueIsSet=function(e,t){a(`${e} isn't set (null or undefined)`,t)},t.guardValueIsSetWithMessage=a,t.guardSameLength=function(e,t){if(t=t||[],(e=e||[]).length!=t.length)throw new s.ErrInvariantFailed("arrays do not have the same length")},t.guardLength=function(e,t){let n=e.length||0;if(n!=t)throw new s.ErrInvariantFailed(`wrong length, expected: ${t}, actual: ${n}`)},t.guardNotEmpty=function(e,t){if(c(e))throw new s.ErrInvariantFailed(`${t} is empty`)},t.guardEmpty=function(e,t){if(!c(e))throw new s.ErrInvariantFailed(`${t} is not empty`)},t.isEmpty=c},78654:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrAccountNotConnected=t.ErrCannotSignSingleTransaction=t.Err=void 0;class n extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}}t.Err=n;t.ErrCannotSignSingleTransaction=class extends n{constructor(){super("Cannot sign single transaction.")}};t.ErrAccountNotConnected=class extends n{constructor(){super("Account is not connected.")}}},80299:function(e,t,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionProvider=void 0;const o=n(3053),s=n(66679),a=n(78654),c=n(54803);class u{constructor(){if(this.account={address:""},this.initialized=!1,u._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");u._instance=this}static getInstance(){return u._instance}setAddress(e){return this.account.address=e,u._instance}init(){return i(this,void 0,void 0,(function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized}))}login(){return i(this,arguments,void 0,(function*(e={}){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");const{token:t}=e,n=t||"";return yield this.startBgrMsgChannel(c.Operation.Connect,n),this.account}))}logout(){return i(this,void 0,void 0,(function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(c.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0}))}disconnect(){this.account={address:""}}getAddress(){return i(this,void 0,void 0,(function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""}))}isInitialized(){return this.initialized}isConnected(){return Boolean(this.account.address)}getAccount(){return this.account}setAccount(e){this.account=e}signTransaction(e){return i(this,void 0,void 0,(function*(){this.ensureConnected();const t=yield this.signTransactions([e]);if(1!=t.length)throw new a.ErrCannotSignSingleTransaction;return t[0]}))}ensureConnected(){if(!this.account.address)throw new a.ErrAccountNotConnected}signTransactions(e){return i(this,void 0,void 0,(function*(){this.ensureConnected();const t=yield this.startBgrMsgChannel(c.Operation.SignTransactions,{from:this.account.address,transactions:e.map((e=>e.toPlainObject()))});try{return t.map((e=>s.Transaction.fromPlainObject(e)))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}}))}signMessage(e){return i(this,void 0,void 0,(function*(){var t;this.ensureConnected();const n={account:this.account.address,message:r.from(e.data).toString()},i=(yield this.startBgrMsgChannel(c.Operation.SignMessage,n)).signature,s=r.from(i,"hex");return new o.Message({data:r.from(e.data),address:null!==(t=e.address)&&void 0!==t?t:o.Address.fromBech32(this.account.address),signer:"extension",version:e.version,signature:s})}))}cancelAction(){return this.startBgrMsgChannel(c.Operation.CancelAction,{})}startBgrMsgChannel(e,t){return new Promise((n=>{window.postMessage({target:"erdw-inpage",type:e,data:t},window.origin);const r=e=>{e.isTrusted&&"erdw-contentScript"===e.data.target&&("connectResponse"===e.data.type?(e.data.data&&Boolean(e.data.data.address)&&(this.account=e.data.data),window.removeEventListener("message",r),n(e.data.data)):(window.removeEventListener("message",r),n(e.data.data)))};window.addEventListener("message",r,!1)}))}}t.ExtensionProvider=u,u._instance=new u},91571:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(80299),t)},54803:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Operation=void 0,function(e){e.Connect="connect",e.Logout="logout",e.SignTransactions="signTransactions",e.SignMessage="signMessage",e.CancelAction="cancelAction"}(n||(t.Operation=n={}))},50681:function(e,t,n){"use strict";var r=n(48764).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenTransferProperties=t.TransactionMetadataTransfer=t.TransactionMetadata=t.TransactionToDecode=t.TransactionDecoder=void 0;const i=n(3084);t.TransactionDecoder=class{getTransactionMetadata(e){const t=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(t);if(n)return n;const r=this.getNftTransferMetadata(t);if(r)return r;const i=this.getMultiTransferMetadata(t);return i||t}getNormalTransactionMetadata(e){const t=new s;if(t.sender=e.sender,t.receiver=e.receiver,t.value=BigInt(e.value),e.data){const r=this.base64Decode(e.data).split("@"),i=r.slice(1);if(i.every((e=>this.isSmartContractArgument(e)))&&(t.functionName=r[0],t.functionArgs=i),"relayedTx"===t.functionName&&t.functionArgs&&1===t.functionArgs.length)try{const e=JSON.parse(this.hexToString(t.functionArgs[0]));return e.value=e.value.toString(),e.sender=this.bech32Encode(this.base64ToHex(e.sender)),e.receiver=this.bech32Encode(this.base64ToHex(e.receiver)),this.getNormalTransactionMetadata(e)}catch(n){}if("relayedTxV2"===t.functionName&&t.functionArgs&&4===t.functionArgs.length)try{const n=new o;return n.sender=e.receiver,n.receiver=this.bech32Encode(t.functionArgs[0]),n.data=this.base64Encode(this.hexToString(t.functionArgs[2])),n.value="0",this.getNormalTransactionMetadata(n)}catch(n){}}return t}getMultiTransferMetadata(e){if(e.sender!==e.receiver)return;if("MultiESDTNFTTransfer"!==e.functionName)return;const t=e.functionArgs;if(!t)return;if(t.length<3)return;if(!this.isAddressValid(t[0]))return;const n=this.bech32Encode(t[0]),r=this.hexToNumber(t[1]),i=new s;i.transfers||(i.transfers=[]);let o=2;for(let s=0;so&&(i.functionName=this.hexToString(t[o++]),i.functionArgs=t.slice(o++)),i}getNftTransferMetadata(e){if(e.sender!==e.receiver)return;if("ESDTNFTTransfer"!==e.functionName)return;const t=e.functionArgs;if(!t)return;if(t.length<4)return;if(!this.isAddressValid(t[3]))return;const n=this.hexToString(t[0]),r=t[1],i=this.hexToBigInt(t[2]),o=this.bech32Encode(t[3]),a=new s;return a.sender=e.sender,a.receiver=o,a.value=i,t.length>4&&(a.functionName=this.hexToString(t[4]),a.functionArgs=t.slice(5)),a.transfers=[{value:i,properties:{collection:n,identifier:`${n}-${r}`}}],a}base64Encode(e){return r.from(e).toString("base64")}base64Decode(e){return r.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if("ESDTTransfer"!==e.functionName)return;const t=e.functionArgs;if(!t)return;if(t.length<2)return;const n=this.hexToString(t[0]),r=this.hexToBigInt(t[1]),i=new s;return i.sender=e.sender,i.receiver=e.receiver,t.length>2&&(i.functionName=this.hexToString(t[2]),i.functionArgs=t.slice(3)),i.transfers=[{value:r,properties:{identifier:n}}],i.value=r,i}bech32Encode(e){const t=r.from(e,"hex"),n=i.bech32.toWords(t);return i.bech32.encode("erd",n)}isAddressValid(e){return 32==r.from(e,"hex").length}isSmartContractArgument(e){return!!this.isHex(e)&&e.length%2===0}isHex(e){return!1===new RegExp(/[^a-f0-9]/gi).test(e)}base64ToHex(e){return r.from(e,"base64").toString("hex")}hexToString(e){return r.from(e,"hex").toString("ascii")}hexToBigInt(e){return e?BigInt("0x"+e):BigInt(0)}};class o{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}}t.TransactionToDecode=o;class s{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}}t.TransactionMetadata=s;t.TransactionMetadataTransfer=class{constructor(){this.value=BigInt(0)}};t.TokenTransferProperties=class{}},3084:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={};for(let d=0;d>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function o(e){let t=1;for(let n=0;n126)return"Invalid prefix ("+e+")";t=i(t)^r>>5}t=i(t);for(let n=0;n=n;)o-=n,a.push(i>>o&s);if(r)o>0&&a.push(i<=t)return"Excess padding";if(i<n)return"Exceeds length limit";const s=e.toLowerCase(),a=e.toUpperCase();if(e!==s&&e!==a)return"Mixed-case string "+e;const c=(e=s).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const u=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let d=o(u);if("string"===typeof d)return d;const f=[];for(let t=0;t=l.length||f.push(n)}return d!==t?"Invalid checksum for "+e:{prefix:u,words:f}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const n=s(e,t);if("object"===typeof n)return n},decode:function(e,t){const n=s(e,t);if("object"===typeof n)return n;throw new Error(n)},encode:function(e,r,s){if(s=s||90,e.length+7+r.length>s)throw new TypeError("Exceeds length limit");let a=o(e=e.toLowerCase());if("string"===typeof a)throw new Error(a);let c=e+"1";for(let t=0;t>5!==0)throw new Error("Non 5-bit word");a=i(a)^e,c+=n.charAt(e)}for(let t=0;t<6;++t)a=i(a);a^=t;for(let t=0;t<6;++t){c+=n.charAt(a>>5*(5-t)&31)}return c},toWords:a,fromWordsUnsafe:c,fromWords:u}}t.bech32=l("bech32"),t.bech32m=l("bech32m")},58368:function(e,t){var n="undefined"!==typeof self?self:this,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function x(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];S.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(_){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:x(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new S(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=v,e.Response=S),t.Headers=f,t.Request=v,t.Response=S,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},5586:function(e,t,n){"use strict";const r=n(79742),i=n(80645),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},47275:function(e,t){var n="undefined"!==typeof self?self:this,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function x(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];S.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(_){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:x(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new S(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=v,e.Response=S),t.Headers=f,t.Request=v,t.Response=S,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},16450:function(e,t,n){"use strict";var r=n(64836);Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"jsonrpcFromDefs",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"typesAliasFromDefs",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"typesFromDefs",{enumerable:!0,get:function(){return s.default}});var i=r(n(98544)),o=r(n(49651)),s=r(n(64540))},98544:function(e,t,n){"use strict";var r=n(64836);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){return Object.keys(e).filter((t=>{var n;return 0!==Object.keys((null===(n=e[t])||void 0===n?void 0:n.rpc)||{}).length})).forEach((n=>{t[n]={},Object.entries(e[n].rpc).forEach((([e,r])=>{const i=!!r.pubsub;t[n][e]=s(s({},r),{},{isSubscription:i,jsonrpc:`${n}_${e}`,method:e,section:n})}))})),t};var i=r(n(38416));function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t(0,i.default)({},t,e)),t)};var i=r(n(72378))},64540:function(e,t,n){"use strict";var r=n(64836);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){return Object.values(e).reduce(((e,{types:t})=>s(s({},e),t)),t)};var i=r(n(38416));function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t\n ${r.isMobile()?"":"
\n \n\n
\n Pera Connect\n\n v1.3.4\n
\n
\n "} \n\n \n \n \n \n`;class p extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=d,this.shadowRoot.append(f.content.cloneNode(!0),e),this.onClose()}}onClose(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-modal-header-close-button"),n=this.getAttribute("modal-id");t&&n===r.PERA_WALLET_REDIRECT_MODAL_ID&&t.addEventListener("click",(()=>{r.removeModalWrapperFromDOM(r.PERA_WALLET_REDIRECT_MODAL_ID)}))}}var g="data:image/svg+xml,%3csvg fill='none' height='80' width='80' xmlns='http://www.w3.org/2000/svg'%3e%3cpath clip-rule='evenodd' d='M39.9 80V68.99h-9.8V80h-.2V68.99h-3.5a6.503 6.503 0 0 1-6.247-4.7 6.514 6.514 0 0 1-4.445-4.444 6.503 6.503 0 0 1-4.695-6.246v-3.5H0v-.2h11.013v-9.8H0v-.2h11.013v-9.8H0v-.2h11.013v-3.5a6.503 6.503 0 0 1 4.694-6.246 6.513 6.513 0 0 1 4.447-4.447 6.503 6.503 0 0 1 6.246-4.696h3.5V0h.2v11.011h9.8V0h.2v11.011h9.8V0h.2v11.011h3.5a6.503 6.503 0 0 1 6.247 4.697 6.514 6.514 0 0 1 4.443 4.444 6.503 6.503 0 0 1 4.701 6.248v3.5H80v.2H68.991v9.8H80v.2H68.991v9.8H80v.2H68.991v3.5a6.503 6.503 0 0 1-4.701 6.248 6.514 6.514 0 0 1-4.443 4.442 6.503 6.503 0 0 1-6.247 4.7h-3.5V80h-.2V68.99h-9.8V80zm28.89-40.1a28.728 28.728 0 0 0-1.746-9.8h-2.5v9.8h4.247zm-4.246.2h4.247a28.729 28.729 0 0 1-1.747 9.8h-2.5zm-.2-.2v-9.8H60.1v9.8zm-4.244.2h4.244v9.8H60.1zm-.2-.2a19.807 19.807 0 0 0-2.633-9.8H50.1v9.8zm-9.8.2h9.8a19.807 19.807 0 0 1-2.633 9.8H50.1zm-.2-.2v-9.8h-9.8v9.8zm-9.8.2h9.8v9.8h-9.8zm-.2-.2v-9.8h-9.8v9.8zm-9.8.2h9.8v9.8h-9.8zm-.2-.2v-9.8h-7.167a19.807 19.807 0 0 0-2.633 9.8zm-9.8.2h9.8v9.8h-7.167a19.807 19.807 0 0 1-2.633-9.8zm-.2-.2v-9.8h-4.245v9.8zm-4.245.2H19.9v9.8h-4.245zm-.2-.2v-9.8H12.96a28.726 28.726 0 0 0-1.748 9.8h4.242zm-4.242.2h4.242v9.8H12.96a28.726 28.726 0 0 1-1.748-9.8zm0 13.5v-3.5h1.608a28.876 28.876 0 0 0 2.634 5.327v2.617c0 .543.066 1.07.192 1.575a6.303 6.303 0 0 1-4.434-6.019zm4.242 1.449a28.674 28.674 0 0 1-2.42-4.949h2.42zm.2.32V50.1H19.9v9.8h-.702a28.915 28.915 0 0 1-3.543-4.53zM20.1 59.9v-9.8h2.518a20.2 20.2 0 0 0 7.282 7.282V59.9zm0-10h2.403a19.966 19.966 0 0 1-2.403-7.053zm9.8 7.25a20 20 0 0 1-7.05-7.05h7.05zm.2.117V50.1h9.8v9.8a19.807 19.807 0 0 1-9.8-2.633zm10 2.633v-9.8h9.8v7.167a19.807 19.807 0 0 1-9.8 2.633zm10-2.75V50.1h7.05a20 20 0 0 1-7.05 7.05zm0 .232a20.2 20.2 0 0 0 7.282-7.282H59.9v9.8h-9.8zm7.397-7.482H59.9v-7.053a19.966 19.966 0 0 1-2.403 7.053zm2.603 10v-9.8h4.244v5.28a28.91 28.91 0 0 1-3.538 4.52zm4.444-4.841V50.1h2.426a28.67 28.67 0 0 1-2.426 4.959zm0 .378a28.881 28.881 0 0 0 2.64-5.337h1.607v3.5a6.303 6.303 0 0 1-4.44 6.021 6.514 6.514 0 0 0 .193-1.577zm2.713-5.537h1.534v-6.477a28.817 28.817 0 0 1-1.534 6.477zm-56.044 0h1.535a28.807 28.807 0 0 1-1.535-6.477zm57.578-20v-3.5a6.303 6.303 0 0 0-4.44-6.02c.126.504.193 1.031.193 1.575v2.608a28.877 28.877 0 0 1 2.639 5.337zm-1.534.2h1.534v6.477a28.815 28.815 0 0 0-1.534-6.477zm-.288-.2a28.673 28.673 0 0 0-2.425-4.958V29.9zm-2.625 0v-5.279a28.911 28.911 0 0 0-3.538-4.521H60.1v9.8zm-4.444 0v-9.8h-9.8v2.518a20.2 20.2 0 0 1 7.282 7.282zm-2.403.2H59.9v7.053a19.966 19.966 0 0 0-2.403-7.053zm-.347-.2a20 20 0 0 0-7.05-7.05v7.05zm-7.25 0v-7.167a19.807 19.807 0 0 0-9.8-2.633v9.8zm-10 0v-9.8a19.807 19.807 0 0 0-9.8 2.633V29.9zm-10 0v-7.05a20 20 0 0 0-7.05 7.05zm-7.282 0a20.2 20.2 0 0 1 7.282-7.282V20.1h-9.8v9.8zm-2.518.2h2.403a19.966 19.966 0 0 0-2.403 7.053zm-.2-.2v-9.8h-.701a28.915 28.915 0 0 0-3.544 4.53v5.27zm-4.445 0v-4.948a28.665 28.665 0 0 0-2.42 4.948zm-2.634 0a28.874 28.874 0 0 1 2.634-5.327v-2.618c0-.543.066-1.07.191-1.574a6.303 6.303 0 0 0-4.433 6.019v3.5zm-1.608.2h1.535a28.81 28.81 0 0 0-1.535 6.477zM36.58 68.79H30.1v-1.536c2.06.749 4.23 1.27 6.479 1.535zm3.321-.001a28.726 28.726 0 0 1-9.8-1.748v-2.497h9.8zm-10-1.822v-2.423h-4.953a28.678 28.678 0 0 0 4.953 2.423zm10-2.623h-9.8V60.1h9.8zm-10 0V60.1h-9.8v.702a28.915 28.915 0 0 0 4.526 3.542H29.9zm7.254-4.444H30.1v-2.403a19.966 19.966 0 0 0 7.053 2.403zm0-39.8a19.966 19.966 0 0 0-7.054 2.403V20.1h7.053zm2.746-.2h-9.8v-4.245h9.8zm-10 0v-4.245h-5.27a28.907 28.907 0 0 0-4.53 3.544v.701zm10-4.445h-9.8V12.96a28.729 28.729 0 0 1 9.8-1.749zm-10 0v-2.421a28.668 28.668 0 0 0-4.95 2.42h4.95zm6.679-4.244a28.81 28.81 0 0 0-6.479 1.536V11.21h6.479zm-6.679 1.61v-1.61h-3.5a6.303 6.303 0 0 0-6.02 4.436 6.514 6.514 0 0 1 1.575-.192h2.617A28.877 28.877 0 0 1 29.9 12.82zm0 55.968V67.18a28.878 28.878 0 0 1-5.331-2.636h-2.614c-.543 0-1.07-.067-1.575-.192a6.303 6.303 0 0 0 6.02 4.437zm20.2 0h3.5a6.303 6.303 0 0 0 6.02-4.438 6.513 6.513 0 0 1-1.576.193h-2.608a28.879 28.879 0 0 1-5.336 2.638zm-.2-1.534v1.534h-6.475a28.808 28.808 0 0 0 6.475-1.534zm.2-.287a28.671 28.671 0 0 0 4.957-2.424H50.1v2.424zm-.2-2.424v2.499a28.728 28.728 0 0 1-9.8 1.746v-4.245zm.2-.2h5.278a28.914 28.914 0 0 0 4.522-3.538V60.1h-9.8zm-.2-4.244v4.244h-9.8V60.1zm0-2.603V59.9h-7.053a19.966 19.966 0 0 0 7.053-2.403zm0-37.397v2.403a19.966 19.966 0 0 0-7.053-2.403H49.9zm.2-.2h9.8v-.705a28.911 28.911 0 0 0-4.526-3.54H50.1V19.9zm-.2-4.245V19.9h-9.8v-4.245h9.8zm.2-.2h4.954a28.676 28.676 0 0 0-4.954-2.423zm-.2-2.497v2.497h-9.8V11.21a28.75 28.75 0 0 1 9.8 1.747zm.2-.14a28.877 28.877 0 0 1 5.332 2.637h2.612c.543 0 1.071.066 1.576.192a6.303 6.303 0 0 0-6.02-4.436h-3.5zm-.2-1.607v1.534a28.812 28.812 0 0 0-6.475-1.534H49.9zm-34.245 44.53v2.303c0 .567.075 1.117.215 1.64a6.309 6.309 0 0 0 1.643.216h1.41a29.118 29.118 0 0 1-3.268-4.16zm3.458 4.359h-1.6a6.513 6.513 0 0 1-1.578-.193 6.315 6.315 0 0 0 4.157 4.157 6.517 6.517 0 0 1-.192-1.575v-1.602a29.35 29.35 0 0 1-.787-.787zm.787.509a29.029 29.029 0 0 1-.508-.509h.508zm.2.469v1.411c0 .567.075 1.117.215 1.64.523.14 1.073.215 1.64.215h2.3a29.118 29.118 0 0 1-4.155-3.266zm35.649 3.266h2.295c.567 0 1.117-.075 1.64-.216a6.286 6.286 0 0 0 .216-1.639v-1.407a29.116 29.116 0 0 1-4.151 3.262zm4.35-3.454v1.598a6.53 6.53 0 0 1-.192 1.574 6.314 6.314 0 0 0 4.155-4.154 6.509 6.509 0 0 1-1.572.191h-1.6a29.08 29.08 0 0 1-.791.791zm.982-.991h1.41c.565 0 1.114-.075 1.636-.215a6.31 6.31 0 0 0 .216-1.641V55.75a29.113 29.113 0 0 1-3.262 4.15zm3.262-35.65v-2.295c0-.568-.075-1.117-.216-1.64a6.307 6.307 0 0 0-1.637-.215h-1.41a29.112 29.112 0 0 1 3.263 4.15zM60.89 19.9h1.6c.542 0 1.069.066 1.573.192a6.314 6.314 0 0 0-4.156-4.157 6.51 6.51 0 0 1 .192 1.576v1.598c.269.259.532.522.79.791zm-.991-.981V17.51a6.31 6.31 0 0 0-.216-1.64 6.308 6.308 0 0 0-1.64-.216h-2.299a29.108 29.108 0 0 1 4.155 3.264zm-35.641-3.264h-2.304a6.31 6.31 0 0 0-1.639.215 6.306 6.306 0 0 0-.216 1.641v1.412a29.115 29.115 0 0 1 4.159-3.268zM19.9 19.113v-1.602c0-.543.067-1.072.193-1.577a6.315 6.315 0 0 0-4.159 4.16 6.518 6.518 0 0 1 1.58-.194h1.6c.257-.267.519-.53.786-.787zm-.508.787h.508v-.508c-.171.167-.34.337-.508.508zm-.47.2h-1.409a6.31 6.31 0 0 0-1.643.216 6.308 6.308 0 0 0-.215 1.639v2.305a29.107 29.107 0 0 1 3.268-4.16zm41.178-.712c.173.168.344.34.512.512H60.1zm.513 40.712c-.169.173-.34.344-.513.513V60.1z' fill='%2394a3b8' fill-rule='evenodd'/%3e%3crect fill='black' height='80' rx='16' width='80'/%3e%3cpath d='M43.47 19.752c1.24 5.14.821 9.663-.937 10.1-1.758.438-4.19-3.375-5.43-8.517-1.241-5.14-.822-9.663.936-10.1 1.759-.438 4.19 3.376 5.43 8.517zm20.49 4.42c-2.749-2.913-8.216-2.123-12.212 1.763s-5.008 9.398-2.26 12.31 8.215 2.123 12.211-1.763 5.008-9.398 2.26-12.31zM42.102 68.769c1.758-.438 2.116-5.216.8-10.673-1.318-5.456-3.81-9.525-5.57-9.088-1.757.438-2.115 5.216-.798 10.672 1.317 5.457 3.81 9.526 5.568 9.089zM24.18 26.838c5.073 1.496 8.78 4.12 8.28 5.862-.5 1.741-5.019 1.94-10.091.444-5.073-1.496-8.78-4.12-8.28-5.861.501-1.742 5.019-1.941 10.092-.445zm32.924 19.664c5.384 1.588 9.343 4.286 8.843 6.028-.5 1.741-5.27 1.866-10.654.278-5.385-1.588-9.343-4.286-8.843-6.028.5-1.741 5.27-1.866 10.654-.278zm-27.216-3.654c-1.258-1.304-5.384.594-9.215 4.24-3.832 3.644-5.919 7.656-4.66 8.96 1.257 1.304 5.383-.594 9.215-4.239s5.918-7.657 4.66-8.96z' fill='%23fe5'/%3e%3c/svg%3e",m=".pera-wallet-download-qr-code-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n margin: 26px auto 0;\n padding: 10px;\n box-shadow: 0px 20px 60px rgba(26, 35, 91, 0.15), 0px 4px 12px rgba(26, 35, 91, 0.05), 0px 1px 4px rgba(26, 35, 91, 0.06);\n border-radius: 24px;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-download-qr-code-wrapper {\n margin-top: 51px;\n }\n}";l(m);const b=document.createElement("template");b.innerHTML='\n
\n';class y extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=m,this.shadowRoot.append(b.content.cloneNode(!0),e)}}connectedCallback(){var e;const t=new a.default({width:205,height:205,type:"svg",data:r.PERA_DOWNLOAD_URL,image:g,dotsOptions:{color:"#000",type:"extra-rounded"},imageOptions:{crossOrigin:"anonymous",margin:10},cornersSquareOptions:{type:"extra-rounded"},cornersDotOptions:{type:"dot"}}),n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-download-qr-code-wrapper");n&&t.append(n)}}var v="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8.5 19L15.5 12L8.5 5' stroke='%233C3C49' stroke-width='2'/%3e%3c/svg%3e",w=".pera-wallet-connect-modal-desktop-mode {\n display: grid;\n grid-template-columns: 205px auto;\n gap: 70px;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view {\n display: block;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item--active .pera-wallet-accordion-item__content {\n height: 364px;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-accordion-item--web-wallet {\n display: none;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-accordion-item .pera-wallet-accordion-toggle {\n padding: 26px 24px 12px;\n border-radius: 24px 24px 0 0;\n transition: all ease-in 0.2s;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-accordion-item .pera-wallet-accordion-item__content {\n height: 434px;\n border-radius: 0 0 24px 24px;\n transition: height ease-in 0.2s;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-accordion-item .pera-wallet-accordion-icon {\n transform: rotate(90deg);\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-connect-modal-desktop-mode__download-pera-description {\n margin-top: 50px;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__download-view {\n display: none;\n}\n.pera-wallet-connect-modal-desktop-mode--download .pera-wallet-connect-modal-desktop-mode__default-view {\n display: none;\n}\n.pera-wallet-connect-modal-desktop-mode--download .pera-wallet-connect-modal-desktop-mode__download-view {\n display: block;\n}\n.pera-wallet-connect-modal-desktop-mode--download .pera-wallet-connect-modal-desktop-mode__download-view .pera-wallet-connect-modal-download-pera-view__footer a {\n display: flex;\n cursor: pointer;\n}\n.pera-wallet-connect-modal-desktop-mode--compact {\n grid-template-columns: unset;\n gap: unset;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet {\n padding: 28px 40px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet .pera-wallet-connect-modal-desktop-mode__web-wallet__logo-wrapper {\n box-shadow: unset;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet .pera-wallet-connect-modal-desktop-mode__web-wallet__description {\n margin-bottom: 16px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet .pera-wallet-connect-modal-desktop-mode__web-wallet__launch-button {\n width: 172px;\n height: 40px;\n margin: 0 auto;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet-iframe {\n height: 100%;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view {\n overflow: hidden;\n border-radius: 24px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item {\n margin-bottom: 0;\n border-radius: 0;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item:not(:last-child) {\n border-bottom: 1px solid #e6e8ee;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item #pera-wallet-iframe {\n height: 100%;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-toggle {\n padding: 20px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-toggle__text, .pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-toggle__content-with-label__text {\n color: #626268;\n font-size: 14px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.09px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-toggle__bold-color {\n font-weight: 600;\n color: #1a1a1a;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item--active .pera-wallet-accordion-item__content {\n height: 265px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-modal-desktop-mode__download-pera-container {\n display: flex;\n justify-content: space-between;\n margin-top: 14px;\n padding: 0 20px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-modal-desktop-mode__download-pera-description,\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-modal-desktop-mode__download-pera-button {\n margin: 0;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-modal-desktop-mode__download-pera-button {\n font-weight: 500;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-qr-code-wrapper {\n margin: 4px auto 0;\n padding: 0;\n box-shadow: unset;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-qr-code-wrapper svg {\n padding: 8px;\n box-shadow: 0px 20px 60px rgba(26, 35, 91, 0.15), 0px 4px 12px rgba(26, 35, 91, 0.05), 0px 1px 4px rgba(26, 35, 91, 0.06);\n border-radius: 12px;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account {\n width: 100%;\n height: 100%;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account.pera-wallet-connect-modal-desktop-mode--default {\n overflow: hidden;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account .pera-wallet-connect-modal-desktop-mode__web-wallet-iframe {\n position: unset;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account .pera-wallet-accordion {\n overflow: hidden;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account #pera-wallet-iframe {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n border-radius: 16px;\n}\n\n.pera-wallet-connect-modal-desktop-mode__accordion__description,\n.pera-wallet-connect-modal-desktop-mode__connect-button-wrapper {\n padding: 0 40px 20px 64px;\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n height: calc(100% - 88px);\n padding: 48px 52px 40px;\n margin: 0 auto;\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 72px;\n height: 72px;\n margin: 0 auto 16px;\n background: #ffffff;\n border-radius: 50%;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.1), 0px 10px 16px rgba(20, 37, 63, 0.06);\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet__description {\n margin: 0 auto 32px;\n font-size: 14px;\n line-height: 24px;\n letter-spacing: -0.1px;\n text-align: center;\n color: #6a6a81;\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet__launch-button {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n padding: 14px 0;\n color: #ffffff;\n background-color: #6b46fe;\n border-radius: 12px;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n letter-spacing: -0.1;\n border: none;\n outline: none;\n cursor: pointer;\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet-iframe {\n position: relative;\n width: fit-content;\n margin: 0 auto;\n}\n\n.pera-wallet-connect-modal-desktop-mode__connect-button {\n display: block;\n width: 100%;\n height: 48px;\n border: unset;\n border-radius: 6px;\n background-color: #333333;\n color: white;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 13px;\n}\n\n.pera-wallet-connect-qr-code-wrapper {\n width: fit-content;\n margin: 24px auto 0;\n padding: 10px;\n box-shadow: 0px 20px 60px rgba(26, 35, 91, 0.15), 0px 4px 12px rgba(26, 35, 91, 0.05), 0px 1px 4px rgba(26, 35, 91, 0.06);\n border-radius: 24px;\n}\n\n.pera-wallet-connect-modal-desktop-mode__download-pera-description {\n color: #838aa6;\n text-align: center;\n margin: 32px 0 12px;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n letter-spacing: -0.04px;\n}\n\n.pera-wallet-connect-modal-desktop-mode__download-pera-button {\n display: flex;\n align-items: center;\n gap: 8px;\n margin: 0 auto;\n padding: 0;\n color: #6b46fe;\n background-color: transparent;\n outline: none;\n border: none;\n font-weight: 600;\n font-size: 13px;\n line-height: 20px;\n letter-spacing: 0.01px;\n cursor: pointer;\n}\n\n.pera-wallet-connect-modal-download-pera-view__back-button {\n display: flex;\n align-items: center;\n gap: 16px;\n margin-bottom: 14px;\n padding: 12px 24px;\n color: #3c3c49;\n background-color: #ffffff;\n outline: none;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n border: unset;\n border-radius: 24px;\n font-size: 14px;\n font-weight: 600;\n line-height: 24px;\n letter-spacing: -0.1px;\n cursor: pointer;\n}\n\n.pera-wallet-connect-modal-download-pera-view {\n padding: 32px 37px 28px;\n background-color: #ffffff;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n border-radius: 24px;\n}\n\n.pera-wallet-connect-modal-download-pera-view__title {\n margin-bottom: 8px;\n color: #3c3c49;\n font-weight: 600;\n font-size: 15px;\n line-height: 18px;\n text-align: center;\n letter-spacing: -0.13px;\n}\n\n.pera-wallet-connect-modal-download-pera-view__footer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n margin-top: 53px;\n}\n\n.pera-wallet-connect-modal-download-pera-view__footer__button {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 8px 16px;\n color: #6a6a81;\n background-color: #ffffff;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n text-decoration: none;\n border-radius: 12px;\n font-weight: 500;\n font-size: 13px;\n line-height: 200%;\n letter-spacing: -0.04px;\n cursor: pointer;\n}\n\n#pera-wallet-iframe {\n width: 285px;\n height: 376px;\n margin: 0 auto;\n border: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-connect-modal-desktop-mode {\n grid-template-columns: 1fr;\n gap: 24px;\n }\n .pera-wallet-connect-qr-code-wrapper {\n margin-top: 16px;\n }\n .pera-wallet-connect-modal-download-pera-view {\n padding: 24px;\n }\n .pera-wallet-download-qr-code-wrapper {\n margin-top: 32px;\n }\n .pera-wallet-connect-modal-download-pera-view__footer {\n margin-top: 40px;\n }\n}";l(w);var x=".pera-wallet-accordion-item {\n background-color: #ffffff;\n border-radius: 24px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.02), 0px 4px 12px rgba(0, 0, 0, 0.03);\n}\n.pera-wallet-accordion-item:not(:last-of-type) {\n margin-bottom: 20px;\n}\n.pera-wallet-accordion-item:not(:last-of-type) .pera-wallet-accordion-panel {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.pera-wallet-accordion-item .pera-wallet-accordion-item__content {\n height: 0;\n overflow: hidden;\n color: #69708d;\n background-color: #ffffff;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n letter-spacing: -0.04px;\n transition: height ease-in 0.2s;\n}\n.pera-wallet-accordion-item--active .pera-wallet-accordion-toggle {\n padding: 26px 24px 12px;\n border-radius: 24px 24px 0 0;\n transition: all ease-in 0.2s;\n}\n.pera-wallet-accordion-item--active .pera-wallet-accordion-item__content {\n border-radius: 0 0 24px 24px;\n transition: height ease-in 0.2s;\n}\n.pera-wallet-accordion-item--active .pera-wallet-accordion-icon {\n transform: rotate(90deg);\n}\n\n.pera-wallet-accordion-toggle {\n position: relative;\n display: flex;\n align-items: center;\n gap: 16px;\n padding: 12px 24px;\n color: #2c3559;\n background-color: #ffffff;\n border: none;\n border-radius: 24px;\n outline: none;\n cursor: pointer;\n font-size: 16px;\n line-height: 18px;\n letter-spacing: -0.1px;\n font-weight: 600;\n transition: all ease-in 0.2s;\n}\n.pera-wallet-accordion-toggle__text, .pera-wallet-accordion-toggle__content-with-label__text {\n color: #626268;\n}\n\n.pera-wallet-accordion-icon {\n transition: all ease-in 0.2s;\n}\n\n.pera-wallet-accordion-toggle__bold-color {\n color: #1A1A1A;\n font-weight: 600;\n}\n\n.pera-wallet-accordion-toggle__content-with-label {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.pera-wallet-accordion-toggle__label {\n padding: 4px 9px;\n color: #1C786C;\n background: #E0FAEE;\n border-radius: 12px;\n font-size: 11px;\n font-weight: 600;\n line-height: 18px;\n letter-spacing: 0.01px;\n}\n\n.pera-wallet-accordion-toggle__button {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n background: transparent;\n box-shadow: none;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-accordion-toggle {\n font-size: 14px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.1px;\n }\n}";l(x);const S=document.createElement("template"),A=document.createElement("style"),E=document.createElement("style");A.textContent=w,E.textContent=x,S.innerHTML="\n
\n \n\n
\n \n\n
\n \n \n\n Back\n \n\n
\n

\n Download Pera Wallet\n

\n\n \n\n
\n \n \"App\n \n\n \n \"Play\n \n\n \n \"Download\n\n Download APK File\n \n
\n
\n
\n
\n ";class _ extends HTMLElement{constructor(){var e;if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){if(this.shadowRoot.append(S.content.cloneNode(!0),A,E),this.shadowRoot.addEventListener("click",(e=>{this.handleAccordion(e)})),"true"===this.getAttribute("compact-mode")){const e=this.shadowRoot.getElementById("pera-wallet-connect-modal-desktop-mode");null==e||e.classList.add("pera-wallet-connect-modal-desktop-mode--compact")}const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".pera-wallet-connect-modal-desktop-mode__default-view"),n="true"===this.getAttribute("promote-mobile"),{webWalletOption:r,mobileWalletOption:i}=function(e){const t=`\n
\n \n \n \n \n \n
\n
\n Connect With\n \n \n Pera Web\n \n
\n \n NEW\n
\n
\n \n
\n
\n \n \n \n
\n \n \n Connect with Pera Web to continue\n

\n
\n \n \n Launch Pera Web\n \n \n \n
`,n=`\n
\n \n \n \n \n \n
\n Connect with\n \n \n Pera Mobile\n \n
\n
\n \n
\n
\n \n
\n \n Don\u2019t have Pera Wallet app?\n

\n \n \n QR Icon\n \n Download Pera Wallet\n \n
\n
\n
`;return{mobileWalletOption:document.createRange().createContextualFragment(n),webWalletOption:document.createRange().createContextualFragment(t)}}(n);n?(null==t||t.appendChild(i),null==t||t.appendChild(r)):(null==t||t.appendChild(r),null==t||t.appendChild(i))}}connectedCallback(){var e;const t=this.getAttribute("should-display-new-badge"),n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-web-new-label");"false"===t&&(null==n||n.setAttribute("style","display:none")),this.handleChangeView()}handleChangeView(){var e,t,n;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-desktop-mode-download-pera-button"),i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pera-wallet-connect-modal-download-pera-view-back-button"),o=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById("pera-wallet-connect-web-wallet-launch-button");r&&r.addEventListener("click",(()=>{this.onClickDownload()})),i&&i.addEventListener("click",(()=>{this.onClickBack()})),o&&o.addEventListener("click",(()=>{this.webWalletConnect()})),this.renderQRCode(),this.checkWebWalletAvaliability()}webWalletConnect(){"true"===this.getAttribute("is-web-wallet-avaliable")&&window.onWebWalletConnect()}handleAccordion(e){var t,n;if(e.target instanceof Element){if(!e.target.classList.contains("pera-wallet-accordion-toggle__button"))return;if(this.shadowRoot&&(null===(t=e.target.parentElement)||void 0===t?void 0:t.parentElement)){const t=null===(n=e.target.parentElement)||void 0===n?void 0:n.parentElement;if(!t)return;if(t.classList.contains("pera-wallet-accordion-item--active"))return;const r=this.shadowRoot.querySelectorAll(".pera-wallet-accordion-item.pera-wallet-accordion-item--active");for(let e=0;e{this.onClickLaunch()})))}}onClickLaunch(){if(I.innerHTML=`\n
\n \n
\n `,this.shadowRoot){const e=document.createElement("style");e.textContent=C,this.shadowRoot.innerHTML="",this.shadowRoot.append(I.content.cloneNode(!0),e)}}}var T='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");\n.pera-wallet-modal {\n --pera-wallet-modal-font-family: "Inter", sans-serif;\n --pera-wallet-modal-compact-width: 380px;\n --pera-wallet-modal-compact-height: 396px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 999999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n}\n.pera-wallet-modal--select-account .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body {\n top: 40px;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: unset;\n height: calc(100 * var(--vh));\n padding: 20px;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);\n border-radius: 20px 20px 0px 0px;\n animation: 0.3s PeraWalletConnectMobileSlideIn ease-out;\n overflow-y: auto;\n transform: unset;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body::before {\n background-image: unset;\n}\n.pera-wallet-modal--compact:not(.pera-wallet-modal--mobile) .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n padding: 0;\n}\n.pera-wallet-modal * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-modal ul,\n.pera-wallet-modal ol,\n.pera-wallet-modal li {\n list-style-type: none;\n}\n\n.pera-wallet-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: auto;\n height: 48px;\n padding: 14px;\n border: none;\n border-radius: 12px;\n outline: none;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 14px;\n}\n\n.pera-wallet-modal__logo img {\n display: block;\n width: 32px;\n}\n\n.pera-wallet-modal__body {\n position: relative;\n top: 50%;\n left: 50%;\n width: 700px;\n max-width: calc(100vw - 80px);\n padding: 28px;\n background-color: #f3f3f7;\n box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.08);\n border-radius: 24px;\n animation: 0.3s PeraWalletConnectSlideIn ease-out;\n transform: translate(-50%, -50%);\n}\n.pera-wallet-modal__body::before {\n --background-line: #1e0972 0 1.2px, transparent 0 calc(100% - 1.2px), #1e0972;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: "";\n background-image: linear-gradient(var(--background-line)), linear-gradient(90deg, var(--background-line));\n background-size: 116px 116px;\n mix-blend-mode: overlay;\n border-radius: 24px;\n opacity: 0.8;\n pointer-events: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-modal--desktop .pera-wallet-modal__body {\n width: 100%;\n max-width: calc(100vw - 32px);\n padding: 24px;\n }\n}\n@keyframes PeraWalletConnectSlideIn {\n 0% {\n opacity: 0;\n transform: translate(-50%, calc(-50% + 24px));\n }\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n}\n@keyframes PeraWalletConnectMobileSlideIn {\n 0% {\n top: 30%;\n opacity: 0;\n }\n 100% {\n top: 40px;\n opacity: 1;\n }\n}';l(T);const M=document.createElement("template");let P=r.isMobile()?`${r.PERA_WALLET_MODAL_CLASSNAME} ${r.PERA_WALLET_MODAL_CLASSNAME}--mobile`:`${r.PERA_WALLET_MODAL_CLASSNAME} ${r.PERA_WALLET_MODAL_CLASSNAME}--desktop`;class O extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=T,"true"===this.getAttribute("compact-mode")&&(P=`${P} ${r.PERA_WALLET_MODAL_CLASSNAME}--compact`),r.isMobile()?(M.innerHTML=`\n
\n
\n \n \n \n
\n
\n `,this.shadowRoot.append(M.content.cloneNode(!0),e)):(M.innerHTML=`\n
\n
\n \n \n \n
\n
\n `,this.shadowRoot.append(M.content.cloneNode(!0),e))}}}var R='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");\n.pera-wallet-modal {\n --pera-wallet-modal-font-family: "Inter", sans-serif;\n --pera-wallet-modal-compact-width: 380px;\n --pera-wallet-modal-compact-height: 396px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 999999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n}\n.pera-wallet-modal--select-account .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body {\n top: 40px;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: unset;\n height: calc(100 * var(--vh));\n padding: 20px;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);\n border-radius: 20px 20px 0px 0px;\n animation: 0.3s PeraWalletConnectMobileSlideIn ease-out;\n overflow-y: auto;\n transform: unset;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body::before {\n background-image: unset;\n}\n.pera-wallet-modal--compact:not(.pera-wallet-modal--mobile) .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n padding: 0;\n}\n.pera-wallet-modal * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-modal ul,\n.pera-wallet-modal ol,\n.pera-wallet-modal li {\n list-style-type: none;\n}\n\n.pera-wallet-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: auto;\n height: 48px;\n padding: 14px;\n border: none;\n border-radius: 12px;\n outline: none;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 14px;\n}\n\n.pera-wallet-modal__logo img {\n display: block;\n width: 32px;\n}\n\n.pera-wallet-modal__body {\n position: relative;\n top: 50%;\n left: 50%;\n width: 700px;\n max-width: calc(100vw - 80px);\n padding: 28px;\n background-color: #f3f3f7;\n box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.08);\n border-radius: 24px;\n animation: 0.3s PeraWalletConnectSlideIn ease-out;\n transform: translate(-50%, -50%);\n}\n.pera-wallet-modal__body::before {\n --background-line: #1e0972 0 1.2px, transparent 0 calc(100% - 1.2px), #1e0972;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: "";\n background-image: linear-gradient(var(--background-line)), linear-gradient(90deg, var(--background-line));\n background-size: 116px 116px;\n mix-blend-mode: overlay;\n border-radius: 24px;\n opacity: 0.8;\n pointer-events: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-modal--desktop .pera-wallet-modal__body {\n width: 100%;\n max-width: calc(100vw - 32px);\n padding: 24px;\n }\n}\n@keyframes PeraWalletConnectSlideIn {\n 0% {\n opacity: 0;\n transform: translate(-50%, calc(-50% + 24px));\n }\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n}\n@keyframes PeraWalletConnectMobileSlideIn {\n 0% {\n top: 30%;\n opacity: 0;\n }\n 100% {\n top: 40px;\n opacity: 1;\n }\n}\n.pera-wallet-redirect-modal {\n display: grid;\n grid-template-columns: 1fr;\n gap: 56px;\n grid-template-rows: auto 48px;\n height: 100%;\n padding: 4px;\n padding-bottom: 70px;\n}\n\n.pera-wallet-redirect-modal__content {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n}\n\n.pera-wallet-redirect-modal__content__title {\n margin: 20px 0 8px;\n color: #3c3c49;\n font-size: 18px;\n font-weight: 600;\n line-height: 22px;\n letter-spacing: -0.26px;\n}\n\n.pera-wallet-redirect-modal__content__description,\n.pera-wallet-redirect-modal__content__install-pera-text {\n color: #3c3c49;\n max-width: 271px;\n font-size: 14px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -0.09px;\n text-align: center;\n}\n\n.pera-wallet-redirect-modal__content__description {\n margin-bottom: 24px;\n}\n\n.pera-wallet-redirect-modal__content__install-pera-text__link {\n color: #6b46fe;\n font-size: 14px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -0.09px;\n text-align: center;\n}\n\n.pera-wallet-redirect-modal__launch-pera-wallet-button {\n display: block;\n padding: 14px;\n color: #ffffff;\n background-color: #6b46fe;\n border-radius: 12px;\n text-decoration: none;\n text-align: center;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.09px;\n font-weight: 500;\n}';l(R);const N=document.createElement("template");N.innerHTML=`\n
\n
\n \n\n
\n
\n \n\n

\n Can't Launch Pera\n

\n\n

\n We couldn't redirect you to Pera Wallet automatically. Please try again.\n

\n\n

\n Don't have Pera Wallet installed yet?\n
\n \n \n Tap here to install.\n \n

\n
\n\n \n Launch Pera Wallet\n \n
\n
\n
\n`;class B extends HTMLElement{constructor(){var e,t;if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const n=document.createElement("style");n.textContent=R,this.shadowRoot.append(N.content.cloneNode(!0),n);const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-redirect-modal-download-pera-link");null==r||r.addEventListener("click",(()=>{this.onClose()}));const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pera-wallet-redirect-modal-launch-pera-link");null==i||i.addEventListener("click",(()=>{this.onClose(),window.open(u(),"_blank")}))}}connectedCallback(){const e=window.open(u(),"_blank");e&&!e.closed&&this.onClose()}onClose(){r.removeModalWrapperFromDOM(r.PERA_WALLET_REDIRECT_MODAL_ID)}}var L="data:image/svg+xml,%3csvg width='32' height='35' viewBox='0 0 32 35' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M18.2837 5.09271C19.0234 8.12325 18.7827 10.7913 17.7463 11.0519C16.7098 11.3126 15.27 9.06712 14.5304 6.03657C13.7908 3.00603 14.0315 0.337996 15.0679 0.0773547C16.1044 -0.183287 17.5441 2.06216 18.2837 5.09271Z' fill='%233C3C49'/%3e%3cpath d='M30.376 7.66915C28.7507 5.95537 25.5271 6.42918 23.1759 8.72745C20.8247 11.0257 20.2361 14.2781 21.8614 15.9919C23.4866 17.7057 26.7102 17.2319 29.0614 14.9336C31.4127 12.6354 32.0012 9.38294 30.376 7.66915Z' fill='%233C3C49'/%3e%3cpath d='M17.5511 34.0071C18.5876 33.7465 18.7914 30.9276 18.0064 27.711C17.2214 24.4945 15.7448 22.0982 14.7084 22.3589C13.6719 22.6195 13.4681 25.4383 14.2531 28.6549C15.0381 31.8715 16.5147 34.2677 17.5511 34.0071Z' fill='%233C3C49'/%3e%3cpath d='M6.91617 9.3015C9.9105 10.1763 12.1008 11.7187 11.8083 12.7466C11.5158 13.7745 8.85126 13.8986 5.85693 13.0239C2.8626 12.1491 0.672334 10.6067 0.964835 9.57881C1.25734 8.5509 3.92184 8.42674 6.91617 9.3015Z' fill='%233C3C49'/%3e%3cpath d='M26.3656 20.8508C29.5437 21.7793 31.883 23.3652 31.5905 24.3932C31.298 25.4211 28.4845 25.5017 25.3063 24.5732C22.1282 23.6448 19.7889 22.0588 20.0814 21.0309C20.3739 20.003 23.1874 19.9224 26.3656 20.8508Z' fill='%233C3C49'/%3e%3cpath d='M10.3069 18.7365C9.56299 17.9692 7.13209 19.0948 4.87736 21.2506C2.62264 23.4064 1.39791 25.776 2.14185 26.5432C2.8858 27.3105 5.3167 26.1849 7.57143 24.0291C9.82615 21.8733 11.0509 19.5037 10.3069 18.7365Z' fill='%233C3C49'/%3e%3c/svg%3e",D=".pera-wallet-connect-modal-information-section {\n padding: 12px;\n padding-right: 0;\n}\n.pera-wallet-connect-modal-information-section--mobile {\n padding: 0;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__pera-icon {\n margin-bottom: 16px;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__connect-pera-title {\n margin-bottom: 8px;\n color: #3c3c49;\n font-size: 18px;\n font-weight: 600;\n line-height: 22px;\n letter-spacing: -0.2px;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__title {\n margin-bottom: 24px;\n color: #3c3c49;\n font-size: 14px;\n line-height: 24px;\n letter-spacing: -0.09px;\n font-weight: 400;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__features-item__icon-wrapper {\n background-color: #f2f3f8;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__features-item__description {\n color: #6a6a81;\n}\n.pera-wallet-connect-modal-information-section * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.pera-wallet-connect-modal-information-section__pera-icon {\n margin-bottom: 32px;\n}\n\n.pera-wallet-connect-modal-information-section__title {\n margin-bottom: 148px;\n color: #3c3c49;\n font-size: 20px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.5px;\n}\n\n.pera-wallet-connect-modal-information-section__secondary-title {\n margin-bottom: 20px;\n color: #9d9dae;\n font-size: 11px;\n font-weight: 600;\n line-height: 18px;\n letter-spacing: 0.06px;\n text-transform: uppercase;\n}\n\n.pera-wallet-connect-modal-information-section__features-item {\n display: grid;\n align-items: center;\n grid-template-columns: 36px auto;\n gap: 16px;\n}\n.pera-wallet-connect-modal-information-section__features-item:not(:last-of-type) {\n margin-bottom: 24px;\n}\n\n.pera-wallet-connect-modal-information-section__features-item__icon-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n background-color: #ffffff;\n border-radius: 50%;\n}\n\n.pera-wallet-connect-modal-information-section__features-item__description {\n color: #6a6a81;\n font-size: 12px;\n font-weight: 500;\n line-height: 18px;\n letter-spacing: 0.01px;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-connect-modal-information-section--desktop {\n padding: 0;\n }\n .pera-wallet-connect-modal-information-section--desktop .pera-wallet-connect-modal-information-section__pera-icon {\n margin-bottom: 12px;\n }\n .pera-wallet-connect-modal-information-section--desktop .pera-wallet-connect-modal-information-section__title {\n margin-bottom: 24px;\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.26px;\n }\n .pera-wallet-connect-modal-information-section--desktop .pera-wallet-connect-modal-information-section__features-item {\n display: none;\n }\n .pera-wallet-connect-modal-information-section__secondary-title {\n display: none;\n }\n}";l(D);const U=document.createElement("template"),j=r.isMobile()?"pera-wallet-connect-modal-information-section pera-wallet-connect-modal-information-section--mobile":"pera-wallet-connect-modal-information-section pera-wallet-connect-modal-information-section--desktop";U.innerHTML=`\n
\n \n\n

\n Connect to Pera Wallet\n

\n\n

\n Simply the best Algorand wallet.\n

\n\n

\n Features\n

\n\n
    \n
  • \n
    \n Layer Icon\n
    \n \n \n Connect to any Algorand dApp securely\n

    \n
  • \n\n
  • \n \n Tick Icon\n
\n\n \n Your private keys are safely stored locally\n

\n \n\n
  • \n \n Note Icon\n \n\n \n View NFTs, buy and swap crypto and more\n

    \n
  • \n \n \n`;class F extends HTMLElement{constructor(){var e,t,n,i;super(),this.attachShadow({mode:"open"});const o="true"===(null===(e=document.querySelector("pera-wallet-connect-modal"))||void 0===e?void 0:e.getAttribute("compact-mode"));if(this.shadowRoot&&(!o&&!r.isMobile()||r.isMobile())){const e=document.createElement("style");e.textContent=D,this.shadowRoot.append(U.content.cloneNode(!0),e),r.isMobile()?null===(t=this.shadowRoot.getElementById("pera-wallet-connect-modal-information-section-title"))||void 0===t||t.setAttribute("style","display: none;"):(null===(n=this.shadowRoot.getElementById("pera-wallet-connect-modal-information-section-pera-icon"))||void 0===n||n.setAttribute("src","data:image/svg+xml,%3csvg width='84' height='38' viewBox='0 0 84 38' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M19.806 8.62773C20.4416 11.2609 20.2268 13.5772 19.3262 13.8012C18.4256 14.0253 17.1803 12.0723 16.5448 9.43906C15.9092 6.80585 16.1241 4.48959 17.0246 4.26555C17.9252 4.04151 19.1705 5.99452 19.806 8.62773Z' fill='%233C3C49'/%3e%3cpath d='M30.3007 10.8917C28.8932 9.3999 26.0929 9.80424 24.0461 11.7948C21.9994 13.7853 21.4812 16.6082 22.8887 18.1C24.2962 19.5917 27.0964 19.1874 29.1432 17.1969C31.1899 15.2064 31.7082 12.3834 30.3007 10.8917Z' fill='%233C3C49'/%3e%3cpath d='M19.1061 33.734C20.0067 33.5099 20.1899 31.0627 19.5153 28.2678C18.8408 25.473 17.5639 23.3889 16.6633 23.613C15.7627 23.837 15.5795 26.2843 16.2541 29.0791C16.9286 31.874 18.2056 33.958 19.1061 33.734Z' fill='%233C3C49'/%3e%3cpath d='M9.92571 12.2574C12.5239 13.0236 14.4224 14.3678 14.1662 15.2597C13.9099 16.1517 11.5959 16.2536 8.99771 15.4874C6.3995 14.7212 4.50098 13.377 4.75724 12.4851C5.0135 11.5931 7.3275 11.4912 9.92571 12.2574Z' fill='%233C3C49'/%3e%3cpath d='M26.7892 22.3292C29.5469 23.1424 31.5747 24.5247 31.3184 25.4167C31.0621 26.3086 28.6189 26.3724 25.8612 25.5592C23.1035 24.7459 21.0757 23.3636 21.3319 22.4717C21.5882 21.5797 24.0315 21.5159 26.7892 22.3292Z' fill='%233C3C49'/%3e%3cpath d='M12.8493 20.4577C12.205 19.7898 10.0916 20.7619 8.12896 22.6289C6.16631 24.4959 5.09759 26.5509 5.7419 27.2188C6.38622 27.8867 8.49958 26.9146 10.4622 25.0476C12.4249 23.1806 13.4936 21.1256 12.8493 20.4577Z' fill='%233C3C49'/%3e%3cpath d='M41.691 12.5347V11.9635H39.3366V27.1957H41.691V23.0915C41.691 22.6472 41.691 22.2876 41.6482 21.801H41.691C42.5471 23.1973 44.0026 23.9377 45.7148 23.9377C48.6043 23.9377 51.1299 21.7587 51.1299 17.7179C51.1299 13.7617 48.6043 11.625 45.7148 11.625C44.0668 11.625 42.6113 12.3443 41.691 13.7617H41.6482C41.691 13.2963 41.691 12.9578 41.691 12.5347ZM45.1155 21.9279C42.9324 21.9068 41.6696 20.0662 41.6696 17.6967C41.6696 15.4542 42.9324 13.656 45.1155 13.6348C47.2559 13.6137 48.6685 15.2638 48.6685 17.7179C48.6685 20.2354 47.2559 21.9491 45.1155 21.9279Z' fill='%233C3C49'/%3e%3cpath d='M63.4932 16.7236C63.4932 13.8041 61.1388 11.625 57.9283 11.625C54.5037 11.625 52.1279 13.931 52.1279 17.7814C52.1279 21.4836 54.4609 23.9377 57.9283 23.9377C60.7749 23.9377 62.8939 22.2876 63.3862 20.0239H60.8177C60.4111 21.1663 59.2981 21.9279 57.9283 21.9279C56.1732 21.9279 54.889 20.6797 54.6107 18.6064H63.4932V16.7236ZM57.9283 13.6348C59.662 13.6348 60.8606 14.8195 61.1174 16.5332H54.6321C54.9318 14.883 56.1518 13.6348 57.9283 13.6348Z' fill='%233C3C49'/%3e%3cpath d='M65.224 23.5992H67.5784V17.0409C67.5784 14.7984 68.8198 13.6348 70.7462 13.6348H72.009V11.625H71.003C69.2693 11.625 68.1991 12.7674 67.5784 13.7617H67.5356V11.9635H65.224V23.5992Z' fill='%233C3C49'/%3e%3cpath d='M83.0154 21.5683C82.6944 21.5683 82.5445 21.3779 82.5445 20.9971V15.8773C82.5445 13.4233 81.3459 11.625 77.8144 11.625C74.3898 11.625 72.8273 13.3175 72.6561 15.7292H75.0105C75.1603 14.4176 76.2091 13.6348 77.8144 13.6348C79.1842 13.6348 80.1259 14.2272 80.1259 15.158C80.1259 15.9196 79.5909 16.3851 77.8358 16.3851H76.894C74.0901 16.3851 72.2066 17.5063 72.2066 20.0662C72.2066 22.753 74.1972 23.98 76.5301 23.98C78.2638 23.98 79.7407 23.2184 80.3186 21.5894C80.3828 22.7742 81.1747 23.5992 82.673 23.5992H84V21.5683H83.0154ZM80.1902 18.1833C80.1902 20.8067 78.7561 21.9491 76.9154 21.9491C75.3101 21.9491 74.668 21.0182 74.668 20.0662C74.668 19.1565 75.2245 18.416 76.9368 18.416H77.2793C78.9273 18.416 79.9547 17.8448 80.1688 16.8505H80.1902V18.1833Z' fill='%233C3C49'/%3e%3c/svg%3e"),null===(i=this.shadowRoot.getElementById("pera-wallet-connect-modal-information-section-connect-pera-mobile"))||void 0===i||i.setAttribute("style","display: none;"))}}}var V='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");\n.pera-wallet-modal {\n --pera-wallet-modal-font-family: "Inter", sans-serif;\n --pera-wallet-modal-compact-width: 380px;\n --pera-wallet-modal-compact-height: 396px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 999999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n}\n.pera-wallet-modal--select-account .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body {\n top: 40px;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: unset;\n height: calc(100 * var(--vh));\n padding: 20px;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);\n border-radius: 20px 20px 0px 0px;\n animation: 0.3s PeraWalletConnectMobileSlideIn ease-out;\n overflow-y: auto;\n transform: unset;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body::before {\n background-image: unset;\n}\n.pera-wallet-modal--compact:not(.pera-wallet-modal--mobile) .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n padding: 0;\n}\n.pera-wallet-modal * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-modal ul,\n.pera-wallet-modal ol,\n.pera-wallet-modal li {\n list-style-type: none;\n}\n\n.pera-wallet-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: auto;\n height: 48px;\n padding: 14px;\n border: none;\n border-radius: 12px;\n outline: none;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 14px;\n}\n\n.pera-wallet-modal__logo img {\n display: block;\n width: 32px;\n}\n\n.pera-wallet-modal__body {\n position: relative;\n top: 50%;\n left: 50%;\n width: 700px;\n max-width: calc(100vw - 80px);\n padding: 28px;\n background-color: #f3f3f7;\n box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.08);\n border-radius: 24px;\n animation: 0.3s PeraWalletConnectSlideIn ease-out;\n transform: translate(-50%, -50%);\n}\n.pera-wallet-modal__body::before {\n --background-line: #1e0972 0 1.2px, transparent 0 calc(100% - 1.2px), #1e0972;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: "";\n background-image: linear-gradient(var(--background-line)), linear-gradient(90deg, var(--background-line));\n background-size: 116px 116px;\n mix-blend-mode: overlay;\n border-radius: 24px;\n opacity: 0.8;\n pointer-events: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-modal--desktop .pera-wallet-modal__body {\n width: 100%;\n max-width: calc(100vw - 32px);\n padding: 24px;\n }\n}\n@keyframes PeraWalletConnectSlideIn {\n 0% {\n opacity: 0;\n transform: translate(-50%, calc(-50% + 24px));\n }\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n}\n@keyframes PeraWalletConnectMobileSlideIn {\n 0% {\n top: 30%;\n opacity: 0;\n }\n 100% {\n top: 40px;\n opacity: 1;\n }\n}\n.pera-wallet-connect-modal-pending-message-section {\n display: grid;\n grid-template-columns: 1fr;\n grid-template-rows: auto 48px;\n gap: 56px;\n height: 100%;\n padding: 4px;\n padding-bottom: 70px;\n}\n\n.pera-wallet-connect-modal-pending-message {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n text-align: center;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n height: 100%;\n margin-top: 10px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__title {\n margin: 16px 0 12px;\n color: #3c3c49;\n font-size: 18px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.26px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__description {\n color: #6a6a81;\n font-size: 14px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -0.01px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__button {\n display: block;\n width: 100%;\n padding: 14px;\n border-radius: 12px;\n text-decoration: none;\n text-align: center;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.09px;\n font-weight: 500;\n color: #ffffff;\n background-color: #6b46fe;\n border: none;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor {\n display: flex;\n gap: 12px;\n margin-bottom: 20px;\n padding: 16px;\n background: #ffffff;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n border-radius: 12px;\n text-decoration: none;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor__image {\n width: 24px;\n height: 24px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor__title-wrapper {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 4px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor__title {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n letter-spacing: -0.1px;\n color: #3c3c49;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor__description {\n /* stylelint-disable value-no-vendor-prefix */\n /* stylelint-disable property-no-vendor-prefix */\n display: -webkit-box;\n max-width: 100%;\n -webkit-line-clamp: 2;\n /* autoprefixer: ignore next */\n -webkit-box-orient: vertical;\n overflow: hidden;\n /* stylelint-enable value-no-vendor-prefix */\n /* stylelint-enable property-no-vendor-prefix */\n margin: 0;\n font-size: 12px;\n font-weight: 400;\n line-height: 18px;\n letter-spacing: 0.01px;\n color: #9d9dae;\n}\n\n.pera-wallet-connect-modal-pending-message__animation-wrapper {\n width: 56px;\n height: 56px;\n background-color: #6b46fe;\n border-radius: 50%;\n}\n\n.pera-wallet-connect-modal-pending-message__text {\n max-width: 271px;\n margin-top: 24px;\n color: #3c3c49;\n font-size: 18px;\n font-weight: 500;\n line-height: 28px;\n letter-spacing: -0.26px;\n}\n\n.pera-wallet-connect-modal-pending-message__cancel-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n padding: 14px;\n color: #6a6a81;\n background-color: #ffffff;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n border-radius: 12px;\n text-decoration: none;\n text-align: center;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.09px;\n font-weight: 500;\n border: none;\n}';l(V);const q=document.createElement("template");q.innerHTML='\n
    \n
    \n
    \n\n
    \n Please wait while we connect you to Pera Wallet\n
    \n
    \n\n \n Cancel\n \n
    \n\n
    \n';const z=`\n
    \n
    \n Pera Wallet Logo\n\n

    \n Couldn\u2019t establish connection\n

    \n\n

    \n Having issues? Before trying again, make sure to read the support article below and apply the possible solutions.\n

    \n
    \n\n
    \n \n \n\n
    \n \n \n Resolving WalletConnect issues\n \n\n Send Icon\n
    \n\n \n Unfortunately there are several known issues related to WalletConnect that our team is working on. Some of these issues are related to the WalletConnect JavaScript implementation on the dApp ...\n

    \n
    \n \n\n \n
    \n \n `;class H extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=V,this.shadowRoot.append(q.content.cloneNode(!0),e)}}connectedCallback(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-pending-message-cancel-button");null==t||t.addEventListener("click",(()=>{this.onClose()})),this.addAudioForConnection(),this.renderLottieAnimation(),setTimeout((()=>{var e;if(q.innerHTML=z,this.shadowRoot){const t=document.createElement("style");t.textContent=V,this.shadowRoot.innerHTML="",this.shadowRoot.append(q.content.cloneNode(!0),t);const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-pending-message-try-again-button");null==n||n.addEventListener("click",(()=>{this.onClose()}))}}),3e4)}onClose(){r.removeModalWrapperFromDOM(r.PERA_WALLET_CONNECT_MODAL_ID)}addAudioForConnection(){var e;if("true"===this.getAttribute("should-use-sound")&&r.isIOS()){const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-pending-message-audio-wrapper"),n=document.createElement("audio");n.src="https://s3.amazonaws.com/wc.perawallet.app/audio.mp3",n.autoplay=!0,n.loop=!0,null==t||t.appendChild(n)}}renderLottieAnimation(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-pending-message-animation-wrapper");t&&c.default.loadAnimation({container:t,renderer:"svg",loop:!0,autoplay:!0,path:"https://s3.amazonaws.com/wc.perawallet.app/static/pera-loader-animation.json"})}}var W='.pera-wallet-sign-txn-toast {\n --pera-wallet-sign-txn-toast-width: 422px;\n --pera-wallet-sign-txn-toast-height: 134px;\n --pera-wallet-sign-txn-toast-font-family: "Inter", sans-serif;\n position: fixed;\n bottom: 28px;\n right: 35px;\n z-index: 11;\n overflow: hidden;\n width: var(--pera-wallet-sign-txn-toast-width);\n height: var(--pera-wallet-sign-txn-toast-height);\n background: #edeffb;\n border-radius: 8px;\n animation: 0.2s PeraWalletSignTxnToastSlideIn ease-out;\n}\n.pera-wallet-sign-txn-toast * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-sign-txn-toast-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-sign-txn-toast ul,\n.pera-wallet-sign-txn-toast ol,\n.pera-wallet-sign-txn-toast li {\n list-style-type: none;\n}\n\n.pera-wallet-sign-txn-toast__header__close-button {\n position: absolute;\n top: 10px;\n right: 10px;\n width: 20px;\n height: 20px;\n margin: 0;\n padding: 0;\n background: transparent;\n border: none;\n cursor: pointer;\n}\n\n.pera-wallet-sign-txn-toast__content__lottie-animation {\n position: absolute;\n top: -75px;\n left: -100px;\n width: 368px;\n height: 368px;\n}\n\n.pera-wallet-sign-txn-toast__content__description {\n position: absolute;\n top: 40px;\n right: 48px;\n max-width: 197px;\n color: #3c3c49;\n font-size: 14px;\n line-height: 22px;\n letter-spacing: -0.1px;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-sign-txn-toast {\n display: none;\n }\n}\n@keyframes PeraWalletSignTxnToastSlideIn {\n 0% {\n bottom: 12px;\n opacity: 0;\n }\n 100% {\n bottom: 26px;\n opacity: 1;\n }\n}';l(W);const G=document.createElement("template");G.innerHTML='\n
    \n
    \n \n \n \n
    \n
    \n
    \n

    \n Please launch Pera Wallet on your iOS or Android device to sign this transaction.\n

    \n
    \n
    \n';class Z extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=W,this.shadowRoot.append(G.content.cloneNode(!0),e);const t=this.shadowRoot.getElementById("pera-wallet-sign-txn-toast-close-button");null==t||t.addEventListener("click",(()=>{r.removeModalWrapperFromDOM(r.PERA_WALLET_SIGN_TXN_TOAST_ID)})),this.renderLottieAnimation()}}renderLottieAnimation(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-sign-txn-toast-lottie-animation");t&&c.default.loadAnimation({container:t,renderer:"svg",loop:!0,autoplay:!0,path:"https://s3.amazonaws.com/wc.perawallet.app/static/sign-toast-animation.json"})}}var K='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");\n.pera-wallet-modal {\n --pera-wallet-modal-font-family: "Inter", sans-serif;\n --pera-wallet-modal-compact-width: 380px;\n --pera-wallet-modal-compact-height: 396px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 999999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n}\n.pera-wallet-modal--select-account .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body {\n top: 40px;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: unset;\n height: calc(100 * var(--vh));\n padding: 20px;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);\n border-radius: 20px 20px 0px 0px;\n animation: 0.3s PeraWalletConnectMobileSlideIn ease-out;\n overflow-y: auto;\n transform: unset;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body::before {\n background-image: unset;\n}\n.pera-wallet-modal--compact:not(.pera-wallet-modal--mobile) .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n padding: 0;\n}\n.pera-wallet-modal * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-modal ul,\n.pera-wallet-modal ol,\n.pera-wallet-modal li {\n list-style-type: none;\n}\n\n.pera-wallet-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: auto;\n height: 48px;\n padding: 14px;\n border: none;\n border-radius: 12px;\n outline: none;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 14px;\n}\n\n.pera-wallet-modal__logo img {\n display: block;\n width: 32px;\n}\n\n.pera-wallet-modal__body {\n position: relative;\n top: 50%;\n left: 50%;\n width: 700px;\n max-width: calc(100vw - 80px);\n padding: 28px;\n background-color: #f3f3f7;\n box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.08);\n border-radius: 24px;\n animation: 0.3s PeraWalletConnectSlideIn ease-out;\n transform: translate(-50%, -50%);\n}\n.pera-wallet-modal__body::before {\n --background-line: #1e0972 0 1.2px, transparent 0 calc(100% - 1.2px), #1e0972;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: "";\n background-image: linear-gradient(var(--background-line)), linear-gradient(90deg, var(--background-line));\n background-size: 116px 116px;\n mix-blend-mode: overlay;\n border-radius: 24px;\n opacity: 0.8;\n pointer-events: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-modal--desktop .pera-wallet-modal__body {\n width: 100%;\n max-width: calc(100vw - 32px);\n padding: 24px;\n }\n}\n@keyframes PeraWalletConnectSlideIn {\n 0% {\n opacity: 0;\n transform: translate(-50%, calc(-50% + 24px));\n }\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n}\n@keyframes PeraWalletConnectMobileSlideIn {\n 0% {\n top: 30%;\n opacity: 0;\n }\n 100% {\n top: 40px;\n opacity: 1;\n }\n}\n.pera-wallet-sign-txn-modal.pera-wallet-modal .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n background-image: unset;\n padding: 0;\n}\n.pera-wallet-sign-txn-modal.pera-wallet-modal .pera-wallet-modal__body .pera-wallet-sign-txn-modal__body__content {\n width: 100%;\n height: 100%;\n}\n.pera-wallet-sign-txn-modal.pera-wallet-modal .pera-wallet-modal__body #pera-wallet-iframe {\n width: 100%;\n height: 100%;\n border-radius: 16px;\n margin: 0 auto;\n border: none;\n}\n\n.pera-wallet-sign-txn-modal--compact.pera-wallet-modal .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n}';l(K);const X=document.createElement("template");X.innerHTML=`\n
    \n
    \n \n\n
    \n
    \n
    \n`;class Y extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");if(e.textContent=K,this.shadowRoot.append(X.content.cloneNode(!0),e),"true"===this.getAttribute("compact-mode")){const e=this.shadowRoot.getElementById("pera-wallet-sign-txn-modal");null==e||e.classList.add("pera-wallet-sign-txn-modal--compact")}}}}function J(){document.documentElement.style.setProperty("--vh",.01*window.innerHeight+"px")}window.addEventListener("DOMContentLoaded",(()=>{J()})),window.addEventListener("resize",(()=>{J()})),window.customElements.define("pera-wallet-connect-modal",O),window.customElements.define("pera-wallet-modal-desktop-mode",_),window.customElements.define("pera-wallet-modal-header",p),window.customElements.define("pera-wallet-modal-touch-screen-mode",k),window.customElements.define("pera-wallet-redirect-modal",B),window.customElements.define("pera-wallet-connect-modal-information-section",F),window.customElements.define("pera-wallet-connect-modal-pending-message-section",H),window.customElements.define("pera-wallet-sign-txn-toast",Z),window.customElements.define("pera-wallet-sign-txn-modal",Y),window.customElements.define("pera-wallet-download-qr-code",y)},8150:function(e,t,n){"use strict";var r=n(93548).lW,i=n(92725),o=n(81338),s=n(51206);function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(i),u=a(o),l=a(s);function d(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}class f extends Error{constructor(e,t,...n){super(...n),Error.captureStackTrace&&Error.captureStackTrace(this,f),this.name="PeraWalletConnectError",this.data=e,this.message=t}}const h=new class{constructor(e){this.listener=void 0,this.channel=e.channel}setupListener({onReceiveMessage:e}){this.close(),this.listener=t=>{if("object"==typeof t.data)try{t.data.channel===this.channel&&e(t)}catch(e){console.error(e)}},window.addEventListener("message",this.listener)}sendMessage({message:e,targetWindow:t,origin:n,timeout:r=1e3}){setTimeout((()=>{const r={channel:this.channel,message:e};t.postMessage(r,{targetOrigin:n||"*"})}),r)}close(){this.listener&&(window.removeEventListener("message",this.listener),this.listener=void 0)}}({channel:"pera-web-wallet"});function p(){const e=document.querySelector('meta[name="name"]'),t=document.querySelector('meta[name="description"]');let{title:n}=document,r="";return e instanceof HTMLMetaElement&&(n=e.content),t instanceof HTMLMetaElement&&(r=t.content),{title:n,description:r,url:window.location.origin,favicon:g()[0]}}function g(){const e=document.getElementsByTagName("link"),t=[];for(let n=0;n-1){const e=r.getAttribute("href");if(e&&-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=`${window.location.protocol}//${window.location.host}`;if(0===e.indexOf("/"))n+=e;else{const t=window.location.pathname.split("/");t.pop(),n+=`${t.join("/")}/${e}`}t.push(n)}else if(0===(null==e?void 0:e.indexOf("//"))){const n=window.location.protocol+e;t.push(n)}else e&&t.push(e)}}return t}function m(e){return new Promise(((t,n)=>{try{const r=window.open(e,"_blank");let i=0;const o=setInterval((()=>{if(i+=1,50===i)return clearInterval(o),void n(new f({type:"MESSAGE_NOT_RECEIVED"},"Couldn't open Pera Wallet, please try again."));r&&(!0===r.closed&&(clearInterval(o),n(new f({type:"OPERATION_CANCELLED"},"Operation cancelled by user"))),h.sendMessage({message:{type:"TAB_OPEN"},origin:e,targetWindow:r}))}),700);h.setupListener({onReceiveMessage:e=>{"TAB_OPEN_RECEIVED"===e.data.message.type&&(clearInterval(o),t(r))}})}catch(e){n(e)}}))}function b(e){const t=document.createElement("div");return t.setAttribute("id",e),document.body.appendChild(t),t}function y(){b("pera-wallet-redirect-modal-wrapper").innerHTML=""}function v(){b("pera-wallet-sign-txn-toast-wrapper").innerHTML=""}function w(e){const t=document.getElementById(e);t&&t.remove()}const x="PeraWallet.Wallet",S="walletconnect";function A(){return"undefined"==typeof localStorage?void 0:localStorage}function E(e,t){var n;null===(n=A())||void 0===n||n.setItem(x,JSON.stringify({type:t||"pera-wallet",accounts:e,selectedAccount:e[0]}))}function _(){var e;const t=null===(e=A())||void 0===e?void 0:e.getItem(x);return t?JSON.parse(t):null}function C(){return new Promise(((e,t)=>{var n,r;try{null===(n=A())||void 0===n||n.removeItem(S),null===(r=A())||void 0===r||r.removeItem(x),e(void 0)}catch(e){t(e)}}))}function I(e){const t=e.slice();for(let n=t.length-1;n>0;n--){const e=Math.floor(Math.random()*(n+1));[t[n],t[e]]=[t[e],t[n]]}return t}function k(){return d(this,void 0,void 0,(function*(){let e={bridgeURL:"",webWalletURL:"",isWebWalletAvailable:!1,shouldDisplayNewBadge:!1,shouldUseSound:!0,silent:!1,promoteMobile:!1};try{const t=yield function(e,t={}){return fetch("https://wc.perawallet.app/config.json",t).then((e=>e.json())).then((e=>e))}(0,{cache:"no-store"});void 0!==t.web_wallet&&t.web_wallet_url&&(e.isWebWalletAvailable=t.web_wallet),void 0!==t.display_new_badge&&(e.shouldDisplayNewBadge=t.display_new_badge),void 0!==t.use_sound&&(e.shouldUseSound=t.use_sound),void 0!==t.silent&&(e.silent=t.silent),void 0!==t.promote_mobile&&(e.promoteMobile=t.promote_mobile),e=Object.assign(Object.assign({},e),{bridgeURL:I(t.servers||[])[0]||"",webWalletURL:t.web_wallet_url||""})}catch(e){console.log(e)}return e}))}function T(e){return Uint8Array.from(window.atob(e),(e=>e.charCodeAt(0)))}function M(e,t){return{id:Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3)),jsonrpc:"2.0",method:e,params:t}}function P(){return"undefined"!=typeof navigator}function O(){return P()&&/Android/i.test(navigator.userAgent)}function R(){return P()&&/iPhone|iPod|Android/i.test(navigator.userAgent)}const N=O()?"algorand://":"perawallet-wc://";function B(e){return{ROOT:`https://${e}`,CONNECT:`https://${e}/connect`,TRANSACTION_SIGN:`https://${e}/transaction/sign`}}function L({method:e,signTxnRequestParams:t,signer:n,chainId:r,webWalletURL:i,resolve:o,reject:s}){const a=B(i);!function(){d(this,void 0,void 0,(function*(){try{const i=yield m(a.TRANSACTION_SIGN);if(i){let o;"SIGN_TXN"===e?o={type:"SIGN_TXN",txn:t}:"SIGN_DATA"===e&&n&&r&&(o={type:"SIGN_DATA",data:t,signer:n,chainId:r}),o&&h.sendMessage({message:o,origin:a.TRANSACTION_SIGN,targetWindow:i})}const c=setInterval((()=>{!0===(null==i?void 0:i.closed)&&(s(new f({type:`${e}_CANCELLED`},"Transaction signing is cancelled by user.")),clearInterval(c))}),2e3);h.setupListener({onReceiveMessage:t=>function({event:e,newPeraWalletTab:t,method:n,resolve:r,reject:i}){switch(e.data.message.type){case"SIGN_TXN_CALLBACK":null==t||t.close(),r(e.data.message.signedTxns.map((e=>T(e.signedTxn))));break;case"SIGN_DATA_CALLBACK":null==t||t.close(),r(e.data.message.signedData.map((e=>T(e.signedData))));break;case"SIGN_TXN_NETWORK_MISMATCH":i(new f({type:`${n}_NETWORK_MISMATCH`,detail:e.data.message.error},e.data.message.error||"Network mismatch"));break;case"SIGN_TXN_CALLBACK_ERROR":null==t||t.close(),i(new f({type:`${n}_CANCELLED`},e.data.message.error));break;case"SESSION_DISCONNECTED":null==t||t.close(),C(),i(new f({type:"SESSION_DISCONNECTED",detail:e.data.message.error},e.data.message.error))}}({event:t,newPeraWalletTab:i,method:e,resolve:o,reject:s})})}catch(e){s(e)}}))}()}function D({webWalletURL:e,chainId:t,resolve:n,reject:r}){const i=B(e);return function(){return d(this,void 0,void 0,(function*(){try{const e=yield m(i.CONNECT);e&&h.sendMessage({message:{type:"CONNECT",data:Object.assign(Object.assign({},p()),{chainId:t})},origin:i.CONNECT,targetWindow:e});const s=setInterval((()=>{!0===(null==e?void 0:e.closed)&&(r(new f({type:"CONNECT_CANCELLED"},"Connect is cancelled by user")),clearInterval(s),o())}),2e3);h.setupListener({onReceiveMessage:t=>function({event:e,newPeraWalletTab:t,resolve:n,reject:r}){if(n&&"CONNECT_CALLBACK"===e.data.message.type){const r=e.data.message.data.addresses;E(r,"pera-wallet-web"),n(r),w("pera-wallet-connect-modal-wrapper"),null==t||t.close()}else"CONNECT_NETWORK_MISMATCH"===e.data.message.type&&(r(new f({type:"CONNECT_NETWORK_MISMATCH",detail:e.data.message.error},e.data.message.error||"Your wallet is connected to a different network to this dApp. Update your wallet to the correct network (MainNet or TestNet) to continue.")),w("pera-wallet-connect-modal-wrapper"),null==t||t.close())}({event:t,newPeraWalletTab:e,resolve:n,reject:r})})}catch(e){o(),r(e)}}))};function o(){w("pera-wallet-connect-modal-wrapper")}}function U({isWebWalletAvailable:e,shouldDisplayNewBadge:t,shouldUseSound:n,compactMode:r,promoteMobile:i}){return{open:(o={isWebWalletAvailable:e,shouldDisplayNewBadge:t,shouldUseSound:n,compactMode:r,promoteMobile:i},e=>{if(!document.getElementById("pera-wallet-connect-modal-wrapper")){const t=b("pera-wallet-connect-modal-wrapper"),n=`${e}&algorand=true`,{isWebWalletAvailable:r,shouldDisplayNewBadge:i,shouldUseSound:s,compactMode:a,promoteMobile:c}=o;t.innerHTML=``}}),close:()=>w("pera-wallet-connect-modal-wrapper")};var o}"undefined"!=typeof window&&(window.global=window,window.Buffer=window.Buffer||n(93548).lW,Promise.resolve().then((function(){return n(37400)}))),t.PERA_DOWNLOAD_URL="https://perawallet.app/download/",t.PERA_WALLET_APP_DEEP_LINK=N,t.PERA_WALLET_CONNECT_MODAL_ID="pera-wallet-connect-modal-wrapper",t.PERA_WALLET_MODAL_CLASSNAME="pera-wallet-modal",t.PERA_WALLET_REDIRECT_MODAL_ID="pera-wallet-redirect-modal-wrapper",t.PERA_WALLET_SIGN_TXN_MODAL_ID="pera-wallet-sign-txn-modal-wrapper",t.PERA_WALLET_SIGN_TXN_TOAST_ID="pera-wallet-sign-txn-toast-wrapper",t.PeraWalletConnect=class{constructor(e){this.bridge=(null==e?void 0:e.bridge)||"",this.connector=null,this.shouldShowSignTxnToast=void 0===(null==e?void 0:e.shouldShowSignTxnToast)||e.shouldShowSignTxnToast,this.chainId=null==e?void 0:e.chainId,this.compactMode=(null==e?void 0:e.compactMode)||!1}get platform(){return function(){const e=_();let t=null;return"pera-wallet"===(null==e?void 0:e.type)?t="mobile":"pera-wallet-web"===(null==e?void 0:e.type)&&(t="web"),t}()}get isConnected(){var e;return"mobile"===this.platform?!!this.connector:"web"===this.platform&&!!(null===(e=_())||void 0===e?void 0:e.accounts.length)}connect(){return new Promise(((e,t)=>d(this,void 0,void 0,(function*(){var n;try{if(null===(n=this.connector)||void 0===n?void 0:n.connected)try{yield this.connector.killSession()}catch(e){}const{isWebWalletAvailable:r,bridgeURL:i,webWalletURL:o,shouldDisplayNewBadge:s,shouldUseSound:a,promoteMobile:u}=yield k(),l=D({resolve:e,reject:t,webWalletURL:o,chainId:this.chainId,isCompactMode:this.compactMode});r&&(window.onWebWalletConnect=l),this.connector=new c.default({bridge:this.bridge||i||"https://bridge.walletconnect.org",qrcodeModal:U({isWebWalletAvailable:r,shouldDisplayNewBadge:s,shouldUseSound:a,compactMode:this.compactMode,promoteMobile:u})}),yield this.connector.createSession({chainId:this.chainId||4160}),function(e,t){var n,r,i,o;const s=document.getElementById(e),a=null===(r=null===(n=null==s?void 0:s.querySelector(e.replace("-wrapper","")))||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.querySelector(".pera-wallet-modal"),c=null===(o=null===(i=null==a?void 0:a.querySelector("pera-wallet-modal-header"))||void 0===i?void 0:i.shadowRoot)||void 0===o?void 0:o.getElementById("pera-wallet-modal-header-close-button");null==c||c.addEventListener("click",(()=>{t(),w(e)}))}("pera-wallet-connect-modal-wrapper",(()=>t(new f({type:"CONNECT_MODAL_CLOSED"},"Connect modal is closed by user")))),this.connector.on("connect",((n,r)=>{var i,o;n&&t(n),e((null===(i=this.connector)||void 0===i?void 0:i.accounts)||[]),E((null===(o=this.connector)||void 0===o?void 0:o.accounts)||[])}))}catch(e){console.log(e),t(new f({type:"SESSION_CONNECT",detail:e},e.message||"There was an error while connecting to Pera Wallet"))}}))))}reconnectSession(){return new Promise(((e,t)=>d(this,void 0,void 0,(function*(){var n,r;try{const i=_();if(!i)return void e([]);if("pera-wallet-web"===(null==i?void 0:i.type)){const{isWebWalletAvailable:n}=yield k();n?e(i.accounts||[]):t(new f({type:"SESSION_RECONNECT",detail:"Pera Web is not available"},"Pera Web is not available"))}this.connector&&e(this.connector.accounts||[]),this.bridge=(null===(n=function(){var e;const t=null===(e=A())||void 0===e?void 0:e.getItem(S);return t?JSON.parse(t):null}())||void 0===n?void 0:n.bridge)||"",this.bridge&&(this.connector=new c.default({bridge:this.bridge}),e((null===(r=this.connector)||void 0===r?void 0:r.accounts)||[])),this.isConnected||e([])}catch(e){yield this.disconnect(),t(new f({type:"SESSION_RECONNECT",detail:e},e.message||"There was an error while reconnecting to Pera Wallet"))}}))))}disconnect(){var e;return d(this,void 0,void 0,(function*(){let t;this.isConnected&&"mobile"===this.platform&&(t=null===(e=this.connector)||void 0===e?void 0:e.killSession(),null==t||t.then((()=>{this.connector=null}))),yield C()}))}signTransactionWithMobile(e){return d(this,void 0,void 0,(function*(){const t=M("algo_signTxn",[e]);try{try{const{silent:e}=yield k(),n=(yield this.connector.sendCustomRequest(t,{forcePushNotification:!e})).filter(Boolean);return"string"==typeof n[0]?n.map(T):n.map((e=>Uint8Array.from(e)))}catch(e){return yield Promise.reject(new f({type:"SIGN_TRANSACTIONS",detail:e},e.message||"Failed to sign transaction"))}}finally{w("pera-wallet-redirect-modal-wrapper"),w("pera-wallet-sign-txn-toast-wrapper")}}))}signTransactionWithWeb(e,t){return new Promise(((n,r)=>L({signTxnRequestParams:e,webWalletURL:t,method:"SIGN_TXN",resolve:n,reject:r})))}signDataWithMobile({data:e,signer:t,chainId:n}){return d(this,void 0,void 0,(function*(){const r=M("algo_signData",e.map((e=>Object.assign(Object.assign({},e),{signer:t,chainId:n}))));try{try{const{silent:e}=yield k(),t=(yield this.connector.sendCustomRequest(r,{forcePushNotification:!e})).filter(Boolean);return"string"==typeof t[0]?t.map(T):t.map((e=>Uint8Array.from(e)))}catch(e){return yield Promise.reject(new f({type:"SIGN_TRANSACTIONS",detail:e},e.message||"Failed to sign transaction"))}}finally{w("pera-wallet-redirect-modal-wrapper"),w("pera-wallet-sign-txn-toast-wrapper")}}))}signDataWithWeb({data:e,signer:t,chainId:n,webWalletURL:r}){return new Promise(((i,o)=>L({method:"SIGN_DATA",signTxnRequestParams:e,signer:t,chainId:n,webWalletURL:r,resolve:i,reject:o})))}signTransaction(e,t){return d(this,void 0,void 0,(function*(){if("mobile"===this.platform&&(R()?y():!R()&&this.shouldShowSignTxnToast&&v(),!this.connector))throw new Error("PeraWalletConnect was not initialized correctly.");const n=e.flatMap((e=>e.map((e=>function(e,t){let n;t&&!(e.signers||[]).includes(t)&&(n=[]);const i={txn:(o=e.txn,r.from(u.default.encodeUnsignedTransaction(o)).toString("base64"))};var o;return Array.isArray(n)&&(i.signers=n),e.authAddr&&(i.authAddr=e.authAddr),e.message&&(i.message=e.message),e.msig&&(i.msig=e.msig),i}(e,t)))));if("web"===this.platform){const{webWalletURL:e}=yield k();return this.signTransactionWithWeb(n,e)}return this.signTransactionWithMobile(n)}))}signData(e,t){return d(this,void 0,void 0,(function*(){const n=this.chainId||4160;if("mobile"===this.platform&&(R()?y():!R()&&this.shouldShowSignTxnToast&&v(),!this.connector))throw new Error("PeraWalletConnect was not initialized correctly.");if("web"===this.platform){const{webWalletURL:r}=yield k();return this.signDataWithWeb({data:e,signer:t,chainId:n,webWalletURL:r})}const i=e.map((e=>Object.assign(Object.assign({},e),{data:r.from(e.data).toString("base64")})));return this.signDataWithMobile({data:i,signer:t,chainId:n})}))}},t.closePeraWalletSignTxnToast=function(){w("pera-wallet-sign-txn-toast-wrapper")},t.detectBrowser=function(){if(!P())return null;const{userAgent:e}=navigator;let t;return t=e.match(/DuckDuckGo/i)?"DuckDuckGo":e.match(/OPX/i)?"Opera GX":navigator.brave?"Brave":l.default.getParser(navigator.userAgent).getBrowserName(),t},t.isAndroid=O,t.isIOS=function(){return P()&&/iPhone|iPad|iPod/i.test(navigator.userAgent)},t.isMobile=R,t.removeModalWrapperFromDOM=w},92339:function(e,t,n){"use strict";var r=n(8150);n(92725),n(81338),n(51206),t.DQ=r.PeraWalletConnect,r.closePeraWalletSignTxnToast},92725:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Ze}});var r={};n.r(r),n.d(r,{decrypt:function(){return Ge},encrypt:function(){return We},generateKey:function(){return ze},verifyHmac:function(){return He}});var i=n(68364),o=n(40957),s=n(34155),a=function(){for(var e=0,t=0,n=arguments.length;t1)}())}function S(){return!function(){const e=v();return!(!e||!e.name)&&"node"===e.name.toLowerCase()}()&&!!A()}o.getFromWindow,o.getFromWindowOrThrow,o.getDocumentOrThrow,o.getDocument,o.getNavigatorOrThrow;const A=o.getNavigator,E=(o.getLocationOrThrow,o.getLocation),_=(o.getCryptoOrThrow,o.getCrypto,o.getLocalStorageOrThrow,o.getLocalStorage);function C(){return i.D()}const I=function(e){if("string"!==typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}},k=function(e){return"string"===typeof e?e:JSON.stringify(e)};function T(e){let t=null,n=null;const r=_();return r&&(n=r.getItem(e)),t=n?I(n):n,t}function M(e){const t=_();t&&t.removeItem(e)}const P="WALLETCONNECT_DEEPLINK_CHOICE";const O=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],R=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"];var N=n(11460),B=n.n(N),L=(n(4501),n(65054)),D=n.n(L),U=n(48764).Buffer;const j="hex",F="utf8",V="0";function q(e){return new Uint8Array(e)}function z(e,t=!1){const n=e.toString(j);return t?ne(n):n}function H(e){return e.toString(F)}function W(e){return D()(e)}function G(e,t=!1){return z(W(e),t)}function Z(e){return H(W(e))}function K(e){return U.from(te(e),j)}function X(e){return q(K(e))}function Y(e){return U.from(e,F)}function J(e){return q(Y(e))}function Q(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}function $(...e){let t=[];return e.forEach((e=>t=t.concat(Array.from(e)))),new Uint8Array([...t])}function ee(e,t=8,n="0"){return function(e,t,n="0"){return ie(e,t,!0,n)}(e,function(e,t=8){const n=e%t;return n?(e-n)/t*t+t:e}(e.length,t),n)}function te(e){return e.replace(/^0x/,"")}function ne(e){return e.startsWith("0x")?e:`0x${e}`}function re(e){return(e=ee(e=te(e),2))&&(e=ne(e)),e}function ie(e,t,n,r="0"){const i=t-e.length;let o=e;if(i>0){const t=r.repeat(i);o=n?t+e:e+t}return o}function oe(e){return W(new Uint8Array(e))}function se(e,t){return function(e,t=!1){return z(Y(e),t)}(e,!t)}function ae(e,t){const n=te(re(new(B())(e).toString(16)));return t?n:ne(n)}var ce=n(91094);var ue=n(1468);function le(){return Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}function de(e){return re(e)}function fe(e){return function(e){const t=e.startsWith("0x");return e=(e=te(e)).startsWith(V)?e.substring(1):e,t?ne(e):e}(ne(e))}const he=le;function pe(){return((e,t)=>{for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t})()}function ge(e,t){return Q(e,t)}function me(e){return"undefined"!==typeof e.result}function be(e){return"undefined"!==typeof e.error}function ye(e){return"undefined"!==typeof e.event}function ve(e){e=te(e.toLowerCase());const t=te((0,ce.keccak_256)(Y(e)));let n="";for(let r=0;r7?n+=e[r].toUpperCase():n+=e[r];return ne(n)}function we(e){var t;return(t=e)&&t.length&&!ge(e[0])&&(e[0]=se(e[0])),e}function xe(e){if("undefined"!==typeof e.type&&"0"!==e.type)return e;if("undefined"===typeof e.from||(!(t=e.from)||"0x"!==t.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(t)||!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t)&&t!==ve(t)))throw new Error("Transaction object must include a valid 'from' value.");var t;function n(e){let t=e;return("number"===typeof e||"string"===typeof e&&!function(e){return""===e||"string"===typeof e&&""===e.trim()}(e))&&(ge(e)?"string"===typeof e&&(t=de(e)):t=ae(e)),"string"===typeof t&&(t=fe(t)),t}const r={from:de(e.from),to:"undefined"===typeof e.to?void 0:de(e.to),gasPrice:"undefined"===typeof e.gasPrice?"":n(e.gasPrice),gas:"undefined"===typeof e.gas?"undefined"===typeof e.gasLimit?"":n(e.gasLimit):n(e.gas),value:"undefined"===typeof e.value?"":n(e.value),nonce:"undefined"===typeof e.nonce?"":n(e.nonce),data:"undefined"===typeof e.data?"":de(e.data)||"0x"},i=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((e=>{("undefined"===typeof r[e]||"string"===typeof r[e]&&!r[e].trim().length)&&i.includes(e)&&delete r[e]})),r}var Se=n(66151);function Ae(e,t){let n=Ee(e);return n=Object.assign(Object.assign({},n),t),e=function(e){return Se.stringify(e)}(n),e}function Ee(e){return Se.parse(e)}var _e=class{constructor(){this._eventEmitters=[],"undefined"!==typeof window&&"undefined"!==typeof window.addEventListener&&(window.addEventListener("online",(()=>this.trigger("online"))),window.addEventListener("offline",(()=>this.trigger("offline"))))}on(e,t){this._eventEmitters.push({event:e,callback:t})}trigger(e){let t=[];e&&(t=this._eventEmitters.filter((t=>t.event===e))),t.forEach((e=>{e.callback()}))}};const Ce="undefined"!==typeof n.g.WebSocket?n.g.WebSocket:n(68007);var Ie=class{constructor(e){if(this.opts=e,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=e.protocol,this._version=e.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=e.subscriptions||[],this._netMonitor=e.netMonitor||new _e,!e.url||"string"!==typeof e.url)throw new Error("Missing or invalid WebSocket url");this._url=e.url,this._netMonitor.on("online",(()=>this._socketCreate()))}set readyState(e){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(e){}get connecting(){return 0===this.readyState}set connected(e){}get connected(){return 1===this.readyState}set closing(e){}get closing(){return 2===this.readyState}set closed(e){}get closed(){return 3===this.readyState}open(){this._socketCreate()}close(){this._socketClose()}send(e,t,n){if(!t||"string"!==typeof t)throw new Error("Missing or invalid topic field");this._socketSend({topic:t,type:"pub",payload:e,silent:!!n})}subscribe(e){this._socketSend({topic:e,type:"sub",payload:"",silent:!0})}on(e,t){this._events.push({event:e,callback:t})}_socketCreate(){if(this._nextSocket)return;const e=function(e,t,n){var r,i;const o=(e.startsWith("https")?e.replace("https","wss"):e.startsWith("http")?e.replace("http","ws"):e).split("?"),s=S()?{protocol:t,version:n,env:"browser",host:(null===(r=E())||void 0===r?void 0:r.host)||""}:{protocol:t,version:n,env:(null===(i=v())||void 0===i?void 0:i.name)||""},a=Ae(function(e){const t=-1!==e.indexOf("?")?e.indexOf("?"):void 0;return"undefined"!==typeof t?e.substr(t):""}(o[1]||""),s);return o[0]+"?"+a}(this._url,this._protocol,this._version);if(this._nextSocket=new Ce(e),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=e=>this._socketReceive(e),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=e=>this._socketError(e),this._nextSocket.onclose=()=>{setTimeout((()=>{this._nextSocket=null,this._socketCreate()}),1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(e){const t=JSON.stringify(e);this._socket&&1===this._socket.readyState?this._socket.send(t):(this._setToQueue(e),this._socketCreate())}async _socketReceive(e){let t;try{t=JSON.parse(e.data)}catch(n){return}if(this._socketSend({topic:t.topic,type:"ack",payload:"",silent:!0}),this._socket&&1===this._socket.readyState){const e=this._events.filter((e=>"message"===e.event));e&&e.length&&e.forEach((e=>e.callback(t)))}}_socketError(e){const t=this._events.filter((e=>"error"===e.event));t&&t.length&&t.forEach((t=>t.callback(e)))}_queueSubscriptions(){this._subscriptions.forEach((e=>this._queue.push({topic:e,type:"sub",payload:"",silent:!0}))),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(e){this._queue.push(e)}_pushQueue(){this._queue.forEach((e=>this._socketSend(e))),this._queue=[]}};const ke="Session currently connected",Te="Session currently disconnected",Me="JSON RPC response format is invalid",Pe="User close QRCode Modal";var Oe=class{constructor(){this._eventEmitters=[]}subscribe(e){this._eventEmitters.push(e)}unsubscribe(e){this._eventEmitters=this._eventEmitters.filter((t=>t.event!==e))}trigger(e){let t,n=[];t="undefined"!==typeof e.method?e.method:me(e)||be(e)?`response:${e.id}`:ye(e)?e.event:"",t&&(n=this._eventEmitters.filter((e=>e.event===t))),n&&n.length||function(e){return O.includes(e)||e.startsWith("wc_")}(t)||ye(t)||(n=this._eventEmitters.filter((e=>"call_request"===e.event))),n.forEach((t=>{if(be(e)){const n=new Error(e.error.message);t.callback(n,null)}else t.callback(null,e)}))}};var Re=class{constructor(e="walletconnect"){this.storageId=e}getSession(){let e=null;const t=T(this.storageId);return t&&"undefined"!==typeof t.bridge&&(e=t),e}setSession(e){return function(e,t){const n=k(t),r=_();r&&r.setItem(e,n)}(this.storageId,e),e}removeSession(){M(this.storageId)}};const Ne="abcdefghijklmnopqrstuvwxyz0123456789".split("").map((e=>`https://${e}.bridge.walletconnect.org`));function Be(){return Ne[Math.floor(Math.random()*Ne.length)]}var Le=class{constructor(e){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new Oe,this._clientMeta=C()||e.connectorOpts.clientMeta||null,this._cryptoLib=e.cryptoLib,this._sessionStorage=e.sessionStorage||new Re(e.connectorOpts.storageId),this._qrcodeModal=e.connectorOpts.qrcodeModal,this._qrcodeModalOptions=e.connectorOpts.qrcodeModalOptions,this._signingMethods=[...R,...e.connectorOpts.signingMethods||[]],!e.connectorOpts.bridge&&!e.connectorOpts.uri&&!e.connectorOpts.session)throw new Error("Missing one of the required parameters: bridge / uri / session");var t;e.connectorOpts.bridge&&(this.bridge=function(e){return"walletconnect.org"===function(e){return function(e){let t=e.indexOf("//")>-1?e.split("/")[2]:e.split("/")[0];return t=t.split(":")[0],t=t.split("?")[0],t}(e).split(".").slice(-2).join(".")}(e)}(t=e.connectorOpts.bridge)?Be():t),e.connectorOpts.uri&&(this.uri=e.connectorOpts.uri);const n=e.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e.transport||new Ie({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),e.connectorOpts.uri&&this._subscribeToSessionRequest(),e.pushServerOpts&&this._registerPushServer(e.pushServerOpts)}set bridge(e){e&&(this._bridge=e)}get bridge(){return this._bridge}set key(e){if(!e)return;const t=X(e).buffer;this._key=t}get key(){if(this._key){return e=this._key,t=!0,G(new Uint8Array(e),!t)}var e,t;return""}set clientId(e){e&&(this._clientId=e)}get clientId(){let e=this._clientId;return e||(e=this._clientId=pe()),this._clientId}set peerId(e){e&&(this._peerId=e)}get peerId(){return this._peerId}set clientMeta(e){}get clientMeta(){let e=this._clientMeta;return e||(e=this._clientMeta=C()),e}set peerMeta(e){this._peerMeta=e}get peerMeta(){return this._peerMeta}set handshakeTopic(e){e&&(this._handshakeTopic=e)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(e){e&&(this._handshakeId=e)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(e){if(!e)return;const{handshakeTopic:t,bridge:n,key:r}=this._parseUri(e);this.handshakeTopic=t,this.bridge=n,this.key=r}set chainId(e){this._chainId=e}get chainId(){return this._chainId}set networkId(e){this._networkId=e}get networkId(){return this._networkId}set accounts(e){this._accounts=e}get accounts(){return this._accounts}set rpcUrl(e){this._rpcUrl=e}get rpcUrl(){return this._rpcUrl}set connected(e){}get connected(){return this._connected}set pending(e){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(e){e&&(this._connected=e.connected,this.accounts=e.accounts,this.chainId=e.chainId,this.bridge=e.bridge,this.key=e.key,this.clientId=e.clientId,this.clientMeta=e.clientMeta,this.peerId=e.peerId,this.peerMeta=e.peerMeta,this.handshakeId=e.handshakeId,this.handshakeTopic=e.handshakeTopic)}on(e,t){const n={event:e,callback:t};this._eventManager.subscribe(n)}off(e){this._eventManager.unsubscribe(e)}async createInstantRequest(e){this._key=await this._generateKey();const t=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(e)}]});this.handshakeId=t.id,this.handshakeTopic=pe(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",(()=>{throw new Error(Pe)}));const n=()=>{this.killSession()};try{const e=await this._sendCallRequest(t);return e&&n(),e}catch(r){throw n(),r}}async connect(e){if(!this._qrcodeModal)throw new Error("QRCode Modal not provided");return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(e),new Promise((async(e,t)=>{this.on("modal_closed",(()=>t(new Error(Pe)))),this.on("connect",((n,r)=>{if(n)return t(n);e(r.params[0])}))})))}async createSession(e){if(this._connected)throw new Error(ke);if(this.pending)return;this._key=await this._generateKey();const t=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:e&&e.chainId?e.chainId:null}]});this.handshakeId=t.id,this.handshakeTopic=pe(),this._sendSessionRequest(t,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(e){if(this._connected)throw new Error(ke);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const t={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},n={id:this.handshakeId,jsonrpc:"2.0",result:t};this._sendResponse(n),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(e){if(this._connected)throw new Error(ke);const t=e&&e.message?e.message:"Session Rejected",n=this._formatResponse({id:this.handshakeId,error:{message:t}});this._sendResponse(n),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:t}]}),this._removeStorageSession()}updateSession(e){if(!this._connected)throw new Error(Te);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const t={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},n=this._formatRequest({method:"wc_sessionUpdate",params:[t]});this._sendSessionRequest(n,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(e){const t=e?e.message:"Session Disconnected",n=this._formatRequest({method:"wc_sessionUpdate",params:[{approved:!1,chainId:null,networkId:null,accounts:null}]});await this._sendRequest(n),this._handleSessionDisconnect(t)}async sendTransaction(e){if(!this._connected)throw new Error(Te);const t=xe(e),n=this._formatRequest({method:"eth_sendTransaction",params:[t]});return await this._sendCallRequest(n)}async signTransaction(e){if(!this._connected)throw new Error(Te);const t=xe(e),n=this._formatRequest({method:"eth_signTransaction",params:[t]});return await this._sendCallRequest(n)}async signMessage(e){if(!this._connected)throw new Error(Te);const t=this._formatRequest({method:"eth_sign",params:e});return await this._sendCallRequest(t)}async signPersonalMessage(e){if(!this._connected)throw new Error(Te);e=we(e);const t=this._formatRequest({method:"personal_sign",params:e});return await this._sendCallRequest(t)}async signTypedData(e){if(!this._connected)throw new Error(Te);const t=this._formatRequest({method:"eth_signTypedData",params:e});return await this._sendCallRequest(t)}async updateChain(e){if(!this._connected)throw new Error("Session currently disconnected");const t=this._formatRequest({method:"wallet_updateChain",params:[e]});return await this._sendCallRequest(t)}unsafeSend(e,t){return this._sendRequest(e,t),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:t}]}),new Promise(((t,n)=>{this._subscribeToResponse(e.id,((e,r)=>{if(e)n(e);else{if(!r)throw new Error("Missing JSON RPC response");t(r)}}))}))}async sendCustomRequest(e,t){if(!this._connected)throw new Error(Te);switch(e.method){case"eth_accounts":return this.accounts;case"eth_chainId":return ae(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":e.params&&(e.params[0]=xe(e.params[0]));break;case"personal_sign":e.params&&(e.params=we(e.params))}const n=this._formatRequest(e);return await this._sendCallRequest(n,t)}approveRequest(e){if(!me(e))throw new Error('JSON-RPC success response must include "result" field');{const t=this._formatResponse(e);this._sendResponse(t)}}rejectRequest(e){if(!be(e))throw new Error('JSON-RPC error response must include "error" field');{const t=this._formatResponse(e);this._sendResponse(t)}}transportClose(){this._transport.close()}async _sendRequest(e,t){const n=this._formatRequest(e),r=await this._encrypt(n),i="undefined"!==typeof(null===t||void 0===t?void 0:t.topic)?t.topic:this.peerId,o=JSON.stringify(r),s="undefined"!==typeof(null===t||void 0===t?void 0:t.forcePushNotification)?!t.forcePushNotification:function(e){return!!e.method.startsWith("wc_")||!R.includes(e.method)}(n);this._transport.send(o,i,s)}async _sendResponse(e){const t=await this._encrypt(e),n=this.peerId,r=JSON.stringify(t);this._transport.send(r,n,!0)}async _sendSessionRequest(e,t,n){this._sendRequest(e,n),this._subscribeToSessionResponse(e.id,t)}_sendCallRequest(e,t){return this._sendRequest(e,t),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:t}]}),this._subscribeToCallResponse(e.id)}_formatRequest(e){if("undefined"===typeof e.method)throw new Error('JSON RPC request must have valid "method" value');return{id:"undefined"===typeof e.id?he():e.id,jsonrpc:"2.0",method:e.method,params:"undefined"===typeof e.params?[]:e.params}}_formatResponse(e){if("undefined"===typeof e.id)throw new Error('JSON RPC request must have valid "id" value');const t={id:e.id,jsonrpc:"2.0"};if(be(e)){const n=function(e){const t=e.message||"Failed or Rejected Request";let n=-32e3;if(e&&!e.code)switch(t){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}const r={code:n,message:t};return e.data&&(r.data=e.data),r}(e.error);return Object.assign(Object.assign(Object.assign({},t),e),{error:n})}if(me(e)){return Object.assign(Object.assign({},t),e)}throw new Error(Me)}_handleSessionDisconnect(e){const t=e||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),M(P)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:t}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(e,t){t&&t.approved?(this._connected?(t.chainId&&(this.chainId=t.chainId),t.accounts&&(this.accounts=t.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,t.chainId&&(this.chainId=t.chainId),t.accounts&&(this.accounts=t.accounts),t.peerId&&!this.peerId&&(this.peerId=t.peerId),t.peerMeta&&!this.peerMeta&&(this.peerMeta=t.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(e)}async _handleIncomingMessages(e){if(![this.clientId,this.handshakeTopic].includes(e.topic))return;let t;try{t=JSON.parse(e.payload)}catch(r){return}const n=await this._decrypt(t);n&&this._eventManager.trigger(n)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(e,t){this.on(`response:${e}`,t)}_subscribeToSessionResponse(e,t){this._subscribeToResponse(e,((e,n)=>{e?this._handleSessionResponse(e.message):me(n)?this._handleSessionResponse(t,n.result):n.error&&n.error.message?this._handleSessionResponse(n.error.message):this._handleSessionResponse(t)}))}_subscribeToCallResponse(e){return new Promise(((t,n)=>{this._subscribeToResponse(e,((e,r)=>{e?n(e):me(r)?t(r.result):r.error&&r.error.message?n(r.error):n(new Error(Me))}))}))}_subscribeToInternalEvents(){this.on("display_uri",(()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,(()=>{this._eventManager.trigger({event:"modal_closed",params:[]})}),this._qrcodeModalOptions)})),this.on("connect",(()=>{this._qrcodeModal&&this._qrcodeModal.close()})),this.on("call_request_sent",((e,t)=>{const{request:n}=t.params[0];if(x()&&this._signingMethods.includes(n.method)){const e=T(P);e&&(window.location.href=e.href)}})),this.on("wc_sessionRequest",((e,t)=>{e&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:e.toString()}]}),this.handshakeId=t.id,this.peerId=t.params[0].peerId,this.peerMeta=t.params[0].peerMeta;const n=Object.assign(Object.assign({},t),{method:"session_request"});this._eventManager.trigger(n)})),this.on("wc_sessionUpdate",((e,t)=>{e&&this._handleSessionResponse(e.message),this._handleSessionResponse("Session disconnected",t.params[0])}))}_initTransport(){this._transport.on("message",(e=>this._handleIncomingMessages(e))),this._transport.on("open",(()=>this._eventManager.trigger({event:"transport_open",params:[]}))),this._transport.on("close",(()=>this._eventManager.trigger({event:"transport_close",params:[]}))),this._transport.on("error",(()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]}))),this._transport.open()}_formatUri(){return`${this.protocol}:${this.handshakeTopic}@${this.version}?bridge=${encodeURIComponent(this.bridge)}&key=${this.key}`}_parseUri(e){const t=function(e){const t=e.indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=function(e){const t=e.split("@");return{handshakeTopic:t[0],version:parseInt(t[1],10)}}(e.substring(t+1,n)),o=function(e){const t=Ee(e);return{key:t.key||"",bridge:t.bridge||""}}("undefined"!==typeof n?e.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}(e);if(t.protocol===this.protocol){if(!t.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const e=t.handshakeTopic;if(!t.bridge)throw Error("Invalid or missing bridge url parameter value");const n=decodeURIComponent(t.bridge);if(!t.key)throw Error("Invalid or missing key parameter value");return{handshakeTopic:e,bridge:n,key:t.key}}throw new Error("URI format is invalid")}async _generateKey(){if(this._cryptoLib){return await this._cryptoLib.generateKey()}return null}async _encrypt(e){const t=this._key;if(this._cryptoLib&&t){return await this._cryptoLib.encrypt(e,t)}return null}async _decrypt(e){const t=this._key;if(this._cryptoLib&&t){return await this._cryptoLib.decrypt(e,t)}return null}_getStorageSession(){let e=null;return this._sessionStorage&&(e=this._sessionStorage.getSession()),e}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(e){if(!e.url||"string"!==typeof e.url)throw Error("Invalid or missing pushServerOpts.url parameter value");if(!e.type||"string"!==typeof e.type)throw Error("Invalid or missing pushServerOpts.type parameter value");if(!e.token||"string"!==typeof e.token)throw Error("Invalid or missing pushServerOpts.token parameter value");const t={bridge:this.bridge,topic:this.clientId,type:e.type,token:e.token,peerName:"",language:e.language||""};this.on("connect",(async(n,r)=>{if(n)throw n;if(e.peerMeta){const e=r.params[0].peerMeta.name;t.peerName=e}try{const n=await fetch(`${e.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)});if(!(await n.json()).success)throw Error("Failed to register in Push Server")}catch(n){throw Error("Failed to register in Push Server")}}))}};const De="AES-CBC",Ue="HMAC";async function je(e,t="AES-CBC"){return ue.getSubtleCrypto().importKey("raw",e,function(e){return e===De?{length:256,name:De}:{hash:{name:"SHA-256"},name:Ue}}(t),!0,function(e){return e===De?["encrypt","decrypt"]:["sign","verify"]}(t))}function Fe(e,t,n){return async function(e,t,n){const r=ue.getSubtleCrypto(),i=await je(t,De),o=await r.encrypt({iv:e,name:De},i,n);return new Uint8Array(o)}(e,t,n)}function Ve(e,t,n){return async function(e,t,n){const r=ue.getSubtleCrypto(),i=await je(t,De),o=await r.decrypt({iv:e,name:De},i,n);return new Uint8Array(o)}(e,t,n)}async function qe(e,t){const n=await async function(e,t){const n=ue.getSubtleCrypto(),r=await je(e,Ue),i=await n.sign({length:256,name:Ue},r,t);return new Uint8Array(i)}(e,t);return n}async function ze(e){const t=function(e){return ue.getBrowerCrypto().getRandomValues(new Uint8Array(e))}((e||256)/8);return q(W(t)).buffer}async function He(e,t){const n=X(e.data),r=X(e.iv),i=G(X(e.hmac),!1),o=$(n,r),s=G(await qe(t,o),!1);return te(i)===te(s)}async function We(e,t,n){const r=q(oe(t)),i=q(oe(n||await ze(128))),o=G(i,!1),s=J(JSON.stringify(e)),a=await Fe(i,r,s),c=G(a,!1),u=$(a,i);return{data:c,hmac:G(await qe(r,u),!1),iv:o}}async function Ge(e,t){const n=q(oe(t));if(!n)throw new Error("Missing key: required for decryption");if(!(await He(e,n)))return null;const r=X(e.data),i=X(e.iv),o=Z(await Ve(i,n,r));let s;try{s=JSON.parse(o)}catch(a){return null}return s}var Ze=class extends Le{constructor(e,t){super({cryptoLib:r,connectorOpts:e,pushServerOpts:t})}}},93548:function(e,t,n){"use strict";const r=n(79742),i=n(80645),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},84730:function(e){"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!==typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,c=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch(k){o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=p[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modrn(l).toString(e);n=(d=d.idivn(l)).isZero()?g+n:f[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function b(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(e,t,n){return b(e,t,n)}function v(e,t){this.x=e,this.y=t}Math.imul||(m=g),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?g(this,e,t):n<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},v.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new C(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}x.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(S,x),S.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new A;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return w[e]=t,t},C.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},C.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},C.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},C.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},C.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},C.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},C.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},C.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},C.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new I(e)},i(I,C),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},34537:function(e){"use strict";e.exports=function(e,t){var n=new Array(arguments.length-1),r=0,i=2,o=!0;for(;i1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),i=new Array(123),o=0;o<64;)i[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,n){for(var i,o=null,s=[],a=0,c=0;t>2],i=(3&u)<<4,c=1;break;case 1:s[a++]=r[i|u>>4],i=(15&u)<<2,c=2;break;case 2:s[a++]=r[i|u>>6],s[a++]=r[63&u],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=r[i],s[a++]=61,1===c&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";n.decode=function(e,t,n){for(var r,o=n,a=0,c=0;c1)break;if(void 0===(u=i[u]))throw Error(s);switch(a){case 0:r=u,a=1;break;case 1:t[n++]=r<<2|(48&u)>>4,r=u,a=2;break;case 2:t[n++]=(15&r)<<4|(60&u)>>2,r=u,a=3;break;case 3:t[n++]=(3&r)<<6|u,a=0}}if(1===a)throw Error(s);return n-o},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},19211:function(e){"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,r)}}function s(e,t,n){var r=e(t,n),i=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,r),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function a(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:o,e.writeDoubleBE=r?o:i,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,n,r,i,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,i,o+t),e(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))e(0,i,o+t),e(2146959360,i,o+n);else if(r>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+n);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+n);else{var c=Math.floor(Math.log(r)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=r*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+n)}}}function s(e,t,n,r,i){var o=e(r,i+t),s=e(r,i+n),a=2*(s>>31)+1,c=s>>>20&2047,u=4294967296*(1048575&s)+o;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function n(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function r(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},67199:function(module){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},76662:function(e){"use strict";e.exports=function(e,t,n){var r=n||8192,i=r>>>1,o=null,s=r;return function(n){if(n<1||n>i)return e(n);s+n>r&&(o=e(r),s=0);var a=t.call(o,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},94997:function(e,t){"use strict";var n=t;n.length=function(e){for(var t=0,n=0,r=0;r191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},n.write=function(e,t,n){for(var r,i,o=n,s=0;s>6|192,t[n++]=63&r|128):55296===(64512&r)&&56320===(64512&(i=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&i),++s,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}},55664:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(58875);n(45697);var i=n(67294);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n=0;r-=1)this.handlers[r].called||(this.handlers[r].called=!0,this.handlers[r](e));for(var i=n;i>=0;i-=1)this.handlers[i].called=!1}else(0,this.handlers[n])(e)}},{key:"hasHandlers",value:function(){return this.handlers.length>0}},{key:"removeHandlers",value:function(t){for(var n=[],r=this.handlers.length,i=0;i0;var t=this.handlerSets.get(e);return!!t&&t.hasHandlers()}},{key:"removeHandlers",value:function(t,n){var r=g(this.handlerSets);if(!r.has(t))return new e(this.poolName,r);var i=r.get(t).removeHandlers(n);return i.hasHandlers()?r.set(t,i):r.delete(t),new e(this.poolName,r)}}]),e}();u(y,"createByType",(function(e,t,n){var r=new Map;return r.set(t,new p(n)),new y(e,r)}));var v=function(){function e(t){var n=this;s(this,e),u(this,"handlers",new Map),u(this,"pools",new Map),u(this,"target",void 0),u(this,"createEmitter",(function(e){return function(t){n.pools.forEach((function(n){n.dispatchEvent(e,t)}))}})),this.target=t}return c(e,[{key:"addHandlers",value:function(e,t,n){if(this.pools.has(e)){var r=this.pools.get(e);this.pools.set(e,r.addHandlers(t,n))}else this.pools.set(e,y.createByType(e,t,n));this.handlers.has(t)||this.addTargetHandler(t)}},{key:"hasHandlers",value:function(){return this.handlers.size>0}},{key:"removeHandlers",value:function(e,t,n){if(this.pools.has(e)){var r=this.pools.get(e).removeHandlers(t,n);r.hasHandlers()?this.pools.set(e,r):this.pools.delete(e);var i=!1;this.pools.forEach((function(e){return i=i||e.hasHandlers(t)})),i||this.removeTargetHandler(t)}}},{key:"addTargetHandler",value:function(e){var t=this.createEmitter(e);this.handlers.set(e,t),this.target.addEventListener(e,t,!0)}},{key:"removeTargetHandler",value:function(e){this.handlers.has(e)&&(this.target.removeEventListener(e,this.handlers.get(e),!0),this.handlers.delete(e))}}]),e}(),w=function(){function e(){var t=this;s(this,e),u(this,"targets",new Map),u(this,"getTarget",(function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=b(e);if(t.targets.has(r))return t.targets.get(r);if(!n)return null;var i=new v(r);return t.targets.set(r,i),i})),u(this,"removeTarget",(function(e){t.targets.delete(b(e))}))}return c(e,[{key:"sub",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.canUseDOM){var i=n.target,o=void 0===i?document:i,s=n.pool,a=void 0===s?"default":s;this.getTarget(o).addHandlers(a,e,m(t))}}},{key:"unsub",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.canUseDOM){var i=n.target,o=void 0===i?document:i,s=n.pool,a=void 0===s?"default":s,c=this.getTarget(o,!1);c&&(c.removeHandlers(a,e,m(t)),c.hasHandlers()||this.removeTarget(o))}}}]),e}(),x=new w,S=function(e){function t(){return s(this,t),h(this,d(t).apply(this,arguments))}return l(t,i.PureComponent),c(t,[{key:"componentDidMount",value:function(){this.subscribe(this.props)}},{key:"componentDidUpdate",value:function(e){this.unsubscribe(e),this.subscribe(this.props)}},{key:"componentWillUnmount",value:function(){this.unsubscribe(this.props)}},{key:"subscribe",value:function(e){var t=e.name,n=e.on,r=e.pool,i=e.target;x.sub(t,n,{pool:r,target:i})}},{key:"unsubscribe",value:function(e){var t=e.name,n=e.on,r=e.pool,i=e.target;x.unsub(t,n,{pool:r,target:i})}},{key:"render",value:function(){return null}}]),t}();u(S,"defaultProps",{pool:"default",target:"document"}),S.propTypes={},t.instance=x,t.default=S},9695:function(e,t,n){"use strict";var r;r=n(55664),e.exports=r.default,e.exports.instance=r.instance},98099:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(97117);function i(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}function o(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}function d(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}function f(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),l(e/4294967296>>>0,t,n),l(e>>>0,t,n+4),t}function h(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),d(e>>>0,t,n),d(e/4294967296>>>0,t,n+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=d,t.writeInt32LE=d,t.readInt64BE=function(e,t){void 0===t&&(t=0);var n=s(e,t),r=s(e,t+4);return 4294967296*n+r-4294967296*(r>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var n=c(e,t);return 4294967296*c(e,t+4)+n-4294967296*(n>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var n=u(e,t);return 4294967296*u(e,t+4)+n},t.writeUint64BE=f,t.writeInt64BE=f,t.writeUint64LE=h,t.writeInt64LE=h,t.readUintBE=function(e,t,n){if(void 0===n&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,i=1,o=e/8+n-1;o>=n;o--)r+=t[o]*i,i*=256;return r},t.readUintLE=function(e,t,n){if(void 0===n&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,i=1,o=n;o=i;s--)n[s]=t/o&255,o*=256;return n},t.writeUintLE=function(e,t,n,i){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!r.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s>>16|O<<16)|0)>>>20|E<<12,_=(_^=T=T+(R=(R^=x=x+_|0)>>>16|R<<16)|0)>>>20|_<<12,C=(C^=M=M+(N=(N^=S=S+C|0)>>>16|N<<16)|0)>>>20|C<<12,I=(I^=P=P+(B=(B^=A=A+I|0)>>>16|B<<16)|0)>>>20|I<<12,C=(C^=M=M+(N=(N^=S=S+C|0)>>>24|N<<8)|0)>>>25|C<<7,I=(I^=P=P+(B=(B^=A=A+I|0)>>>24|B<<8)|0)>>>25|I<<7,_=(_^=T=T+(R=(R^=x=x+_|0)>>>24|R<<8)|0)>>>25|_<<7,E=(E^=k=k+(O=(O^=w=w+E|0)>>>24|O<<8)|0)>>>25|E<<7,_=(_^=M=M+(B=(B^=w=w+_|0)>>>16|B<<16)|0)>>>20|_<<12,C=(C^=P=P+(O=(O^=x=x+C|0)>>>16|O<<16)|0)>>>20|C<<12,I=(I^=k=k+(R=(R^=S=S+I|0)>>>16|R<<16)|0)>>>20|I<<12,E=(E^=T=T+(N=(N^=A=A+E|0)>>>16|N<<16)|0)>>>20|E<<12,I=(I^=k=k+(R=(R^=S=S+I|0)>>>24|R<<8)|0)>>>25|I<<7,E=(E^=T=T+(N=(N^=A=A+E|0)>>>24|N<<8)|0)>>>25|E<<7,C=(C^=P=P+(O=(O^=x=x+C|0)>>>24|O<<8)|0)>>>25|C<<7,_=(_^=M=M+(B=(B^=w=w+_|0)>>>24|B<<8)|0)>>>25|_<<7;r.writeUint32LE(w+i|0,e,0),r.writeUint32LE(x+o|0,e,4),r.writeUint32LE(S+s|0,e,8),r.writeUint32LE(A+a|0,e,12),r.writeUint32LE(E+c|0,e,16),r.writeUint32LE(_+u|0,e,20),r.writeUint32LE(C+l|0,e,24),r.writeUint32LE(I+d|0,e,28),r.writeUint32LE(k+f|0,e,32),r.writeUint32LE(T+h|0,e,36),r.writeUint32LE(M+p|0,e,40),r.writeUint32LE(P+g|0,e,44),r.writeUint32LE(O+m|0,e,48),r.writeUint32LE(R+b|0,e,52),r.writeUint32LE(N+y|0,e,56),r.writeUint32LE(B+v|0,e,60)}function s(e,t,n,r,s){if(void 0===s&&(s=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(r.length>>=8,t++;if(r>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=s,t.stream=function(e,t,n,r){return void 0===r&&(r=0),i.wipe(n),s(e,t,n,n,r)}},15501:function(e,t,n){"use strict";var r=n(25439),i=n(63027),o=n(17309),s=n(98099),a=n(4153);t.Cv=32,t.WH=12,t.pg=16;var c=new Uint8Array(16),u=function(){function e(e){if(this.nonceLength=t.WH,this.tagLength=t.pg,e.length!==t.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);r.stream(this._key,s,a,4);var c,u=t.length+this.tagLength;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(u);return r.streamXOR(this._key,s,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),n),o.wipe(s),c},e.prototype.open=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&a.update(c.subarray(r.length%16))),a.update(n),n.length%16>0&&a.update(c.subarray(n.length%16));var u=new Uint8Array(8);r&&s.writeUint64LE(r.length,u),a.update(u),s.writeUint64LE(n.length,u),a.update(u);for(var l=a.digest(),d=0;d>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,n){return~(e-1)&t|e-1&n},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=n,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==n(e,t)}},31050:function(e,t,n){"use strict";t.Xx=t._w=t.aP=t.KS=t.jQ=void 0;const r=n(31416),i=n(93350),o=n(17309);function s(e){const t=new Float64Array(16);if(e)for(let n=0;n>16&1),n[t-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,m(r,n,1-e)}for(let i=0;i<16;i++)e[2*i]=255&r[i],e[2*i+1]=r[i]>>8}function y(e,t){let n=0;for(let r=0;r<32;r++)n|=e[r]^t[r];return(1&n-1>>>8)-1}function v(e,t){const n=new Uint8Array(32),r=new Uint8Array(32);return b(n,e),b(r,t),y(n,r)}function w(e){const t=new Uint8Array(32);return b(t,e),1&t[0]}function x(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function S(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function A(e,t,n){let r,i,o=0,s=0,a=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,g=0,m=0,b=0,y=0,v=0,w=0,x=0,S=0,A=0,E=0,_=0,C=0,I=0,k=0,T=0,M=0,P=0,O=0,R=0,N=0,B=0,L=n[0],D=n[1],U=n[2],j=n[3],F=n[4],V=n[5],q=n[6],z=n[7],H=n[8],W=n[9],G=n[10],Z=n[11],K=n[12],X=n[13],Y=n[14],J=n[15];r=t[0],o+=r*L,s+=r*D,a+=r*U,c+=r*j,u+=r*F,l+=r*V,d+=r*q,f+=r*z,h+=r*H,p+=r*W,g+=r*G,m+=r*Z,b+=r*K,y+=r*X,v+=r*Y,w+=r*J,r=t[1],s+=r*L,a+=r*D,c+=r*U,u+=r*j,l+=r*F,d+=r*V,f+=r*q,h+=r*z,p+=r*H,g+=r*W,m+=r*G,b+=r*Z,y+=r*K,v+=r*X,w+=r*Y,x+=r*J,r=t[2],a+=r*L,c+=r*D,u+=r*U,l+=r*j,d+=r*F,f+=r*V,h+=r*q,p+=r*z,g+=r*H,m+=r*W,b+=r*G,y+=r*Z,v+=r*K,w+=r*X,x+=r*Y,S+=r*J,r=t[3],c+=r*L,u+=r*D,l+=r*U,d+=r*j,f+=r*F,h+=r*V,p+=r*q,g+=r*z,m+=r*H,b+=r*W,y+=r*G,v+=r*Z,w+=r*K,x+=r*X,S+=r*Y,A+=r*J,r=t[4],u+=r*L,l+=r*D,d+=r*U,f+=r*j,h+=r*F,p+=r*V,g+=r*q,m+=r*z,b+=r*H,y+=r*W,v+=r*G,w+=r*Z,x+=r*K,S+=r*X,A+=r*Y,E+=r*J,r=t[5],l+=r*L,d+=r*D,f+=r*U,h+=r*j,p+=r*F,g+=r*V,m+=r*q,b+=r*z,y+=r*H,v+=r*W,w+=r*G,x+=r*Z,S+=r*K,A+=r*X,E+=r*Y,_+=r*J,r=t[6],d+=r*L,f+=r*D,h+=r*U,p+=r*j,g+=r*F,m+=r*V,b+=r*q,y+=r*z,v+=r*H,w+=r*W,x+=r*G,S+=r*Z,A+=r*K,E+=r*X,_+=r*Y,C+=r*J,r=t[7],f+=r*L,h+=r*D,p+=r*U,g+=r*j,m+=r*F,b+=r*V,y+=r*q,v+=r*z,w+=r*H,x+=r*W,S+=r*G,A+=r*Z,E+=r*K,_+=r*X,C+=r*Y,I+=r*J,r=t[8],h+=r*L,p+=r*D,g+=r*U,m+=r*j,b+=r*F,y+=r*V,v+=r*q,w+=r*z,x+=r*H,S+=r*W,A+=r*G,E+=r*Z,_+=r*K,C+=r*X,I+=r*Y,k+=r*J,r=t[9],p+=r*L,g+=r*D,m+=r*U,b+=r*j,y+=r*F,v+=r*V,w+=r*q,x+=r*z,S+=r*H,A+=r*W,E+=r*G,_+=r*Z,C+=r*K,I+=r*X,k+=r*Y,T+=r*J,r=t[10],g+=r*L,m+=r*D,b+=r*U,y+=r*j,v+=r*F,w+=r*V,x+=r*q,S+=r*z,A+=r*H,E+=r*W,_+=r*G,C+=r*Z,I+=r*K,k+=r*X,T+=r*Y,M+=r*J,r=t[11],m+=r*L,b+=r*D,y+=r*U,v+=r*j,w+=r*F,x+=r*V,S+=r*q,A+=r*z,E+=r*H,_+=r*W,C+=r*G,I+=r*Z,k+=r*K,T+=r*X,M+=r*Y,P+=r*J,r=t[12],b+=r*L,y+=r*D,v+=r*U,w+=r*j,x+=r*F,S+=r*V,A+=r*q,E+=r*z,_+=r*H,C+=r*W,I+=r*G,k+=r*Z,T+=r*K,M+=r*X,P+=r*Y,O+=r*J,r=t[13],y+=r*L,v+=r*D,w+=r*U,x+=r*j,S+=r*F,A+=r*V,E+=r*q,_+=r*z,C+=r*H,I+=r*W,k+=r*G,T+=r*Z,M+=r*K,P+=r*X,O+=r*Y,R+=r*J,r=t[14],v+=r*L,w+=r*D,x+=r*U,S+=r*j,A+=r*F,E+=r*V,_+=r*q,C+=r*z,I+=r*H,k+=r*W,T+=r*G,M+=r*Z,P+=r*K,O+=r*X,R+=r*Y,N+=r*J,r=t[15],w+=r*L,x+=r*D,S+=r*U,A+=r*j,E+=r*F,_+=r*V,C+=r*q,I+=r*z,k+=r*H,T+=r*W,M+=r*G,P+=r*Z,O+=r*K,R+=r*X,N+=r*Y,B+=r*J,o+=38*x,s+=38*S,a+=38*A,c+=38*E,u+=38*_,l+=38*C,d+=38*I,f+=38*k,h+=38*T,p+=38*M,g+=38*P,m+=38*O,b+=38*R,y+=38*N,v+=38*B,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=g,e[11]=m,e[12]=b,e[13]=y,e[14]=v,e[15]=w}function E(e,t){A(e,t,t)}function _(e,t){const n=s();let r;for(r=0;r<16;r++)n[r]=t[r];for(r=253;r>=0;r--)E(n,n),2!==r&&4!==r&&A(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function C(e,t){const n=s(),r=s(),i=s(),o=s(),a=s(),c=s(),u=s(),d=s(),f=s();S(n,e[1],e[0]),S(f,t[1],t[0]),A(n,n,f),x(r,e[0],e[1]),x(f,t[0],t[1]),A(r,r,f),A(i,e[3],t[3]),A(i,i,l),A(o,e[2],t[2]),x(o,o,o),S(a,r,n),S(c,o,i),x(u,o,i),x(d,r,n),A(e[0],a,c),A(e[1],d,u),A(e[2],u,c),A(e[3],a,d)}function I(e,t,n){for(let r=0;r<4;r++)m(e[r],t[r],n)}function k(e,t){const n=s(),r=s(),i=s();_(i,t[2]),A(n,t[0],i),A(r,t[1],i),b(e,r),e[31]^=w(n)<<7}function T(e,t,n){p(e[0],a),p(e[1],c),p(e[2],c),p(e[3],a);for(let r=255;r>=0;--r){const i=n[r/8|0]>>(7&r)&1;I(e,t,i),C(t,e),C(e,e),I(e,t,i)}}function M(e,t){const n=[s(),s(),s(),s()];p(n[0],d),p(n[1],f),p(n[2],c),A(n[3],d,f),T(e,n,t)}function P(e){if(e.length!==t.aP)throw new Error(`ed25519: seed must be ${t.aP} bytes`);const n=(0,i.hash)(e);n[0]&=248,n[31]&=127,n[31]|=64;const r=new Uint8Array(32),o=[s(),s(),s(),s()];M(o,n),k(r,o);const a=new Uint8Array(64);return a.set(e),a.set(r,32),{publicKey:r,secretKey:a}}t._w=P;const O=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function R(e,t){let n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>4)*O[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*O[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function N(e){const t=new Float64Array(64);for(let n=0;n<64;n++)t[n]=e[n];for(let n=0;n<64;n++)e[n]=0;R(e,t)}function B(e,t){const n=s(),r=s(),i=s(),o=s(),l=s(),d=s(),f=s();return p(e[2],c),function(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}(e[1],t),E(i,e[1]),A(o,i,u),S(i,i,e[2]),x(o,e[2],o),E(l,o),E(d,l),A(f,d,l),A(n,f,i),A(n,n,o),function(e,t){const n=s();let r;for(r=0;r<16;r++)n[r]=t[r];for(r=250;r>=0;r--)E(n,n),1!==r&&A(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}(n,n),A(n,n,i),A(n,n,o),A(n,n,o),A(e[0],n,o),E(r,e[0]),A(r,r,o),v(r,i)&&A(e[0],e[0],h),E(r,e[0]),A(r,r,o),v(r,i)?-1:(w(e[0])===t[31]>>7&&S(e[0],a,e[0]),A(e[3],e[0],e[1]),0)}t.Xx=function(e,t){const n=new Float64Array(64),r=[s(),s(),s(),s()],o=(0,i.hash)(e.subarray(0,32));o[0]&=248,o[31]&=127,o[31]|=64;const a=new Uint8Array(64);a.set(o.subarray(32),32);const c=new i.SHA512;c.update(a.subarray(32)),c.update(t);const u=c.digest();c.clean(),N(u),M(r,u),k(a,r),c.reset(),c.update(a.subarray(0,32)),c.update(e.subarray(32)),c.update(t);const l=c.digest();N(l);for(let i=0;i<32;i++)n[i]=u[i];for(let i=0;i<32;i++)for(let e=0;e<32;e++)n[i+e]+=l[i]*o[e];return R(a.subarray(32),n),a}},79984:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return"undefined"!==typeof e.saveState&&"undefined"!==typeof e.restoreState&&"undefined"!==typeof e.cleanSavedState}},512:function(e,t,n){"use strict";var r=n(25629),i=n(17309),o=function(){function e(e,t,n,i){void 0===n&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=r.hmac(this._hash,n,t);this._hmac=new r.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;nthis.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var i=0;i>>16&65535)*r+n*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},63027:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4153),i=n(17309);t.DIGEST_LENGTH=16;var o=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var n=e[0]|e[1]<<8;this._r[0]=8191&n;var r=e[2]|e[3]<<8;this._r[1]=8191&(n>>>13|r<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(r>>>10|i<<6);var o=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=e[8]|e[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var u=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,n){for(var r=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],d=this._h[7],f=this._h[8],h=this._h[9],p=this._r[0],g=this._r[1],m=this._r[2],b=this._r[3],y=this._r[4],v=this._r[5],w=this._r[6],x=this._r[7],S=this._r[8],A=this._r[9];n>=16;){var E=e[t+0]|e[t+1]<<8;i+=8191&E;var _=e[t+2]|e[t+3]<<8;o+=8191&(E>>>13|_<<3);var C=e[t+4]|e[t+5]<<8;s+=8191&(_>>>10|C<<6);var I=e[t+6]|e[t+7]<<8;a+=8191&(C>>>7|I<<9);var k=e[t+8]|e[t+9]<<8;c+=8191&(I>>>4|k<<12),u+=k>>>1&8191;var T=e[t+10]|e[t+11]<<8;l+=8191&(k>>>14|T<<2);var M=e[t+12]|e[t+13]<<8;d+=8191&(T>>>11|M<<5);var P=e[t+14]|e[t+15]<<8,O=0,R=O;R+=i*p,R+=o*(5*A),R+=s*(5*S),R+=a*(5*x),O=(R+=c*(5*w))>>>13,R&=8191,R+=u*(5*v),R+=l*(5*y),R+=d*(5*b),R+=(f+=8191&(M>>>8|P<<8))*(5*m);var N=O+=(R+=(h+=P>>>5|r)*(5*g))>>>13;N+=i*g,N+=o*p,N+=s*(5*A),N+=a*(5*S),O=(N+=c*(5*x))>>>13,N&=8191,N+=u*(5*w),N+=l*(5*v),N+=d*(5*y),N+=f*(5*b),O+=(N+=h*(5*m))>>>13,N&=8191;var B=O;B+=i*m,B+=o*g,B+=s*p,B+=a*(5*A),O=(B+=c*(5*S))>>>13,B&=8191,B+=u*(5*x),B+=l*(5*w),B+=d*(5*v),B+=f*(5*y);var L=O+=(B+=h*(5*b))>>>13;L+=i*b,L+=o*m,L+=s*g,L+=a*p,O=(L+=c*(5*A))>>>13,L&=8191,L+=u*(5*S),L+=l*(5*x),L+=d*(5*w),L+=f*(5*v);var D=O+=(L+=h*(5*y))>>>13;D+=i*y,D+=o*b,D+=s*m,D+=a*g,O=(D+=c*p)>>>13,D&=8191,D+=u*(5*A),D+=l*(5*S),D+=d*(5*x),D+=f*(5*w);var U=O+=(D+=h*(5*v))>>>13;U+=i*v,U+=o*y,U+=s*b,U+=a*m,O=(U+=c*g)>>>13,U&=8191,U+=u*p,U+=l*(5*A),U+=d*(5*S),U+=f*(5*x);var j=O+=(U+=h*(5*w))>>>13;j+=i*w,j+=o*v,j+=s*y,j+=a*b,O=(j+=c*m)>>>13,j&=8191,j+=u*g,j+=l*p,j+=d*(5*A),j+=f*(5*S);var F=O+=(j+=h*(5*x))>>>13;F+=i*x,F+=o*w,F+=s*v,F+=a*y,O=(F+=c*b)>>>13,F&=8191,F+=u*m,F+=l*g,F+=d*p,F+=f*(5*A);var V=O+=(F+=h*(5*S))>>>13;V+=i*S,V+=o*x,V+=s*w,V+=a*v,O=(V+=c*y)>>>13,V&=8191,V+=u*b,V+=l*m,V+=d*g,V+=f*p;var q=O+=(V+=h*(5*A))>>>13;q+=i*A,q+=o*S,q+=s*x,q+=a*w,O=(q+=c*v)>>>13,q&=8191,q+=u*y,q+=l*b,q+=d*m,q+=f*g,i=R=8191&(O=(O=((O+=(q+=h*p)>>>13)<<2)+O|0)+(R&=8191)|0),o=N+=O>>>=13,s=B&=8191,a=L&=8191,c=D&=8191,u=U&=8191,l=j&=8191,d=F&=8191,f=V&=8191,h=q&=8191,t+=16,n-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=d,this._h[8]=f,this._h[9]=h},e.prototype.finish=function(e,t){void 0===t&&(t=0);var n,r,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(n=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=n,n=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*n,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,s[0]=this._h[0]+5,n=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+n,n=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,r=(1^n)-1,o=0;o<10;o++)s[o]&=r;for(r=~r,o=0;o<10;o++)this._h[o]=this._h[o]&r|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,n=0,r=e.length;if(this._leftover){(t=16-this._leftover)>r&&(t=r);for(var i=0;i=16&&(t=r-r%16,this._blocks(e,n,t),n+=t,r-=t),r){for(i=0;i256)throw new Error("randomString charset is too long");let i="";const c=n.length,u=256-256%c;for(;e>0;){const t=s(Math.ceil(256*e/u),r);for(let r=0;r0;r++){const o=t[r];o0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=a(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.mE=o;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,n,i,o){for(;o>=64;){for(var a=t[0],c=t[1],u=t[2],l=t[3],d=t[4],f=t[5],h=t[6],p=t[7],g=0;g<16;g++){var m=i+4*g;e[g]=r.readUint32BE(n,m)}for(g=16;g<64;g++){var b=e[g-2],y=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,v=((b=e[g-15])>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;e[g]=(y+e[g-7]|0)+(v+e[g-16]|0)}for(g=0;g<64;g++){y=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&f^~d&h)|0)+(p+(s[g]+e[g]|0)|0)|0,v=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&u^c&u)|0;p=h,h=f,f=d,d=l+y|0,l=u,u=c,c=a,a=y+v|0}t[0]+=a,t[1]+=c,t[2]+=u,t[3]+=l,t[4]+=d,t[5]+=f,t[6]+=h,t[7]+=p,i+=64,o-=64}return i}t.vp=function(e){var t=new o;t.update(e);var n=t.digest();return t.clean(),n}},93350:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(98099),i=n(17309);t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},e.prototype.update=function(e,n){if(void 0===n&&(n=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var r=0;if(this._bytesHashed+=n,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],n--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(n>=this.blockSize&&(r=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,r,n),n%=this.blockSize);n>0;)this._buffer[this._bufferLength++]=e[r++],n--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%128<112?128:256;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.stateHi),i.wipe(e.stateLo),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA512=o;var s=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(e,t,n,i,o,a,c){for(var u,l,d,f,h,p,g,m,b=n[0],y=n[1],v=n[2],w=n[3],x=n[4],S=n[5],A=n[6],E=n[7],_=i[0],C=i[1],I=i[2],k=i[3],T=i[4],M=i[5],P=i[6],O=i[7];c>=128;){for(var R=0;R<16;R++){var N=8*R+a;e[R]=r.readUint32BE(o,N),t[R]=r.readUint32BE(o,N+4)}for(R=0;R<80;R++){var B,L,D=b,U=y,j=v,F=w,V=x,q=S,z=A,H=_,W=C,G=I,Z=k,K=T,X=M,Y=P;if(h=65535&(l=O),p=l>>>16,g=65535&(u=E),m=u>>>16,h+=65535&(l=(T>>>14|x<<18)^(T>>>18|x<<14)^(x>>>9|T<<23)),p+=l>>>16,g+=65535&(u=(x>>>14|T<<18)^(x>>>18|T<<14)^(T>>>9|x<<23)),m+=u>>>16,h+=65535&(l=T&M^~T&P),p+=l>>>16,g+=65535&(u=x&S^~x&A),m+=u>>>16,u=s[2*R],h+=65535&(l=s[2*R+1]),p+=l>>>16,g+=65535&u,m+=u>>>16,u=e[R%16],p+=(l=t[R%16])>>>16,g+=65535&u,m+=u>>>16,g+=(p+=(h+=65535&l)>>>16)>>>16,h=65535&(l=f=65535&h|p<<16),p=l>>>16,g=65535&(u=d=65535&g|(m+=g>>>16)<<16),m=u>>>16,h+=65535&(l=(_>>>28|b<<4)^(b>>>2|_<<30)^(b>>>7|_<<25)),p+=l>>>16,g+=65535&(u=(b>>>28|_<<4)^(_>>>2|b<<30)^(_>>>7|b<<25)),m+=u>>>16,p+=(l=_&C^_&I^C&I)>>>16,g+=65535&(u=b&y^b&v^y&v),m+=u>>>16,B=65535&(g+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=g>>>16)<<16,L=65535&h|p<<16,h=65535&(l=Z),p=l>>>16,g=65535&(u=F),m=u>>>16,p+=(l=f)>>>16,g+=65535&(u=d),m+=u>>>16,y=D,v=U,w=j,x=F=65535&(g+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=g>>>16)<<16,S=V,A=q,E=z,b=B,C=H,I=W,k=G,T=Z=65535&h|p<<16,M=K,P=X,O=Y,_=L,R%16===15)for(N=0;N<16;N++)u=e[N],h=65535&(l=t[N]),p=l>>>16,g=65535&u,m=u>>>16,u=e[(N+9)%16],h+=65535&(l=t[(N+9)%16]),p+=l>>>16,g+=65535&u,m+=u>>>16,d=e[(N+1)%16],h+=65535&(l=((f=t[(N+1)%16])>>>1|d<<31)^(f>>>8|d<<24)^(f>>>7|d<<25)),p+=l>>>16,g+=65535&(u=(d>>>1|f<<31)^(d>>>8|f<<24)^d>>>7),m+=u>>>16,d=e[(N+14)%16],p+=(l=((f=t[(N+14)%16])>>>19|d<<13)^(d>>>29|f<<3)^(f>>>6|d<<26))>>>16,g+=65535&(u=(d>>>19|f<<13)^(f>>>29|d<<3)^d>>>6),m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,e[N]=65535&g|m<<16,t[N]=65535&h|p<<16}h=65535&(l=_),p=l>>>16,g=65535&(u=b),m=u>>>16,u=n[0],p+=(l=i[0])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[0]=b=65535&g|m<<16,i[0]=_=65535&h|p<<16,h=65535&(l=C),p=l>>>16,g=65535&(u=y),m=u>>>16,u=n[1],p+=(l=i[1])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[1]=y=65535&g|m<<16,i[1]=C=65535&h|p<<16,h=65535&(l=I),p=l>>>16,g=65535&(u=v),m=u>>>16,u=n[2],p+=(l=i[2])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[2]=v=65535&g|m<<16,i[2]=I=65535&h|p<<16,h=65535&(l=k),p=l>>>16,g=65535&(u=w),m=u>>>16,u=n[3],p+=(l=i[3])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[3]=w=65535&g|m<<16,i[3]=k=65535&h|p<<16,h=65535&(l=T),p=l>>>16,g=65535&(u=x),m=u>>>16,u=n[4],p+=(l=i[4])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[4]=x=65535&g|m<<16,i[4]=T=65535&h|p<<16,h=65535&(l=M),p=l>>>16,g=65535&(u=S),m=u>>>16,u=n[5],p+=(l=i[5])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[5]=S=65535&g|m<<16,i[5]=M=65535&h|p<<16,h=65535&(l=P),p=l>>>16,g=65535&(u=A),m=u>>>16,u=n[6],p+=(l=i[6])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[6]=A=65535&g|m<<16,i[6]=P=65535&h|p<<16,h=65535&(l=O),p=l>>>16,g=65535&(u=E),m=u>>>16,u=n[7],p+=(l=i[7])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[7]=E=65535&g|m<<16,i[7]=O=65535&h|p<<16,a+=128,c-=128}return a}t.hash=function(e){var t=new o;t.update(e);var n=t.digest();return t.clean(),n}},17309:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t=0;--o){const e=n[o>>>3]>>>(7&o)&1;u(i,s,e),u(p,g,e),l(m,i,p),d(i,i,p),l(p,s,g),d(s,s,g),h(g,m),h(b,i),f(i,p,i),f(p,s,m),l(m,i,p),d(i,i,p),h(s,i),d(p,g,b),f(i,p,a),l(i,i,g),f(p,p,i),f(i,g,b),f(g,s,r),h(s,m),u(i,s,e),u(p,g,e)}for(let o=0;o<16;o++)r[o+16]=i[o],r[o+32]=p[o],r[o+48]=s[o],r[o+64]=g[o];const y=r.subarray(32),v=r.subarray(16);!function(e,t){const n=o();for(let r=0;r<16;r++)n[r]=t[r];for(let r=253;r>=0;r--)h(n,n),2!==r&&4!==r&&f(n,n,t);for(let r=0;r<16;r++)e[r]=n[r]}(y,y),f(v,v,y);const w=new Uint8Array(32);return function(e,t){const n=o(),r=o();for(let i=0;i<16;i++)r[i]=t[i];c(r),c(r),c(r);for(let i=0;i<2;i++){n[0]=r[0]-65517;for(let t=1;t<15;t++)n[t]=r[t]-65535-(n[t-1]>>16&1),n[t-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,u(r,n,1-e)}for(let i=0;i<16;i++)e[2*i]=255&r[i],e[2*i+1]=r[i]>>8}(w,v),w}function g(e){return p(e,s)}function m(e){if(e.length!==t.KS)throw new Error(`x25519: seed must be ${t.KS} bytes`);const n=new Uint8Array(e);return{publicKey:g(n),secretKey:n}}t.Au=function(e){const t=(0,r.randomBytes)(32,e),n=m(t);return(0,i.wipe)(t),n},t.gi=function(e,n,r=!1){if(e.length!==t.kz)throw new Error("X25519: incorrect secret key length");if(n.length!==t.kz)throw new Error("X25519: incorrect public key length");const i=p(e,n);if(r){let e=0;for(let t=0;tr.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=r.getAttribute("content");if(e)return e}}return""}const i=function(){let t=n("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:n("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const n=e.getElementsByTagName("link"),r=[];for(let e=0;e-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=t.protocol+"//"+t.host;if(0===e.indexOf("/"))n+=e;else{const r=t.pathname.split("/");r.pop();n+=r.join("/")+"/"+e}r.push(n)}else if(0===e.indexOf("//")){const n=t.protocol+e;r.push(n)}else r.push(e)}}return r}(),name:i}}},40926:function(e,t,n){"use strict";function r(){return(null===n.g||void 0===n.g?void 0:n.g.crypto)||(null===n.g||void 0===n.g?void 0:n.g.msCrypto)||{}}function i(){const e=r();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=r,t.getSubtleCrypto=i,t.isBrowserCryptoAvailable=function(){return!!r()&&!!i()}},88618:function(e,t,n){"use strict";var r=n(34155);function i(){return"undefined"===typeof document&&"undefined"!==typeof navigator&&"ReactNative"===navigator.product}function o(){return"undefined"!==typeof r&&"undefined"!==typeof r.versions&&"undefined"!==typeof r.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=i,t.isNode=o,t.isBrowser=function(){return!i()&&!o()}},1468:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(40926),t),i(n(88618),t)},74235:function(e,t,n){"use strict";var r=t;r.version=n(97037).i8,r.utils=n(54569),r.rand=n(29931),r.curve=n(62247),r.curves=n(99876),r.ec=n(66618),r.eddsa=n(66908)},34791:function(e,t,n){"use strict";var r=n(13550),i=n(54569),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var n=e._getDoubles(),r=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+r[l];u.push(c)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var d=s[u];a(0!==d),c="affine"===e.type?d>0?c.mixedAdd(i[d-1>>1]):c.mixedAdd(i[-d-1>>1].neg()):d>0?c.add(i[d-1>>1]):c.add(i[-d-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,r,i){var a,c,u,l=this._wnafT1,d=this._wnafT2,f=this._wnafT3,h=0;for(a=0;a=1;a-=2){var g=a-1,m=a;if(1===l[g]&&1===l[m]){var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(n[g],n[m]);for(h=Math.max(v[0].length,h),f[g]=new Array(h),f[m]=new Array(h),c=0;c=0;a--){for(var E=0;a>=0;){var _=!0;for(c=0;c=0&&E++,S=S.dblp(E),a<0)break;for(c=0;c0?u=d[c][C-1>>1]:C<0&&(u=d[c][-C-1>>1].neg()),S="affine"===u.type?S.mixedAdd(u):S.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),s=o.redSub(n),a=r.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),d=s.redMul(o);return this.curve.point(c,u,d,l)},u.prototype._projDbl=function(){var e,t,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(c)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(r.redSub(c)),n=u.redMul(o))}else r=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(a.redISub(c)),n=r.redMul(o);return this.curve.point(e,t,n)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),s=i.redSub(r),a=i.redAdd(r),c=n.redAdd(t),u=o.redMul(s),l=a.redMul(c),d=o.redMul(c),f=s.redMul(a);return this.curve.point(u,l,f,d)},u.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(s.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(s.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},u.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},62247:function(e,t,n){"use strict";var r=t;r.base=n(34791),r.short=n(70690),r.mont=n(2856),r.edwards=n(44852)},2856:function(e,t,n){"use strict";var r=n(13550),i=n(35717),o=n(34791),s=n(54569);function a(e){o.call(this,"mont",e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,n){o.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(t,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),s=i.redMul(r),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},70690:function(e,t,n){"use strict";var r=n(54569),i=n(13550),o=n(35717),s=n(34791),a=r.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,n,r){s.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,n,r){s.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),n=new i(2).toRed(t).redInvm(),r=n.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,r,o,s,a,c,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),b=new i(1),y=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),l=m.sub(v.mul(p));var w=b.sub(v.mul(g));if(!r&&u.cmp(d)<0)t=c.neg(),n=p,r=u.neg(),o=l;else if(r&&2===++y)break;c=u,h=f,f=u,m=p,p=l,b=g,g=w}s=u.neg(),a=l;var x=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(x)>=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},u.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},99876:function(e,t,n){"use strict";var r,i=t,o=n(33715),s=n(62247),a=n(54569).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var n=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(47593)}catch(l){r=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},66618:function(e,t,n){"use strict";var r=n(13550),i=n(2156),o=n(54569),s=n(99876),a=n(29931),c=o.assert,u=n(96446),l=n(53302);function d(e){if(!(this instanceof d))return new d(e);"string"===typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=d,d.prototype.keyPair=function(e){return new u(this,e)},d.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(t.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},d.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,n,o){"object"===typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new r(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new r(1)),f=0;;f++){var h=o.k?o.k(f):new r(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new l({r:m,s:b,recoveryParam:y})}}}}}},d.prototype.verify=function(e,t,n,i){e=this._truncateToN(new r(e,16)),n=this.keyFromPublic(n,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),d)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),d)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},d.prototype.recoverPubKey=function(e,t,n,i){c((3&n)===n,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new r(e),a=t.r,u=t.s,d=1&n,f=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),d):this.curve.pointFromX(a,d);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),g=u.mul(h).umod(o);return this.g.mulAdd(p,a,g)},d.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new l(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},96446:function(e,t,n){"use strict";var r=n(13550),i=n(54569).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"===typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new r(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},53302:function(e,t,n){"use strict";var r=n(13550),i=n(54569),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;if(0===e[t.place])return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var o=c(e,n);if(!1===o)return!1;if(o+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var s=c(e,n);if(!1===s)return!1;if(0!==(128&e[n.place]))return!1;var u=e.slice(n.place,s+n.place);if(n.place+=s,2!==e[n.place++])return!1;var l=c(e,n);if(!1===l)return!1;if(e.length!==l+n.place)return!1;if(0!==(128&e[n.place]))return!1;var d=e.slice(n.place,l+n.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new r(u),this.s=new r(d),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=u(t),n=u(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];l(r,t.length),(r=r.concat(t)).push(2),l(r,n.length);var o=r.concat(n),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},66908:function(e,t,n){"use strict";var r=n(33715),i=n(99876),o=n(54569),s=o.assert,a=o.parseBytes,c=n(72791),u=n(93021);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=r.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,n){if(e=a(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(o>>1)-1?(o>>1)-c:c,s.isubn(a)):a=0,i[r]=a,s.iushrn(1)}return i},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0===(1&c)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==u?c:-c,n[0].push(s),a=0===(1&u)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==c?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},638:function(e,t,n){"use strict";function r(){return(null===n.g||void 0===n.g?void 0:n.g.crypto)||(null===n.g||void 0===n.g?void 0:n.g.msCrypto)||{}}function i(){const e=r();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=r,t.getSubtleCrypto=i,t.isBrowserCryptoAvailable=function(){return!!r()&&!!i()}},19066:function(e,t,n){"use strict";var r=n(34155);function i(){return"undefined"===typeof document&&"undefined"!==typeof navigator&&"ReactNative"===navigator.product}function o(){return"undefined"!==typeof r&&"undefined"!==typeof r.versions&&"undefined"!==typeof r.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=i,t.isNode=o,t.isBrowser=function(){return!i()&&!o()}},93109:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(70655);r.__exportStar(n(638),t),r.__exportStar(n(19066),t)},72030:function(e){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},43014:function(){},24080:function(e,t,n){"use strict";var r=t;r.version=n(98738).i8,r.utils=n(66583),r.rand=n(29931),r.curve=n(88759),r.curves=n(7589),r.ec=n(30701),r.eddsa=n(3389)},42392:function(e,t,n){"use strict";var r=n(13550),i=n(66583),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var n=e._getDoubles(),r=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+r[l];u.push(c)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var d=s[u];a(0!==d),c="affine"===e.type?d>0?c.mixedAdd(i[d-1>>1]):c.mixedAdd(i[-d-1>>1].neg()):d>0?c.add(i[d-1>>1]):c.add(i[-d-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,r,i){var a,c,u,l=this._wnafT1,d=this._wnafT2,f=this._wnafT3,h=0;for(a=0;a=1;a-=2){var g=a-1,m=a;if(1===l[g]&&1===l[m]){var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(n[g],n[m]);for(h=Math.max(v[0].length,h),f[g]=new Array(h),f[m]=new Array(h),c=0;c=0;a--){for(var E=0;a>=0;){var _=!0;for(c=0;c=0&&E++,S=S.dblp(E),a<0)break;for(c=0;c0?u=d[c][C-1>>1]:C<0&&(u=d[c][-C-1>>1].neg()),S="affine"===u.type?S.mixedAdd(u):S.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),s=o.redSub(n),a=r.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),d=s.redMul(o);return this.curve.point(c,u,d,l)},u.prototype._projDbl=function(){var e,t,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(c)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(r.redSub(c)),n=u.redMul(o))}else r=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(a.redISub(c)),n=r.redMul(o);return this.curve.point(e,t,n)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),s=i.redSub(r),a=i.redAdd(r),c=n.redAdd(t),u=o.redMul(s),l=a.redMul(c),d=o.redMul(c),f=s.redMul(a);return this.curve.point(u,l,f,d)},u.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(s.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(s.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},u.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},88759:function(e,t,n){"use strict";var r=t;r.base=n(42392),r.short=n(74930),r.mont=n(12283),r.edwards=n(58467)},12283:function(e,t,n){"use strict";var r=n(13550),i=n(35717),o=n(42392),s=n(66583);function a(e){o.call(this,"mont",e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,n){o.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(t,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),s=i.redMul(r),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},74930:function(e,t,n){"use strict";var r=n(66583),i=n(13550),o=n(35717),s=n(42392),a=r.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,n,r){s.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,n,r){s.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),n=new i(2).toRed(t).redInvm(),r=n.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,r,o,s,a,c,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),b=new i(1),y=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),l=m.sub(v.mul(p));var w=b.sub(v.mul(g));if(!r&&u.cmp(d)<0)t=c.neg(),n=p,r=u.neg(),o=l;else if(r&&2===++y)break;c=u,h=f,f=u,m=p,p=l,b=g,g=w}s=u.neg(),a=l;var x=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(x)>=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},u.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},7589:function(e,t,n){"use strict";var r,i=t,o=n(33715),s=n(88759),a=n(66583).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var n=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(45380)}catch(l){r=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},30701:function(e,t,n){"use strict";var r=n(13550),i=n(2156),o=n(66583),s=n(7589),a=n(29931),c=o.assert,u=n(6744),l=n(83005);function d(e){if(!(this instanceof d))return new d(e);"string"===typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=d,d.prototype.keyPair=function(e){return new u(this,e)},d.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(t.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},d.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,n,o){"object"===typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new r(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new r(1)),f=0;;f++){var h=o.k?o.k(f):new r(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new l({r:m,s:b,recoveryParam:y})}}}}}},d.prototype.verify=function(e,t,n,i){e=this._truncateToN(new r(e,16)),n=this.keyFromPublic(n,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),d)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),d)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},d.prototype.recoverPubKey=function(e,t,n,i){c((3&n)===n,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new r(e),a=t.r,u=t.s,d=1&n,f=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),d):this.curve.pointFromX(a,d);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),g=u.mul(h).umod(o);return this.g.mulAdd(p,a,g)},d.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new l(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},6744:function(e,t,n){"use strict";var r=n(13550),i=n(66583).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"===typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new r(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},83005:function(e,t,n){"use strict";var r=n(13550),i=n(66583),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;if(0===e[t.place])return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var o=c(e,n);if(!1===o)return!1;if(o+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var s=c(e,n);if(!1===s)return!1;if(0!==(128&e[n.place]))return!1;var u=e.slice(n.place,s+n.place);if(n.place+=s,2!==e[n.place++])return!1;var l=c(e,n);if(!1===l)return!1;if(e.length!==l+n.place)return!1;if(0!==(128&e[n.place]))return!1;var d=e.slice(n.place,l+n.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new r(u),this.s=new r(d),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=u(t),n=u(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];l(r,t.length),(r=r.concat(t)).push(2),l(r,n.length);var o=r.concat(n),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},3389:function(e,t,n){"use strict";var r=n(33715),i=n(7589),o=n(66583),s=o.assert,a=o.parseBytes,c=n(51250),u=n(19713);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=r.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,n){if(e=a(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(o>>1)-1?(o>>1)-c:c,s.isubn(a)):a=0,i[r]=a,s.iushrn(1)}return i},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0===(1&c)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==u?c:-c,n[0].push(s),a=0===(1&u)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==c?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},68007:function(e){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},36900:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(70655);r.__exportStar(n(46869),t),r.__exportStar(n(88033),t)},46869:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_THOUSAND=t.ONE_HUNDRED=void 0,t.ONE_HUNDRED=100,t.ONE_THOUSAND=1e3},88033:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=5*t.ONE_MINUTE,t.TEN_MINUTES=10*t.ONE_MINUTE,t.THIRTY_MINUTES=30*t.ONE_MINUTE,t.SIXTY_MINUTES=60*t.ONE_MINUTE,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=3*t.ONE_HOUR,t.SIX_HOURS=6*t.ONE_HOUR,t.TWELVE_HOURS=12*t.ONE_HOUR,t.TWENTY_FOUR_HOURS=24*t.ONE_HOUR,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=3*t.ONE_DAY,t.FIVE_DAYS=5*t.ONE_DAY,t.SEVEN_DAYS=7*t.ONE_DAY,t.THIRTY_DAYS=30*t.ONE_DAY,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=2*t.ONE_WEEK,t.THREE_WEEKS=3*t.ONE_WEEK,t.FOUR_WEEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY},66736:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(70655);r.__exportStar(n(18526),t),r.__exportStar(n(47001),t),r.__exportStar(n(52939),t),r.__exportStar(n(36900),t)},52939:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(70655).__exportStar(n(88766),t)},88766:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0;t.IWatch=class{}},83207:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;const r=n(36900);t.toMiliseconds=function(e){return e*r.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/r.ONE_THOUSAND)}},83873:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}},18526:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(70655);r.__exportStar(n(83873),t),r.__exportStar(n(83207),t)},47001:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Watch=void 0;class n{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if("undefined"!==typeof t.elapsed)throw new Error(`Watch already stopped for label: ${e}`);const n=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:n})}get(e){const t=this.timestamps.get(e);if("undefined"===typeof t)throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}t.Watch=n,t.default=n},13964:function(e,t,n){"use strict";var r=t;r.version=n(15220).i8,r.utils=n(63039),r.rand=n(29931),r.curve=n(30472),r.curves=n(1538),r.ec=n(57387),r.eddsa=n(58625)},9568:function(e,t,n){"use strict";var r=n(13550),i=n(63039),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var n=e._getDoubles(),r=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+r[l];u.push(c)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var d=s[u];a(0!==d),c="affine"===e.type?d>0?c.mixedAdd(i[d-1>>1]):c.mixedAdd(i[-d-1>>1].neg()):d>0?c.add(i[d-1>>1]):c.add(i[-d-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,r,i){var a,c,u,l=this._wnafT1,d=this._wnafT2,f=this._wnafT3,h=0;for(a=0;a=1;a-=2){var g=a-1,m=a;if(1===l[g]&&1===l[m]){var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(n[g],n[m]);for(h=Math.max(v[0].length,h),f[g]=new Array(h),f[m]=new Array(h),c=0;c=0;a--){for(var E=0;a>=0;){var _=!0;for(c=0;c=0&&E++,S=S.dblp(E),a<0)break;for(c=0;c0?u=d[c][C-1>>1]:C<0&&(u=d[c][-C-1>>1].neg()),S="affine"===u.type?S.mixedAdd(u):S.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),s=o.redSub(n),a=r.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),d=s.redMul(o);return this.curve.point(c,u,d,l)},u.prototype._projDbl=function(){var e,t,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(c)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(r.redSub(c)),n=u.redMul(o))}else r=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(a.redISub(c)),n=r.redMul(o);return this.curve.point(e,t,n)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),s=i.redSub(r),a=i.redAdd(r),c=n.redAdd(t),u=o.redMul(s),l=a.redMul(c),d=o.redMul(c),f=s.redMul(a);return this.curve.point(u,l,f,d)},u.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(s.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(s.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},u.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},30472:function(e,t,n){"use strict";var r=t;r.base=n(9568),r.short=n(39573),r.mont=n(60208),r.edwards=n(2629)},60208:function(e,t,n){"use strict";var r=n(13550),i=n(35717),o=n(9568),s=n(63039);function a(e){o.call(this,"mont",e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,n){o.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(t,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),s=i.redMul(r),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},39573:function(e,t,n){"use strict";var r=n(63039),i=n(13550),o=n(35717),s=n(9568),a=r.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,n,r){s.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,n,r){s.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),n=new i(2).toRed(t).redInvm(),r=n.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,r,o,s,a,c,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),b=new i(1),y=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),l=m.sub(v.mul(p));var w=b.sub(v.mul(g));if(!r&&u.cmp(d)<0)t=c.neg(),n=p,r=u.neg(),o=l;else if(r&&2===++y)break;c=u,h=f,f=u,m=p,p=l,b=g,g=w}s=u.neg(),a=l;var x=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(x)>=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},u.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},1538:function(e,t,n){"use strict";var r,i=t,o=n(33715),s=n(30472),a=n(63039).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var n=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(69008)}catch(l){r=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},57387:function(e,t,n){"use strict";var r=n(13550),i=n(2156),o=n(63039),s=n(1538),a=n(29931),c=o.assert,u=n(63896),l=n(25207);function d(e){if(!(this instanceof d))return new d(e);"string"===typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=d,d.prototype.keyPair=function(e){return new u(this,e)},d.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(t.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},d.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,n,o){"object"===typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new r(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new r(1)),f=0;;f++){var h=o.k?o.k(f):new r(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new l({r:m,s:b,recoveryParam:y})}}}}}},d.prototype.verify=function(e,t,n,i){e=this._truncateToN(new r(e,16)),n=this.keyFromPublic(n,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),d)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),d)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},d.prototype.recoverPubKey=function(e,t,n,i){c((3&n)===n,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new r(e),a=t.r,u=t.s,d=1&n,f=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),d):this.curve.pointFromX(a,d);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),g=u.mul(h).umod(o);return this.g.mulAdd(p,a,g)},d.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new l(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},63896:function(e,t,n){"use strict";var r=n(13550),i=n(63039).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"===typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new r(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},25207:function(e,t,n){"use strict";var r=n(13550),i=n(63039),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;if(0===e[t.place])return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var o=c(e,n);if(!1===o)return!1;if(o+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var s=c(e,n);if(!1===s)return!1;if(0!==(128&e[n.place]))return!1;var u=e.slice(n.place,s+n.place);if(n.place+=s,2!==e[n.place++])return!1;var l=c(e,n);if(!1===l)return!1;if(e.length!==l+n.place)return!1;if(0!==(128&e[n.place]))return!1;var d=e.slice(n.place,l+n.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new r(u),this.s=new r(d),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=u(t),n=u(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];l(r,t.length),(r=r.concat(t)).push(2),l(r,n.length);var o=r.concat(n),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},58625:function(e,t,n){"use strict";var r=n(33715),i=n(1538),o=n(63039),s=o.assert,a=o.parseBytes,c=n(28509),u=n(73022);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=r.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,n){if(e=a(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(o>>1)-1?(o>>1)-c:c,s.isubn(a)):a=0,i[r]=a,s.iushrn(1)}return i},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0===(1&c)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==u?c:-c,n[0].push(s),a=0===(1&u)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==c?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},11460:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s=n(36563).Buffer}catch(E){}function a(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function c(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"===typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"===typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=6)i=a(e,n,n+6),this.words[r]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=a(e,t,n+6),this.words[r]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var f=l[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?g+n:u[f-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r("undefined"!==typeof s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,u=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function p(e,t,n){return(new g).mulp(e,t,n)}function g(e,t){this.x=e,this.y=t}Math.imul||(h=f),o.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?h(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},g.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},g.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):n.strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},i(y,b),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new x}return m[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},i(A,S),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},66151:function(e,t,n){"use strict";const r=n(70610),i=n(44020),o=n(80500);function s(e){if("string"!==typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function c(e,t){return t.decode?i(e):e}function u(e){return Array.isArray(e)?e.sort():"object"===typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"===typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"===typeof n&&n.split("").indexOf(e.arrayFormatSeparator)>-1?n.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===n?n:c(n,e);r[t]=i};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!==typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){let[e,s]=o(t.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator"].includes(t.arrayFormat)?s:c(s,t),n(c(e,t),s,r)}for(const i of Object.keys(r)){const e=r[i];if("object"===typeof e&&null!==e)for(const n of Object.keys(e))e[n]=f(e[n],t);else r[i]=f(e,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce(((e,t)=>{const n=r[t];return Boolean(n)&&"object"===typeof n&&!Array.isArray(n)?e[t]=u(n):e[t]=n,e}),Object.create(null))}t.extract=d,t.parse=h,t.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>{return t.skipNull&&(null===(r=e[n])||void 0===r)||t.skipEmptyString&&""===e[n];var r},r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[",i,"]"].join("")]:[...n,[a(t,e),"[",a(i,e),"]=",a(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[]"].join("")]:[...n,[a(t,e),"[]=",a(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null===r||void 0===r||0===r.length?n:0===n.length?[[a(t,e),"=",a(r,e)].join("")]:[[n,a(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,a(t,e)]:[...n,[a(t,e),"=",a(r,e)].join("")]}}(t),i={};for(const s of Object.keys(e))n(s)||(i[s]=e[s]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((n=>{const i=e[n];return void 0===i?"":null===i?a(n,t):Array.isArray(i)?i.reduce(r(n),[]).join("&"):a(n,t)+"="+a(i,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=o(e,"#");return Object.assign({url:n.split("?")[0]||"",query:h(d(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:c(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=l(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),s=Object.assign(o,e.query);let c=t.stringify(s,n);c&&(c=`?${c}`);let u=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(u=`#${a(e.fragmentIdentifier,n)}`),`${r}${c}${u}`}},62873:function(e,t){"use strict";function n(e){let t;return"undefined"!==typeof window&&"undefined"!==typeof window[e]&&(t=window[e]),t}function r(e){const t=n(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=n,t.getFromWindowOrThrow=r,t.getDocumentOrThrow=function(){return r("document")},t.getDocument=function(){return n("document")},t.getNavigatorOrThrow=function(){return r("navigator")},t.getNavigator=function(){return n("navigator")},t.getLocationOrThrow=function(){return r("location")},t.getLocation=function(){return n("location")},t.getCryptoOrThrow=function(){return r("crypto")},t.getCrypto=function(){return n("crypto")},t.getLocalStorageOrThrow=function(){return r("localStorage")},t.getLocalStorage=function(){return n("localStorage")}},65755:function(e,t,n){"use strict";t.D=void 0;const r=n(62873);t.D=function(){let e,t;try{e=r.getDocumentOrThrow(),t=r.getLocationOrThrow()}catch(o){return null}function n(...t){const n=e.getElementsByTagName("meta");for(let e=0;er.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=r.getAttribute("content");if(e)return e}}return""}const i=function(){let t=n("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:n("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const n=e.getElementsByTagName("link"),r=[];for(let e=0;e-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=t.protocol+"//"+t.host;if(0===e.indexOf("/"))n+=e;else{const r=t.pathname.split("/");r.pop();n+=r.join("/")+"/"+e}r.push(n)}else if(0===e.indexOf("//")){const n=t.protocol+e;r.push(n)}else r.push(e)}}return r}(),name:i}}},28599:function(e){"use strict";const{AbortController:t,AbortSignal:n}="undefined"!==typeof self?self:"undefined"!==typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=n,e.exports.default=t},66424:function(e,t,n){var r=n(34155);e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"encode",(function(){return T})),n.d(t,"decode",(function(){return H})),n.d(t,"decodeAsync",(function(){return Q})),n.d(t,"decodeArrayStream",(function(){return $})),n.d(t,"decodeStream",(function(){return ee})),n.d(t,"Decoder",(function(){return q})),n.d(t,"Encoder",(function(){return I})),n.d(t,"ExtensionCodec",(function(){return E})),n.d(t,"ExtData",(function(){return p})),n.d(t,"EXT_TIMESTAMP",(function(){return b})),n.d(t,"encodeDateToTimeSpec",(function(){return v})),n.d(t,"encodeTimeSpecToTimestamp",(function(){return y})),n.d(t,"decodeTimestampToTimeSpec",(function(){return x})),n.d(t,"encodeTimestampExtension",(function(){return w})),n.d(t,"decodeTimestampExtension",(function(){return S}));var i=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},o=function(){for(var e=[],t=0;t=55296&&i<=56319&&r65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|1023&d),s.push(d)}else s.push(c);s.length>=4096&&(a+=String.fromCharCode.apply(String,o(s)),s.length=0)}return s.length>0&&(a+=String.fromCharCode.apply(String,o(s))),a}var f=s?new TextDecoder:null,h="undefined"!=typeof r?200:0,p=function(e,t){this.type=e,this.data=t};function g(e,t,n){var r=Math.floor(n/4294967296),i=n;e.setUint32(t,r),e.setUint32(t+4,i)}function m(e,t){var n=e.getInt32(t),r=e.getUint32(t+4),i=nMath.floor(Number.MAX_SAFE_INTEGER/4294967296);return i||o?BigInt(n)*BigInt(4294967296)+BigInt(r):4294967296*n+r}var b=-1;function y(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var i=new Uint8Array(4);return(t=new DataView(i.buffer)).setUint32(0,n),i}var o=n/4294967296,s=4294967295&n;return i=new Uint8Array(8),(t=new DataView(i.buffer)).setUint32(0,r<<2|3&o),t.setUint32(4,s),i}return i=new Uint8Array(12),(t=new DataView(i.buffer)).setUint32(0,r),g(t,4,n),i}function v(e){var t=e.getTime(),n=Math.floor(t/1e3),r=1e6*(t-1e3*n),i=Math.floor(r/1e9);return{sec:n+i,nsec:r-1e9*i}}function w(e){return e instanceof Date?y(v(e)):null}function x(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:m(t,4),nsec:t.getUint32(0)};default:throw new Error("Unrecognized data size for timestamp: "+e.length)}}function S(e){var t=x(e);return new Date(1e3*t.sec+t.nsec/1e6)}var A={type:b,encode:w,decode:S},E=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(A)}return e.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var i=1+t;this.builtInEncoders[i]=n,this.builtInDecoders[i]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},I=function(){function e(e,t,n,r,i,o,s,a){void 0===e&&(e=E.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=100),void 0===r&&(r=2048),void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),this.extensionCodec=e,this.context=t,this.maxDepth=n,this.initialBufferSize=r,this.sortKeys=i,this.forceFloat32=o,this.ignoreUndefined=s,this.forceIntegerToFloat=a,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return e.prototype.getUint8Array=function(){return this.bytes.subarray(0,this.pos)},e.prototype.reinitializeState=function(){this.pos=0},e.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.getUint8Array()},e.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth "+t);null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):"bigint"==typeof e?this.encodebigint(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.encodebigint=function(e){e>=BigInt(0)?e=BigInt(-32)?this.writeU8(224|Number(e)+32):e>=BigInt(-128)?(this.writeU8(208),this.writeI8(Number(e))):e>=BigInt(-32768)?(this.writeU8(209),this.writeI16(Number(e))):e>=BigInt(-2147483648)?(this.writeU8(210),this.writeI32(Number(e))):(this.writeU8(211),this.writeBig64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: "+e+" bytes in UTF-8");this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){var t=e.length;if(s&&t>u){var n=a(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),l(e,this.bytes,this.pos),this.pos+=n}else n=a(e),this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),function(e,t,n){for(var r=e.length,i=n,o=0;o>6&31|192;else{if(s>=55296&&s<=56319&&o>12&15|224,t[i++]=s>>6&63|128):(t[i++]=s>>18&7|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128)}t[i++]=63&s|128}else t[i++]=s}}(e,this.bytes,this.pos),this.pos+=n},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: "+Object.prototype.toString.apply(e));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: "+t);this.writeU8(198),this.writeU32(t)}var n=_(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n,r,i=e.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else{if(!(i<4294967296))throw new Error("Too large array: "+i);this.writeU8(221),this.writeU32(i)}try{for(var o=C(e),s=o.next();!s.done;s=o.next()){var a=s.value;this.doEncode(a,t+1)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e.prototype.countWithoutUndefined=function(e,t){var n,r,i=0;try{for(var o=C(t),s=o.next();!s.done;s=o.next())void 0!==e[s.value]&&i++}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},e.prototype.encodeMap=function(e,t){var n,r,i=Object.keys(e);this.sortKeys&&i.sort();var o=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.length;if(o<16)this.writeU8(128+o);else if(o<65536)this.writeU8(222),this.writeU16(o);else{if(!(o<4294967296))throw new Error("Too large map object: "+o);this.writeU8(223),this.writeU32(o)}try{for(var s=C(i),a=s.next();!a.done;a=s.next()){var c=a.value,u=e[c];this.ignoreUndefined&&void 0===u||(this.encodeString(c),this.doEncode(u,t+1))}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}},e.prototype.encodeExtension=function(e){var t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large extension object: "+t);this.writeU8(201),this.writeU32(t)}this.writeI8(e.type),this.writeU8a(e.data)},e.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},e.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},e.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},e.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},e.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},e.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},e.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},e.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},e.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},e.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),function(e,t,n){var r=n/4294967296,i=n;e.setUint32(t,r),e.setUint32(t+4,i)}(this.view,this.pos,e),this.pos+=8},e.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),g(this.view,this.pos,e),this.pos+=8},e.prototype.writeBig64=function(e){this.ensureBufferSizeToWrite(8),function(e,t,n){var r=Number(n/BigInt(4294967296)),i=Number(n%BigInt(4294967296));r<0&&0!==i&&(r-=1),e.setUint32(t,r),e.setUint32(t+4,i)}(this.view,this.pos,e),this.pos+=8},e}(),k={};function T(e,t){return void 0===t&&(t=k),new I(t.extensionCodec,t.context,t.maxDepth,t.initialBufferSize,t.sortKeys,t.forceFloat32,t.ignoreUndefined,t.forceIntegerToFloat).encode(e)}function M(e){return(e<0?"-":"")+"0x"+Math.abs(e).toString(16).padStart(2,"0")}var P=function(){function e(e,t){void 0===e&&(e=16),void 0===t&&(t=16),this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(var n=0;n0&&e<=this.maxKeyLength},e.prototype.get=function(e,t,n){var r=this.caches[n-1],i=r.length;e:for(var o=0;o=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},e.prototype.decode=function(e,t,n){var r=this.get(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var i=d(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,i),i},e}(),O=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},R=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof B?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}},D=new DataView(new ArrayBuffer(0)),U=new Uint8Array(D.buffer),j=function(){try{D.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),F=new j("Insufficient data"),V=new P,q=function(){function e(e,t,n,r,i,o,s,a){void 0===e&&(e=E.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=4294967295),void 0===r&&(r=4294967295),void 0===i&&(i=4294967295),void 0===o&&(o=4294967295),void 0===s&&(s=4294967295),void 0===a&&(a=V),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=r,this.maxArrayLength=i,this.maxMapLength=o,this.maxExtLength=s,this.keyDecoder=a,this.totalPos=0,this.pos=0,this.view=D,this.bytes=U,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1},e.prototype.setBuffer=function(e){this.bytes=_(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=_(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining()){var t=this.bytes.subarray(this.pos),n=_(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return void 0===e&&(e=1),this.view.byteLength-this.pos>=e},e.prototype.createNoExtraBytesError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra "+(t.byteLength-n)+" of "+t.byteLength+" byte(s) found at buffer["+e+"]")},e.prototype.decode=function(e){return this.reinitializeState(),this.setBuffer(e),this.doDecodeSingleSync()},e.prototype.doDecodeSingleSync=function(){var e=this.doDecodeSync();if(this.hasRemaining())throw this.createNoExtraBytesError(this.pos);return e},e.prototype.decodeAsync=function(e){var t,n,r,i;return O(this,void 0,void 0,(function(){var o,s,a,c,u,l,d,f;return R(this,(function(h){switch(h.label){case 0:o=!1,h.label=1;case 1:h.trys.push([1,6,7,12]),t=N(e),h.label=2;case 2:return[4,t.next()];case 3:if((n=h.sent()).done)return[3,5];if(a=n.value,o)throw this.createNoExtraBytesError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),o=!0}catch(e){if(!(e instanceof j))throw e}this.totalPos+=this.pos,h.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=h.sent(),r={error:c},[3,12];case 7:return h.trys.push([7,,10,11]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,9];case 8:h.sent(),h.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(o){if(this.hasRemaining())throw this.createNoExtraBytesError(this.totalPos);return[2,s]}throw l=(u=this).headByte,d=u.pos,f=u.totalPos,new RangeError("Insufficient data in parcing "+M(l)+" at "+f+" ("+d+" in the current buffer)")}}))}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return L(this,arguments,(function(){var n,r,i,o,s,a,c,u,l;return R(this,(function(d){switch(d.label){case 0:n=t,r=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),i=N(e),d.label=2;case 2:return[4,B(i.next())];case 3:if((o=d.sent()).done)return[3,12];if(s=o.value,t&&0===r)throw this.createNoExtraBytesError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,B(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof j))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),u={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),o&&!o.done&&(l=i.return)?[4,B(l.call(i))]:[3,16];case 15:d.sent(),d.label=16;case 16:return[3,18];case 17:if(u)throw u.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!==(r=e-128)){this.pushMapState(r),this.complete();continue e}t={}}else if(e<160){if(0!==(r=e-144)){this.pushArrayState(r),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(r=this.readU16())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(221===e){if(0!==(r=this.readU32())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(222===e){if(0!==(r=this.readU16())){this.pushMapState(r),this.complete();continue e}t={}}else if(223===e){if(0!==(r=this.readU32())){this.pushMapState(r),this.complete();continue e}t={}}else if(196===e){var r=this.lookU8();t=this.decodeBinary(r,1)}else if(197===e)r=this.lookU16(),t=this.decodeBinary(r,2);else if(198===e)r=this.lookU32(),t=this.decodeBinary(r,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)r=this.lookU8(),t=this.decodeExtension(r,1);else if(200===e)r=this.lookU16(),t=this.decodeExtension(r,2);else{if(201!==e)throw new Error("Unrecognized type byte: "+M(e));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var i=this.stack;i.length>0;){var o=i[i.length-1];if(0===o.type){if(o.array[o.position]=t,o.position++,o.position!==o.size)continue e;i.pop(),t=o.array}else{if(1===o.type){if(s=void 0,"string"!==(s=typeof t)&&"number"!==s)throw new Error("The type of key must be string or number but "+typeof t);o.key=t,o.type=2;continue e}if(o.map[o.key]=t,o.readCount++,o.readCount!==o.size){o.key=null,o.type=1;continue e}i.pop(),t=o.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new Error("Unrecognized array type byte: "+M(e))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Error("Max length exceeded: map length ("+e+") > maxMapLengthLength ("+this.maxMapLength+")");this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new Error("Max length exceeded: array length ("+e+") > maxArrayLength ("+this.maxArrayLength+")");this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new Error("Max length exceeded: UTF-8 byte length ("+e+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLengthh?function(e,t,n){var r=e.subarray(t,t+n);return f.decode(r)}(this.bytes,i,e):d(this.bytes,i,e),this.pos+=t+e,r},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new Error("Max length exceeded: bin length ("+e+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(e+t))throw F;var n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new Error("Max length exceeded: ext length ("+e+") > maxExtLength ("+this.maxExtLength+")");var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n,r,i=(e=this.view,t=this.pos,n=e.getUint32(t),r=e.getUint32(t+4),n>Math.floor(Number.MAX_SAFE_INTEGER/4294967296)?BigInt(n)*BigInt(4294967296)+BigInt(r):4294967296*n+r);return this.pos+=8,i},e.prototype.readI64=function(){var e=m(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),z={};function H(e,t){return void 0===t&&(t=z),new q(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}var W=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof G?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}};function K(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function X(e){return null!=e[Symbol.asyncIterator]?e:function(e){return Z(this,arguments,(function(){var t,n,r,i;return W(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,G(t.read())];case 3:return n=o.sent(),r=n.done,i=n.value,r?[4,G(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return K(i),[4,G(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}var Y=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},J=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e===t[n]))}function b(...e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;for(let i=0;iBigInt("0xffffffffffffffff"))throw new Error("Input is not a 64-bit unsigned integer");const t=new Uint8Array(8);return new DataView(t.buffer).setBigUint64(0,BigInt(e)),t}function M(e,t="safe"){if("safe"!==t&&"mixed"!==t&&"bigint"!==t)throw new Error(`Unknown decodingMode option: ${t}`);if(0===e.byteLength||e.byteLength>8)throw new Error(`Data has unacceptable length. Expected length is between 1 and 8, got ${e.byteLength}`);const n=b(new Uint8Array(8-e.byteLength),e),r=new DataView(n.buffer).getBigUint64(0),i=r>BigInt(Number.MAX_SAFE_INTEGER);if("safe"===t){if(i)throw new Error(`Integer exceeds maximum safe integer: ${r.toString()}. Try decoding with "mixed" or "safe" decodingMode.`);return Number(r)}return"mixed"!==t||i?r:Number(r)}const P=new Uint8Array([77,117,108,116,105,115,105,103,65,100,100,114]),O=a.lW.from("appID"),R="address seems to be malformed";function N(e){if("string"!==typeof e||58!==e.length)throw new Error(R);const t=k().decode.asBytes(e.toString());if(36!==t.length)throw new Error(R);const n=new Uint8Array(t.slice(0,32)),r=new Uint8Array(t.slice(C,36));if(!m(y(n).slice(28,32),r))throw new Error("wrong checksum for address");return{publicKey:n,checksum:r}}function B(e){try{N(e)}catch(t){return!1}return!0}function L(e){const t=y(e).slice(C-4,C);return k().encode(b(e,t)).toString().slice(0,58)}function D({version:e,threshold:t,pks:n}){if(1!==e||e>255||e<0)throw new Error("invalid multisig version");if(0===t||0===n.length||t>n.length||t>255)throw new Error("bad multisig threshold");if(32!==C)throw new Error("nacl public key length is not 32 bytes");const r=new Uint8Array(P.length+2+32*n.length);r.set(P,0),r.set([e],P.length),r.set([t],P.length+1);for(let i=0;iN(e).publicKey))}))}function j(e){const t=y(b(O,T(e)));return L(new Uint8Array(t))}var F=n(66424);function V(e){return F.encode(e,{sortKeys:!0})}function q(e){const t=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&(!e[t]||0===e[t].length))return{containsEmpty:!0,firstEmptyKey:t};return{containsEmpty:!1,firstEmptyKey:void 0}}(e);if(t.containsEmpty)throw new Error("The object contains empty or 0 values. First empty or 0 value encountered during encoding: "+t.firstEmptyKey);return V(e)}function z(e){return F.decode(e)}function H(e,t,n){return null==e?[]:e.map((e=>function(e,t,n){const r=e.appIndex,i=e.name,o=0===r||r===n;let s=0;if(null!=t&&(s=t.indexOf(r)+1),0===s&&!o)throw new Error(`Box ref with appId ${r} not in foreign-apps`);return{i:s,n:i}}(e,t,n)))}var W,G;!function(e){e.pay="pay",e.keyreg="keyreg",e.acfg="acfg",e.axfer="axfer",e.afrz="afrz",e.appl="appl",e.stpf="stpf"}(W||(W={})),function(e){e[e.NoOpOC=0]="NoOpOC",e[e.OptInOC=1]="OptInOC",e[e.CloseOutOC=2]="CloseOutOC",e[e.ClearStateOC=3]="ClearStateOC",e[e.UpdateApplicationOC=4]="UpdateApplicationOC",e[e.DeleteApplicationOC=5]="DeleteApplicationOC"}(G||(G={}));const Z=1e3;function K(e,t,n){if(null==e)return;let r;if("string"===typeof e?r=a.lW.from(e,"base64"):e.constructor===Uint8Array?r=a.lW.from(e):a.lW.isBuffer(e)&&(r=e),null==r||r.byteLength!==n)throw Error(`${t} must be a ${n} byte Uint8Array or Buffer or base64 string.`);return r}class X{constructor({...e}){this.name="Transaction",this.tag=a.lW.from("TX");const t={type:W.pay,flatFee:!1,nonParticipation:!1};if("undefined"===typeof e.type&&(e.type=t.type),"undefined"===typeof e.flatFee&&(e.flatFee=t.flatFee),e.type===W.keyreg&&"undefined"!==typeof e.voteKey&&"undefined"===typeof e.nonParticipation&&(e.nonParticipation=t.nonParticipation),void 0!==e.suggestedParams){const t=e;t.genesisHash=t.suggestedParams.genesisHash,t.fee=t.suggestedParams.fee,void 0!==t.suggestedParams.flatFee&&(t.flatFee=t.suggestedParams.flatFee),t.firstRound=t.suggestedParams.firstRound,t.lastRound=t.suggestedParams.lastRound,t.genesisID=t.suggestedParams.genesisID}const n=e;if(n.from=N(n.from),void 0!==n.to&&(n.to=N(n.to)),void 0!==n.closeRemainderTo&&(n.closeRemainderTo=N(n.closeRemainderTo)),void 0!==n.assetManager&&(n.assetManager=N(n.assetManager)),void 0!==n.assetReserve&&(n.assetReserve=N(n.assetReserve)),void 0!==n.assetFreeze&&(n.assetFreeze=N(n.assetFreeze)),void 0!==n.assetClawback&&(n.assetClawback=N(n.assetClawback)),void 0!==n.assetRevocationTarget&&(n.assetRevocationTarget=N(n.assetRevocationTarget)),void 0!==n.freezeAccount&&(n.freezeAccount=N(n.freezeAccount)),void 0!==n.reKeyTo&&(n.reKeyTo=N(n.reKeyTo)),void 0===n.genesisHash)throw Error("genesis hash must be specified and in a base64 string.");if(n.genesisHash=a.lW.from(n.genesisHash,"base64"),void 0!==n.amount&&(!(Number.isSafeInteger(n.amount)||"bigint"===typeof n.amount&&n.amount<=BigInt("0xffffffffffffffff"))||n.amount<0))throw Error("Amount must be a positive number and smaller than 2^64-1. If the number is larger than 2^53-1, use bigint.");if(!Number.isSafeInteger(n.fee)||n.fee<0)throw Error("fee must be a positive number and smaller than 2^53-1");if(!Number.isSafeInteger(n.firstRound)||n.firstRound<0)throw Error("firstRound must be a positive number");if(!Number.isSafeInteger(n.lastRound)||n.lastRound<0)throw Error("lastRound must be a positive number");if(void 0!==n.extraPages&&(!Number.isInteger(n.extraPages)||n.extraPages<0||n.extraPages>3))throw Error("extraPages must be an Integer between and including 0 to 3");if(void 0!==n.assetTotal&&(!(Number.isSafeInteger(n.assetTotal)||"bigint"===typeof n.assetTotal&&n.assetTotal<=BigInt("0xffffffffffffffff"))||n.assetTotal<0))throw Error("Total asset issuance must be a positive number and smaller than 2^64-1. If the number is larger than 2^53-1, use bigint.");if(void 0!==n.assetDecimals&&(!Number.isSafeInteger(n.assetDecimals)||n.assetDecimals<0||n.assetDecimals>19))throw Error(`assetDecimals must be a positive number and smaller than ${19..toString()}`);if(void 0!==n.assetIndex&&(!Number.isSafeInteger(n.assetIndex)||n.assetIndex<0))throw Error("Asset index must be a positive number and smaller than 2^53-1");if(void 0!==n.appIndex&&(!Number.isSafeInteger(n.appIndex)||n.appIndex<0))throw Error("Application index must be a positive number and smaller than 2^53-1");if(void 0!==n.appLocalInts&&(!Number.isSafeInteger(n.appLocalInts)||n.appLocalInts<0))throw Error("Application local ints count must be a positive number and smaller than 2^53-1");if(void 0!==n.appLocalByteSlices&&(!Number.isSafeInteger(n.appLocalByteSlices)||n.appLocalByteSlices<0))throw Error("Application local byte slices count must be a positive number and smaller than 2^53-1");if(void 0!==n.appGlobalInts&&(!Number.isSafeInteger(n.appGlobalInts)||n.appGlobalInts<0))throw Error("Application global ints count must be a positive number and smaller than 2^53-1");if(void 0!==n.appGlobalByteSlices&&(!Number.isSafeInteger(n.appGlobalByteSlices)||n.appGlobalByteSlices<0))throw Error("Application global byte slices count must be a positive number and smaller than 2^53-1");if(void 0!==n.appApprovalProgram&&n.appApprovalProgram.constructor!==Uint8Array)throw Error("appApprovalProgram must be a Uint8Array.");if(void 0!==n.appClearProgram&&n.appClearProgram.constructor!==Uint8Array)throw Error("appClearProgram must be a Uint8Array.");if(void 0!==n.appArgs){if(!Array.isArray(n.appArgs))throw Error("appArgs must be an Array of Uint8Array.");n.appArgs=n.appArgs.slice(),n.appArgs.forEach((e=>{if(e.constructor!==Uint8Array)throw Error("each element of AppArgs must be a Uint8Array.")}))}else n.appArgs=[];if(void 0!==n.appAccounts){if(!Array.isArray(n.appAccounts))throw Error("appAccounts must be an Array of addresses.");n.appAccounts=n.appAccounts.map((e=>N(e)))}if(void 0!==n.appForeignApps){if(!Array.isArray(n.appForeignApps))throw Error("appForeignApps must be an Array of integers.");n.appForeignApps=n.appForeignApps.slice(),n.appForeignApps.forEach((e=>{if(!Number.isSafeInteger(e)||e<0)throw Error("each foreign application index must be a positive number and smaller than 2^53-1")}))}if(void 0!==n.appForeignAssets){if(!Array.isArray(n.appForeignAssets))throw Error("appForeignAssets must be an Array of integers.");n.appForeignAssets=n.appForeignAssets.slice(),n.appForeignAssets.forEach((e=>{if(!Number.isSafeInteger(e)||e<0)throw Error("each foreign asset index must be a positive number and smaller than 2^53-1")}))}if(void 0!==n.boxes){if(!Array.isArray(n.boxes))throw Error("boxes must be an Array of BoxReference.");n.boxes=n.boxes.slice(),n.boxes.forEach((e=>{if(!Number.isSafeInteger(e.appIndex)||e.name.constructor!==Uint8Array)throw Error("box app index must be a number and name must be an Uint8Array.")}))}if(void 0!==n.assetMetadataHash&&0!==n.assetMetadataHash.length){if("string"===typeof n.assetMetadataHash&&(n.assetMetadataHash=new Uint8Array(a.lW.from(n.assetMetadataHash))),n.assetMetadataHash.constructor!==Uint8Array||32!==n.assetMetadataHash.byteLength)throw Error("assetMetadataHash must be a 32 byte Uint8Array or string.");n.assetMetadataHash.every((e=>0===e))&&(n.assetMetadataHash=void 0)}else n.assetMetadataHash=void 0;if(void 0!==n.note){if(n.note.constructor!==Uint8Array)throw Error("note must be a Uint8Array.")}else n.note=new Uint8Array(0);if(void 0!==n.lease){if(n.lease.constructor!==Uint8Array)throw Error("lease must be a Uint8Array.");if(32!==n.lease.length)throw Error(`lease must be of length ${32..toString()}.`);n.lease.every((e=>0===e))&&(n.lease=new Uint8Array(0))}else n.lease=new Uint8Array(0);if(n.voteKey=K(n.voteKey,"voteKey",32),n.selectionKey=K(n.selectionKey,"selectionKey",32),n.stateProofKey=K(n.stateProofKey,"stateProofKey",64),n.nonParticipation&&(n.voteKey||n.selectionKey||n.voteFirst||n.stateProofKey||n.voteLast||n.voteKeyDilution))throw new Error("nonParticipation is true but participation params are present.");if(!n.nonParticipation&&(n.voteKey||n.selectionKey||n.stateProofKey||n.voteFirst||n.voteLast||n.voteKeyDilution)&&!(n.voteKey&&n.selectionKey&&n.voteFirst&&n.voteLast&&n.voteKeyDilution))throw new Error("online key registration missing at least one of the following fields: voteKey, selectionKey, voteFirst, voteLast, voteKeyDilution");if(delete n.suggestedParams,Object.assign(this,function(e){const t={...e};return Object.keys(t).forEach((e=>{"undefined"===typeof t[e]&&delete t[e]})),t}(n)),n.flatFee||(this.fee*=this.estimateSize(),this.feea.lW.from(e)))),void 0!==this.appAccounts&&(e.apat=this.appAccounts.map((e=>a.lW.from(e.publicKey)))),e.note.length||delete e.note,e.lx.length||delete e.lx,e.amt||delete e.amt,e.fee||delete e.fee,e.fv||delete e.fv,e.gen||delete e.gen,e.apid||delete e.apid,e.apls.nui||delete e.apls.nui,e.apls.nbs||delete e.apls.nbs,e.apls.nui||e.apls.nbs||delete e.apls,e.apgs.nui||delete e.apgs.nui,e.apgs.nbs||delete e.apgs.nbs,e.apaa&&e.apaa.length||delete e.apaa,e.apgs.nui||e.apgs.nbs||delete e.apgs,e.apap||delete e.apap,e.apsu||delete e.apsu,e.apan||delete e.apan,e.apfa&&e.apfa.length||delete e.apfa,e.apas&&e.apas.length||delete e.apas;for(const t of e.apbx)t.i||delete t.i,t.n&&t.n.length||delete t.n;return e.apbx&&e.apbx.length||delete e.apbx,e.apat&&e.apat.length||delete e.apat,e.apep||delete e.apep,void 0===e.grp&&delete e.grp,e}if("stpf"===this.type){const e={fee:this.fee,fv:this.firstRound,lv:this.lastRound,note:a.lW.from(this.note),snd:a.lW.from(this.from.publicKey),type:this.type,gen:this.genesisID,gh:this.genesisHash,lx:a.lW.from(this.lease),sptype:this.stateProofType,spmsg:a.lW.from(this.stateProofMessage),sp:a.lW.from(this.stateProof)};return e.sptype||delete e.sptype,e.note.length||delete e.note,e.lx.length||delete e.lx,e.amt||delete e.amt,e.fee||delete e.fee,e.fv||delete e.fv,e.gen||delete e.gen,e.apid||delete e.apid,e.apaa&&e.apaa.length||delete e.apaa,e.apap||delete e.apap,e.apsu||delete e.apsu,e.apan||delete e.apan,e.apfa&&e.apfa.length||delete e.apfa,e.apas&&e.apas.length||delete e.apas,e.apat&&e.apat.length||delete e.apat,e.apep||delete e.apep,void 0===e.grp&&delete e.grp,e}}static from_obj_for_encoding(e){const t=Object.create(this.prototype);if(t.name="Transaction",t.tag=a.lW.from("TX"),t.genesisID=e.gen,t.genesisHash=a.lW.from(e.gh),(n=e.type)!==W.pay&&n!==W.keyreg&&n!==W.acfg&&n!==W.axfer&&n!==W.afrz&&n!==W.appl&&n!==W.stpf)throw new Error(`Unrecognized transaction type: ${e.type}`);var n;return t.type=e.type,t.fee=e.fee,t.firstRound=e.fv,t.lastRound=e.lv,t.note=new Uint8Array(e.note),t.lease=new Uint8Array(e.lx),t.from=N(L(new Uint8Array(e.snd))),void 0!==e.grp&&(t.group=a.lW.from(e.grp)),void 0!==e.rekey&&(t.reKeyTo=N(L(new Uint8Array(e.rekey)))),"pay"===e.type?(t.amount=e.amt,t.to=N(L(new Uint8Array(e.rcv))),void 0!==e.close&&(t.closeRemainderTo=N(L(e.close)))):"keyreg"===e.type?(void 0!==e.votekey&&(t.voteKey=a.lW.from(e.votekey)),void 0!==e.selkey&&(t.selectionKey=a.lW.from(e.selkey)),void 0!==e.sprfkey&&(t.stateProofKey=a.lW.from(e.sprfkey)),void 0!==e.votekd&&(t.voteKeyDilution=e.votekd),void 0!==e.votefst&&(t.voteFirst=e.votefst),void 0!==e.votelst&&(t.voteLast=e.votelst),void 0!==e.nonpart&&(t.nonParticipation=e.nonpart)):"acfg"===e.type?(void 0!==e.caid&&(t.assetIndex=e.caid),void 0!==e.apar&&(t.assetTotal=e.apar.t,t.assetDefaultFrozen=e.apar.df,void 0!==e.apar.dc&&(t.assetDecimals=e.apar.dc),void 0!==e.apar.m&&(t.assetManager=N(L(new Uint8Array(e.apar.m)))),void 0!==e.apar.r&&(t.assetReserve=N(L(new Uint8Array(e.apar.r)))),void 0!==e.apar.f&&(t.assetFreeze=N(L(new Uint8Array(e.apar.f)))),void 0!==e.apar.c&&(t.assetClawback=N(L(new Uint8Array(e.apar.c)))),void 0!==e.apar.un&&(t.assetUnitName=e.apar.un),void 0!==e.apar.an&&(t.assetName=e.apar.an),void 0!==e.apar.au&&(t.assetURL=e.apar.au),void 0!==e.apar.am&&(t.assetMetadataHash=e.apar.am))):"axfer"===e.type?(void 0!==e.xaid&&(t.assetIndex=e.xaid),void 0!==e.aamt&&(t.amount=e.aamt),void 0!==e.aclose&&(t.closeRemainderTo=N(L(new Uint8Array(e.aclose)))),void 0!==e.asnd&&(t.assetRevocationTarget=N(L(new Uint8Array(e.asnd)))),t.to=N(L(new Uint8Array(e.arcv)))):"afrz"===e.type?(void 0!==e.afrz&&(t.freezeState=e.afrz),void 0!==e.faid&&(t.assetIndex=e.faid),t.freezeAccount=N(L(new Uint8Array(e.fadd)))):"appl"===e.type?(void 0!==e.apid&&(t.appIndex=e.apid),void 0!==e.apan&&(t.appOnComplete=e.apan),void 0!==e.apls&&(void 0!==e.apls.nui&&(t.appLocalInts=e.apls.nui),void 0!==e.apls.nbs&&(t.appLocalByteSlices=e.apls.nbs)),void 0!==e.apgs&&(void 0!==e.apgs.nui&&(t.appGlobalInts=e.apgs.nui),void 0!==e.apgs.nbs&&(t.appGlobalByteSlices=e.apgs.nbs)),void 0!==e.apep&&(t.extraPages=e.apep),void 0!==e.apap&&(t.appApprovalProgram=new Uint8Array(e.apap)),void 0!==e.apsu&&(t.appClearProgram=new Uint8Array(e.apsu)),void 0!==e.apaa&&(t.appArgs=e.apaa.map((e=>new Uint8Array(e)))),void 0!==e.apat&&(t.appAccounts=e.apat.map((e=>N(L(new Uint8Array(e)))))),void 0!==e.apfa&&(t.appForeignApps=e.apfa),void 0!==e.apas&&(t.appForeignAssets=e.apas),void 0!==e.apbx&&(t.boxes=e.apbx.map((e=>({appIndex:e.i?t.appForeignApps[e.i-1]:0,name:e.n}))))):"stpf"===e.type&&(void 0!==e.sptype&&(t.stateProofType=e.sptype),void 0!==e.sp&&(t.stateProof=e.sp),void 0!==e.spmsg&&(t.stateProofMessage=e.spmsg)),t}estimateSize(){return this.toByte().length+75}bytesToSign(){const e=this.toByte();return a.lW.from(b(this.tag,e))}toByte(){return q(this.get_obj_for_encoding())}rawSignTxn(e){const t=A(this.bytesToSign(),e);return a.lW.from(t)}signTxn(e){const t={sig:this.rawSignTxn(e),txn:this.get_obj_for_encoding()},n=S(e).publicKey;return L(n)!==L(this.from.publicKey)&&(t.sgnr=a.lW.from(n)),new Uint8Array(q(t))}attachSignature(e,t){if(!x(t.length))throw new Error("Invalid signature length");const n={sig:a.lW.from(t),txn:this.get_obj_for_encoding()};if(e!==L(this.from.publicKey)){const t=N(e).publicKey;n.sgnr=a.lW.from(t)}return new Uint8Array(q(n))}rawTxID(){const e=this.toByte(),t=a.lW.from(b(this.tag,e));return a.lW.from(y(t))}txID(){const e=this.rawTxID();return k().encode(e).slice(0,52)}addLease(e,t=0){let n;if(void 0!==e){if(e.constructor!==Uint8Array)throw Error("lease must be a Uint8Array.");if(32!==e.length)throw Error(`lease must be of length ${32..toString()}.`);n=new Uint8Array(e)}else n=new Uint8Array(0);this.lease=n,0!==t&&(this.fee+=37*t)}addRekey(e,t=0){void 0!==e&&(this.reKeyTo=N(e)),0!==t&&(this.fee+=37*t)}_getDictForDisplay(){const e={...this};return e.tag=e.tag.toString(),e.from=L(e.from.publicKey),void 0!==e.to&&(e.to=L(e.to.publicKey)),void 0!==e.freezeAccount&&(e.freezeAccount=L(e.freezeAccount.publicKey)),void 0!==e.closeRemainderTo&&(e.closeRemainderTo=L(e.closeRemainderTo.publicKey)),void 0!==e.assetManager&&(e.assetManager=L(e.assetManager.publicKey)),void 0!==e.assetReserve&&(e.assetReserve=L(e.assetReserve.publicKey)),void 0!==e.assetFreeze&&(e.assetFreeze=L(e.assetFreeze.publicKey)),void 0!==e.assetClawback&&(e.assetClawback=L(e.assetClawback.publicKey)),void 0!==e.assetRevocationTarget&&(e.assetRevocationTarget=L(e.assetRevocationTarget.publicKey)),void 0!==e.reKeyTo&&(e.reKeyTo=L(e.reKeyTo.publicKey)),e.genesisHash=e.genesisHash.toString("base64"),e}prettyPrint(){console.log(this._getDictForDisplay())}toString(){return JSON.stringify(this._getDictForDisplay())}}function Y(e){return q({txn:e.get_obj_for_encoding()})}function J(e){return q(e.get_obj_for_encoding())}function Q(e){const t=z(e);return X.from_obj_for_encoding(t)}function $(e){const t=z(e);return{...t,txn:X.from_obj_for_encoding(t.txn)}}function ee(e){return e instanceof X?e:new X(e)}class te{constructor({bidderKey:e,bidAmount:t,bidID:n,auctionKey:r,auctionID:i,maxPrice:o}){this.name="Bid",this.tag=a.lW.from([97,66]);const s=N(e),c=N(r);if(!Number.isSafeInteger(t)||t<0)throw Error("Bid amount must be positive and 2^53-1");if(!Number.isSafeInteger(n)||n<0)throw Error("BidID must be positive and 2^53-1");if(!Number.isSafeInteger(i)||i<0)throw Error("auctionID must be positive");Object.assign(this,{bidderKey:s,bidAmount:t,bidID:n,auctionKey:c,auctionID:i,maxPrice:o})}get_obj_for_encoding(){return{bidder:a.lW.from(this.bidderKey.publicKey),cur:this.bidAmount,price:this.maxPrice,id:this.bidID,auc:a.lW.from(this.auctionKey.publicKey),aid:this.auctionID}}signBid(e){const t=q(this.get_obj_for_encoding()),n=A(a.lW.from(b(this.tag,t)),e),r={sig:a.lW.from(n),bid:this.get_obj_for_encoding()};return new Uint8Array(q({t:"b",b:r}))}}const ne=1e6,re="Microalgos should be positive and less than 2^53 - 1.";function ie(e){if(e<0||!Number.isSafeInteger(e))throw new Error(re);return e/ne}function oe(e){const t=e*ne;return Math.round(t)}class se extends Error{constructor(e,t){super(e),this.response=t,this.name="URLTokenBaseHTTPError",this.response=t}}class ae{constructor(e,t,n,r={}){this.defaultHeaders=r;const i=t.endsWith("/")?t:`${t}/`,o=new URL(i);if("undefined"!==typeof n&&(o.port=n.toString()),0===o.protocol.length)throw new Error("Invalid base server URL, protocol must be defined.");this.baseURL=o,this.tokenHeader=e}getURL(e,t){let n;n=e.startsWith("./")?e:e.startsWith("/")?`.${e}`:`./${e}`;const r=new URL(n,this.baseURL);if(t)for(const[i,o]of Object.entries(t))r.searchParams.set(i,o);return r.toString()}static formatFetchResponseHeaders(e){const t={};return e.forEach(((e,n)=>{t[e]=n})),t}static async checkHttpError(e){if(e.ok)return;let t=null,n=null;try{t=new Uint8Array(await e.arrayBuffer());const r=JSON.parse(a.lW.from(t).toString());r.message&&(n=r.message)}catch(i){}let r=`Network request error. Received status ${e.status} (${e.statusText})`;throw n&&(r+=`: ${n}`),new se(r,{body:t,status:e.status,headers:ae.formatFetchResponseHeaders(e.headers)})}static async formatFetchResponse(e){return await this.checkHttpError(e),{body:new Uint8Array(await e.arrayBuffer()),status:e.status,headers:ae.formatFetchResponseHeaders(e.headers)}}async get(e,t,n={}){const r={...this.tokenHeader,...this.defaultHeaders,...n},i=await fetch(this.getURL(e,t),{headers:r});return ae.formatFetchResponse(i)}async post(e,t,n,r={}){const i={...this.tokenHeader,...this.defaultHeaders,...r},o=await fetch(this.getURL(e,n),{method:"POST",body:t,headers:i});return ae.formatFetchResponse(o)}async delete(e,t,n,r={}){const i={...this.tokenHeader,...this.defaultHeaders,...r},o=await fetch(this.getURL(e,n),{method:"DELETE",body:t,headers:i});return ae.formatFetchResponse(o)}}function ce(e){return Object.keys(e).reduce(((t,n)=>(t[n.toLowerCase()]=e[n],t)),{})}class ue{constructor(e,t,n,r={}){this.bc=void 0!==t?new ae(e,t,n,r):e}static parseJSON(e,t,n={}){try{return 0===Object.keys(n).length?e&&JSON.parse(e):e&&function(e,t){const n=t&&t.intDecoding?t.intDecoding:p.DEFAULT;return g.parse(e,((e,t)=>{if(null!=t&&"object"===typeof t&&null==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,Object.prototype),"bigint"===typeof t){if("safe"===n&&t>Number.MAX_SAFE_INTEGER)throw new Error(`Integer exceeds maximum safe integer: ${t.toString()}. Try parsing with a different intDecoding option.`);return"bigint"===n||"mixed"===n&&t>Number.MAX_SAFE_INTEGER?t:Number(t)}return"number"===typeof t&&"bigint"===n&&Number.isInteger(t)?BigInt(t):t}))}(e,n)}catch(r){const n=r;throw n.rawResponse=e||null,n.statusCode=t,n}}static serializeData(e,t){if(!e)return new Uint8Array(0);if("application/json"===t["content-type"])return new Uint8Array(a.lW.from(JSON.stringify(e)));if("string"===typeof e)return new Uint8Array(a.lW.from(e));if(e instanceof Uint8Array)return e;throw new Error("provided data is neither a string nor a Uint8Array and content-type is not application/json")}static prepareResponse(e,t,n,r={}){let i,{body:o}=e;return"application/msgpack"!==t&&(i=o&&a.lW.from(o).toString()||""),n&&"application/json"===t&&(o=ue.parseJSON(i,e.status,r)),{...e,body:o,text:i,ok:2===Math.trunc(e.status/100)}}static prepareResponseError(e){return e.response&&(e.response=ue.prepareResponse(e.response,"application/json",!0),e.status=e.response.status),e}async get(e,t,n={},r={},i=!0){const o=function(e){return void 0!==e&&Object.prototype.hasOwnProperty.call(e,"format")&&"msgpack"===e.format?"application/msgpack":"application/json"}(t),s={...n,accept:o};try{const n=await this.bc.get(e,function(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(e[t]&&0!==e[t].length||delete e[t]);return e}(t),s);return ue.prepareResponse(n,o,i,r)}catch(a){throw ue.prepareResponseError(a)}}async post(e,t,n={},r,i=!0){const o={"content-type":"application/json",...ce(n)};try{const n=await this.bc.post(e,ue.serializeData(t,o),r,o);return ue.prepareResponse(n,"application/json",i)}catch(s){throw ue.prepareResponseError(s)}}async delete(e,t,n={},r=!0){const i={"content-type":"application/json",...ce(n)},o=await this.bc.delete(e,ue.serializeData(t,i),void 0,i);return ue.prepareResponse(o,"application/json",r)}}class le{constructor(e,t,n,r,i={}){if("function"===typeof t.get)this.c=new ue(t);else{let o;o="string"===typeof t?function(e="",t){const n={};return""===e||(n[t]=e),n}(t,e):t,this.c=new ue(o,n,r,i)}this.intDecoding=p.DEFAULT}setIntEncoding(e){this.intDecoding=e}getIntEncoding(){return this.intDecoding}}function de(e,t){let n;if(e instanceof Uint8Array)n=t?e:a.lW.from(e).toString("base64");else if("function"===typeof e.get_obj_for_encoding)n=e.get_obj_for_encoding(t);else if(Array.isArray(e)){n=[];for(const r of e)n.push(de(r,t))}else if("object"===typeof e){const r={};for(const n of Object.keys(e))r[n]=de(e[n],t);n=r}else{if(!function(e){return void 0===e||null==e||"object"!==typeof e&&"function"!==typeof e}(e))throw new Error(`Unsupported value: ${String(e)}`);n=e}return n}class fe{get_obj_for_encoding(e=!1){const t={};for(const n of Object.keys(this.attribute_map)){const r=this.attribute_map[n],i=this[n];"undefined"!==typeof i&&(t[r]=null===i?null:de(i,e))}return t}}class he extends fe{constructor({address:e,amount:t,amountWithoutPendingRewards:n,minBalance:r,pendingRewards:i,rewards:o,round:s,status:a,totalAppsOptedIn:c,totalAssetsOptedIn:u,totalCreatedApps:l,totalCreatedAssets:d,appsLocalState:f,appsTotalExtraPages:h,appsTotalSchema:p,assets:g,authAddr:m,createdApps:b,createdAssets:y,participation:v,rewardBase:w,sigType:x,totalBoxBytes:S,totalBoxes:A}){super(),this.address=e,this.amount=t,this.amountWithoutPendingRewards=n,this.minBalance=r,this.pendingRewards=i,this.rewards=o,this.round=s,this.status=a,this.totalAppsOptedIn=c,this.totalAssetsOptedIn=u,this.totalCreatedApps=l,this.totalCreatedAssets=d,this.appsLocalState=f,this.appsTotalExtraPages=h,this.appsTotalSchema=p,this.assets=g,this.authAddr=m,this.createdApps=b,this.createdAssets=y,this.participation=v,this.rewardBase=w,this.sigType=x,this.totalBoxBytes=S,this.totalBoxes=A,this.attribute_map={address:"address",amount:"amount",amountWithoutPendingRewards:"amount-without-pending-rewards",minBalance:"min-balance",pendingRewards:"pending-rewards",rewards:"rewards",round:"round",status:"status",totalAppsOptedIn:"total-apps-opted-in",totalAssetsOptedIn:"total-assets-opted-in",totalCreatedApps:"total-created-apps",totalCreatedAssets:"total-created-assets",appsLocalState:"apps-local-state",appsTotalExtraPages:"apps-total-extra-pages",appsTotalSchema:"apps-total-schema",assets:"assets",authAddr:"auth-addr",createdApps:"created-apps",createdAssets:"created-assets",participation:"participation",rewardBase:"reward-base",sigType:"sig-type",totalBoxBytes:"total-box-bytes",totalBoxes:"total-boxes"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["amount-without-pending-rewards"])throw new Error(`Response is missing required field 'amount-without-pending-rewards': ${e}`);if("undefined"===typeof e["min-balance"])throw new Error(`Response is missing required field 'min-balance': ${e}`);if("undefined"===typeof e["pending-rewards"])throw new Error(`Response is missing required field 'pending-rewards': ${e}`);if("undefined"===typeof e.rewards)throw new Error(`Response is missing required field 'rewards': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.status)throw new Error(`Response is missing required field 'status': ${e}`);if("undefined"===typeof e["total-apps-opted-in"])throw new Error(`Response is missing required field 'total-apps-opted-in': ${e}`);if("undefined"===typeof e["total-assets-opted-in"])throw new Error(`Response is missing required field 'total-assets-opted-in': ${e}`);if("undefined"===typeof e["total-created-apps"])throw new Error(`Response is missing required field 'total-created-apps': ${e}`);if("undefined"===typeof e["total-created-assets"])throw new Error(`Response is missing required field 'total-created-assets': ${e}`);return new he({address:e.address,amount:e.amount,amountWithoutPendingRewards:e["amount-without-pending-rewards"],minBalance:e["min-balance"],pendingRewards:e["pending-rewards"],rewards:e.rewards,round:e.round,status:e.status,totalAppsOptedIn:e["total-apps-opted-in"],totalAssetsOptedIn:e["total-assets-opted-in"],totalCreatedApps:e["total-created-apps"],totalCreatedAssets:e["total-created-assets"],appsLocalState:"undefined"!==typeof e["apps-local-state"]?e["apps-local-state"].map(Se.from_obj_for_encoding):void 0,appsTotalExtraPages:e["apps-total-extra-pages"],appsTotalSchema:"undefined"!==typeof e["apps-total-schema"]?_e.from_obj_for_encoding(e["apps-total-schema"]):void 0,assets:"undefined"!==typeof e.assets?e.assets.map(Ie.from_obj_for_encoding):void 0,authAddr:e["auth-addr"],createdApps:"undefined"!==typeof e["created-apps"]?e["created-apps"].map(ye.from_obj_for_encoding):void 0,createdAssets:"undefined"!==typeof e["created-assets"]?e["created-assets"].map(Ce.from_obj_for_encoding):void 0,participation:"undefined"!==typeof e.participation?me.from_obj_for_encoding(e.participation):void 0,rewardBase:e["reward-base"],sigType:e["sig-type"],totalBoxBytes:e["total-box-bytes"],totalBoxes:e["total-boxes"]})}}class pe extends fe{constructor({round:e,appLocalState:t,createdApp:n}){super(),this.round=e,this.appLocalState=t,this.createdApp=n,this.attribute_map={round:"round",appLocalState:"app-local-state",createdApp:"created-app"}}static from_obj_for_encoding(e){if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);return new pe({round:e.round,appLocalState:"undefined"!==typeof e["app-local-state"]?Se.from_obj_for_encoding(e["app-local-state"]):void 0,createdApp:"undefined"!==typeof e["created-app"]?Ae.from_obj_for_encoding(e["created-app"]):void 0})}}class ge extends fe{constructor({round:e,assetHolding:t,createdAsset:n}){super(),this.round=e,this.assetHolding=t,this.createdAsset=n,this.attribute_map={round:"round",assetHolding:"asset-holding",createdAsset:"created-asset"}}static from_obj_for_encoding(e){if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);return new ge({round:e.round,assetHolding:"undefined"!==typeof e["asset-holding"]?Ie.from_obj_for_encoding(e["asset-holding"]):void 0,createdAsset:"undefined"!==typeof e["created-asset"]?Te.from_obj_for_encoding(e["created-asset"]):void 0})}}class me extends fe{constructor({selectionParticipationKey:e,voteFirstValid:t,voteKeyDilution:n,voteLastValid:r,voteParticipationKey:i,stateProofKey:o}){super(),this.selectionParticipationKey="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.voteFirstValid=t,this.voteKeyDilution=n,this.voteLastValid=r,this.voteParticipationKey="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.stateProofKey="string"===typeof o?new Uint8Array(a.lW.from(o,"base64")):o,this.attribute_map={selectionParticipationKey:"selection-participation-key",voteFirstValid:"vote-first-valid",voteKeyDilution:"vote-key-dilution",voteLastValid:"vote-last-valid",voteParticipationKey:"vote-participation-key",stateProofKey:"state-proof-key"}}static from_obj_for_encoding(e){if("undefined"===typeof e["selection-participation-key"])throw new Error(`Response is missing required field 'selection-participation-key': ${e}`);if("undefined"===typeof e["vote-first-valid"])throw new Error(`Response is missing required field 'vote-first-valid': ${e}`);if("undefined"===typeof e["vote-key-dilution"])throw new Error(`Response is missing required field 'vote-key-dilution': ${e}`);if("undefined"===typeof e["vote-last-valid"])throw new Error(`Response is missing required field 'vote-last-valid': ${e}`);if("undefined"===typeof e["vote-participation-key"])throw new Error(`Response is missing required field 'vote-participation-key': ${e}`);return new me({selectionParticipationKey:e["selection-participation-key"],voteFirstValid:e["vote-first-valid"],voteKeyDilution:e["vote-key-dilution"],voteLastValid:e["vote-last-valid"],voteParticipationKey:e["vote-participation-key"],stateProofKey:e["state-proof-key"]})}}class be extends fe{constructor({address:e,delta:t}){super(),this.address=e,this.delta=t,this.attribute_map={address:"address",delta:"delta"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if(!Array.isArray(e.delta))throw new Error(`Response is missing required array field 'delta': ${e}`);return new be({address:e.address,delta:e.delta.map(Xe.from_obj_for_encoding)})}}class ye extends fe{constructor({id:e,params:t}){super(),this.id=e,this.params=t,this.attribute_map={id:"id",params:"params"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);if("undefined"===typeof e.params)throw new Error(`Response is missing required field 'params': ${e}`);return new ye({id:e.id,params:Ae.from_obj_for_encoding(e.params)})}}class ve extends fe{constructor({id:e,appBoxes:t,appGlobals:n,appLocals:r}){super(),this.id=e,this.appBoxes=t,this.appGlobals=n,this.appLocals=r,this.attribute_map={id:"id",appBoxes:"app-boxes",appGlobals:"app-globals",appLocals:"app-locals"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);return new ve({id:e.id,appBoxes:"undefined"!==typeof e["app-boxes"]?we.from_obj_for_encoding(e["app-boxes"]):void 0,appGlobals:"undefined"!==typeof e["app-globals"]?we.from_obj_for_encoding(e["app-globals"]):void 0,appLocals:"undefined"!==typeof e["app-locals"]?e["app-locals"].map(we.from_obj_for_encoding):void 0})}}class we extends fe{constructor({kvs:e,account:t}){super(),this.kvs=e,this.account=t,this.attribute_map={kvs:"kvs",account:"account"}}static from_obj_for_encoding(e){if(!Array.isArray(e.kvs))throw new Error(`Response is missing required array field 'kvs': ${e}`);return new we({kvs:e.kvs.map(Me.from_obj_for_encoding),account:e.account})}}class xe extends fe{constructor({account:e,app:t}){super(),this.account=e,this.app=t,this.attribute_map={account:"account",app:"app"}}static from_obj_for_encoding(e){if("undefined"===typeof e.account)throw new Error(`Response is missing required field 'account': ${e}`);if("undefined"===typeof e.app)throw new Error(`Response is missing required field 'app': ${e}`);return new xe({account:e.account,app:e.app})}}class Se extends fe{constructor({id:e,schema:t,keyValue:n}){super(),this.id=e,this.schema=t,this.keyValue=n,this.attribute_map={id:"id",schema:"schema",keyValue:"key-value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);if("undefined"===typeof e.schema)throw new Error(`Response is missing required field 'schema': ${e}`);return new Se({id:e.id,schema:_e.from_obj_for_encoding(e.schema),keyValue:"undefined"!==typeof e["key-value"]?e["key-value"].map(wt.from_obj_for_encoding):void 0})}}class Ae extends fe{constructor({approvalProgram:e,clearStateProgram:t,creator:n,extraProgramPages:r,globalState:i,globalStateSchema:o,localStateSchema:s}){super(),this.approvalProgram="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.clearStateProgram="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.creator=n,this.extraProgramPages=r,this.globalState=i,this.globalStateSchema=o,this.localStateSchema=s,this.attribute_map={approvalProgram:"approval-program",clearStateProgram:"clear-state-program",creator:"creator",extraProgramPages:"extra-program-pages",globalState:"global-state",globalStateSchema:"global-state-schema",localStateSchema:"local-state-schema"}}static from_obj_for_encoding(e){if("undefined"===typeof e["approval-program"])throw new Error(`Response is missing required field 'approval-program': ${e}`);if("undefined"===typeof e["clear-state-program"])throw new Error(`Response is missing required field 'clear-state-program': ${e}`);if("undefined"===typeof e.creator)throw new Error(`Response is missing required field 'creator': ${e}`);return new Ae({approvalProgram:e["approval-program"],clearStateProgram:e["clear-state-program"],creator:e.creator,extraProgramPages:e["extra-program-pages"],globalState:"undefined"!==typeof e["global-state"]?e["global-state"].map(wt.from_obj_for_encoding):void 0,globalStateSchema:"undefined"!==typeof e["global-state-schema"]?_e.from_obj_for_encoding(e["global-state-schema"]):void 0,localStateSchema:"undefined"!==typeof e["local-state-schema"]?_e.from_obj_for_encoding(e["local-state-schema"]):void 0})}}class Ee extends fe{constructor({appStateType:e,key:t,operation:n,account:r,newValue:i}){super(),this.appStateType=e,this.key="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.operation=n,this.account=r,this.newValue=i,this.attribute_map={appStateType:"app-state-type",key:"key",operation:"operation",account:"account",newValue:"new-value"}}static from_obj_for_encoding(e){if("undefined"===typeof e["app-state-type"])throw new Error(`Response is missing required field 'app-state-type': ${e}`);if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.operation)throw new Error(`Response is missing required field 'operation': ${e}`);return new Ee({appStateType:e["app-state-type"],key:e.key,operation:e.operation,account:e.account,newValue:"undefined"!==typeof e["new-value"]?Pe.from_obj_for_encoding(e["new-value"]):void 0})}}class _e extends fe{constructor({numUint:e,numByteSlice:t}){super(),this.numUint=e,this.numByteSlice=t,this.attribute_map={numUint:"num-uint",numByteSlice:"num-byte-slice"}}static from_obj_for_encoding(e){if("undefined"===typeof e["num-uint"])throw new Error(`Response is missing required field 'num-uint': ${e}`);if("undefined"===typeof e["num-byte-slice"])throw new Error(`Response is missing required field 'num-byte-slice': ${e}`);return new _e({numUint:e["num-uint"],numByteSlice:e["num-byte-slice"]})}}class Ce extends fe{constructor({index:e,params:t}){super(),this.index=e,this.params=t,this.attribute_map={index:"index",params:"params"}}static from_obj_for_encoding(e){if("undefined"===typeof e.index)throw new Error(`Response is missing required field 'index': ${e}`);if("undefined"===typeof e.params)throw new Error(`Response is missing required field 'params': ${e}`);return new Ce({index:e.index,params:Te.from_obj_for_encoding(e.params)})}}class Ie extends fe{constructor({amount:e,assetId:t,isFrozen:n}){super(),this.amount=e,this.assetId=t,this.isFrozen=n,this.attribute_map={amount:"amount",assetId:"asset-id",isFrozen:"is-frozen"}}static from_obj_for_encoding(e){if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["asset-id"])throw new Error(`Response is missing required field 'asset-id': ${e}`);if("undefined"===typeof e["is-frozen"])throw new Error(`Response is missing required field 'is-frozen': ${e}`);return new Ie({amount:e.amount,assetId:e["asset-id"],isFrozen:e["is-frozen"]})}}class ke extends fe{constructor({account:e,asset:t}){super(),this.account=e,this.asset=t,this.attribute_map={account:"account",asset:"asset"}}static from_obj_for_encoding(e){if("undefined"===typeof e.account)throw new Error(`Response is missing required field 'account': ${e}`);if("undefined"===typeof e.asset)throw new Error(`Response is missing required field 'asset': ${e}`);return new ke({account:e.account,asset:e.asset})}}class Te extends fe{constructor({creator:e,decimals:t,total:n,clawback:r,defaultFrozen:i,freeze:o,manager:s,metadataHash:c,name:u,nameB64:l,reserve:d,unitName:f,unitNameB64:h,url:p,urlB64:g}){super(),this.creator=e,this.decimals=t,this.total=n,this.clawback=r,this.defaultFrozen=i,this.freeze=o,this.manager=s,this.metadataHash="string"===typeof c?new Uint8Array(a.lW.from(c,"base64")):c,this.name=u,this.nameB64="string"===typeof l?new Uint8Array(a.lW.from(l,"base64")):l,this.reserve=d,this.unitName=f,this.unitNameB64="string"===typeof h?new Uint8Array(a.lW.from(h,"base64")):h,this.url=p,this.urlB64="string"===typeof g?new Uint8Array(a.lW.from(g,"base64")):g,this.attribute_map={creator:"creator",decimals:"decimals",total:"total",clawback:"clawback",defaultFrozen:"default-frozen",freeze:"freeze",manager:"manager",metadataHash:"metadata-hash",name:"name",nameB64:"name-b64",reserve:"reserve",unitName:"unit-name",unitNameB64:"unit-name-b64",url:"url",urlB64:"url-b64"}}static from_obj_for_encoding(e){if("undefined"===typeof e.creator)throw new Error(`Response is missing required field 'creator': ${e}`);if("undefined"===typeof e.decimals)throw new Error(`Response is missing required field 'decimals': ${e}`);if("undefined"===typeof e.total)throw new Error(`Response is missing required field 'total': ${e}`);return new Te({creator:e.creator,decimals:e.decimals,total:e.total,clawback:e.clawback,defaultFrozen:e["default-frozen"],freeze:e.freeze,manager:e.manager,metadataHash:e["metadata-hash"],name:e.name,nameB64:e["name-b64"],reserve:e.reserve,unitName:e["unit-name"],unitNameB64:e["unit-name-b64"],url:e.url,urlB64:e["url-b64"]})}}class Me extends fe{constructor({key:e,value:t}){super(),this.key="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new Me({key:e.key,value:Pe.from_obj_for_encoding(e.value)})}}class Pe extends fe{constructor({type:e,bytes:t,uint:n}){super(),this.type=e,this.bytes="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.uint=n,this.attribute_map={type:"type",bytes:"bytes",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.type)throw new Error(`Response is missing required field 'type': ${e}`);return new Pe({type:e.type,bytes:e.bytes,uint:e.uint})}}class Oe extends fe{constructor({blockhash:e}){super(),this.blockhash=e,this.attribute_map={blockhash:"blockHash"}}static from_obj_for_encoding(e){if("undefined"===typeof e.blockHash)throw new Error(`Response is missing required field 'blockHash': ${e}`);return new Oe({blockhash:e.blockHash})}}class Re extends fe{constructor({block:e,cert:t}){super(),this.block=e,this.cert=t,this.attribute_map={block:"block",cert:"cert"}}static from_obj_for_encoding(e){if("undefined"===typeof e.block)throw new Error(`Response is missing required field 'block': ${e}`);return new Re({block:e.block,cert:e.cert})}}class Ne extends fe{constructor({blocktxids:e}){super(),this.blocktxids=e,this.attribute_map={blocktxids:"blockTxids"}}static from_obj_for_encoding(e){if(!Array.isArray(e.blockTxids))throw new Error(`Response is missing required array field 'blockTxids': ${e}`);return new Ne({blocktxids:e.blockTxids})}}class Be extends fe{constructor({name:e,round:t,value:n}){super(),this.name="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.round=t,this.value="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.attribute_map={name:"name",round:"round",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new Be({name:e.name,round:e.round,value:e.value})}}class Le extends fe{constructor({name:e}){super(),this.name="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.attribute_map={name:"name"}}static from_obj_for_encoding(e){if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);return new Le({name:e.name})}}class De extends fe{constructor({app:e,name:t}){super(),this.app=e,this.name="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={app:"app",name:"name"}}static from_obj_for_encoding(e){if("undefined"===typeof e.app)throw new Error(`Response is missing required field 'app': ${e}`);if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);return new De({app:e.app,name:e.name})}}class Ue extends fe{constructor({boxes:e}){super(),this.boxes=e,this.attribute_map={boxes:"boxes"}}static from_obj_for_encoding(e){if(!Array.isArray(e.boxes))throw new Error(`Response is missing required array field 'boxes': ${e}`);return new Ue({boxes:e.boxes.map(Le.from_obj_for_encoding)})}}class je extends fe{constructor({branch:e,buildNumber:t,channel:n,commitHash:r,major:i,minor:o}){super(),this.branch=e,this.buildNumber=t,this.channel=n,this.commitHash=r,this.major=i,this.minor=o,this.attribute_map={branch:"branch",buildNumber:"build_number",channel:"channel",commitHash:"commit_hash",major:"major",minor:"minor"}}static from_obj_for_encoding(e){if("undefined"===typeof e.branch)throw new Error(`Response is missing required field 'branch': ${e}`);if("undefined"===typeof e.build_number)throw new Error(`Response is missing required field 'build_number': ${e}`);if("undefined"===typeof e.channel)throw new Error(`Response is missing required field 'channel': ${e}`);if("undefined"===typeof e.commit_hash)throw new Error(`Response is missing required field 'commit_hash': ${e}`);if("undefined"===typeof e.major)throw new Error(`Response is missing required field 'major': ${e}`);if("undefined"===typeof e.minor)throw new Error(`Response is missing required field 'minor': ${e}`);return new je({branch:e.branch,buildNumber:e.build_number,channel:e.channel,commitHash:e.commit_hash,major:e.major,minor:e.minor})}}class Fe extends fe{constructor({hash:e,result:t,sourcemap:n}){super(),this.hash=e,this.result=t,this.sourcemap=n,this.attribute_map={hash:"hash",result:"result",sourcemap:"sourcemap"}}static from_obj_for_encoding(e){if("undefined"===typeof e.hash)throw new Error(`Response is missing required field 'hash': ${e}`);if("undefined"===typeof e.result)throw new Error(`Response is missing required field 'result': ${e}`);return new Fe({hash:e.hash,result:e.result,sourcemap:e.sourcemap})}}class Ve extends fe{constructor({result:e}){super(),this.result=e,this.attribute_map={result:"result"}}static from_obj_for_encoding(e){if("undefined"===typeof e.result)throw new Error(`Response is missing required field 'result': ${e}`);return new Ve({result:e.result})}}class qe extends fe{constructor({accounts:e,apps:t,latestTimestamp:n,protocolVersion:r,round:i,sources:o,txns:s}){super(),this.accounts=e,this.apps=t,this.latestTimestamp=n,this.protocolVersion=r,this.round=i,this.sources=o,this.txns=s,this.attribute_map={accounts:"accounts",apps:"apps",latestTimestamp:"latest-timestamp",protocolVersion:"protocol-version",round:"round",sources:"sources",txns:"txns"}}static from_obj_for_encoding(e){if(!Array.isArray(e.accounts))throw new Error(`Response is missing required array field 'accounts': ${e}`);if(!Array.isArray(e.apps))throw new Error(`Response is missing required array field 'apps': ${e}`);if("undefined"===typeof e["latest-timestamp"])throw new Error(`Response is missing required field 'latest-timestamp': ${e}`);if("undefined"===typeof e["protocol-version"])throw new Error(`Response is missing required field 'protocol-version': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if(!Array.isArray(e.sources))throw new Error(`Response is missing required array field 'sources': ${e}`);if(!Array.isArray(e.txns))throw new Error(`Response is missing required array field 'txns': ${e}`);return new qe({accounts:e.accounts.map(he.from_obj_for_encoding),apps:e.apps.map(ye.from_obj_for_encoding),latestTimestamp:e["latest-timestamp"],protocolVersion:e["protocol-version"],round:e.round,sources:e.sources.map(He.from_obj_for_encoding),txns:e.txns})}}class ze extends fe{constructor({error:e,protocolVersion:t,txns:n}){super(),this.error=e,this.protocolVersion=t,this.txns=n,this.attribute_map={error:"error",protocolVersion:"protocol-version",txns:"txns"}}static from_obj_for_encoding(e){if("undefined"===typeof e.error)throw new Error(`Response is missing required field 'error': ${e}`);if("undefined"===typeof e["protocol-version"])throw new Error(`Response is missing required field 'protocol-version': ${e}`);if(!Array.isArray(e.txns))throw new Error(`Response is missing required array field 'txns': ${e}`);return new ze({error:e.error,protocolVersion:e["protocol-version"],txns:e.txns.map(Ge.from_obj_for_encoding)})}}class He extends fe{constructor({fieldName:e,source:t,txnIndex:n,appIndex:r}){super(),this.fieldName=e,this.source=t,this.txnIndex=n,this.appIndex=r,this.attribute_map={fieldName:"field-name",source:"source",txnIndex:"txn-index",appIndex:"app-index"}}static from_obj_for_encoding(e){if("undefined"===typeof e["field-name"])throw new Error(`Response is missing required field 'field-name': ${e}`);if("undefined"===typeof e.source)throw new Error(`Response is missing required field 'source': ${e}`);if("undefined"===typeof e["txn-index"])throw new Error(`Response is missing required field 'txn-index': ${e}`);if("undefined"===typeof e["app-index"])throw new Error(`Response is missing required field 'app-index': ${e}`);return new He({fieldName:e["field-name"],source:e.source,txnIndex:e["txn-index"],appIndex:e["app-index"]})}}class We extends fe{constructor({line:e,pc:t,stack:n,error:r,scratch:i}){super(),this.line=e,this.pc=t,this.stack=n,this.error=r,this.scratch=i,this.attribute_map={line:"line",pc:"pc",stack:"stack",error:"error",scratch:"scratch"}}static from_obj_for_encoding(e){if("undefined"===typeof e.line)throw new Error(`Response is missing required field 'line': ${e}`);if("undefined"===typeof e.pc)throw new Error(`Response is missing required field 'pc': ${e}`);if(!Array.isArray(e.stack))throw new Error(`Response is missing required array field 'stack': ${e}`);return new We({line:e.line,pc:e.pc,stack:e.stack.map(xt.from_obj_for_encoding),error:e.error,scratch:"undefined"!==typeof e.scratch?e.scratch.map(xt.from_obj_for_encoding):void 0})}}class Ge extends fe{constructor({disassembly:e,appCallMessages:t,appCallTrace:n,budgetAdded:r,budgetConsumed:i,globalDelta:o,localDeltas:s,logicSigDisassembly:a,logicSigMessages:c,logicSigTrace:u,logs:l}){super(),this.disassembly=e,this.appCallMessages=t,this.appCallTrace=n,this.budgetAdded=r,this.budgetConsumed=i,this.globalDelta=o,this.localDeltas=s,this.logicSigDisassembly=a,this.logicSigMessages=c,this.logicSigTrace=u,this.logs=l,this.attribute_map={disassembly:"disassembly",appCallMessages:"app-call-messages",appCallTrace:"app-call-trace",budgetAdded:"budget-added",budgetConsumed:"budget-consumed",globalDelta:"global-delta",localDeltas:"local-deltas",logicSigDisassembly:"logic-sig-disassembly",logicSigMessages:"logic-sig-messages",logicSigTrace:"logic-sig-trace",logs:"logs"}}static from_obj_for_encoding(e){if(!Array.isArray(e.disassembly))throw new Error(`Response is missing required array field 'disassembly': ${e}`);return new Ge({disassembly:e.disassembly,appCallMessages:e["app-call-messages"],appCallTrace:"undefined"!==typeof e["app-call-trace"]?e["app-call-trace"].map(We.from_obj_for_encoding):void 0,budgetAdded:e["budget-added"],budgetConsumed:e["budget-consumed"],globalDelta:"undefined"!==typeof e["global-delta"]?e["global-delta"].map(Xe.from_obj_for_encoding):void 0,localDeltas:"undefined"!==typeof e["local-deltas"]?e["local-deltas"].map(be.from_obj_for_encoding):void 0,logicSigDisassembly:e["logic-sig-disassembly"],logicSigMessages:e["logic-sig-messages"],logicSigTrace:"undefined"!==typeof e["logic-sig-trace"]?e["logic-sig-trace"].map(We.from_obj_for_encoding):void 0,logs:e.logs})}}class Ze extends fe{constructor({message:e,data:t}){super(),this.message=e,this.data=t,this.attribute_map={message:"message",data:"data"}}static from_obj_for_encoding(e){if("undefined"===typeof e.message)throw new Error(`Response is missing required field 'message': ${e}`);return new Ze({message:e.message,data:e.data})}}class Ke extends fe{constructor({action:e,bytes:t,uint:n}){super(),this.action=e,this.bytes=t,this.uint=n,this.attribute_map={action:"action",bytes:"bytes",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.action)throw new Error(`Response is missing required field 'action': ${e}`);return new Ke({action:e.action,bytes:e.bytes,uint:e.uint})}}class Xe extends fe{constructor({key:e,value:t}){super(),this.key=e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new Xe({key:e.key,value:Ke.from_obj_for_encoding(e.value)})}}class Ye extends fe{constructor({offset:e}){super(),this.offset=e,this.attribute_map={offset:"offset"}}static from_obj_for_encoding(e){if("undefined"===typeof e.offset)throw new Error(`Response is missing required field 'offset': ${e}`);return new Ye({offset:e.offset})}}class Je extends fe{constructor({round:e}){super(),this.round=e,this.attribute_map={round:"round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);return new Je({round:e.round})}}class Qe extends fe{constructor({key:e,value:t}){super(),this.key="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.value="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){return new Qe({key:e.key,value:e.value})}}class $e extends fe{constructor({delta:e,ids:t}){super(),this.delta=e,this.ids=t,this.attribute_map={delta:"Delta",ids:"Ids"}}static from_obj_for_encoding(e){if("undefined"===typeof e.Delta)throw new Error(`Response is missing required field 'Delta': ${e}`);if(!Array.isArray(e.Ids))throw new Error(`Response is missing required array field 'Ids': ${e}`);return new $e({delta:e.Delta,ids:e.Ids})}}class et extends fe{constructor({index:e,proof:t,treedepth:n}){super(),this.index=e,this.proof="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.treedepth=n,this.attribute_map={index:"index",proof:"proof",treedepth:"treedepth"}}static from_obj_for_encoding(e){if("undefined"===typeof e.index)throw new Error(`Response is missing required field 'index': ${e}`);if("undefined"===typeof e.proof)throw new Error(`Response is missing required field 'proof': ${e}`);if("undefined"===typeof e.treedepth)throw new Error(`Response is missing required field 'treedepth': ${e}`);return new et({index:e.index,proof:e.proof,treedepth:e.treedepth})}}class tt extends fe{constructor({catchupTime:e,lastRound:t,lastVersion:n,nextVersion:r,nextVersionRound:i,nextVersionSupported:o,stoppedAtUnsupportedRound:s,timeSinceLastRound:a,catchpoint:c,catchpointAcquiredBlocks:u,catchpointProcessedAccounts:l,catchpointProcessedKvs:d,catchpointTotalAccounts:f,catchpointTotalBlocks:h,catchpointTotalKvs:p,catchpointVerifiedAccounts:g,catchpointVerifiedKvs:m,lastCatchpoint:b,upgradeDelay:y,upgradeNextProtocolVoteBefore:v,upgradeNoVotes:w,upgradeNodeVote:x,upgradeVoteRounds:S,upgradeVotes:A,upgradeVotesRequired:E,upgradeYesVotes:_}){super(),this.catchupTime=e,this.lastRound=t,this.lastVersion=n,this.nextVersion=r,this.nextVersionRound=i,this.nextVersionSupported=o,this.stoppedAtUnsupportedRound=s,this.timeSinceLastRound=a,this.catchpoint=c,this.catchpointAcquiredBlocks=u,this.catchpointProcessedAccounts=l,this.catchpointProcessedKvs=d,this.catchpointTotalAccounts=f,this.catchpointTotalBlocks=h,this.catchpointTotalKvs=p,this.catchpointVerifiedAccounts=g,this.catchpointVerifiedKvs=m,this.lastCatchpoint=b,this.upgradeDelay=y,this.upgradeNextProtocolVoteBefore=v,this.upgradeNoVotes=w,this.upgradeNodeVote=x,this.upgradeVoteRounds=S,this.upgradeVotes=A,this.upgradeVotesRequired=E,this.upgradeYesVotes=_,this.attribute_map={catchupTime:"catchup-time",lastRound:"last-round",lastVersion:"last-version",nextVersion:"next-version",nextVersionRound:"next-version-round",nextVersionSupported:"next-version-supported",stoppedAtUnsupportedRound:"stopped-at-unsupported-round",timeSinceLastRound:"time-since-last-round",catchpoint:"catchpoint",catchpointAcquiredBlocks:"catchpoint-acquired-blocks",catchpointProcessedAccounts:"catchpoint-processed-accounts",catchpointProcessedKvs:"catchpoint-processed-kvs",catchpointTotalAccounts:"catchpoint-total-accounts",catchpointTotalBlocks:"catchpoint-total-blocks",catchpointTotalKvs:"catchpoint-total-kvs",catchpointVerifiedAccounts:"catchpoint-verified-accounts",catchpointVerifiedKvs:"catchpoint-verified-kvs",lastCatchpoint:"last-catchpoint",upgradeDelay:"upgrade-delay",upgradeNextProtocolVoteBefore:"upgrade-next-protocol-vote-before",upgradeNoVotes:"upgrade-no-votes",upgradeNodeVote:"upgrade-node-vote",upgradeVoteRounds:"upgrade-vote-rounds",upgradeVotes:"upgrade-votes",upgradeVotesRequired:"upgrade-votes-required",upgradeYesVotes:"upgrade-yes-votes"}}static from_obj_for_encoding(e){if("undefined"===typeof e["catchup-time"])throw new Error(`Response is missing required field 'catchup-time': ${e}`);if("undefined"===typeof e["last-round"])throw new Error(`Response is missing required field 'last-round': ${e}`);if("undefined"===typeof e["last-version"])throw new Error(`Response is missing required field 'last-version': ${e}`);if("undefined"===typeof e["next-version"])throw new Error(`Response is missing required field 'next-version': ${e}`);if("undefined"===typeof e["next-version-round"])throw new Error(`Response is missing required field 'next-version-round': ${e}`);if("undefined"===typeof e["next-version-supported"])throw new Error(`Response is missing required field 'next-version-supported': ${e}`);if("undefined"===typeof e["stopped-at-unsupported-round"])throw new Error(`Response is missing required field 'stopped-at-unsupported-round': ${e}`);if("undefined"===typeof e["time-since-last-round"])throw new Error(`Response is missing required field 'time-since-last-round': ${e}`);return new tt({catchupTime:e["catchup-time"],lastRound:e["last-round"],lastVersion:e["last-version"],nextVersion:e["next-version"],nextVersionRound:e["next-version-round"],nextVersionSupported:e["next-version-supported"],stoppedAtUnsupportedRound:e["stopped-at-unsupported-round"],timeSinceLastRound:e["time-since-last-round"],catchpoint:e.catchpoint,catchpointAcquiredBlocks:e["catchpoint-acquired-blocks"],catchpointProcessedAccounts:e["catchpoint-processed-accounts"],catchpointProcessedKvs:e["catchpoint-processed-kvs"],catchpointTotalAccounts:e["catchpoint-total-accounts"],catchpointTotalBlocks:e["catchpoint-total-blocks"],catchpointTotalKvs:e["catchpoint-total-kvs"],catchpointVerifiedAccounts:e["catchpoint-verified-accounts"],catchpointVerifiedKvs:e["catchpoint-verified-kvs"],lastCatchpoint:e["last-catchpoint"],upgradeDelay:e["upgrade-delay"],upgradeNextProtocolVoteBefore:e["upgrade-next-protocol-vote-before"],upgradeNoVotes:e["upgrade-no-votes"],upgradeNodeVote:e["upgrade-node-vote"],upgradeVoteRounds:e["upgrade-vote-rounds"],upgradeVotes:e["upgrade-votes"],upgradeVotesRequired:e["upgrade-votes-required"],upgradeYesVotes:e["upgrade-yes-votes"]})}}class nt extends fe{constructor({poolError:e,txn:t,applicationIndex:n,assetClosingAmount:r,assetIndex:i,closeRewards:o,closingAmount:s,confirmedRound:a,globalStateDelta:c,innerTxns:u,localStateDelta:l,logs:d,receiverRewards:f,senderRewards:h}){super(),this.poolError=e,this.txn=t,this.applicationIndex=n,this.assetClosingAmount=r,this.assetIndex=i,this.closeRewards=o,this.closingAmount=s,this.confirmedRound=a,this.globalStateDelta=c,this.innerTxns=u,this.localStateDelta=l,this.logs=d,this.receiverRewards=f,this.senderRewards=h,this.attribute_map={poolError:"pool-error",txn:"txn",applicationIndex:"application-index",assetClosingAmount:"asset-closing-amount",assetIndex:"asset-index",closeRewards:"close-rewards",closingAmount:"closing-amount",confirmedRound:"confirmed-round",globalStateDelta:"global-state-delta",innerTxns:"inner-txns",localStateDelta:"local-state-delta",logs:"logs",receiverRewards:"receiver-rewards",senderRewards:"sender-rewards"}}static from_obj_for_encoding(e){if("undefined"===typeof e["pool-error"])throw new Error(`Response is missing required field 'pool-error': ${e}`);if("undefined"===typeof e.txn)throw new Error(`Response is missing required field 'txn': ${e}`);return new nt({poolError:e["pool-error"],txn:e.txn,applicationIndex:e["application-index"],assetClosingAmount:e["asset-closing-amount"],assetIndex:e["asset-index"],closeRewards:e["close-rewards"],closingAmount:e["closing-amount"],confirmedRound:e["confirmed-round"],globalStateDelta:"undefined"!==typeof e["global-state-delta"]?e["global-state-delta"].map(Xe.from_obj_for_encoding):void 0,innerTxns:"undefined"!==typeof e["inner-txns"]?e["inner-txns"].map(nt.from_obj_for_encoding):void 0,localStateDelta:"undefined"!==typeof e["local-state-delta"]?e["local-state-delta"].map(be.from_obj_for_encoding):void 0,logs:e.logs,receiverRewards:e["receiver-rewards"],senderRewards:e["sender-rewards"]})}}class rt extends fe{constructor({topTransactions:e,totalTransactions:t}){super(),this.topTransactions=e,this.totalTransactions=t,this.attribute_map={topTransactions:"top-transactions",totalTransactions:"total-transactions"}}static from_obj_for_encoding(e){if(!Array.isArray(e["top-transactions"]))throw new Error(`Response is missing required array field 'top-transactions': ${e}`);if("undefined"===typeof e["total-transactions"])throw new Error(`Response is missing required field 'total-transactions': ${e}`);return new rt({topTransactions:e["top-transactions"],totalTransactions:e["total-transactions"]})}}class it extends fe{constructor({txid:e}){super(),this.txid=e,this.attribute_map={txid:"txId"}}static from_obj_for_encoding(e){if("undefined"===typeof e.txId)throw new Error(`Response is missing required field 'txId': ${e}`);return new it({txid:e.txId})}}class ot extends fe{constructor({newValue:e,slot:t}){super(),this.newValue=e,this.slot=t,this.attribute_map={newValue:"new-value",slot:"slot"}}static from_obj_for_encoding(e){if("undefined"===typeof e["new-value"])throw new Error(`Response is missing required field 'new-value': ${e}`);if("undefined"===typeof e.slot)throw new Error(`Response is missing required field 'slot': ${e}`);return new ot({newValue:Pe.from_obj_for_encoding(e["new-value"]),slot:e.slot})}}class st extends fe{constructor({appInitialStates:e}){super(),this.appInitialStates=e,this.attribute_map={appInitialStates:"app-initial-states"}}static from_obj_for_encoding(e){return new st({appInitialStates:"undefined"!==typeof e["app-initial-states"]?e["app-initial-states"].map(ve.from_obj_for_encoding):void 0})}}class at extends fe{constructor({txnGroups:e,allowEmptySignatures:t,allowMoreLogging:n,allowUnnamedResources:r,execTraceConfig:i,extraOpcodeBudget:o,round:s}){super(),this.txnGroups=e,this.allowEmptySignatures=t,this.allowMoreLogging=n,this.allowUnnamedResources=r,this.execTraceConfig=i,this.extraOpcodeBudget=o,this.round=s,this.attribute_map={txnGroups:"txn-groups",allowEmptySignatures:"allow-empty-signatures",allowMoreLogging:"allow-more-logging",allowUnnamedResources:"allow-unnamed-resources",execTraceConfig:"exec-trace-config",extraOpcodeBudget:"extra-opcode-budget",round:"round"}}static from_obj_for_encoding(e){if(!Array.isArray(e["txn-groups"]))throw new Error(`Response is missing required array field 'txn-groups': ${e}`);return new at({txnGroups:e["txn-groups"].map(ct.from_obj_for_encoding),allowEmptySignatures:e["allow-empty-signatures"],allowMoreLogging:e["allow-more-logging"],allowUnnamedResources:e["allow-unnamed-resources"],execTraceConfig:"undefined"!==typeof e["exec-trace-config"]?lt.from_obj_for_encoding(e["exec-trace-config"]):void 0,extraOpcodeBudget:e["extra-opcode-budget"],round:e.round})}}class ct extends fe{constructor({txns:e}){super(),this.txns=e,this.attribute_map={txns:"txns"}}static from_obj_for_encoding(e){if(!Array.isArray(e.txns))throw new Error(`Response is missing required array field 'txns': ${e}`);return new ct({txns:e.txns})}}class ut extends fe{constructor({lastRound:e,txnGroups:t,version:n,evalOverrides:r,execTraceConfig:i,initialStates:o}){super(),this.lastRound=e,this.txnGroups=t,this.version=n,this.evalOverrides=r,this.execTraceConfig=i,this.initialStates=o,this.attribute_map={lastRound:"last-round",txnGroups:"txn-groups",version:"version",evalOverrides:"eval-overrides",execTraceConfig:"exec-trace-config",initialStates:"initial-states"}}static from_obj_for_encoding(e){if("undefined"===typeof e["last-round"])throw new Error(`Response is missing required field 'last-round': ${e}`);if(!Array.isArray(e["txn-groups"]))throw new Error(`Response is missing required array field 'txn-groups': ${e}`);if("undefined"===typeof e.version)throw new Error(`Response is missing required field 'version': ${e}`);return new ut({lastRound:e["last-round"],txnGroups:e["txn-groups"].map(dt.from_obj_for_encoding),version:e.version,evalOverrides:"undefined"!==typeof e["eval-overrides"]?pt.from_obj_for_encoding(e["eval-overrides"]):void 0,execTraceConfig:"undefined"!==typeof e["exec-trace-config"]?lt.from_obj_for_encoding(e["exec-trace-config"]):void 0,initialStates:"undefined"!==typeof e["initial-states"]?st.from_obj_for_encoding(e["initial-states"]):void 0})}}class lt extends fe{constructor({enable:e,scratchChange:t,stackChange:n,stateChange:r}){super(),this.enable=e,this.scratchChange=t,this.stackChange=n,this.stateChange=r,this.attribute_map={enable:"enable",scratchChange:"scratch-change",stackChange:"stack-change",stateChange:"state-change"}}static from_obj_for_encoding(e){return new lt({enable:e.enable,scratchChange:e["scratch-change"],stackChange:e["stack-change"],stateChange:e["state-change"]})}}class dt extends fe{constructor({txnResults:e,appBudgetAdded:t,appBudgetConsumed:n,failedAt:r,failureMessage:i,unnamedResourcesAccessed:o}){super(),this.txnResults=e,this.appBudgetAdded=t,this.appBudgetConsumed=n,this.failedAt=r,this.failureMessage=i,this.unnamedResourcesAccessed=o,this.attribute_map={txnResults:"txn-results",appBudgetAdded:"app-budget-added",appBudgetConsumed:"app-budget-consumed",failedAt:"failed-at",failureMessage:"failure-message",unnamedResourcesAccessed:"unnamed-resources-accessed"}}static from_obj_for_encoding(e){if(!Array.isArray(e["txn-results"]))throw new Error(`Response is missing required array field 'txn-results': ${e}`);return new dt({txnResults:e["txn-results"].map(ft.from_obj_for_encoding),appBudgetAdded:e["app-budget-added"],appBudgetConsumed:e["app-budget-consumed"],failedAt:e["failed-at"],failureMessage:e["failure-message"],unnamedResourcesAccessed:"undefined"!==typeof e["unnamed-resources-accessed"]?ht.from_obj_for_encoding(e["unnamed-resources-accessed"]):void 0})}}class ft extends fe{constructor({txnResult:e,appBudgetConsumed:t,execTrace:n,logicSigBudgetConsumed:r,unnamedResourcesAccessed:i}){super(),this.txnResult=e,this.appBudgetConsumed=t,this.execTrace=n,this.logicSigBudgetConsumed=r,this.unnamedResourcesAccessed=i,this.attribute_map={txnResult:"txn-result",appBudgetConsumed:"app-budget-consumed",execTrace:"exec-trace",logicSigBudgetConsumed:"logic-sig-budget-consumed",unnamedResourcesAccessed:"unnamed-resources-accessed"}}static from_obj_for_encoding(e){if("undefined"===typeof e["txn-result"])throw new Error(`Response is missing required field 'txn-result': ${e}`);return new ft({txnResult:nt.from_obj_for_encoding(e["txn-result"]),appBudgetConsumed:e["app-budget-consumed"],execTrace:"undefined"!==typeof e["exec-trace"]?mt.from_obj_for_encoding(e["exec-trace"]):void 0,logicSigBudgetConsumed:e["logic-sig-budget-consumed"],unnamedResourcesAccessed:"undefined"!==typeof e["unnamed-resources-accessed"]?ht.from_obj_for_encoding(e["unnamed-resources-accessed"]):void 0})}}class ht extends fe{constructor({accounts:e,appLocals:t,apps:n,assetHoldings:r,assets:i,boxes:o,extraBoxRefs:s}){super(),this.accounts=e,this.appLocals=t,this.apps=n,this.assetHoldings=r,this.assets=i,this.boxes=o,this.extraBoxRefs=s,this.attribute_map={accounts:"accounts",appLocals:"app-locals",apps:"apps",assetHoldings:"asset-holdings",assets:"assets",boxes:"boxes",extraBoxRefs:"extra-box-refs"}}static from_obj_for_encoding(e){return new ht({accounts:e.accounts,appLocals:"undefined"!==typeof e["app-locals"]?e["app-locals"].map(xe.from_obj_for_encoding):void 0,apps:e.apps,assetHoldings:"undefined"!==typeof e["asset-holdings"]?e["asset-holdings"].map(ke.from_obj_for_encoding):void 0,assets:e.assets,boxes:"undefined"!==typeof e.boxes?e.boxes.map(De.from_obj_for_encoding):void 0,extraBoxRefs:e["extra-box-refs"]})}}class pt extends fe{constructor({allowEmptySignatures:e,allowUnnamedResources:t,extraOpcodeBudget:n,maxLogCalls:r,maxLogSize:i}){super(),this.allowEmptySignatures=e,this.allowUnnamedResources=t,this.extraOpcodeBudget=n,this.maxLogCalls=r,this.maxLogSize=i,this.attribute_map={allowEmptySignatures:"allow-empty-signatures",allowUnnamedResources:"allow-unnamed-resources",extraOpcodeBudget:"extra-opcode-budget",maxLogCalls:"max-log-calls",maxLogSize:"max-log-size"}}static from_obj_for_encoding(e){return new pt({allowEmptySignatures:e["allow-empty-signatures"],allowUnnamedResources:e["allow-unnamed-resources"],extraOpcodeBudget:e["extra-opcode-budget"],maxLogCalls:e["max-log-calls"],maxLogSize:e["max-log-size"]})}}class gt extends fe{constructor({pc:e,scratchChanges:t,spawnedInners:n,stackAdditions:r,stackPopCount:i,stateChanges:o}){super(),this.pc=e,this.scratchChanges=t,this.spawnedInners=n,this.stackAdditions=r,this.stackPopCount=i,this.stateChanges=o,this.attribute_map={pc:"pc",scratchChanges:"scratch-changes",spawnedInners:"spawned-inners",stackAdditions:"stack-additions",stackPopCount:"stack-pop-count",stateChanges:"state-changes"}}static from_obj_for_encoding(e){if("undefined"===typeof e.pc)throw new Error(`Response is missing required field 'pc': ${e}`);return new gt({pc:e.pc,scratchChanges:"undefined"!==typeof e["scratch-changes"]?e["scratch-changes"].map(ot.from_obj_for_encoding):void 0,spawnedInners:e["spawned-inners"],stackAdditions:"undefined"!==typeof e["stack-additions"]?e["stack-additions"].map(Pe.from_obj_for_encoding):void 0,stackPopCount:e["stack-pop-count"],stateChanges:"undefined"!==typeof e["state-changes"]?e["state-changes"].map(Ee.from_obj_for_encoding):void 0})}}class mt extends fe{constructor({approvalProgramHash:e,approvalProgramTrace:t,clearStateProgramHash:n,clearStateProgramTrace:r,innerTrace:i,logicSigHash:o,logicSigTrace:s}){super(),this.approvalProgramHash="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.approvalProgramTrace=t,this.clearStateProgramHash="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.clearStateProgramTrace=r,this.innerTrace=i,this.logicSigHash="string"===typeof o?new Uint8Array(a.lW.from(o,"base64")):o,this.logicSigTrace=s,this.attribute_map={approvalProgramHash:"approval-program-hash",approvalProgramTrace:"approval-program-trace",clearStateProgramHash:"clear-state-program-hash",clearStateProgramTrace:"clear-state-program-trace",innerTrace:"inner-trace",logicSigHash:"logic-sig-hash",logicSigTrace:"logic-sig-trace"}}static from_obj_for_encoding(e){return new mt({approvalProgramHash:e["approval-program-hash"],approvalProgramTrace:"undefined"!==typeof e["approval-program-trace"]?e["approval-program-trace"].map(gt.from_obj_for_encoding):void 0,clearStateProgramHash:e["clear-state-program-hash"],clearStateProgramTrace:"undefined"!==typeof e["clear-state-program-trace"]?e["clear-state-program-trace"].map(gt.from_obj_for_encoding):void 0,innerTrace:"undefined"!==typeof e["inner-trace"]?e["inner-trace"].map(mt.from_obj_for_encoding):void 0,logicSigHash:e["logic-sig-hash"],logicSigTrace:"undefined"!==typeof e["logic-sig-trace"]?e["logic-sig-trace"].map(gt.from_obj_for_encoding):void 0})}}class bt extends fe{constructor({message:e,stateproof:t}){super(),this.message=e,this.stateproof="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={message:"Message",stateproof:"StateProof"}}static from_obj_for_encoding(e){if("undefined"===typeof e.Message)throw new Error(`Response is missing required field 'Message': ${e}`);if("undefined"===typeof e.StateProof)throw new Error(`Response is missing required field 'StateProof': ${e}`);return new bt({message:yt.from_obj_for_encoding(e.Message),stateproof:e.StateProof})}}class yt extends fe{constructor({blockheaderscommitment:e,firstattestedround:t,lastattestedround:n,lnprovenweight:r,voterscommitment:i}){super(),this.blockheaderscommitment="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.firstattestedround=t,this.lastattestedround=n,this.lnprovenweight=r,this.voterscommitment="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.attribute_map={blockheaderscommitment:"BlockHeadersCommitment",firstattestedround:"FirstAttestedRound",lastattestedround:"LastAttestedRound",lnprovenweight:"LnProvenWeight",voterscommitment:"VotersCommitment"}}static from_obj_for_encoding(e){if("undefined"===typeof e.BlockHeadersCommitment)throw new Error(`Response is missing required field 'BlockHeadersCommitment': ${e}`);if("undefined"===typeof e.FirstAttestedRound)throw new Error(`Response is missing required field 'FirstAttestedRound': ${e}`);if("undefined"===typeof e.LastAttestedRound)throw new Error(`Response is missing required field 'LastAttestedRound': ${e}`);if("undefined"===typeof e.LnProvenWeight)throw new Error(`Response is missing required field 'LnProvenWeight': ${e}`);if("undefined"===typeof e.VotersCommitment)throw new Error(`Response is missing required field 'VotersCommitment': ${e}`);return new yt({blockheaderscommitment:e.BlockHeadersCommitment,firstattestedround:e.FirstAttestedRound,lastattestedround:e.LastAttestedRound,lnprovenweight:e.LnProvenWeight,voterscommitment:e.VotersCommitment})}}class vt extends fe{constructor({currentRound:e,onlineMoney:t,totalMoney:n}){super(),this.currentRound=e,this.onlineMoney=t,this.totalMoney=n,this.attribute_map={currentRound:"current_round",onlineMoney:"online-money",totalMoney:"total-money"}}static from_obj_for_encoding(e){if("undefined"===typeof e.current_round)throw new Error(`Response is missing required field 'current_round': ${e}`);if("undefined"===typeof e["online-money"])throw new Error(`Response is missing required field 'online-money': ${e}`);if("undefined"===typeof e["total-money"])throw new Error(`Response is missing required field 'total-money': ${e}`);return new vt({currentRound:e.current_round,onlineMoney:e["online-money"],totalMoney:e["total-money"]})}}class wt extends fe{constructor({key:e,value:t}){super(),this.key=e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new wt({key:e.key,value:xt.from_obj_for_encoding(e.value)})}}class xt extends fe{constructor({type:e,bytes:t,uint:n}){super(),this.type=e,this.bytes=t,this.uint=n,this.attribute_map={type:"type",bytes:"bytes",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.type)throw new Error(`Response is missing required field 'type': ${e}`);if("undefined"===typeof e.bytes)throw new Error(`Response is missing required field 'bytes': ${e}`);if("undefined"===typeof e.uint)throw new Error(`Response is missing required field 'uint': ${e}`);return new xt({type:e.type,bytes:e.bytes,uint:e.uint})}}class St extends fe{constructor({deltas:e}){super(),this.deltas=e,this.attribute_map={deltas:"Deltas"}}static from_obj_for_encoding(e){if(!Array.isArray(e.Deltas))throw new Error(`Response is missing required array field 'Deltas': ${e}`);return new St({deltas:e.Deltas.map($e.from_obj_for_encoding)})}}class At extends fe{constructor({consensusVersion:e,fee:t,genesisHash:n,genesisId:r,lastRound:i,minFee:o}){super(),this.consensusVersion=e,this.fee=t,this.genesisHash="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.genesisId=r,this.lastRound=i,this.minFee=o,this.attribute_map={consensusVersion:"consensus-version",fee:"fee",genesisHash:"genesis-hash",genesisId:"genesis-id",lastRound:"last-round",minFee:"min-fee"}}static from_obj_for_encoding(e){if("undefined"===typeof e["consensus-version"])throw new Error(`Response is missing required field 'consensus-version': ${e}`);if("undefined"===typeof e.fee)throw new Error(`Response is missing required field 'fee': ${e}`);if("undefined"===typeof e["genesis-hash"])throw new Error(`Response is missing required field 'genesis-hash': ${e}`);if("undefined"===typeof e["genesis-id"])throw new Error(`Response is missing required field 'genesis-id': ${e}`);if("undefined"===typeof e["last-round"])throw new Error(`Response is missing required field 'last-round': ${e}`);if("undefined"===typeof e["min-fee"])throw new Error(`Response is missing required field 'min-fee': ${e}`);return new At({consensusVersion:e["consensus-version"],fee:e.fee,genesisHash:e["genesis-hash"],genesisId:e["genesis-id"],lastRound:e["last-round"],minFee:e["min-fee"]})}}class Et extends fe{constructor({idx:e,proof:t,stibhash:n,treedepth:r,hashtype:i}){super(),this.idx=e,this.proof="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.stibhash="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.treedepth=r,this.hashtype=i,this.attribute_map={idx:"idx",proof:"proof",stibhash:"stibhash",treedepth:"treedepth",hashtype:"hashtype"}}static from_obj_for_encoding(e){if("undefined"===typeof e.idx)throw new Error(`Response is missing required field 'idx': ${e}`);if("undefined"===typeof e.proof)throw new Error(`Response is missing required field 'proof': ${e}`);if("undefined"===typeof e.stibhash)throw new Error(`Response is missing required field 'stibhash': ${e}`);if("undefined"===typeof e.treedepth)throw new Error(`Response is missing required field 'treedepth': ${e}`);return new Et({idx:e.idx,proof:e.proof,stibhash:e.stibhash,treedepth:e.treedepth,hashtype:e.hashtype})}}class _t extends fe{constructor({build:e,genesisHashB64:t,genesisId:n,versions:r}){super(),this.build=e,this.genesisHashB64="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.genesisId=n,this.versions=r,this.attribute_map={build:"build",genesisHashB64:"genesis_hash_b64",genesisId:"genesis_id",versions:"versions"}}static from_obj_for_encoding(e){if("undefined"===typeof e.build)throw new Error(`Response is missing required field 'build': ${e}`);if("undefined"===typeof e.genesis_hash_b64)throw new Error(`Response is missing required field 'genesis_hash_b64': ${e}`);if("undefined"===typeof e.genesis_id)throw new Error(`Response is missing required field 'genesis_id': ${e}`);if(!Array.isArray(e.versions))throw new Error(`Response is missing required array field 'versions': ${e}`);return new _t({build:je.from_obj_for_encoding(e.build),genesisHashB64:e.genesis_hash_b64,genesisId:e.genesis_id,versions:e.versions})}}class Ct{constructor(e,t){this.c=e,this.query={},this.intDecoding=t||p.DEFAULT}prepare(e){return e}async do(e={}){const t={};"default"!==this.intDecoding&&(t.intDecoding=this.intDecoding);const n=await this.c.get(this.path(),this.query,e,t);return this.prepare(n.body)}async doRaw(e={}){return(await this.c.get(this.path(),this.query,e,{},!1)).body}setIntDecoding(e){if("default"!==e&&"safe"!==e&&"mixed"!==e&&"bigint"!==e)throw new Error(`Invalid method for int decoding: ${e}`);return this.intDecoding=e,this}}class It extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}`}exclude(e){return this.query.exclude=e,this}}class kt extends Ct{constructor(e,t,n,r){super(e,t),this.account=n,this.assetID=r,this.account=n,this.assetID=r}path(){return`/v2/accounts/${this.account}/assets/${this.assetID}`}}class Tt extends Ct{constructor(e,t,n,r){super(e,t),this.account=n,this.applicationID=r,this.account=n,this.applicationID=r}path(){return`/v2/accounts/${this.account}/applications/${this.applicationID}`}}class Mt extends Ct{constructor(e,t){if(super(e),!Number.isInteger(t))throw Error("roundNumber should be an integer");this.round=t,this.query={format:"msgpack"}}path(){return`/v2/blocks/${this.round}`}prepare(e){if(e&&e.byteLength>0)return z(e)}}function Pt(e={}){let t=e;return Object.keys(t).every((e=>"content-type"!==e.toLowerCase()))&&(t={...e},t["Content-Type"]="text/plain"),t}class Ot extends Ct{constructor(e,t){super(e),this.source=t,this.source=t}path(){return"/v2/teal/compile"}sourcemap(e=!0){return this.query.sourcemap=e,this}async do(e={}){const t=Pt(e);return(await this.c.post(this.path(),a.lW.from(this.source),t,this.query)).body}}class Rt extends Ct{constructor(e,t){super(e),this.blob=q(t.get_obj_for_encoding(!0))}path(){return"/v2/teal/dryrun"}async do(e={}){const t=Pt(e);return(await this.c.post(this.path(),a.lW.from(this.blob),t)).body}}class Nt extends Ct{path(){return"/genesis"}}class Bt extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/assets/${this.index}`}}class Lt extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/applications/${this.index}`}}class Dt extends Ct{constructor(e,t,n){if(super(e,t),!Number.isInteger(n))throw Error("roundNumber should be an integer");this.round=n}path(){return`/v2/blocks/${this.round}/hash`}}class Ut extends Ct{constructor(e,t,n){if(super(e,t),!Number.isInteger(n))throw Error("roundNumber should be an integer");this.round=n}path(){return`/v2/blocks/${this.round}/txids`}}class jt extends Ct{constructor(e,t,n,r){super(e,t),this.index=n,this.index=n;const i=a.lW.from(r).toString("base64");this.query.name=encodeURI(`b64:${i}`)}path(){return`/v2/applications/${this.index}/box`}prepare(e){return Be.from_obj_for_encoding(e)}}class Ft extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n,this.query.max=0}path(){return`/v2/applications/${this.index}/boxes`}max(e){return this.query.max=e,this}prepare(e){return Ue.from_obj_for_encoding(e)}}class Vt extends Ct{path(){return"/health"}async do(e={}){const t=await this.c.get(this.path(),{},e);if(!t.ok)throw new Error(`Health response: ${t.status}`);return{}}}class qt extends Ct{constructor(e,t){super(e),this.txid=t,this.txid=t,this.query.format="msgpack"}prepare(e){if(e&&e.byteLength>0)return z(e)}path(){return`/v2/transactions/pending/${this.txid}`}max(e){return this.query.max=e,this}}class zt extends Ct{constructor(e){super(e),this.query.format="msgpack"}path(){return"/v2/transactions/pending"}prepare(e){if(e&&e.byteLength>0)return z(e)}max(e){return this.query.max=e,this}}class Ht extends Ct{constructor(e,t){super(e),this.address=t,this.address=t,this.query.format="msgpack"}prepare(e){if(e&&e.byteLength>0)return z(e)}path(){return`/v2/accounts/${this.address}/transactions/pending`}max(e){return this.query.max=e,this}}class Wt extends Ct{constructor(e,t,n,r){super(e,t),this.round=n,this.txID=r,this.round=n,this.txID=r}path(){return`/v2/blocks/${this.round}/transactions/${this.txID}/proof`}hashType(e){return this.query.hashtype=e,this}}function Gt(e){return e&&void 0!==e.byteLength}class Zt extends Ct{constructor(e,t){super(e);let n=t;if(Array.isArray(t)){if(!t.every(Gt))throw new TypeError("Array elements must be byte arrays");n=b(...t)}else if(!Gt(n))throw new TypeError("Argument must be byte array");this.txnBytesToPost=n}path(){return"/v2/transactions"}async do(e={}){const t=function(e={}){let t=e;return Object.keys(t).every((e=>"content-type"!==e.toLowerCase()))&&(t={...e},t["Content-Type"]="application/x-binary"),t}(e);return(await this.c.post(this.path(),a.lW.from(this.txnBytesToPost),t)).body}}class Kt extends Ct{path(){return"/v2/status"}}class Xt extends Ct{constructor(e,t,n){if(super(e,t),this.round=n,!Number.isInteger(n))throw Error("round should be an integer");this.round=n}path(){return`/v2/status/wait-for-block-after/${this.round}`}}class Yt extends Ct{path(){return"/v2/transactions/params"}prepare(e){return{flatFee:!1,fee:e.fee,firstRound:e["last-round"],lastRound:e["last-round"]+1e3,genesisID:e["genesis-id"],genesisHash:e["genesis-hash"],minFee:e["min-fee"]}}}class Jt extends Ct{path(){return"/v2/ledger/supply"}}class Qt extends Ct{path(){return"/versions"}}class $t extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n}path(){return`/v2/blocks/${this.round}/lightheader/proof`}}class en extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n}path(){return`/v2/stateproofs/${this.round}`}}class tn extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n}path(){return`/v2/ledger/sync/${this.round}`}async do(e={}){return(await this.c.post(this.path(),e)).body}}class nn extends Ct{path(){return"/v2/ledger/sync"}prepare(e){return Je.from_obj_for_encoding(e)}}class rn extends Ct{constructor(e,t,n){super(e,t),this.offset=n,this.offset=n}path(){return`/v2/devmode/blocks/offset/${this.offset}`}async do(e={}){return(await this.c.post(this.path(),e)).body}}class on extends Ct{path(){return"/v2/devmode/blocks/offset"}prepare(e){return Ye.from_obj_for_encoding(e)}}class sn extends Ct{constructor(e,t){super(e),this.source=t,this.source=t}path(){return"/v2/teal/disassemble"}async do(e={}){const t=function(e={}){let t=e;return Object.keys(t).every((e=>"content-type"!==e.toLowerCase()))&&(t={...e},t["Content-Type"]="text/plain"),t}(e);return(await this.c.post(this.path(),a.lW.from(this.source),t,this.query)).body}}class an extends Ct{constructor(e,t){super(e),this.query.format="msgpack",this.requestBytes=V(t.get_obj_for_encoding(!0))}path(){return"/v2/transactions/simulate"}async do(e={}){const t=function(e={}){let t=e;return Object.keys(t).every((e=>"content-type"!==e.toLowerCase()))&&(t={...e},t["Content-Type"]="application/msgpack"),t}(e),n=await this.c.post(this.path(),a.lW.from(this.requestBytes),t,this.query,!1);return this.prepare(n.body)}prepare(e){const t=z(e);return ut.from_obj_for_encoding(t)}}class cn extends Ct{path(){return"/ready"}}class un extends Ct{path(){return"/v2/ledger/sync"}async do(e={}){return(await this.c.delete(this.path(),e)).body}}class ln extends Ct{constructor(e,t,n){super(e,t),this.id=n,this.id=n,this.query={format:"json"}}path(){return`/v2/deltas/txn/group/${this.id}`}}class dn extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n,this.query={format:"json"}}path(){return`/v2/deltas/${this.round}`}}class fn extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n,this.query={format:"json"}}path(){return`/v2/deltas/${this.round}/txn/group`}prepare(e){return St.from_obj_for_encoding(e)}}class hn extends le{constructor(e,t,n,r={}){super("X-Algo-API-Token",e,t,n,r)}healthCheck(){return new Vt(this.c)}versionsCheck(){return new Qt(this.c)}sendRawTransaction(e){return new Zt(this.c,e)}accountInformation(e){return new It(this.c,this.intDecoding,e)}accountAssetInformation(e,t){return new kt(this.c,this.intDecoding,e,t)}accountApplicationInformation(e,t){return new Tt(this.c,this.intDecoding,e,t)}block(e){return new Mt(this.c,e)}getBlockHash(e){return new Dt(this.c,this.intDecoding,e)}getBlockTxids(e){return new Ut(this.c,this.intDecoding,e)}pendingTransactionInformation(e){return new qt(this.c,e)}pendingTransactionsInformation(){return new zt(this.c)}pendingTransactionByAddress(e){return new Ht(this.c,e)}status(){return new Kt(this.c,this.intDecoding)}statusAfterBlock(e){return new Xt(this.c,this.intDecoding,e)}getTransactionParams(){return new Yt(this.c)}supply(){return new Jt(this.c,this.intDecoding)}compile(e){return new Ot(this.c,e)}disassemble(e){return new sn(this.c,e)}dryrun(e){return new Rt(this.c,e)}getAssetByID(e){return new Bt(this.c,this.intDecoding,e)}getApplicationByID(e){return new Lt(this.c,this.intDecoding,e)}getApplicationBoxByName(e,t){return new jt(this.c,this.intDecoding,e,t)}getApplicationBoxes(e){return new Ft(this.c,this.intDecoding,e)}genesis(){return new Nt(this.c,this.intDecoding)}getTransactionProof(e,t){return new Wt(this.c,this.intDecoding,e,t)}getLightBlockHeaderProof(e){return new $t(this.c,this.intDecoding,e)}getStateProof(e){return new en(this.c,this.intDecoding,e)}simulateRawTransactions(e){const t=[];if(Array.isArray(e))for(const r of e)t.push(z(r));else t.push(z(e));const n=new at({txnGroups:[new ct({txns:t})]});return this.simulateTransactions(n)}simulateTransactions(e){return new an(this.c,e)}setBlockOffsetTimestamp(e){return new rn(this.c,this.intDecoding,e)}getBlockOffsetTimestamp(){return new on(this.c,this.intDecoding)}setSyncRound(e){return new tn(this.c,this.intDecoding,e)}unsetSyncRound(){return new un(this.c,this.intDecoding)}getSyncRound(){return new nn(this.c,this.intDecoding)}ready(){return new cn(this.c,this.intDecoding)}getLedgerStateDeltaForTransactionGroup(e){return new ln(this.c,this.intDecoding,e)}getLedgerStateDelta(e){return new dn(this.c,this.intDecoding,e)}getTransactionGroupLedgerStateDeltasForRound(e){return new fn(this.c,this.intDecoding,e)}}class pn extends le{constructor(e,t="http://127.0.0.1",n=7833,r={}){super("X-KMD-API-Token",e,t,n,r)}async versions(){return(await this.c.get("/versions")).body}async listWallets(){return(await this.c.get("/v1/wallets")).body}async createWallet(e,t,n=new Uint8Array,r="sqlite"){const i={wallet_name:e,wallet_driver_name:r,wallet_password:t,master_derivation_key:a.lW.from(n).toString("base64")};return(await this.c.post("/v1/wallet",i)).body}async initWalletHandle(e,t){const n={wallet_id:e,wallet_password:t};return(await this.c.post("/v1/wallet/init",n)).body}async releaseWalletHandle(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/wallet/release",t)).body}async renewWalletHandle(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/wallet/renew",t)).body}async renameWallet(e,t,n){const r={wallet_id:e,wallet_password:t,wallet_name:n};return(await this.c.post("/v1/wallet/rename",r)).body}async getWallet(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/wallet/info",t)).body}async exportMasterDerivationKey(e,t){const n={wallet_handle_token:e,wallet_password:t},r=await this.c.post("/v1/master-key/export",n);return{master_derivation_key:a.lW.from(r.body.master_derivation_key,"base64")}}async importKey(e,t){const n={wallet_handle_token:e,private_key:a.lW.from(t).toString("base64")};return(await this.c.post("/v1/key/import",n)).body}async exportKey(e,t,n){const r={wallet_handle_token:e,address:n,wallet_password:t},i=await this.c.post("/v1/key/export",r);return{private_key:a.lW.from(i.body.private_key,"base64")}}async generateKey(e){const t={wallet_handle_token:e,display_mnemonic:!1};return(await this.c.post("/v1/key",t)).body}async deleteKey(e,t,n){const r={wallet_handle_token:e,address:n,wallet_password:t};return(await this.c.delete("/v1/key",r)).body}async listKeys(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/key/list",t)).body}async signTransaction(e,t,n){const r=ee(n),i={wallet_handle_token:e,wallet_password:t,transaction:a.lW.from(r.toByte()).toString("base64")},o=await this.c.post("/v1/transaction/sign",i);return 200===o.status?a.lW.from(o.body.signed_transaction,"base64"):o.body}async signTransactionWithSpecificPublicKey(e,t,n,r){const i=ee(n),o={wallet_handle_token:e,wallet_password:t,transaction:a.lW.from(i.toByte()).toString("base64"),public_key:a.lW.from(r).toString("base64")},s=await this.c.post("/v1/transaction/sign",o);return 200===s.status?a.lW.from(s.body.signed_transaction,"base64"):s.body}async listMultisig(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/multisig/list",t)).body}async importMultisig(e,t,n,r){const i={wallet_handle_token:e,multisig_version:t,threshold:n,pks:r};return(await this.c.post("/v1/multisig/import",i)).body}async exportMultisig(e,t){const n={wallet_handle_token:e,address:t};return(await this.c.post("/v1/multisig/export",n)).body}async signMultisigTransaction(e,t,n,r,i){const o=ee(n),s={wallet_handle_token:e,transaction:a.lW.from(o.toByte()).toString("base64"),public_key:a.lW.from(r).toString("base64"),partial_multisig:i,wallet_password:t};return(await this.c.post("/v1/multisig/sign",s)).body}async deleteMultisig(e,t,n){const r={wallet_handle_token:e,address:n,wallet_password:t};return(await this.c.delete("/v1/multisig",r)).body}}class gn extends Ct{path(){return"/health"}}class mn extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/assets/${this.index}/balances`}limit(e){return this.query.limit=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}}function bn(e){return"string"===typeof e?e:a.lW.from(e).toString("base64")}class yn extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/transactions`}notePrefix(e){return this.query["note-prefix"]=bn(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}assetID(e){return this.query["asset-id"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e,this}afterTime(e){return this.query["after-time"]=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}}class vn extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/assets/${this.index}/transactions`}notePrefix(e){return this.query["note-prefix"]=bn(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e,this}afterTime(e){return this.query["after-time"]=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}addressRole(e){return this.query["address-role"]=e,this}address(e){return this.query.address=e,this}excludeCloseTo(e){return this.query["exclude-close-to"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}}class wn extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n}path(){return`/v2/blocks/${this.round}`}headerOnly(e){return this.query["header-only"]=e,this}}class xn extends Ct{constructor(e,t,n){super(e,t),this.txID=n,this.txID=n}path(){return`/v2/transactions/${this.txID}`}}class Sn extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}`}round(e){return this.query.round=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}exclude(e){return this.query.exclude=e,this}}class An extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/assets`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}assetId(e){return this.query["asset-id"]=e,this}}class En extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/created-assets`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}assetID(e){return this.query["asset-id"]=e,this}}class _n extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/apps-local-state`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}applicationID(e){return this.query["application-id"]=e,this}}class Cn extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/created-applications`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}applicationID(e){return this.query["application-id"]=e,this}}class In extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/assets/${this.index}`}includeAll(e=!0){return this.query["include-all"]=e,this}}class kn extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/applications/${this.index}`}includeAll(e=!0){return this.query["include-all"]=e,this}}class Tn extends Ct{constructor(e,t,n){super(e,t),this.appID=n,this.appID=n}path(){return`/v2/applications/${this.appID}/logs`}limit(e){return this.query.limit=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}nextToken(e){return this.query.next=e,this}sender(e){return this.query["sender-address"]=e,this}txid(e){return this.query.txid=e,this}}class Mn extends fe{constructor({address:e,amount:t,amountWithoutPendingRewards:n,pendingRewards:r,rewards:i,round:o,status:s,totalAppsOptedIn:a,totalAssetsOptedIn:c,totalBoxBytes:u,totalBoxes:l,totalCreatedApps:d,totalCreatedAssets:f,appsLocalState:h,appsTotalExtraPages:p,appsTotalSchema:g,assets:m,authAddr:b,closedAtRound:y,createdApps:v,createdAssets:w,createdAtRound:x,deleted:S,participation:A,rewardBase:E,sigType:_}){super(),this.address=e,this.amount=t,this.amountWithoutPendingRewards=n,this.pendingRewards=r,this.rewards=i,this.round=o,this.status=s,this.totalAppsOptedIn=a,this.totalAssetsOptedIn=c,this.totalBoxBytes=u,this.totalBoxes=l,this.totalCreatedApps=d,this.totalCreatedAssets=f,this.appsLocalState=h,this.appsTotalExtraPages=p,this.appsTotalSchema=g,this.assets=m,this.authAddr=b,this.closedAtRound=y,this.createdApps=v,this.createdAssets=w,this.createdAtRound=x,this.deleted=S,this.participation=A,this.rewardBase=E,this.sigType=_,this.attribute_map={address:"address",amount:"amount",amountWithoutPendingRewards:"amount-without-pending-rewards",pendingRewards:"pending-rewards",rewards:"rewards",round:"round",status:"status",totalAppsOptedIn:"total-apps-opted-in",totalAssetsOptedIn:"total-assets-opted-in",totalBoxBytes:"total-box-bytes",totalBoxes:"total-boxes",totalCreatedApps:"total-created-apps",totalCreatedAssets:"total-created-assets",appsLocalState:"apps-local-state",appsTotalExtraPages:"apps-total-extra-pages",appsTotalSchema:"apps-total-schema",assets:"assets",authAddr:"auth-addr",closedAtRound:"closed-at-round",createdApps:"created-apps",createdAssets:"created-assets",createdAtRound:"created-at-round",deleted:"deleted",participation:"participation",rewardBase:"reward-base",sigType:"sig-type"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["amount-without-pending-rewards"])throw new Error(`Response is missing required field 'amount-without-pending-rewards': ${e}`);if("undefined"===typeof e["pending-rewards"])throw new Error(`Response is missing required field 'pending-rewards': ${e}`);if("undefined"===typeof e.rewards)throw new Error(`Response is missing required field 'rewards': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.status)throw new Error(`Response is missing required field 'status': ${e}`);if("undefined"===typeof e["total-apps-opted-in"])throw new Error(`Response is missing required field 'total-apps-opted-in': ${e}`);if("undefined"===typeof e["total-assets-opted-in"])throw new Error(`Response is missing required field 'total-assets-opted-in': ${e}`);if("undefined"===typeof e["total-box-bytes"])throw new Error(`Response is missing required field 'total-box-bytes': ${e}`);if("undefined"===typeof e["total-boxes"])throw new Error(`Response is missing required field 'total-boxes': ${e}`);if("undefined"===typeof e["total-created-apps"])throw new Error(`Response is missing required field 'total-created-apps': ${e}`);if("undefined"===typeof e["total-created-assets"])throw new Error(`Response is missing required field 'total-created-assets': ${e}`);return new Mn({address:e.address,amount:e.amount,amountWithoutPendingRewards:e["amount-without-pending-rewards"],pendingRewards:e["pending-rewards"],rewards:e.rewards,round:e.round,status:e.status,totalAppsOptedIn:e["total-apps-opted-in"],totalAssetsOptedIn:e["total-assets-opted-in"],totalBoxBytes:e["total-box-bytes"],totalBoxes:e["total-boxes"],totalCreatedApps:e["total-created-apps"],totalCreatedAssets:e["total-created-assets"],appsLocalState:"undefined"!==typeof e["apps-local-state"]?e["apps-local-state"].map(Ln.from_obj_for_encoding):void 0,appsTotalExtraPages:e["apps-total-extra-pages"],appsTotalSchema:"undefined"!==typeof e["apps-total-schema"]?qn.from_obj_for_encoding(e["apps-total-schema"]):void 0,assets:"undefined"!==typeof e.assets?e.assets.map(Gn.from_obj_for_encoding):void 0,authAddr:e["auth-addr"],closedAtRound:e["closed-at-round"],createdApps:"undefined"!==typeof e["created-apps"]?e["created-apps"].map(Bn.from_obj_for_encoding):void 0,createdAssets:"undefined"!==typeof e["created-assets"]?e["created-assets"].map(Hn.from_obj_for_encoding):void 0,createdAtRound:e["created-at-round"],deleted:e.deleted,participation:"undefined"!==typeof e.participation?Pn.from_obj_for_encoding(e.participation):void 0,rewardBase:e["reward-base"],sigType:e["sig-type"]})}}class Pn extends fe{constructor({selectionParticipationKey:e,voteFirstValid:t,voteKeyDilution:n,voteLastValid:r,voteParticipationKey:i,stateProofKey:o}){super(),this.selectionParticipationKey="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.voteFirstValid=t,this.voteKeyDilution=n,this.voteLastValid=r,this.voteParticipationKey="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.stateProofKey="string"===typeof o?new Uint8Array(a.lW.from(o,"base64")):o,this.attribute_map={selectionParticipationKey:"selection-participation-key",voteFirstValid:"vote-first-valid",voteKeyDilution:"vote-key-dilution",voteLastValid:"vote-last-valid",voteParticipationKey:"vote-participation-key",stateProofKey:"state-proof-key"}}static from_obj_for_encoding(e){if("undefined"===typeof e["selection-participation-key"])throw new Error(`Response is missing required field 'selection-participation-key': ${e}`);if("undefined"===typeof e["vote-first-valid"])throw new Error(`Response is missing required field 'vote-first-valid': ${e}`);if("undefined"===typeof e["vote-key-dilution"])throw new Error(`Response is missing required field 'vote-key-dilution': ${e}`);if("undefined"===typeof e["vote-last-valid"])throw new Error(`Response is missing required field 'vote-last-valid': ${e}`);if("undefined"===typeof e["vote-participation-key"])throw new Error(`Response is missing required field 'vote-participation-key': ${e}`);return new Pn({selectionParticipationKey:e["selection-participation-key"],voteFirstValid:e["vote-first-valid"],voteKeyDilution:e["vote-key-dilution"],voteLastValid:e["vote-last-valid"],voteParticipationKey:e["vote-participation-key"],stateProofKey:e["state-proof-key"]})}}class On extends fe{constructor({account:e,currentRound:t}){super(),this.account=e,this.currentRound=t,this.attribute_map={account:"account",currentRound:"current-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.account)throw new Error(`Response is missing required field 'account': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new On({account:Mn.from_obj_for_encoding(e.account),currentRound:e["current-round"]})}}class Rn extends fe{constructor({address:e,delta:t}){super(),this.address=e,this.delta=t,this.attribute_map={address:"address",delta:"delta"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if(!Array.isArray(e.delta))throw new Error(`Response is missing required array field 'delta': ${e}`);return new Rn({address:e.address,delta:e.delta.map(sr.from_obj_for_encoding)})}}class Nn extends fe{constructor({accounts:e,currentRound:t,nextToken:n}){super(),this.accounts=e,this.currentRound=t,this.nextToken=n,this.attribute_map={accounts:"accounts",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.accounts))throw new Error(`Response is missing required array field 'accounts': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Nn({accounts:e.accounts.map(Mn.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Bn extends fe{constructor({id:e,params:t,createdAtRound:n,deleted:r,deletedAtRound:i}){super(),this.id=e,this.params=t,this.createdAtRound=n,this.deleted=r,this.deletedAtRound=i,this.attribute_map={id:"id",params:"params",createdAtRound:"created-at-round",deleted:"deleted",deletedAtRound:"deleted-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);if("undefined"===typeof e.params)throw new Error(`Response is missing required field 'params': ${e}`);return new Bn({id:e.id,params:Fn.from_obj_for_encoding(e.params),createdAtRound:e["created-at-round"],deleted:e.deleted,deletedAtRound:e["deleted-at-round"]})}}class Ln extends fe{constructor({id:e,schema:t,closedOutAtRound:n,deleted:r,keyValue:i,optedInAtRound:o}){super(),this.id=e,this.schema=t,this.closedOutAtRound=n,this.deleted=r,this.keyValue=i,this.optedInAtRound=o,this.attribute_map={id:"id",schema:"schema",closedOutAtRound:"closed-out-at-round",deleted:"deleted",keyValue:"key-value",optedInAtRound:"opted-in-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);if("undefined"===typeof e.schema)throw new Error(`Response is missing required field 'schema': ${e}`);return new Ln({id:e.id,schema:qn.from_obj_for_encoding(e.schema),closedOutAtRound:e["closed-out-at-round"],deleted:e.deleted,keyValue:"undefined"!==typeof e["key-value"]?e["key-value"].map(xr.from_obj_for_encoding):void 0,optedInAtRound:e["opted-in-at-round"]})}}class Dn extends fe{constructor({appsLocalStates:e,currentRound:t,nextToken:n}){super(),this.appsLocalStates=e,this.currentRound=t,this.nextToken=n,this.attribute_map={appsLocalStates:"apps-local-states",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e["apps-local-states"]))throw new Error(`Response is missing required array field 'apps-local-states': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Dn({appsLocalStates:e["apps-local-states"].map(Ln.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Un extends fe{constructor({logs:e,txid:t}){super(),this.logs=e,this.txid=t,this.attribute_map={logs:"logs",txid:"txid"}}static from_obj_for_encoding(e){if(!Array.isArray(e.logs))throw new Error(`Response is missing required array field 'logs': ${e}`);if("undefined"===typeof e.txid)throw new Error(`Response is missing required field 'txid': ${e}`);return new Un({logs:e.logs,txid:e.txid})}}class jn extends fe{constructor({applicationId:e,currentRound:t,logData:n,nextToken:r}){super(),this.applicationId=e,this.currentRound=t,this.logData=n,this.nextToken=r,this.attribute_map={applicationId:"application-id",currentRound:"current-round",logData:"log-data",nextToken:"next-token"}}static from_obj_for_encoding(e){if("undefined"===typeof e["application-id"])throw new Error(`Response is missing required field 'application-id': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new jn({applicationId:e["application-id"],currentRound:e["current-round"],logData:"undefined"!==typeof e["log-data"]?e["log-data"].map(Un.from_obj_for_encoding):void 0,nextToken:e["next-token"]})}}class Fn extends fe{constructor({approvalProgram:e,clearStateProgram:t,creator:n,extraProgramPages:r,globalState:i,globalStateSchema:o,localStateSchema:s}){super(),this.approvalProgram="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.clearStateProgram="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.creator=n,this.extraProgramPages=r,this.globalState=i,this.globalStateSchema=o,this.localStateSchema=s,this.attribute_map={approvalProgram:"approval-program",clearStateProgram:"clear-state-program",creator:"creator",extraProgramPages:"extra-program-pages",globalState:"global-state",globalStateSchema:"global-state-schema",localStateSchema:"local-state-schema"}}static from_obj_for_encoding(e){if("undefined"===typeof e["approval-program"])throw new Error(`Response is missing required field 'approval-program': ${e}`);if("undefined"===typeof e["clear-state-program"])throw new Error(`Response is missing required field 'clear-state-program': ${e}`);return new Fn({approvalProgram:e["approval-program"],clearStateProgram:e["clear-state-program"],creator:e.creator,extraProgramPages:e["extra-program-pages"],globalState:"undefined"!==typeof e["global-state"]?e["global-state"].map(xr.from_obj_for_encoding):void 0,globalStateSchema:"undefined"!==typeof e["global-state-schema"]?qn.from_obj_for_encoding(e["global-state-schema"]):void 0,localStateSchema:"undefined"!==typeof e["local-state-schema"]?qn.from_obj_for_encoding(e["local-state-schema"]):void 0})}}class Vn extends fe{constructor({currentRound:e,application:t}){super(),this.currentRound=e,this.application=t,this.attribute_map={currentRound:"current-round",application:"application"}}static from_obj_for_encoding(e){if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Vn({currentRound:e["current-round"],application:"undefined"!==typeof e.application?Bn.from_obj_for_encoding(e.application):void 0})}}class qn extends fe{constructor({numByteSlice:e,numUint:t}){super(),this.numByteSlice=e,this.numUint=t,this.attribute_map={numByteSlice:"num-byte-slice",numUint:"num-uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e["num-byte-slice"])throw new Error(`Response is missing required field 'num-byte-slice': ${e}`);if("undefined"===typeof e["num-uint"])throw new Error(`Response is missing required field 'num-uint': ${e}`);return new qn({numByteSlice:e["num-byte-slice"],numUint:e["num-uint"]})}}class zn extends fe{constructor({applications:e,currentRound:t,nextToken:n}){super(),this.applications=e,this.currentRound=t,this.nextToken=n,this.attribute_map={applications:"applications",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.applications))throw new Error(`Response is missing required array field 'applications': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new zn({applications:e.applications.map(Bn.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Hn extends fe{constructor({index:e,params:t,createdAtRound:n,deleted:r,destroyedAtRound:i}){super(),this.index=e,this.params=t,this.createdAtRound=n,this.deleted=r,this.destroyedAtRound=i,this.attribute_map={index:"index",params:"params",createdAtRound:"created-at-round",deleted:"deleted",destroyedAtRound:"destroyed-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.index)throw new Error(`Response is missing required field 'index': ${e}`);if("undefined"===typeof e.params)throw new Error(`Response is missing required field 'params': ${e}`);return new Hn({index:e.index,params:Kn.from_obj_for_encoding(e.params),createdAtRound:e["created-at-round"],deleted:e.deleted,destroyedAtRound:e["destroyed-at-round"]})}}class Wn extends fe{constructor({balances:e,currentRound:t,nextToken:n}){super(),this.balances=e,this.currentRound=t,this.nextToken=n,this.attribute_map={balances:"balances",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.balances))throw new Error(`Response is missing required array field 'balances': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Wn({balances:e.balances.map(dr.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Gn extends fe{constructor({amount:e,assetId:t,isFrozen:n,deleted:r,optedInAtRound:i,optedOutAtRound:o}){super(),this.amount=e,this.assetId=t,this.isFrozen=n,this.deleted=r,this.optedInAtRound=i,this.optedOutAtRound=o,this.attribute_map={amount:"amount",assetId:"asset-id",isFrozen:"is-frozen",deleted:"deleted",optedInAtRound:"opted-in-at-round",optedOutAtRound:"opted-out-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["asset-id"])throw new Error(`Response is missing required field 'asset-id': ${e}`);if("undefined"===typeof e["is-frozen"])throw new Error(`Response is missing required field 'is-frozen': ${e}`);return new Gn({amount:e.amount,assetId:e["asset-id"],isFrozen:e["is-frozen"],deleted:e.deleted,optedInAtRound:e["opted-in-at-round"],optedOutAtRound:e["opted-out-at-round"]})}}class Zn extends fe{constructor({assets:e,currentRound:t,nextToken:n}){super(),this.assets=e,this.currentRound=t,this.nextToken=n,this.attribute_map={assets:"assets",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.assets))throw new Error(`Response is missing required array field 'assets': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Zn({assets:e.assets.map(Gn.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Kn extends fe{constructor({creator:e,decimals:t,total:n,clawback:r,defaultFrozen:i,freeze:o,manager:s,metadataHash:c,name:u,nameB64:l,reserve:d,unitName:f,unitNameB64:h,url:p,urlB64:g}){super(),this.creator=e,this.decimals=t,this.total=n,this.clawback=r,this.defaultFrozen=i,this.freeze=o,this.manager=s,this.metadataHash="string"===typeof c?new Uint8Array(a.lW.from(c,"base64")):c,this.name=u,this.nameB64="string"===typeof l?new Uint8Array(a.lW.from(l,"base64")):l,this.reserve=d,this.unitName=f,this.unitNameB64="string"===typeof h?new Uint8Array(a.lW.from(h,"base64")):h,this.url=p,this.urlB64="string"===typeof g?new Uint8Array(a.lW.from(g,"base64")):g,this.attribute_map={creator:"creator",decimals:"decimals",total:"total",clawback:"clawback",defaultFrozen:"default-frozen",freeze:"freeze",manager:"manager",metadataHash:"metadata-hash",name:"name",nameB64:"name-b64",reserve:"reserve",unitName:"unit-name",unitNameB64:"unit-name-b64",url:"url",urlB64:"url-b64"}}static from_obj_for_encoding(e){if("undefined"===typeof e.creator)throw new Error(`Response is missing required field 'creator': ${e}`);if("undefined"===typeof e.decimals)throw new Error(`Response is missing required field 'decimals': ${e}`);if("undefined"===typeof e.total)throw new Error(`Response is missing required field 'total': ${e}`);return new Kn({creator:e.creator,decimals:e.decimals,total:e.total,clawback:e.clawback,defaultFrozen:e["default-frozen"],freeze:e.freeze,manager:e.manager,metadataHash:e["metadata-hash"],name:e.name,nameB64:e["name-b64"],reserve:e.reserve,unitName:e["unit-name"],unitNameB64:e["unit-name-b64"],url:e.url,urlB64:e["url-b64"]})}}class Xn extends fe{constructor({asset:e,currentRound:t}){super(),this.asset=e,this.currentRound=t,this.attribute_map={asset:"asset",currentRound:"current-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.asset)throw new Error(`Response is missing required field 'asset': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Xn({asset:Hn.from_obj_for_encoding(e.asset),currentRound:e["current-round"]})}}class Yn extends fe{constructor({assets:e,currentRound:t,nextToken:n}){super(),this.assets=e,this.currentRound=t,this.nextToken=n,this.attribute_map={assets:"assets",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.assets))throw new Error(`Response is missing required array field 'assets': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Yn({assets:e.assets.map(Hn.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Jn extends fe{constructor({genesisHash:e,genesisId:t,previousBlockHash:n,round:r,seed:i,timestamp:o,transactionsRoot:s,transactionsRootSha256:c,participationUpdates:u,rewards:l,stateProofTracking:d,transactions:f,txnCounter:h,upgradeState:p,upgradeVote:g}){super(),this.genesisHash="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.genesisId=t,this.previousBlockHash="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.round=r,this.seed="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.timestamp=o,this.transactionsRoot="string"===typeof s?new Uint8Array(a.lW.from(s,"base64")):s,this.transactionsRootSha256="string"===typeof c?new Uint8Array(a.lW.from(c,"base64")):c,this.participationUpdates=u,this.rewards=l,this.stateProofTracking=d,this.transactions=f,this.txnCounter=h,this.upgradeState=p,this.upgradeVote=g,this.attribute_map={genesisHash:"genesis-hash",genesisId:"genesis-id",previousBlockHash:"previous-block-hash",round:"round",seed:"seed",timestamp:"timestamp",transactionsRoot:"transactions-root",transactionsRootSha256:"transactions-root-sha256",participationUpdates:"participation-updates",rewards:"rewards",stateProofTracking:"state-proof-tracking",transactions:"transactions",txnCounter:"txn-counter",upgradeState:"upgrade-state",upgradeVote:"upgrade-vote"}}static from_obj_for_encoding(e){if("undefined"===typeof e["genesis-hash"])throw new Error(`Response is missing required field 'genesis-hash': ${e}`);if("undefined"===typeof e["genesis-id"])throw new Error(`Response is missing required field 'genesis-id': ${e}`);if("undefined"===typeof e["previous-block-hash"])throw new Error(`Response is missing required field 'previous-block-hash': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.seed)throw new Error(`Response is missing required field 'seed': ${e}`);if("undefined"===typeof e.timestamp)throw new Error(`Response is missing required field 'timestamp': ${e}`);if("undefined"===typeof e["transactions-root"])throw new Error(`Response is missing required field 'transactions-root': ${e}`);if("undefined"===typeof e["transactions-root-sha256"])throw new Error(`Response is missing required field 'transactions-root-sha256': ${e}`);return new Jn({genesisHash:e["genesis-hash"],genesisId:e["genesis-id"],previousBlockHash:e["previous-block-hash"],round:e.round,seed:e.seed,timestamp:e.timestamp,transactionsRoot:e["transactions-root"],transactionsRootSha256:e["transactions-root-sha256"],participationUpdates:"undefined"!==typeof e["participation-updates"]?fr.from_obj_for_encoding(e["participation-updates"]):void 0,rewards:"undefined"!==typeof e.rewards?Qn.from_obj_for_encoding(e.rewards):void 0,stateProofTracking:"undefined"!==typeof e["state-proof-tracking"]?e["state-proof-tracking"].map(yr.from_obj_for_encoding):void 0,transactions:"undefined"!==typeof e.transactions?e.transactions.map(Ar.from_obj_for_encoding):void 0,txnCounter:e["txn-counter"],upgradeState:"undefined"!==typeof e["upgrade-state"]?$n.from_obj_for_encoding(e["upgrade-state"]):void 0,upgradeVote:"undefined"!==typeof e["upgrade-vote"]?er.from_obj_for_encoding(e["upgrade-vote"]):void 0})}}class Qn extends fe{constructor({feeSink:e,rewardsCalculationRound:t,rewardsLevel:n,rewardsPool:r,rewardsRate:i,rewardsResidue:o}){super(),this.feeSink=e,this.rewardsCalculationRound=t,this.rewardsLevel=n,this.rewardsPool=r,this.rewardsRate=i,this.rewardsResidue=o,this.attribute_map={feeSink:"fee-sink",rewardsCalculationRound:"rewards-calculation-round",rewardsLevel:"rewards-level",rewardsPool:"rewards-pool",rewardsRate:"rewards-rate",rewardsResidue:"rewards-residue"}}static from_obj_for_encoding(e){if("undefined"===typeof e["fee-sink"])throw new Error(`Response is missing required field 'fee-sink': ${e}`);if("undefined"===typeof e["rewards-calculation-round"])throw new Error(`Response is missing required field 'rewards-calculation-round': ${e}`);if("undefined"===typeof e["rewards-level"])throw new Error(`Response is missing required field 'rewards-level': ${e}`);if("undefined"===typeof e["rewards-pool"])throw new Error(`Response is missing required field 'rewards-pool': ${e}`);if("undefined"===typeof e["rewards-rate"])throw new Error(`Response is missing required field 'rewards-rate': ${e}`);if("undefined"===typeof e["rewards-residue"])throw new Error(`Response is missing required field 'rewards-residue': ${e}`);return new Qn({feeSink:e["fee-sink"],rewardsCalculationRound:e["rewards-calculation-round"],rewardsLevel:e["rewards-level"],rewardsPool:e["rewards-pool"],rewardsRate:e["rewards-rate"],rewardsResidue:e["rewards-residue"]})}}class $n extends fe{constructor({currentProtocol:e,nextProtocol:t,nextProtocolApprovals:n,nextProtocolSwitchOn:r,nextProtocolVoteBefore:i}){super(),this.currentProtocol=e,this.nextProtocol=t,this.nextProtocolApprovals=n,this.nextProtocolSwitchOn=r,this.nextProtocolVoteBefore=i,this.attribute_map={currentProtocol:"current-protocol",nextProtocol:"next-protocol",nextProtocolApprovals:"next-protocol-approvals",nextProtocolSwitchOn:"next-protocol-switch-on",nextProtocolVoteBefore:"next-protocol-vote-before"}}static from_obj_for_encoding(e){if("undefined"===typeof e["current-protocol"])throw new Error(`Response is missing required field 'current-protocol': ${e}`);return new $n({currentProtocol:e["current-protocol"],nextProtocol:e["next-protocol"],nextProtocolApprovals:e["next-protocol-approvals"],nextProtocolSwitchOn:e["next-protocol-switch-on"],nextProtocolVoteBefore:e["next-protocol-vote-before"]})}}class er extends fe{constructor({upgradeApprove:e,upgradeDelay:t,upgradePropose:n}){super(),this.upgradeApprove=e,this.upgradeDelay=t,this.upgradePropose=n,this.attribute_map={upgradeApprove:"upgrade-approve",upgradeDelay:"upgrade-delay",upgradePropose:"upgrade-propose"}}static from_obj_for_encoding(e){return new er({upgradeApprove:e["upgrade-approve"],upgradeDelay:e["upgrade-delay"],upgradePropose:e["upgrade-propose"]})}}class tr extends fe{constructor({name:e,value:t}){super(),this.name="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.value="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={name:"name",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new tr({name:e.name,value:e.value})}}class nr extends fe{constructor({name:e}){super(),this.name="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.attribute_map={name:"name"}}static from_obj_for_encoding(e){if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);return new nr({name:e.name})}}class rr extends fe{constructor({applicationId:e,boxes:t,nextToken:n}){super(),this.applicationId=e,this.boxes=t,this.nextToken=n,this.attribute_map={applicationId:"application-id",boxes:"boxes",nextToken:"next-token"}}static from_obj_for_encoding(e){if("undefined"===typeof e["application-id"])throw new Error(`Response is missing required field 'application-id': ${e}`);if(!Array.isArray(e.boxes))throw new Error(`Response is missing required array field 'boxes': ${e}`);return new rr({applicationId:e["application-id"],boxes:e.boxes.map(nr.from_obj_for_encoding),nextToken:e["next-token"]})}}class ir extends fe{constructor({message:e,data:t}){super(),this.message=e,this.data=t,this.attribute_map={message:"message",data:"data"}}static from_obj_for_encoding(e){if("undefined"===typeof e.message)throw new Error(`Response is missing required field 'message': ${e}`);return new ir({message:e.message,data:e.data})}}class or extends fe{constructor({action:e,bytes:t,uint:n}){super(),this.action=e,this.bytes=t,this.uint=n,this.attribute_map={action:"action",bytes:"bytes",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.action)throw new Error(`Response is missing required field 'action': ${e}`);return new or({action:e.action,bytes:e.bytes,uint:e.uint})}}class sr extends fe{constructor({key:e,value:t}){super(),this.key=e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new sr({key:e.key,value:or.from_obj_for_encoding(e.value)})}}class ar extends fe{constructor({hashType:e}){super(),this.hashType=e,this.attribute_map={hashType:"hash-type"}}static from_obj_for_encoding(e){return new ar({hashType:e["hash-type"]})}}class cr extends fe{constructor({dbAvailable:e,isMigrating:t,message:n,round:r,version:i,data:o,errors:s}){super(),this.dbAvailable=e,this.isMigrating=t,this.message=n,this.round=r,this.version=i,this.data=o,this.errors=s,this.attribute_map={dbAvailable:"db-available",isMigrating:"is-migrating",message:"message",round:"round",version:"version",data:"data",errors:"errors"}}static from_obj_for_encoding(e){if("undefined"===typeof e["db-available"])throw new Error(`Response is missing required field 'db-available': ${e}`);if("undefined"===typeof e["is-migrating"])throw new Error(`Response is missing required field 'is-migrating': ${e}`);if("undefined"===typeof e.message)throw new Error(`Response is missing required field 'message': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.version)throw new Error(`Response is missing required field 'version': ${e}`);return new cr({dbAvailable:e["db-available"],isMigrating:e["is-migrating"],message:e.message,round:e.round,version:e.version,data:e.data,errors:e.errors})}}class ur extends fe{constructor({blockHeadersCommitment:e,firstAttestedRound:t,latestAttestedRound:n,lnProvenWeight:r,votersCommitment:i}){super(),this.blockHeadersCommitment="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.firstAttestedRound=t,this.latestAttestedRound=n,this.lnProvenWeight=r,this.votersCommitment="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.attribute_map={blockHeadersCommitment:"block-headers-commitment",firstAttestedRound:"first-attested-round",latestAttestedRound:"latest-attested-round",lnProvenWeight:"ln-proven-weight",votersCommitment:"voters-commitment"}}static from_obj_for_encoding(e){return new ur({blockHeadersCommitment:e["block-headers-commitment"],firstAttestedRound:e["first-attested-round"],latestAttestedRound:e["latest-attested-round"],lnProvenWeight:e["ln-proven-weight"],votersCommitment:e["voters-commitment"]})}}class lr extends fe{constructor({hashFactory:e,path:t,treeDepth:n}){super(),this.hashFactory=e,this.path=t,this.treeDepth=n,this.attribute_map={hashFactory:"hash-factory",path:"path",treeDepth:"tree-depth"}}static from_obj_for_encoding(e){return new lr({hashFactory:"undefined"!==typeof e["hash-factory"]?ar.from_obj_for_encoding(e["hash-factory"]):void 0,path:e.path,treeDepth:e["tree-depth"]})}}class dr extends fe{constructor({address:e,amount:t,isFrozen:n,deleted:r,optedInAtRound:i,optedOutAtRound:o}){super(),this.address=e,this.amount=t,this.isFrozen=n,this.deleted=r,this.optedInAtRound=i,this.optedOutAtRound=o,this.attribute_map={address:"address",amount:"amount",isFrozen:"is-frozen",deleted:"deleted",optedInAtRound:"opted-in-at-round",optedOutAtRound:"opted-out-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["is-frozen"])throw new Error(`Response is missing required field 'is-frozen': ${e}`);return new dr({address:e.address,amount:e.amount,isFrozen:e["is-frozen"],deleted:e.deleted,optedInAtRound:e["opted-in-at-round"],optedOutAtRound:e["opted-out-at-round"]})}}class fr extends fe{constructor({expiredParticipationAccounts:e}){super(),this.expiredParticipationAccounts=e,this.attribute_map={expiredParticipationAccounts:"expired-participation-accounts"}}static from_obj_for_encoding(e){return new fr({expiredParticipationAccounts:e["expired-participation-accounts"]})}}class hr extends fe{constructor({partProofs:e,positionsToReveal:t,reveals:n,saltVersion:r,sigCommit:i,sigProofs:o,signedWeight:s}){super(),this.partProofs=e,this.positionsToReveal=t,this.reveals=n,this.saltVersion=r,this.sigCommit="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.sigProofs=o,this.signedWeight=s,this.attribute_map={partProofs:"part-proofs",positionsToReveal:"positions-to-reveal",reveals:"reveals",saltVersion:"salt-version",sigCommit:"sig-commit",sigProofs:"sig-proofs",signedWeight:"signed-weight"}}static from_obj_for_encoding(e){return new hr({partProofs:"undefined"!==typeof e["part-proofs"]?lr.from_obj_for_encoding(e["part-proofs"]):void 0,positionsToReveal:e["positions-to-reveal"],reveals:"undefined"!==typeof e.reveals?e.reveals.map(gr.from_obj_for_encoding):void 0,saltVersion:e["salt-version"],sigCommit:e["sig-commit"],sigProofs:"undefined"!==typeof e["sig-proofs"]?lr.from_obj_for_encoding(e["sig-proofs"]):void 0,signedWeight:e["signed-weight"]})}}class pr extends fe{constructor({verifier:e,weight:t}){super(),this.verifier=e,this.weight=t,this.attribute_map={verifier:"verifier",weight:"weight"}}static from_obj_for_encoding(e){return new pr({verifier:"undefined"!==typeof e.verifier?vr.from_obj_for_encoding(e.verifier):void 0,weight:e.weight})}}class gr extends fe{constructor({participant:e,position:t,sigSlot:n}){super(),this.participant=e,this.position=t,this.sigSlot=n,this.attribute_map={participant:"participant",position:"position",sigSlot:"sig-slot"}}static from_obj_for_encoding(e){return new gr({participant:"undefined"!==typeof e.participant?pr.from_obj_for_encoding(e.participant):void 0,position:e.position,sigSlot:"undefined"!==typeof e["sig-slot"]?mr.from_obj_for_encoding(e["sig-slot"]):void 0})}}class mr extends fe{constructor({lowerSigWeight:e,signature:t}){super(),this.lowerSigWeight=e,this.signature=t,this.attribute_map={lowerSigWeight:"lower-sig-weight",signature:"signature"}}static from_obj_for_encoding(e){return new mr({lowerSigWeight:e["lower-sig-weight"],signature:"undefined"!==typeof e.signature?br.from_obj_for_encoding(e.signature):void 0})}}class br extends fe{constructor({falconSignature:e,merkleArrayIndex:t,proof:n,verifyingKey:r}){super(),this.falconSignature="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.merkleArrayIndex=t,this.proof=n,this.verifyingKey="string"===typeof r?new Uint8Array(a.lW.from(r,"base64")):r,this.attribute_map={falconSignature:"falcon-signature",merkleArrayIndex:"merkle-array-index",proof:"proof",verifyingKey:"verifying-key"}}static from_obj_for_encoding(e){return new br({falconSignature:e["falcon-signature"],merkleArrayIndex:e["merkle-array-index"],proof:"undefined"!==typeof e.proof?lr.from_obj_for_encoding(e.proof):void 0,verifyingKey:e["verifying-key"]})}}class yr extends fe{constructor({nextRound:e,onlineTotalWeight:t,type:n,votersCommitment:r}){super(),this.nextRound=e,this.onlineTotalWeight=t,this.type=n,this.votersCommitment="string"===typeof r?new Uint8Array(a.lW.from(r,"base64")):r,this.attribute_map={nextRound:"next-round",onlineTotalWeight:"online-total-weight",type:"type",votersCommitment:"voters-commitment"}}static from_obj_for_encoding(e){return new yr({nextRound:e["next-round"],onlineTotalWeight:e["online-total-weight"],type:e.type,votersCommitment:e["voters-commitment"]})}}class vr extends fe{constructor({commitment:e,keyLifetime:t}){super(),this.commitment="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.keyLifetime=t,this.attribute_map={commitment:"commitment",keyLifetime:"key-lifetime"}}static from_obj_for_encoding(e){return new vr({commitment:e.commitment,keyLifetime:e["key-lifetime"]})}}class wr extends fe{constructor({numByteSlice:e,numUint:t}){super(),this.numByteSlice=e,this.numUint=t,this.attribute_map={numByteSlice:"num-byte-slice",numUint:"num-uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e["num-byte-slice"])throw new Error(`Response is missing required field 'num-byte-slice': ${e}`);if("undefined"===typeof e["num-uint"])throw new Error(`Response is missing required field 'num-uint': ${e}`);return new wr({numByteSlice:e["num-byte-slice"],numUint:e["num-uint"]})}}class xr extends fe{constructor({key:e,value:t}){super(),this.key=e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new xr({key:e.key,value:Sr.from_obj_for_encoding(e.value)})}}class Sr extends fe{constructor({bytes:e,type:t,uint:n}){super(),this.bytes=e,this.type=t,this.uint=n,this.attribute_map={bytes:"bytes",type:"type",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.bytes)throw new Error(`Response is missing required field 'bytes': ${e}`);if("undefined"===typeof e.type)throw new Error(`Response is missing required field 'type': ${e}`);if("undefined"===typeof e.uint)throw new Error(`Response is missing required field 'uint': ${e}`);return new Sr({bytes:e.bytes,type:e.type,uint:e.uint})}}class Ar extends fe{constructor({fee:e,firstValid:t,lastValid:n,sender:r,applicationTransaction:i,assetConfigTransaction:o,assetFreezeTransaction:s,assetTransferTransaction:c,authAddr:u,closeRewards:l,closingAmount:d,confirmedRound:f,createdApplicationIndex:h,createdAssetIndex:p,genesisHash:g,genesisId:m,globalStateDelta:b,group:y,id:v,innerTxns:w,intraRoundOffset:x,keyregTransaction:S,lease:A,localStateDelta:E,logs:_,note:C,paymentTransaction:I,receiverRewards:k,rekeyTo:T,roundTime:M,senderRewards:P,signature:O,stateProofTransaction:R,txType:N}){super(),this.fee=e,this.firstValid=t,this.lastValid=n,this.sender=r,this.applicationTransaction=i,this.assetConfigTransaction=o,this.assetFreezeTransaction=s,this.assetTransferTransaction=c,this.authAddr=u,this.closeRewards=l,this.closingAmount=d,this.confirmedRound=f,this.createdApplicationIndex=h,this.createdAssetIndex=p,this.genesisHash="string"===typeof g?new Uint8Array(a.lW.from(g,"base64")):g,this.genesisId=m,this.globalStateDelta=b,this.group="string"===typeof y?new Uint8Array(a.lW.from(y,"base64")):y,this.id=v,this.innerTxns=w,this.intraRoundOffset=x,this.keyregTransaction=S,this.lease="string"===typeof A?new Uint8Array(a.lW.from(A,"base64")):A,this.localStateDelta=E,this.logs=_,this.note="string"===typeof C?new Uint8Array(a.lW.from(C,"base64")):C,this.paymentTransaction=I,this.receiverRewards=k,this.rekeyTo=T,this.roundTime=M,this.senderRewards=P,this.signature=O,this.stateProofTransaction=R,this.txType=N,this.attribute_map={fee:"fee",firstValid:"first-valid",lastValid:"last-valid",sender:"sender",applicationTransaction:"application-transaction",assetConfigTransaction:"asset-config-transaction",assetFreezeTransaction:"asset-freeze-transaction",assetTransferTransaction:"asset-transfer-transaction",authAddr:"auth-addr",closeRewards:"close-rewards",closingAmount:"closing-amount",confirmedRound:"confirmed-round",createdApplicationIndex:"created-application-index",createdAssetIndex:"created-asset-index",genesisHash:"genesis-hash",genesisId:"genesis-id",globalStateDelta:"global-state-delta",group:"group",id:"id",innerTxns:"inner-txns",intraRoundOffset:"intra-round-offset",keyregTransaction:"keyreg-transaction",lease:"lease",localStateDelta:"local-state-delta",logs:"logs",note:"note",paymentTransaction:"payment-transaction",receiverRewards:"receiver-rewards",rekeyTo:"rekey-to",roundTime:"round-time",senderRewards:"sender-rewards",signature:"signature",stateProofTransaction:"state-proof-transaction",txType:"tx-type"}}static from_obj_for_encoding(e){if("undefined"===typeof e.fee)throw new Error(`Response is missing required field 'fee': ${e}`);if("undefined"===typeof e["first-valid"])throw new Error(`Response is missing required field 'first-valid': ${e}`);if("undefined"===typeof e["last-valid"])throw new Error(`Response is missing required field 'last-valid': ${e}`);if("undefined"===typeof e.sender)throw new Error(`Response is missing required field 'sender': ${e}`);return new Ar({fee:e.fee,firstValid:e["first-valid"],lastValid:e["last-valid"],sender:e.sender,applicationTransaction:"undefined"!==typeof e["application-transaction"]?Er.from_obj_for_encoding(e["application-transaction"]):void 0,assetConfigTransaction:"undefined"!==typeof e["asset-config-transaction"]?_r.from_obj_for_encoding(e["asset-config-transaction"]):void 0,assetFreezeTransaction:"undefined"!==typeof e["asset-freeze-transaction"]?Cr.from_obj_for_encoding(e["asset-freeze-transaction"]):void 0,assetTransferTransaction:"undefined"!==typeof e["asset-transfer-transaction"]?Ir.from_obj_for_encoding(e["asset-transfer-transaction"]):void 0,authAddr:e["auth-addr"],closeRewards:e["close-rewards"],closingAmount:e["closing-amount"],confirmedRound:e["confirmed-round"],createdApplicationIndex:e["created-application-index"],createdAssetIndex:e["created-asset-index"],genesisHash:e["genesis-hash"],genesisId:e["genesis-id"],globalStateDelta:"undefined"!==typeof e["global-state-delta"]?e["global-state-delta"].map(sr.from_obj_for_encoding):void 0,group:e.group,id:e.id,innerTxns:"undefined"!==typeof e["inner-txns"]?e["inner-txns"].map(Ar.from_obj_for_encoding):void 0,intraRoundOffset:e["intra-round-offset"],keyregTransaction:"undefined"!==typeof e["keyreg-transaction"]?kr.from_obj_for_encoding(e["keyreg-transaction"]):void 0,lease:e.lease,localStateDelta:"undefined"!==typeof e["local-state-delta"]?e["local-state-delta"].map(Rn.from_obj_for_encoding):void 0,logs:e.logs,note:e.note,paymentTransaction:"undefined"!==typeof e["payment-transaction"]?Tr.from_obj_for_encoding(e["payment-transaction"]):void 0,receiverRewards:e["receiver-rewards"],rekeyTo:e["rekey-to"],roundTime:e["round-time"],senderRewards:e["sender-rewards"],signature:"undefined"!==typeof e.signature?Pr.from_obj_for_encoding(e.signature):void 0,stateProofTransaction:"undefined"!==typeof e["state-proof-transaction"]?Br.from_obj_for_encoding(e["state-proof-transaction"]):void 0,txType:e["tx-type"]})}}class Er extends fe{constructor({applicationId:e,accounts:t,applicationArgs:n,approvalProgram:r,clearStateProgram:i,extraProgramPages:o,foreignApps:s,foreignAssets:c,globalStateSchema:u,localStateSchema:l,onCompletion:d}){super(),this.applicationId=e,this.accounts=t,this.applicationArgs=n,this.approvalProgram="string"===typeof r?new Uint8Array(a.lW.from(r,"base64")):r,this.clearStateProgram="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.extraProgramPages=o,this.foreignApps=s,this.foreignAssets=c,this.globalStateSchema=u,this.localStateSchema=l,this.onCompletion=d,this.attribute_map={applicationId:"application-id",accounts:"accounts",applicationArgs:"application-args",approvalProgram:"approval-program",clearStateProgram:"clear-state-program",extraProgramPages:"extra-program-pages",foreignApps:"foreign-apps",foreignAssets:"foreign-assets",globalStateSchema:"global-state-schema",localStateSchema:"local-state-schema",onCompletion:"on-completion"}}static from_obj_for_encoding(e){if("undefined"===typeof e["application-id"])throw new Error(`Response is missing required field 'application-id': ${e}`);return new Er({applicationId:e["application-id"],accounts:e.accounts,applicationArgs:e["application-args"],approvalProgram:e["approval-program"],clearStateProgram:e["clear-state-program"],extraProgramPages:e["extra-program-pages"],foreignApps:e["foreign-apps"],foreignAssets:e["foreign-assets"],globalStateSchema:"undefined"!==typeof e["global-state-schema"]?wr.from_obj_for_encoding(e["global-state-schema"]):void 0,localStateSchema:"undefined"!==typeof e["local-state-schema"]?wr.from_obj_for_encoding(e["local-state-schema"]):void 0,onCompletion:e["on-completion"]})}}class _r extends fe{constructor({assetId:e,params:t}){super(),this.assetId=e,this.params=t,this.attribute_map={assetId:"asset-id",params:"params"}}static from_obj_for_encoding(e){return new _r({assetId:e["asset-id"],params:"undefined"!==typeof e.params?Kn.from_obj_for_encoding(e.params):void 0})}}class Cr extends fe{constructor({address:e,assetId:t,newFreezeStatus:n}){super(),this.address=e,this.assetId=t,this.newFreezeStatus=n,this.attribute_map={address:"address",assetId:"asset-id",newFreezeStatus:"new-freeze-status"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if("undefined"===typeof e["asset-id"])throw new Error(`Response is missing required field 'asset-id': ${e}`);if("undefined"===typeof e["new-freeze-status"])throw new Error(`Response is missing required field 'new-freeze-status': ${e}`);return new Cr({address:e.address,assetId:e["asset-id"],newFreezeStatus:e["new-freeze-status"]})}}class Ir extends fe{constructor({amount:e,assetId:t,receiver:n,closeAmount:r,closeTo:i,sender:o}){super(),this.amount=e,this.assetId=t,this.receiver=n,this.closeAmount=r,this.closeTo=i,this.sender=o,this.attribute_map={amount:"amount",assetId:"asset-id",receiver:"receiver",closeAmount:"close-amount",closeTo:"close-to",sender:"sender"}}static from_obj_for_encoding(e){if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["asset-id"])throw new Error(`Response is missing required field 'asset-id': ${e}`);if("undefined"===typeof e.receiver)throw new Error(`Response is missing required field 'receiver': ${e}`);return new Ir({amount:e.amount,assetId:e["asset-id"],receiver:e.receiver,closeAmount:e["close-amount"],closeTo:e["close-to"],sender:e.sender})}}class kr extends fe{constructor({nonParticipation:e,selectionParticipationKey:t,stateProofKey:n,voteFirstValid:r,voteKeyDilution:i,voteLastValid:o,voteParticipationKey:s}){super(),this.nonParticipation=e,this.selectionParticipationKey="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.stateProofKey="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.voteFirstValid=r,this.voteKeyDilution=i,this.voteLastValid=o,this.voteParticipationKey="string"===typeof s?new Uint8Array(a.lW.from(s,"base64")):s,this.attribute_map={nonParticipation:"non-participation",selectionParticipationKey:"selection-participation-key",stateProofKey:"state-proof-key",voteFirstValid:"vote-first-valid",voteKeyDilution:"vote-key-dilution",voteLastValid:"vote-last-valid",voteParticipationKey:"vote-participation-key"}}static from_obj_for_encoding(e){return new kr({nonParticipation:e["non-participation"],selectionParticipationKey:e["selection-participation-key"],stateProofKey:e["state-proof-key"],voteFirstValid:e["vote-first-valid"],voteKeyDilution:e["vote-key-dilution"],voteLastValid:e["vote-last-valid"],voteParticipationKey:e["vote-participation-key"]})}}class Tr extends fe{constructor({amount:e,receiver:t,closeAmount:n,closeRemainderTo:r}){super(),this.amount=e,this.receiver=t,this.closeAmount=n,this.closeRemainderTo=r,this.attribute_map={amount:"amount",receiver:"receiver",closeAmount:"close-amount",closeRemainderTo:"close-remainder-to"}}static from_obj_for_encoding(e){if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e.receiver)throw new Error(`Response is missing required field 'receiver': ${e}`);return new Tr({amount:e.amount,receiver:e.receiver,closeAmount:e["close-amount"],closeRemainderTo:e["close-remainder-to"]})}}class Mr extends fe{constructor({currentRound:e,transaction:t}){super(),this.currentRound=e,this.transaction=t,this.attribute_map={currentRound:"current-round",transaction:"transaction"}}static from_obj_for_encoding(e){if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);if("undefined"===typeof e.transaction)throw new Error(`Response is missing required field 'transaction': ${e}`);return new Mr({currentRound:e["current-round"],transaction:Ar.from_obj_for_encoding(e.transaction)})}}class Pr extends fe{constructor({logicsig:e,multisig:t,sig:n}){super(),this.logicsig=e,this.multisig=t,this.sig="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.attribute_map={logicsig:"logicsig",multisig:"multisig",sig:"sig"}}static from_obj_for_encoding(e){return new Pr({logicsig:"undefined"!==typeof e.logicsig?Or.from_obj_for_encoding(e.logicsig):void 0,multisig:"undefined"!==typeof e.multisig?Rr.from_obj_for_encoding(e.multisig):void 0,sig:e.sig})}}class Or extends fe{constructor({logic:e,args:t,multisigSignature:n,signature:r}){super(),this.logic="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.args=t,this.multisigSignature=n,this.signature="string"===typeof r?new Uint8Array(a.lW.from(r,"base64")):r,this.attribute_map={logic:"logic",args:"args",multisigSignature:"multisig-signature",signature:"signature"}}static from_obj_for_encoding(e){if("undefined"===typeof e.logic)throw new Error(`Response is missing required field 'logic': ${e}`);return new Or({logic:e.logic,args:e.args,multisigSignature:"undefined"!==typeof e["multisig-signature"]?Rr.from_obj_for_encoding(e["multisig-signature"]):void 0,signature:e.signature})}}class Rr extends fe{constructor({subsignature:e,threshold:t,version:n}){super(),this.subsignature=e,this.threshold=t,this.version=n,this.attribute_map={subsignature:"subsignature",threshold:"threshold",version:"version"}}static from_obj_for_encoding(e){return new Rr({subsignature:"undefined"!==typeof e.subsignature?e.subsignature.map(Nr.from_obj_for_encoding):void 0,threshold:e.threshold,version:e.version})}}class Nr extends fe{constructor({publicKey:e,signature:t}){super(),this.publicKey="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.signature="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={publicKey:"public-key",signature:"signature"}}static from_obj_for_encoding(e){return new Nr({publicKey:e["public-key"],signature:e.signature})}}class Br extends fe{constructor({message:e,stateProof:t,stateProofType:n}){super(),this.message=e,this.stateProof=t,this.stateProofType=n,this.attribute_map={message:"message",stateProof:"state-proof",stateProofType:"state-proof-type"}}static from_obj_for_encoding(e){return new Br({message:"undefined"!==typeof e.message?ur.from_obj_for_encoding(e.message):void 0,stateProof:"undefined"!==typeof e["state-proof"]?hr.from_obj_for_encoding(e["state-proof"]):void 0,stateProofType:e["state-proof-type"]})}}class Lr extends fe{constructor({currentRound:e,transactions:t,nextToken:n}){super(),this.currentRound=e,this.transactions=t,this.nextToken=n,this.attribute_map={currentRound:"current-round",transactions:"transactions",nextToken:"next-token"}}static from_obj_for_encoding(e){if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);if(!Array.isArray(e.transactions))throw new Error(`Response is missing required array field 'transactions': ${e}`);return new Lr({currentRound:e["current-round"],transactions:e.transactions.map(Ar.from_obj_for_encoding),nextToken:e["next-token"]})}}class Dr extends Ct{constructor(e,t,n,r){super(e,t),this.index=n,this.index=n;const i=a.lW.from(r).toString("base64");this.query.name=encodeURI(`b64:${i}`)}path(){return`/v2/applications/${this.index}/box`}prepare(e){return tr.from_obj_for_encoding(e)}}class Ur extends Ct{path(){return"/v2/accounts"}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}limit(e){return this.query.limit=e,this}assetID(e){return this.query["asset-id"]=e,this}nextToken(e){return this.query.next=e,this}round(e){return this.query.round=e,this}authAddr(e){return this.query["auth-addr"]=e,this}applicationID(e){return this.query["application-id"]=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}exclude(e){return this.query.exclude=e,this}}class jr extends Ct{path(){return"/v2/transactions"}notePrefix(e){return this.query["note-prefix"]=bn(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}assetID(e){return this.query["asset-id"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e,this}afterTime(e){return this.query["after-time"]=e,this}addressRole(e){return this.query["address-role"]=e,this}address(e){return this.query.address=e,this}excludeCloseTo(e){return this.query["exclude-close-to"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}applicationID(e){return this.query["application-id"]=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}}class Fr extends Ct{path(){return"/v2/assets"}limit(e){return this.query.limit=e,this}creator(e){return this.query.creator=e,this}name(e){return this.query.name=e,this}unit(e){return this.query.unit=e,this}index(e){return this.query["asset-id"]=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}}class Vr extends Ct{path(){return"/v2/applications"}index(e){return this.query["application-id"]=e,this}creator(e){return this.query.creator=e,this}nextToken(e){return this.query.next=e,this}limit(e){return this.query.limit=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}}class qr extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/applications/${this.index}/boxes`}nextToken(e){return this.query.next=e,this}limit(e){return this.query.limit=e,this}prepare(e){return rr.from_obj_for_encoding(e)}}class zr extends le{constructor(e,t="http://127.0.0.1",n=8080,r={}){super("X-Indexer-API-Token",e,t,n,r)}makeHealthCheck(){return new gn(this.c,this.intDecoding)}lookupAssetBalances(e){return new mn(this.c,this.intDecoding,e)}lookupAssetTransactions(e){return new vn(this.c,this.intDecoding,e)}lookupAccountTransactions(e){return new yn(this.c,this.intDecoding,e)}lookupBlock(e){return new wn(this.c,this.intDecoding,e)}lookupTransactionByID(e){return new xn(this.c,this.intDecoding,e)}lookupAccountByID(e){return new Sn(this.c,this.intDecoding,e)}lookupAccountAssets(e){return new An(this.c,this.intDecoding,e)}lookupAccountCreatedAssets(e){return new En(this.c,this.intDecoding,e)}lookupAccountAppLocalStates(e){return new _n(this.c,this.intDecoding,e)}lookupAccountCreatedApplications(e){return new Cn(this.c,this.intDecoding,e)}lookupAssetByID(e){return new In(this.c,this.intDecoding,e)}lookupApplications(e){return new kn(this.c,this.intDecoding,e)}lookupApplicationLogs(e){return new Tn(this.c,this.intDecoding,e)}searchAccounts(){return new Ur(this.c,this.intDecoding)}searchForTransactions(){return new jr(this.c,this.intDecoding)}searchForAssets(){return new Fr(this.c,this.intDecoding)}searchForApplications(){return new Vr(this.c,this.intDecoding)}searchForApplicationBoxes(e){return new qr(this.c,this.intDecoding,e)}lookupApplicationBoxByIDandName(e,t){return new Dr(this.c,this.intDecoding,e,t)}}async function Hr(e,t,n){const r=await e.status().do();if("undefined"===typeof r)throw new Error("Unable to get node status");const i=r["last-round"]+1;let o=i;for(;o=11&&(t.push(2047&n),n>>=11,r-=11)})),r&&t.push(n),t}function Jr(e){return e.map((e=>Kr[e]))}function Qr(e){return Jr(Yr(y(e)))[0]}function $r(e){if(32!==e.length)throw new RangeError("Seed length must be 32");const t=Jr(Yr(e)),n=Qr(e);return`${t.join(" ")} ${n}`}function ei(e){const t=e.split(" "),n=t.slice(0,24);for(const o of n)if(-1===Kr.indexOf(o))throw new Error("the mnemonic contains a word that is not in the wordlist");const r=t[t.length-1];let i=function(e){const t=[];let n=0,r=0;return e.forEach((function(e){for(n|=e<=8;)t.push(255&n),n>>=8,r-=8})),r&&t.push(n),new Uint8Array(t)}(n.map((e=>Kr.indexOf(e))));if(33!==i.length)throw new Error(Xr);if(0!==i[i.length-1])throw new Error(Xr);i=i.slice(0,i.length-1);if(Qr(i)===r)return i;throw new Error(Xr)}function ti(e){const t=w(ei(e));return{addr:L(t.publicKey),sk:t.secretKey}}function ni(e){return $r(e.slice(0,32))}function ri(e){return ei(e)}function ii(e){return $r(e)}class oi{constructor(e){if(this.name="Transaction group",this.tag=a.lW.from("TG"),e.length>16){const t=`${e.length.toString()} transactions grouped together but max group size is ${16..toString()}`;throw Error(t)}this.txGroupHashes=e}get_obj_for_encoding(){return{txlist:this.txGroupHashes}}static from_obj_for_encoding(e){const t=Object.create(this.prototype);t.name="Transaction group",t.tag=a.lW.from("TG"),t.txGroupHashes=[];for(const n of e.txlist)t.txGroupHashes.push(a.lW.from(n));return t}toByte(){return q(this.get_obj_for_encoding())}}function si(e){const t=[];for(const o of e){const e=ee(o);t.push(e.rawTxID())}const n=new oi(t),r=n.toByte(),i=y(a.lW.from(b(n.tag,r)));return a.lW.from(i)}function ai(e,t){const n=si(e),r=[];for(const i of e){const e=ee(i);t&&L(e.from.publicKey)!==t||(e.group=n,r.push(e))}return r}const ci="Cannot merge txs. Multisig preimages differ",ui="Cannot mutate a multisig field as it would invalidate all existing signatures.";function li(e,{version:t,threshold:n,addrs:r}){const i=r.map((e=>N(e).publicKey)),o={v:t,thr:n,subsig:i.map((e=>({pk:a.lW.from(e)})))},s=e.get_obj_for_encoding(),c={msig:o,txn:s},u=D({version:t,threshold:n,pks:i});return L(s.snd)!==L(u)&&(c.sgnr=a.lW.from(u)),new Uint8Array(q(c))}function di(e,{rawSig:t,myPk:n},{version:r,threshold:i,pks:o}){const s=z(li(e,{version:r,threshold:i,addrs:o.map((e=>L(e)))}));let c=!1;if(s.msig.subsig.forEach(((e,r)=>{E(e.pk,n)&&(c=!0,s.msig.subsig[r].s=t)})),!1===c)throw new Error("Key does not exist");const u=D({version:r,threshold:i,pks:o});return L(s.txn.snd)!==L(u)&&(s.sgnr=a.lW.from(u)),new Uint8Array(q(s))}class fi extends X{addLease(){throw new Error(ui)}addRekey(){throw new Error(ui)}signTxn(e){throw new Error("Cannot sign a multisig transaction using `signTxn`. Use `partialSignTxn` instead.")}partialSignTxn({version:e,threshold:t,pks:n},r){const i=S(r).publicKey;return di(this,{rawSig:this.rawSignTxn(r),myPk:i},{version:e,threshold:t,pks:n})}partialSignWithMultisigSignature(e,t,n){if(!x(n.length))throw new Error("Cannot add multisig signature. Signature is not of the correct length.");return di(this,{rawSig:n,myPk:N(t).publicKey},e)}static from_obj_for_encoding(e){return super.from_obj_for_encoding(e)}}function hi(e){if(e.length<2)throw new Error("Not enough multisig transactions to merge. Need at least two");const t=z(e[0]),n=fi.from_obj_for_encoding(t.txn).txID(),r=t.sgnr?L(t.sgnr):void 0,i=L(D({version:t.msig.v,threshold:t.msig.thr,pks:t.msig.subsig.map((e=>e.pk))})),o=t.msig.subsig.map((e=>({...e})));for(let c=1;ce.pk))})))throw new Error(ci);s.msig.subsig.forEach(((e,t)=>{if(!e.s)return;const n=o[t];if(n.s&&0!==a.lW.compare(a.lW.from(e.s),a.lW.from(n.s)))throw new Error("Cannot merge txs. subsigs are mismatched.");n.s=e.s}))}const s={msig:{v:t.msig.v,thr:t.msig.thr,subsig:o},txn:t.txn};return"undefined"!==typeof r&&(s.sgnr=a.lW.from(N(r).publicKey)),new Uint8Array(q(s))}function pi(e,t,n){const r=t.v,i=t.thr,o=t.subsig,s=o.map((e=>e.pk));if(t.subsig.lengthN(e).publicKey));let a,c;return e instanceof X?(a=e,c=fi.prototype.partialSignTxn.call(a,{version:t,threshold:n,pks:s},i)):(a=new fi(e),c=a.partialSignTxn({version:t,threshold:n,pks:s},i)),{txID:a.txID().toString(),blob:c}}function mi(e,{version:t,threshold:n,addrs:r},i){const o=r.map((e=>N(e).publicKey)),s=z(e),a=fi.from_obj_for_encoding(s.txn),c=a.partialSignTxn({version:t,threshold:n,pks:o},i);return{txID:a.txID().toString(),blob:hi([e,c])}}function bi(e,{version:t,threshold:n,addrs:r},i,o){const s=r.map((e=>N(e).publicKey)),a=z(e),c=fi.from_obj_for_encoding(a.txn),u=c.partialSignWithMultisigSignature({version:t,threshold:n,pks:s},i,o);return{txID:c.txID().toString(),blob:hi([e,u])}}function yi({version:e,threshold:t,addrs:n}){return U({version:e,threshold:t,addrs:n})}function vi(e){if(!e||0===e.length)throw new Error("empty program");const t="\n".charCodeAt(0),n=" ".charCodeAt(0),r="~".charCodeAt(0);if(e.every((e=>e===t||(e=>n<=e&&e<=r)(e)))){const t=a.lW.from(e).toString();if(B(t))throw new Error("requesting program bytes, get Algorand address");if(a.lW.from(t,"base64").toString("base64")===t)throw new Error("program should not be b64 encoded");throw new Error("program bytes are all ASCII printable characters, not looking like Teal byte code")}}class wi{constructor(e,t){if(this.tag=a.lW.from("Program"),t&&(!Array.isArray(t)||!t.every((e=>e.constructor===Uint8Array||a.lW.isBuffer(e)))))throw new TypeError("Invalid arguments");let n;null!=t&&(n=t.map((e=>new Uint8Array(e)))),vi(e),this.logic=e,this.args=n,this.sig=void 0,this.msig=void 0}get_obj_for_encoding(){const e={l:this.logic};return this.args&&(e.arg=this.args),this.sig?e.sig=this.sig:this.msig&&(e.msig=this.msig),e}static from_obj_for_encoding(e){const t=new wi(e.l,e.arg);return t.sig=e.sig,t.msig=e.msig,t}verify(e){if(this.sig&&this.msig)return!1;try{vi(this.logic)}catch(n){return!1}const t=b(this.tag,this.logic);if(!this.sig&&!this.msig){return m(y(t),e)}return this.sig?_(t,this.sig,e):pi(t,this.msig,e)}address(){const e=y(b(this.tag,this.logic));return L(new Uint8Array(e))}sign(e,t){if(null==t)this.sig=this.signProgram(e);else{const n=t.addrs.map((e=>({pk:N(e).publicKey})));this.msig={v:t.version,thr:t.threshold,subsig:n};const[r,i]=this.singleSignMultisig(e,this.msig);this.msig.subsig[i].s=r}}appendToMultisig(e){if(void 0===this.msig)throw new Error("no multisig present");const[t,n]=this.singleSignMultisig(e,this.msig);this.msig.subsig[n].s=t}signProgram(e){return A(b(this.tag,this.logic),e)}singleSignMultisig(e,t){let n=-1;const r=S(e).publicKey;for(let i=0;ie.pk))}))}return this.lsig.address()}signMultisig(e,t){this.lsig.sign(t,e)}appendToMultisig(e){this.lsig.appendToMultisig(e)}sign(e){this.lsig.sign(e),this.sigkey=S(e).publicKey}}function Si(e,t){let n,r;if(t instanceof xi)n=t.lsig,r=N(t.address()).publicKey;else if(n=t,n.sig)r=e.from.publicKey;else if(n.msig){r=D({version:n.msig.v,threshold:n.msig.thr,pks:n.msig.subsig.map((e=>e.pk))})}else r=N(n.address()).publicKey;return function(e,t,n){if(!t.verify(n))throw new Error("Logic signature verification failed. Ensure the program and signature are valid.");const r={lsig:t.get_obj_for_encoding(),txn:e.get_obj_for_encoding()};return E(n,e.from.publicKey)||(r.sgnr=a.lW.from(n)),{txID:e.txID().toString(),blob:q(r)}}(e,n,r)}function Ai(e,t){return Si(ee(e),t)}function Ei(e){return wi.fromByte(e)}const _i=a.lW.from("ProgData");function Ci(e,t,n){const r=b(N(n).publicKey,t);return A(a.lW.from(b(_i,r)),e)}function Ii(e,t,n,r){const i=b(N(t).publicKey,e);return _(a.lW.from(b(_i,i)),n,r)}function ki(e,t,n){return Ci(e,t,new wi(n).address())}let Ti={},Mi={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").forEach((function(e,t){Ti[e]=t,Mi[t]=e}));class Pi{constructor({version:e,sources:t,names:n,mappings:r}){if(this.version=e,this.sources=t,this.names=n,this.mappings=r,3!==this.version)throw new Error(`Only version 3 is supported, got ${this.version}`);if(void 0===this.mappings)throw new Error("mapping undefined, cannot build source map without `mapping`");const i=this.mappings.split(";").map((e=>{const t=function(e){let t=[],n=0,r=0;for(let i=0;i>>=1,e?t.push(0===r?-2147483648:-r):t.push(r),r=n=0}}return t}(e);if(t.length>2)return t[2]}));this.pcToLine={},this.lineToPc={};let o=0;for(const[s,a]of i.entries())void 0!==a&&(o+=a),o in this.lineToPc||(this.lineToPc[o]=[]),this.lineToPc[o].push(s),this.pcToLine[s]=o}getLineForPc(e){return this.pcToLine[e]}getPcsForLine(e){return this.lineToPc[e]}}function Oi(e){return e.params["approval-program"]=a.lW.from(e.params["approval-program"].toString(),"base64"),e.params["clear-state-program"]=a.lW.from(e.params["clear-state-program"].toString(),"base64"),e}async function Ri({client:e,txns:t,protocolVersion:n,latestTimestamp:r,round:i,sources:o}){const s=[],a=[],c=[],u=[],l=[];for(const p of t)p.txn.type===W.appl&&(l.push(L(p.txn.from.publicKey)),p.txn.appAccounts&&l.push(...p.txn.appAccounts.map((e=>L(e.publicKey)))),p.txn.appForeignApps&&(c.push(...p.txn.appForeignApps),l.push(...p.txn.appForeignApps.map((e=>j(e))))),p.txn.appForeignAssets&&u.push(...p.txn.appForeignAssets),void 0===p.txn.appIndex||0===p.txn.appIndex?s.push(new ye({id:1380011588,params:new Ae({creator:L(p.txn.from.publicKey),approvalProgram:p.txn.appApprovalProgram,clearStateProgram:p.txn.appClearProgram,localStateSchema:new _e({numUint:p.txn.appLocalInts,numByteSlice:p.txn.appLocalByteSlices}),globalStateSchema:new _e({numUint:p.txn.appGlobalInts,numByteSlice:p.txn.appGlobalByteSlices})})})):(c.push(p.txn.appIndex),l.push(j(p.txn.appIndex))));const d=[];for(const p of[...new Set(u)])d.push(e.getAssetByID(p).do().then((e=>{l.push(e.params.creator)})));await Promise.all(d);const f=[];for(const p of[...new Set(c)])f.push(e.getApplicationByID(p).do().then((e=>{const t=Oi(e);s.push(t),l.push(t.params.creator)})));await Promise.all(f);const h=[];for(const p of[...new Set(l)])h.push(e.accountInformation(p).do().then((e=>{"created-apps"in e&&(e["created-apps"]=e["created-apps"].map((e=>Oi(e)))),a.push(e)})));return await Promise.all(h),new qe({txns:t.map((e=>({...e,txn:e.txn.get_obj_for_encoding()}))),accounts:a,apps:s,latestTimestamp:r,round:i,protocolVersion:n,sources:o})}class Ni{constructor(e){this.type=0,this.bytes="",this.uint=0,this.type=e.type,this.bytes=e.bytes,this.uint=e.uint}toString(){return 1===this.type?`0x${a.lW.from(this.bytes,"base64").toString("hex")}`:this.uint.toString()}}class Bi{constructor(e){this.error="",this.line=0,this.pc=0,this.scratch=[],this.stack=[],this.error=void 0===e.error?"":e.error,this.line=e.line,this.pc=e.pc,this.scratch=e.scratch,this.stack=e.stack.map((e=>new Ni(e)))}}class Li{constructor(e){this.trace=[],null!=e&&(this.trace=e.map((e=>new Bi(e))))}}function Di(e,t){return e.length>t&&t>0?`${e.slice(0,t)}...`:e}function Ui(e,t){if(0===t.length)return"";let n=null;for(let i=0;ie.length||JSON.stringify(e[i])!==JSON.stringify(t[i]))&&(n=i);if(null==n)return"";const r=t[n];return r.bytes.length>0?`${n} = 0x${a.lW.from(r.bytes,"base64").toString("hex")}`:`${n} = ${r.uint.toString()}`}function ji(e,t){return`[${(t?e.reverse():e).map((e=>{switch(e.type){case 1:return`0x${a.lW.from(e.bytes,"base64").toString("hex")}`;case 2:return`${e.uint.toString()}`;default:return""}})).join(", ")}]`}class Fi{constructor(e){this.disassembly=[],this.appCallMessages=[],this.localDeltas=[],this.globalDelta=[],this.cost=0,this.logicSigMessages=[],this.logicSigDisassembly=[],this.logs=[],this.appCallTrace=void 0,this.logicSigTrace=void 0,this.required=["disassembly"],this.optionals=["app-call-messages","local-deltas","global-delta","cost","logic-sig-messages","logic-sig-disassembly","logs"],this.traces=["app-call-trace","logic-sig-trace"],this.disassembly=e.disassembly,this.appCallMessages=e["app-call-messages"],this.localDeltas=e["local-deltas"],this.globalDelta=e["global-delta"],this.cost=e.cost,this.logicSigMessages=e["logic-sig-messages"],this.logicSigDisassembly=e["logic-sig-disassembly"],this.logs=e.logs,this.appCallTrace=new Li(e["app-call-trace"]),this.logicSigTrace=new Li(e["logic-sig-trace"])}appCallRejected(){return void 0!==this.appCallMessages&&this.appCallMessages.includes("REJECT")}logicSigRejected(){return void 0!==this.logicSigMessages&&this.logicSigMessages.includes("REJECT")}static trace(e,t,n){const r=n.maxValueWidth||30,i=[["pc#","ln#","source","scratch","stack"]];for(let s=0;s0&&void 0!==e.trace[s-1].scratch?e.trace[s-1].scratch:[],h=""===a?t[o]:`!! ${a} !!`;i.push([c.toString().padEnd(3," "),o.toString().padEnd(3," "),Di(h,r),Di(Ui(f,d),r),Di(ji(l,n.topOfStackFirst),r)])}const o=i.reduce(((e,t)=>{const n=new Array(i[0].length).fill(0);for(let r=0;re[r]?t[r].length:e[r];return n}),new Array(i[0].length).fill(0));return`${i.map((e=>e.map(((e,t)=>e.padEnd(o[t]+1," "))).join("|").trim())).join("\n")}\n`}appTrace(e){if(void 0===this.appCallTrace||!this.disassembly)return"";let t=e;return void 0===e&&(t={maxValueWidth:30,topOfStackFirst:!1}),Fi.trace(this.appCallTrace,this.disassembly,t)}lsigTrace(e){if(void 0===this.logicSigTrace||void 0===this.logicSigDisassembly)return"";let t=e;return void 0===e&&(t={maxValueWidth:30,topOfStackFirst:!0}),Fi.trace(this.logicSigTrace,this.logicSigDisassembly,t)}}class Vi{constructor(e){this.error="",this.protocolVersion="",this.txns=[],this.error=e.error,this.protocolVersion=e["protocol-version"],this.txns=e.txns.map((e=>new Fi(e)))}}function qi(e,t,n,r,i,o,s){const a={from:e,to:t,amount:n,closeRemainderTo:r,note:i,suggestedParams:o,type:W.pay,reKeyTo:s};return new X(a)}function zi(e){return qi(e.from,e.to,e.amount,e.closeRemainderTo,e.note,e.suggestedParams,e.rekeyTo)}function Hi(e,t,n,r,i,o,s,a,c,u=!1,l){const d={from:e,note:t,voteKey:n,selectionKey:r,voteFirst:i,voteLast:o,voteKeyDilution:s,suggestedParams:a,type:W.keyreg,reKeyTo:c,nonParticipation:u,stateProofKey:l};return new X(d)}function Wi(e){return Hi(e.from,e.note,e.voteKey,e.selectionKey,e.voteFirst,e.voteLast,e.voteKeyDilution,e.suggestedParams,e.rekeyTo,e.nonParticipation,e.stateProofKey)}function Gi(e,t,n,r,i,o,s,a,c,u,l,d,f,h,p){const g={from:e,note:t,suggestedParams:h,assetTotal:n,assetDecimals:r,assetDefaultFrozen:i,assetUnitName:u,assetName:l,assetURL:d,assetMetadataHash:f,assetManager:o,assetReserve:s,assetFreeze:a,assetClawback:c,type:W.acfg,reKeyTo:p};return new X(g)}function Zi(e){return Gi(e.from,e.note,e.total,e.decimals,e.defaultFrozen,e.manager,e.reserve,e.freeze,e.clawback,e.unitName,e.assetName,e.assetURL,e.assetMetadataHash,e.suggestedParams,e.rekeyTo)}function Ki(e,t,n,r,i,o,s,a,c=!0,u){if(c&&(void 0===r||void 0===i||void 0===o||void 0===s))throw Error("strict empty address checking was turned on, but at least one empty address was provided");const l={from:e,suggestedParams:a,assetIndex:n,assetManager:r,assetReserve:i,assetFreeze:o,assetClawback:s,type:W.acfg,note:t,reKeyTo:u};return new X(l)}function Xi(e){return Ki(e.from,e.note,e.assetIndex,e.manager,e.reserve,e.freeze,e.clawback,e.suggestedParams,e.strictEmptyAddressChecking,e.rekeyTo)}function Yi(e,t,n,r,i){const o={from:e,suggestedParams:r,assetIndex:n,type:W.acfg,note:t,reKeyTo:i};return new X(o)}function Ji(e){return Yi(e.from,e.note,e.assetIndex,e.suggestedParams,e.rekeyTo)}function Qi(e,t,n,r,i,o,s){const a={from:e,type:W.afrz,freezeAccount:r,assetIndex:n,freezeState:i,note:t,suggestedParams:o,reKeyTo:s};return new X(a)}function $i(e){return Qi(e.from,e.note,e.assetIndex,e.freezeTarget,e.freezeState,e.suggestedParams,e.rekeyTo)}function eo(e,t,n,r,i,o,s,a,c){const u={type:W.axfer,from:e,to:t,amount:i,suggestedParams:a,assetIndex:s,note:o,assetRevocationTarget:r,closeRemainderTo:n,reKeyTo:c};return new X(u)}function to(e){return eo(e.from,e.to,e.closeRemainderTo,e.revocationTarget,e.amount,e.note,e.assetIndex,e.suggestedParams,e.rekeyTo)}function no(e,t,n,r,i,o,s,a,c,u,l,d,f,h,p,g,m,b){const y={type:W.appl,from:e,suggestedParams:t,appIndex:0,appOnComplete:n,appLocalInts:o,appLocalByteSlices:s,appGlobalInts:a,appGlobalByteSlices:c,appApprovalProgram:r,appClearProgram:i,appArgs:u,appAccounts:l,appForeignApps:d,appForeignAssets:f,boxes:b,note:h,lease:p,reKeyTo:g,extraPages:m};return new X(y)}function ro(e){return no(e.from,e.suggestedParams,e.onComplete,e.approvalProgram,e.clearProgram,e.numLocalInts,e.numLocalByteSlices,e.numGlobalInts,e.numGlobalByteSlices,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.extraPages,e.boxes)}function io(e,t,n,r,i,o,s,a,c,u,l,d,f){const h={type:W.appl,from:e,suggestedParams:t,appIndex:n,appApprovalProgram:r,appOnComplete:G.UpdateApplicationOC,appClearProgram:i,appArgs:o,appAccounts:s,appForeignApps:a,appForeignAssets:c,boxes:f,note:u,lease:l,reKeyTo:d};return new X(h)}function oo(e){return io(e.from,e.suggestedParams,e.appIndex,e.approvalProgram,e.clearProgram,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function so(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.DeleteApplicationOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function ao(e){return so(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function co(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.OptInOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function uo(e){return co(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function lo(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.CloseOutOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function fo(e){return lo(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function ho(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.ClearStateOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function po(e){return ho(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function go(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.NoOpOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function mo(e){return go(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function bo(e){const t={type:W.appl,from:e.from,suggestedParams:e.suggestedParams,appIndex:e.appIndex,appOnComplete:e.onComplete,appLocalInts:e.numLocalInts,appLocalByteSlices:e.numLocalByteSlices,appGlobalInts:e.numGlobalInts,appGlobalByteSlices:e.numGlobalByteSlices,appApprovalProgram:e.approvalProgram,appClearProgram:e.clearProgram,appArgs:e.appArgs,appAccounts:e.accounts,appForeignApps:e.foreignApps,appForeignAssets:e.foreignAssets,boxes:e.boxes,note:e.note,lease:e.lease,reKeyTo:e.rekeyTo,extraPages:e.extraPages};return new X(t)}function yo(e){return(t,n)=>{const r=[];for(const i of n)r.push(t[i].signTxn(e.sk));return Promise.resolve(r)}}function vo(e){return(t,n)=>{const r=[];for(const i of n){const{blob:n}=Si(t[i],e);r.push(n)}return Promise.resolve(r)}}function wo(e,t){return(n,r)=>{const i=[];for(const o of r){const r=n[o],s=[];for(const n of t){const{blob:t}=gi(r,e,n);s.push(t)}s.length>1?i.push(hi(s)):i.push(s[0])}return Promise.resolve(i)}}function xo(){return(e,t)=>{const n=[];for(const r of t)n.push(Y(e[r]));return Promise.resolve(n)}}function So(e){return"object"===typeof e&&2===Object.keys(e).length&&"object"===typeof e.txn&&"function"===typeof e.signer}const Ao=65535,Eo=32,_o=1,Co=1,Io=2,ko=/^([a-z\d[\](),]+)\[(0|[1-9][\d]*)]$/,To=/^ufixed([1-9][\d]*)x([1-9][\d]*)$/;class Mo{static from(e){if(e.endsWith("[]")){const t=Mo.from(e.slice(0,e.length-2));return new Uo(t)}if(e.endsWith("]")){const t=e.match(ko);if(3!==t.length)throw new Error(`malformed static array string: ${e}`);const n=t[2],r=parseInt(n,10);if(r>Ao)throw new Error(`array length exceeds limit ${Ao}`);const i=Mo.from(t[1]);return new Do(i,r)}if(e.startsWith("uint")){const t=e=>[...e].every((e=>"0123456789".includes(e))),n=e.slice(4,e.length);if(!t(n))throw new Error(`malformed uint string: ${n}`);const r=parseInt(n,10);if(r>Ao)throw new Error(`malformed uint string: ${r}`);return new Po(r)}if("byte"===e)return new Bo;if(e.startsWith("ufixed")){const t=e.match(To);if(3!==t.length)throw new Error(`malformed ufixed type: ${e}`);const n=parseInt(t[1],10),r=parseInt(t[2],10);return new Oo(n,r)}if("bool"===e)return new No;if("address"===e)return new Ro;if("string"===e)return new Lo;if(e.length>=2&&"("===e[0]&&")"===e[e.length-1]){const t=jo.parseTupleContent(e.slice(1,e.length-1)),n=[];for(let e=0;e512)throw new Error(`unsupported uint type bitSize: ${e}`);this.bitSize=e}toString(){return`uint${this.bitSize}`}equals(e){return e instanceof Po&&this.bitSize===e.bitSize}isDynamic(){return!1}byteLen(){return this.bitSize/8}encode(e){if("bigint"!==typeof e&&"number"!==typeof e)throw new Error(`Cannot encode value as uint${this.bitSize}: ${e}`);if(e>=BigInt(2**this.bitSize)||e512)throw new Error(`unsupported ufixed type bitSize: ${e}`);if(t>160||t<1)throw new Error(`unsupported ufixed type precision: ${t}`);this.bitSize=e,this.precision=t}toString(){return`ufixed${this.bitSize}x${this.precision}`}equals(e){return e instanceof Oo&&this.bitSize===e.bitSize&&this.precision===e.precision}isDynamic(){return!1}byteLen(){return this.bitSize/8}encode(e){if("bigint"!==typeof e&&"number"!==typeof e)throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);if(e>=BigInt(2**this.bitSize)||e255)throw new Error(`${e} cannot be encoded into a byte`);return new Uint8Array([e])}decode(e){if(1!==e.byteLength)throw new Error("byte string must be 1 byte long");return e[0]}}class Lo extends Mo{toString(){return"string"}equals(e){return e instanceof Lo}isDynamic(){return!0}byteLen(){throw new Error(`${this.toString()} is a dynamic type`)}encode(e){if("string"!==typeof e&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as string: ${e}`);const t=a.lW.from(e),n=Wr(t.length,Io),r=new Uint8Array(t.length+Io);return r.set(n),r.set(t,Io),r}decode(e){if(e.length=Ao)throw new Error("tuple type child type number larger than maximum uint16 error");this.childTypes=e}toString(){const e=[];for(let t=0;tt.equals(e.childTypes[n])))}isDynamic(){return this.childTypes.some((e=>e.isDynamic()))}byteLen(){let e=0;for(let t=0;tAo)throw new Error("length of tuple array should not exceed a uint16");const n=this.childTypes,r=[],i=[],o=new Map;let s=0;for(;sAo)throw new Error(`byte length of ${e} should not exceed a uint16`);r[u]=Wr(e,Io)}c+=i[u].length}return b(...r,...i)}decode(e){const t=this.childTypes,n=[],r=[];let i=0,o=0;const s=a.lW.from(e);for(;i0&&(n[n.length-1].right=t,t>i;(e[o]&t)>0?r.push(new Uint8Array([128])):r.push(new Uint8Array([0]))}i+=n,o+=1}else{const t=a.byteLen();r.push(e.slice(o,o+t)),o+=t}if(i!==t.length-1&&o>=e.length)throw new Error("input byte not enough to decode");i+=1}if(n.length>0&&(n[n.length-1].right=e.length,o=e.length),oe.right)throw new Error("dynamic segment should display a [l, r] space with l <= r");if(a!==n.length-1&&e.right!==n[a+1].left)throw new Error("dynamic segment should be consecutive")}let c=0;for(let a=0;a8)throw new Error("value list passed in should be no greater than length 8");for(let n=0;n0&&-1===n))break;r+=1}}return r}var qo,zo;function Ho(e){return e===qo.any||e===qo.pay||e===qo.keyreg||e===qo.acfg||e===qo.axfer||e===qo.afrz||e===qo.appl}function Wo(e,t){return e===qo.any||t.type&&t.type.toString()===e.toString()}function Go(e){return e===zo.account||e===zo.application||e===zo.asset}!function(e){e.any="txn",e.pay="pay",e.keyreg="keyreg",e.acfg="acfg",e.axfer="axfer",e.afrz="afrz",e.appl="appl"}(qo||(qo={})),function(e){e.account="account",e.application="application",e.asset="asset"}(zo||(zo={}));class Zo{constructor(e){if("string"!==typeof e.name||"object"!==typeof e.returns||!Array.isArray(e.args))throw new Error("Invalid ABIMethod parameters");this.name=e.name,this.description=e.desc,this.args=e.args.map((({type:e,name:t,desc:n})=>Ho(e)||Go(e)?{type:e,name:t,description:n}:{type:Mo.from(e),name:t,description:n})),this.returns={type:"void"===e.returns.type?e.returns.type:Mo.from(e.returns.type),description:e.returns.desc}}getSignature(){const e=this.args.map((e=>e.type.toString())).join(","),t=this.returns.type.toString();return`${this.name}(${e})${t}`}getSelector(){const e=y(this.getSignature());return new Uint8Array(e.slice(0,4))}txnCount(){let e=1;for(const t of this.args)"string"===typeof t.type&&Ho(t.type)&&(e+=1);return e}toJSON(){return{name:this.name,desc:this.description,args:this.args.map((({type:e,name:t,description:n})=>({type:e.toString(),name:t,desc:n}))),returns:{type:this.returns.type.toString(),desc:this.returns.description}}}static fromSignature(e){const{name:t,args:n,returns:r}=function(e){const t=e.indexOf("(");if(-1===t)throw new Error(`Invalid method signature: ${e}`);let n=-1,r=0;for(let i=t;i({type:e}))),returns:{type:r}})}}function Ko(e,t){if(null===e||!Array.isArray(e)||!e.every((e=>e instanceof Zo)))throw new Error("Methods list provided is null or not the correct type");const n=e.filter((e=>e.name===t));if(n.length>1)throw new Error(`found ${n.length} methods with the same name ${n.map((e=>e.getSignature())).join(",")}`);if(0===n.length)throw new Error(`found 0 methods with the name ${t}`);return n[0]}class Xo{constructor(e){if("string"!==typeof e.name||!Array.isArray(e.methods)||e.networks&&"object"!==typeof e.networks)throw new Error("Invalid ABIContract parameters");this.name=e.name,this.description=e.desc,this.networks=e.networks?{...e.networks}:{},this.methods=e.methods.map((e=>new Zo(e)))}toJSON(){return{name:this.name,desc:this.description,networks:this.networks,methods:this.methods.map((e=>e.toJSON()))}}getMethodByName(e){return Ko(this.methods,e)}}class Yo{constructor(e){if("string"!==typeof e.name||!Array.isArray(e.methods))throw new Error("Invalid ABIInterface parameters");this.name=e.name,this.description=e.desc,this.methods=e.methods.map((e=>new Zo(e)))}toJSON(){return{name:this.name,desc:this.description,methods:this.methods.map((e=>e.toJSON()))}}getMethodByName(e){return Ko(this.methods,e)}}const Jo=a.lW.from([21,31,124,117]);var Qo;function $o(e,t,n){if(null!=n&&e===n)return 0;const r=null==n?0:1;for(let i=0;i({txn:X.from_obj_for_encoding({...e.get_obj_for_encoding(),grp:void 0}),signer:t}))),e.methodCalls=new Map(this.methodCalls),e}addTransaction(e){if(this.status!==Qo.BUILDING)throw new Error("Cannot add transactions when composer status is not BUILDING");if(this.transactions.length===es.MAX_GROUP_SIZE)throw new Error(`Adding an additional transaction exceeds the maximum atomic group size of ${es.MAX_GROUP_SIZE}`);if(e.txn.group&&e.txn.group.some((e=>0!==e)))throw new Error("Cannot add a transaction with nonzero group ID");this.transactions.push(e)}addMethodCall({appID:e,method:t,methodArgs:n,sender:r,suggestedParams:i,onComplete:o,approvalProgram:s,clearProgram:a,numGlobalInts:c,numGlobalByteSlices:u,numLocalInts:l,numLocalByteSlices:d,extraPages:f,appAccounts:h,appForeignApps:p,appForeignAssets:g,boxes:m,note:b,lease:y,rekeyTo:v,signer:w}){if(this.status!==Qo.BUILDING)throw new Error("Cannot add transactions when composer status is not BUILDING");if(this.transactions.length+t.txnCount()>es.MAX_GROUP_SIZE)throw new Error(`Adding additional transactions exceeds the maximum atomic group size of ${es.MAX_GROUP_SIZE}`);if(0===e){if(null==s||null==a||null==c||null==u||null==l||null==d)throw new Error("One of the following required parameters for application creation is missing: approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices")}else if(o===G.UpdateApplicationOC){if(null==s||null==a)throw new Error("One of the following required parameters for OnApplicationComplete.UpdateApplicationOC is missing: approvalProgram, clearProgram");if(null!=c||null!=u||null!=l||null!=d||null!=f)throw new Error("One of the following application creation parameters were set on a non-creation call: numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages")}else if(null!=s||null!=a||null!=c||null!=u||null!=l||null!=d||null!=f)throw new Error("One of the following application creation parameters were set on a non-creation call: approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages");if(null==n&&(n=[]),n.length!==t.args.length)throw new Error(`Incorrect number of method arguments. Expected ${t.args.length}, got ${n.length}`);let x=[],S=[];const A=[],E=[],_=[],C=new Map,I=m||[];for(let N=0;N0!==e)))throw new Error("Cannot add a transaction with nonzero group ID");A.push(r)}else{if(So(r))throw new Error(`Expected non-transaction value for argument at index ${N}`);if(Go(e)&&(C.set(E.length,x.length),E.push(e),_.push(r),e=new Po(8)),"string"===typeof e)throw new Error(`Unknown ABI type: ${e}`);x.push(e),S.push(r)}}const k=[],T=null==h?[]:h.slice(),M=null==p?[]:p.slice(),P=null==g?[]:g.slice();for(let N=0;NNumber.MAX_SAFE_INTEGER)throw new Error(`Expected safe integer for application value, got ${r}`);i=$o(Number(r),M,e);break}case zo.asset:{const e=new Po(64),t=e.decode(e.encode(n));if(t>Number.MAX_SAFE_INTEGER)throw new Error(`Expected safe integer for asset value, got ${t}`);i=$o(Number(t),P);break}default:throw new Error(`Unknown reference type: ${t}`)}k.push(i)}for(let N=0;N15){const e=x.slice(14),t=S.slice(14);x=x.slice(0,14),S=S.slice(0,14),x.push(new jo(e)),S.push(t)}const O=[t.getSelector()];for(let N=0;N1&&ai(this.transactions.map((e=>e.txn))),this.status=Qo.BUILT}return this.transactions}async gatherSignatures(){if(this.status>=Qo.SIGNED)return this.signedTxns;const e=this.buildGroup(),t=e.map((e=>e.txn)),n=new Map;for(let a=0;ae(t,n)))),o=e.map((()=>null));for(let a=0;anull!=e)))throw new Error(`Missing signatures. Got ${o}`);const s=o.map(((e,t)=>{try{return $(e).txn.txID()}catch(n){throw new Error(`Cannot decode signed transaction at index ${t}. ${n}`)}}));return this.signedTxns=o,this.txIDs=s,this.status=Qo.SIGNED,o}async submit(e){if(this.status>Qo.SUBMITTED)throw new Error("Transaction group cannot be resubmitted");const t=await this.gatherSignatures();return await e.sendRawTransaction(t).do(),this.status=Qo.SUBMITTED,this.txIDs}async simulate(e,t){if(this.status>Qo.SUBMITTED)throw new Error("Simulated Transaction group has already been submitted to the network");const n=(await this.gatherSignatures()).map((e=>z(e))),r=null==t?new at({txnGroups:[]}):t;r.txnGroups=[new ct({txns:n})];const i=await e.simulateTransactions(r).do(),o=[];for(const[s,a]of this.methodCalls){const e=this.txIDs[s],t=i.txnGroups[0].txnResults[s].txnResult,n={txID:e,rawReturnValue:new Uint8Array,method:a};o.push(es.parseMethodResponse(a,n,t.get_obj_for_encoding()))}return{methodResults:o,simulateResponse:i}}async execute(e,t){if(this.status===Qo.COMMITTED)throw new Error("Transaction group has already been executed successfully");const n=await this.submit(e);this.status=Qo.SUBMITTED;const r=this.transactions.findIndex(((e,t)=>this.methodCalls.has(t))),i=-1===r?0:r,o=await Hr(e,n[i],t);this.status=Qo.COMMITTED;const s=o["confirmed-round"],a=[];for(const[u,l]of this.methodCalls){const t=n[u];let i={txID:t,rawReturnValue:new Uint8Array,method:l};try{const n=u===r?o:await e.pendingTransactionInformation(t).do();i=es.parseMethodResponse(l,i,n)}catch(c){i.decodeError=c}a.push(i)}return{confirmedRound:s,txIDs:n,methodResults:a}}static parseMethodResponse(e,t,n){const r=t;try{if(r.txInfo=n,"void"!==e.returns.type){const i=n.logs||[];if(0===i.length)throw new Error("App call transaction did not log a return value");const o=a.lW.from(i[i.length-1],"base64");if(o.byteLength<4||!o.slice(0,4).equals(Jo))throw new Error("App call transaction did not log a return value");r.rawReturnValue=new Uint8Array(o.slice(4)),r.returnValue=e.returns.type.decode(t.rawReturnValue)}}catch(i){r.decodeError=i}return r}}es.MAX_GROUP_SIZE=16;const ts=a.lW.from([77,88]),ns="The transaction sender address and multisig preimage do not match.";function rs(e,t){if("undefined"===typeof e.from){const n=S(t);e.from=L(n.publicKey)}const n=ee(e);return{txID:n.txID().toString(),blob:n.signTxn(t)}}function is(e,t){return new te(e).signBid(t)}function os(e,t){return A(a.lW.from(b(ts,e)),t)}function ss(e,t,n){return _(a.lW.from(b(ts,e)),t,N(n).publicKey)}function as(e){return new Uint8Array(q(e))}function cs(e){return z(e)}const us=new Error(ns),ls=new Error(re);var ds=o},78688:function(e,t,n){"use strict";const r=n(79742),i=n(80645),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},9669:function(e,t,n){e.exports=n(51609)},55448:function(e,t,n){"use strict";var r=n(64867),i=n(36026),o=n(4372),s=n(15327),a=n(94097),c=n(84109),u=n(67985),l=n(77874),d=n(82648),f=n(60644),h=n(90205);e.exports=function(e){return new Promise((function(t,n){var p,g=e.data,m=e.headers,b=e.responseType;function y(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}r.isFormData(g)&&r.isStandardBrowserEnv()&&delete m["Content-Type"];var v=new XMLHttpRequest;if(e.auth){var w=e.auth.username||"",x=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";m.Authorization="Basic "+btoa(w+":"+x)}var S=a(e.baseURL,e.url);function A(){if(v){var r="getAllResponseHeaders"in v?c(v.getAllResponseHeaders()):null,o={data:b&&"text"!==b&&"json"!==b?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:r,config:e,request:v};i((function(e){t(e),y()}),(function(e){n(e),y()}),o),v=null}}if(v.open(e.method.toUpperCase(),s(S,e.params,e.paramsSerializer),!0),v.timeout=e.timeout,"onloadend"in v?v.onloadend=A:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(A)},v.onabort=function(){v&&(n(new d("Request aborted",d.ECONNABORTED,e,v)),v=null)},v.onerror=function(){n(new d("Network Error",d.ERR_NETWORK,e,v,v)),v=null},v.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new d(t,r.clarifyTimeoutError?d.ETIMEDOUT:d.ECONNABORTED,e,v)),v=null},r.isStandardBrowserEnv()){var E=(e.withCredentials||u(S))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;E&&(m[e.xsrfHeaderName]=E)}"setRequestHeader"in v&&r.forEach(m,(function(e,t){"undefined"===typeof g&&"content-type"===t.toLowerCase()?delete m[t]:v.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(v.withCredentials=!!e.withCredentials),b&&"json"!==b&&(v.responseType=e.responseType),"function"===typeof e.onDownloadProgress&&v.addEventListener("progress",e.onDownloadProgress),"function"===typeof e.onUploadProgress&&v.upload&&v.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(p=function(e){v&&(n(!e||e&&e.type?new f:e),v.abort(),v=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p))),g||(g=null);var _=h(S);_&&-1===["http","https","file"].indexOf(_)?n(new d("Unsupported protocol "+_+":",d.ERR_BAD_REQUEST,e)):v.send(g)}))}},51609:function(e,t,n){"use strict";var r=n(64867),i=n(91849),o=n(30321),s=n(47185);var a=function e(t){var n=new o(t),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(45546));a.Axios=o,a.CanceledError=n(60644),a.CancelToken=n(14972),a.isCancel=n(26502),a.VERSION=n(97288).version,a.toFormData=n(47675),a.AxiosError=n(82648),a.Cancel=a.CanceledError,a.all=function(e){return Promise.all(e)},a.spread=n(8713),a.isAxiosError=n(16268),e.exports=a,e.exports.default=a},14972:function(e,t,n){"use strict";var r=n(60644);function i(e){if("function"!==typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(e){d.headers[e]={}})),i.forEach(["post","put","patch"],(function(e){d.headers[e]=i.merge(u)})),e.exports=d},77874:function(e){"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},97288:function(e){e.exports={version:"0.27.2"}},91849:function(e){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},90205:function(e){"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},8713:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},47675:function(e,t,n){"use strict";var r=n(48764).Buffer,i=n(64867);e.exports=function(e,t){t=t||new FormData;var n=[];function o(e){return null===e?"":i.isDate(e)?e.toISOString():i.isArrayBuffer(e)||i.isTypedArray(e)?"function"===typeof Blob?new Blob([e]):r.from(e):e}return function e(r,s){if(i.isPlainObject(r)||i.isArray(r)){if(-1!==n.indexOf(r))throw Error("Circular reference detected in "+s);n.push(r),i.forEach(r,(function(n,r){if(!i.isUndefined(n)){var a,c=s?s+"."+r:r;if(n&&!s&&"object"===typeof n)if(i.endsWith(r,"{}"))n=JSON.stringify(n);else if(i.endsWith(r,"[]")&&(a=i.toArray(n)))return void a.forEach((function(e){!i.isUndefined(e)&&t.append(c,o(e))}));e(n,c)}})),n.pop()}else t.append(s,o(r))}(e),t}},54875:function(e,t,n){"use strict";var r=n(97288).version,i=n(82648),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var s={};o.transitional=function(e,t,n){function o(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new i(o(r," has been removed"+(t?" in "+t:"")),i.ERR_DEPRECATED);return t&&!s[r]&&(s[r]=!0,console.warn(o(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={assertOptions:function(e,t,n){if("object"!==typeof e)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),o=r.length;o-- >0;){var s=r[o],a=t[s];if(a){var c=e[s],u=void 0===c||a(c,s,e);if(!0!==u)throw new i("option "+s+" must be "+u,i.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new i("Unknown option "+s,i.ERR_BAD_OPTION)}},validators:o}},64867:function(e,t,n){"use strict";var r,i=n(91849),o=Object.prototype.toString,s=(r=Object.create(null),function(e){var t=o.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return s(t)===e}}function c(e){return Array.isArray(e)}function u(e){return"undefined"===typeof e}var l=a("ArrayBuffer");function d(e){return null!==e&&"object"===typeof e}function f(e){if("object"!==s(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var h=a("Date"),p=a("File"),g=a("Blob"),m=a("FileList");function b(e){return"[object Function]"===o.call(e)}var y=a("URLSearchParams");function v(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==typeof e&&(e=[e]),c(e))for(var n=0,r=e.length;n0;)s[o=r[i]]||(t[o]=e[o],s[o]=!0);e=Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:a,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;var t=e.length;if(u(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},isTypedArray:x,isFileList:m}},79742:function(e,t){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,o=c(e),s=o[0],a=o[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,d=a>0?s-4:s;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=16383,a=0,c=r-i;ac?c:a+s));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,r){for(var i,o,s=[],a=t;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},92882:function(e){"use strict";for(var t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={},r=0;r>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function s(e){for(var t=1,n=0;n126)return"Invalid prefix ("+e+")";t=o(t)^r>>5}for(t=o(t),n=0;nt)return"Exceeds length limit";var r=e.toLowerCase(),i=e.toUpperCase();if(e!==r&&e!==i)return"Mixed-case string "+e;var a=(e=r).lastIndexOf("1");if(-1===a)return"No separator character for "+e;if(0===a)return"Missing prefix for "+e;var c=e.slice(0,a),u=e.slice(a+1);if(u.length<6)return"Data too short";var l=s(c);if("string"===typeof l)return l;for(var d=[],f=0;f=u.length||d.push(p)}return 1!==l?"Invalid checksum for "+e:{prefix:c,words:d}}function c(e,t,n,r){for(var i=0,o=0,s=(1<=n;)o-=n,a.push(i>>o&s);if(r)o>0&&a.push(i<=t)return"Excess padding";if(i<r)throw new TypeError("Exceeds length limit");var i=s(e=e.toLowerCase());if("string"===typeof i)throw new Error(i);for(var a=e+"1",c=0;c>5!==0)throw new Error("Non 5-bit word");i=o(i)^u,a+=t.charAt(u)}for(c=0;c<6;++c)i=o(i);for(i^=1,c=0;c<6;++c){a+=t.charAt(i>>5*(5-c)&31)}return a},toWordsUnsafe:function(e){var t=c(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=c(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=c(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=c(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}}},44431:function(e,t,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",d=1e14,f=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,m=1e9;function b(e){var t=0|e;return e>0||e===t?t:t-1}function y(e){for(var t,n,r=1,i=e.length,o=e[0]+"";ru^n?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^n?1:-1;return c==u?0:c>u^n?1:-1}function w(e,t,n,r){if(en||e!==c(e))throw Error(u+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function x(e){var t=e.c.length-1;return b(e.e/f)==t&&e.c[t]%2!=0}function S(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function A(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else tM?b.c=b.e=null:e.e=10;d/=10,u++);return void(u>M?b.c=b.e=null:(b.e=u,b.c=[e]))}m=String(e)}else{if(!s.test(m=String(e)))return i(b,m,p);b.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(d=m.search(/e/i))>0?(u<0&&(u=d),u+=+m.slice(d+1),m=m.substring(0,d)):u<0&&(u=m.length)}else{if(w(t,2,B.length,"Base"),10==t&&L)return V(b=new D(e),_+b.e+1,C);if(m=String(e),p="number"==typeof e){if(0*e!=0)return i(b,m,p,t);if(b.s=1/e<0?(m=m.slice(1),-1):1,D.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else b.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(n=B.slice(0,t),u=d=0,g=m.length;du){u=g;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,d=-1,u=0;continue}return i(b,String(e),p,t)}p=!1,(u=(m=r(m,t,10,b.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(d=0;48===m.charCodeAt(d);d++);for(g=m.length;48===m.charCodeAt(--g););if(m=m.slice(d,++g)){if(g-=d,p&&D.DEBUG&&g>15&&(e>h||e!==c(e)))throw Error(l+b.s*e);if((u=u-d-1)>M)b.c=b.e=null;else if(u=k)?S(c,s):A(c,s,"0");else if(o=(e=V(new D(e),t,n)).e,a=(c=y(e.c)).length,1==r||2==r&&(t<=o||o<=I)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function j(e,t){for(var n,r=1,i=new D(e[0]);r=10;i/=10,r++);return(n=r+n*f-1)>M?e.c=e.e=null:n=10;u/=10,i++);if((o=t-i)<0)o+=f,s=t,g=(l=m[h=0])/b[i-s-1]%10|0;else if((h=a((o+1)/f))>=m.length){if(!r)break e;for(;m.length<=h;m.push(0));l=g=0,i=1,s=(o%=f)-f+1}else{for(l=u=m[h],i=1;u>=10;u/=10,i++);g=(s=(o%=f)-f+i)<0?0:l/b[i-s-1]%10|0}if(r=r||t<0||null!=m[h+1]||(s<0?l:l%b[i-s-1]),r=n<4?(g||r)&&(0==n||n==(e.s<0?3:2)):g>5||5==g&&(4==n||r||6==n&&(o>0?s>0?l/b[i-s]:0:m[h-1])%10&1||n==(e.s<0?8:7)),t<1||!m[0])return m.length=0,r?(t-=e.e+1,m[0]=b[(f-t%f)%f],e.e=-t||0):m[0]=e.e=0,e;if(0==o?(m.length=h,u=1,h--):(m.length=h+1,u=b[f-o],m[h]=s>0?c(l/b[i-s]%b[s])*u:0),r)for(;;){if(0==h){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,m[0]==d&&(m[0]=1));break}if(m[h]+=u,m[h]!=d)break;m[h--]=0,u=1}for(o=m.length;0===m[--o];m.pop());}e.e>M?e.c=e.e=null:e.e=k?S(t,n):A(t,n,"0"),e.s<0?"-"+t:t)}return D.clone=e,D.ROUND_UP=0,D.ROUND_DOWN=1,D.ROUND_CEIL=2,D.ROUND_FLOOR=3,D.ROUND_HALF_UP=4,D.ROUND_HALF_DOWN=5,D.ROUND_HALF_EVEN=6,D.ROUND_HALF_CEIL=7,D.ROUND_HALF_FLOOR=8,D.EUCLID=9,D.config=D.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(w(n=e[t],0,m,t),_=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(n=e[t],0,8,t),C=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(w(n[0],-m,0,t),w(n[1],0,m,t),I=n[0],k=n[1]):(w(n,-m,m,t),I=-(k=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)w(n[0],-m,-1,t),w(n[1],1,m,t),T=n[0],M=n[1];else{if(w(n,-m,m,t),!n)throw Error(u+t+" cannot be zero: "+n);T=-(M=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(u+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!n,Error(u+"crypto unavailable");P=n}else P=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(w(n=e[t],0,9,t),O=n),e.hasOwnProperty(t="POW_PRECISION")&&(w(n=e[t],0,m,t),R=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(u+t+" not an object: "+n);N=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(u+t+" invalid: "+n);L="0123456789"==n.slice(0,10),B=n}}return{DECIMAL_PLACES:_,ROUNDING_MODE:C,EXPONENTIAL_AT:[I,k],RANGE:[T,M],CRYPTO:P,MODULO_MODE:O,POW_PRECISION:R,FORMAT:N,ALPHABET:B}},D.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!D.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-m&&i<=m&&i===c(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%f)<1&&(t+=f),String(r[0]).length==t){for(t=0;t=d||n!==c(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+e)},D.maximum=D.max=function(){return j(arguments,o.lt)},D.minimum=D.min=function(){return j(arguments,o.gt)},D.random=function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return c(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var n,r,i,o,s,l=0,d=[],h=new D(E);if(null==e?e=_:w(e,0,m),o=a(e/f),P)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(o*=2));l>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(d.push(s%1e14),l+=2);l=o/2}else{if(!crypto.randomBytes)throw P=!1,Error(u+"crypto unavailable");for(n=crypto.randomBytes(o*=7);l=9e15?crypto.randomBytes(7).copy(n,l):(d.push(s%1e14),l+=7);l=o/7}if(!P)for(;l=10;s/=10,l++);ln-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var c,u,l,d,f,h,p,g,m=r.indexOf("."),b=_,v=C;for(m>=0&&(d=R,R=0,r=r.replace(".",""),h=(g=new D(i)).pow(r.length-m),R=d,g.c=t(A(y(h.c),h.e,"0"),10,o,e),g.e=g.c.length),l=d=(p=t(r,i,o,a?(c=B,e):(c=e,B))).length;0==p[--d];p.pop());if(!p[0])return c.charAt(0);if(m<0?--l:(h.c=p,h.e=l,h.s=s,p=(h=n(h,g,b,v,o)).c,f=h.r,l=h.e),m=p[u=l+b+1],d=o/2,f=f||u<0||null!=p[u+1],f=v<4?(null!=m||f)&&(0==v||v==(h.s<0?3:2)):m>d||m==d&&(4==v||f||6==v&&1&p[u-1]||v==(h.s<0?8:7)),u<1||!p[0])r=f?A(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(p.length=u,f)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(d=p.length;!p[--d];);for(m=0,r="";m<=d;r+=c.charAt(p[m++]));r=A(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,i,o,s,a=0,c=e.length,u=t%g,l=t/g|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%g)+(r=l*o+(s=e[c]/g|0)*u)%g*g+a)/n|0)+(r/g|0)+l*s,e[c]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,o,s,a){var u,l,h,p,g,m,y,v,w,x,S,A,E,_,C,I,k,T=r.s==i.s?1:-1,M=r.c,P=i.c;if(!M||!M[0]||!P||!P[0])return new D(r.s&&i.s&&(M?!P||M[0]!=P[0]:P)?M&&0==M[0]||!P?0*T:T/0:NaN);for(w=(v=new D(T)).c=[],T=o+(l=r.e-i.e)+1,a||(a=d,l=b(r.e/f)-b(i.e/f),T=T/f|0),h=0;P[h]==(M[h]||0);h++);if(P[h]>(M[h]||0)&&l--,T<0)w.push(1),p=!0;else{for(_=M.length,I=P.length,h=0,T+=2,(g=c(a/(P[0]+1)))>1&&(P=e(P,g,a),M=e(M,g,a),I=P.length,_=M.length),E=I,S=(x=M.slice(0,I)).length;S=a/2&&C++;do{if(g=0,(u=t(P,x,I,S))<0){if(A=x[0],I!=S&&(A=A*a+(x[1]||0)),(g=c(A/C))>1)for(g>=a&&(g=a-1),y=(m=e(P,g,a)).length,S=x.length;1==t(m,x,y,S);)g--,n(m,I=10;T/=10,h++);V(v,o+(v.e=h+l*f-1)+1,s,p)}else v.e=l,v.r=+p;return v}}(),i=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,a,c){var l,d=a?s:s.replace(i,"");if(r.test(d))o.s=isNaN(d)?null:d<0?-1:1;else{if(!a&&(d=d.replace(e,(function(e,t,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=l?e:t})),c&&(l=c,d=d.replace(t,"$1").replace(n,"0.$1")),s!=d))return new D(d,l);if(D.DEBUG)throw Error(u+"Not a"+(c?" base "+c:"")+" number: "+s);o.s=null}o.c=o.e=null}}(),o.absoluteValue=o.abs=function(){var e=new D(this);return e.s<0&&(e.s=1),e},o.comparedTo=function(e,t){return v(this,new D(e,t))},o.decimalPlaces=o.dp=function(e,t){var n,r,i,o=this;if(null!=e)return w(e,0,m),null==t?t=C:w(t,0,8),V(new D(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-b(this.e/f))*f,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},o.dividedBy=o.div=function(e,t){return n(this,new D(e,t),_,C)},o.dividedToIntegerBy=o.idiv=function(e,t){return n(this,new D(e,t),0,1)},o.exponentiatedBy=o.pow=function(e,t){var n,r,i,o,s,l,d,h,p=this;if((e=new D(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+q(e));if(null!=t&&(t=new D(t)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new D(Math.pow(+q(p),s?2-x(e):+q(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new D(NaN);(r=!l&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&x(e)?-0:0,p.e>-1&&(o=1/o),new D(l?1/o:o);R&&(o=a(R/f+2))}for(s?(n=new D(.5),l&&(e.s=1),d=x(e)):d=(i=Math.abs(+q(e)))%2,h=new D(E);;){if(d){if(!(h=h.times(p)).c)break;o?h.c.length>o&&(h.c.length=o):r&&(h=h.mod(t))}if(i){if(0===(i=c(i/2)))break;d=i%2}else if(V(e=e.times(n),e.e+1,1),e.e>14)d=x(e);else{if(0===(i=+q(e)))break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?h:(l&&(h=E.div(h)),t?h.mod(t):o?V(h,R,C,undefined):h)},o.integerValue=function(e){var t=new D(this);return null==e?e=C:w(e,0,8),V(t,t.e+1,e)},o.isEqualTo=o.eq=function(e,t){return 0===v(this,new D(e,t))},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(e,t){return v(this,new D(e,t))>0},o.isGreaterThanOrEqualTo=o.gte=function(e,t){return 1===(t=v(this,new D(e,t)))||0===t},o.isInteger=function(){return!!this.c&&b(this.e/f)>this.c.length-2},o.isLessThan=o.lt=function(e,t){return v(this,new D(e,t))<0},o.isLessThanOrEqualTo=o.lte=function(e,t){return-1===(t=v(this,new D(e,t)))||0===t},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&&0==this.c[0]},o.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(t=(e=new D(e,t)).s,!a||!t)return new D(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/f,u=e.e/f,l=s.c,h=e.c;if(!c||!u){if(!l||!h)return l?(e.s=-t,e):new D(h?s:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new D(l[0]?s:3==C?-0:0)}if(c=b(c),u=b(u),l=l.slice(),a=c-u){for((o=a<0)?(a=-a,i=l):(u=c,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=l.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;l[n++]=0);for(t=d-1;r>a;){if(l[--r]=0;){for(n=0,p=A[i]%w,m=A[i]/w|0,o=i+(s=c);o>i;)n=((u=p*(u=S[--s]%w)+(a=m*u+(l=S[s]/w|0)*p)%w*w+y[o]+n)/v|0)+(a/w|0)+m*l,y[o--]=u%v;y[o]=n}return n?++r:y.splice(0,1),F(e,y,r)},o.negated=function(){var e=new D(this);return e.s=-e.s||null,e},o.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new D(e,t)).s,!i||!t)return new D(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/f,s=e.e/f,a=r.c,c=e.c;if(!o||!s){if(!a||!c)return new D(i/0);if(!a[0]||!c[0])return c[0]?e:new D(a[0]?r:0*i)}if(o=b(o),s=b(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=c):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(t=c.length)<0&&(n=c,c=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/d|0,a[t]=d===a[t]?0:a[t]%d;return i&&(a=[i].concat(a),++s),F(e,a,s)},o.precision=o.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return w(e,1,m),null==t?t=C:w(t,0,8),V(new D(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*f+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},o.shiftedBy=function(e){return w(e,-9007199254740991,h),this.times("1e"+e)},o.squareRoot=o.sqrt=function(){var e,t,r,i,o,s=this,a=s.c,c=s.s,u=s.e,l=_+4,d=new D("0.5");if(1!==c||!a||!a[0])return new D(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+q(s)))||c==1/0?(((t=y(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=b((u+1)/2)-(u<0||u%2),r=new D(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new D(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(o=r,r=d.times(o.plus(n(s,o,l,1))),y(o.c).slice(0,c)===(t=y(r.c)).slice(0,c)){if(r.e0&&g>0){for(o=g%a||a,d=p.substr(0,o);o0&&(d+=l+p.slice(o)),h&&(d="-"+d)}r=f?d+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):d}return(n.prefix||"")+r+(n.suffix||"")},o.toFraction=function(e){var t,r,i,o,s,a,c,l,d,h,g,m,b=this,v=b.c;if(null!=e&&(!(c=new D(e)).isInteger()&&(c.c||1!==c.s)||c.lt(E)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+q(c));if(!v)return new D(b);for(t=new D(E),d=r=new D(E),i=l=new D(E),m=y(v),s=t.e=m.length-b.e-1,t.c[0]=p[(a=s%f)<0?f+a:a],e=!e||c.comparedTo(t)>0?s>0?t:d:c,a=M,M=1/0,c=new D(m),l.c[0]=0;h=n(c,t,0,1),1!=(o=r.plus(h.times(i))).comparedTo(e);)r=i,i=o,d=l.plus(h.times(o=d)),l=o,t=c.minus(h.times(o=t)),c=o;return o=n(e.minus(r),i,0,1),l=l.plus(o.times(d)),r=r.plus(o.times(i)),l.s=d.s=b.s,g=n(d,i,s*=2,C).minus(b).abs().comparedTo(n(l,r,s,C).minus(b).abs())<1?[d,i]:[l,r],M=a,g},o.toNumber=function(){return+q(this)},o.toPrecision=function(e,t){return null!=e&&w(e,1,m),U(this,e,t,2)},o.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=I||o>=k?S(y(n.c),o):A(y(n.c),o,"0"):10===e&&L?t=A(y((n=V(new D(n),_+o+1,C)).c),n.e,"0"):(w(e,2,B.length,"Base"),t=r(A(y(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},o.valueOf=o.toJSON=function(){return q(this)},o._isBigNumber=!0,null!=t&&D.set(t),D}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(t,n,t,e))||(e.exports=r)}()},66053:function(e,t,n){function r(e){if(!r.supported)return null;var t,o=e&&e.imports,s=(t="AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL","function"===typeof atob?new Uint8Array(atob(t).split("").map(i)):new(n(48764).Buffer)(t,"base64")),a=null,c={buffer:s,memory:null,exports:null,realloc:function(e){c.exports.memory.grow(Math.ceil(Math.abs(e-c.memory.length)/65536)),c.memory=new Uint8Array(c.exports.memory.buffer)},onload:u};return u((function(){})),c;function u(t){if(c.exports)return t();if(a)a.then(t.bind(null,null)).catch(t);else{try{if(e&&e.async)throw new Error("async");l({instance:new WebAssembly.Instance(new WebAssembly.Module(s),o)})}catch(n){a=WebAssembly.instantiate(s,o).then(l)}u(t)}}function l(e){c.exports=e.instance.exports,c.memory=c.exports.memory&&c.exports.memory.buffer&&new Uint8Array(c.exports.memory.buffer)}}function i(e){return e.charCodeAt(0)}e.exports=r,r.supported="undefined"!==typeof WebAssembly},67060:function(e,t,n){var r=n(29204),i=n(66053)(),o=64,s=[];e.exports=h;var a=e.exports.BYTES_MIN=16,c=e.exports.BYTES_MAX=64,u=(e.exports.BYTES=32,e.exports.KEYBYTES_MIN=16),l=e.exports.KEYBYTES_MAX=64,d=(e.exports.KEYBYTES=32,e.exports.SALTBYTES=16),f=e.exports.PERSONALBYTES=16;function h(e,t,n,p,g){if(!(this instanceof h))return new h(e,t,n,p,g);if(!i||!i.exports)throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");e||(e=32),!0!==g&&(r(e>=a,"digestLength must be at least "+a+", was given "+e),r(e<=c,"digestLength must be at most "+c+", was given "+e),null!=t&&r(t.length>=u,"key must be at least "+u+", was given "+t.length),null!=t&&r(t.length<=l,"key must be at least "+l+", was given "+t.length),null!=n&&r(n.length===d,"salt must be exactly "+d+", was given "+n.length),null!=p&&r(p.length===f,"personal must be exactly "+f+", was given "+p.length)),s.length||(s.push(o),o+=216),this.digestLength=e,this.finalized=!1,this.pointer=s.pop(),i.memory.fill(0,0,64),i.memory[0]=this.digestLength,i.memory[1]=t?t.length:0,i.memory[2]=1,i.memory[3]=1,n&&i.memory.set(n,32),p&&i.memory.set(p,48),this.pointer+216>i.memory.length&&i.realloc(this.pointer+216),i.exports.blake2b_init(this.pointer,this.digestLength),t&&(this.update(t),i.memory.fill(0,o,o+t.length),i.memory[this.pointer+200]=128)}function p(){}function g(e){return e<16?"0"+e.toString(16):e.toString(16)}h.prototype.update=function(e){return r(!1===this.finalized,"Hash instance finalized"),r(e,"input must be TypedArray or Buffer"),o+e.length>i.memory.length&&i.realloc(o+e.length),i.memory.set(e,o),i.exports.blake2b_update(this.pointer,o,o+e.length),this},h.prototype.digest=function(e){if(r(!1===this.finalized,"Hash instance finalized"),this.finalized=!0,s.push(this.pointer),i.exports.blake2b_final(this.pointer),!e||"binary"===e)return i.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if("hex"===e)return function(e,t,n){for(var r="",i=0;i=this.digestLength,"input must be TypedArray or Buffer");for(var t=0;t=4294967296&&i++,e[t]=r,e[t+1]=i}function s(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function a(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function c(e,t,n,r,i,a){var c=f[i],u=f[i+1],l=f[a],h=f[a+1];o(d,e,t),s(d,e,c,u);var p=d[r]^d[e],g=d[r+1]^d[e+1];d[r]=g,d[r+1]=p,o(d,n,r),p=d[t]^d[n],g=d[t+1]^d[n+1],d[t]=p>>>24^g<<8,d[t+1]=g>>>24^p<<8,o(d,e,t),s(d,e,l,h),p=d[r]^d[e],g=d[r+1]^d[e+1],d[r]=p>>>16^g<<16,d[r+1]=g>>>16^p<<16,o(d,n,r),p=d[t]^d[n],g=d[t+1]^d[n+1],d[t]=g>>>31^p<<1,d[t+1]=p>>>31^g<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),l=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),d=new Uint32Array(32),f=new Uint32Array(32);function h(e,t){var n=0;for(n=0;n<16;n++)d[n]=e.h[n],d[n+16]=u[n];for(d[24]=d[24]^e.t,d[25]=d[25]^e.t/4294967296,t&&(d[28]=~d[28],d[29]=~d[29]),n=0;n<32;n++)f[n]=a(e.b,4*n);for(n=0;n<12;n++)c(0,8,16,24,l[16*n+0],l[16*n+1]),c(2,10,18,26,l[16*n+2],l[16*n+3]),c(4,12,20,28,l[16*n+4],l[16*n+5]),c(6,14,22,30,l[16*n+6],l[16*n+7]),c(0,10,20,30,l[16*n+8],l[16*n+9]),c(2,12,22,24,l[16*n+10],l[16*n+11]),c(4,14,16,26,l[16*n+12],l[16*n+13]),c(6,8,18,28,l[16*n+14],l[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^d[n]^d[n+16]}var p=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function g(e,t,n,r){p.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=e,p[0]=e,t&&(p[1]=t.length),p[2]=1,p[3]=1,n&&p.set(n,32),r&&p.set(r,48);for(var i=0;i<16;i++)this.h[i]=u[i]^a(p,4*i);t&&(m(this,t),this.c=128)}function m(e,t){for(var n=0;n=this.outlen,"out must have at least outlen bytes of space"),function(e,t){e.t+=e.c;for(;e.c<128;)e.b[e.c++]=0;h(e,!0);for(var n=0;n>2]>>8*(3&n)}(this,t),"hex"===e?function(e){for(var t="",n=0;n=v,"outlen must be at least "+v+", was given "+e),r(e<=w,"outlen must be at most "+w+", was given "+e),null!=t&&r(t.length>=x,"key must be at least "+x+", was given "+t.length),null!=t&&r(t.length<=S,"key must be at most "+S+", was given "+t.length),null!=n&&r(n.length===A,"salt must be exactly "+A+", was given "+n.length),null!=i&&r(i.length===E,"personal must be exactly "+E+", was given "+i.length)),new y(e,t,n,i)},e.exports.ready=function(e){i.ready((function(){e()}))},e.exports.WASM_SUPPORTED=i.SUPPORTED,e.exports.WASM_LOADED=!1;var v=e.exports.BYTES_MIN=16,w=e.exports.BYTES_MAX=64,x=(e.exports.BYTES=32,e.exports.KEYBYTES_MIN=16),S=e.exports.KEYBYTES_MAX=64,A=(e.exports.KEYBYTES=32,e.exports.SALTBYTES=16),E=e.exports.PERSONALBYTES=16;i.ready((function(t){t||(e.exports.WASM_LOADED=!0,y=i)}))},13550:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:n(46601).Buffer}catch(_){}function a(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"===typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,c=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?l[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=d[e],h=f[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?g+n:l[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r("undefined"!==typeof s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,u=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function g(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(p=h),o.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?p(this,e,t):r<63?h(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):g(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new A(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(v,y),v.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return b[e]=t,t},A.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},A.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new E(e)},i(E,A),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},51206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,c=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]1?i-1:0),s=1;s0){var s=Object.keys(n),c=a.default.find(s,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var d=this.satisfies(n[l]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=a.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},29931:function(e,t,n){var r;function i(e){this.rand=e}if(e.exports=function(e){return r||(r=new i(null)),r.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;ns)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|g(e,t),r=a(n),i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){var t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);var i=function(e){if(c.isBuffer(e)){var t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||q(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){for(var t=e.length<0?0:0|p(e.length),n=a(t),r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(i)return r?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){for(var d=!0,f=0;fi&&(r=i):r=i;var o=t.length;r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(l=u);break;case 2:128===(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128===(192&o)&&128===(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128===(192&o)&&128===(192&s)&&128===(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,d=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=d}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rr.length?c.from(o).copy(r,i):Uint8Array.prototype.set.call(r,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i)}i+=o.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(V(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n),d=0;d>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function k(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,o){return t=+t,n>>>=0,o||N(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,o){return t=+t,n>>>=0,o||N(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e],i=1,o=0;++o>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function j(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function F(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!==e}var z=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},21924:function(e,t,n){"use strict";var r=n(40210),i=n(55559),o=i(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"===typeof n&&o(e,".prototype.")>-1?i(n):n}},55559:function(e,t,n){"use strict";var r=n(58612),i=n(40210),o=i("%Function.prototype.apply%"),s=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||r.call(s,o),c=i("%Object.getOwnPropertyDescriptor%",!0),u=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(u)try{u({},"a",{value:1})}catch(f){u=null}e.exports=function(e){var t=a(r,s,arguments);if(c&&u){var n=c(t,"length");n.configurable&&u(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var d=function(){return a(r,o,arguments)};u?u(e.exports,"apply",{value:d}):e.exports.apply=d},94184:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t-1};function u(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function x(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];S.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(_){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:x(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new S(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=v,e.Response=S),t.Headers=f,t.Request=v,t.Response=S,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},44020:function(e){"use strict";var t="%[a-f0-9]{2}",n=new RegExp(t,"gi"),r=new RegExp("("+t+")+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(o){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n),r=1;r0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"===typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"===typeof c)r(c,this,t);else{var u=c.length,l=p(c,u);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return f(this,e,!0)},o.prototype.rawListeners=function(e){return f(this,e,!1)},o.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},58875:function(e,t,n){var r;!function(){"use strict";var i=!("undefined"===typeof window||!window.document||!window.document.createElement),o={canUseDOM:i,canUseWorkers:"undefined"!==typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen};void 0===(r=function(){return o}.call(t,n,t,e))||(e.exports=r)}()},92806:function(e){"use strict";e.exports=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o1&&"boolean"!==typeof t)throw new s('"allowMissing" argument must be a boolean');var n=C(e),r=n.length>0?n[0]:"",o=I("%"+r+"%",t),a=o.name,u=o.value,l=!1,d=o.alias;d&&(r=d[0],x(n,w([0,1],d)));for(var f=1,h=!0;f=n.length){var y=c(u,p);u=(h=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:u[p]}else h=v(u,p),u=u[p];h&&!l&&(g[a]=u)}}return u}},41405:function(e,t,n){"use strict";var r="undefined"!==typeof Symbol&&Symbol,i=n(55419);e.exports=function(){return"function"===typeof r&&("function"===typeof Symbol&&("symbol"===typeof r("foo")&&("symbol"===typeof Symbol("bar")&&i())))}},55419:function(e){"use strict";e.exports=function(){if("function"!==typeof Symbol||"function"!==typeof Object.getOwnPropertySymbols)return!1;if("symbol"===typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"===typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"===typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"===typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"===typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},96410:function(e,t,n){"use strict";var r=n(55419);e.exports=function(){return r()&&!!Symbol.toStringTag}},17642:function(e,t,n){"use strict";var r=n(58612);e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},33715:function(e,t,n){var r=t;r.utils=n(26436),r.common=n(95772),r.sha=n(89041),r.ripemd=n(12949),r.hmac=n(52344),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},95772:function(e,t,n){"use strict";var r=n(26436),i=n(79746);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=r.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=r.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},t.g1_256=function(e){return r(e,17)^r(e,19)^e>>>10}},26436:function(e,t,n){"use strict";var r=n(79746),i=n(35717);function o(e,t){return 55296===(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320===(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"===typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(e="0"+e),i=0;i>6|192,n[r++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},t.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},t.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},t.sum64_lo=function(e,t,n,r){return t+r>>>0},t.sum64_4_hi=function(e,t,n,r,i,o,s,a){var c=0,u=t;return c+=(u=u+r>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,n,r,i,o,s,a){return t+r+o+a>>>0},t.sum64_5_hi=function(e,t,n,r,i,o,s,a,c,u){var l=0,d=t;return l+=(d=d+r>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,n,r,i,o,s,a,c,u){return t+r+o+a+u>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},89090:function(e,t,n){var r,i=n(34155);!function(){"use strict";var t="object"===typeof window?window:{};!t.HI_BASE32_NO_NODE_JS&&"object"===typeof i&&i.versions&&i.versions.node&&(t=n.g);var o=!t.HI_BASE32_NO_COMMON_JS&&e.exports,s=n.amdO,a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),c={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},u=[0,0,0,0,0,0,0,0],l=function(e,t){t.length>10&&(t="..."+t.substr(-10));var n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},d=function(e){if(""===e)return[];if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,n,r,i,o,s,a,u,l=[],d=0,f=(e=e.replace(/=/g,"")).length,h=0,p=f>>3<<3;h>>2),l[d++]=255&(n<<6|r<<1|i>>>4),l[d++]=255&(i<<4|o>>>1),l[d++]=255&(o<<7|s<<2|a>>>3),l[d++]=255&(a<<5|u);var g=f-p;return 2===g?(t=c[e.charAt(h++)],n=c[e.charAt(h++)],l[d++]=255&(t<<3|n>>>2)):4===g?(t=c[e.charAt(h++)],n=c[e.charAt(h++)],r=c[e.charAt(h++)],i=c[e.charAt(h++)],l[d++]=255&(t<<3|n>>>2),l[d++]=255&(n<<6|r<<1|i>>>4)):5===g?(t=c[e.charAt(h++)],n=c[e.charAt(h++)],r=c[e.charAt(h++)],i=c[e.charAt(h++)],o=c[e.charAt(h++)],l[d++]=255&(t<<3|n>>>2),l[d++]=255&(n<<6|r<<1|i>>>4),l[d++]=255&(i<<4|o>>>1)):7===g&&(t=c[e.charAt(h++)],n=c[e.charAt(h++)],r=c[e.charAt(h++)],i=c[e.charAt(h++)],o=c[e.charAt(h++)],s=c[e.charAt(h++)],a=c[e.charAt(h++)],l[d++]=255&(t<<3|n>>>2),l[d++]=255&(n<<6|r<<1|i>>>4),l[d++]=255&(i<<4|o>>>1),l[d++]=255&(o<<7|s<<2|a>>>3)),l},f=function(e,t){if(!t)return function(e){for(var t,n,r="",i=e.length,o=0,s=0;o191&&t<=223?(n=31&t,s=1):t<=239?(n=15&t,s=2):t<=247?(n=7&t,s=3):l(o,r);for(var a=0;a191)&&l(o,r),n<<=6,n+=63&t;n>=55296&&n<=57343&&l(o,r),n>1114111&&l(o,r),n<=65535?r+=String.fromCharCode(n):(n-=65536,r+=String.fromCharCode(55296+(n>>10)),r+=String.fromCharCode(56320+(1023&n)))}return r}(d(e));if(""===e)return"";if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,i,o,s,a,u,f,h="",p=e.indexOf("=");-1===p&&(p=e.length);for(var g=0,m=p>>3<<3;g>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|u>>>3))+String.fromCharCode(255&(u<<5|f));var b=p-m;return 2===b?(n=c[e.charAt(g++)],r=c[e.charAt(g++)],h+=String.fromCharCode(255&(n<<3|r>>>2))):4===b?(n=c[e.charAt(g++)],r=c[e.charAt(g++)],i=c[e.charAt(g++)],o=c[e.charAt(g++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))):5===b?(n=c[e.charAt(g++)],r=c[e.charAt(g++)],i=c[e.charAt(g++)],o=c[e.charAt(g++)],s=c[e.charAt(g++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===b&&(n=c[e.charAt(g++)],r=c[e.charAt(g++)],i=c[e.charAt(g++)],o=c[e.charAt(g++)],s=c[e.charAt(g++)],a=c[e.charAt(g++)],u=c[e.charAt(g++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|u>>>3))),h},h={encode:function(e,t){var n="string"!==typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?function(e){for(var t,n,r,i,o,s="",c=e.length,u=0,l=5*parseInt(c/5);u>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|o>>>5)]+a[31&o];var d=c-l;return 1===d?(t=e[u],s+=a[t>>>3]+a[t<<2&31]+"======"):2===d?(t=e[u++],n=e[u],s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[n<<4&31]+"===="):3===d?(t=e[u++],n=e[u++],r=e[u],s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[r<<1&31]+"==="):4===d&&(t=e[u++],n=e[u++],r=e[u++],i=e[u],s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"="),s}(e):t?function(e){for(var t,n,r,i,o,s="",c=e.length,u=0,l=5*parseInt(c/5);u>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|o>>>5)]+a[31&o];var d=c-l;return 1===d?(t=e.charCodeAt(u),s+=a[t>>>3]+a[t<<2&31]+"======"):2===d?(t=e.charCodeAt(u++),n=e.charCodeAt(u),s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[n<<4&31]+"===="):3===d?(t=e.charCodeAt(u++),n=e.charCodeAt(u++),r=e.charCodeAt(u),s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[r<<1&31]+"==="):4===d&&(t=e.charCodeAt(u++),n=e.charCodeAt(u++),r=e.charCodeAt(u++),i=e.charCodeAt(u),s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"="),s}(e):function(e){var t,n,r,i,o,s,c,l=!1,d="",f=0,h=0,p=e.length;if(""===e)return d;do{for(u[0]=u[5],u[1]=u[6],u[2]=u[7],c=h;f>6,u[c++]=128|63&s):s<55296||s>=57344?(u[c++]=224|s>>12,u[c++]=128|s>>6&63,u[c++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++f)),u[c++]=240|s>>18,u[c++]=128|s>>12&63,u[c++]=128|s>>6&63,u[c++]=128|63&s);h=c-5,f===p&&++f,f>p&&c<6&&(l=!0),t=u[0],c>4?(n=u[1],r=u[2],i=u[3],o=u[4],d+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|o>>>5)]+a[31&o]):1===c?d+=a[t>>>3]+a[t<<2&31]+"======":2===c?(n=u[1],d+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[n<<4&31]+"===="):3===c?(n=u[1],r=u[2],d+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[r<<1&31]+"==="):(n=u[1],r=u[2],i=u[3],d+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"=")}while(!l);return d}(e)},decode:f};f.asBytes=d,o?e.exports=h:(t.base32=h,s&&(void 0===(r=function(){return h}.call(h,n,h,e))||(e.exports=r)))}()},2156:function(e,t,n){"use strict";var r=n(33715),i=n(34504),o=n(79746);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),n=i.toArray(e.nonce,e.nonceEnc||"hex"),r=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}e.exports=s,s.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},s.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(r=n,n=t,t=null),n&&(n=i.toArray(n,r||"hex"),this._update(n));for(var o=[];o.length-1};function u(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function x(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];S.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(_){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:x(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new S(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=v,e.Response=S),t.Headers=f,t.Request=v,t.Response=S,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},80645:function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<>1,l=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=u}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<0;e[n+h]=255&s,h+=p,s/=256,u-=8);e[n+h-p]|=128*g}},35717:function(e){"function"===typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},82584:function(e,t,n){"use strict";var r=n(96410)(),i=n(21924)("Object.prototype.toString"),o=function(e){return!(r&&e&&"object"===typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},s=function(e){return!!o(e)||null!==e&&"object"===typeof e&&"number"===typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,e.exports=a?o:s},48662:function(e,t,n){"use strict";var r,i=Object.prototype.toString,o=Function.prototype.toString,s=/^\s*(?:function)?\*/,a=n(96410)(),c=Object.getPrototypeOf;e.exports=function(e){if("function"!==typeof e)return!1;if(s.test(o.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===i.call(e);if(!c)return!1;if("undefined"===typeof r){var t=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}}();r=!!t&&c(t)}return c(e)===r}},85692:function(e,t,n){"use strict";var r=n(49804),i=n(63083),o=n(21924),s=o("Object.prototype.toString"),a=n(96410)(),c="undefined"===typeof globalThis?n.g:globalThis,u=i(),l=o("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n-1}return!!h&&function(e){var t=!1;return r(f,(function(n,r){if(!t)try{t=n.call(e)===r}catch(i){}})),t}(e)}},4501:function(e){e.exports=r,r.strict=i,r.loose=o;var t=Object.prototype.toString,n={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function r(e){return i(e)||o(e)}function i(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return n[t.call(e)]}},91094:function(e,t,n){var r,i=n(34155);!function(){"use strict";var o="input is invalid type",s="object"===typeof window,a=s?window:{};a.JS_SHA3_NO_WINDOW&&(s=!1);var c=!s&&"object"===typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"===typeof i&&i.versions&&i.versions.node?a=n.g:c&&(a=self);var u=!a.JS_SHA3_NO_COMMON_JS&&e.exports,l=n.amdO,d=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,f="0123456789abcdef".split(""),h=[4,1024,262144,67108864],p=[0,8,16,24],g=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=[224,256,384,512],b=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!a.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!d||!a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var w=function(e,t,n){return function(r){return new B(e,t,e).update(r)[n]()}},x=function(e,t,n){return function(r,i){return new B(e,t,i).update(r)[n]()}},S=function(e,t,n){return function(t,r,i,o){return I["cshake"+e].update(t,r,i,o)[n]()}},A=function(e,t,n){return function(t,r,i,o){return I["kmac"+e].update(t,r,i,o)[n]()}},E=function(e,t,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function L(e,t,n){B.call(this,e,t,n)}B.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(o);if(null===e)throw new Error(o);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!d||!ArrayBuffer.isView(e)))throw new Error(o);t=!0}for(var r,i,s=this.blocks,a=this.byteCount,c=e.length,u=this.blockCount,l=0,f=this.s;l>2]|=e[l]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(s[r>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=a){for(this.start=r-a,this.block=s[u],r=0;r>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},B.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(o);if(null===e)throw new Error(o);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!d||!ArrayBuffer.isView(e)))throw new Error(o);t=!0}var r=0,i=e.length;if(t)r=i;else for(var s=0;s=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),r+=4)}return r+=this.encode(8*r),this.update(e),r},B.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+f[15&e]+f[e>>12&15]+f[e>>8&15]+f[e>>20&15]+f[e>>16&15]+f[e>>28&15]+f[e>>24&15];s%t===0&&(D(n),o=0)}return i&&(e=n[o],a+=f[e>>4&15]+f[15&e],i>1&&(a+=f[e>>12&15]+f[e>>8&15]),i>2&&(a+=f[e>>20&15]+f[e>>16&15])),a},B.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%n===0&&D(r)}return o&&(e=a<<2,t=r[s],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},L.prototype=new B,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),B.prototype.finalize.call(this)};var D=function(e){var t,n,r,i,o,s,a,c,u,l,d,f,h,p,m,b,y,v,w,x,S,A,E,_,C,I,k,T,M,P,O,R,N,B,L,D,U,j,F,V,q,z,H,W,G,Z,K,X,Y,J,Q,$,ee,te,ne,re,ie,oe,se,ae,ce,ue,le;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),n=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(c<<1|u>>>31),n=o^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=s^(l<<1|d>>>31),n=a^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(f<<1|h>>>31),n=u^(h<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(i<<1|o>>>31),n=d^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],m=e[1],Z=e[11]<<4|e[10]>>>28,K=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,M=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,b=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,X=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,O=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,R=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,_=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,j=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,x=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,W=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,I=e[18]<<20|e[19]>>>12,k=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,V=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~b&v,e[1]=m^~y&w,e[10]=_^~I&T,e[11]=C^~k&M,e[20]=B^~D&j,e[21]=L^~U&F,e[30]=W^~Z&X,e[31]=G^~K&Y,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=b^~v&x,e[3]=y^~w&S,e[12]=I^~T&P,e[13]=k^~M&O,e[22]=D^~j&V,e[23]=U^~F&q,e[32]=Z^~X&J,e[33]=K^~Y&Q,e[42]=re^~oe&ae,e[43]=ie^~se&ce,e[4]=v^~x&A,e[5]=w^~S&E,e[14]=T^~P&R,e[15]=M^~O&N,e[24]=j^~V&z,e[25]=F^~q&H,e[34]=X^~J&$,e[35]=Y^~Q&ee,e[44]=oe^~ae&ue,e[45]=se^~ce&le,e[6]=x^~A&p,e[7]=S^~E&m,e[16]=P^~R&_,e[17]=O^~N&C,e[26]=V^~z&B,e[27]=q^~H&L,e[36]=J^~$&W,e[37]=Q^~ee&G,e[46]=ae^~ue&te,e[47]=ce^~le&ne,e[8]=A^~p&b,e[9]=E^~m&y,e[18]=R^~_&I,e[19]=N^~C&k,e[28]=z^~B&D,e[29]=H^~L&U,e[38]=$^~W&Z,e[39]=ee^~G&K,e[48]=ue^~te&re,e[49]=le^~ne&ie,e[0]^=g[r],e[1]^=g[r+1]};if(u)e.exports=I;else{for(T=0;T>6,c[u++]=128|63&a):a<55296||a>=57344?(c[u++]=224|a>>12,c[u++]=128|a>>6&63,c[u++]=128|63&a):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++d)),c[u++]=240|a>>18,c[u++]=128|a>>12&63,c[u++]=128|a>>6&63,c[u++]=128|63&a);e=c}e.length>128&&(e=new x(n,!0).update(e).array());var f=[],h=[];for(d=0;d<128;++d){var p=e[d]||0;f[d]=92^p,h[d]=54^p}x.call(this,n,r),this.update(h),this.oKeyPad=f,this.inner=!0,this.sharedMemory=r}x.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!l||!ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var i,o,s=0,a=e.length,c=this.blocks;s>2]|=e[s]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(c[o>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=128?(this.block=c[32],this.start=o-128,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[32]=this.block,e[t>>2]|=f[3&t],this.block=e[32],t>=112&&(this.hashed||this.hash(),e[0]=this.block,e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=e[16]=e[17]=e[18]=e[19]=e[20]=e[21]=e[22]=e[23]=e[24]=e[25]=e[26]=e[27]=e[28]=e[29]=e[30]=e[31]=e[32]=0),e[30]=this.hBytes<<3|this.bytes>>>29,e[31]=this.bytes<<3,this.hash()}},x.prototype.hash=function(){var e,t,n,r,i,o,s,a,c,u,l,d,f,h,g,m,b,y,v,w,x,S,A,E,_,C=this.h0h,I=this.h0l,k=this.h1h,T=this.h1l,M=this.h2h,P=this.h2l,O=this.h3h,R=this.h3l,N=this.h4h,B=this.h4l,L=this.h5h,D=this.h5l,U=this.h6h,j=this.h6l,F=this.h7h,V=this.h7l,q=this.blocks;for(e=32;e<160;e+=2)t=((w=q[e-30])>>>1|(x=q[e-29])<<31)^(w>>>8|x<<24)^w>>>7,n=(x>>>1|w<<31)^(x>>>8|w<<24)^(x>>>7|w<<25),r=((w=q[e-4])>>>19|(x=q[e-3])<<13)^(x>>>29|w<<3)^w>>>6,i=(x>>>19|w<<13)^(w>>>29|x<<3)^(x>>>6|w<<26),w=q[e-32],x=q[e-31],c=((S=q[e-14])>>>16)+(w>>>16)+(t>>>16)+(r>>>16)+((a=(65535&S)+(65535&w)+(65535&t)+(65535&r)+((s=((A=q[e-13])>>>16)+(x>>>16)+(n>>>16)+(i>>>16)+((o=(65535&A)+(65535&x)+(65535&n)+(65535&i))>>>16))>>>16))>>>16),q[e]=c<<16|65535&a,q[e+1]=s<<16|65535&o;var z=C,H=I,W=k,G=T,Z=M,K=P,X=O,Y=R,J=N,Q=B,$=L,ee=D,te=U,ne=j,re=F,ie=V;for(m=W&Z,b=G&K,e=0;e<160;e+=8)t=(z>>>28|H<<4)^(H>>>2|z<<30)^(H>>>7|z<<25),n=(H>>>28|z<<4)^(z>>>2|H<<30)^(z>>>7|H<<25),r=(J>>>14|Q<<18)^(J>>>18|Q<<14)^(Q>>>9|J<<23),i=(Q>>>14|J<<18)^(Q>>>18|J<<14)^(J>>>9|Q<<23),y=(u=z&W)^z&Z^m,v=(l=H&G)^H&K^b,E=J&$^~J&te,_=Q&ee^~Q&ne,w=q[e],x=q[e+1],w=(c=((S=p[e])>>>16)+(w>>>16)+(E>>>16)+(r>>>16)+(re>>>16)+((a=(65535&S)+(65535&w)+(65535&E)+(65535&r)+(65535&re)+((s=((A=p[e+1])>>>16)+(x>>>16)+(_>>>16)+(i>>>16)+(ie>>>16)+((o=(65535&A)+(65535&x)+(65535&_)+(65535&i)+(65535&ie))>>>16))>>>16))>>>16))<<16|65535&a,x=s<<16|65535&o,S=(c=(y>>>16)+(t>>>16)+((a=(65535&y)+(65535&t)+((s=(v>>>16)+(n>>>16)+((o=(65535&v)+(65535&n))>>>16))>>>16))>>>16))<<16|65535&a,A=s<<16|65535&o,re=(c=(X>>>16)+(w>>>16)+((a=(65535&X)+(65535&w)+((s=(Y>>>16)+(x>>>16)+((o=(65535&Y)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,ie=s<<16|65535&o,t=((X=(c=(S>>>16)+(w>>>16)+((a=(65535&S)+(65535&w)+((s=(A>>>16)+(x>>>16)+((o=(65535&A)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(Y=s<<16|65535&o)<<4)^(Y>>>2|X<<30)^(Y>>>7|X<<25),n=(Y>>>28|X<<4)^(X>>>2|Y<<30)^(X>>>7|Y<<25),r=(re>>>14|ie<<18)^(re>>>18|ie<<14)^(ie>>>9|re<<23),i=(ie>>>14|re<<18)^(ie>>>18|re<<14)^(re>>>9|ie<<23),y=(d=X&z)^X&W^u,v=(f=Y&H)^Y&G^l,E=re&J^~re&$,_=ie&Q^~ie&ee,w=q[e+2],x=q[e+3],w=(c=((S=p[e+2])>>>16)+(w>>>16)+(E>>>16)+(r>>>16)+(te>>>16)+((a=(65535&S)+(65535&w)+(65535&E)+(65535&r)+(65535&te)+((s=((A=p[e+3])>>>16)+(x>>>16)+(_>>>16)+(i>>>16)+(ne>>>16)+((o=(65535&A)+(65535&x)+(65535&_)+(65535&i)+(65535&ne))>>>16))>>>16))>>>16))<<16|65535&a,x=s<<16|65535&o,S=(c=(y>>>16)+(t>>>16)+((a=(65535&y)+(65535&t)+((s=(v>>>16)+(n>>>16)+((o=(65535&v)+(65535&n))>>>16))>>>16))>>>16))<<16|65535&a,A=s<<16|65535&o,te=(c=(Z>>>16)+(w>>>16)+((a=(65535&Z)+(65535&w)+((s=(K>>>16)+(x>>>16)+((o=(65535&K)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,ne=s<<16|65535&o,t=((Z=(c=(S>>>16)+(w>>>16)+((a=(65535&S)+(65535&w)+((s=(A>>>16)+(x>>>16)+((o=(65535&A)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(K=s<<16|65535&o)<<4)^(K>>>2|Z<<30)^(K>>>7|Z<<25),n=(K>>>28|Z<<4)^(Z>>>2|K<<30)^(Z>>>7|K<<25),r=(te>>>14|ne<<18)^(te>>>18|ne<<14)^(ne>>>9|te<<23),i=(ne>>>14|te<<18)^(ne>>>18|te<<14)^(te>>>9|ne<<23),y=(h=Z&X)^Z&z^d,v=(g=K&Y)^K&H^f,E=te&re^~te&J,_=ne&ie^~ne&Q,w=q[e+4],x=q[e+5],w=(c=((S=p[e+4])>>>16)+(w>>>16)+(E>>>16)+(r>>>16)+($>>>16)+((a=(65535&S)+(65535&w)+(65535&E)+(65535&r)+(65535&$)+((s=((A=p[e+5])>>>16)+(x>>>16)+(_>>>16)+(i>>>16)+(ee>>>16)+((o=(65535&A)+(65535&x)+(65535&_)+(65535&i)+(65535&ee))>>>16))>>>16))>>>16))<<16|65535&a,x=s<<16|65535&o,S=(c=(y>>>16)+(t>>>16)+((a=(65535&y)+(65535&t)+((s=(v>>>16)+(n>>>16)+((o=(65535&v)+(65535&n))>>>16))>>>16))>>>16))<<16|65535&a,A=s<<16|65535&o,$=(c=(W>>>16)+(w>>>16)+((a=(65535&W)+(65535&w)+((s=(G>>>16)+(x>>>16)+((o=(65535&G)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,ee=s<<16|65535&o,t=((W=(c=(S>>>16)+(w>>>16)+((a=(65535&S)+(65535&w)+((s=(A>>>16)+(x>>>16)+((o=(65535&A)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(G=s<<16|65535&o)<<4)^(G>>>2|W<<30)^(G>>>7|W<<25),n=(G>>>28|W<<4)^(W>>>2|G<<30)^(W>>>7|G<<25),r=($>>>14|ee<<18)^($>>>18|ee<<14)^(ee>>>9|$<<23),i=(ee>>>14|$<<18)^(ee>>>18|$<<14)^($>>>9|ee<<23),y=(m=W&Z)^W&X^h,v=(b=G&K)^G&Y^g,E=$&te^~$&re,_=ee&ne^~ee&ie,w=q[e+6],x=q[e+7],w=(c=((S=p[e+6])>>>16)+(w>>>16)+(E>>>16)+(r>>>16)+(J>>>16)+((a=(65535&S)+(65535&w)+(65535&E)+(65535&r)+(65535&J)+((s=((A=p[e+7])>>>16)+(x>>>16)+(_>>>16)+(i>>>16)+(Q>>>16)+((o=(65535&A)+(65535&x)+(65535&_)+(65535&i)+(65535&Q))>>>16))>>>16))>>>16))<<16|65535&a,x=s<<16|65535&o,S=(c=(y>>>16)+(t>>>16)+((a=(65535&y)+(65535&t)+((s=(v>>>16)+(n>>>16)+((o=(65535&v)+(65535&n))>>>16))>>>16))>>>16))<<16|65535&a,A=s<<16|65535&o,J=(c=(z>>>16)+(w>>>16)+((a=(65535&z)+(65535&w)+((s=(H>>>16)+(x>>>16)+((o=(65535&H)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,Q=s<<16|65535&o,z=(c=(S>>>16)+(w>>>16)+((a=(65535&S)+(65535&w)+((s=(A>>>16)+(x>>>16)+((o=(65535&A)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,H=s<<16|65535&o;c=(C>>>16)+(z>>>16)+((a=(65535&C)+(65535&z)+((s=(I>>>16)+(H>>>16)+((o=(65535&I)+(65535&H))>>>16))>>>16))>>>16),this.h0h=c<<16|65535&a,this.h0l=s<<16|65535&o,c=(k>>>16)+(W>>>16)+((a=(65535&k)+(65535&W)+((s=(T>>>16)+(G>>>16)+((o=(65535&T)+(65535&G))>>>16))>>>16))>>>16),this.h1h=c<<16|65535&a,this.h1l=s<<16|65535&o,c=(M>>>16)+(Z>>>16)+((a=(65535&M)+(65535&Z)+((s=(P>>>16)+(K>>>16)+((o=(65535&P)+(65535&K))>>>16))>>>16))>>>16),this.h2h=c<<16|65535&a,this.h2l=s<<16|65535&o,c=(O>>>16)+(X>>>16)+((a=(65535&O)+(65535&X)+((s=(R>>>16)+(Y>>>16)+((o=(65535&R)+(65535&Y))>>>16))>>>16))>>>16),this.h3h=c<<16|65535&a,this.h3l=s<<16|65535&o,c=(N>>>16)+(J>>>16)+((a=(65535&N)+(65535&J)+((s=(B>>>16)+(Q>>>16)+((o=(65535&B)+(65535&Q))>>>16))>>>16))>>>16),this.h4h=c<<16|65535&a,this.h4l=s<<16|65535&o,c=(L>>>16)+($>>>16)+((a=(65535&L)+(65535&$)+((s=(D>>>16)+(ee>>>16)+((o=(65535&D)+(65535&ee))>>>16))>>>16))>>>16),this.h5h=c<<16|65535&a,this.h5l=s<<16|65535&o,c=(U>>>16)+(te>>>16)+((a=(65535&U)+(65535&te)+((s=(j>>>16)+(ne>>>16)+((o=(65535&j)+(65535&ne))>>>16))>>>16))>>>16),this.h6h=c<<16|65535&a,this.h6l=s<<16|65535&o,c=(F>>>16)+(re>>>16)+((a=(65535&F)+(65535&re)+((s=(V>>>16)+(ie>>>16)+((o=(65535&V)+(65535&ie))>>>16))>>>16))>>>16),this.h7h=c<<16|65535&a,this.h7l=s<<16|65535&o},x.prototype.hex=function(){this.finalize();var e=this.h0h,t=this.h0l,n=this.h1h,r=this.h1l,i=this.h2h,o=this.h2l,s=this.h3h,a=this.h3l,c=this.h4h,u=this.h4l,l=this.h5h,f=this.h5l,h=this.h6h,p=this.h6l,g=this.h7h,m=this.h7l,b=this.bits,y=d[e>>28&15]+d[e>>24&15]+d[e>>20&15]+d[e>>16&15]+d[e>>12&15]+d[e>>8&15]+d[e>>4&15]+d[15&e]+d[t>>28&15]+d[t>>24&15]+d[t>>20&15]+d[t>>16&15]+d[t>>12&15]+d[t>>8&15]+d[t>>4&15]+d[15&t]+d[n>>28&15]+d[n>>24&15]+d[n>>20&15]+d[n>>16&15]+d[n>>12&15]+d[n>>8&15]+d[n>>4&15]+d[15&n]+d[r>>28&15]+d[r>>24&15]+d[r>>20&15]+d[r>>16&15]+d[r>>12&15]+d[r>>8&15]+d[r>>4&15]+d[15&r]+d[i>>28&15]+d[i>>24&15]+d[i>>20&15]+d[i>>16&15]+d[i>>12&15]+d[i>>8&15]+d[i>>4&15]+d[15&i]+d[o>>28&15]+d[o>>24&15]+d[o>>20&15]+d[o>>16&15]+d[o>>12&15]+d[o>>8&15]+d[o>>4&15]+d[15&o]+d[s>>28&15]+d[s>>24&15]+d[s>>20&15]+d[s>>16&15]+d[s>>12&15]+d[s>>8&15]+d[s>>4&15]+d[15&s];return b>=256&&(y+=d[a>>28&15]+d[a>>24&15]+d[a>>20&15]+d[a>>16&15]+d[a>>12&15]+d[a>>8&15]+d[a>>4&15]+d[15&a]),b>=384&&(y+=d[c>>28&15]+d[c>>24&15]+d[c>>20&15]+d[c>>16&15]+d[c>>12&15]+d[c>>8&15]+d[c>>4&15]+d[15&c]+d[u>>28&15]+d[u>>24&15]+d[u>>20&15]+d[u>>16&15]+d[u>>12&15]+d[u>>8&15]+d[u>>4&15]+d[15&u]+d[l>>28&15]+d[l>>24&15]+d[l>>20&15]+d[l>>16&15]+d[l>>12&15]+d[l>>8&15]+d[l>>4&15]+d[15&l]+d[f>>28&15]+d[f>>24&15]+d[f>>20&15]+d[f>>16&15]+d[f>>12&15]+d[f>>8&15]+d[f>>4&15]+d[15&f]),512==b&&(y+=d[h>>28&15]+d[h>>24&15]+d[h>>20&15]+d[h>>16&15]+d[h>>12&15]+d[h>>8&15]+d[h>>4&15]+d[15&h]+d[p>>28&15]+d[p>>24&15]+d[p>>20&15]+d[p>>16&15]+d[p>>12&15]+d[p>>8&15]+d[p>>4&15]+d[15&p]+d[g>>28&15]+d[g>>24&15]+d[g>>20&15]+d[g>>16&15]+d[g>>12&15]+d[g>>8&15]+d[g>>4&15]+d[15&g]+d[m>>28&15]+d[m>>24&15]+d[m>>20&15]+d[m>>16&15]+d[m>>12&15]+d[m>>8&15]+d[m>>4&15]+d[15&m]),y},x.prototype.toString=x.prototype.hex,x.prototype.digest=function(){this.finalize();var e=this.h0h,t=this.h0l,n=this.h1h,r=this.h1l,i=this.h2h,o=this.h2l,s=this.h3h,a=this.h3l,c=this.h4h,u=this.h4l,l=this.h5h,d=this.h5l,f=this.h6h,h=this.h6l,p=this.h7h,g=this.h7l,m=this.bits,b=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,s>>24&255,s>>16&255,s>>8&255,255&s];return m>=256&&b.push(a>>24&255,a>>16&255,a>>8&255,255&a),m>=384&&b.push(c>>24&255,c>>16&255,c>>8&255,255&c,u>>24&255,u>>16&255,u>>8&255,255&u,l>>24&255,l>>16&255,l>>8&255,255&l,d>>24&255,d>>16&255,d>>8&255,255&d),512==m&&b.push(f>>24&255,f>>16&255,f>>8&255,255&f,h>>24&255,h>>16&255,h>>8&255,255&h,p>>24&255,p>>16&255,p>>8&255,255&p,g>>24&255,g>>16&255,g>>8&255,255&g),b},x.prototype.array=x.prototype.digest,x.prototype.arrayBuffer=function(){this.finalize();var e=this.bits,t=new ArrayBuffer(e/8),n=new DataView(t);return n.setUint32(0,this.h0h),n.setUint32(4,this.h0l),n.setUint32(8,this.h1h),n.setUint32(12,this.h1l),n.setUint32(16,this.h2h),n.setUint32(20,this.h2l),n.setUint32(24,this.h3h),e>=256&&n.setUint32(28,this.h3l),e>=384&&(n.setUint32(32,this.h4h),n.setUint32(36,this.h4l),n.setUint32(40,this.h5h),n.setUint32(44,this.h5l)),512==e&&(n.setUint32(48,this.h6h),n.setUint32(52,this.h6l),n.setUint32(56,this.h7h),n.setUint32(60,this.h7l)),t},x.prototype.clone=function(){var e=new x(this.bits,!1);return this.copyTo(e),e},x.prototype.copyTo=function(e){var t=0,n=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(t=0;t="0"&&a<="9";)i+=a,f();if("."===a)for(i+=".";f()&&a>="0"&&a<="9";)i+=a;if("e"===a||"E"===a)for(i+=a,f(),"-"!==a&&"+"!==a||(i+=a,f());a>="0"&&a<="9";)i+=a,f();if(e=+i,isFinite(e))return null==r&&(r=n(44431)),i.length>15?t.storeAsString?i:t.useNativeBigInt?BigInt(i):new r(i):t.alwaysParseAsBig?t.useNativeBigInt?BigInt(e):new r(e):e;d("Bad number")},p=function(){var e,t,n,r="";if('"'===a)for(var i=s;f();){if('"'===a)return s-1>i&&(r+=c.substring(i,s-1)),f(),r;if("\\"===a){if(s-1>i&&(r+=c.substring(i,s-1)),f(),"u"===a){for(n=0,t=0;t<4&&(e=parseInt(f(),16),isFinite(e));t+=1)n=16*n+e;r+=String.fromCharCode(n)}else{if("string"!==typeof l[a])break;r+=l[a]}i=s}}d("Bad string")},g=function(){for(;a&&a<=" ";)f()};return u=function(){switch(g(),a){case"{":return function(){var e,n=Object.create(null);if("{"===a){if(f("{"),g(),"}"===a)return f("}"),n;for(;a;){if(e=p(),g(),f(":"),!0===t.strict&&Object.hasOwnProperty.call(n,e)&&d('Duplicate key "'+e+'"'),!0===i.test(e)?"error"===t.protoAction?d("Object contains forbidden prototype property"):"ignore"===t.protoAction?u():n[e]=u():!0===o.test(e)?"error"===t.constructorAction?d("Object contains forbidden constructor property"):"ignore"===t.constructorAction?u():n[e]=u():n[e]=u(),g(),"}"===a)return f("}"),n;f(","),g()}}d("Bad object")}();case"[":return function(){var e=[];if("["===a){if(f("["),g(),"]"===a)return f("]"),e;for(;a;){if(e.push(u()),g(),"]"===a)return f("]"),e;f(","),g()}}d("Bad array")}();case'"':return p();case"-":return h();default:return a>="0"&&a<="9"?h():function(){switch(a){case"t":return f("t"),f("r"),f("u"),f("e"),!0;case"f":return f("f"),f("a"),f("l"),f("s"),f("e"),!1;case"n":return f("n"),f("u"),f("l"),f("l"),null}d("Unexpected '"+a+"'")}()}},function(e,t){var n;return c=e+"",s=0,a=" ",n=u(),g(),a&&d("Syntax error"),"function"===typeof t?function e(n,r){var i,o=n[r];return o&&"object"===typeof o&&Object.keys(o).forEach((function(t){void 0!==(i=e(o,t))?o[t]=i:delete o[t]})),t.call(n,r,o)}({"":n},""):n}}},54123:function(e,t,n){var r=n(44431),i=e.exports;!function(){"use strict";var e,t,n,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function a(e){return o.lastIndex=0,o.test(e)?'"'+e.replace(o,(function(e){var t=s[e];return"string"===typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function c(i,o){var s,u,l,d,f,h=e,p=o[i],g=null!=p&&(p instanceof r||r.isBigNumber(p));switch(p&&"object"===typeof p&&"function"===typeof p.toJSON&&(p=p.toJSON(i)),"function"===typeof n&&(p=n.call(o,i,p)),typeof p){case"string":return g?p:a(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":case"bigint":return String(p);case"object":if(!p)return"null";if(e+=t,f=[],"[object Array]"===Object.prototype.toString.apply(p)){for(d=p.length,s=0;sclass t extends i{constructor(t,n,r,i,o){super(o),this._rate=t,this._capacity=n,this._delimitedSuffix=r,this._hashBitLength=i,this._options=o,this._state=new e,this._state.initialize(t,n),this._finalized=!1}_transform(e,t,n){let r=null;try{this.update(e,t)}catch(i){r=i}n(r)}_flush(e){let t=null;try{this.push(this.digest())}catch(n){t=n}e(t)}update(e,t){if(!r.isBuffer(e)&&"string"!==typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return r.isBuffer(e)||(e=r.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}},5675:function(e,t,n){var r=n(48764).Buffer;const{Transform:i}=n(88473);e.exports=e=>class t extends i{constructor(t,n,r,i){super(i),this._rate=t,this._capacity=n,this._delimitedSuffix=r,this._options=i,this._state=new e,this._state.initialize(t,n),this._finalized=!1}_transform(e,t,n){let r=null;try{this.update(e,t)}catch(i){r=i}n(r)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!r.isBuffer(e)&&"string"!==typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return r.isBuffer(e)||(e=r.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let n=this._state.squeeze(e);return void 0!==t&&(n=n.toString(t)),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}},34040:function(e,t){const n=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];t.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],d=e[8]^e[18]^e[28]^e[38]^e[48],f=e[9]^e[19]^e[29]^e[39]^e[49];let h=d^(o<<1|s>>>31),p=f^(s<<1|o>>>31);const g=e[0]^h,m=e[1]^p,b=e[10]^h,y=e[11]^p,v=e[20]^h,w=e[21]^p,x=e[30]^h,S=e[31]^p,A=e[40]^h,E=e[41]^p;h=r^(a<<1|c>>>31),p=i^(c<<1|a>>>31);const _=e[2]^h,C=e[3]^p,I=e[12]^h,k=e[13]^p,T=e[22]^h,M=e[23]^p,P=e[32]^h,O=e[33]^p,R=e[42]^h,N=e[43]^p;h=o^(u<<1|l>>>31),p=s^(l<<1|u>>>31);const B=e[4]^h,L=e[5]^p,D=e[14]^h,U=e[15]^p,j=e[24]^h,F=e[25]^p,V=e[34]^h,q=e[35]^p,z=e[44]^h,H=e[45]^p;h=a^(d<<1|f>>>31),p=c^(f<<1|d>>>31);const W=e[6]^h,G=e[7]^p,Z=e[16]^h,K=e[17]^p,X=e[26]^h,Y=e[27]^p,J=e[36]^h,Q=e[37]^p,$=e[46]^h,ee=e[47]^p;h=u^(r<<1|i>>>31),p=l^(i<<1|r>>>31);const te=e[8]^h,ne=e[9]^p,re=e[18]^h,ie=e[19]^p,oe=e[28]^h,se=e[29]^p,ae=e[38]^h,ce=e[39]^p,ue=e[48]^h,le=e[49]^p,de=g,fe=m,he=y<<4|b>>>28,pe=b<<4|y>>>28,ge=v<<3|w>>>29,me=w<<3|v>>>29,be=S<<9|x>>>23,ye=x<<9|S>>>23,ve=A<<18|E>>>14,we=E<<18|A>>>14,xe=_<<1|C>>>31,Se=C<<1|_>>>31,Ae=k<<12|I>>>20,Ee=I<<12|k>>>20,_e=T<<10|M>>>22,Ce=M<<10|T>>>22,Ie=O<<13|P>>>19,ke=P<<13|O>>>19,Te=R<<2|N>>>30,Me=N<<2|R>>>30,Pe=L<<30|B>>>2,Oe=B<<30|L>>>2,Re=D<<6|U>>>26,Ne=U<<6|D>>>26,Be=F<<11|j>>>21,Le=j<<11|F>>>21,De=V<<15|q>>>17,Ue=q<<15|V>>>17,je=H<<29|z>>>3,Fe=z<<29|H>>>3,Ve=W<<28|G>>>4,qe=G<<28|W>>>4,ze=K<<23|Z>>>9,He=Z<<23|K>>>9,We=X<<25|Y>>>7,Ge=Y<<25|X>>>7,Ze=J<<21|Q>>>11,Ke=Q<<21|J>>>11,Xe=ee<<24|$>>>8,Ye=$<<24|ee>>>8,Je=te<<27|ne>>>5,Qe=ne<<27|te>>>5,$e=re<<20|ie>>>12,et=ie<<20|re>>>12,tt=se<<7|oe>>>25,nt=oe<<7|se>>>25,rt=ae<<8|ce>>>24,it=ce<<8|ae>>>24,ot=ue<<14|le>>>18,st=le<<14|ue>>>18;e[0]=de^~Ae&Be,e[1]=fe^~Ee&Le,e[10]=Ve^~$e&ge,e[11]=qe^~et&me,e[20]=xe^~Re&We,e[21]=Se^~Ne&Ge,e[30]=Je^~he&_e,e[31]=Qe^~pe&Ce,e[40]=Pe^~ze&tt,e[41]=Oe^~He&nt,e[2]=Ae^~Be&Ze,e[3]=Ee^~Le&Ke,e[12]=$e^~ge&Ie,e[13]=et^~me&ke,e[22]=Re^~We&rt,e[23]=Ne^~Ge&it,e[32]=he^~_e&De,e[33]=pe^~Ce&Ue,e[42]=ze^~tt&be,e[43]=He^~nt&ye,e[4]=Be^~Ze&ot,e[5]=Le^~Ke&st,e[14]=ge^~Ie&je,e[15]=me^~ke&Fe,e[24]=We^~rt&ve,e[25]=Ge^~it&we,e[34]=_e^~De&Xe,e[35]=Ce^~Ue&Ye,e[44]=tt^~be&Te,e[45]=nt^~ye&Me,e[6]=Ze^~ot&de,e[7]=Ke^~st&fe,e[16]=Ie^~je&Ve,e[17]=ke^~Fe&qe,e[26]=rt^~ve&xe,e[27]=it^~we&Se,e[36]=De^~Xe&Je,e[37]=Ue^~Ye&Qe,e[46]=be^~Te&Pe,e[47]=ye^~Me&Oe,e[8]=ot^~de&Ae,e[9]=st^~fe&Ee,e[18]=je^~Ve&$e,e[19]=Fe^~qe&et,e[28]=ve^~xe&Re,e[29]=we^~Se&Ne,e[38]=Xe^~Je&he,e[39]=Ye^~Qe&pe,e[48]=Te^~Pe&ze,e[49]=Me^~Oe&He,e[0]^=n[2*t],e[1]^=n[2*t+1]}}},79653:function(e,t,n){var r=n(48764).Buffer;const i=n(34040);function o(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}o.prototype.initialize=function(e,t){for(let n=0;n<50;++n)this.state[n]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},o.prototype.absorb=function(e){for(let t=0;t>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(i.p1600(this.state),this.count=0);return t},o.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},e.exports=o},47630:function(e){"use strict";for(var t=function(e){return null!==e&&!Array.isArray(e)&&"object"===typeof e},n={3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",28:"Convert",29:"NonConvert",30:"Accept",31:"ModeChange",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"},r=0;r<24;r+=1)n[112+r]="F"+(r+1);for(var i=0;i<26;i+=1){var o=i+65;n[o]=[String.fromCharCode(o+32),String.fromCharCode(o)]}var s={codes:n,getCode:function(e){return t(e)?e.keyCode||e.which||this[e.key]:this[e]},getKey:function(e){var r=t(e);if(r&&e.key)return e.key;var i=n[r?e.keyCode||e.which:e];return Array.isArray(i)&&(i=r?i[e.shiftKey?1:0]:i[0]),i},Cancel:3,Help:6,Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Convert:28,NonConvert:29,Accept:30,ModeChange:31," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Select:41,Print:42,Execute:43,PrintScreen:44,Insert:45,Delete:46,0:48,")":48,1:49,"!":49,2:50,"@":50,3:51,"#":51,4:52,$:52,5:53,"%":53,6:54,"^":54,7:55,"&":55,8:56,"*":56,9:57,"(":57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,OS:91,ContextMenu:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,NumLock:144,ScrollLock:145,VolumeMute:181,VolumeDown:182,VolumeUp:183,";":186,":":186,"=":187,"+":187,",":188,"<":188,"-":189,_:189,".":190,">":190,"/":191,"?":191,"`":192,"~":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"'":222,'"':222,Meta:224,AltGraph:225,Attn:246,CrSel:247,ExSel:248,EraseEof:249,Play:250,ZoomOut:251};s.Spacebar=s[" "],s.Digit0=s[0],s.Digit1=s[1],s.Digit2=s[2],s.Digit3=s[3],s.Digit4=s[4],s.Digit5=s[5],s.Digit6=s[6],s.Digit7=s[7],s.Digit8=s[8],s.Digit9=s[9],s.Tilde=s["~"],s.GraveAccent=s["`"],s.ExclamationPoint=s["!"],s.AtSign=s["@"],s.PoundSign=s["#"],s.PercentSign=s["%"],s.Caret=s["^"],s.Ampersand=s["&"],s.PlusSign=s["+"],s.MinusSign=s["-"],s.EqualsSign=s["="],s.DivisionSign=s["/"],s.MultiplicationSign=s["*"],s.Comma=s[","],s.Decimal=s["."],s.Colon=s[":"],s.Semicolon=s[";"],s.Pipe=s["|"],s.BackSlash=s["\\"],s.QuestionMark=s["?"],s.SingleQuote=s["'"],s.DoubleQuote=s['"'],s.LeftCurlyBrace=s["{"],s.RightCurlyBrace=s["}"],s.LeftParenthesis=s["("],s.RightParenthesis=s[")"],s.LeftAngleBracket=s["<"],s.RightAngleBracket=s[">"],s.LeftSquareBracket=s["["],s.RightSquareBracket=s["]"],e.exports=s},72307:function(e,t,n){e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Array]",a="[object Boolean]",c="[object Date]",u="[object Error]",l="[object Function]",d="[object Map]",f="[object Number]",h="[object Object]",p="[object Promise]",g="[object RegExp]",m="[object Set]",b="[object String]",y="[object Symbol]",v="[object WeakMap]",w="[object ArrayBuffer]",x="[object DataView]",S=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[o]=E[s]=E[w]=E[a]=E[x]=E[c]=E[u]=E[l]=E[d]=E[f]=E[h]=E[g]=E[m]=E[b]=E[v]=!1;var _="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,C="object"==typeof self&&self&&self.Object===Object&&self,I=_||C||Function("return this")(),k=t&&!t.nodeType&&t,T=k&&e&&!e.nodeType&&e,M=T&&T.exports===k,P=M&&_.process,O=function(){try{return P&&P.binding&&P.binding("util")}catch(e){}}(),R=O&&O.isTypedArray;function N(e,t){for(var n=-1,r=null==e?0:e.length;++na))return!1;var u=o.get(e);if(u&&o.get(t))return u==t;var l=-1,d=!0,f=2&n?new ve:void 0;for(o.set(e,t),o.set(t,e);++l-1},be.prototype.set=function(e,t){var n=this.__data__,r=Se(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ye.prototype.clear=function(){this.size=0,this.__data__={hash:new me,map:new(ie||be),string:new me}},ye.prototype.delete=function(e){var t=Me(this,e).delete(e);return this.size-=t?1:0,t},ye.prototype.get=function(e){return Me(this,e).get(e)},ye.prototype.has=function(e){return Me(this,e).has(e)},ye.prototype.set=function(e,t){var n=Me(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,r),this},ve.prototype.has=function(e){return this.__data__.has(e)},we.prototype.clear=function(){this.__data__=new be,this.size=0},we.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var n=this.__data__;if(n instanceof be){var r=n.__data__;if(!ie||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ye(r)}return n.set(e,t),this.size=n.size,this};var Oe=ee?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n-1&&e%1==0&&e-1&&e%1==0&&e<=i}function qe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ze(e){return null!=e&&"object"==typeof e}var He=R?function(e){return function(t){return e(t)}}(R):function(e){return ze(e)&&Ve(e.length)&&!!E[Ae(e)]};function We(e){return null!=(t=e)&&Ve(t.length)&&!Fe(t)?xe(e):Ie(e);var t}e.exports=function(e,t){return _e(e,t)}},72378:function(e,t,n){e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Function]",a="[object Object]",c=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[o]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[s]=l["[object Map]"]=l["[object Number]"]=l[a]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var d="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,f="object"==typeof self&&self&&self.Object===Object&&self,h=d||f||Function("return this")(),p=t&&!t.nodeType&&t,g=p&&e&&!e.nodeType&&e,m=g&&g.exports===p,b=m&&d.process,y=function(){try{var e=g&&g.require&&g.require("util").types;return e||b&&b.binding&&b.binding("util")}catch(t){}}(),v=y&&y.isTypedArray;function w(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var x,S,A=Array.prototype,E=Function.prototype,_=Object.prototype,C=h["__core-js_shared__"],I=E.toString,k=_.hasOwnProperty,T=function(){var e=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),M=_.toString,P=I.call(Object),O=RegExp("^"+I.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=m?h.Buffer:void 0,N=h.Symbol,B=h.Uint8Array,L=R?R.allocUnsafe:void 0,D=(x=Object.getPrototypeOf,S=Object,function(e){return x(S(e))}),U=Object.create,j=_.propertyIsEnumerable,F=A.splice,V=N?N.toStringTag:void 0,q=function(){try{var e=pe(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),z=R?R.isBuffer:void 0,H=Math.max,W=Date.now,G=pe(h,"Map"),Z=pe(Object,"create"),K=function(){function e(){}return function(t){if(!Ce(t))return{};if(U)return U(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function X(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Y.prototype.set=function(e,t){var n=this.__data__,r=ne(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new X,map:new(G||Y),string:new X}},J.prototype.delete=function(e){var t=he(this,e).delete(e);return this.size-=t?1:0,t},J.prototype.get=function(e){return he(this,e).get(e)},J.prototype.has=function(e){return he(this,e).has(e)},J.prototype.set=function(e,t){var n=he(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Q.prototype.clear=function(){this.__data__=new Y,this.size=0},Q.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Q.prototype.get=function(e){return this.__data__.get(e)},Q.prototype.has=function(e){return this.__data__.has(e)},Q.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Y){var r=n.__data__;if(!G||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new J(r)}return n.set(e,t),this.size=n.size,this};var ie,oe=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),s=o.length;s--;){var a=o[ie?s:++r];if(!1===t(i[a],a,i))break}return e};function se(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":V&&V in Object(e)?function(e){var t=k.call(e,V),n=e[V];try{e[V]=void 0;var r=!0}catch(o){}var i=M.call(e);r&&(t?e[V]=n:delete e[V]);return i}(e):function(e){return M.call(e)}(e)}function ae(e){return Ie(e)&&se(e)==o}function ce(e){return!(!Ce(e)||function(e){return!!T&&T in e}(e))&&(Ee(e)?O:c).test(function(e){if(null!=e){try{return I.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e))}function ue(e){if(!Ce(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=me(e),n=[];for(var r in e)("constructor"!=r||!t&&k.call(e,r))&&n.push(r);return n}function le(e,t,n,r,i){e!==t&&oe(t,(function(o,s){if(i||(i=new Q),Ce(o))!function(e,t,n,r,i,o,s){var c=be(e,n),u=be(t,n),l=s.get(u);if(l)return void ee(e,n,l);var d=o?o(c,u,n+"",e,t,s):void 0,f=void 0===d;if(f){var h=xe(u),p=!h&&Ae(u),g=!h&&!p&&ke(u);d=u,h||p||g?xe(c)?d=c:Ie(m=c)&&Se(m)?d=function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n-1&&e%1==0&&e0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(fe);function ve(e,t){return e===t||e!==e&&t!==t}var we=ae(function(){return arguments}())?ae:function(e){return Ie(e)&&k.call(e,"callee")&&!j.call(e,"callee")},xe=Array.isArray;function Se(e){return null!=e&&_e(e.length)&&!Ee(e)}var Ae=z||function(){return!1};function Ee(e){if(!Ce(e))return!1;var t=se(e);return t==s||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function _e(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function Ce(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ie(e){return null!=e&&"object"==typeof e}var ke=v?function(e){return function(t){return e(t)}}(v):function(e){return Ie(e)&&_e(e.length)&&!!l[se(e)]};function Te(e){return Se(e)?$(e,!0):ue(e)}var Me,Pe=(Me=function(e,t,n){le(e,t,n)},de((function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=Me.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!Ce(n))return!1;var r=typeof t;return!!("number"==r?Se(n)&&ge(t,n.length):"string"==r&&t in n)&&ve(n[t],e)}(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n"']/g,Y=RegExp(K.source),J=RegExp(X.source),Q=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ie=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(ie.source),se=/^\s+/,ae=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,le=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ge=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,ye=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,we=/^(?:0|[1-9]\d*)$/,xe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Se=/($^)/,Ae=/['\n\r\u2028\u2029\\]/g,Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="\\u2700-\\u27bf",Ce="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",ke="\\ufe0e\\ufe0f",Te="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Me="['\u2019]",Pe="[\\ud800-\\udfff]",Oe="["+Te+"]",Re="["+Ee+"]",Ne="\\d+",Be="[\\u2700-\\u27bf]",Le="["+Ce+"]",De="[^\\ud800-\\udfff"+Te+Ne+_e+Ce+Ie+"]",Ue="\\ud83c[\\udffb-\\udfff]",je="[^\\ud800-\\udfff]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",Ve="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Ie+"]",ze="(?:"+Le+"|"+De+")",He="(?:"+qe+"|"+De+")",We="(?:['\u2019](?:d|ll|m|re|s|t|ve))?",Ge="(?:['\u2019](?:D|LL|M|RE|S|T|VE))?",Ze="(?:"+Re+"|"+Ue+")"+"?",Ke="[\\ufe0e\\ufe0f]?",Xe=Ke+Ze+("(?:\\u200d(?:"+[je,Fe,Ve].join("|")+")"+Ke+Ze+")*"),Ye="(?:"+[Be,Fe,Ve].join("|")+")"+Xe,Je="(?:"+[je+Re+"?",Re,Fe,Ve,Pe].join("|")+")",Qe=RegExp(Me,"g"),$e=RegExp(Re,"g"),et=RegExp(Ue+"(?="+Ue+")|"+Je+Xe,"g"),tt=RegExp([qe+"?"+Le+"+"+We+"(?="+[Oe,qe,"$"].join("|")+")",He+"+"+Ge+"(?="+[Oe,qe+ze,"$"].join("|")+")",qe+"?"+ze+"+"+We,qe+"+"+Ge,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ne,Ye].join("|"),"g"),nt=RegExp("[\\u200d\\ud800-\\udfff"+Ee+ke+"]"),rt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,st={};st[L]=st[D]=st[U]=st[j]=st[F]=st[V]=st[q]=st[z]=st[H]=!0,st[y]=st[v]=st[N]=st[w]=st[B]=st[x]=st[S]=st[A]=st[_]=st[C]=st[I]=st[T]=st[M]=st[P]=st[R]=!1;var at={};at[y]=at[v]=at[N]=at[B]=at[w]=at[x]=at[L]=at[D]=at[U]=at[j]=at[F]=at[_]=at[C]=at[I]=at[T]=at[M]=at[P]=at[O]=at[V]=at[q]=at[z]=at[H]=!0,at[S]=at[A]=at[R]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,dt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ft="object"==typeof self&&self&&self.Object===Object&&self,ht=dt||ft||Function("return this")(),pt=t&&!t.nodeType&&t,gt=pt&&e&&!e.nodeType&&e,mt=gt&>.exports===pt,bt=mt&&dt.process,yt=function(){try{var e=gt&>.require&>.require("util").types;return e||bt&&bt.binding&&bt.binding("util")}catch(t){}}(),vt=yt&&yt.isArrayBuffer,wt=yt&&yt.isDate,xt=yt&&yt.isMap,St=yt&&yt.isRegExp,At=yt&&yt.isSet,Et=yt&&yt.isTypedArray;function _t(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Ct(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ot(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function tn(e,t){for(var n=e.length;n--&&Vt(t,e[n],0)>-1;);return n}function nn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var rn=Gt({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),on=Gt({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+ct[e]}function an(e){return nt.test(e)}function cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function un(e,t){return function(n){return e(t(n))}}function ln(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"});var bn=function e(t){var n=(t=null==t?ht:bn.defaults(ht.Object(),t,bn.pick(ht,it))).Array,r=t.Date,ae=t.Error,Ee=t.Function,_e=t.Math,Ce=t.Object,Ie=t.RegExp,ke=t.String,Te=t.TypeError,Me=n.prototype,Pe=Ee.prototype,Oe=Ce.prototype,Re=t["__core-js_shared__"],Ne=Pe.toString,Be=Oe.hasOwnProperty,Le=0,De=function(){var e=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ue=Oe.toString,je=Ne.call(Ce),Fe=ht._,Ve=Ie("^"+Ne.call(Be).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=mt?t.Buffer:i,ze=t.Symbol,He=t.Uint8Array,We=qe?qe.allocUnsafe:i,Ge=un(Ce.getPrototypeOf,Ce),Ze=Ce.create,Ke=Oe.propertyIsEnumerable,Xe=Me.splice,Ye=ze?ze.isConcatSpreadable:i,Je=ze?ze.iterator:i,et=ze?ze.toStringTag:i,nt=function(){try{var e=ho(Ce,"defineProperty");return e({},"",{}),e}catch(t){}}(),ct=t.clearTimeout!==ht.clearTimeout&&t.clearTimeout,dt=r&&r.now!==ht.Date.now&&r.now,ft=t.setTimeout!==ht.setTimeout&&t.setTimeout,pt=_e.ceil,gt=_e.floor,bt=Ce.getOwnPropertySymbols,yt=qe?qe.isBuffer:i,Ut=t.isFinite,Gt=Me.join,yn=un(Ce.keys,Ce),vn=_e.max,wn=_e.min,xn=r.now,Sn=t.parseInt,An=_e.random,En=Me.reverse,_n=ho(t,"DataView"),Cn=ho(t,"Map"),In=ho(t,"Promise"),kn=ho(t,"Set"),Tn=ho(t,"WeakMap"),Mn=ho(Ce,"create"),Pn=Tn&&new Tn,On={},Rn=Fo(_n),Nn=Fo(Cn),Bn=Fo(In),Ln=Fo(kn),Dn=Fo(Tn),Un=ze?ze.prototype:i,jn=Un?Un.valueOf:i,Fn=Un?Un.toString:i;function Vn(e){if(ra(e)&&!Gs(e)&&!(e instanceof Wn)){if(e instanceof Hn)return e;if(Be.call(e,"__wrapped__"))return Vo(e)}return new Hn(e)}var qn=function(){function e(){}return function(t){if(!na(t))return{};if(Ze)return Ze(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function zn(){}function Hn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Wn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ur(e,t,n,r,o,s){var a,c=1&t,u=2&t,l=4&t;if(n&&(a=o?n(e,r,o,s):n(e)),a!==i)return a;if(!na(e))return e;var d=Gs(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Be.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Mi(e,a)}else{var f=mo(e),h=f==A||f==E;if(Ys(e))return Ei(e,c);if(f==I||f==y||h&&!o){if(a=u||h?{}:yo(e),!c)return u?function(e,t){return Pi(e,go(e),t)}(e,function(e,t){return e&&Pi(t,Na(t),e)}(a,e)):function(e,t){return Pi(e,po(e),t)}(e,or(a,e))}else{if(!at[f])return o?e:{};a=function(e,t,n){var r=e.constructor;switch(t){case N:return _i(e);case w:case x:return new r(+e);case B:return function(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case L:case D:case U:case j:case F:case V:case q:case z:case H:return Ci(e,n);case _:return new r;case C:case P:return new r(e);case T:return function(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case M:return new r;case O:return i=e,jn?Ce(jn.call(i)):{}}var i}(e,f,c)}}s||(s=new Yn);var p=s.get(e);if(p)return p;s.set(e,a),ca(e)?e.forEach((function(r){a.add(ur(r,t,n,r,e,s))})):ia(e)&&e.forEach((function(r,i){a.set(i,ur(r,t,n,i,e,s))}));var g=d?i:(l?u?oo:io:u?Na:Ra)(e);return It(g||e,(function(r,i){g&&(r=e[i=r]),nr(a,i,ur(r,t,n,i,e,s))})),a}function lr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Ce(e);r--;){var o=n[r],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function dr(e,t,n){if("function"!=typeof e)throw new Te(o);return Ro((function(){e.apply(i,n)}),t)}function fr(e,t,n,r){var i=-1,o=Pt,s=!0,a=e.length,c=[],u=t.length;if(!a)return c;n&&(t=Rt(t,Jt(n))),r?(o=Ot,s=!1):t.length>=200&&(o=$t,s=!1,t=new Xn(t));e:for(;++i-1},Zn.prototype.set=function(e,t){var n=this.__data__,r=rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Kn.prototype.clear=function(){this.size=0,this.__data__={hash:new Gn,map:new(Cn||Zn),string:new Gn}},Kn.prototype.delete=function(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t},Kn.prototype.get=function(e){return lo(this,e).get(e)},Kn.prototype.has=function(e){return lo(this,e).has(e)},Kn.prototype.set=function(e,t){var n=lo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(e){return this.__data__.set(e,s),this},Xn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Zn,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Zn){var r=n.__data__;if(!Cn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Kn(r)}return n.set(e,t),this.size=n.size,this};var hr=Ni(xr),pr=Ni(Sr,!0);function gr(e,t){var n=!0;return hr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function mr(e,t,n){for(var r=-1,o=e.length;++r0&&n(a)?t>1?yr(a,t-1,n,r,i):Nt(i,a):r||(i[i.length]=a)}return i}var vr=Bi(),wr=Bi(!0);function xr(e,t){return e&&vr(e,t,Ra)}function Sr(e,t){return e&&wr(e,t,Ra)}function Ar(e,t){return Mt(t,(function(t){return $s(e[t])}))}function Er(e,t){for(var n=0,r=(t=wi(t,e)).length;null!=e&&nt}function kr(e,t){return null!=e&&Be.call(e,t)}function Tr(e,t){return null!=e&&t in Ce(e)}function Mr(e,t,r){for(var o=r?Ot:Pt,s=e[0].length,a=e.length,c=a,u=n(a),l=1/0,d=[];c--;){var f=e[c];c&&t&&(f=Rt(f,Jt(t))),l=wn(f.length,l),u[c]=!r&&(t||s>=120&&f.length>=120)?new Xn(c&&f):i}f=e[0];var h=-1,p=u[0];e:for(;++h=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Gr(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)a!==e&&Xe.call(a,c,1),Xe.call(e,c,1);return e}function Kr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;wo(i)?Xe.call(e,i,1):fi(e,i)}}return e}function Xr(e,t){return e+gt(An()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>p)return n;do{t%2&&(n+=e),(t=gt(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return No(ko(e,t,oc),e+"")}function Qr(e){return Qn(qa(e))}function $r(e,t){var n=qa(e);return Do(n,cr(t,0,n.length))}function ei(e,t,n,r){if(!na(e))return e;for(var o=-1,s=(t=wi(t,e)).length,a=s-1,c=e;null!=c&&++oo?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var s=n(o);++i>>1,s=e[o];null!==s&&!la(s)&&(n?s<=t:s=200){var u=t?null:Yi(e);if(u)return dn(u);s=!1,i=$t,c=new Xn}else c=t?[]:a;e:for(;++r=r?e:ii(e,t,n)}var Ai=ct||function(e){return ht.clearTimeout(e)};function Ei(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function _i(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function Ci(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ii(e,t){if(e!==t){var n=e!==i,r=null===e,o=e===e,s=la(e),a=t!==i,c=null===t,u=t===t,l=la(t);if(!c&&!l&&!s&&e>t||s&&a&&u&&!c&&!l||r&&a&&u||!n&&u||!o)return 1;if(!r&&!s&&!l&&e1?n[o-1]:i,a=o>2?n[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&xo(n[0],n[1],a)&&(s=o<3?i:s,o=1),t=Ce(t);++r-1?o[s?t[a]:a]:i}}function Fi(e){return ro((function(t){var n=t.length,r=n,s=Hn.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new Te(o);if(s&&!c&&"wrapper"==ao(a))var c=new Hn([],!0)}for(r=c?r:n;++r1&&v.reverse(),h&&lc))return!1;var l=s.get(e),d=s.get(t);if(l&&d)return l==t&&d==e;var f=-1,h=!0,p=2&n?new Xn:i;for(s.set(e,t),s.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return It(b,(function(n){var r="_."+n[0];t&n[1]&&!Pt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(le):[]}(r),n)))}function Lo(e){var t=0,n=0;return function(){var r=xn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Do(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,as(e,n)}));function ps(e){var t=Vn(e);return t.__chain__=!0,t}function gs(e,t){return t(e)}var ms=ro((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ar(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Wn&&wo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:gs,args:[o],thisArg:i}),new Hn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)}));var bs=Oi((function(e,t,n){Be.call(e,n)?++e[n]:sr(e,n,1)}));var ys=ji(Wo),vs=ji(Go);function ws(e,t){return(Gs(e)?It:hr)(e,uo(t,3))}function xs(e,t){return(Gs(e)?kt:pr)(e,uo(t,3))}var Ss=Oi((function(e,t,n){Be.call(e,n)?e[n].push(t):sr(e,n,[t])}));var As=Jr((function(e,t,r){var i=-1,o="function"==typeof t,s=Ks(e)?n(e.length):[];return hr(e,(function(e){s[++i]=o?_t(t,e,r):Pr(e,t,r)})),s})),Es=Oi((function(e,t,n){sr(e,n,t)}));function _s(e,t){return(Gs(e)?Rt:Fr)(e,uo(t,3))}var Cs=Oi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Is=Jr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&xo(e,t[0],t[1])?t=[]:n>2&&xo(t[0],t[1],t[2])&&(t=[t[0]]),Wr(e,yr(t,1),[])})),ks=dt||function(){return ht.Date.now()};function Ts(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Qi(e,d,i,i,i,i,t)}function Ms(e,t){var n;if("function"!=typeof t)throw new Te(o);return e=ma(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ps=Jr((function(e,t,n){var r=1;if(n.length){var i=ln(n,co(Ps));r|=u}return Qi(e,r,t,n,i)})),Os=Jr((function(e,t,n){var r=3;if(n.length){var i=ln(n,co(Os));r|=u}return Qi(t,r,e,n,i)}));function Rs(e,t,n){var r,s,a,c,u,l,d=0,f=!1,h=!1,p=!0;if("function"!=typeof e)throw new Te(o);function g(t){var n=r,o=s;return r=s=i,d=t,c=e.apply(o,n)}function m(e){return d=e,u=Ro(y,t),f?g(e):c}function b(e){var n=e-l;return l===i||n>=t||n<0||h&&e-d>=a}function y(){var e=ks();if(b(e))return v(e);u=Ro(y,function(e){var n=t-(e-l);return h?wn(n,a-(e-d)):n}(e))}function v(e){return u=i,p&&r?g(e):(r=s=i,c)}function w(){var e=ks(),n=b(e);if(r=arguments,s=this,l=e,n){if(u===i)return m(l);if(h)return Ai(u),u=Ro(y,t),g(l)}return u===i&&(u=Ro(y,t)),c}return t=ya(t)||0,na(n)&&(f=!!n.leading,a=(h="maxWait"in n)?vn(ya(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p),w.cancel=function(){u!==i&&Ai(u),d=0,r=l=s=u=i},w.flush=function(){return u===i?c:v(ks())},w}var Ns=Jr((function(e,t){return dr(e,1,t)})),Bs=Jr((function(e,t,n){return dr(e,ya(t)||0,n)}));function Ls(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Te(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ls.Cache||Kn),n}function Ds(e){if("function"!=typeof e)throw new Te(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ls.Cache=Kn;var Us=xi((function(e,t){var n=(t=1==t.length&&Gs(t[0])?Rt(t[0],Jt(uo())):Rt(yr(t,1),Jt(uo()))).length;return Jr((function(r){for(var i=-1,o=wn(r.length,n);++i=t})),Ws=Or(function(){return arguments}())?Or:function(e){return ra(e)&&Be.call(e,"callee")&&!Ke.call(e,"callee")},Gs=n.isArray,Zs=vt?Jt(vt):function(e){return ra(e)&&Cr(e)==N};function Ks(e){return null!=e&&ta(e.length)&&!$s(e)}function Xs(e){return ra(e)&&Ks(e)}var Ys=yt||yc,Js=wt?Jt(wt):function(e){return ra(e)&&Cr(e)==x};function Qs(e){if(!ra(e))return!1;var t=Cr(e);return t==S||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!sa(e)}function $s(e){if(!na(e))return!1;var t=Cr(e);return t==A||t==E||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ea(e){return"number"==typeof e&&e==ma(e)}function ta(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function na(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ra(e){return null!=e&&"object"==typeof e}var ia=xt?Jt(xt):function(e){return ra(e)&&mo(e)==_};function oa(e){return"number"==typeof e||ra(e)&&Cr(e)==C}function sa(e){if(!ra(e)||Cr(e)!=I)return!1;var t=Ge(e);if(null===t)return!0;var n=Be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ne.call(n)==je}var aa=St?Jt(St):function(e){return ra(e)&&Cr(e)==T};var ca=At?Jt(At):function(e){return ra(e)&&mo(e)==M};function ua(e){return"string"==typeof e||!Gs(e)&&ra(e)&&Cr(e)==P}function la(e){return"symbol"==typeof e||ra(e)&&Cr(e)==O}var da=Et?Jt(Et):function(e){return ra(e)&&ta(e.length)&&!!st[Cr(e)]};var fa=Zi(jr),ha=Zi((function(e,t){return e<=t}));function pa(e){if(!e)return[];if(Ks(e))return ua(e)?pn(e):Mi(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());var t=mo(e);return(t==_?cn:t==M?dn:qa)(e)}function ga(e){return e?(e=ya(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e===e?e:0:0===e?e:0}function ma(e){var t=ga(e),n=t%1;return t===t?n?t-n:t:0}function ba(e){return e?cr(ma(e),0,m):0}function ya(e){if("number"==typeof e)return e;if(la(e))return g;if(na(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=na(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):me.test(e)?g:+e}function va(e){return Pi(e,Na(e))}function wa(e){return null==e?"":li(e)}var xa=Ri((function(e,t){if(_o(t)||Ks(t))Pi(t,Ra(t),e);else for(var n in t)Be.call(t,n)&&nr(e,n,t[n])})),Sa=Ri((function(e,t){Pi(t,Na(t),e)})),Aa=Ri((function(e,t,n,r){Pi(t,Na(t),e,r)})),Ea=Ri((function(e,t,n,r){Pi(t,Ra(t),e,r)})),_a=ro(ar);var Ca=Jr((function(e,t){e=Ce(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&xo(t[0],t[1],o)&&(r=1);++n1),t})),Pi(e,oo(e),n),r&&(n=ur(n,7,to));for(var i=t.length;i--;)fi(n,t[i]);return n}));var Ua=ro((function(e,t){return null==e?{}:function(e,t){return Gr(e,t,(function(t,n){return Ta(e,n)}))}(e,t)}));function ja(e,t){if(null==e)return{};var n=Rt(oo(e),(function(e){return[e]}));return t=uo(t),Gr(e,n,(function(e,n){return t(e,n[0])}))}var Fa=Ji(Ra),Va=Ji(Na);function qa(e){return null==e?[]:Qt(e,Ra(e))}var za=Di((function(e,t,n){return t=t.toLowerCase(),e+(n?Ha(t):t)}));function Ha(e){return Qa(wa(e).toLowerCase())}function Wa(e){return(e=wa(e))&&e.replace(xe,rn).replace($e,"")}var Ga=Di((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Za=Di((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ka=Li("toLowerCase");var Xa=Di((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Ya=Di((function(e,t,n){return e+(n?" ":"")+Qa(t)}));var Ja=Di((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Qa=Li("toUpperCase");function $a(e,t,n){return e=wa(e),(t=n?i:t)===i?function(e){return rt.test(e)}(e)?function(e){return e.match(tt)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var ec=Jr((function(e,t){try{return _t(e,i,t)}catch(n){return Qs(n)?n:new ae(n)}})),tc=ro((function(e,t){return It(t,(function(t){t=jo(t),sr(e,t,Ps(e[t],e))})),e}));function nc(e){return function(){return e}}var rc=Fi(),ic=Fi(!0);function oc(e){return e}function sc(e){return Lr("function"==typeof e?e:ur(e,1))}var ac=Jr((function(e,t){return function(n){return Pr(n,e,t)}})),cc=Jr((function(e,t){return function(n){return Pr(e,n,t)}}));function uc(e,t,n){var r=Ra(t),i=Ar(t,r);null!=n||na(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Ar(t,Ra(t)));var o=!(na(n)&&"chain"in n)||!!n.chain,s=$s(e);return It(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=Mi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Nt([this.value()],arguments))})})),e}function lc(){}var dc=Hi(Rt),fc=Hi(Tt),hc=Hi(Dt);function pc(e){return So(e)?Wt(jo(e)):function(e){return function(t){return Er(t,e)}}(e)}var gc=Gi(),mc=Gi(!0);function bc(){return[]}function yc(){return!1}var vc=zi((function(e,t){return e+t}),0),wc=Xi("ceil"),xc=zi((function(e,t){return e/t}),1),Sc=Xi("floor");var Ac=zi((function(e,t){return e*t}),1),Ec=Xi("round"),_c=zi((function(e,t){return e-t}),0);return Vn.after=function(e,t){if("function"!=typeof t)throw new Te(o);return e=ma(e),function(){if(--e<1)return t.apply(this,arguments)}},Vn.ary=Ts,Vn.assign=xa,Vn.assignIn=Sa,Vn.assignInWith=Aa,Vn.assignWith=Ea,Vn.at=_a,Vn.before=Ms,Vn.bind=Ps,Vn.bindAll=tc,Vn.bindKey=Os,Vn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Gs(e)?e:[e]},Vn.chain=ps,Vn.chunk=function(e,t,r){t=(r?xo(e,t,r):t===i)?1:vn(ma(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,c=n(pt(o/t));so?0:o+n),(r=r===i||r>o?o:ma(r))<0&&(r+=o),r=n>r?0:ba(r);n>>0)?(e=wa(e))&&("string"==typeof t||null!=t&&!aa(t))&&!(t=li(t))&&an(e)?Si(pn(e),0,n):e.split(t,n):[]},Vn.spread=function(e,t){if("function"!=typeof e)throw new Te(o);return t=null==t?0:vn(ma(t),0),Jr((function(n){var r=n[t],i=Si(n,0,t);return r&&Nt(i,r),_t(e,this,i)}))},Vn.tail=function(e){var t=null==e?0:e.length;return t?ii(e,1,t):[]},Vn.take=function(e,t,n){return e&&e.length?ii(e,0,(t=n||t===i?1:ma(t))<0?0:t):[]},Vn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ii(e,(t=r-(t=n||t===i?1:ma(t)))<0?0:t,r):[]},Vn.takeRightWhile=function(e,t){return e&&e.length?pi(e,uo(t,3),!1,!0):[]},Vn.takeWhile=function(e,t){return e&&e.length?pi(e,uo(t,3)):[]},Vn.tap=function(e,t){return t(e),e},Vn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Te(o);return na(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Rs(e,t,{leading:r,maxWait:t,trailing:i})},Vn.thru=gs,Vn.toArray=pa,Vn.toPairs=Fa,Vn.toPairsIn=Va,Vn.toPath=function(e){return Gs(e)?Rt(e,jo):la(e)?[e]:Mi(Uo(wa(e)))},Vn.toPlainObject=va,Vn.transform=function(e,t,n){var r=Gs(e),i=r||Ys(e)||da(e);if(t=uo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:na(e)&&$s(o)?qn(Ge(e)):{}}return(i?It:xr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Vn.unary=function(e){return Ts(e,1)},Vn.union=rs,Vn.unionBy=is,Vn.unionWith=os,Vn.uniq=function(e){return e&&e.length?di(e):[]},Vn.uniqBy=function(e,t){return e&&e.length?di(e,uo(t,2)):[]},Vn.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?di(e,i,t):[]},Vn.unset=function(e,t){return null==e||fi(e,t)},Vn.unzip=ss,Vn.unzipWith=as,Vn.update=function(e,t,n){return null==e?e:hi(e,t,vi(n))},Vn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:hi(e,t,vi(n),r)},Vn.values=qa,Vn.valuesIn=function(e){return null==e?[]:Qt(e,Na(e))},Vn.without=cs,Vn.words=$a,Vn.wrap=function(e,t){return js(vi(t),e)},Vn.xor=us,Vn.xorBy=ls,Vn.xorWith=ds,Vn.zip=fs,Vn.zipObject=function(e,t){return bi(e||[],t||[],nr)},Vn.zipObjectDeep=function(e,t){return bi(e||[],t||[],ei)},Vn.zipWith=hs,Vn.entries=Fa,Vn.entriesIn=Va,Vn.extend=Sa,Vn.extendWith=Aa,uc(Vn,Vn),Vn.add=vc,Vn.attempt=ec,Vn.camelCase=za,Vn.capitalize=Ha,Vn.ceil=wc,Vn.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ya(n))===n?n:0),t!==i&&(t=(t=ya(t))===t?t:0),cr(ya(e),t,n)},Vn.clone=function(e){return ur(e,4)},Vn.cloneDeep=function(e){return ur(e,5)},Vn.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:i)},Vn.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:i)},Vn.conformsTo=function(e,t){return null==t||lr(e,t,Ra(t))},Vn.deburr=Wa,Vn.defaultTo=function(e,t){return null==e||e!==e?t:e},Vn.divide=xc,Vn.endsWith=function(e,t,n){e=wa(e),t=li(t);var r=e.length,o=n=n===i?r:cr(ma(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Vn.eq=qs,Vn.escape=function(e){return(e=wa(e))&&J.test(e)?e.replace(X,on):e},Vn.escapeRegExp=function(e){return(e=wa(e))&&oe.test(e)?e.replace(ie,"\\$&"):e},Vn.every=function(e,t,n){var r=Gs(e)?Tt:gr;return n&&xo(e,t,n)&&(t=i),r(e,uo(t,3))},Vn.find=ys,Vn.findIndex=Wo,Vn.findKey=function(e,t){return jt(e,uo(t,3),xr)},Vn.findLast=vs,Vn.findLastIndex=Go,Vn.findLastKey=function(e,t){return jt(e,uo(t,3),Sr)},Vn.floor=Sc,Vn.forEach=ws,Vn.forEachRight=xs,Vn.forIn=function(e,t){return null==e?e:vr(e,uo(t,3),Na)},Vn.forInRight=function(e,t){return null==e?e:wr(e,uo(t,3),Na)},Vn.forOwn=function(e,t){return e&&xr(e,uo(t,3))},Vn.forOwnRight=function(e,t){return e&&Sr(e,uo(t,3))},Vn.get=ka,Vn.gt=zs,Vn.gte=Hs,Vn.has=function(e,t){return null!=e&&bo(e,t,kr)},Vn.hasIn=Ta,Vn.head=Ko,Vn.identity=oc,Vn.includes=function(e,t,n,r){e=Ks(e)?e:qa(e),n=n&&!r?ma(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),ua(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Vt(e,t,n)>-1},Vn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Vt(e,t,i)},Vn.inRange=function(e,t,n){return t=ga(t),n===i?(n=t,t=0):n=ga(n),function(e,t,n){return e>=wn(t,n)&&e=-9007199254740991&&e<=p},Vn.isSet=ca,Vn.isString=ua,Vn.isSymbol=la,Vn.isTypedArray=da,Vn.isUndefined=function(e){return e===i},Vn.isWeakMap=function(e){return ra(e)&&mo(e)==R},Vn.isWeakSet=function(e){return ra(e)&&"[object WeakSet]"==Cr(e)},Vn.join=function(e,t){return null==e?"":Gt.call(e,t)},Vn.kebabCase=Ga,Vn.last=Qo,Vn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ma(n))<0?vn(r+o,0):wn(o,r-1)),t===t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Ft(e,zt,o,!0)},Vn.lowerCase=Za,Vn.lowerFirst=Ka,Vn.lt=fa,Vn.lte=ha,Vn.max=function(e){return e&&e.length?mr(e,oc,Ir):i},Vn.maxBy=function(e,t){return e&&e.length?mr(e,uo(t,2),Ir):i},Vn.mean=function(e){return Ht(e,oc)},Vn.meanBy=function(e,t){return Ht(e,uo(t,2))},Vn.min=function(e){return e&&e.length?mr(e,oc,jr):i},Vn.minBy=function(e,t){return e&&e.length?mr(e,uo(t,2),jr):i},Vn.stubArray=bc,Vn.stubFalse=yc,Vn.stubObject=function(){return{}},Vn.stubString=function(){return""},Vn.stubTrue=function(){return!0},Vn.multiply=Ac,Vn.nth=function(e,t){return e&&e.length?Hr(e,ma(t)):i},Vn.noConflict=function(){return ht._===this&&(ht._=Fe),this},Vn.noop=lc,Vn.now=ks,Vn.pad=function(e,t,n){e=wa(e);var r=(t=ma(t))?hn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Wi(gt(i),n)+e+Wi(pt(i),n)},Vn.padEnd=function(e,t,n){e=wa(e);var r=(t=ma(t))?hn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=An();return wn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Xr(e,t)},Vn.reduce=function(e,t,n){var r=Gs(e)?Bt:Zt,i=arguments.length<3;return r(e,uo(t,4),n,i,hr)},Vn.reduceRight=function(e,t,n){var r=Gs(e)?Lt:Zt,i=arguments.length<3;return r(e,uo(t,4),n,i,pr)},Vn.repeat=function(e,t,n){return t=(n?xo(e,t,n):t===i)?1:ma(t),Yr(wa(e),t)},Vn.replace=function(){var e=arguments,t=wa(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Vn.result=function(e,t,n){var r=-1,o=(t=wi(t,e)).length;for(o||(o=1,e=i);++rp)return[];var n=m,r=wn(e,m);t=uo(t),e-=m;for(var i=Xt(r,t);++n=s)return e;var c=n-hn(r);if(c<1)return r;var u=a?Si(a,0,c).join(""):e.slice(0,c);if(o===i)return u+r;if(a&&(c+=u.length-c),aa(o)){if(e.slice(c).search(o)){var l,d=u;for(o.global||(o=Ie(o.source,wa(ge.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var f=l.index;u=u.slice(0,f===i?c:f)}}else if(e.indexOf(li(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+r},Vn.unescape=function(e){return(e=wa(e))&&Y.test(e)?e.replace(K,mn):e},Vn.uniqueId=function(e){var t=++Le;return wa(e)+t},Vn.upperCase=Ja,Vn.upperFirst=Qa,Vn.each=ws,Vn.eachRight=xs,Vn.first=Ko,uc(Vn,function(){var e={};return xr(Vn,(function(t,n){Be.call(Vn.prototype,n)||(e[n]=t)})),e}(),{chain:!1}),Vn.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Vn[e].placeholder=Vn})),It(["drop","take"],(function(e,t){Wn.prototype[e]=function(n){n=n===i?1:vn(ma(n),0);var r=this.__filtered__&&!t?new Wn(this):this.clone();return r.__filtered__?r.__takeCount__=wn(n,r.__takeCount__):r.__views__.push({size:wn(n,m),type:e+(r.__dir__<0?"Right":"")}),r},Wn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),It(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Wn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:uo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),It(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Wn.prototype[e]=function(){return this[n](1).value()[0]}})),It(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Wn.prototype[e]=function(){return this.__filtered__?new Wn(this):this[n](1)}})),Wn.prototype.compact=function(){return this.filter(oc)},Wn.prototype.find=function(e){return this.filter(e).head()},Wn.prototype.findLast=function(e){return this.reverse().find(e)},Wn.prototype.invokeMap=Jr((function(e,t){return"function"==typeof e?new Wn(this):this.map((function(n){return Pr(n,e,t)}))})),Wn.prototype.reject=function(e){return this.filter(Ds(uo(e)))},Wn.prototype.slice=function(e,t){e=ma(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Wn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=ma(t))<0?n.dropRight(-t):n.take(t-e)),n)},Wn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Wn.prototype.toArray=function(){return this.take(m)},xr(Wn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Vn[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);o&&(Vn.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,c=t instanceof Wn,u=a[0],l=c||Gs(t),d=function(e){var t=o.apply(Vn,Nt([e],a));return r&&f?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,h=!!this.__actions__.length,p=s&&!f,g=c&&!h;if(!s&&l){t=g?t:new Wn(this);var m=e.apply(t,a);return m.__actions__.push({func:gs,args:[d],thisArg:i}),new Hn(m,f)}return p&&g?e.apply(this,a):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})})),It(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Me[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Vn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Gs(i)?i:[],e)}return this[n]((function(n){return t.apply(Gs(n)?n:[],e)}))}})),xr(Wn.prototype,(function(e,t){var n=Vn[t];if(n){var r=n.name+"";Be.call(On,r)||(On[r]=[]),On[r].push({name:t,func:n})}})),On[Vi(i,2).name]=[{name:"wrapper",func:i}],Wn.prototype.clone=function(){var e=new Wn(this.__wrapped__);return e.__actions__=Mi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Mi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Mi(this.__views__),e},Wn.prototype.reverse=function(){if(this.__filtered__){var e=new Wn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Wn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Gs(e),r=t<0,i=n?e.length:0,o=function(e,t,n){var r=-1,i=n.length;for(;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Vn.prototype.plant=function(e){for(var t,n=this;n instanceof zn;){var r=Vo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Vn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Wn){var t=e;return this.__actions__.length&&(t=new Wn(this)),(t=t.reverse()).__actions__.push({func:gs,args:[ns],thisArg:i}),new Hn(t,this.__chain__)}return this.thru(ns)},Vn.prototype.toJSON=Vn.prototype.valueOf=Vn.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},Vn.prototype.first=Vn.prototype.head,Je&&(Vn.prototype[Je]=function(){return this}),Vn}();ht._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},79746:function(e){function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},34504:function(e,t){"use strict";var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}},29204:function(e){function t(e,t){if(!e)throw new Error(t||"AssertionError")}t.notEqual=function(e,n,r){t(e!=n,r)},t.notOk=function(e,n){t(!e,n)},t.equal=function(e,n,r){t(e==n,r)},t.ok=t,e.exports=t},98255:function(e,t,n){"use strict";var r=n(59499),i=n(67294),o=n(80967),s=n(54335),a=n(85893);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}t.Z=i.memo((0,s.ZP)((function(e){return(0,a.jsx)(o.Z,function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=e.className,n=e.children,r=e.style,o=void 0===r?{}:r,s=(0,i.Z)(e,u);return(0,c.jsxs)("div",d(d({className:t,style:d({display:"flex"},o)},s),{},{children:[(0,c.jsx)("div",{style:{flex:1,height:1,width:1}}),n,(0,c.jsx)("div",{style:{flex:1,height:1,width:1}})]}))}var h=a.ZP.div.withConfig({displayName:"layout__RowFlex",componentId:"sc-11ag14j-0"})(["display:flex;flex-direction:row;"]),p=a.ZP.div.withConfig({displayName:"layout__ColFlex",componentId:"sc-11ag14j-1"})(["display:flex;flex-direction:column;"]),g="Crust Files";t.ZP=(0,a.ZP)((function(e){var t=e.children,n=e.className;return(0,c.jsxs)("div",{className:n,children:[(0,c.jsxs)(s(),{children:[(0,c.jsx)("link",{rel:"icon",href:"/favicon.ico"}),(0,c.jsx)("meta",{name:"description",content:"Crust Files, the Web3.0 file storage application"}),(0,c.jsx)("meta",{name:"og:title",content:g})]}),t]})})).withConfig({displayName:"layout",componentId:"sc-11ag14j-2"})(["width:100%;height:100%;max-height:100%;overflow:auto;"])},90356:function(e,t,n){"use strict";n.d(t,{Il:function(){return i},qD:function(){return s},wI:function(){return o}});var r=n(67294),i=r.createContext(null),o=i.Provider;function s(){return(0,r.useContext)(i)}},10720:function(e,t,n){"use strict";n.d(t,{Dl:function(){return o},OF:function(){return c},g6:function(){return u},ok:function(){return d},qi:function(){return s},rs:function(){return l},up:function(){return a}});var r=n(39374),i=n(22134);function o(e){return[{location:e("\ufe0fShanghai"),text:e("\ufe0f\u26a1 Thunder Gateway"),value:"https://gw.crustfiles.net"},{location:e("Singapore"),text:e("DCF"),value:"https://crustipfs.xyz"},{location:e("United States"),text:e("Crust Network"),value:"https://ipfs-gw.decloud.foundation"},{location:e("Henan"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.w3ipfs.cn:10443"},{location:e("Los Angeles"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.smallwolf.me"},{location:e("Henan"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.w3ipfs.com:7443"},{location:e("Henan Unicom"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.w3ipfs.net:7443"},{location:e("Helsinki"),text:e("\ufe0fcrust-fans"),value:"https://crust.fans"},{location:e("Phoenix"),text:e("\ufe0fcrustgateway"),value:"https://crustgateway.com"},{location:e("Germany"),text:e("\ufe0fcrustgateway-de"),value:"https://crustgateway.online"},{location:e("Los Angeles"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.w3ipfs.org.cn"},{location:e("Shanghai"),text:e("Area51-GW"),value:"https://223.111.148.195"},{location:e("Shanghai"),text:e("Crato-GW"),value:"https://223.111.148.196"}]}function s(e){return[{text:e("Crust Pinner"),value:"https://pin.crustcode.com"}]}var a="https://chrome.google.com/webstore/detail/crust-wallet/jccapkebeeiajkkdemacblkjhhhboiek",c="https://swap.crust.network",u=r.T?"beta":"prod",l=function(){return r.T?"https://files-api.decoo.io":"https://api.".concat(i.Kh.value)},d=r.T?"f8bd392f-2ff5-4dc7-bedd-1be9f175885b":"09ef6613-21f0-4fb6-ab1f-ded9bedb291e"},39374:function(e,t,n){"use strict";n.d(t,{T:function(){return r}});var r=!1},22134:function(e,t,n){"use strict";n.d(t,{Kh:function(){return i},Vi:function(){return s}});var r=n(67294),i={value:"crustfiles.io"},o=["crustfiles.io","crustfiles.com","crustfiles.xyz"];function s(){(0,r.useEffect)((function(){i.value=function(){var e;if("localhost"==location.hostname)return o[0];if(1==(null===(e=location.hostname.match(/^\d+\.\d+\.\d+\.\d+$/))||void 0===e?void 0:e.length))return o[0];var t=location.hostname.split("."),n=t.slice(-2).join(".");return"ipns"==t[1]&&(n=t[0].replaceAll("-",".")),o.includes(n)?location.hostname:o[0]}()}),[])}},61509:function(e,t,n){"use strict";n.d(t,{$7:function(){return x},Cn:function(){return P},KL:function(){return E},PF:function(){return S},Pk:function(){return b},Pw:function(){return w},Y1:function(){return y},a6:function(){return h},fV:function(){return d},fb:function(){return g},ie:function(){return I},lK:function(){return f},on:function(){return M},tO:function(){return O},uJ:function(){return c},w2:function(){return m},w8:function(){return k},wJ:function(){return C},we:function(){return p},y7:function(){return A},yS:function(){return _},zo:function(){return v},zv:function(){return T}});var r=n(59499),i=n(9669),o=n.n(i);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var a=n(10720).rs,c=function(e){return"".concat(a()).concat(e)};function u(e){if(200===e.data.code)return e.data.data;throw function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"";return o().post(c("/common/rewardsHistory"),{address:e}).then(u)}function k(e){return o().post(c("/common/external/address"),{address:e}).then(u)}function T(e){return o().post(c("/common/members"),{address:e}).then(u)}function M(e){return o().get(c("/common/grandDraw/".concat(e,"/winners"))).then(u)}function P(e,t){return o().post(c("/common/calculateShortLinkHash"),{cid:e,options:t}).then(u)}function O(e){return o().get(c("/common/shortLinkInfo/".concat(e))).then(u)}},5320:function(e,t,n){"use strict";n.d(t,{g:function(){return h},o:function(){return d}});var r=n(50029),i=n(87794),o=n.n(i),s=n(67294),a=n(39468),c=n(61027),u=n(27774),l=["wss://rpc.crust.network","wss://rpc-crust-mainnet.decoo.io"];function d(e){return f.apply(this,arguments)}function f(){return(f=(0,r.Z)(o().mark((function e(t){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=null!==t&&void 0!==t?t:new a.U(l,5e3)).on("error",console.error),e.next=4,new c.G({provider:n,typesBundle:u.typesBundleForPolkadot}).isReady;case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(){var e=(0,s.useState)(null),t=e[0],n=e[1];return(0,s.useEffect)((function(){var e=new a.U(l,5e3);e.on("error",console.error),new c.G({provider:e,typesBundle:u.typesBundleForPolkadot}).isReady.then(n).catch(console.error)}),[]),t}},69168:function(e,t,n){"use strict";n.d(t,{Zn:function(){return u},ms:function(){return l}});var r=n(59499),i=n(67294),o=n(90356),s=n(39374);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t",e,t),c(c({},t),{},(0,r.Z)({},e.key,e.value))}))}}}function l(e){var t=(0,o.qD)().store,n=t.store,r=t.update;return(0,i.useEffect)((function(){return e.value&&r(e)}),[e.value]),n}},62020:function(e,t,n){"use strict";n.d(t,{AR:function(){return v},GY:function(){return p},K3:function(){return w},Or:function(){return y},Sk:function(){return h},Sq:function(){return b},az:function(){return x},lS:function(){return l},vr:function(){return d},yn:function(){return m},zw:function(){return f}});var r=n(49495),i=n(89048),o=n(35226),s=n(96486),a=n.n(s),c=n(94316),u=n.n(c),l=(n(48764).Buffer,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;return e.length>2*t?"".concat(e.substring(0,t),"...").concat(e.substring(e.length-t)):e}),d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n="".concat(e.trim()),r=n.indexOf(".");for(r>=0&&n.length-r-1>t&&(n=n.substring(0,r+t+1));"0"!==n&&n.endsWith("0");)n=n.substring(0,n.length-1);return n.endsWith(".")?n.substring(0,n.length-1):n},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!e)return"-";var n=(0,o.a)(e,{decimals:12,forceUnit:"Unit",withSi:!1});return d(n,t)},h=function(e){window.open("".concat(window.location.origin).concat(e),"_blank")},p=function(e){return"".concat(window.location.origin).concat(e)};function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";if(e!==t&&null!==e&&void 0!==e){var n=a().toNumber(e),r=n<0?0:n;return u()(r).format({thousandSeparated:!0})}return t}function m(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"-";return g(a().get(e,t,n),n)}var b=function(e,t){return e.events.find((function(e){return"".concat(e.event.section.toString(),"(").concat(e.event.method.toString(),")")===t}))},y=function(e){return(0,r.m)((0,i.m)(e),66)},v=function(e,t){return y(e)===y(t)},w=function(e,t){return e.length<=t?e:e.substring(0,e.length-t)},x=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Network Error",n=t;"string"==typeof e?n=e:"string"==typeof(null===e||void 0===e?void 0:e.msg)?n=null===e||void 0===e?void 0:e.msg:"string"==typeof(null===e||void 0===e?void 0:e.message)&&(n=null===e||void 0===e?void 0:e.message);var r=n.toLowerCase();return r.includes("denied")||r.includes("rejected")||r.includes("declined")?"You declined the action in your wallet.":n.includes("transaction failed")?"Transaction failed":n}},50205:function(e,t,n){"use strict";n.d(t,{p$:function(){return Ut},aB:function(){return Lt},gE:function(){return jt},XH:function(){return Dt},s3:function(){return Nt}});var r=n(59499);function i(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const o=i({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});var s=n(95946);function a(e,t){return({exclude:n,format:r})=>({exclude:n,format:e=>{const i=t(e);if(n)for(const t of n)delete i[t];return{...i,...r(e)}},type:e})}const c={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844"};function u(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?(0,s.ly)(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?(0,s.ly)(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?c[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"===typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),"eip1559"===t.type&&delete t.maxFeePerBlobGas,t}const l=a("transaction",u);function d(e){const t=e.transactions?.map((e=>"string"===typeof e?e:u(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const f=a("block",d);function h(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const p={"0x0":"reverted","0x1":"success"};function g(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>h(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?(0,s.ly)(e.transactionIndex):null,status:e.status?p[e.status]:null,type:e.type?c[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const m=a("transactionReceipt",g),b={block:f({format(e){const t=e.transactions?.map((e=>{if("string"===typeof e)return e;const t=u(e);return"0x7e"===t.typeHex&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?(0,s.y_)(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}));return{transactions:t,stateRoot:e.stateRoot}}}),transaction:l({format(e){const t={};return"0x7e"===e.type&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?(0,s.y_)(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:m({format:e=>({l1GasPrice:e.l1GasPrice?(0,s.y_)(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?(0,s.y_)(e.l1GasUsed):null,l1Fee:e.l1Fee?(0,s.y_)(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null})})};var y=n(30478);class v extends y.G{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}class w extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}set(e,t){return super.set(e,t),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}var x=n(11187);function S(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function A(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function E(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function _(e,t){A(e);const n=t.outputLen;if(e.length>I&C)}:{h:0|Number(e>>I&C),l:0|Number(e&C)}}function T(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;ie<>>32-n,P=(e,t,n)=>t<>>32-n,O=(e,t,n)=>t<>>64-n,R=(e,t,n)=>e<>>64-n;const N=e=>e instanceof Uint8Array,B=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),L=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function D(e){if("string"===typeof e&&(e=function(e){if("string"!==typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!N(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class U{clone(){return this._cloneInto()}}function j(e){const t=t=>e().update(D(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const[F,V,q]=[[],[],[]],z=BigInt(0),H=BigInt(1),W=BigInt(2),G=BigInt(7),Z=BigInt(256),K=BigInt(113);for(let Ft=0,Vt=H,qt=1,zt=0;Ft<24;Ft++){[qt,zt]=[zt,(2*qt+3*zt)%5],F.push(2*(5*zt+qt)),V.push((Ft+1)*(Ft+2)/2%64);let e=z;for(let t=0;t<7;t++)Vt=(Vt<>G)*K)%Z,Vt&W&&(e^=H<<(H<n>32?O(e,t,n):M(e,t,n),Q=(e,t,n)=>n>32?R(e,t,n):P(e,t,n);class $ extends U{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,S(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){!function(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const t=(r+8)%10,i=(r+2)%10,o=n[i],s=n[i+1],a=J(o,s,1)^n[t],c=Q(o,s,1)^n[t+1];for(let n=0;n<50;n+=10)e[r+n]^=a,e[r+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=V[n],o=J(t,i,r),s=Q(t,i,r),a=F[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let r=0;r<50;r+=10){for(let t=0;t<10;t++)n[t]=e[r+t];for(let t=0;t<10;t++)e[r+t]^=~n[(t+2)%10]&n[(t+4)%10]}e[0]^=X[r],e[1]^=Y[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){E(this);const{blockLen:t,state:n}=this,r=(e=D(e)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return S(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(_(e,this),this.finished)throw new 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(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new $(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const ee=(e,t,n)=>j((()=>new $(t,e,n))),te=ee(1,136,32);var ne=n(15102),re=n(92106);function ie(e,t){const n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=function(e,t){const n=t||"hex",r=te((0,ne.v)(e,{strict:!1})?(0,x.O0)(e):e);return"bytes"===n?r:(0,re.NC)(r)}((0,x.qX)(n),"bytes"),i=(t?n.substring(`${t}0x`.length):n).split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(15&r[o>>1])>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());return`0x${i.join("")}`}const oe=/^0x[a-fA-F0-9]{40}$/,se=new w(8192);function ae(e,t){const{strict:n=!0}=t??{};if(se.has(e))return se.get(e);const r=!!oe.test(e)&&(e.toLowerCase()===e||!n||ie(e)===e);return se.set(e,r),r}function ce(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}class ue extends y.G{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class le extends y.G{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}class de extends y.G{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RecursiveReadLimitExceededError"})}}const fe={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:1/0,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new de({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new le({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new ue({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new ue({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===1/0)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function he(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(fe);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function pe(e,t="hex"){const n=ge(e),r=he(new Uint8Array(n.length));return n.encode(r),"hex"===t?(0,re.ci)(r.bytes):r.bytes}function ge(e){return Array.isArray(e)?function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=me(t);return{length:t<=55?1+t:1+n+t,encode(r){t<=55?r.pushByte(192+t):(r.pushByte(247+n),1===n?r.pushUint8(t):2===n?r.pushUint16(t):3===n?r.pushUint24(t):r.pushUint32(t));for(const{encode:t}of e)t(r)}}}(e.map((e=>ge(e)))):function(e){const t="string"===typeof e?(0,x.nr)(e):e,n=me(t.length);return{length:1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+n),1===n?e.pushUint8(t.length):2===n?e.pushUint16(t.length):3===n?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function me(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new y.G("Length is too large.")}function be(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),n=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(n+1)} ${t}`)).join("\n")}class ye extends y.G{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLegacyVError"})}}class ve extends y.G{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",be(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class we extends y.G{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStorageKeySizeError"})}}function xe(e){const{kzg:t}=e,n=e.to??("string"===typeof e.blobs[0]?"hex":"bytes"),r="string"===typeof e.blobs[0]?e.blobs.map((e=>(0,x.nr)(e))):e.blobs,i=[];for(const o of r)i.push(Uint8Array.from(t.blobToKzgCommitment(o)));return"bytes"===n?i:i.map((e=>(0,re.ci)(e)))}function Se(e){const{kzg:t}=e,n=e.to??("string"===typeof e.blobs[0]?"hex":"bytes"),r="string"===typeof e.blobs[0]?e.blobs.map((e=>(0,x.nr)(e))):e.blobs,i="string"===typeof e.commitments[0]?e.commitments.map((e=>(0,x.nr)(e))):e.commitments,o=[];for(let s=0;s(0,re.ci)(e)))}class Ae extends U{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=B(this.buffer)}update(e){E(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=D(e)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let l=o;l>i&o),a=Number(n&o),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=B(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;le&t^~e&n,_e=(e,t,n)=>e&t^e&n^t&n,Ce=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]),Ie=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ke=new Uint32Array(64);class Te extends Ae{constructor(){super(64,32,8,!1),this.A=0|Ie[0],this.B=0|Ie[1],this.C=0|Ie[2],this.D=0|Ie[3],this.E=0|Ie[4],this.F=0|Ie[5],this.G=0|Ie[6],this.H=0|Ie[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let l=0;l<16;l++,t+=4)ke[l]=e.getUint32(t,!1);for(let l=16;l<64;l++){const e=ke[l-15],t=ke[l-2],n=L(e,7)^L(e,18)^e>>>3,r=L(t,17)^L(t,19)^t>>>10;ke[l]=r+ke[l-7]+n+ke[l-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let l=0;l<64;l++){const e=u+(L(s,6)^L(s,11)^L(s,25))+Ee(s,a,c)+Ce[l]+ke[l]|0,t=(L(n,2)^L(n,13)^L(n,22))+_e(n,r,i)|0;u=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,i,o,s,a,c,u)}roundClean(){ke.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Me=j((()=>new Te));function Pe(e,t){const n=t||"hex",r=Me((0,ne.v)(e,{strict:!1})?(0,x.O0)(e):e);return"bytes"===n?r:(0,re.NC)(r)}function Oe(e){const{commitment:t,version:n=1}=e,r=e.to??("string"===typeof t?"hex":"bytes"),i=Pe(t,"bytes");return i.set([n],0),"bytes"===r?i:(0,re.ci)(i)}const Re=4096,Ne=131072,Be=761855;class Le extends y.G{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlobSizeTooLargeError"})}}class De extends y.G{constructor(){super("Blob data must not be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}class Ue extends y.G{constructor({hash:e,size:t}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashSizeError"})}}class je extends y.G{constructor({hash:e,version:t}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:["Expected: 1",`Received: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashVersionError"})}}var Fe=n(39135);function Ve(e){const{data:t,kzg:n,to:r}=e,i=e.blobs??function(e){const t=e.to??("string"===typeof e.data?"hex":"bytes"),n="string"===typeof e.data?(0,x.nr)(e.data):e.data,r=(0,Fe.d)(n);if(!r)throw new De;if(r>Be)throw new Le({maxSize:Be,size:r});const i=[];let o=!0,s=0;for(;o;){const e=he(new Uint8Array(Ne));let t=0;for(;te.bytes)):i.map((e=>(0,re.ci)(e.bytes)))}({data:t,to:r}),o=e.commitments??xe({blobs:i,kzg:n,to:r}),s=e.proofs??Se({blobs:i,commitments:o,kzg:n,to:r}),a=[];for(let c=0;c0&&t>(0,Fe.d)(e)-1)throw new rt.mV({offset:t,position:"start",size:(0,Fe.d)(e)})}function st(e,t,n){if("number"===typeof t&&"number"===typeof n&&(0,Fe.d)(e)!==n-t)throw new rt.mV({offset:n,position:"end",size:(0,Fe.d)(e)})}function at(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:i}=e;if(t<=0)throw new ze({chainId:t});if(i&&!ae(i))throw new v({address:i});if(r&&r>2n**256n-1n)throw new Ze({maxFeePerGas:r});if(n&&r&&n>r)throw new nt({maxFeePerGas:r,maxPriorityFeePerGas:n})}function ct(e){if(!e||0===e.length)return[];const t=[];for(let n=0;n2n**256n-1n)throw new Ze({maxFeePerGas:r})}(e);const l=ct(c);return ce(["0x01",pe([(0,re.NC)(n),o?(0,re.NC)(o):"0x",u?(0,re.NC)(u):"0x",r?(0,re.NC)(r):"0x",s??"0x",a?(0,re.NC)(a):"0x",i??"0x",l,...lt(e,t)])])}(e,t):"eip4844"===n?function(e,t){const{chainId:n,gas:r,nonce:i,to:o,value:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:l,accessList:d,data:f}=e;!function(e){const{blobVersionedHashes:t}=e;if(t){if(0===t.length)throw new De;for(const e of t){const t=(0,Fe.d)(e),n=(0,s.ly)(it(e,0,1));if(32!==t)throw new Ue({hash:e,size:t});if(1!==n)throw new je({hash:e,version:n})}}at(e)}(e);let h=e.blobVersionedHashes,p=e.sidecars;if(e.blobs&&("undefined"===typeof h||"undefined"===typeof p)){const t="string"===typeof e.blobs[0]?e.blobs:e.blobs.map((e=>(0,re.ci)(e))),n=e.kzg,r=xe({blobs:t,kzg:n});if("undefined"===typeof h&&(h=function(e){const{commitments:t,version:n}=e,r=e.to??("string"===typeof t[0]?"hex":"bytes"),i=[];for(const o of t)i.push(Oe({commitment:o,to:r,version:n}));return i}({commitments:r})),"undefined"===typeof p){p=Ve({blobs:t,commitments:r,proofs:Se({blobs:t,commitments:r,kzg:n})})}}const g=ct(d),m=[(0,re.NC)(n),i?(0,re.NC)(i):"0x",l?(0,re.NC)(l):"0x",u?(0,re.NC)(u):"0x",r?(0,re.NC)(r):"0x",o??"0x",a?(0,re.NC)(a):"0x",f??"0x",g,c?(0,re.NC)(c):"0x",h??[],...lt(e,t)],b=[],y=[],v=[];if(p)for(let s=0;s2n**256n-1n)throw new Ze({maxFeePerGas:r});if(s)throw new y.G("`accessList` is not a valid Legacy Transaction attribute.")}(e);let u=[o?(0,re.NC)(o):"0x",c?(0,re.NC)(c):"0x",r?(0,re.NC)(r):"0x",s??"0x",a?(0,re.NC)(a):"0x",i??"0x"];if(t){const e=(()=>{if(t.v>=35n){return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n)}if(n>0)return BigInt(2*n)+BigInt(35n+t.v-27n);const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new ye({v:t.v});return e})();u=[...u,(0,re.NC)(e),t.r,t.s]}else n>0&&(u=[...u,(0,re.NC)(n),"0x","0x"]);return pe(u)}(e,t)}function lt(e,t){const{r:n,s:r,v:i,yParity:o}=t??e;if("undefined"===typeof n)return[];if("undefined"===typeof r)return[];if("undefined"===typeof i&&"undefined"===typeof o)return[];return["number"===typeof o?o?(0,re.NC)(1):"0x":0n===i?"0x":1n===i?(0,re.NC)(1):27n===i?"0x":(0,re.NC)(1),qe(n),qe(r)]}const dt={transaction:function(e,t){return function(e){return"deposit"===e.type||"undefined"!==typeof e.sourceHash}(e)?function(e){!function(e){const{from:t,to:n}=e;if(t&&!ae(t))throw new v({address:t});if(n&&!ae(n))throw new v({address:n})}(e);const{sourceHash:t,data:n,from:r,gas:i,isSystemTx:o,mint:s,to:a,value:c}=e;return ce(["0x7e",pe([t,r,a??"0x",s?(0,re.NC)(s):"0x",c?(0,re.NC)(c):"0x",i?(0,re.NC)(i):"0x",o?"0x1":"0x",n??"0x"])])}(e):ut(e,t)}};const ft={contracts:{gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters:b,serializers:dt},ht=i({...ft,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...ft.contracts,l2OutputOracle:{1:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{1:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{1:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:1}),pt=i({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),gt={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3"};function mt(e){const t={};return"undefined"!==typeof e.accessList&&(t.accessList=e.accessList),"undefined"!==typeof e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),"undefined"!==typeof e.blobs&&("string"!==typeof e.blobs[0]?t.blobs=e.blobs.map((e=>(0,re.ci)(e))):t.blobs=e.blobs),"undefined"!==typeof e.data&&(t.data=e.data),"undefined"!==typeof e.from&&(t.from=e.from),"undefined"!==typeof e.gas&&(t.gas=(0,re.eC)(e.gas)),"undefined"!==typeof e.gasPrice&&(t.gasPrice=(0,re.eC)(e.gasPrice)),"undefined"!==typeof e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=(0,re.eC)(e.maxFeePerBlobGas)),"undefined"!==typeof e.maxFeePerGas&&(t.maxFeePerGas=(0,re.eC)(e.maxFeePerGas)),"undefined"!==typeof e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=(0,re.eC)(e.maxPriorityFeePerGas)),"undefined"!==typeof e.nonce&&(t.nonce=(0,re.eC)(e.nonce)),"undefined"!==typeof e.to&&(t.to=e.to),"undefined"!==typeof e.type&&(t.type=gt[e.type]),"undefined"!==typeof e.value&&(t.value=(0,re.eC)(e.value)),t}const bt=a("transactionRequest",mt),yt=50000n,vt=32n*(2n**16n-1n),wt={block:f({format(e){const t=e.transactions?.map((e=>{if("string"===typeof e)return e;const t=wt.transaction?.format(e);return"0x71"===t.typeHex?t.type="eip712":"0xff"===t.typeHex&&(t.type="priority"),t}));return{l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,l1BatchTimestamp:e.l1BatchTimestamp?(0,s.y_)(e.l1BatchTimestamp):null,transactions:t}}}),transaction:l({format(e){const t={};return"0x71"===e.type?t.type="eip712":"0xff"===e.type&&(t.type="priority"),{...t,l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?(0,s.y_)(e.l1BatchTxIndex):null}}}),transactionReceipt:m({format:e=>({l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?(0,s.y_)(e.l1BatchTxIndex):null,logs:e.logs.map((e=>({...h(e),l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,transactionLogIndex:(0,s.ly)(e.transactionLogIndex),logType:e.logType}))),l2ToL1Logs:e.l2ToL1Logs.map((e=>({blockNumber:(0,s.y_)(e.blockHash),blockHash:e.blockHash,l1BatchNumber:(0,s.y_)(e.l1BatchNumber),transactionIndex:(0,s.y_)(e.transactionIndex),shardId:(0,s.y_)(e.shardId),isService:e.isService,sender:e.sender,key:e.key,value:e.value,transactionHash:e.transactionHash,logIndex:(0,s.y_)(e.logIndex)})))})}),transactionRequest:bt({exclude:["customSignature","factoryDeps","gasPerPubdata","paymaster","paymasterInput"],format:e=>e.gasPerPubdata||e.paymaster&&e.paymasterInput||e.factoryDeps||e.customSignature?{eip712Meta:{...e.gasPerPubdata?{gasPerPubdata:(0,re.NC)(e.gasPerPubdata)}:{gasPerPubdata:(0,re.NC)(yt)},...e.paymaster&&e.paymasterInput?{paymasterParams:{paymaster:e.paymaster,paymasterInput:Array.from((0,x.nr)(e.paymasterInput))}}:{},...e.factoryDeps?{factoryDeps:e.factoryDeps.map((e=>Array.from((0,x.nr)(e))))}:{},...e.customSignature?{customSignature:Array.from((0,x.nr)(e.customSignature))}:{}},type:"0x71"}:{}})};class xt extends y.G{constructor(){super(["Transaction is not an EIP712 transaction.","","Transaction must:",' - include `type: "eip712"`'," - include one of the following: `customSignature`, `paymaster`, `paymasterInput`, `gasPerPubdata`, `factoryDeps`"].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidEip712TransactionError"})}}function St(e){return"eip712"===e.type||!!("customSignature"in e&&e.customSignature||"paymaster"in e&&e.paymaster||"paymasterInput"in e&&e.paymasterInput||"gasPerPubdata"in e&&"bigint"===typeof e.gasPerPubdata||"factoryDeps"in e&&e.factoryDeps)}function At(e){const{chainId:t,to:n,from:r,paymaster:i,paymasterInput:o}=e;if(!St(e))throw new xt;if(!t||t<=0)throw new ze({chainId:t});if(n&&!ae(n))throw new v({address:n});if(r&&!ae(r))throw new v({address:r});if(i&&!ae(i))throw new v({address:i});if(i&&!o)throw new y.G("`paymasterInput` must be provided when `paymaster` is defined");if(!i&&o)throw new y.G("`paymaster` must be provided when `paymasterInput` is defined")}const Et={transaction:function(e,t){return St(e)?function(e){const{chainId:t,gas:n,nonce:r,to:i,from:o,value:s,maxFeePerGas:a,maxPriorityFeePerGas:c,customSignature:u,factoryDeps:l,paymaster:d,paymasterInput:f,gasPerPubdata:h,data:p}=e;At(e);return ce(["0x71",pe([r?(0,re.NC)(r):"0x",c?(0,re.NC)(c):"0x",a?(0,re.NC)(a):"0x",n?(0,re.NC)(n):"0x",i??"0x",s?(0,re.NC)(s):"0x",p??"0x0",(0,re.NC)(t),(0,re.NC)(""),(0,re.NC)(""),(0,re.NC)(t),o??"0x",h?(0,re.NC)(h):(0,re.NC)(yt),l??[],u??"0x",d&&f?[d,f]:[]])])}(e):ut(e,t)}};var _t=n(61769);class Ct extends y.G{constructor({givenLength:e,maxBytecodeSize:t}){super(`Bytecode cannot be longer than ${t} bytes. Given length: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytecodeLengthExceedsMaxSizeError"})}}class It extends y.G{constructor({givenLengthInWords:e}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytecodeLengthInWordsMustBeOddError"})}}class kt extends y.G{constructor({givenLength:e}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytecodeLengthMustBeDivisibleBy32Error"})}}const Tt={formatters:wt,serializers:Et,custom:{getEip712Domain:e=>{At(e);const t=function(e){const{gas:t,nonce:n,to:r,from:i,value:o,maxFeePerGas:s,maxPriorityFeePerGas:a,factoryDeps:c,paymaster:u,paymasterInput:l,gasPerPubdata:d,data:f}=e;return{txType:113n,from:BigInt(i),to:r?BigInt(r):0n,gasLimit:t??0n,gasPerPubdataByteLimit:d??yt,maxFeePerGas:s??0n,maxPriorityFeePerGas:a??0n,paymaster:u?BigInt(u):0n,nonce:n?BigInt(n):0n,value:o??0n,data:f||"0x0",factoryDeps:c?.map((e=>(0,re.NC)(function(e){const t=(0,x.O0)(e);if(t.length%32!==0)throw new kt({givenLength:t.length});if(t.length>vt)throw new Ct({givenLength:t.length,maxBytecodeSize:vt});const n=Pe(t),r=(0,x.O0)(n),i=t.length/32;if(i%2===0)throw new It({givenLengthInWords:i});const o=(0,x.O0)(i),s=(0,_t.vk)(o,{size:2}),a=new Uint8Array([1,0]);return r.set(a,0),r.set(s,2),r}(e))))??[],paymasterInput:l||"0x"}}(e);return{domain:{name:"zkSync",version:"2",chainId:e.chainId},types:{Transaction:[{name:"txType",type:"uint256"},{name:"from",type:"uint256"},{name:"to",type:"uint256"},{name:"gasLimit",type:"uint256"},{name:"gasPerPubdataByteLimit",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymaster",type:"uint256"},{name:"nonce",type:"uint256"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"factoryDeps",type:"bytes32[]"},{name:"paymasterInput",type:"bytes"}]},primaryType:"Transaction",message:t}}}},Mt=i({...Tt,id:324,name:"zkSync Era",network:"zksync-era",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]}},blockExplorers:{default:{name:"Etherscan",url:"https://era.zksync.network/",apiUrl:"https://api-era.zksync.network/api"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}}}),Pt=i({id:81457,name:"Blast",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.blast.io"]}},blockExplorers:{default:{name:"Blastscan",url:"https://blastscan.io",apiUrl:"https://api.blastscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:212929}},sourceId:1}),Ot=i({...ft,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...ft.contracts,l2OutputOracle:{1:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{1:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{1:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:1});var Rt,Nt={token:"a".repeat(64),chainId:416001,applicationId:1275319623,applicationAddress:"SLNGOJJFB3ERUUZUAAOVW6DWH3NKKQMGZWH26IBIU34EHM3AU24Y5VIH3E",algodUrl:"https://mainnet-api.algonode.cloud"},Bt=i({testnet:!0,id:366666,name:"Crust EVM Parachain Test",nativeCurrency:{name:"CRU",symbol:"CRU",decimals:18},blockExplorers:{default:{name:"Crust EVM Parachain Test",url:" https://evmexplorer.tanssi-chains.network"}},rpcUrls:{default:{http:["https://fraa-flashbox-2952-rpc.a.stagenet.tanssi.network"]}}}),Lt={mainnet:o,optimism:ht,arbitrum:pt,zkSync:Mt,blast:Pt,base:Ot,crustEvmParachainTest:Bt},Dt=(Rt={},(0,r.Z)(Rt,o.id,"0xf063A29f03d0A02FD96f270EE4F59158EF3d4860"),(0,r.Z)(Rt,5,"0xDE52b55C3Ee0765d17564631570ec8E7fD3D499a"),(0,r.Z)(Rt,ht.id,"0xf063A29f03d0A02FD96f270EE4F59158EF3d4860"),(0,r.Z)(Rt,420,"0x06Ae21caEEA438Aa3AA4D353332a7C124f8dF3c7"),(0,r.Z)(Rt,pt.id,"0xf063A29f03d0A02FD96f270EE4F59158EF3d4860"),(0,r.Z)(Rt,421613,"0x9AE6C9d00Fde0e0F774693Ca6099d06dfe2001C6"),(0,r.Z)(Rt,Mt.id,"0x61ecfA2C8dF06A4f941A8529E4B707488B74e3bE"),(0,r.Z)(Rt,280,"0x6C0445ec09d49214Cbc21E3DC032d3dEA25ce2Ae"),(0,r.Z)(Rt,137,""),(0,r.Z)(Rt,42220,""),(0,r.Z)(Rt,56,""),(0,r.Z)(Rt,Pt.id,"0xf063A29f03d0A02FD96f270EE4F59158EF3d4860"),(0,r.Z)(Rt,Ot.id,"0xf063a29f03d0a02fd96f270ee4f59158ef3d4860"),(0,r.Z)(Rt,Bt.id,"0xA40179e57280585D88899b2032E7eCF13B3B6c72"),Rt),Ut=(0,r.Z)({416001:"ALGO",137:"Matic",56:"BNB"},Bt.id,"CRU"),jt=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"customer",type:"address"},{indexed:!1,internalType:"address",name:"merchant",type:"address"},{indexed:!1,internalType:"string",name:"cid",type:"string"},{indexed:!1,internalType:"uint256",name:"size",type:"uint256"},{indexed:!1,internalType:"uint256",name:"price",type:"uint256"},{indexed:!1,internalType:"bool",name:"isPermanent",type:"bool"}],name:"Order",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[{internalType:"address",name:"nodeAddress",type:"address"}],name:"addOrderNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getNodesNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"size",type:"uint256"},{internalType:"bool",name:"isPermanent",type:"bool"}],name:"getPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"nodeArray",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nodes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"cid",type:"string"},{internalType:"uint256",name:"size",type:"uint256"},{internalType:"bool",name:"isPermanent",type:"bool"}],name:"placeOrder",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"string",name:"cid",type:"string"},{internalType:"uint256",name:"size",type:"uint256"},{internalType:"address",name:"nodeAddress",type:"address"},{internalType:"bool",name:"isPermanent",type:"bool"}],name:"placeOrderWithNode",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"priceOracle",outputs:[{internalType:"contract IPriceOracle",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"nodeAddress",type:"address"}],name:"removeOrderNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"priceOracleAddress",type:"address"}],name:"setPriceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"}]},47687:function(e,t,n){"use strict";n.d(t,{it:function(){return QU},kb:function(){return YU},WY:function(){return $U},Yg:function(){return ZU},xX:function(){return JU}});var r={};n.r(r),n.d(r,{Address:function(){return Bs},Array:function(){return js},Bool:function(){return Ns},Character:function(){return Rs},Dictionary:function(){return Fs},Enum:function(){return Hs},Event:function(){return Vs},Fix64:function(){return Ps},Identity:function(){return cs},InclusiveRange:function(){return Gs},Int:function(){return ls},Int128:function(){return ws},Int16:function(){return ps},Int256:function(){return Ss},Int32:function(){return ms},Int64:function(){return ys},Int8:function(){return fs},Optional:function(){return Ds},Path:function(){return Ws},Reference:function(){return Us},Resource:function(){return qs},String:function(){return Os},Struct:function(){return zs},UFix64:function(){return Ms},UInt:function(){return us},UInt128:function(){return vs},UInt16:function(){return hs},UInt256:function(){return xs},UInt32:function(){return gs},UInt64:function(){return bs},UInt8:function(){return ds},Void:function(){return Ls},Word128:function(){return Is},Word16:function(){return Es},Word256:function(){return ks},Word32:function(){return _s},Word64:function(){return Cs},Word8:function(){return As},_Array:function(){return js}});var i={};n.r(i),n.d(i,{identity:function(){return Ad}});var o={};n.r(o),n.d(o,{base2:function(){return Ed}});var s={};n.r(s),n.d(s,{base8:function(){return _d}});var a={};n.r(a),n.d(a,{base10:function(){return Cd}});var c={};n.r(c),n.d(c,{base16:function(){return Id},base16upper:function(){return kd}});var u={};n.r(u),n.d(u,{base32:function(){return Td},base32hex:function(){return Rd},base32hexpad:function(){return Bd},base32hexpadupper:function(){return Ld},base32hexupper:function(){return Nd},base32pad:function(){return Pd},base32padupper:function(){return Od},base32upper:function(){return Md},base32z:function(){return Dd}});var l={};n.r(l),n.d(l,{base36:function(){return Ud},base36upper:function(){return jd}});var d={};n.r(d),n.d(d,{base58btc:function(){return Fd},base58flickr:function(){return Vd}});var f={};n.r(f),n.d(f,{base64:function(){return qd},base64pad:function(){return zd},base64url:function(){return Hd},base64urlpad:function(){return Wd}});var h={};n.r(h),n.d(h,{base256emoji:function(){return Xd}});var p={};n.r(p),n.d(p,{sha256:function(){return yf},sha512:function(){return vf}});var g={};n.r(g),n.d(g,{identity:function(){return xf}});var m={};n.r(m),n.d(m,{code:function(){return Af},decode:function(){return _f},encode:function(){return Ef},name:function(){return Sf}});var b={};n.r(b),n.d(b,{code:function(){return Tf},decode:function(){return Pf},encode:function(){return Mf},name:function(){return kf}});var y={};n.r(y),n.d(y,{AppUtils:function(){return Ga},InteractionTemplateUtils:function(){return qc},TestUtils:function(){return Xo},VERSION:function(){return ea},WalletUtils:function(){return Fa},account:function(){return bo},arg:function(){return Ro},args:function(){return Oo},atBlockHeight:function(){return go},atBlockId:function(){return mo},authenticate:function(){return qx},authorization:function(){return So},authorizations:function(){return xo},authz:function(){return Zx},block:function(){return yo},build:function(){return jr},cadence:function(){return Rn},cdc:function(){return Rn},config:function(){return xt},createSignableVoucher:function(){return Hi},currentUser:function(){return Vx},decode:function(){return fo},discovery:function(){return Oc},display:function(){return Rt},events:function(){return hc},getAccount:function(){return zr},getBlock:function(){return qr},getBlockHeader:function(){return Co},getChainId:function(){return ga},getCollection:function(){return Io},getEvents:function(){return Ao},getEventsAtBlockHeightRange:function(){return Eo},getEventsAtBlockIds:function(){return _o},getNetworkParameters:function(){return Mo},getNodeVersionInfo:function(){return vo},getTransaction:function(){return To},getTransactionStatus:function(){return ko},invariant:function(){return uo},isBad:function(){return Tr},isOk:function(){return kr},limit:function(){return Po},logIn:function(){return Gx},mutate:function(){return Fx},nodeVersionInfo:function(){return wo},param:function(){return Jo},params:function(){return Yo},payer:function(){return Bo},ping:function(){return Lo},pipe:function(){return Rr},pluginRegistry:function(){return Ac},proposer:function(){return No},query:function(){return Sa},reauthenticate:function(){return Hx},ref:function(){return Do},sansPrefix:function(){return Pt},script:function(){return Uo},send:function(){return lo},serialize:function(){return Ka},signUp:function(){return Wx},subscribeEvents:function(){return qo},t:function(){return r},transaction:function(){return Fo},tx:function(){return ac},unauthenticate:function(){return zx},validator:function(){return po},verifyUserSignatures:function(){return Za},voucherIntercept:function(){return Vo},voucherToTxId:function(){return Wi},why:function(){return Mr},withPrefix:function(){return Ot}});var v=n(16835),w=n(50029),x=n(59499),S=n(87794),A=n.n(S),E=n(96486),_=n.n(E),C=n(11163),I=n(67294),k=n(58971),T=n.n(k),M=n(92777),P=n(82262);function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}function N(e,t,n){return N="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=R(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}},N(e,t,n||e)}function B(e,t){return B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},B(e,t)}function L(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}var D=n(14027);function U(e,t){if(t&&("object"===D(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}var j=n(50205),F=n(39275),V=n(92339),q=n(62020),z=n(42103),H=n(48764).Buffer;function W(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var G=function(e){L(n,e);var t=W(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o{const{title:t,message:n,level:r,always:i}=e,o=await(ue?.()?.get("logger.level"))??le.warn;if(!i&&o{const{title:t,message:n}=e;return[`\n %c${t}\n ============================\n\n ${n}\n\n ============================\n `.replace(/\n[^\S\r\n]+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"]})({title:t,message:n});switch(r){case le.debug:console.debug(...s);break;case le.info:console.info(...s);break;case le.warn:console.warn(...s);break;case le.error:console.error(...s);break;default:console.log(...s)}};function fe(e,t){if(!e){const e=new Error(`INVARIANT ${t}`);e.stack=e.stack?.split("\n")?.filter((e=>!/at invariant/.test(e)))?.join("\n");for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i{const{pkg:t,subject:n,transition:r,level:i=le.warn,message:o="",callback:s=null}=e,a=()=>{return de({title:(t?t+" ":"")+"Deprecation Notice",message:`\n ${n?`${e=n,e.charAt(0).toUpperCase()+e.slice(1)} is deprecated and will cease to work in future releases${t?" of "+t:""}.`:""}${o?"\n"+o:""}${r?`\nYou can learn more (including a guide on common transition paths) here: ${r}`:""}\n `.trim(),level:i});var e};return"function"===typeof s?async function(){return await a(),await s(...arguments)}:a()};var he={randomUUID:"undefined"!==typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let pe;const ge=new Uint8Array(16);function me(){if(!pe&&(pe="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pe(ge)}const be=[];for(let tj=0;tj<256;++tj)be.push((tj+256).toString(16).slice(1));function ye(e,t=0){return be[e[t+0]]+be[e[t+1]]+be[e[t+2]]+be[e[t+3]]+"-"+be[e[t+4]]+be[e[t+5]]+"-"+be[e[t+6]]+be[e[t+7]]+"-"+be[e[t+8]]+be[e[t+9]]+"-"+be[e[t+10]]+be[e[t+11]]+be[e[t+12]]+be[e[t+13]]+be[e[t+14]]+be[e[t+15]]}var ve=function(e,t,n){if(he.randomUUID&&!t&&!e)return he.randomUUID();const r=(e=e||{}).random||(e.rng||me)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return ye(r)},we=function(e){return e.UNKNOWN="UNKNOWN",e.SCRIPT="SCRIPT",e.TRANSACTION="TRANSACTION",e.GET_TRANSACTION_STATUS="GET_TRANSACTION_STATUS",e.GET_ACCOUNT="GET_ACCOUNT",e.GET_EVENTS="GET_EVENTS",e.PING="PING",e.GET_TRANSACTION="GET_TRANSACTION",e.GET_BLOCK="GET_BLOCK",e.GET_BLOCK_HEADER="GET_BLOCK_HEADER",e.GET_COLLECTION="GET_COLLECTION",e.GET_NETWORK_PARAMETERS="GET_NETWORK_PARAMETERS",e.SUBSCRIBE_EVENTS="SUBSCRIBE_EVENTS",e.GET_NODE_VERSION_INFO="GET_NODE_VERSION_INFO",e}({}),xe=function(e){return e.BAD="BAD",e.OK="OK",e}({}),Se=function(e){return e.AUTHORIZER="authorizer",e.PAYER="payer",e.PROPOSER="proposer",e}({}),Ae=function(e){return e.ARGUMENT="ARGUMENT",e.ACCOUNT="ACCOUNT",e}({});const Ee=()=>{const e=[];let t;return{async deliver(n){e.push(n),t&&(t(e.shift()),t=void 0)},receive:()=>new Promise((function(n){const r=e.shift();if(r)return n(r);t=n}))}};let _e;const Ce=e=>(_e||(_e=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0))),Ie="INIT",ke="SUBSCRIBE",Te="UNSUBSCRIBE",Me="UPDATED",Pe="SNAPSHOT",Oe="EXIT",Re="object"===typeof self&&self.self===self&&self||"object"===typeof n.g&&n.g.global===n.g&&n.g||"object"===typeof window&&window.window===window&&window||{FCL_REGISTRY:null};Re.FCL_REGISTRY=null==Re.FCL_REGISTRY?{}:Re.FCL_REGISTRY;const Ne=Re.FCL_REGISTRY;let Be=0;function Le(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{expectReply:!1};return new Promise(((i,o)=>{const s=r.expectReply||!1,a=null!=r.timeout?r.timeout:5e3;s&&a&&setTimeout((()=>o(new Error(`Timeout: ${a}ms passed without a response.`))),a);const c={to:e,from:r.from,tag:t,data:n,timeout:a,reply:i,reject:o};try{Ne[e]&&Ne[e].mailbox.deliver(c),s||i(!0)}catch(u){console.error("FCL.Actor -- Could Not Deliver Message",c,Ne[e],u),o(u)}}))}const De=e=>{delete Ne[e]},Ue=e=>async t=>{"function"===typeof e.INIT&&await e.INIT(t);e:for(;;){const r=await t.receive();try{if(r.tag===Oe){"function"===typeof e.TERMINATE&&await e.TERMINATE(t,r,r.data||{});break e}await(e[r.tag]?.(t,r,r.data||{}))}catch(n){console.error(`${t.self()} Error`,r,n)}finally{continue e}}},je=e=>{if(null==e){for(;Ne[String(Be)];)Be++;return String(Be)}return String(e)},Fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=je(t);if(null!=Ne[n])return n;Ne[n]={addr:n,mailbox:Ee(),subs:new Set,kvs:{},error:null};const r=Ve(n);let i;return i="object"===typeof e?Ue(e):e,Ce((async()=>{await i(r),De(n)})),n},Ve=e=>({self:()=>e,receive:()=>Ne[e].mailbox.receive(),send:function(t,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(null!=t)return i.from=e,Le(t,n,r,i)},sendSelf:function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne[e]&&Le(e,t,n,r)},broadcast:function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.from=e;for(const i of Ne[e].subs)Le(i,t,n,r)},subscribe:t=>null!=t&&Ne[e].subs.add(t),unsubscribe:t=>null!=t&&Ne[e].subs.delete(t),subscriberCount:()=>Ne[e].subs.size,hasSubs:()=>!!Ne[e].subs.size,put:(t,n)=>{null!=t&&(Ne[e].kvs[t]=n)},get:function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;const r=Ne[e].kvs[t];return null==r?n:r},delete:t=>{delete Ne[e].kvs[t]},update:(t,n)=>{null!=t&&(Ne[e].kvs[t]=n(Ne[e].kvs[t]))},keys:()=>Object.keys(Ne[e].kvs),all:()=>Ne[e].kvs,where:t=>Object.keys(Ne[e].kvs).reduce(((n,r)=>t.test(r)?{...n,[r]:Ne[e].kvs[r]}:n),{}),merge:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(t).forEach((n=>Ne[e].kvs[n]=t[n]))},fatalError:t=>{Ne[e].error=t;for(const n of Ne[e].subs)Le(n,Me)}});function qe(e,t,n){t(e);const r=Fe((async t=>{for(t.send(e,ke);;){const r=await t.receive(),i=Ne[e].error;if(r.tag===Oe)return void t.send(e,Te);if(i)return n(null,i),void t.send(e,Te);n(r.data,null)}}));return()=>Le(r,Oe)}function ze(e,t){return t(e),Le(e,Pe,null,{expectReply:!0,timeout:0})}const He=function(){for(var e=arguments.length,t=new Array(e),n=0;nt.reduce(((e,t)=>t(e)),e)},We=e=>e&&"object"===typeof e&&!Array.isArray(e),Ge=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rArray.isArray(e)?Ge({},...e):e,Ke=e=>e.contracts?e.contracts:{},Xe=e=>e.dependencies?e.dependencies:{},Ye=(e,t)=>He(Ze,function(){for(var e=arguments.length,t=new Array(e),n=0;nt.reduce(((t,n)=>({...t,...n(e)})),{})}((e=>t=>{let{deployments:n={},accounts:r={}}=t;const i=n?.[e];return i?Object.entries(i).reduce(((e,t)=>{let[n,i]=t;const o=r[n]?.address;return o?i.reduce(((e,t)=>({...e,[t]:o})),{}):e}),{}):{}})(t),He(Ke,(e=>t=>Object.entries(t).reduce(((t,n)=>{let[r,i]=n;const o=i?.aliases?.[e];return o&&(t[r]=o),t}),{}))(t)),He(Xe,(e=>t=>Object.entries(t).reduce(((t,n)=>{let[r,i]=n;const o=i?.aliases?.[e];return o&&(t[r]=o),t}),{}))(t))))(e),Je=e=>Object.entries(e?.accounts??[]).reduce(((e,t)=>{let[,n]=t;return!!e||n&&Object.prototype.hasOwnProperty.call(n,"key")&&(r=n?.key,"string"===typeof r&&/^[0-9A-Fa-f]+$/.test(r));var r}),!1),Qe=e=>Array.isArray(e)?e.some(Je):Je(e),$e=e=>{const t="local"===e?.toLowerCase()?"emulator":e?.toLowerCase();if("emulator"===t||"testnet"===t||"mainnet"===t||"previewnet"===t)return t;throw new Error(`Invalid network "${e}". Must be one of "emulator", "local", "testnet", or "mainnet"`)};ue=xt;const et="config",tt="PUT_CONFIG",nt="GET_CONFIG",rt="GET_ALL_CONFIG",it="UPDATE_CONFIG",ot="DELETE_CONFIG",st="CLEAR_CONFIG",at="WHERE_CONFIG",ct="CONFIG/UPDATED",ut=e=>e,lt={[tt]:(e,t,n)=>{let{key:r,value:i}=n;if(null==r)throw new Error("Missing 'key' for config/put.");e.put(r,i),e.broadcast(ct,{...e.all()})},[nt]:(e,t,n)=>{let{key:r,fallback:i}=n;if(null==r)throw new Error("Missing 'key' for config/get");t.reply(e.get(r,i))},[rt]:(e,t)=>{t.reply({...e.all()})},[it]:(e,t,n)=>{let{key:r,fn:i}=n;if(null==r)throw new Error("Missing 'key' for config/update");e.update(r,i||ut),e.broadcast(ct,{...e.all()})},[ot]:(e,t,n)=>{let{key:r}=n;if(null==r)throw new Error("Missing 'key' for config/delete");e.delete(r),e.broadcast(ct,{...e.all()})},[st]:e=>{const t=Object.keys(e.all());for(const n of t)e.delete(n);e.broadcast(ct,{...e.all()})},[at]:(e,t,n)=>{let{pattern:r}=n;if(null==r)throw new Error("Missing 'pattern' for config/where");t.reply(e.where(r))},[ke]:(e,t)=>{e.subscribe(t.from),e.send(t.from,ct,{...e.all()})},[Te]:(e,t)=>{e.unsubscribe(t.from)}};function dt(e,t){return Le(et,tt,{key:e,value:t}),xt()}function ft(e,t){return Le(et,nt,{key:e,fallback:t},{expectReply:!0,timeout:10})}async function ht(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if(!e.length)return t;const[n,...r]=e,i=await ft(n);return null==i?ht(r,t):i}function pt(){return Le(et,rt,null,{expectReply:!0,timeout:10})}function gt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut;return Le(et,it,{key:e,fn:t}),xt()}function mt(e){return Le(et,ot,{key:e}),xt()}function bt(e){return Le(et,at,{pattern:e},{expectReply:!0,timeout:10})}function yt(e){return qe(et,(()=>Fe(lt,et)),e)}async function vt(e){return async function(){await Le(et,st)}().then((()=>xt(e)))}async function wt(e){let{ignoreConflicts:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await ft("flow.network"),r=$e(n),{flowJSON:i}=e;if(fe(Boolean(i),"config.load -- 'flowJSON' must be defined"),fe(!!r,'Flow Network Required -- In order for FCL to load your contracts please define "flow.network" to "emulator", "local", "testnet", or "mainnet" in your config. See more here: https://developers.flow.com/tools/fcl-js/reference/configure-fcl'),Qe(i)){const e="emulator"===r;de({title:"Private Keys Detected",message:"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security",level:e?le.warn:le.error}),fe(e,"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security")}for(const[o,s]of Object.entries(Ye(i,r))){const e=`0x${o}`,n=await ft(e);n&&n!==s&&!t?de({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:le.warn}):dt(e,s);const r=`system.contracts.${o}`,i=await ft(r);i&&i!==s&&!t?de({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:le.warn}):dt(r,s)}}function xt(e){return null!=e&&"object"===typeof e&&Object.keys(e).map((t=>dt(t,e[t]))),{put:dt,get:ft,all:pt,first:ht,update:gt,delete:mt,where:bt,subscribe:yt,overload:St,load:wt}}async function St(e,t){const n=await pt();try{xt(e);return await t(await pt())}finally{await vt(n)}}Fe(lt,et),xt.put=dt,xt.get=ft,xt.all=pt,xt.first=ht,xt.update=gt,xt.delete=mt,xt.where=bt,xt.subscribe=yt,xt.overload=St,xt.load=wt;var At=n(5586);function Et(e){if(Array.isArray(e)){const t=[];for(let r=0;r{e.abort()}),c);return Mt()((s=t,a=n,a?s.replace(/\/+$/,"")+"/"+a.replace(/^\/+/,""):s).toString(),{method:r,body:l,headers:o,signal:e.signal}).then((async e=>{if(e.ok)return e.json();const i=await e.text().catch((()=>null)),o=Ut(i);throw new Ft({error:o?.message,hostname:t,path:n,method:r,requestBody:l,responseBody:i,responseStatusText:e.statusText,statusCode:e.status})})).catch((async e=>{if(e instanceof Ft)throw e;if("AbortError"===e.name)throw e;throw u&&await de({title:"Access Node Error",message:`The provided access node ${t} does not appear to be a valid REST/HTTP access node.\n Please verify that you are not unintentionally using a GRPC access node.\n See more here: https://docs.onflow.org/fcl/reference/sdk-guidelines/#connect`,level:le.error}),new Ft({error:e?.message,hostname:t,path:n,method:r,requestBody:l})})).finally((()=>{clearTimeout(i)}));var s,a}return await async function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{return await d()}catch(n){const r=[408,429,500,502,503,504];if("AbortError"===n.name||r.includes(n.statusCode))return await new Promise(((r,i)=>{t{r(e(t+1))}),a)):i(n)}));throw n}}()}async function qt(e,t,n){const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:`/v1/scripts?block_id=${e.block.id}`,method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return Wt(e,t,i)}async function zt(e,t,n){const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:`/v1/scripts?block_height=${e.block.height}`,method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return Wt(e,t,i)}async function Ht(e,t,n){const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:"/v1/scripts?block_height=sealed",method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return Wt(e,t,i)}function Wt(e,t,n){let r=t.response();return r.tag=e.tag,r.encodedData=JSON.parse(t.Buffer.from(n,"base64").toString()),r}async function Gt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fe(n.node,"SDK Send Execute Script Error: opts.node must be defined."),fe(t.response,"SDK Send Execute Script Error: context.response must be defined."),fe(t.Buffer,"SDK Send Execute Script Error: context.Buffer must be defined."),(e=await e).block.id?await qt(e,t,n):e.block.height?await zt(e,t,n):await Ht(e,t,n)}const Zt={SHA2_256:1,SHA2_384:2,SHA3_256:3,SHA3_384:4,KMAC128_BLS_BLS12_381:5},Kt={ECDSA_P256:1,ECDSA_secp256k1:2,BLS_BLS12_381:3};async function Xt(e,t,n){const r=n.httpRequest||Vt;return Jt(e,t,await r({hostname:n.node,path:`/v1/accounts/${e.account.addr}?block_height=${e.block.height}&expand=contracts,keys`,method:"GET",body:null}))}async function Yt(e,t,n){const r=n.httpRequest||Vt;return Jt(e,t,await r({hostname:n.node,path:`/v1/accounts/${e.account.addr}?block_height=sealed&expand=contracts,keys`,method:"GET",body:null}))}function Jt(e,t,n){let r=t.response();r.tag=e.tag;return r.account={address:n.address,balance:Number(n.balance),code:"",contracts:(e=>{const n={};if(!e)return n;for(let r of Object.keys(e))n[r]=t.Buffer.from(e[r],"base64").toString();return n})(n.contracts),keys:n.keys?.map((e=>({index:Number(e.index),publicKey:e.public_key.replace(/^0x/,""),signAlgo:Kt[e.signing_algorithm],signAlgoString:e.signing_algorithm,hashAlgo:Zt[e.hashing_algorithm],hashAlgoString:e.hashing_algorithm,sequenceNumber:Number(e.sequence_number),weight:Number(e.weight),revoked:e.revoked})))??[]},r}async function Qt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fe(n.node,"SDK Send Get Account Error: opts.node must be defined."),fe(t.response,"SDK Send Get Account Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Account Error: context.Buffer must be defined."),null!==(e=await e).block.height?await Xt(e,t,n):await Yt(e,t,n)}async function $t(e,t,n){const r=n.httpRequest||Vt;return nn(e,t,await r({hostname:n.node,path:`/v1/blocks/${e.block.id}`,method:"GET",body:null}))}async function en(e,t,n){const r=n.httpRequest||Vt;return nn(e,t,await r({hostname:n.node,path:`/v1/blocks?height=${e.block.height}`,method:"GET",body:null}))}async function tn(e,t,n){const r=n.httpRequest||Vt,i=e.block?.isSealed?"sealed":"final";return nn(e,t,await r({hostname:n.node,path:`/v1/blocks?height=${i}`,method:"GET",body:null}))}function nn(e,t,n){const r=n.length?n[0]:null,i=t.response();return i.tag=e.tag,i.blockHeader={id:r.header.id,parentId:r.header.parent_id,height:Number(r.header.height),timestamp:r.header.timestamp},i}async function rn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Block Header Error: opts.node must be defined."),fe(t.response,"SDK Send Get Block Header Error: context.response must be defined.");const r=null!==(e=await e).block.id,i=null!==e.block.height;return r?await $t(e,t,n):i?await en(e,t,n):await tn(e,t,n)}async function on(e,t,n){const r=n.httpRequest||Vt;return cn(e,t,await r({hostname:n.node,path:`/v1/blocks/${e.block.id}?expand=payload`,method:"GET",body:null}))}async function sn(e,t,n){const r=n.httpRequest||Vt;return cn(e,t,await r({hostname:n.node,path:`/v1/blocks?height=${e.block.height}&expand=payload`,method:"GET",body:null}))}async function an(e,t,n){const r=n.httpRequest||Vt,i=e.block?.isSealed?"sealed":"final";return cn(e,t,await r({hostname:n.node,path:`/v1/blocks?height=${i}&expand=payload`,method:"GET",body:null}))}function cn(e,t,n){const r=n.length?n[0]:null,i=t.response();return i.tag=e.tag,i.block={id:r.header.id,parentId:r.header.parent_id,height:Number(r.header.height),timestamp:r.header.timestamp,collectionGuarantees:r.payload.collection_guarantees.map((e=>({collectionId:e.collection_id,signerIds:e.signer_ids}))),blockSeals:r.payload.block_seals.map((e=>({blockId:e.block_id,executionReceiptId:e.result_id})))},i}async function un(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Block Error: opts.node must be defined."),fe(t.response,"SDK Send Get Block Error: context.response must be defined.");const r=null!==(e=await e).block.id,i=null!==e.block.height;return r?await on(e,t,n):i?await sn(e,t,n):await an(e,t,n)}async function ln(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Collection Error: opts.node must be defined."),fe(t.response,"SDK Send Get Collection Error: context.response must be defined.");const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:`/v1/collections/${e.collection.id}?expand=transactions`,method:"GET",body:null}),o=t.response();return o.tag=e.tag,o.collection={id:i.id,transactionIds:i.transactions.map((e=>e.id))},o}async function dn(e,t,n){const r=n.httpRequest||Vt;return hn(e,t,await r({hostname:n.node,path:`/v1/events?type=${e.events.eventType}&start_height=${e.events.start}&end_height=${e.events.end}`,method:"GET",body:null}))}async function fn(e,t,n){const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:`/v1/events?type=${e.events.eventType}&block_ids=${e.events.blockIds.join(",")}`,method:"GET",body:null});return hn(e,t,i)}function hn(e,t,n){let r=t.response();return r.tag=e.tag,r.events=[],n.forEach((e=>e.events?e.events.forEach((n=>r.events.push({blockId:e.block_id,blockHeight:Number(e.block_height),blockTimestamp:e.block_timestamp,type:n.type,transactionId:n.transaction_id,transactionIndex:Number(n.transaction_index),eventIndex:Number(n.event_index),payload:JSON.parse(t.Buffer.from(n.payload,"base64").toString())}))):null)),r}async function pn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Events Error: opts.node must be defined."),fe(t.response,"SDK Send Get Events Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Events Error: context.Buffer must be defined.");const r=null!==(e=await e).events.start,i=Array.isArray(e.events.blockIds)&&e.events.blockIds.length>0;return fe(r||i,"SendGetEventsError: Unable to determine which get events request to send. Either a block height range, or block IDs must be specified."),r?await dn(e,t,n):await fn(e,t,n)}async function gn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Transaction Error: opts.node must be defined."),fe(t.response,"SDK Send Get Transaction Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Transaction Error: context.Buffer must be defined.");const r=n.httpRequest||Vt;e=await e;const i=await r({hostname:n.node,path:`/v1/transactions/${e.transaction.id}`,method:"GET",body:null}),o=e=>({address:e.address,keyId:Number(e.key_id),sequenceNumber:Number(e.sequence_number)}),s=e=>({address:e.address,keyId:Number(e.key_index),signature:e.signature}),a=e=>JSON.parse(t.Buffer.from(e,"base64").toString());let c=t.response();return c.tag=e.tag,c.transaction={script:t.Buffer.from(i.script,"base64").toString(),args:[...i.arguments.map(a)],referenceBlockId:i.reference_block_id,gasLimit:Number(i.gas_limit),payer:i.payer,proposalKey:i.proposal_key?o(i.proposal_key):i.proposal_key,authorizers:i.authorizers,payloadSignatures:[...i.payload_signatures.map(s)],envelopeSignatures:[...i.envelope_signatures.map(s)]},c}const mn={UNKNOWN:0,PENDING:1,FINALIZED:2,EXECUTED:3,SEALED:4,EXPIRED:5};async function bn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Transaction Status Error: opts.node must be defined."),fe(t.response,"SDK Send Get Transaction Status Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Transaction Status Error: context.Buffer must be defined.");const r=n.httpRequest||Vt;e=await e;const i=await r({hostname:n.node,path:`/v1/transaction_results/${e.transaction.id}`,method:"GET",body:null});let o=t.response();return o.tag=e.tag,o.transactionStatus={blockId:i.block_id,status:mn[i.status.toUpperCase()]||"",statusString:i.status.toUpperCase(),statusCode:i.status_code,errorMessage:i.error_message,events:i.events.map((e=>({type:e.type,transactionId:e.transaction_id,transactionIndex:Number(e.transaction_index),eventIndex:Number(e.event_index),payload:JSON.parse(t.Buffer.from(e.payload,"base64").toString())})))},o}async function yn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(Boolean(n.node),"SDK Send Ping Error: opts.node must be defined."),fe(Boolean(t.response),"SDK Send Ping Error: context.response must be defined.");const r=n.httpRequest||Vt;await r({hostname:n.node,path:"/v1/blocks?height=sealed",method:"GET",body:null});let i="function"===typeof t?.response?t.response():{};return i.tag=e.tag,i}const vn=e=>`${withPrefix(e.addr)}-${e.keyId}`;async function wn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Transaction Error: opts.node must be defined."),fe(t.response,"SDK Send Transaction Error: context.response must be defined."),fe(t.Buffer,"SDK Send Transaction Error: context.Buffer must be defined.");const r=n.httpRequest||Vt;e=await e;let i=[];for(let d of Object.values(e.accounts))try{if(!d.role.payer&&null!=d.signature){const e={address:Pt(d.addr),key_index:String(d.keyId),signature:t.Buffer.from(d.signature,"hex").toString("base64")};i.find((t=>t.address===e.address&&t.key_index===e.key_index&&t.signature===e.signature))||i.push(e)}}catch(l){throw console.error("SDK HTTP Send Error: Trouble applying payload signature",{acct:d,ix:e}),l}let o={};for(let d of Object.values(e.accounts))try{if(d.role.payer&&null!=d.signature){let e=d.tempId||vn(d);o[e]=o[e]||{address:Pt(d.addr),key_index:String(d.keyId),signature:t.Buffer.from(d.signature,"hex").toString("base64")}}}catch(l){throw console.error("SDK HTTP Send Error: Trouble applying envelope signature",{acct:d,ix:e}),l}o=Object.values(o);var s=Date.now();const a=await r({hostname:n.node,path:"/v1/transactions",method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:[...e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))],reference_block_id:e.message.refBlock?e.message.refBlock:null,gas_limit:String(e.message.computeLimit),payer:Pt(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),proposal_key:{address:Pt(e.accounts[e.proposer].addr),key_index:String(e.accounts[e.proposer].keyId),sequence_number:String(e.accounts[e.proposer].sequenceNum)},authorizers:e.authorizations.map((t=>e.accounts[t].addr)).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[]).map(Pt),payload_signatures:i,envelope_signatures:o}});var c=Date.now();let u=t.response();return u.tag=e.tag,u.transactionId=a.id,"undefined"!==typeof window&&"undefined"!==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("FLOW::TX",{detail:{txId:u.transactionId,delta:c-s}})),u}async function xn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Network Parameters Error: opts.node must be defined."),fe(t.response,"SDK Send Get Network Parameters Error: context.response must be defined.");const r=n.httpRequest||Vt;e=await e;const i=await r({hostname:n.node,path:"/v1/network/parameters",method:"GET",body:null,enableRequestLogging:n.enableRequestLogging??!0});let o=t.response();return o.tag=e.tag,o.networkParameters={chainId:i.chain_id},o}async function Sn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Node Version Info Error: opts.node must be defined."),fe(t.response,"SDK Send Get Node Verison Info Error: context.response must be defined.");const r=n.httpRequest||Vt;e=await e;const i=await r({hostname:n.node,path:"/v1/node_version_info",method:"GET"});let o=t.response();return o.tag=e.tag,o.nodeVersionInfo={semver:i.semver,commit:i.commit,sporkId:i.spork_id,protocolVersion:parseInt(i.protocol_version),sporkRootBlockHeight:parseInt(i.spork_root_block_height),nodeRootBlockHeight:parseInt(i.node_root_block_height)},o}const An=Dt;class En extends Error{constructor(e){let{code:t,reason:n,message:r,wasClean:i}=e;super(`\n connectWs: connection closed with error${r?`: ${r}`:""}\n ${t?`code: ${t}`:""}\n ${n?`reason: ${n}`:""}\n ${i?`wasClean: ${i}`:""}\n `),this.name="WebsocketError",this.code=t,this.reason=n,this.wasClean=!1}}function _n(e){let{hostname:t,path:n,params:r,getParams:i,retryLimit:o=5,retryIntervalMs:s=1e3}=e;if(i&&r)throw new Error("connectWs: cannot specify both params and getParams");let a=new Nt.EventEmitter,c=0;const u=i||(()=>r);let l=()=>{};return function e(){let r=!1,i=!1;const d=function(e,t,n){const r=new URL(t||"",e);"https:"===r.protocol?r.protocol="wss:":"http:"===r.protocol&&(r.protocol="ws:");return Object.entries(n||{}).forEach((e=>{let[t,n]=e;if(n){let e;e=Array.isArray(n)?n.join(","):n.toString(),r.searchParams.append(t,e)}})),r.toString()}(t,n,u()),f=new An(d);f.onmessage=function(e){const t=Ut(e.data);t?a.emit("data",t):(a.emit("error",new En({message:"invalid JSON data"})),this.close())},f.onclose=function(t){if(r)return a.emit("close"),void a.removeAllListeners();i?setTimeout(e,s):c{a.emit("close"),a.removeAllListeners()})))},f.onopen=function(){i=!0,c=0},l=()=>{r=!0,f.close()}}(),{on(e,t){return a.on(e,t),this},off(e,t){return a.off(e,t),this},close(){l()}}}function Cn(e,t,n){const r=t.response();return r.tag=e.tag,r.events=n.Events?.length>0?n.Events.map((e=>({blockId:n.BlockID,blockHeight:Number(n.Height),blockTimestamp:n.Timestamp,type:e.Type,transactionId:e.TransactionID,transactionIndex:Number(e.TransactionIndex),eventIndex:Number(e.EventIndex),payload:JSON.parse(t.Buffer.from(e.Payload,"base64").toString())}))):null,r.heartbeat={blockId:n.BlockID,blockHeight:Number(n.Height),blockTimestamp:n.Timestamp},r}function In(e,t,n){const r=t.response();return r.tag=e.tag,r.streamConnection=n,r}async function kn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Events Error: opts.node must be defined."),fe(t.response,"SDK Send Get Events Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Events Error: context.Buffer must be defined.");const r=await e,i=n.connectWs||_n,o=new Nt.EventEmitter;let s=null;const a=i({hostname:n.node,path:"/v1/subscribe_events",getParams:()=>{const e={event_types:r.subscribeEvents?.eventTypes,addresses:r.subscribeEvents?.addresses,contracts:r.subscribeEvents?.contracts,heartbeat_interval:r.subscribeEvents?.heartbeatInterval};return s?e.start_height=s+1:(e.start_block_id=r.subscribeEvents?.startBlockId,e.start_height=r.subscribeEvents?.startHeight),e}});a.on("data",(e=>{const n=Cn(r,t,e);s=n.heartbeat.blockHeight,o.emit("data",n)})),a.on("error",(e=>{o.emit("error",e)})),a.on("close",(()=>{o.emit("close")}));const c={on(e,t){return o.on(e,t),this},off(e,t){return o.off(e,t),this},close(){a.close()}};return In(r,t,c)}const Tn=async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(fe(Boolean(n?.node),'SDK Send Error: Either opts.node or "accessNode.api" in config must be defined.'),fe(Boolean(t.ix),"SDK Send Error: context.ix must be defined."),e=await e,!0){case t.ix.isTransaction(e):return n.sendTransaction?n.sendTransaction(e,t,n):wn(e,t,n);case t.ix.isGetTransactionStatus(e):return n.sendGetTransactionStatus?n.sendGetTransactionStatus(e,t,n):bn(e,t,n);case t.ix.isGetTransaction(e):return n.sendGetTransaction?n.sendGetTransaction(e,t,n):gn(e,t,n);case t.ix.isScript(e):return n.sendExecuteScript?n.sendExecuteScript(e,t,n):Gt(e,t,n);case t.ix.isGetAccount(e):return n.sendGetAccount?n.sendGetAccount(e,t,n):Qt(e,t,n);case t.ix.isGetEvents(e):return n.sendGetEvents?n.sendGetEvents(e,t,n):pn(e,t,n);case t.ix.isSubscribeEvents?.(e):return n.connectSubscribeEvents?n.connectSubscribeEvents(e,t,n):kn(e,t,n);case t.ix.isGetBlock(e):return n.sendGetBlock?n.sendGetBlock(e,t,n):un(e,t,n);case t.ix.isGetBlockHeader(e):return n.sendGetBlockHeader?n.sendGetBlockHeader(e,t,n):rn(e,t,n);case t.ix.isGetCollection(e):return n.sendGetCollection?n.sendGetCollection(e,t,n):ln(e,t,n);case t.ix.isPing(e):return n.sendPing?n.sendPing(e,t,n):yn(e,t,n);case t.ix.isGetNetworkParameters(e):return n.sendGetNetworkParameters?n.sendGetNetworkParameters(e,t,n):xn(e,t,n);case t.ix.isGetNodeVersionInfo?.(e):return n.sendGetNodeVersionInfo?n.sendGetNodeVersionInfo(e,t,n):Sn(e,t,n);default:return e}};var Mn=n(35682);function Pn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!e.length&&!t.length)return n;if(!e.length)return n;if(!t.length)return n.push(...e),n;const[r,...i]=e,[o,...s]=t;return void 0!==r&&n.push(r),void 0!==o&&n.push(o),Pn(i,s,n)}function On(e){return function(t){return"function"===typeof t?(de.deprecate({pkg:"FCL/SDK",subject:"Interopolation of functions into template literals",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"}),On(e)(t(e))):String(t)}}function Rn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re:"function"===typeof e?e:t=>Pn([...e],n.map(On(t))).join("").trim()}const Nn=`{\n "kind":"${Ae.ACCOUNT}",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}`,Bn=`{\n "kind":"${Ae.ARGUMENT}",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}`,Ln=`{\n "tag":"${we.UNKNOWN}",\n "assigns":{},\n "status":"${xe.OK}",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":[],\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "subscribeEvents": {\n "startBlockId":null,\n "startHeight":null,\n "eventTypes":null,\n "addresses":null,\n "contracts":null,\n "heartbeatInterval":null\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}`,Dn=new Set(Object.keys(JSON.parse(Ln))),Un=()=>JSON.parse(Ln),jn=()=>(de.deprecate({pkg:"FCL/SDK",message:"The interaction been deprecated from the Flow JS-SDK/FCL. use initInteraction instead",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0010-deprecate-interaction",level:le.warn}),Un()),Fn=e=>"number"===typeof e,Vn=e=>Array.isArray(e),qn=e=>null!==e&&"object"===typeof e,zn=e=>null==e,Hn=e=>"function"===typeof e,Wn=e=>{if(!qn(e)||zn(e)||Fn(e))return!1;for(let t of Dn)if(!e.hasOwnProperty(t))return!1;return!0},Gn=e=>(e.status=xe.OK,e),Zn=(e,t)=>(e.status=xe.BAD,e.reason=t,e),Kn=e=>t=>(t.tag=e,Gn(t)),Xn=e=>null==e.keyId?e:(fe(!isNaN(parseInt(e.keyId.toString())),"account.keyId must be an integer"),{...e,keyId:parseInt(e.keyId.toString())}),Yn=()=>JSON.parse(Nn),Jn=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{fe("function"===typeof e||"object"===typeof e,"prepAccount must be passed an authorization function or an account object"),fe(null!=t.role,"Account must have a role");const r=Yn(),i=t.role,o=ve();let s={...e};e.authorization&&Hn(e.authorization)&&(s={resolve:e.authorization}),!e.authorization&&Hn(e)&&(s={resolve:e});const a=s.resolve;return a&&(s.resolve=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rt(await e,...n)),e)}),s=Xn(s),n.accounts[o]={...r,tempId:o,...s,role:{...r.role,..."object"===typeof e.role?e.role:{},...i?{[i]:!0}:{}}},i===Se.AUTHORIZER?n.authorizations.push(o):i===Se.PAYER?n.payer.push(o):i&&(n[i]=o),n}},Qn=e=>t=>{let n=ve();return t.message.arguments.push(n),t.arguments[n]=JSON.parse(Bn),t.arguments[n].tempId=n,t.arguments[n].value=e.value,t.arguments[n].asArgument=e.asArgument,t.arguments[n].xform=e.xform,t.arguments[n].resolve=e.resolve,t.arguments[n].resolveArgument=Hn(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,Gn(t)},$n=Kn(we.UNKNOWN),er=Kn(we.SCRIPT),tr=Kn(we.TRANSACTION),nr=Kn(we.GET_TRANSACTION_STATUS),rr=Kn(we.GET_TRANSACTION),ir=Kn(we.GET_ACCOUNT),or=Kn(we.GET_EVENTS),sr=Kn(we.PING),ar=Kn(we.GET_BLOCK),cr=Kn(we.GET_BLOCK_HEADER),ur=Kn(we.GET_COLLECTION),lr=Kn(we.GET_NETWORK_PARAMETERS),dr=Kn(we.SUBSCRIBE_EVENTS),fr=Kn(we.GET_NODE_VERSION_INFO),hr=e=>t=>t.tag===e,pr=hr(we.UNKNOWN),gr=hr(we.SCRIPT),mr=hr(we.TRANSACTION),br=hr(we.GET_TRANSACTION_STATUS),yr=hr(we.GET_TRANSACTION),vr=hr(we.GET_ACCOUNT),wr=hr(we.GET_EVENTS),xr=hr(we.PING),Sr=hr(we.GET_BLOCK),Ar=hr(we.GET_BLOCK_HEADER),Er=hr(we.GET_COLLECTION),_r=hr(we.GET_NETWORK_PARAMETERS),Cr=hr(we.GET_NODE_VERSION_INFO),Ir=hr(we.SUBSCRIBE_EVENTS),kr=e=>e.status===xe.OK,Tr=e=>e.status===xe.BAD,Mr=e=>e.reason,Pr=e=>{for(let t of Object.keys(e))if(!Dn.has(t))throw new Error(`"${t}" is an invalid root level Interaction property.`);return e},Or=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];try{if(e=Pr(await e),Tr(e))throw new Error(`Interaction Error: ${e.reason}`);if(!t.length)return e;const[n,...r]=t,i=await n;if(Hn(i))return Or(i(e),r);if(zn(i)||!i)return Or(e,r);if(Wn(i))return Or(i,r);throw new Error("Invalid Interaction Composition")}catch(n){throw n}};function Rr(){for(var e=arguments.length,t=new Array(e),n=0;nRr(e,r);const o=r,s=i;return Or(o,s)}const Nr=function(e){return e},Br=(e,t,n)=>null==e.assigns[t]?n:e.assigns[t],Lr=(e,t)=>n=>(n.assigns[e]=t,Gn(n)),Dr=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nr;return n=>(n.assigns[e]=t(n.assigns[e],n),Gn(n))};var Ur=Object.freeze({__proto__:null,initInteraction:Un,interaction:jn,isNumber:Fn,isArray:Vn,isObj:qn,isNull:zn,isFn:Hn,isInteraction:Wn,Ok:Gn,Bad:Zn,initAccount:Yn,prepAccount:Jn,makeArgument:Qn,makeUnknown:$n,makeScript:er,makeTransaction:tr,makeGetTransactionStatus:nr,makeGetTransaction:rr,makeGetAccount:ir,makeGetEvents:or,makePing:sr,makeGetBlock:ar,makeGetBlockHeader:cr,makeGetCollection:ur,makeGetNetworkParameters:lr,makeSubscribeEvents:dr,makeGetNodeVerionInfo:fr,isUnknown:pr,isScript:gr,isTransaction:mr,isGetTransactionStatus:br,isGetTransaction:yr,isGetAccount:vr,isGetEvents:wr,isPing:xr,isGetBlock:Sr,isGetBlockHeader:Ar,isGetCollection:Er,isGetNetworkParameters:_r,isGetNodeVersionInfo:Cr,isSubscribeEvents:Ir,isOk:kr,isBad:Tr,why:Mr,isAccount:e=>e.kind===Ae.ACCOUNT,isArgument:e=>e.kind===Ae.ARGUMENT,pipe:Rr,get:Br,put:Lr,update:Dr,destroy:e=>t=>(delete t.assigns[e],Gn(t))});function jr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Rr(Un(),e)}const Fr={tag:null,transaction:null,transactionStatus:null,transactionId:null,encodedData:null,events:null,account:null,block:null,blockHeader:null,latestBlock:null,collection:null,networkParameters:null,streamConnection:null,heartbeat:null,nodeVersionInfo:null},Vr=()=>({...Fr});function qr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Rr([ar,t=>(t.block.isSealed=e,Gn(t))])}function zr(e){return Rr([ir,t=>(t.account.addr=Pt(e),Gn(t))])}const Hr=(e,t,n)=>{const r=new(Bt());let i=function(){let e=[],t=!1;async function n(){if(!t){for(t=!0;e.length>0;){const t=e.shift();await(t?.())}t=!1}}return{push:t=>{e.push(t),n()}}}();function o(t){e.on(t,(e=>{i.push((async()=>{r.emit(t,e)}))}))}return e.on("data",(async e=>{const o=Object.keys(e).filter((t=>null!=e[t]&&"tag"!==t));let s=Promise.all(o.map((async r=>{const i={[r]:e[r]};return{channel:r,message:await t(i,n)}})));i.push((async()=>{(await s).forEach((e=>{let{channel:t,message:n}=e;r.emit(t,n)}))}))})),o("close"),o("error"),{on(e,t){return r.on(e,t),this},off(e,t){return r.off(e,t),this},close:()=>{e.close()}}};const Wr=()=>{de.deprecate({pkg:"@onflow/decode",subject:"Operating upon data of the latestBlock field of the response object",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field"})},Gr=async e=>e,Zr=async(e,t,n)=>{const r=await e.fields.reduce((async(e,r)=>((e=await e)[r.name]=await Yr(r.value,t,[...n,r.name]),e)),Promise.resolve({})),i=e.id&&Xr(t,e.id);return i?await i(r):r},Kr={UInt:Gr,Int:Gr,UInt8:Gr,Int8:Gr,UInt16:Gr,Int16:Gr,UInt32:Gr,Int32:Gr,UInt64:Gr,Int64:Gr,UInt128:Gr,Int128:Gr,UInt256:Gr,Int256:Gr,Word8:Gr,Word16:Gr,Word32:Gr,Word64:Gr,Word128:Gr,Word256:Gr,UFix64:Gr,Fix64:Gr,String:Gr,Character:Gr,Bool:Gr,Address:Gr,Void:async()=>null,Optional:async(e,t,n)=>e?await Yr(e,t,n):null,Reference:Gr,Array:async(e,t,n)=>await Promise.all(e.map((e=>new Promise((async r=>r(await Yr(e,t,[...n,e.type]))))))),Dictionary:async(e,t,n)=>await e.reduce((async(e,r)=>((e=await e)[await Yr(r.key,t,[...n,r.key])]=await Yr(r.value,t,[...n,r.key]),e)),Promise.resolve({})),Event:Zr,Resource:Zr,Struct:Zr,Enum:Zr,Type:async e=>e.staticType,Path:Gr,Capability:Gr,InclusiveRange:async(e,t,n)=>{const r=["start","end","step"];return await Object.keys(e).reduce((async(i,o)=>(i=await i,r.includes(o)&&(i[o]=await Yr(e[o],t,[...n,o])),i)),Promise.resolve({}))}},Xr=(e,t)=>{const n=Object.keys(e).find((e=>{if(/^\/.*\/$/.test(e)){return new RegExp(e.substring(1,e.length-1)).test(t)}return e===t}));return t&&n&&e[n]},Yr=async(e,t,n)=>{let r=Xr(t,e.type);if(!r)throw new Error(`Undefined Decoder Error: ${e.type}@${n.join(".")}`);return await r(e.value,t,n)},Jr=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=Object.keys(Kr).filter((e=>!Object.keys(t).find((t=>new RegExp(t).test(e))))).reduce(((e,t)=>(e[t]=Kr[t],e)),t),i={...r,...t};return Yr(e,i,n)},Qr=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.encodedData)return Jr(e.encodedData,t);if(e.transactionStatus)return{...e.transactionStatus,events:await Promise.all(e.transactionStatus.events.map((async function(e){return{type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await Jr(e.payload,t)}})))};if(e.transaction)return e.transaction;if(e.events)return await Promise.all(e.events.map((async function(e){return{blockId:e.blockId,blockHeight:e.blockHeight,blockTimestamp:e.blockTimestamp,type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await Jr(e.payload,t)}})));if(e.account)return e.account;if(e.block)return e.block;if(e.blockHeader)return e.blockHeader;if(e.latestBlock)return Wr(),e.latestBlock;if(e.transactionId)return e.transactionId;if(e.collection)return e.collection;if(e.networkParameters){const t=/^flow-/,n=e.networkParameters.chainId;let r;return r="flow-emulator"===n?"local":t.test(n)?n.replace(t,""):n,{chainId:r}}return e.streamConnection?Hr(e.streamConnection,Qr,t):e.heartbeat?e.heartbeat:e.nodeVersionInfo?e.nodeVersionInfo:null},$r=e=>"function"===typeof e,ei=e=>"string"===typeof e;function ti(e){return/\b(0x\w+)\b/g.test(e)}function ni(e){return/import\s+"(\w+)"/g.test(e)}const ri=e=>"function"===typeof e;function ii(e){return fe(null!=typeof e.xform,`No type specified for argument: ${e.value}`),ri(e.xform)?e.xform(e.value):ri(e.xform.asArgument)?e.xform.asArgument(e.value):void fe(!1,"Invalid Argument",e)}async function oi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(fe(t>0,`Argument Resolve Recursion Limit Exceeded for Arg: ${e.tempId}`),ri(e.resolveArgument)){return oi(await e.resolveArgument(),t-1)}return e}const si=e=>fi(yi(wi(e))),ai=e=>fi(yi(xi(e))),ci=(e,t)=>At.lW.from(e.padStart(2*t,"0"),"hex"),ui=(li=At.lW.from("FLOW-V0.0-transaction").toString("hex"),di=32,At.lW.from(li.padEnd(2*di,"0"),"hex")).toString("hex");var li,di;const fi=e=>ui+e,hi=e=>ci(e,8),pi=e=>ci(e,32),gi=e=>At.lW.from(JSON.stringify(e),"utf8"),mi=e=>At.lW.from(e,"utf8"),bi=e=>At.lW.from(e,"hex"),yi=e=>Et(e).toString("hex"),vi=e=>{const t=new Mn.Aj(256);return t.update(At.lW.from(e,"hex")),t.digest().toString("hex")},wi=e=>(_i(e),[mi(e.cadence||""),e.arguments.map(gi),pi(e.refBlock||""),e.computeLimit,hi(Pt(e.proposalKey.address||"")),e.proposalKey.keyId,e.proposalKey.sequenceNum,hi(Pt(e.payer)),e.authorizers.map((e=>hi(Pt(e))))]),xi=e=>(Ci(e),[wi(e),Si(e)]),Si=e=>{const t=Ai(e);return e.payloadSigs?.map((e=>({signerIndex:t.get(e.address)||"",keyId:e.keyId,sig:e.sig}))).sort(((e,t)=>e.signerIndex>t.signerIndex?1:e.signerIndext.keyId?1:e.keyId[e.signerIndex,e.keyId,bi(e.sig)]))},Ai=e=>{const t=new Map;let n=0;const r=e=>{t.has(e)||(t.set(e,n),n++)};return e.proposalKey.address&&r(e.proposalKey.address),r(e.payer),e.authorizers.forEach(r),t},Ei=e=>{Ii(e);const t=Ai(e),n=e=>e.map((e=>{let{address:n,keyId:r,sig:i}=e;return{signerIndex:t.get(n)||"",keyId:r,sig:i}})).sort(((e,t)=>e.signerIndex>t.signerIndex?1:e.signerIndext.keyId?1:e.keyId[e.signerIndex,e.keyId,bi(e.sig)]));return[[mi(e.cadence),e.arguments.map(gi),pi(e.refBlock),e.computeLimit,hi(Pt(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,hi(Pt(e.payer)),e.authorizers.map((e=>hi(Pt(e))))],n(e.payloadSigs),n(e.envelopeSigs)]},_i=e=>{Oi.forEach((t=>Ui(e,t))),Ri.forEach((t=>Ui(e.proposalKey,t,"proposalKey")))},Ci=e=>{Ni.forEach((t=>Ui(e,t))),e.payloadSigs?.forEach(((e,t)=>{Bi.forEach((n=>Ui(e,n,"payloadSigs",t)))}))},Ii=e=>{Oi.forEach((t=>Ui(e,t))),Ri.forEach((t=>Ui(e.proposalKey,t,"proposalKey"))),Ni.forEach((t=>Ui(e,t))),e.payloadSigs.forEach(((e,t)=>{Bi.forEach((n=>Ui(e,n,"payloadSigs",t)))})),Li.forEach((t=>Ui(e,t))),e.envelopeSigs.forEach(((e,t)=>{Di.forEach((n=>Ui(e,n,"envelopeSigs",t)))}))},ki=e=>"number"===typeof e,Ti=e=>"string"===typeof e,Mi=e=>null!==e&&"object"===typeof e,Pi=e=>Mi(e)&&e instanceof Array,Oi=[{name:"cadence",check:Ti},{name:"arguments",check:Pi},{name:"refBlock",check:Ti,defaultVal:"0"},{name:"computeLimit",check:ki},{name:"proposalKey",check:Mi},{name:"payer",check:Ti},{name:"authorizers",check:Pi}],Ri=[{name:"address",check:Ti},{name:"keyId",check:ki},{name:"sequenceNum",check:ki}],Ni=[{name:"payloadSigs",check:Pi}],Bi=[{name:"address",check:Ti},{name:"keyId",check:ki},{name:"sig",check:Ti}],Li=[{name:"envelopeSigs",check:Pi}],Di=[{name:"address",check:Ti},{name:"keyId",check:ki},{name:"sig",check:Ti}],Ui=(e,t,n,r)=>{const{name:i,check:o,defaultVal:s}=t;if(null==e[i]&&null!=s&&(e[i]=s),null==e[i])throw Fi(i,n,r);if(!o(e[i]))throw Vi(i,n,r)},ji=(e,t,n)=>t?null==n?`${t}.${e}`:`${t}.${n}.${e}`:e,Fi=(e,t,n)=>new Error(`Missing field ${ji(e,t,n)}`),Vi=(e,t,n)=>new Error(`Invalid field ${ji(e,t,n)}`);function qi(e){let t=new Set(e.authorizations);return e.proposer&&t.add(e.proposer),Array.isArray(e.payer)?e.payer.forEach((e=>t.delete(e))):t.delete(e.payer),Array.from(t)}function zi(e){let t=new Set(Array.isArray(e.payer)?e.payer:[e.payer]);return Array.from(t)}const Hi=e=>{const t=e.proposer?{address:Ot(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum}:{};return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map((t=>e.arguments[t].asArgument)),proposalKey:t,payer:Ot(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),authorizers:e.authorizations.map((t=>Ot(e.accounts[t].addr))).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[]),payloadSigs:qi(e).map((t=>({address:Ot(e.accounts[t].addr),keyId:e.accounts[t].keyId,sig:e.accounts[t].signature}))),envelopeSigs:zi(e).map((t=>({address:Ot(e.accounts[t].addr),keyId:e.accounts[t].keyId,sig:e.accounts[t].signature})))}},Wi=e=>(e=>vi(yi(Ei(e))))(e),Gi=e=>e&&("[object Function]"===Object.prototype.toString.call(e)||"function"===typeof e||e instanceof Function);var Zi=function(e){return e.PAYER="payer",e.PROPOSER="proposer",e.AUTHORIZATIONS="authorizations",e}(Zi||{});function Ki(){const e=[];return[function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e.push(Array(4*n).fill(" ").join("-")+t)},function(){return e.reduce(((e,t)=>e+"\n"+t))}]}function Xi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return t<=0?e:Array.isArray(e)?Xi(e.flatMap((e=>e)),t-1):e}function Yi(e,t){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:t.message.cadence,args:t.message.arguments.map((e=>t.arguments[e].asArgument)),data:{},interaction:t,voucher:Hi(t)}}catch(n){throw console.error("buildPreSignable",n),n}}async function Ji(e,t){const n=Array.isArray(e.payer)?e.payer:[e.payer],r=Array.isArray(e.authorizations)?e.authorizations:[e.authorizations],i=null===e.proposer?[]:Array.isArray(e.proposer)?e.proposer:[e.proposer],o=Object.keys(e.accounts),s=[...new Set(n.concat(r,i))];for(const a of o)s.find((e=>e===a))||delete e.accounts[a]}function Qi(e,t){var n;"string"!==typeof t.addr||"number"!==typeof t.keyId&&"string"!==typeof t.keyId?t.tempId=t.tempId||ve():t.tempId=`${Ot((n=t).addr)}-${n.keyId}`;const r=e.accounts[t.tempId]||t;return e.accounts[t.tempId]||(e.accounts[t.tempId]=t),e.accounts[t.tempId].role.proposer=r.role.proposer||t.role.proposer,e.accounts[t.tempId].role.payer=r.role.payer||t.role.payer,e.accounts[t.tempId].role.authorizer=r.role.authorizer||t.role.authorizer,e.accounts[t.tempId]}function $i(e){const t=Xi(e),n=new Set,r=t.map((e=>{const t=function(){for(var e=arguments.length,t=new Array(e),n=0;nnull!==e));return r}async function eo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,{debugLogger:r}=arguments.length>3?arguments[3]:void 0;if(n<=0)throw new Error("recurseResolveAccount Error: Depth limit (5) reached. Ensure your authorization functions resolve to an account after 5 resolves.");let i=e.accounts[t];if(!i)return[[],!1];if(r(`account: ${i.tempId}`,Math.max(5-n,0)),i?.resolve){if(Gi(i?.resolve)){r(`account: ${i.tempId} -- cache MISS`,Math.max(5-n,0));const{resolve:t,...o}=i;let s=await t(o,Yi(o,e));s=Array.isArray(s)?s:[s];let a=Xi(s);return a=a.map((t=>Qi(e,t))),i.resolve=a.map((e=>e.tempId)),i=Qi(e,i),[a.map((e=>e.tempId)),!0]}return r(`account: ${i.tempId} -- cache HIT`,Math.max(5-n,0)),[i.resolve,!1]}return[i.tempId?[i.tempId]:[],!1]}const to=e=>null===e?[]:Array.isArray(e)?e:[e];async function no(e,t,n){for(let r of Object.values(Zi))if(r===Zi.AUTHORIZATIONS||r===Zi.PAYER)e[r]=to(e[r]).reduce(((e,i)=>i===t?e.concat(...n.filter((e=>r===Zi.PAYER&&e.role.payer||r===Zi.AUTHORIZATIONS&&e.role.authorizer)).map((e=>e.tempId))):e.concat(i)),[]);else if(r===Zi.PROPOSER){const t=n.filter((e=>e.role.proposer));if(t.length>1)throw new Error("replaceRoles Error: Multiple proposer keys were resolved, but only one is allowed");e[r]=t[0]?.tempId??e[r]}}async function ro(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,{debugLogger:r}=arguments.length>3?arguments[3]:void 0;fe(e&&"object"===typeof e,"resolveAccountType Error: ix not defined");let i,o=new Set;for(let s of t){let t=e.accounts[s];fe(Boolean(t),"resolveAccountType Error: account not found");const[i,a]=await eo(e,s,n,{debugLogger:r});if(a){const t=$i(i.map((t=>e.accounts[t])));t.forEach((e=>o.add(e.tempId))),no(e,s,t)}}for(const s of e[Zi.PAYER]){let t=e.accounts[s];if(i){if(i!==t.addr)throw new Error("resolveAccountType Error: payers from different accounts detected")}else i=t.addr}return o}function io(e,t){return async function(n){const r=e.accounts[n];if(null!=r.signature&&void 0!==r.signature)return;const{signature:i}=await r.signingFunction(function(e,t,n){try{return{f_type:"Signable",f_vsn:"1.0.1",message:t,addr:Pt(e.addr),keyId:e.keyId,roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map((e=>n.arguments[e].asArgument)),data:{},interaction:n,voucher:Hi(n)}}catch(r){throw console.error("buildSignable",r),r}}(r,t,e));e.accounts[n].signature=i}}function oo(e){const t=Pt((Array.isArray(e.payer)?e.accounts[e.payer[0]]:e.accounts[e.payer]).addr||""),n=e.proposer?{address:Pt(e.accounts[e.proposer].addr)||"",keyId:e.accounts[e.proposer].keyId||0,sequenceNum:e.accounts[e.proposer].sequenceNum||0}:{};return{cadence:e.message.cadence,refBlock:e.message.refBlock,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map((t=>e.arguments[t].asArgument)),proposalKey:n,payer:t,authorizers:e.authorizations.map((t=>Pt(e.accounts[t].addr)||"")).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[])}}const so=e=>e,ao=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:so;return async n=>(await xt.get(`debug.${e}`)&&await t(n,(function(){for(var t=arguments.length,n=new Array(t),r=0;r["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean))),n)},co=Rr([async function(e){if(!mr(e)&&!gr(e))return e;var t=Br(e,"ix.cadence");if(fe($r(t)||ei(t),"Cadence needs to be a function or a string."),$r(t)&&(t=await t({})),fe(ei(t),"Cadence needs to be a string at this point."),fe(!ti(t)||!ni(t),"Both account identifier and contract identifier syntax not simultaneously supported."),ti(t)&&(t=await xt().where(/^0x/).then((e=>Object.entries(e).reduce(((e,t)=>{let[n,r]=t;const i=new RegExp("(\\b"+n+"\\b)","g");return e.replace(i,r)}),t)))),ni(t))for(const[n,r]of function(e){return e.matchAll(/import\s+"(\w+)"/g)}(t)){const e=await xt().get(`system.contracts.${r}`);e?t=t.replace(n,`import ${r} from ${Ot(e)}`):de({title:"Contract Placeholder not found",message:`Cannot find a value for contract placeholder ${r}. Please add to your flow.json or explicitly add it to the config 'contracts.*' namespace.`,level:le.warn})}return e.message.cadence=t,e},ao("cadence",((e,t)=>t(e.message.cadence))),async function(e){return mr(e)&&(e.message.computeLimit=e.message.computeLimit||await xt.get("fcl.limit"),e.message.computeLimit||(de.deprecate({pkg:"FCL/SDK",subject:"The built-in default compute limit (DEFAULT_COMPUTE_LIMIT=10)",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0009-deprecate-default-compute-limit"}),e.message.computeLimit=100)),e},ao("compute limit",((e,t)=>t(e.message.computeLimit))),async function(e){if(mr(e)||gr(e))for(let[t,n]of Object.entries(e.arguments)){const r=await oi(n);e.arguments[t].asArgument=ii(r)}return e},ao("arguments",((e,t)=>t(e.message.arguments,e.message))),async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(mr(e)){Array.isArray(e.payer)||de.deprecate({pkg:"FCL",subject:'"ix.payer" must be an array. Support for ix.payer as a singular',message:"See changelog for more info."});let[r,i]=Ki();try{let n=5,o=new Set([...to(e[Zi.PAYER]),...to(e[Zi.PROPOSER]),...to(e[Zi.AUTHORIZATIONS])]);for(;o.size>0;){if(n<=0)throw new Error("resolveAccounts Error: Depth limit (5) reached. Ensure your authorization functions resolve to an account after 5 resolves.");o=await ro(e,o,n,{debugLogger:r}),n--}await Ji(e);for(const t of Object.values(Zi))fe(to(e[t]).length>0||t===Zi.AUTHORIZATIONS,`resolveAccountType Error: no accounts for role "${t}" found`);t.enableDebug&&console.debug(i())}catch(n){throw console.error("=== SAD PANDA ===\n\n",n,"\n\n=== SAD PANDA ==="),n}}return e},ao("accounts",((e,t,n)=>t(...n(e)))),async function(e){if(mr(e)&&null==e.message.refBlock){const t=await xt().get("accessNode.api"),n=await xt.first(["sdk.transport","sdk.send"],Tn);fe(n,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),e.message.refBlock=(await n(jr([qr()]),{config:xt,response:Vr,Buffer:At.lW,ix:Ur},{node:t}).then(Qr)).id}return e},async function(e){if(mr(e)){var t=Object.values(e.accounts).find((e=>e.role.proposer));if(fe(t,"Transactions require a proposer"),null==t.sequenceNum){const n=await xt().get("accessNode.api"),r=await xt.first(["sdk.transport","sdk.send"],Tn);fe(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),e.accounts[t.tempId].sequenceNum=await r(await jr([zr(t.addr)]),{config:xt,response:Vr,Buffer:At.lW,ix:Ur},{node:n}).then(Qr).then((e=>e.keys)).then((e=>e.find((e=>e.index===t.keyId)))).then((e=>e.sequenceNumber))}}return e},async function(e){if(mr(e))try{let t=qi(e);const n=si(oo(e));await Promise.all(t.map(io(e,n)));let r=zi(e);const i=ai({...oo(e),payloadSigs:t.map((t=>({address:e.accounts[t].addr||"",keyId:e.accounts[t].keyId||0,sig:e.accounts[t].signature||""})))});await Promise.all(r.map(io(e,i)))}catch(t){throw console.error("Signatures",t,{ix:e}),t}return e},ao("signatures",((e,t,n)=>t(...n(e)))),async function(e){for(let t of Object.keys(e.accounts))e.accounts[t].addr=Pt(e.accounts[t].addr);return e},async function(e){return Rr(e,Br(e,"ix.validators",[]).map((e=>t=>e(t,{Ok:Gn,Bad:Zn}))))},async function(e){const t=Br(e,"ix.voucher-intercept");return Hn(t)&&await t(Hi(e)),e},ao("resolved",((e,t)=>t(e)))]);function uo(){for(var e=arguments.length,t=new Array(e),n=0;n1){const[e,n]=t;return uo(((t,r)=>{let{Ok:i,Bad:o}=r;return e?i(t):o(t,n)}))}const[r]=t;return e=>r(e,{Ok:Gn,Bad:Zn})}const lo=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await xt.first(["sdk.transport","sdk.send"],t.send||Tn);uo(n,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21");const r=await xt.first(["sdk.resolve"],t.resolve||co);return t.node=t.node||await xt().get("accessNode.api"),Array.isArray(e)&&(e=Rr(Un(),e)),n(await r(e),{config:xt,response:Vr,ix:Ur,Buffer:At.lW},t)};async function fo(e){const t=await xt().where(/^decoder\./),n=Object.entries(t).map((e=>{let[t,n]=e;return t=`/${t.replace(/^decoder\./,"")}$/`,[t,n]}));return Qr(e,Object.fromEntries(n))}class ho extends Error{constructor(e){super(`\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: ${e}. \n Please ensure the address: ${e} is intended to sign the given transaction as specified by the transaction signable.\n `.trim()),this.name="Unable To Determine Message Encoding For Signer Addresss"}}function po(e){return Dr("ix.validators",(t=>Array.isArray(t)?t.push(e):[e]))}function go(e){return Rr([t=>(t.block.height=e,t),po((e=>{if("boolean"===typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e}))])}function mo(e){return Rr([t=>(t.block.id=e,Gn(t)),po(((e,t)=>{let{Ok:n,Bad:r}=t;return vr(e)?r(e,"Unable to specify a block id with a Get Account interaction."):"boolean"===typeof e.block.isSealed?r(e,"Unable to specify both block id and isSealed."):e.block.height?r(e,"Unable to specify both block id and block height."):n(e)}))])}function bo(e){let{height:t,id:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return fe(!(n&&t),'Method: account -- Cannot pass "id" and "height" simultaneously'),n?lo([zr(e),mo(n)],r).then(Qr):t?lo([zr(e),go(t)],r).then(Qr):lo([zr(e)],r).then(Qr)}function yo(){let{sealed:e=!1,id:t,height:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fe(!(e&&t||e&&n),'Method: block -- Cannot pass "sealed" with "id" or "height"'),fe(!(t&&n),'Method: block -- Cannot pass "id" and "height" simultaneously'),t?lo([qr(),mo(t)],r).then(Qr):n?lo([qr(),go(n)],r).then(Qr):lo([qr(e)],r).then(Qr)}function vo(){return Rr([fr,e=>Gn(e)])}async function wo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return lo([vo()],e).then(Qr)}function xo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Rr(e.map((e=>Jn(e,{role:Se.AUTHORIZER}))))}function So(e,t,n,r){return{addr:e,signingFunction:t,keyId:n,sequenceNum:r}}function Ao(e,t,n){return"undefined"===typeof t&&"undefined"===typeof n||de.deprecate({pkg:"FCL/SDK",subject:"Passing a start and end into getEvents",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder"}),Rr([or,r=>(r.events.eventType=e,r.events.start=t,r.events.end=n,Gn(r))])}function Eo(e,t,n){return Rr([or,r=>(r.events.eventType=e,r.events.start=t,r.events.end=n,Gn(r))])}function _o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Rr([or,n=>(n.events.eventType=e,n.events.blockIds=t,Gn(n))])}function Co(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Rr([cr,t=>(t.block.isSealed=e,Gn(t))])}function Io(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Rr([ur,t=>(t.collection.id=e,t)])}function ko(e){return Rr([nr,t=>(t.transaction.id=e,Gn(t))])}function To(e){return Rr([rr,t=>(t.transaction.id=e,Gn(t))])}function Mo(){return Rr([lr,e=>Gn(e)])}function Po(e){return t=>(t.message.computeLimit=e,t)}function Oo(e){return Rr(e.map(Qn))}function Ro(e,t){return{value:e,xform:t}}function No(e){return Jn(e,{role:Se.PROPOSER})}function Bo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)||(e=[e]),Rr(e.map((e=>Jn(e,{role:Se.PAYER}))))}function Lo(){return sr}function Do(e){return Rr([t=>(t.message.refBlock=e,Gn(t))])}function Uo(){return Rr([er,Lr("ix.cadence",Rn(...arguments))])}const jo=[];function Fo(){return Rr([tr,Lr("ix.cadence",Rn(...arguments)),e=>(e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||jo,Gn(e))])}function Vo(e){return Lr("ix.voucher-intercept",e)}function qo(e){let{startBlockId:t,startHeight:n,eventTypes:r,addresses:i,contracts:o,heartbeatInterval:s}=e;return fe(!(t&&n),"SDK Subscribe Events Error: Cannot set both startBlockId and startHeight."),Rr([dr,e=>(e.subscribeEvents.startBlockId=t??null,e.subscribeEvents.startHeight=n??null,e.subscribeEvents.eventTypes=r??null,e.subscribeEvents.addresses=i??null,e.subscribeEvents.contracts=o??null,e.subscribeEvents.heartbeatInterval=s??null,Gn(e))])}function zo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;fe(e.account,"mockAccountResponse(ix) -- ix.account is missing",e),fe(e.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",e);const n=e.account.addr;return{account:{addr:n,keys:Array.from({length:t},((e,t)=>({index:t,sequenceNumber:42})))}}}const Ho=e=>e;function Wo(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Go(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){const n={...t,...e,resolve:null,signingFunction:e.signingFunction||t.signingFunction||function(e){return{addr:n.addr,keyId:n.keyId,signature:Wo(n)}}};return n}}const Zo={proposer:!1,authorizer:!1,payer:!1};function Ko(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{authorizations:[]};return function(t){return{...t,tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:()=>[e.proposer&&Go(e.proposer)({role:{...Zo,proposer:!0}}),...e.authorizations.map(Go).map((e=>e({role:{...Zo,authorizer:!0}}))),e.payer&&Go(e.payer)({role:{...Zo,payer:!0}})].filter(Boolean)}}}var Xo=Object.freeze({__proto__:null,mockSend:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ho;return async function(t){switch(t=await t,!0){case vr(t):return zo(t);case Sr(t):return{tag:"GET_BLOCK",block:{id:"32"}};default:return e(t)}}},authzFn:Go,authzResolve:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){const{tempId:n,...r}=e;return{...t,tempId:n||"WITH_RESOLVE",resolve:Go(r)}}},authzResolveMany:Ko,authzDeepResolveMany:function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{authorizations:[]},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return function(r){const i=t.tempId||"AUTHZ_DEEP_RESOLVE_MANY";return{...r,tempId:i,resolve:n>0?e(t,n-1)(r).resolve:Ko(t)(r).resolve}}},sig:Wo,idof:e=>`${Ot(e.addr)}-${e.keyId}`,run:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return jr([Do("123"),...e]).then(co)}});const Yo=e=>de.deprecate({pkg:"FCL/SDK",message:"The params builder has been removed from the Flow JS-SDK/FCL.",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params",level:le.error}),Jo=e=>de.deprecate({pkg:"FCL/SDK",message:"The param builder has been removed from the Flow JS-SDK/FCL.",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params",level:le.error}),Qo=(e,t,n)=>({label:e,asArgument:t,asInjection:t=>(de.deprecate({pkg:"@onflow/types",subject:`Passing in ${e} as value for ${e}`,message:`Going forward, use ${e} as value for ${e}.`}),n(t))}),$o=e=>Array.isArray(e),es=e=>"object"===typeof e,ts=e=>null==e,ns=e=>"number"===typeof e,rs=e=>Number.isInteger(e),is=e=>"string"===typeof e,os=e=>{throw new Error("Type Error: "+e)},ss=e=>{de.deprecate({pkg:"@onflow/types",subject:`Passing in Number as value for ${e}`,message:`Going forward, use String as value for ${e}.`,transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0002-[U]Int*-and-Word*-as-Number"})};let as=!1;const cs={label:"Identity",asArgument:e=>(as||(de.deprecate({pkg:"@onflow/types",subject:"Identity",message:"Identity type is deprecated and will be removed in v2.0.0. Please remove it from your code."}),as=!0),e),asInjection:e=>e},us=Qo("UInt",(e=>ns(e)&&rs(e)?(ss("UInt"),{type:"UInt",value:e.toString()}):is(e)?{type:"UInt",value:e}:os("Expected Positive Integer for type Unsigned Int")),(e=>e)),ls=Qo("Int",(e=>ns(e)&&rs(e)?(ss("Int"),{type:"Int",value:e.toString()}):is(e)?{type:"Int",value:e}:os("Expected Integer for type Int")),(e=>e)),ds=Qo("UInt8",(e=>ns(e)&&rs(e)?(ss("UInt8"),{type:"UInt8",value:e.toString()}):is(e)?{type:"UInt8",value:e}:os("Expected integer for UInt8")),(e=>e)),fs=Qo("Int8",(e=>ns(e)&&rs(e)?(ss("Int8"),{type:"Int8",value:e.toString()}):is(e)?{type:"Int8",value:e}:os("Expected positive integer for Int8")),(e=>e)),hs=Qo("UInt16",(e=>ns(e)&&rs(e)?(ss("UInt16"),{type:"UInt16",value:e.toString()}):is(e)?{type:"UInt16",value:e}:os("Expected integer for UInt16")),(e=>e)),ps=Qo("Int16",(e=>ns(e)&&rs(e)?(ss("Int16"),{type:"Int16",value:e.toString()}):is(e)?{type:"Int16",value:e}:os("Expected positive integer for Int16")),(e=>e)),gs=Qo("UInt32",(e=>ns(e)&&rs(e)?(ss("UInt32"),{type:"UInt32",value:e.toString()}):is(e)?{type:"UInt32",value:e}:os("Expected integer for UInt32")),(e=>e)),ms=Qo("Int32",(e=>ns(e)&&rs(e)?(ss("Int32"),{type:"Int32",value:e.toString()}):is(e)?{type:"Int32",value:e}:os("Expected positive integer for Int32")),(e=>e)),bs=Qo("UInt64",(e=>ns(e)&&rs(e)?(ss("UInt64"),{type:"UInt64",value:e.toString()}):is(e)?{type:"UInt64",value:e}:os("Expected integer for UInt64")),(e=>e)),ys=Qo("Int64",(e=>ns(e)&&rs(e)?(ss("Int64"),{type:"Int64",value:e.toString()}):is(e)?{type:"Int64",value:e}:os("Expected positive integer for Int64")),(e=>e)),vs=Qo("UInt128",(e=>ns(e)&&rs(e)?(ss("UInt128"),{type:"UInt128",value:e.toString()}):is(e)?{type:"UInt128",value:e}:os("Expected integer for UInt128")),(e=>e)),ws=Qo("Int128",(e=>ns(e)&&rs(e)?(ss("Int128"),{type:"Int128",value:e.toString()}):is(e)?{type:"Int128",value:e}:os("Expected positive integer for Int128")),(e=>e)),xs=Qo("UInt256",(e=>ns(e)&&rs(e)?(ss("UInt256"),{type:"UInt256",value:e.toString()}):is(e)?{type:"UInt256",value:e}:os("Expected integer for UInt256")),(e=>e)),Ss=Qo("Int256",(e=>ns(e)&&rs(e)?(ss("Int256"),{type:"Int256",value:e.toString()}):is(e)?{type:"Int256",value:e}:os("Expected integer for Int256")),(e=>e)),As=Qo("Word8",(e=>ns(e)&&rs(e)?(ss("Word8"),{type:"Word8",value:e.toString()}):is(e)?{type:"Word8",value:e}:os("Expected positive number for Word8")),(e=>e)),Es=Qo("Word16",(e=>ns(e)&&rs(e)?(ss("Word16"),{type:"Word16",value:e.toString()}):is(e)?{type:"Word16",value:e}:os("Expected positive number for Word16")),(e=>e)),_s=Qo("Word32",(e=>ns(e)&&rs(e)?(ss("Word32"),{type:"Word32",value:e.toString()}):is(e)?{type:"Word32",value:e}:os("Expected positive number for Word32")),(e=>e)),Cs=Qo("Word64",(e=>ns(e)&&rs(e)?(ss("Word64"),{type:"Word64",value:e.toString()}):is(e)?{type:"Word64",value:e}:os("Expected positive number for Word64")),(e=>e)),Is=Qo("Word128",(e=>ns(e)&&rs(e)?(ss("Word128"),{type:"Word128",value:e.toString()}):is(e)?{type:"Word128",value:e}:os("Expected positive number for Word128")),(e=>e)),ks=Qo("Word256",(e=>ns(e)&&rs(e)?(ss("Word256"),{type:"Word256",value:e.toString()}):is(e)?{type:"Word256",value:e}:os("Expected positive number for Word256")),(e=>e)),Ts=()=>{de.deprecate({subject:"Passing in Numbers as values for Fix64 and UFix64 types",pkg:"@onflow/types",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0001-[U]Fix64-as-Number"})},Ms=Qo("UFix64",(e=>{if(is(e)){const t=e.split(".");return 2!==t.length?os(`Expected one decimal but found ${t.length} in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):0==t[1].length||t[1].length>8?os(`Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ${t[1].length} digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):(t[1]=t[1].padEnd(8,"0"),{type:"UFix64",value:e=t.join(".")})}return ns(e)?(Ts(),{type:"UFix64",value:e.toString()}):os("Expected String for UFix64")}),(e=>e)),Ps=Qo("Fix64",(e=>{if(is(e)){const t=e.split(".");return 2!==t.length?os(`Expected one decimal but found ${t.length} in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):0==t[1].length||t[1].length>8?os(`Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ${t[1].length} digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):(t[1]=t[1].padEnd(8,"0"),{type:"Fix64",value:e=t.join(".")})}return ns(e)?(Ts(),{type:"Fix64",value:e.toString()}):os("Expected String for Fix64")}),(e=>e)),Os=Qo("String",(e=>is(e)?{type:"String",value:e}:os("Expected String for type String")),(e=>e)),Rs=Qo("Character",(e=>is(e)?{type:"Character",value:e}:os("Expected Character for type Character")),(e=>e)),Ns=Qo("Bool",(e=>(e=>"boolean"===typeof e)(e)?{type:"Bool",value:e}:os("Expected Boolean for type Bool")),(e=>e)),Bs=Qo("Address",(e=>is(e)?{type:"Address",value:e}:os("Expected Address for type Address")),(e=>e)),Ls=Qo("Void",(e=>!e||ts(e)?{type:"Void",value:null}:os("Expected Void for type Void")),(e=>e)),Ds=e=>Qo("Optional",(t=>({type:"Optional",value:ts(t)?null:e.asArgument(t)})),(e=>e)),Us=Qo("Reference",(e=>es(e)?{type:"Reference",value:e}:os("Expected Object for type Reference")),(e=>e)),js=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Qo("Array",(t=>({type:"Array",value:$o(e)?e.map(((e,n)=>e.asArgument(t[n]))):t.map((t=>e.asArgument(t)))})),(e=>e))},Fs=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Qo("Dictionary",(t=>{const n=$o(t),r=$o(e);return es(t)?{type:"Dictionary",value:r&&n?e.map(((e,n)=>({key:e.key.asArgument(t[n].key),value:e.value.asArgument(t[n].value)}))):n&&!r?t.map((t=>({key:e.key.asArgument(t.key),value:e.value.asArgument(t.value)}))):n||r?os("Invalid arguments for Dictionary."):[{key:e.key.asArgument(t.key),value:e.value.asArgument(t.value)}]}:os("Expected Object for type Dictionary")}),(e=>e))},Vs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qo("Event",(n=>es(n)?{type:"Event",value:{id:e,fields:$o(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:os("Expected Object for type Event")),(e=>e))},qs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qo("Resource",(n=>es(n)?{type:"Resource",value:{id:e,fields:$o(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:os("Expected Object for type Resource")),(e=>e))},zs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qo("Struct",(n=>es(n)?{type:"Struct",value:{id:e,fields:$o(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:os("Expected Object for type Struct")),(e=>e))},Hs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qo("Enum",(n=>es(n)?{type:"Enum",value:{id:e,fields:$o(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:os("Expected Object for type Enum")),(e=>e))},Ws=Qo("Path",(e=>es(e)?is(e.domain)?"storage"!==e.domain&&"private"!==e.domain&&"public"!==e.domain?os(`Expected either "storage", "private" or "public" as the Path domain but found ${e.domain}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):is(e.identifier)?{type:"Path",value:{domain:e.domain,identifier:e.identifier}}:os(`Expected a string for the Path identifier but found ${e.identifier}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):os(`Expected a string for the Path domain but found ${e.domain}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):os("Expected Object for type Path")),(e=>e)),Gs=e=>Qo("InclusiveRange",(t=>{if(es(t)){const{start:n,end:r,step:i}=t;return{type:"InclusiveRange",value:{start:e.asArgument(n),end:e.asArgument(r),step:e.asArgument(i)}}}return os("Expected Object for type InclusiveRange")}),(e=>e));var Zs=n(58368),Ks=n.n(Zs),Xs=n(33037),Ys=/^[0-9]+$/,Js=function(e,t){var n=Ys.test(e),r=Ys.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:eparseInt(r[i]))return 1;if(parseInt(n[i])t=>typeof t===e,na=e=>null!=e,ra=ta("object"),ia=ta("string"),oa=ta("function"),sa=ta("number");function aa(e){return oa(e)?e(Ro,r):[]}async function ca(e){let t,{url:n}=e;fe("undefined"!==typeof n,"retrieve({ url }) -- url must be defined");try{t=await Ks()(n)}catch(r){throw new Error("httpDocumentResolver Error: Failed to retrieve document.")}return t.ok?await t.json():null}const ua=new Map([["http",ca],["https",ca]]);async function la(e){let{network:t,template:n}=e;fe("1.1.0"===n.f_version,"deriveCadenceByNetwork110({ template }) -- template must be version 1.0.0");const r={};return n?.data?.dependencies.forEach((e=>{e.contracts.forEach((e=>{const n=e.contract;e.networks.forEach((e=>{e.network===t&&(r[n]=e.address)})),fe(void 0!==r[n],`deriveCadenceByNetwork110 -- Could not find contracts Network Address: ${t} ${n}`)}))})),fe(Object.keys(r).length===n?.data?.dependencies.length,`deriveCadenceByNetwork110 -- Could not find contracts for import dependencies: ${r}`),fe(Object.keys(r).length===Object.values(r).length,`deriveCadenceByNetwork110 -- Could not find all addresses for network ${t} dependencies: ${r}`),fe(n?.data?.cadence?.body,`no cadence found -- Could not replace import dependencies: ${r}`),function(e){let{cadence:t,networkDependencies:n}=e;return Object.keys(n).reduce(((e,t)=>{const r=n[t],i=new RegExp(`import "\\b${t}\\b"`,"g");return e.replace(i,`import ${t} from ${r}`)}),t)}({cadence:n?.data?.cadence?.body,networkDependencies:r})}async function da(e){let{network:t,template:n}=e;switch(fe(void 0!=t,"deriveCadenceByNetwork({ network }) -- network must be defined"),fe("string"===typeof t,"deriveCadenceByNetwork({ network }) -- network must be a string"),fe(void 0!=n,"deriveCadenceByNetwork({ template }) -- template must be defined"),fe("object"===typeof n,"deriveCadenceByNetwork({ template }) -- template must be an object"),fe("InteractionTemplate"===n.f_type,"deriveCadenceByNetwork({ template }) -- template must be an InteractionTemplate"),n.f_version){case"1.1.0":return await la({network:t,template:n});case"1.0.0":return await async function(e){let{network:t,template:n}=e;return fe("1.0.0"===n.f_version,"deriveCadenceByNetwork100({ template }) -- template must be version 1.0.0"),Object.keys(n?.data?.dependencies).map((e=>{const r=Object.values(n?.data?.dependencies?.[e]);fe(void 0!==r,`deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ${e}`),fe(r.length>0,`deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ${e}`);const i=r[0]?.[t];return fe(i,`deriveCadenceByNetwork100 -- Could not find ${t} network information for dependency: ${e}`),[e,i?.address]})).reduce(((e,t)=>{let[n,r]=t;const i=new RegExp("(\\b"+n+"\\b)","g");return e.replace(i,r)}),n.data.cadence)}({network:t,template:n});default:throw new Error("deriveCadenceByNetwork Error: Unsupported template version")}}async function fa(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=await lo([Mo()],e).then(fo);return t.chainId}let ha={},pa=!1;async function ga(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=await xt.get("flow.network"),n=await xt.get("env");n&&!pa&&(de.deprecate({pkg:"FCL",subject:'Using the "env" configuration key for specifying the flow network',message:"Configuring to specify flow network is no longer required",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/TRANSITIONS.md#0001-deprecate-env-config-key"}),pa=!0);const r=e.node||await xt.get("accessNode.api");if(!r){if(t)return t;if(n)return n;throw new Error('Either the "accessNode.api" config key or opts.node must be set')}if(ha[r])try{return await ha[r]}catch{}ha[r]||(ha[r]=fa(e).catch((e=>{throw ha[r]=null,e})));try{return await ha[r]}catch(i){if(t)return t;if(n)return n;throw new Error(`Error getting chainId from access node - are you using the correct access node endpoint. If running locally, is your emulator up-to-date? ${i.message}`)}}function ma(){return"undefined"!==typeof navigator&&/iPhone|iPod/.test(navigator.userAgent)||"undefined"!==typeof navigator&&/iPad/.test(navigator.userAgent)}function ba(){return"undefined"!==typeof navigator&&/android/i.test(navigator.userAgent)||ma()}async function ya(e){ia(e?.template)&&(e.template=await async function(e){let{url:t}=e;fe("undefined"!==typeof t,"retrieve({ url }) -- url must be defined"),fe("string"===typeof t,"retrieve({ url }) -- url must be a string");const n=await xt().where(/^document\.resolver\./);Object.keys(n).map((e=>{const t=n[e],r=e.replace(/^document\.resolver\./,"");ua.set(r,t)}));const r=/^(.*):\/\/([A-Za-z0-9\-\.]+)(:[0-9]+)?(.*)$/.exec(t);fe(r,"Failed to parse URL");const i=r[1];fe(r,"Failed to parse URL protocol");const o=ua.get(i);return fe(o,`No resolver found for protcol=${i}`),await o({url:t})}({url:e?.template}));const t=e.cadence||await da({template:e.template,network:await ga(e)});return e.cadence=t,e}async function va(e,t){fe(na(t),`${e}(opts) -- opts is required`),fe(ra(t),`${e}(opts) -- opts must be an object`),fe(!(t.cadence&&t.template),`${e}({ template, cadence }) -- cannot pass both cadence and template`),fe(na(t.cadence||t?.template),`${e}({ cadence }) -- cadence is required`),fe(ia(t.cadence)||t?.template,`${e}({ cadence }) -- cadence must be a string`),fe(await xt().get("accessNode.api"),`${e}(opts) -- Required value for "accessNode.api" not defined in config. See: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/src/exec/query.md#configuration`)}async function wa(e){return va("mutate",e)}async function xa(e){return va("query",e)}async function Sa(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return await xa(e),e=await ya(e),lo([Uo(e.cadence),Oo(aa(e.args||[])),e.limit&&"number"===typeof e.limit&&Po(e.limit)]).then(fo)}const Aa="fcl_redirect_url",Ea="fclResponseJson",_a={"HTTP/RPC":"HTTP/RPC","HTTP/POST":"HTTP/POST","IFRAME/RPC":"IFRAME/RPC","POP/RPC":"POP/RPC","TAB/RPC":"TAB/RPC","EXT/RPC":"EXT/RPC","DEEPLINK/RPC":"DEEPLINK/RPC"},Ca=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};const n=e=>(e.deprecated&&console.warn("DEPRECATION NOTICE",e.deprecated.message),delete e?.body?.interaction,e),r=r=>{const{data:i}=r;"object"===typeof i&&null!=typeof i&&i.type===e&&t(n(i))};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)};let Ia=!1;const ka=globalThis.URL;class Ta extends ka{constructor(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i1&&void 0!==arguments[1]?arguments[1]:{};const n={...t,type:e},r=new URLSearchParams(window.location.search),i=r.get(Aa);if(i){const e=new Ta(i);e.searchParams.append(Ea,JSON.stringify(n)),window.location.href=e.href}else if(window.location!==window.parent.location)window.parent.postMessage({...t,type:e},"*");else{if(!window.opener)throw new Error("Unable to communicate with parent FCL instance");window.opener.postMessage({...t,type:e},"*")}},Pa={f_type:"Service",f_vsn:"1.0.0"},Oa={f_type:"Identity",f_vsn:"1.0.0"},Ra={f_type:"USER",f_vsn:"1.0.0"},Na={f_type:"PollingResponse",f_vsn:"1.0.0"},Ba={f_type:"CompositeSignature",f_vsn:"1.0.0"};const La=(e,t)=>At.lW.from(e.padEnd(2*t,"0"),"hex"),Da=e=>((e,t)=>At.lW.from(e.padStart(2*t,"0"),"hex"))(e,8),Ua=e=>At.lW.from(e,"hex"),ja=function(e){let{address:t,nonce:n,appIdentifier:r}=e,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];fe(t,"Encode Message For Provable Authn Error: address must be defined"),fe(n,"Encode Message For Provable Authn Error: nonce must be defined"),fe(r,"Encode Message For Provable Authn Error: appIdentifier must be defined"),fe(n.length>=64,"Encode Message For Provable Authn Error: nonce must be minimum of 32 bytes");const o=La(At.lW.from("FCL-ACCOUNT-PROOF-V0.0").toString("hex"),32);return i?At.lW.concat([o,Et([r,Da(Pt(t)),Ua(n)])]).toString("hex"):Et([r,Da(Pt(t)),Ua(n)]).toString("hex")};var Fa=Object.freeze({__proto__:null,sendMsgToFCL:Ma,ready:function(e){Ca("FCL:VIEW:READY:RESPONSE",e),Ma("FCL:VIEW:READY")},close:()=>{Ma("FCL:VIEW:CLOSE")},approve:e=>{Ma("FCL:VIEW:RESPONSE",{f_type:"PollingResponse",f_vsn:"1.0.0",status:"APPROVED",reason:null,data:e})},decline:e=>{Ma("FCL:VIEW:RESPONSE",{f_type:"PollingResponse",f_vsn:"1.0.0",status:"DECLINED",reason:e,data:null})},redirect:e=>{Ma("FCL:VIEW:RESPONSE",{f_type:"PollingResponse",f_vsn:"1.0.0",status:"REDIRECT",reason:null,data:e})},onMessageFromFCL:Ca,encodeMessageFromSignable:(e,t)=>{let n=(e=>{let t=new Set(e.authorizers);return t.add(e.proposalKey.address),t.delete(e.payer),Array.from(t).map(Ot)})(e.voucher),r=(e=>{let t=new Set([e.payer]);return Array.from(t).map(Ot)})(e.voucher);const i=n.includes(Ot(t)),o=r.includes(Ot(t));if(!i&&!o)throw new ho(t);const s={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:{...e.voucher.proposalKey,address:Pt(e.voucher.proposalKey.address)},payer:Pt(e.voucher.payer),authorizers:e.voucher.authorizers.map(Pt),payloadSigs:e.voucher.payloadSigs.map((e=>({...e,address:Pt(e.address)})))};return i?si(s):ai(s)},CompositeSignature:function(e,t,n){this.f_type=Ba.f_type,this.f_vsn=Ba.f_vsn,this.addr=Ot(e),this.keyId=Number(t),this.signature=n},encodeAccountProof:ja,injectExtService:function(e){"authn"===e.type&&null!=e.endpoint?(Array.isArray(window.fcl_extensions)||(window.fcl_extensions=[]),window.fcl_extensions.push(e)):console.warn("Authn service is required")}});const Va="ACCOUNT_PROOF",qa="USER_SIGNATURE",za=e=>{if(e.appIdentifier){const{appIdentifier:t,address:n,nonce:r,signatures:i}=e;return fe(ia(t),"verifyAccountProof({ appIdentifier }) -- appIdentifier must be a string"),fe(ia(n)&&16===Pt(n).length,"verifyAccountProof({ address }) -- address must be a valid address"),fe(/^[0-9a-f]+$/i.test(r),"nonce must be a hex string"),fe(Array.isArray(i)&&i.every(((e,t,n)=>"CompositeSignature"===e.f_type)),"Must include an Array of CompositeSignatures to verify"),fe(i.map((e=>e.addr)).every(((e,t,n)=>e===n[0])),"User signatures to be verified must be from a single account address"),!0}{const{message:t,address:n,compSigs:r}=e;return fe(/^[0-9a-f]+$/i.test(t),"Signed message must be a hex string"),fe(ia(n)&&16===Pt(n).length,"verifyUserSignatures({ address }) -- address must be a valid address"),fe(Array.isArray(r)&&r.every(((e,t,n)=>"CompositeSignature"===e.f_type)),"Must include an Array of CompositeSignatures to verify"),fe(r.map((e=>e.addr)).every(((e,t,n)=>e===n[0])),"User signatures to be verified must be from a single account address"),!0}},Ha=async(e,t)=>{const n="ACCOUNT_PROOF"===e?"verifyAccountProofSignatures":"verifyUserSignatures";let r=await ga(t);const i=t.fclCryptoContract||{testnet:"0x74daa6f9c7ef24b1",mainnet:"0xb4b82a1c9d21d284",previewnet:"0x40b5b8b2ce81ea4a"}[r];return fe(i,`${n}({ fclCryptoContract }) -- FCLCrypto contract address is unknown for network: ${r}. Please manually specify the FCLCrypto contract address.`),`\n import FCLCrypto from ${i}\n\n access(all) fun main(\n address: Address, \n message: String, \n keyIndices: [Int], \n signatures: [String]\n ): Bool {\n return FCLCrypto.${n}(address: address, message: message, keyIndices: keyIndices, signatures: signatures)\n }\n `};async function Wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Ot(t[0].addr);za({message:e,address:r,compSigs:t});let i=[],o=[];for(const s of t)i.push(s.signature),o.push(s.keyId.toString());return Sa({cadence:await Ha(qa,n),args:(t,n)=>[t(r,n.Address),t(e,n.String),t(o,n.Array(n.Int)),t(i,n.Array(n.String))]})}var Ga=Object.freeze({__proto__:null,verifyAccountProof:async function(e,t){let{address:n,nonce:r,signatures:i}=t,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};za({appIdentifier:e,address:n,nonce:r,signatures:i});const s=ja({address:n,nonce:r,appIdentifier:e},!1);let a=[],c=[];for(const u of i)a.push(u.signature),c.push(u.keyId.toString());return Sa({cadence:await Ha(Va,o),args:(e,t)=>[e(Ot(n),t.Address),e(s,t.String),e(c,t.Array(t.Int)),e(a,t.Array(t.String))]})},verifyUserSignatures:Wa});const Za=de.deprecate({pkg:"FCL",subject:"fcl.verifyUserSignatures()",message:"Please use fcl.AppUtils.verifyUserSignatures()",callback:function(e,t){return Wa(e,t)}}),Ka=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await xt.first(["sdk.resolve"],t.resolve||co);return Array.isArray(e)&&(e=await Rr(jn(),e)),JSON.stringify(Hi(await n(e)),null,2)};async function Xa(e){return Object.fromEntries(Object.entries(await xt().where(e)).map((t=>{let[n,r]=t;return[n.replace(e,""),r]})))}const Ya=/^[0-9a-fA-F]{64}$/,Ja="POLL",Qa="TIMEOUT",$a=async e=>lo([ko(e)]).then(fo),ec=e=>e.status>=4,tc=e=>e.status>=3,nc=e=>e.status>=2,rc=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),ic=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{[Ie]:async t=>{setTimeout((()=>t.sendSelf(Qa)),e.txNotFoundTimeout),t.sendSelf(Ja)},[ke]:(e,t)=>{e.subscribe(t.from),e.send(t.from,Me,e.all())},[Te]:(e,t)=>{e.unsubscribe(t.from)},[Pe]:async(e,t)=>{t.reply(e.all())},[Qa]:async t=>{0===Object.keys(t.all()).length&&t.fatalError(new Error(`TX status polling failed: no transaction was found within timeout interval (${e.txNotFoundTimeout}ms)`))},[Ja]:async t=>{const n=()=>setTimeout((()=>t.sendSelf(Ja)),e.pollRate);let r;const i=t.all();try{r=await $a(t.self())}catch(o){const e=o instanceof Ft&&404===o.statusCode,r=o.code===Xs.grpc.Code.NotFound;return e||r?n():t.fatalError(o)}ec(r)||n(),rc(i,r)&&t.broadcast(Me,r),t.merge(r)}}},oc=e=>{if("object"===typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},sc=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>Fe(ic(e),oc(t))};function ac(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{txNotFoundTimeout:12500,pollRate:2500};if(!Ya.test(oc(e)))throw new Error("Invalid transactionId");function n(){return ze(e,sc(t))}function r(n){return qe(oc(e),sc(t),n)}function i(e){return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=t.suppress||!1;return new Promise(((t,i)=>{const o=r(((r,s)=>{!s&&!r.statusCode||n?e(r)&&(t(r),o()):(i(s||r.errorMessage),o())}))}))}}return{snapshot:n,subscribe:r,onceFinalized:i(nc),onceExecuted:i(tc),onceSealed:i(ec)}}ac.isUnknown=e=>e.status>=0,ac.isPending=e=>e.status>=1,ac.isFinalized=nc,ac.isExecuted=tc,ac.isSealed=ec,ac.isExpired=e=>5===e.status;const cc="TICK",uc="hwm",lc=async e=>setTimeout((()=>e.sendSelf(cc)),await xt().get("fcl.eventPollRate",1e4)),dc={[cc]:async e=>{if(!e.hasSubs())return;let t=e.get(uc);if(null==t)e.put(uc,await yo()),e.put(cc,await lc(e));else{let n=await yo();if(e.put(uc,n),t.height{e.hasSubs()||e.put(cc,await lc(e)),e.subscribe(t.from)},[Te]:(e,t)=>{e.unsubscribe(t.from),e.hasSubs()||(clearTimeout(e.get(cc)),e.delete(cc),e.delete(uc))}},fc=e=>Fe(dc,e);function hc(e){let t;return t="string"===typeof e?{eventTypes:[e]}:e||{},{subscribe:n=>{const r=lo([qo(t)]).then(fo),i=r.then((()=>null)).catch((t=>{if("SDK Send Error: subscribeEvents is not supported by this transport."!==t.message)throw t;if("string"!==typeof e)throw new Error("GRPC fcl.events fallback only supports string (type) filters");return(r=e,{subscribe:e=>qe(r,fc,e)}).subscribe(n);var r}));function o(e){e.forEach((e=>n(e,null)))}function s(e){n(null,e)}return i.then((e=>{e||r.then((e=>e.on("events",o).on("error",s))).catch((e=>{r.then((e=>e.close())),s(e)}))})),()=>{i.then((e=>{e?e():r.then((e=>e.close()))}))}}}}const pc=()=>{throw new Error("Platform specific Core Strategies are not initialized")},gc={[_a["EXT/RPC"]]:pc,[_a["HTTP/POST"]]:pc,[_a["IFRAME/RPC"]]:pc,[_a["POP/RPC"]]:pc,[_a["TAB/RPC"]]:pc,[_a["EXT/RPC"]]:pc},mc=["ServicePlugin"],bc=["discovery-service"],yc=e=>{let{coreStrategies:t}=e,n=new Set,r=new Map(Object.entries(t));const i=e=>n=new Set([...e]);return Object.freeze({add:e=>{if(fe(bc.includes(e.type),`Service Plugin type ${e.type} is not supported`),"discovery-service"===e.type){const{discoveryServices:t,serviceStrategy:n}=(e=>{const{services:t=[],serviceStrategy:n}=e;fe(Array.isArray(t),"Services must be an array");for(const r of t)fe(na(r.f_type)&&"Service"===r.f_type,"Service is required"),fe(na(r.type)&&"authn"===r.type,`Service must be type authn. Received ${r.type}`),fe(r.method in _a||n.method===r.method,`Service method ${r.method} is not supported`);return fe(na(n),"Service strategy is required"),fe(na(n.method)&&ia(n.method),"Service strategy method is required"),fe(na(n.exec)&&oa(n.exec),"Service strategy exec function is required"),{discoveryServices:t,serviceStrategy:n}})(e);i(t),r.has(n.method)?de({title:"Add Service Plugin",message:`Service strategy for ${n.method} already exists`,level:le.warn}):r.set(n.method,n.exec)}},getServices:()=>[...n],getStrategy:e=>r.get(e),getStrategies:()=>[...r.keys()]})};let vc;const wc=()=>"undefined"!==typeof vc,xc=e=>{let{coreStrategies:t}=e;if(wc())return vc;const n=yc({coreStrategies:t});return vc=n,n},Sc=()=>wc()?vc:(console.warn("Registry is not initalized, it will be initialized with stub core strategies"),xc({coreStrategies:gc})),Ac=(()=>{const e=new Map;return Object.freeze({add:t=>{const n=(e=>{let t;fe(!!e,"No plugins supplied"),t=Array.isArray(e)?[...e]:[e];for(const n of t)fe(na(n.name),"Plugin name is required"),fe(na(n.f_type),"Plugin f_type is required"),fe(mc.includes(n.f_type),`Plugin type ${n.f_type} is not supported`);return t})(t);for(const r of n)e.set(r.name,r),"ServicePlugin"===r.f_type&&vc.add(r)},getPlugins:()=>e})})(),Ec=async()=>[...window?.fcl_extensions||[],...Sc().getServices()];async function _c(e){const t=await xt.get("discovery.authn.include",[]),n=await xt.get("discovery.features.suggested",[]),r=await xt.first(["discovery.wallet.method","discovery.wallet.method.default"]),i=e?.method?e.method:r,o=e?.endpoint??await xt.first(["discovery.wallet","challenge.handshake"]);return fe(o,'\n If no service is passed to "authenticate," then "discovery.wallet" must be defined in fcl config.\n See: "https://docs.onflow.org/fcl/reference/api/#setting-configuration-values"\n '),{...e,type:"authn",endpoint:o,method:i,discoveryAuthnInclude:t,discoveryFeaturesSuggested:n}}const Cc="authn",Ic="UPDATED",kc="UPDATE_RESULTS",Tc=async()=>{try{const e=await async function(e){let{types:t}=e;const n=await xt.get("discovery.authn.endpoint");fe(Boolean(n),'"discovery.authn.endpoint" in config must be defined.');const r=await xt.get("discovery.authn.include",[]),i=new Ta(n);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,fclVersion:ea,include:r,features:{suggested:await xt.get("discovery.features.suggested",[])},clientServices:await Ec(),supportedStrategies:Sc().getStrategies(),userAgent:window?.navigator?.userAgent,network:await ga()})}).then((e=>e.json()))}({types:[Cc]});Le(Cc,kc,{results:e})}catch(e){de({title:`${e.name} Error fetching Discovery API services.`,message:e.message,level:le.error})}},Mc={[Ie]:async e=>{var t,n;t="undefined"===typeof window,n='"fcl.discovery" is only available in the browser.',t&&console.warn(`\n %cFCL Warning\n ============================\n ${n}\n For more info, please see the docs: https://docs.onflow.org/fcl/\n ============================\n `,"font-weight:bold;font-family:monospace;"),"complete"===document.readyState?Tc():window.addEventListener("load",(()=>{Tc()}))},[kc]:(e,t,n)=>{e.merge(n),e.broadcast(Ic,{...e.all()})},[ke]:(e,t)=>{e.subscribe(t.from),e.send(t.from,Ic,{...e.all()})},[Te]:(e,t)=>e.unsubscribe(t.from),["SNAPSHOT"]:async(e,t)=>t.reply({...e.all()})},Pc=()=>Fe(Mc,Cc),Oc={authn:{subscribe:e=>qe(Cc,Pc,e),snapshot:()=>ze(Cc,Pc),update:()=>{"complete"===document.readyState&&Tc()}}};function Rc(e){const t=new Mn.Aj(256);return t.update(At.lW.from(e,"utf8")),t.digest("hex")}function Nc(e){let{contractName:t,address:n}=e;return{contractName:t,address:n,contract:""}}function Bc(e){const t=[],n=e.match(/import ((\w|,| )+)* from 0x\w+/g)||[];for(const r of n){const e=/import ((\w+|, |)*) from (0x\w+)/g.exec(r),n=/((?:\w+)+),?/g,i=e[1].match(n)||[];for(const r of i)t.push(Nc({address:e[3],contractName:r.replace(/,/g,"")}))}return t}async function Lc(e){let{address:t,contractName:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};uo(void 0!=t,"generateDependencyPin({ address }) -- address must be defined"),uo(void 0!=n,"generateDependencyPin({ contractName }) -- contractName must be defined"),uo("string"===typeof t,"generateDependencyPin({ address }) -- address must be a string"),uo("string"===typeof n,"generateDependencyPin({ contractName }) -- contractName must be a string");const i=[Nc({contractName:n,address:t})];for(const c of i){const e=await lo([zr(await xt().get(c.address,c.address))],r).then(fo);if(c.contract=e.contracts?.[c.contractName],!c.contract)throw console.error("Did not find expected contract",c,e),new Error("Did not find expected contract");const t=Bc(c.contract);i.push(...t)}const o=i.map((e=>Rc(e.contract))),s=await Promise.all(o),a=s.join("");return Rc(a)}async function Dc(e,t){const n=[];for(const r of t){const t=[Rc(r.network)],{address:i,dependency_pin_block_height:o}=r;if(r.dependency_pin){const n=await Lc({address:i,contractName:e,blockHeight:o});t.push(Rc(n))}n.push(t)}return n}async function Uc(e){const t=[];for(let n=0;n[Rc(e.key),await Promise.all(e.i18n.map((async e=>[Rc(e.tag),Rc(e.translation)])))]))),i=await Promise.all(n?.parameters.sort(((e,t)=>e.index-t.index)).map((async e=>[Rc(e.label),[Rc(String(e.index)),Rc(e.type),await Promise.all(e.messages.map((async e=>[Rc(e.key),await Promise.all(e.i18n.map((async e=>[Rc(e.tag),Rc(e.translation)])))])))]]))),o=[await Uc(n?.dependencies)],s=Et([Rc(t?.f_type),Rc(t?.f_version),Rc(n?.type),Rc(n?.interface),r,Rc(n?.cadence?.body),[o],i]).toString("hex");return Rc(s)}({template:t});case"1.0.0":return await async function(e){let{template:t}=e;uo(void 0!=t,"generateTemplateId({ template }) -- template must be defined"),uo("object"===typeof t,"generateTemplateId({ template }) -- template must be an object"),uo("InteractionTemplate"===t.f_type,"generateTemplateId({ template }) -- template object must be an InteractionTemplate"),uo("1.0.0"===t.f_version,"generateTemplateId({ template }) -- template object must be an version 1.0.0");const n=t.data,r=await Promise.all(Object.keys(n.messages).map((async e=>[Rc(e),await Promise.all(Object.keys(n.messages?.[e]?.i18n).map((async t=>[Rc(t),Rc(n.messages?.[e]?.i18n?.[t])])))]))),i=await Promise.all(Object.keys(n?.dependencies).map((async e=>[Rc(e),await Promise.all(Object.keys(n?.dependencies?.[e]).map((async t=>[Rc(t),await Promise.all(Object.keys(n?.dependencies?.[e]?.[t]).map((async r=>[Rc(r),[Rc(n?.dependencies?.[e]?.[t]?.[r].address),Rc(n?.dependencies?.[e]?.[t]?.[r].contract),Rc(n?.dependencies?.[e]?.[t]?.[r].fq_address),Rc(n?.dependencies?.[e]?.[t]?.[r].pin),Rc(String(n?.dependencies?.[e]?.[t]?.[r].pin_block_height))]])))])))]))),o=await Promise.all(Object.keys(n?.arguments).map((async e=>[Rc(e),[Rc(String(n?.arguments?.[e].index)),Rc(n?.arguments?.[e].type),Rc(n?.arguments?.[e].balance||""),await Promise.all(Object.keys(n?.arguments?.[e].messages).map((async t=>[Rc(t),await Promise.all(Object.keys(n?.arguments?.[e].messages?.[t].i18n).map((async r=>[Rc(r),Rc(n?.arguments?.[e].messages?.[t].i18n?.[r])])))])))]]))),s=Et([Rc("InteractionTemplate"),Rc("1.0.0"),Rc(n?.type),Rc(n?.interface),r,Rc(n?.cadence),i,o]).toString("hex");return Rc(s)}({template:t});default:throw new Error("generateTemplateId Error: Unsupported template version")}}async function Fc(e){let{version:t,address:n,contractName:r}=e;switch(uo(void 0!=n,"generateDependencyPin({ address }) -- address must be defined"),uo(void 0!=r,"generateDependencyPin({ contractName }) -- contractName must be defined"),uo("string"===typeof n,"generateDependencyPin({ address }) -- address must be a string"),uo("string"===typeof r,"generateDependencyPin({ contractName }) -- contractName must be a string"),t){case"1.1.0":return await Lc({address:n,contractName:r});case"1.0.0":return await async function(e){let{address:t,contractName:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};uo(void 0!=t,"generateDependencyPin({ address }) -- address must be defined"),uo(void 0!=n,"generateDependencyPin({ contractName }) -- contractName must be defined"),uo("string"===typeof t,"generateDependencyPin({ address }) -- address must be a string"),uo("string"===typeof n,"generateDependencyPin({ contractName }) -- contractName must be a string");const i=[Nc({contractName:n,address:t})];for(const s of i){const e=await lo([zr(await xt().get(s.address,s.address))],r).then(fo);if(s.contract=e.contracts?.[s.contractName],!s.contract)throw console.error("Did not find expected contract",s,e),new Error("Did not find expected contract");const t=Bc(s.contract);i.push(...t)}const o=i.map((e=>Rc(e.contract)));return Rc(o.join(""))}({address:n,contractName:r});default:throw new Error("deriveCadenceByNetwork Error: Unsupported template version")}}async function Vc(e){let{template:t,blockHeight:n,network:r}=e;switch(uo(void 0!=t,"generateDependencyPin({ template }) -- template must be defined"),uo("object"===typeof t,"generateDependencyPin({ template }) -- template must be an object"),uo("InteractionTemplate"===t.f_type,"generateDependencyPin({ template }) -- template must be an InteractionTemplate"),uo(void 0!=r,"generateDependencyPin({ network }) network must be defined"),uo(void 0!=n,"generateDependencyPin({ blockHeight }) blockHeight must be defined"),uo("number"===typeof n,"generateDependencyPin({ blockHeight }) blockHeight must be a number"),t.f_version){case"1.0.0":const e=Object.keys(t.data.dependencies);for(let o of e){const e=t.data.dependencies[o],i=Object.keys(e);for(let s of i){const e=t.data.dependencies[o][s][r];if("undefined"===typeof e)continue;const i=await Fc({address:e.address,contractName:e.contract,blockHeight:n});if(i!==e.pin)return de({title:"verifyDependencyPinsSame Debug Error",message:`Could not recompute and match dependency pin.\n address: ${e.address} | contract: ${e.contract}\n computed: ${i}\n template: ${e.pin}\n `,level:le.debug}),!1}}return!0;case"1.1.0":let i=!1;for(let o=0;o1&&void 0!==arguments[1]?arguments[1]:{};uo(void 0!=t,"getInteractionTemplateAudits({ template }) -- template must be defined"),uo("InteractionTemplate"===t.f_type,"getInteractionTemplateAudits({ template }) -- template must be an InteractionTemplate");let i=await jc({template:t});if(i!==t.id)throw de({title:"getInteractionTemplateAudits Debug Error",message:`Could not recompute and match template ID\n computed: ${i}\n template: ${t.id}\n `,level:le.debug}),new Error("getInteractionTemplateAudits Error: Could not recompute and match template ID");switch(t.f_version){case"1.1.0":case"1.0.0":const e=n||await xt().get("flow.auditors");uo(e,"getInteractionTemplateAudits Error: Required configuration for 'fcl.auditors' is not set"),uo(Array.isArray(e),"getInteractionTemplateAudits Error: Required configuration for 'fcl.auditors' is not an array");let t=r.flowInteractionAuditContract;if(!t){const e=await ga(r);uo("mainnet"===e||"testnet"===e,"getInteractionTemplateAudits Error: Unable to determine address for FlowInteractionTemplateAudit contract. Set configuration for 'fcl.network' to 'mainnet' or 'testnet'"),t="mainnet"===e?"0xfd100e39d50a13e6":"0xf78bfc12d0a786dc"}const o=await Sa({cadence:`\n import FlowInteractionTemplateAudit from ${t}\n access(all) fun main(templateId: String, auditors: [Address]): {Address:Bool} {\n return FlowInteractionTemplateAudit.getHasTemplateBeenAuditedByAuditors(templateId: templateId, auditors: auditors)\n }\n `,args:(t,n)=>[t(i,n.String),t(e,n.Array(n.Address))]});return o;default:throw new Error("getInteractionTemplateAudits Error: Unsupported template version")}},generateDependencyPin:Fc,generateDependencyPinAtLatestSealedBlock:async function(e){let{version:t,address:n,contractName:r}=e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=await yo({sealed:!0},i),s=o?.height;return Fc({version:t,address:n,contractName:r,blockHeight:s})},generateTemplateId:jc,verifyGeneratedTemplateId:async function(e){let{template:t}=e;return t.id===await jc({template:t})},verifyDependencyPinsSame:Vc,verifyDependencyPinsSameAtLatestSealedBlock:async function(e){let{template:t,network:n}=e;const r=(await yo({sealed:!0}))?.height;return Vc({template:t,network:n,blockHeight:r})},deriveCadenceByNetwork:da,getTemplateMessage:function(e){let{localization:t="en-US",messageKey:n,template:r}=e;switch(uo(n,"getTemplateMessage({ messageKey }) -- messageKey must be defined"),uo("string"===typeof n,"getTemplateMessage({ messageKey }) -- messageKey must be a string"),uo(t,"getTemplateMessage({ localization }) -- localization must be defined"),uo("string"===typeof t,"getTemplateMessage({ localization }) -- localization must be a string"),uo(void 0!=r,"getTemplateMessage({ template }) -- template must be defined"),uo("object"===typeof r,"getTemplateMessage({ template }) -- template must be an object"),uo("InteractionTemplate"===typeof r.f_type,"getTemplateMessage({ template }) -- template object must be an InteractionTemplate"),r.f_version){case"1.1.0":const e=r?.data?.messages?.find((e=>e.key===n));if(!e)return;const i=e?.i18n?.find((e=>e.tag===t));if(!i)return;return i.translation;case"1.0.0":return r?.data?.messages?.[n]?.i18n?.[t];default:throw new Error("getTemplateArgumentMessage Error: Unsupported template version")}},getTemplateArgumentMessage:function(e){let{localization:t="en-US",argumentLabel:n,messageKey:r,template:i}=e;switch(uo(r,"getTemplateArgumentMessage({ messageKey }) -- messageKey must be defined"),uo("string"===typeof r,"getTemplateArgumentMessage({ messageKey }) -- messageKey must be a string"),uo(n,"getTemplateArgumentMessage({ argumentLabel }) -- argumentLabel must be defined"),uo("string"===typeof r,"getTemplateArgumentMessage({ argumentLabel }) -- argumentLabel must be a string"),uo(t,"getTemplateArgumentMessage({ localization }) -- localization must be defined"),uo("string"===typeof t,"getTemplateArgumentMessage({ localization }) -- localization must be a string"),uo(void 0!=i,"getTemplateArgumentMessage({ template }) -- template must be defined"),uo("object"===typeof i,"getTemplateArgumentMessage({ template }) -- template must be an object"),uo("InteractionTemplate"===typeof i.f_type,"getTemplateArgumentMessage({ template }) -- template object must be an InteractionTemplate"),i.f_version){case"1.1.0":const e=i?.data?.parameters?.find((e=>e.label===n));if(!e)return;const o=e?.messages?.find((e=>e.key===r));if(!o)return;const s=o?.i18n?.find((e=>e.tag===t));if(!s)return;return s.translation;case"1.0.0":return i?.data?.arguments?.[n]?.messages?.[r]?.i18n?.[t];default:throw new Error("getTemplateArgumentMessage Error: Unsupported template version")}}});function zc(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{old:e,...Pa,type:"frame",endpoint:e.endpoint,params:e.params||{},data:e.data||{}}}function Hc(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:"back-channel-rpc",endpoint:e.endpoint,method:e.method,params:e.params||{},data:e.data||{}}}function Wc(e){return null==e?null:(null==e.method&&(e={...e,type:"local-view",method:"VIEW/IFRAME"}),e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:e.type||"local-view",method:e.method,endpoint:e.endpoint,data:e.data||{},params:e.params||{}})}function Gc(e,t){return e.map((e=>function(e,t){try{return Zc[e.type](e,t)}catch(n){return console.error(`Unrecognized FCL Service Type [${e.type}]`,e,n),e}}(e,t))).filter(Boolean)}const Zc={"back-channel-rpc":Hc,"pre-authz":function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:e.type,uid:e.id,endpoint:e.endpoint,method:e.method,identity:{...Oa,address:Ot(e.addr),keyId:e.keyId},params:e.params,data:e.data}},authz:function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:e.type,uid:e.id,endpoint:e.endpoint,method:e.method,identity:{...Oa,address:Ot(e.addr),keyId:e.keyId},params:e.params,data:e.data}},authn:function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:e.type,uid:e.id,endpoint:e.authn,id:e.pid,provider:{address:Ot(e.addr),name:e.name,icon:e.icon}}},frame:zc,"open-id":function(e){return null==e?null:"1.0.0"===e.f_vsn?e:null},"user-signature":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("Invalid user-signature service");return"1.0.0"===e.f_vsn?e:null},"local-view":Wc,"account-proof":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("FCL Normalizer Error: Invalid account-proof service");return"1.0.0"===e.f_vsn?e:null},"authn-refresh":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("Invalid authn-refresh service");return"1.0.0"===e.f_vsn?e:null}};function Kc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return e.reduce(((e,n)=>n.type===t&&(!e||$s(n.f_vsn,e.f_vsn)>0)?n:e),null)}function Xc(e){return Et([e.provider?.address||e.provider?.name||"UNSPECIFIED",e.id]).toString("hex")}async function Yc(e){var t=Gc(function(){return[...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],...arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]]}((e=function(e){return e.addr=e.addr?Ot(e.addr):null,e.paddr=e.paddr?Ot(e.paddr):null,e}(e)).services||[],await async function(e,t){if(null==e||null==t)return[];const n=new Ta(e);n.searchParams.append("code",t);const r=await fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>e.json()));if(Array.isArray(r))return r;const i=[];if(Array.isArray(r.authorizations))for(let o of r.authorizations)i.push({type:"authz",keyId:r.keyId,...o});return null!=r.provider&&i.push({type:"authn",id:"wallet-provider#authn",...r.provider}),i}(e.hks,e.code)));const n=Kc(t,"authn");return{...Ra,addr:Ot(e.addr),cid:Xc(n),loggedIn:!0,services:t,expiresAt:e.expires}}const Jc="undefined"===typeof window;const Qc=globalThis.AbortController||n(28599),$c=async e=>{let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return Sc().getStrategy(t.method)({service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s})};async function eu(e){let{service:t,msg:n={},config:r={},opts:i={},platform:o,abortSignal:s=(new Qc).signal,execStrategy:a}=e;!function(){if(Jc)return;Sc().getStrategies().includes("WC/RPC")||de({title:"FCL WalletConnect Service Plugin",level:le.error,message:"All dApps are expected to register for a WalletConnect projectId & add this to their FCL configuration. If you do not do so, users will be unable to use certain wallets to interact with your dApp. See https://developers.flow.com/tools/clients/fcl-js/configure-fcl for more information."})}(),n.data=t.data;const c={services:await Xa(/^service\./),app:await Xa(/^app\.detail\./),client:{...r.client,platform:o,fclVersion:ea,fclLibrary:"https://github.com/onflow/fcl-js",hostname:window?.location?.hostname??null,network:await ga(i)}};try{const e=await(a||$c)({service:t,body:n,config:c,opts:i,abortSignal:s});return"REDIRECT"===e.status?(fe(t.type===e.data.type,"Cannot shift recursive service type in execService"),await eu({service:e.data,msg:n,config:c,opts:i,abortSignal:s})):e}catch(u){throw de({title:`Error on execService ${t?.type}`,message:u,level:le.error}),u}}function tu(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Ba,addr:Pt(e.addr||e.address),signature:e.signature||e.sig,keyId:e.keyId}}const nu="CURRENT_USER",ru="CURRENT_USER/UPDATED",iu="SNAPSHOT",ou="SET_CURRENT_USER",su="DEL_CURRENT_USER",au='{\n "f_type": "User",\n "f_vsn": "1.0.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "expiresAt":null,\n "services":[]\n}',cu={[Ie]:async e=>{"undefined"===typeof window&&console.warn('\n %cFCL Warning\n ============================\n "currentUser" is only available in the browser.\n For more info, please see the docs: https://docs.onflow.org/fcl/\n ============================\n ',"font-weight:bold;font-family:monospace;"),e.merge(JSON.parse(au));const t=await xt.first(["fcl.storage","fcl.storage.default"]);if(t.can){const n=await(async e=>{const t=JSON.parse(au),n=await e.get(nu);return null!=n&&t.f_vsn!==n.f_vsn?(e.removeItem(nu),t):n||t})(t);(function(e){return null==e.expiresAt||0===e.expiresAt||e.expiresAt>Date.now()})(n)&&e.merge(n)}},[ke]:(e,t)=>{e.subscribe(t.from),e.send(t.from,ru,{...e.all()})},[Te]:(e,t)=>{e.unsubscribe(t.from)},[iu]:async(e,t)=>{t.reply({...e.all()})},[ou]:async(e,t,n)=>{e.merge(n);const r=await xt.first(["fcl.storage","fcl.storage.default"]);r.can&&r.put(nu,e.all()),e.broadcast(ru,{...e.all()})},[su]:async(e,t)=>{e.merge(JSON.parse(au));const n=await xt.first(["fcl.storage","fcl.storage.default"]);n.can&&n.put(nu,e.all()),e.broadcast(ru,{...e.all()})}},uu=()=>Fe(cu,nu);async function lu(){let e=await xt.get("fcl.accountProof.resolver");if(null==e)return;if(!(e=>"function"===typeof e)(e))return void de({title:"Account Proof Data Resolver must be a function",message:`Check fcl.accountProof.resolver configuration.\n Expected: fcl.accountProof.resolver: async () => { ... }\n Received: fcl.accountProof.resolver: ${typeof e}\n `,level:le.warn});const t=await e();return null!=t?(fe("string"===typeof t.appIdentifier,"appIdentifier must be a string"),fe(/^[0-9a-f]+$/i.test(t.nonce),"Nonce must be a hex string"),t):void 0}const du=async e=>{let{discoveryAuthnInclude:t,discoveryFeaturesSuggested:n}=e;return{client:{discoveryAuthnInclude:t,discoveryFeaturesSuggested:n,clientServices:await Ec(),supportedStrategies:Sc().getStrategies()}}},fu=e=>{let{platform:t,discovery:n}=e;return async function(){let{service:e,redir:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e||e?.provider?.is_installed||!e?.provider?.requires_install)return new Promise((async(i,o)=>{uu();const s={redir:r},a=await mu(),c=await _c(e),u=Kc(a.services,"authn-refresh");let l;if(a.loggedIn){if(!u)return i(a);try{const e=await eu({service:u,msg:l,opts:s,platform:t});Le(nu,ou,await Yc(e))}catch(d){de({title:`${d.name} Could not refresh wallet authentication.`,message:d.message,level:le.error})}finally{return i(await mu())}}try{l=await lu()}catch(d){return de({title:`${d.name} On Authentication: Could not resolve account proof data.`,message:d.message,level:le.error}),o(d)}try{const e=await eu({service:c,msg:l,config:await du(c),opts:s,platform:t,execStrategy:n?.execStrategy});Le(nu,ou,await Yc(e))}catch(d){de({title:`${d} On Authentication`,message:d,level:le.error})}finally{i(await mu())}}));window.location.href=e?.provider?.install_link}};function hu(){uu(),Le(nu,su)}const pu=e=>{let{platform:t,discovery:n}=e;return async e=>(uu(),{...e,tempId:"CURRENT_USER",async resolve(e,r){const i=await fu({platform:t,discovery:n})({redir:!0}),o=Kc(i.services,"authz"),s=Kc(i.services,"pre-authz");if(s)return(e=>{let{platform:t}=e;return e=>{const n=(e=>({f_type:"PreAuthzResponse",f_vsn:"1.0.0",proposer:(e||{}).proposer,payer:(e||{}).payer||[],authorization:(e||{}).authorization||[]}))(e),r=[];null!=n.proposer&&r.push(["PROPOSER",n.proposer]);for(let t of n.payer||[])r.push(["PAYER",t]);for(let t of n.authorization||[])r.push(["AUTHORIZER",t]);return r.map((e=>{let[n,r]=e;return{tempId:[r.identity.address,r.identity.keyId].join("|"),addr:r.identity.address,keyId:r.identity.keyId,signingFunction:e=>eu({service:r,msg:e,platform:t}),role:{proposer:"PROPOSER"===n,payer:"PAYER"===n,authorizer:"AUTHORIZER"===n}}}))}})({platform:t,discovery:n})(await eu({service:s,msg:r,platform:t}));if(o){let n;return ba()&&"WC/RPC"===o.method&&(n=window.open("","_blank")),{...e,tempId:"CURRENT_USER",resolve:null,addr:Pt(o.identity.address),keyId:o.identity.keyId,sequenceNum:null,signature:null,signingFunction:async e=>tu(await eu({service:o,msg:e,opts:{includeOlderJsonRpcCall:!0,windowRef:n},platform:t}))}}throw new Error("No Authz or PreAuthz Service configured for CURRENT_USER")}})};function gu(e){uu();const t="@EXIT",n=Fe((async n=>{for(n.send(nu,ke);;){const r=await n.receive();if(r.tag===t)return void n.send(nu,Te);e(r.data)}}));return()=>Le(n,t)}function mu(){return uu(),Le(nu,iu,null,{expectReply:!0,timeout:0})}const bu=e=>{let{platform:t,discovery:n}=e;return async()=>{const{addr:e}=await fu({platform:t,discovery:n})();return Ro(Ot(e),Bs)}},yu=e=>(fe(/^[0-9a-f]+$/i.test(e),"Message must be a hex string"),{message:e}),vu=e=>{let{platform:t,discovery:n}=e;return async e=>{uu();const r=Kc((await fu({platform:t,discovery:n})({redir:!0})).services,"user-signature");fe(r,"Current user must have authorized a signing service.");try{const n=await eu({service:r,msg:yu(e),platform:t});return Array.isArray(n)?n.map((e=>tu(e))):[tu(n)]}catch(i){return i}}},wu=e=>{let{platform:t,discovery:n}=e,r=()=>({authenticate:fu({platform:t,discovery:n}),unauthenticate:hu,authorization:pu({platform:t,discovery:n}),signUserMessage:vu({platform:t,discovery:n}),subscribe:gu,snapshot:mu,resolveArgument:bu({platform:t,discovery:n})});return r.authenticate=fu({platform:t,discovery:n}),r.unauthenticate=hu,r.authorization=pu({platform:t,discovery:n}),r.signUserMessage=vu({platform:t,discovery:n}),r.subscribe=gu,r.snapshot=mu,r.resolveArgument=bu({platform:t,discovery:n}),r};function xu(e){const t=new Ta(e.endpoint);if(window?.location?.origin&&t.searchParams.append("l6n",window.location.origin),null!=e.params)for(let[n,r]of Object.entries(e.params||{}))t.searchParams.append(n,r);return t}function Su(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t.method||"POST",r="GET"===n?void 0:JSON.stringify(t.data||e.data||{});return fetch(xu(e),{method:n,headers:{...e.headers||{},...t.headers||{},"Content-Type":"application/json"},body:r}).then((e=>e.json()))}function Au(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Na,status:e.status??"APPROVED",reason:e.reason??null,data:e.compositeSignature||e.data||{...e}||{},updates:Hc(e.authorizationUpdates),local:zc((e.local||[])[0])}}const Eu={"HTTP/GET":"GET","HTTP/POST":"POST"},_u=e=>(fe(Eu[e.method],"Invalid Service Method for type back-channel-rpc",{service:e}),Eu[e.method]);async function Cu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;fe(e,"Missing Polling Service",{service:e});const n=t();if(!n)throw new Error("Externally Halted");let r;try{if("undefined"!==typeof document&&"hidden"===document.visibilityState)return await new Promise((e=>setTimeout(e,500))),Cu(e,t);r=await Su(e,{method:_u(e)}).then(Au)}catch(i){throw i}switch(r.status){case"APPROVED":return r.data;case"DECLINED":throw new Error(`Declined: ${r.reason||"No reason supplied."}`);default:return await new Promise((e=>setTimeout(e,500))),Cu(r.updates,t)}}const Iu=e=>async t=>{let{service:n,body:r,config:i,opts:o}=t;const s=await Su(n,{data:{fclVersion:ea,service:{params:n.params,data:n.data,type:n.type},config:i,...r}}).then(Au);if("APPROVED"===s.status)return s.data;if("DECLINED"===s.status)throw new Error(`Declined: ${s.reason||"No reason supplied."}`);if("REDIRECT"===s.status)return s;if("PENDING"===s.status){var a=!0,c=!0;const[t,n]=await e(Wc(s.local),{serviceEndpoint:xu,onClose:()=>c=!1}),r=()=>{try{n(),c=!1}catch(e){console.error("Frame Close Error",e)}},i=()=>{const e=a;return a=c,e};return Cu(s.updates,i).then((e=>(r(),e))).catch((e=>{throw console.error(e),r(),e}))}throw console.error("Auto Decline: Invalid Response",{service:n,resp:s}),new Error("Auto Decline: Invalid Response")},ku="FCL:VIEW:CLOSE",Tu="FCL:VIEW:READY",Mu="FCL:VIEW:RESPONSE",Pu=e=>"string"===typeof e&&e.toLowerCase(),Ou=new Set(["monetizationstart","monetizationpending","monetizationprogress","monetizationstop"]),Ru=(e,t)=>console.warn("DEPRECATION NOTICE",`Received ${e}, please use ${t} for this and future versions of FCL`),Nu=e=>{let t,{close:n,send:r,onReady:i,onResponse:o,onMessage:s,onCustomRpc:a,getSource:c}=e;return e=>{try{t=c?.()||t}catch(Pu){t=null}try{if("object"!==typeof e.data)return;if(Ou.has(e.data.type))return;if(null!=t&&e.source!==t)return;Pu(e.data.type)===Pu(ku)&&n(),Pu(e.data.type)===Pu(Tu)&&(i(e,{send:r,close:n}),t||=e.source),Pu(e.data.type)===Pu(Mu)&&o(e,{send:r,close:n}),Pu(e.data.type)===Pu("FCL:VIEW:CUSTOM_RPC")&&a(e.data.payload,{send:r,close:n}),s(e,{send:r,close:n}),Pu(e.data.type)===Pu("FCL:FRAME:READY")&&(Ru(e.data.type,Tu),i(e,{send:r,close:n}),t||=e.source),Pu(e.data.type)===Pu("FCL:FRAME:RESPONSE")&&(Ru(e.data.type,Mu),o(e,{send:r,close:n})),Pu(e.data.type)===Pu("FCL:FRAME:CLOSE")&&(Ru(e.data.type,ku),n()),Pu(e.data.type)===Pu("FCL::CHALLENGE::RESPONSE")&&(Ru(e.data.type,Mu),o(e,{send:r,close:n})),Pu(e.data.type)===Pu("FCL::AUTHZ_READY")&&(Ru(e.data.type,Tu),i(e,{send:r,close:n}),t||=e.source),Pu(e.data.type)===Pu("FCL::CHALLENGE::CANCEL")&&(Ru(e.data.type,ku),n()),Pu(e.data.type)===Pu("FCL::CANCEL")&&(Ru(e.data.type,ku),n())}catch(u){console.error("Frame Callback Error",u),n()}}};function Bu(e){return Bu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bu(e)}function Lu(e){var t=function(e,t){if("object"!=Bu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Bu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Bu(t)?t:t+""}function Du(e,t,n){return(t=Lu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}xt.subscribe((()=>{ga({enableRequestLogging:!1}).catch((()=>{}))}));let Uu=function(e){return e[e.INVALID_REQUEST=-32600]="INVALID_REQUEST",e[e.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",e[e.INVALID_PARAMS=-32602]="INVALID_PARAMS",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e[e.PARSE_ERROR=-32700]="PARSE_ERROR",e}({});class ju extends Error{constructor(e,t,n){super(t),this.code=e,this.message=t,this.data=n}}var Fu=function(e){return e.HELLO="rpc_hello",e}(Fu||{});class Vu{constructor(e){let{notifications:t}=e;Du(this,"id",0),Du(this,"setSend",(()=>{})),Du(this,"_send",new Promise((e=>{this.setSend=e}))),Du(this,"peerInfo",new Promise(((e,t)=>{this.resolvePeerInfo=e,this.rejectPeerInfo=t}))),Du(this,"enabledNotifications",[]),Du(this,"requestHandlers",{}),Du(this,"subscriptions",{}),Du(this,"messageListeners",[]),this.enabledNotifications=t||[],this.on(Fu.HELLO,(e=>(this.resolvePeerInfo(e),this.ownInfo())))}connect(e){let{send:t}=e;this.setSend(t),this.requestWithoutConnection(Fu.HELLO,this.ownInfo()).then((e=>{this.resolvePeerInfo(e)})).catch(this.rejectPeerInfo)}ownInfo(){return{requests:Object.keys(this.requestHandlers),notifications:this.enabledNotifications}}async send(e){return(await this._send)(e)}receive(e){"2.0"===e?.jsonrpc&&("method"in e&&("id"in e?this.handleRequest(e):this.handleNotification(e)),this.messageListeners.forEach((t=>t(e))))}async handleRequest(e){const t=this.requestHandlers[e.method];if(t)try{const n=await t(e.params);this.send({jsonrpc:"2.0",id:e.id,result:n})}catch(n){n instanceof ju?this.send({jsonrpc:"2.0",id:e.id,error:{code:n.code,message:n.message,data:n.data}}):this.send({jsonrpc:"2.0",id:e.id,error:{code:Uu.INTERNAL_ERROR,message:n?.message}})}else this.send({jsonrpc:"2.0",id:e.id,error:{code:Uu.METHOD_NOT_FOUND,message:`Method not found: ${e.method}`}})}handleNotification(e){this.subscriptions[e.method]&&this.subscriptions[e.method].forEach((t=>t(e.params)))}onMessage(e){return this.messageListeners.push(e),()=>{this.messageListeners=this.messageListeners.filter((t=>t!==e))}}async notify(e,t){await this.onceConnected(),this.send({jsonrpc:"2.0",method:e,params:t})}async request(e,t){return await this.onceConnected(),this.requestWithoutConnection(e,t)}async requestWithoutConnection(e,t){const n=this.id++;let r=()=>{};const i=new Promise(((e,t)=>{r=this.onMessage((r=>{if(r.id===n&&("result"in r||"error"in r)){if(r.error){const e=new ju(r.error.code,r.error.message,r.error.data);t(e)}e(r.result)}}))})).finally(r);return this.send({jsonrpc:"2.0",method:e,params:t,id:n}),i}on(e,t){this.requestHandlers[e]=t}subscribe(e,t){this.subscriptions[e]=this.subscriptions[e]||new Set,this.subscriptions[e].add(t)}unsubscribe(e,t){this.subscriptions[e]?.delete(t)}async onceConnected(){return this.peerInfo.then((()=>{}))}async getAvailableRequests(){return this.peerInfo.then((e=>e.requests))}async getAvailableNotifications(){return this.peerInfo.then((e=>e.notifications))}}var qu=n(66736);class zu{}class Hu extends zu{constructor(e){super()}}const Wu=qu.FIVE_SECONDS,Gu="heartbeat_pulse";class Zu extends Hu{constructor(e){super(e),this.events=new Nt.EventEmitter,this.interval=Wu,this.interval=e?.interval||Wu}static async init(e){const t=new Zu(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval((()=>this.pulse()),(0,qu.toMiliseconds)(this.interval))}pulse(){this.events.emit(Gu)}}const Ku=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Xu=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Yu=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Ju(e,t){if(!("__proto__"===e||"constructor"===e&&t&&"object"===typeof t&&"prototype"in t))return t;!function(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}(e)}function Qu(e,t={}){if("string"!==typeof e)return e;const n=e.trim();if('"'===e[0]&&e.endsWith('"')&&!e.includes("\\"))return n.slice(1,-1);if(n.length<=9){const e=n.toLowerCase();if("true"===e)return!0;if("false"===e)return!1;if("undefined"===e)return;if("null"===e)return null;if("nan"===e)return Number.NaN;if("infinity"===e)return Number.POSITIVE_INFINITY;if("-infinity"===e)return Number.NEGATIVE_INFINITY}if(!Yu.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(Ku.test(e)||Xu.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,Ju)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}var $u=n(48764).Buffer;function el(e,...t){try{return function(e){return e&&"function"===typeof e.then?e:Promise.resolve(e)}(e(...t))}catch(n){return Promise.reject(n)}}function tl(e){if(function(e){const t=typeof e;return null===e||"object"!==t&&"function"!==t}(e))return String(e);if(function(e){const t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}(e)||Array.isArray(e))return JSON.stringify(e);if("function"===typeof e.toJSON)return tl(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function nl(){if(void 0===typeof $u)throw new TypeError("[unstorage] Buffer is not supported!")}const rl="base64:";function il(e){return e?e.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function ol(...e){return il(e.join(":"))}function sl(e){return(e=il(e))?e+":":""}const al=()=>{const e=new Map;return{name:"memory",options:{},hasItem:t=>e.has(t),getItem:t=>e.get(t)??null,getItemRaw:t=>e.get(t)??null,setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys:()=>Array.from(e.keys()),clear(){e.clear()},dispose(){e.clear()}}};function cl(e={}){const t={mounts:{"":e.driver||al()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=e=>{for(const n of t.mountpoints)if(e.startsWith(n))return{base:n,relativeKey:e.slice(n.length),driver:t.mounts[n]};return{base:"",relativeKey:e,driver:t.mounts[""]}},r=(e,n)=>t.mountpoints.filter((t=>t.startsWith(e)||n&&e.startsWith(t))).map((n=>({relativeBase:e.length>n.length?e.slice(n.length):void 0,mountpoint:n,driver:t.mounts[n]}))),i=(e,n)=>{if(t.watching){n=il(n);for(const r of t.watchListeners)r(e,n)}},o=async()=>{if(t.watching){for(const e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},s=(e,t,r)=>{const i=new Map,o=e=>{let t=i.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},i.set(e.base,t)),t};for(const s of e){const e="string"===typeof s,r=il(e?s:s.key),i=e?void 0:s.value,a=e||!s.options?t:{...t,...s.options},c=n(r);o(c).items.push({key:r,value:i,relativeKey:c.relativeKey,options:a})}return Promise.all([...i.values()].map((e=>r(e)))).then((e=>e.flat()))},a={hasItem(e,t={}){e=il(e);const{relativeKey:r,driver:i}=n(e);return el(i.hasItem,r,t)},getItem(e,t={}){e=il(e);const{relativeKey:r,driver:i}=n(e);return el(i.getItem,r,t).then((e=>Qu(e)))},getItems:(e,t)=>s(e,t,(e=>e.driver.getItems?el(e.driver.getItems,e.items.map((e=>({key:e.relativeKey,options:e.options}))),t).then((t=>t.map((t=>({key:ol(e.base,t.key),value:Qu(t.value)}))))):Promise.all(e.items.map((t=>el(e.driver.getItem,t.relativeKey,t.options).then((e=>({key:t.key,value:Qu(e)})))))))),getItemRaw(e,t={}){e=il(e);const{relativeKey:r,driver:i}=n(e);return i.getItemRaw?el(i.getItemRaw,r,t):el(i.getItem,r,t).then((e=>function(e){return"string"!==typeof e?e:e.startsWith(rl)?(nl(),$u.from(e.slice(rl.length),"base64")):e}(e)))},async setItem(e,t,r={}){if(void 0===t)return a.removeItem(e);e=il(e);const{relativeKey:o,driver:s}=n(e);s.setItem&&(await el(s.setItem,o,tl(t),r),s.watch||i("update",e))},async setItems(e,t){await s(e,t,(async e=>{if(e.driver.setItems)return el(e.driver.setItems,e.items.map((e=>({key:e.relativeKey,value:tl(e.value),options:e.options}))),t);e.driver.setItem&&await Promise.all(e.items.map((t=>el(e.driver.setItem,t.relativeKey,tl(t.value),t.options))))}))},async setItemRaw(e,t,r={}){if(void 0===t)return a.removeItem(e,r);e=il(e);const{relativeKey:o,driver:s}=n(e);if(s.setItemRaw)await el(s.setItemRaw,o,t,r);else{if(!s.setItem)return;await el(s.setItem,o,function(e){if("string"===typeof e)return e;nl();const t=$u.from(e).toString("base64");return rl+t}(t),r)}s.watch||i("update",e)},async removeItem(e,t={}){"boolean"===typeof t&&(t={removeMeta:t}),e=il(e);const{relativeKey:r,driver:o}=n(e);o.removeItem&&(await el(o.removeItem,r,t),(t.removeMeta||t.removeMata)&&await el(o.removeItem,r+"$",t),o.watch||i("remove",e))},async getMeta(e,t={}){"boolean"===typeof t&&(t={nativeOnly:t}),e=il(e);const{relativeKey:r,driver:i}=n(e),o=Object.create(null);if(i.getMeta&&Object.assign(o,await el(i.getMeta,r,t)),!t.nativeOnly){const e=await el(i.getItem,r+"$",t).then((e=>Qu(e)));e&&"object"===typeof e&&("string"===typeof e.atime&&(e.atime=new Date(e.atime)),"string"===typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(o,e))}return o},setMeta(e,t,n={}){return this.setItem(e+"$",t,n)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){e=sl(e);const n=r(e,!0);let i=[];const o=[];for(const r of n){const e=(await el(r.driver.getKeys,r.relativeBase,t)).map((e=>r.mountpoint+il(e))).filter((e=>!i.some((t=>e.startsWith(t)))));o.push(...e),i=[r.mountpoint,...i.filter((e=>!e.startsWith(r.mountpoint)))]}return e?o.filter((t=>t.startsWith(e)&&!t.endsWith("$"))):o.filter((e=>!e.endsWith("$")))},async clear(e,t={}){e=sl(e),await Promise.all(r(e,!1).map((async e=>{if(e.driver.clear)return el(e.driver.clear,e.relativeBase,t);if(e.driver.removeItem){const n=await e.driver.getKeys(e.relativeBase||"",t);return Promise.all(n.map((n=>e.driver.removeItem(n,t))))}})))},async dispose(){await Promise.all(Object.values(t.mounts).map((e=>ll(e))))},watch:async e=>(await(async()=>{if(!t.watching){t.watching=!0;for(const e in t.mounts)t.unwatch[e]=await ul(t.mounts[e],i,e)}})(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter((t=>t!==e)),0===t.watchListeners.length&&await o()}),async unwatch(){t.watchListeners=[],await o()},mount(e,n){if((e=sl(e))&&t.mounts[e])throw new Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort(((e,t)=>t.length-e.length))),t.mounts[e]=n,t.watching&&Promise.resolve(ul(n,i,e)).then((n=>{t.unwatch[e]=n})).catch(console.error),a},async unmount(e,n=!0){(e=sl(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(t.unwatch[e](),delete t.unwatch[e]),n&&await ll(t.mounts[e]),t.mountpoints=t.mountpoints.filter((t=>t!==e)),delete t.mounts[e])},getMount(e=""){e=il(e)+":";const t=n(e);return{driver:t.driver,base:t.base}},getMounts(e="",t={}){e=il(e);return r(e,t.parents).map((e=>({driver:e.driver,base:e.mountpoint})))}};return a}function ul(e,t,n){return e.watch?e.watch(((e,r)=>t(e,n+r))):()=>{}}async function ll(e){"function"===typeof e.dispose&&await el(e.dispose)}function dl(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}function fl(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=dl(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}let hl;function pl(){return hl||(hl=fl("keyval-store","keyval")),hl}function gl(e,t=pl()){return t("readonly",(t=>dl(t.get(e))))}function ml(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},dl(e.transaction)}function bl(e){if("string"!==typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return(e=>{const t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,((e,t)=>"string"===typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t))})(e)}catch(lk){return e}}function yl(e){return"string"===typeof e?e:(t=e,JSON.stringify(t,((e,t)=>"bigint"===typeof t?t.toString()+"n":t))||"");var t}var vl=(e={})=>{const t=e.base&&e.base.length>0?`${e.base}:`:"",n=e=>t+e;let r;return e.dbName&&e.storeName&&(r=fl(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof(await gl(n(e),r))>"u"),getItem:async e=>await gl(n(e),r)??null,setItem:(e,t)=>function(e,t,n=pl()){return n("readwrite",(n=>(n.put(t,e),dl(n.transaction))))}(n(e),t,r),removeItem:e=>function(e,t=pl()){return t("readwrite",(t=>(t.delete(e),dl(t.transaction))))}(n(e),r),getKeys:()=>function(e=pl()){return e("readonly",(e=>{if(e.getAllKeys)return dl(e.getAllKeys());const t=[];return ml(e,(e=>t.push(e.key))).then((()=>t))}))}(r),clear:()=>function(e=pl()){return e("readwrite",(e=>(e.clear(),dl(e.transaction))))}(r)}};class wl{constructor(){this.indexedDb=cl({driver:vl({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((e=>[e.key,e.value]))}async getItem(e){const t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,yl(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var xl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof n.g<"u"?n.g:typeof self<"u"?self:{},Sl={exports:{}};function Al(e){var t;return[e[0],bl(null!=(t=e[1])?t:"")]}!function(){let e;function t(){}e=t,e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){const e=this;Object.keys(e).forEach((function(t){e[t]=void 0,delete e[t]}))},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",(function(){return Object.keys(this).length})),typeof xl<"u"&&xl.localStorage?Sl.exports=xl.localStorage:typeof window<"u"&&window.localStorage?Sl.exports=window.localStorage:Sl.exports=new t}();class El{constructor(){this.localStorage=Sl.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Al)}async getItem(e){const t=this.localStorage.getItem(e);if(null!==t)return bl(t)}async setItem(e,t){this.localStorage.setItem(e,yl(t))}async removeItem(e){this.localStorage.removeItem(e)}}const _l=async(e,t)=>{t.length&&t.forEach((async t=>{await e.removeItem(t)}))};class Cl{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const e=new El;this.storage=e;try{(async(e,t,n)=>{const r="wc_storage_version",i=await t.getItem(r);if(i&&i>=1)return void n(t);const o=await e.getKeys();if(!o.length)return void n(t);const s=[];for(;o.length;){const n=o.shift();if(!n)continue;const r=n.toLowerCase();if(r.includes("wc@")||r.includes("walletconnect")||r.includes("wc_")||r.includes("wallet_connect")){const r=await e.getItem(n);await t.setItem(n,r),s.push(n)}}await t.setItem(r,1),n(t),_l(e,s)})(e,new wl,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise((e=>{const t=setInterval((()=>{this.initialized&&(clearInterval(t),e())}),20)}))}}var Il=n(36559),kl=n.n(Il);const Tl="info",Ml="custom_context";class Pl{constructor(e){this.nodeValue=e,this.sizeInBytes=(new TextEncoder).encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Ol{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new Pl(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class Rl{constructor(e,t=1024e3){this.level=e??"error",this.levelValue=Il.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Ol(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Il.levels.values.error?console.error(e):t===Il.levels.values.warn?console.warn(e):t===Il.levels.values.debug?console.debug(e):t===Il.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(yl({timestamp:(new Date).toISOString(),log:e}));const t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Ol(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(yl({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class Nl{constructor(e,t=1024e3){this.baseChunkLogger=new Rl(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=t,n.download=`walletconnect-logs-${(new Date).toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}}class Bl{constructor(e,t=1024e3){this.baseChunkLogger=new Rl(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var Ll=Object.defineProperty,Dl=Object.defineProperties,Ul=Object.getOwnPropertyDescriptors,jl=Object.getOwnPropertySymbols,Fl=Object.prototype.hasOwnProperty,Vl=Object.prototype.propertyIsEnumerable,ql=(e,t,n)=>t in e?Ll(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zl=(e,t)=>{for(var n in t||(t={}))Fl.call(t,n)&&ql(e,n,t[n]);if(jl)for(var n of jl(t))Vl.call(t,n)&&ql(e,n,t[n]);return e},Hl=(e,t)=>Dl(e,Ul(t));function Wl(e){return Hl(zl({},e),{level:e?.level||Tl})}function Gl(e,t=Ml){let n="";return n=typeof e.bindings>"u"?function(e,t=Ml){return e[t]||""}(e,t):e.bindings().context||"",n}function Zl(e,t,n=Ml){const r=function(e,t,n=Ml){const r=Gl(e,n);return r.trim()?`${r}/${t}`:t}(e,t,n);return function(e,t,n=Ml){return e[n]=t,e}(e.child({context:r}),r,n)}function Kl(e){return typeof e.loggerOverride<"u"&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?function(e){var t,n;const r=new Nl(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:kl()(Hl(zl({},e.opts),{level:"trace",browser:Hl(zl({},null==(n=e.opts)?void 0:n.browser),{write:e=>r.write(e)})})),chunkLoggerController:r}}(e):function(e){var t;const n=new Bl(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:kl()(Hl(zl({},e.opts),{level:"trace"}),n),chunkLoggerController:n}}(e)}class Xl extends zu{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Yl extends zu{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class Jl extends zu{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Ql extends zu{constructor(e){super()}}class $l extends zu{constructor(e,t){super(),this.relayer=e,this.logger=t}}class ed extends zu{constructor(e,t){super(),this.core=e,this.logger=t}}var td=n(31050),nd=n(31416);const rd=".",id="base64url",od="utf8",sd="utf8",ad="did",cd="key",ud="base58btc";function ld(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function dd(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?ld(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}var fd=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=o-1;(0!==l||d>>0,s[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===s[h];)h++;for(var p=new Uint8Array(r+(o-h)),g=r;h!==o;)p[g++]=s[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,u=new Uint8Array(s);i!==o;){for(var d=t[i],f=0,h=s-1;(0!==d||f>>0,u[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=s-r;p!==s&&0===u[p];)p++;for(var g=c.repeat(n);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class gd{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class md{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return yd(this,e)}}class bd{constructor(e){this.decoders=e}or(e){return yd(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const yd=(e,t)=>new bd({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class vd{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new gd(e,t,n),this.decoder=new md(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const wd=({name:e,prefix:t,encode:n,decode:r})=>new vd(e,t,n,r),xd=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=hd(n,t);return wd({prefix:e,name:t,encode:r,decode:e=>pd(i(e))})},Sd=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>wd({prefix:t,name:e,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<((e,t,n,r)=>{const i={};for(let l=0;l=8&&(a-=8,s[u++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(t,r,n,e)}),Ad=wd({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)}),Ed=Sd({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),_d=Sd({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Cd=xd({prefix:"9",name:"base10",alphabet:"0123456789"}),Id=Sd({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),kd=Sd({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Td=Sd({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Md=Sd({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Pd=Sd({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Od=Sd({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Rd=Sd({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Nd=Sd({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Bd=Sd({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ld=Sd({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Dd=Sd({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ud=xd({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),jd=xd({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Fd=xd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Vd=xd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),qd=Sd({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zd=Sd({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hd=Sd({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wd=Sd({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Gd=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),Zd=Gd.reduce(((e,t,n)=>(e[n]=t,e)),[]),Kd=Gd.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const Xd=wd({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Zd[t]),"")},decode:function(e){const t=[];for(const n of e){const e=Kd[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}});var Yd=function e(t,n,r){n=n||[];var i=r=r||0;for(;t>=Jd;)n[r++]=255&t|128,t/=128;for(;-128&t;)n[r++]=255&t|128,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Jd=Math.pow(2,31);var Qd=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(127&r)<=128);return e.bytes=s-n,i};var $d=Math.pow(2,7),ef=Math.pow(2,14),tf=Math.pow(2,21),nf=Math.pow(2,28),rf=Math.pow(2,35),of=Math.pow(2,42),sf=Math.pow(2,49),af=Math.pow(2,56),cf=Math.pow(2,63),uf={encode:Yd,decode:Qd,encodingLength:function(e){return e<$d?1:e(lf.encode(e,t,n),t),ff=e=>lf.encodingLength(e),hf=(e,t)=>{const n=t.byteLength,r=ff(e),i=r+ff(n),o=new Uint8Array(i+n);return df(e,o,0),df(n,o,r),o.set(t,i),new pf(e,n,t,o)};class pf{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const gf=({name:e,code:t,encode:n})=>new mf(e,t,n);class mf{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?hf(this.code,t):t.then((e=>hf(this.code,e)))}throw Error("Unknown type, must be binary type")}}const bf=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),yf=gf({name:"sha2-256",code:18,encode:bf("SHA-256")}),vf=gf({name:"sha2-512",code:19,encode:bf("SHA-512")}),wf=pd,xf={code:0,name:"identity",encode:wf,digest:e=>hf(0,wf(e))},Sf="raw",Af=85,Ef=e=>pd(e),_f=e=>pd(e),Cf=new TextEncoder,If=new TextDecoder,kf="json",Tf=512,Mf=e=>Cf.encode(JSON.stringify(e)),Pf=e=>JSON.parse(If.decode(e));Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom");Symbol.for("@ipld/js-cid/CID");const Of={...i,...o,...s,...a,...c,...u,...l,...d,...f,...h};function Rf(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const Nf=Rf("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Bf=Rf("ascii","a",(e=>{let t="a";for(let n=0;n{const t=dd((e=e.substring(1)).length);for(let n=0;ne+t.length),0));const n=dd(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return ld(n)}([Uf("K36",ud),e]),ud);return[ad,cd,t].join(":")}function qf(e){const t=e.split(rd);return{header:jf(t[0]),payload:jf(t[1]),signature:Uf(t[2],id),data:Uf(t.slice(0,2).join(rd),sd)}}function zf(e=(0,nd.randomBytes)(32)){return td._w(e)}async function Hf(e,t,n,r,i=(0,qu.fromMiliseconds)(Date.now())){const o={alg:"EdDSA",typ:"JWT"},s={iss:Vf(r.publicKey),sub:e,aud:t,iat:i,exp:i+n},a=function(e){return Uf([Ff(e.header),Ff(e.payload)].join(rd),sd)}({header:o,payload:s});return function(e){return[Ff(e.header),Ff(e.payload),(t=e.signature,Df(t,id))].join(rd);var t}({header:o,payload:s,signature:td.Xx(r.secretKey,a)})}n(43014);var Wf=n(34155),Gf=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;ie+t.length),0));const n=hh(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}function gh(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const mh=gh("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),bh=gh("ascii","a",(e=>{let t="a";for(let n=0;n{const t=hh((e=e.substring(1)).length);for(let n=0;nt in e?kh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rh=(e,t)=>{for(var n in t||(t={}))Mh.call(t,n)&&Oh(e,n,t[n]);if(Th)for(var n of Th(t))Ph.call(t,n)&&Oh(e,n,t[n]);return e};const Nh="react-native",Bh="node",Lh="browser",Dh="unknown",Uh="js";function jh(){return typeof Ah<"u"&&typeof Ah.versions<"u"&&typeof Ah.versions.node<"u"}function Fh(){return!(0,ih.getDocument)()&&!!(0,ih.getNavigator)()&&"ReactNative"===navigator.product}function Vh(){return!jh()&&!!(0,ih.getNavigator)()&&!!(0,ih.getDocument)()}function qh(){return Fh()?Nh:jh()?Bh:Vh()?Lh:Dh}function zh(){return(0,oh.D)()||{name:"",description:"",url:"",icons:[""]}}function Hh(e,t,r){const i=function(){if(qh()===Nh&&typeof n.g<"u"&&typeof(null==n.g?void 0:n.g.Platform)<"u"){const{OS:e,Version:t}=n.g.Platform;return[e,t].join("-")}const e=th();if(null===e)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}(),o=function(){var e;const t=qh();return t===Lh?[t,(null==(e=(0,ih.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),[Uh,r].join("-"),i,o].join("/")}function Wh({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:i,projectId:o,useOnCloseEvent:s,bundleId:a}){const c=n.split("?"),u={auth:i,ua:Hh(e,t,r),projectId:o,useOnCloseEvent:s||void 0,origin:a||void 0},l=function(e,t){let n=sh.parse(e);return n=Rh(Rh({},n),t),sh.stringify(n)}(c[1]||"",u);return c[0]+"?"+l}function Gh(e,t){return e.filter((e=>t.includes(e))).length===e.length}function Zh(e){return Object.fromEntries(e.entries())}function Kh(e){return new Map(Object.entries(e))}function Xh(e=qu.FIVE_MINUTES,t){const n=(0,qu.toMiliseconds)(e||qu.FIVE_MINUTES);let r,i,o;return{resolve:e=>{o&&r&&(clearTimeout(o),r(e))},reject:e=>{o&&i&&(clearTimeout(o),i(e))},done:()=>new Promise(((e,s)=>{o=setTimeout((()=>{s(new Error(t))}),n),r=e,i=s}))}}function Yh(e,t,n){return new Promise((async(r,i)=>{const o=setTimeout((()=>i(new Error(n))),t);try{r(await e)}catch(s){i(s)}clearTimeout(o)}))}function Jh(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Qh(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof n)r.topic=n;else{if("id"!==t||!Number.isInteger(Number(n)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);r.id=Number(n)}return r}function $h(e,t){return(0,qu.fromMiliseconds)((t||Date.now())+(0,qu.toMiliseconds)(e))}function ep(e){return Date.now()>=(0,qu.toMiliseconds)(e)}function tp(e,t){return`${e}${t?`:${t}`:""}`}function np(e=[],t=[]){return[...new Set([...e,...t])]}async function rp({id:e,topic:t,wcDeepLink:r}){var i;try{if(!r)return;const o=("string"==typeof r?JSON.parse(r):r)?.href;if("string"!=typeof o)return;const s=function(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let i=`${e}`;if(e.startsWith("https://t.me")){i=`${i}${e.includes("?")?"&startapp=":"?startapp="}${function(e,t=!1){const n=Eh.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}(r,!0)}`}else i=`${i}/wc?${r}`;return i}(o,e,t),a=qh();if(a===Lh){if(null==(i=(0,ih.getDocument)())||!i.hasFocus())return void console.warn("Document does not have focus, skipping deeplink.");s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,typeof window<"u"&&(window.TelegramWebviewProxy||window.Telegram||window.TelegramWebviewProxyProto)?"_blank":"_self","noreferrer noopener")}else a===Nh&&typeof(null==n.g?void 0:n.g.Linking)<"u"&&await n.g.Linking.openURL(s)}catch(o){console.error(o)}}function ip(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function op(){return typeof crypto<"u"&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function sp(){return typeof Ah<"u"&&"true"===Ah.env.IS_VITEST}function ap(e){return Eh.from(e,"base64").toString("utf-8")}const cp="https://rpc.walletconnect.org/v1";async function up(e,t,n,r,i,o){switch(n.t){case"eip191":return function(e,t,n){return(0,ch.recoverAddress)((0,ah.r)(t),n).toLowerCase()===e.toLowerCase()}(e,t,n.s);case"eip1271":return await async function(e,t,n,r,i,o){const s=Ch(r);if(!s.namespace||!s.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const s="0x1626ba7e",a="0000000000000000000000000000000000000000000000000000000000000040",c="0000000000000000000000000000000000000000000000000000000000000041",u=n.substring(2),l=s+(0,ah.r)(t).substring(2)+a+c+u,d=await fetch(`${o||cp}/?chainId=${r}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:lp(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})}),{result:f}=await d.json();return!!f&&f.slice(0,s.length).toLowerCase()===s.toLowerCase()}catch(Ql){return console.error("isValidEip1271Signature: ",Ql),!1}}(e,t,n.s,r,i,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function lp(){return Date.now()+Math.floor(1e3*Math.random())}var dp=Object.defineProperty,fp=Object.defineProperties,hp=Object.getOwnPropertyDescriptors,pp=Object.getOwnPropertySymbols,gp=Object.prototype.hasOwnProperty,mp=Object.prototype.propertyIsEnumerable,bp=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yp=(e,t)=>{for(var n in t||(t={}))gp.call(t,n)&&bp(e,n,t[n]);if(pp)for(var n of pp(t))mp.call(t,n)&&bp(e,n,t[n]);return e},vp=(e,t)=>fp(e,hp(t));const wp=e=>e?.split(":"),xp=e=>{const t=e&&wp(e);if(t)return t[2]+":"+t[3]},Sp=e=>{const t=e&&wp(e);if(t)return t.pop()};async function Ap(e){const{cacao:t,projectId:n}=e,{s:r,p:i}=t,o=Ep(i,i.iss),s=Sp(i.iss);return await up(s,o,r,xp(i.iss),n)}const Ep=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=Sp(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=e.statement||void 0;const o=`URI: ${e.aud||e.uri}`,s=`Version: ${e.version}`,a=`Chain ID: ${(e=>{const t=e&&wp(e);if(t)return e.includes("did:pkh:")?t[3]:t[1]})(t)}`,c=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,f=e.requestId?`Request ID: ${e.requestId}`:void 0,h=e.resources?`Resources:${e.resources.map((e=>`\n- ${e}`)).join("")}`:void 0,p=Bp(e.resources);if(p){i=Op(i,kp(p))}return[n,r,"",i,"",o,s,a,c,u,l,d,f,h].filter((e=>null!=e)).join("\n")};function _p(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(null==t||!t.length)throw new Error("No resources found in `att` property");t.forEach((t=>{const n=e.att[t];if(Array.isArray(n))throw new Error(`Resource must be an object: ${t}`);if("object"!=typeof n)throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(n).forEach((e=>{const t=n[e];if(!Array.isArray(t))throw new Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw new Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach((t=>{if("object"!=typeof t)throw new Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)}))}))}))}function Cp(e,t,n={}){t=t?.sort(((e,t)=>e.localeCompare(t)));const r=t.map((t=>({[`${e}/${t}`]:[n]})));return Object.assign({},...r)}function Ip(e){return _p(e),`urn:recap:${function(e){return Eh.from(JSON.stringify(e)).toString("base64")}(e).replace(/=/g,"")}`}function kp(e){const t=function(e){return JSON.parse(Eh.from(e,"base64").toString("utf-8"))}(e.replace("urn:recap:",""));return _p(t),t}function Tp(e,t,n){const r=function(e,t,n,r={}){return n?.sort(((e,t)=>e.localeCompare(t))),{att:{[e]:Cp(t,n,r)}}}(e,t,n);return Ip(r)}function Mp(e){return e&&e.includes("urn:recap:")}function Pp(e,t){const n=function(e,t){_p(e),_p(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort(((e,t)=>e.localeCompare(t))),r={att:{}};return n.forEach((n=>{var i,o;Object.keys((null==(i=e.att)?void 0:i[n])||{}).concat(Object.keys((null==(o=t.att)?void 0:o[n])||{})).sort(((e,t)=>e.localeCompare(t))).forEach((i=>{var o,s;r.att[n]=vp(yp({},r.att[n]),{[i]:(null==(o=e.att[n])?void 0:o[i])||(null==(s=t.att[n])?void 0:s[i])})}))})),r}(kp(e),kp(t));return Ip(n)}function Op(e="",t){_p(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let i=0;Object.keys(t.att).forEach((e=>{const n=Object.keys(t.att[e]).map((e=>({ability:e.split("/")[0],action:e.split("/")[1]})));n.sort(((e,t)=>e.action.localeCompare(t.action)));const o={};n.forEach((e=>{o[e.ability]||(o[e.ability]=[]),o[e.ability].push(e.action)}));const s=Object.keys(o).map((t=>(i++,`(${i}) '${t}': '${o[t].join("', '")}' for '${e}'.`)));r.push(s.join(", ").replace(".,","."))}));return`${e?e+" ":""}${`${n}${r.join(" ")}`}`}function Rp(e){var t;const n=kp(e);_p(n);const r=null==(t=n.att)?void 0:t.eip155;return r?Object.keys(r).map((e=>e.split("/")[1])):[]}function Np(e){const t=kp(e);_p(t);const n=[];return Object.values(t.att).forEach((e=>{Object.values(e).forEach((e=>{var t;null!=(t=e?.[0])&&t.chains&&n.push(e[0].chains)}))})),[...new Set(n.flat())]}function Bp(e){if(!e)return;const t=e?.[e.length-1];return Mp(t)?t:void 0}const Lp="base10",Dp="base16",Up="base64pad",jp="base64url",Fp="utf8";function Vp(){return wh((0,nd.randomBytes)(32),Dp)}function qp(e){return wh((0,dh.vp)(vh(e,Dp)),Dp)}function zp(e){return wh((0,dh.vp)(vh(e,Fp)),Dp)}function Hp(e){return vh(`${e}`,Lp)}function Wp(e){return Number(wh(e,Lp))}function Gp(e){const{encoding:t=Up}=e;if(2===Wp(e.type))return wh(ph([e.type,e.sealed]),t);if(1===Wp(e.type)){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return wh(ph([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return wh(ph([e.type,e.iv,e.sealed]),t)}function Zp(e){const{encoded:t,encoding:n=Up}=e,r=vh(t,n),i=r.slice(0,1);if(1===Wp(i)){const e=33,t=e+12,n=r.slice(1,e),o=r.slice(e,t);return{type:i,sealed:r.slice(t),iv:o,senderPublicKey:n}}if(2===Wp(i)){return{type:i,sealed:r.slice(1),iv:(0,nd.randomBytes)(12)}}const o=r.slice(1,13);return{type:i,sealed:r.slice(13),iv:o}}function Kp(e){const t=e?.type||0;if(1===t){if(typeof e?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function Xp(e){return 1===e.type&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function Yp(e){return 2===e.type}function Jp(e,t){const[n,r,i]=e.split("."),o=function(e){return Eh.from(function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=t.length%4;return n>0&&(t+="=".repeat(4-n)),t}(e),"base64")}(i);if(64!==o.length)throw new Error("Invalid signature length");const s=o.slice(0,32).toString("hex"),a=o.slice(32,64).toString("hex"),c=`${n}.${r}`,u=(new dh.mE).update(Eh.from(c)).digest(),l=function(e){return new xh.ec("p256").keyFromPublic({x:Eh.from(e.x,"base64").toString("hex"),y:Eh.from(e.y,"base64").toString("hex")},"hex")}(t),d=Eh.from(u).toString("hex");if(!l.verify(d,{r:s,s:a}))throw new Error("Invalid signature");return qf(e).payload}function Qp(e){return e?.relay||{protocol:"irn"}}function $p(e){const t=Sh[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var eg=Object.defineProperty,tg=Object.defineProperties,ng=Object.getOwnPropertyDescriptors,rg=Object.getOwnPropertySymbols,ig=Object.prototype.hasOwnProperty,og=Object.prototype.propertyIsEnumerable,sg=(e,t,n)=>t in e?eg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ag=(e,t)=>{for(var n in t||(t={}))ig.call(t,n)&&sg(e,n,t[n]);if(rg)for(var n of rg(t))og.call(t,n)&&sg(e,n,t[n]);return e};function cg(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach((t=>{if(t.startsWith(r)){const i=t.replace(r,""),o=e[t];n[i]=o}})),n}function ug(e){if(!e.includes("wc:")){const t=ap(e);null!=t&&t.includes("wc:")&&(e=t)}const t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=e.substring(t+1,n).split("@"),o=typeof n<"u"?e.substring(n):"",s=sh.parse(o),a="string"==typeof s.methods?s.methods.split(","):void 0;return{protocol:r,topic:lg(i[0]),version:parseInt(i[1],10),symKey:s.symKey,relay:cg(s),methods:a,expiryTimestamp:s.expiryTimestamp?parseInt(s.expiryTimestamp,10):void 0}}function lg(e){return e.startsWith("//")?e.substring(2):e}function dg(e){return`${e.protocol}:${e.topic}@${e.version}?`+sh.stringify(ag(((e,t)=>tg(e,ng(t)))(ag({symKey:e.symKey},function(e,t="-"){const n={};return Object.keys(e).forEach((r=>{const i="relay"+t+r;e[r]&&(n[i]=e[r])})),n}(e.relay)),{expiryTimestamp:e.expiryTimestamp}),e.methods?{methods:e.methods.join(",")}:{}))}function fg(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function hg(e){const t=[];return e.forEach((e=>{const[n,r]=e.split(":");t.push(`${n}:${r}`)})),t}function pg(e,t){t=t.map((e=>e.replace("did:pkh:","")));const n=function(e){const t={};return e?.forEach((e=>{const[n,r]=e.split(":");t[n]||(t[n]={accounts:[],chains:[],events:[]}),t[n].accounts.push(e),t[n].chains.push(`${n}:${r}`)})),t}(t);for(const[r,i]of Object.entries(n))i.methods?i.methods=np(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return n}const gg={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},mg={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function bg(e,t){const{message:n,code:r}=mg[e];return{message:t?`${n} ${t}`:n,code:r}}function yg(e,t){const{message:n,code:r}=gg[e];return{message:t?`${n} ${t}`:n,code:r}}function vg(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function wg(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function xg(e){return typeof e>"u"}function Sg(e,t){return!(!t||!xg(e))||"string"==typeof e&&!!e.trim().length}function Ag(e,t){return!(!t||!xg(e))||"number"==typeof e&&!isNaN(e)}function Eg(e){return!(!Sg(e,!1)||!e.includes(":"))&&2===e.split(":").length}function _g(e){let t=!0;return vg(e)?e.length&&(t=e.every((e=>Sg(e,!1)))):t=!1,t}function Cg(e,t,n){let r=null;return Object.entries(e).forEach((([e,i])=>{if(r)return;const o=function(e,t,n){let r=null;return vg(t)&&t.length?t.forEach((e=>{r||Eg(e)||(r=yg("UNSUPPORTED_CHAINS",`${n}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):Eg(e)||(r=yg("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}(e,Ih(e,i),`${t} ${n}`);o&&(r=o)})),r}function Ig(e,t){let n=null;return vg(e)?e.forEach((e=>{n||function(e){if(Sg(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&Eg(e)}}return!1}(e)||(n=yg("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):n=yg("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function kg(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=function(e,t){let n=null;return _g(e?.methods)?_g(e?.events)||(n=yg("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=yg("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}(e,`${t}, namespace`);r&&(n=r)})),n}function Tg(e,t){let n=null;if(e&&wg(e)){const r=kg(e,t);r&&(n=r);const i=function(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=Ig(e?.accounts,`${t} namespace`);r&&(n=r)})),n}(e,t);i&&(n=i)}else n=bg("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function Mg(e){return Sg(e.protocol,!0)}function Pg(e){return typeof e<"u"&&null!==typeof e}function Og(e,t){return!(!Eg(t)||!function(e){const t=[];return Object.values(e).forEach((e=>{t.push(...hg(e.accounts))})),t}(e).includes(t))}function Rg(e,t,n){return!!Sg(n,!1)&&function(e,t){const n=[];return Object.values(e).forEach((e=>{hg(e.accounts).includes(t)&&n.push(...e.methods)})),n}(e,t).includes(n)}function Ng(e,t,n){return!!Sg(n,!1)&&function(e,t){const n=[];return Object.values(e).forEach((e=>{hg(e.accounts).includes(t)&&n.push(...e.events)})),n}(e,t).includes(n)}function Bg(e,t,n){let r=null;const i=function(e){const t={};return Object.keys(e).forEach((n=>{var r;n.includes(":")?t[n]=e[n]:null==(r=e[n].chains)||r.forEach((r=>{t[r]={methods:e[n].methods,events:e[n].events}}))})),t}(e),o=function(e){const t={};return Object.keys(e).forEach((n=>{if(n.includes(":"))t[n]=e[n];else{hg(e[n].accounts)?.forEach((r=>{t[r]={accounts:e[n].accounts.filter((e=>e.includes(`${r}:`))),methods:e[n].methods,events:e[n].events}}))}})),t}(t),s=Object.keys(i),a=Object.keys(o),c=Lg(Object.keys(e)),u=Lg(Object.keys(t)),l=c.filter((e=>!u.includes(e)));return l.length&&(r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces.\n Required: ${l.toString()}\n Received: ${Object.keys(t).toString()}`)),Gh(s,a)||(r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces.\n Required: ${s.toString()}\n Approved: ${a.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||r)return;const i=hg(t[e].accounts);i.includes(e)||(r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${i.toString()}`))})),s.forEach((e=>{r||(Gh(i[e].methods,o[e].methods)?Gh(i[e].events,o[e].events)||(r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${e}`)):r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${e}`))})),r}function Lg(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function Dg(){const e=qh();return new Promise((t=>{switch(e){case Lh:t(Vh()&&navigator?.onLine);break;case Nh:t(async function(){if(Fh()&&typeof n.g<"u"&&null!=n.g&&n.g.NetInfo){return(await(null==n.g?void 0:n.g.NetInfo.fetch()))?.isConnected}return!0}());break;default:t(!0)}}))}function Ug(e){switch(qh()){case Lh:!function(e){!Fh()&&Vh()&&(window.addEventListener("online",(()=>e(!0))),window.addEventListener("offline",(()=>e(!1))))}(e);break;case Nh:!function(e){Fh()&&typeof n.g<"u"&&null!=n.g&&n.g.NetInfo&&n.g?.NetInfo.addEventListener((t=>e(t?.isConnected)))}(e)}}const jg={};class Fg{static get(e){return jg[e]}static set(e,t){jg[e]=t}static delete(e){delete jg[e]}}const Vg="INTERNAL_ERROR",qg="SERVER_ERROR",zg=[-32700,-32600,-32601,-32602,-32603],Hg={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[Vg]:{code:-32603,message:"Internal error"},[qg]:{code:-32e3,message:"Server error"}};function Wg(e){return zg.includes(e)}function Gg(e){return Object.keys(Hg).includes(e)?Hg[e]:Hg.SERVER_ERROR}function Zg(e){const t=Object.values(Hg).find((t=>t.code===e));return t||Hg.SERVER_ERROR}function Kg(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${t}`):e}var Xg=n(93109);function Yg(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function Jg(e=6){return BigInt(Yg(e))}function Qg(e,t,n){return{id:n||Yg(),jsonrpc:"2.0",method:e,params:t}}function $g(e,t){return{id:e,jsonrpc:"2.0",result:t}}function em(e,t,n){return{id:e,jsonrpc:"2.0",error:tm(t,n)}}function tm(e,t){return"undefined"===typeof e?Gg(Vg):("string"===typeof e&&(e=Object.assign(Object.assign({},Gg(qg)),{message:e})),"undefined"!==typeof t&&(e.data=t),Wg(e.code)&&(e=Zg(e.code)),e)}class nm extends class extends class{}{constructor(){super()}}{constructor(e){super()}}function rm(e,t){const n=function(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return"undefined"!==typeof n&&new RegExp(t).test(n)}function im(e){return rm(e,"^https?:")}function om(e){return rm(e,"^wss?:")}function sm(e){return"object"===typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function am(e){return sm(e)&&"method"in e}function cm(e){return sm(e)&&(um(e)||lm(e))}function um(e){return"result"in e}function lm(e){return"error"in e}class dm extends nm{constructor(e){super(e),this.events=new Nt.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Qg(e.method,e.params||[],e.id||Jg().toString()),t)}async requestStrict(e,t){return new Promise((async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(Hu){r(Hu)}this.events.on(`${e.id}`,(e=>{lm(e)?r(e.error):n(e.result)}));try{await this.connection.send(e,t)}catch(Hu){r(Hu)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),cm(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",(e=>this.onPayload(e))),this.connection.on("close",(e=>this.onClose(e))),this.connection.on("error",(e=>this.events.emit("error",e))),this.connection.on("register_error",(e=>this.onClose())),this.hasRegisteredEventListeners=!0)}}const fm=e=>e.split("?")[0],hm=typeof WebSocket<"u"?WebSocket:typeof n.g<"u"&&typeof n.g.WebSocket<"u"?n.g.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:n(72030);class pm{constructor(e){if(this.url=e,this.events=new Nt.EventEmitter,this.registering=!1,!om(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise(((e,t)=>{typeof this.socket>"u"?t(new Error("Connection already closed")):(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close())}))}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(yl(e))}catch(aM){this.onError(e.id,aM)}}register(e=this.url){if(!om(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,r)=>{const i=new URLSearchParams(e).get("origin"),o=(0,Xg.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:(a=e,!new RegExp("wss?://localhost(:d{2,5})?").test(a))},s=new hm(e,[],o);var a;typeof WebSocket<"u"||typeof n.g<"u"&&typeof n.g.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u"?s.onerror=e=>{const t=e;r(this.emitError(t.error))}:s.on("error",(e=>{r(this.emitError(e))})),s.onopen=()=>{this.onOpen(s),t(s)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?bl(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=em(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e,t=this.url){return Kg(e,fm(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${fm(this.url)}`));return this.events.emit("register_error",t),t}}var gm=n(72307),mm=n.n(gm);const bm="core",ym="wc@2:core:",vm="error",wm={database:":memory:"},xm="client_ed25519_seed",Sm=qu.ONE_DAY,Am=qu.SIX_HOURS,Em="wss://relay.walletconnect.org",_m="relayer_message",Cm="relayer_message_ack",Im="relayer_connect",km="relayer_disconnect",Tm="relayer_error",Mm="relayer_connection_stalled",Pm="relayer_publish",Om="payload",Rm="connect",Nm="disconnect",Bm="error",Lm="2.17.1",Dm={link_mode:"link_mode",relay:"relay"},Um="WALLETCONNECT_LINK_MODE_APPS",jm="subscription_created",Fm="subscription_deleted",Vm="subscription_sync",qm="subscription_resubscribed",zm=1e3*qu.FIVE_SECONDS,Hm={wc_pairingDelete:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:qu.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:qu.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:0},res:{ttl:qu.ONE_DAY,prompt:!1,tag:0}}},Wm="pairing_create",Gm="pairing_expire",Zm="pairing_delete",Km="pairing_ping",Xm="history_created",Ym="history_updated",Jm="history_deleted",Qm="history_sync",$m="expirer_created",eb="expirer_deleted",tb="expirer_expired",nb="expirer_sync",rb="https://verify.walletconnect.org",ib=rb,ob=`${ib}/v3`,sb=["https://verify.walletconnect.com",rb],ab="pairing_started",cb="pairing_uri_validation_success",ub="pairing_uri_not_expired",lb="store_new_pairing",db="subscribing_pairing_topic",fb="subscribe_pairing_topic_success",hb="existing_pairing",pb="pairing_not_expired",gb="emit_inactive_pairing",mb="emit_session_proposal",bb="no_internet_connection",yb="malformed_pairing_uri",vb="active_pairing_already_exists",wb="subscribe_pairing_topic_failure",xb="pairing_expired",Sb="proposal_listener_not_found",Ab="session_approve_started",Eb="session_namespaces_validation_success",_b="subscribing_session_topic",Cb="subscribe_session_topic_success",Ib="publishing_session_approve",kb="session_approve_publish_success",Tb="store_session",Mb="publishing_session_settle",Pb="session_settle_publish_success",Ob="no_internet_connection",Rb="proposal_expired",Nb="subscribe_session_topic_failure",Bb="session_approve_publish_failure",Lb="session_settle_publish_failure",Db="session_approve_namespace_validation_failure",Ub="proposal_not_found",jb="authenticated_session_approve_started",Fb="create_authenticated_session_topic",Vb="cacaos_verified",qb="store_authenticated_session",zb="subscribing_authenticated_session_topic",Hb="subscribe_authenticated_session_topic_success",Wb="publishing_authenticated_session_approve",Gb="no_internet_connection",Zb="invalid_cacao",Kb="subscribe_authenticated_session_topic_failure",Xb="authenticated_session_approve_publish_failure",Yb="authenticated_session_pending_request_not_found";var Jb=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=o-1;(0!==l||d>>0,s[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===s[h];)h++;for(var p=new Uint8Array(r+(o-h)),g=r;h!==o;)p[g++]=s[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,u=new Uint8Array(s);i!==o;){for(var d=t[i],f=0,h=s-1;(0!==d||f>>0,u[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=s-r;p!==s&&0===u[p];)p++;for(var g=c.repeat(n);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class ey{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class ty{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return ry(this,e)}}class ny{constructor(e){this.decoders=e}or(e){return ry(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ry=(e,t)=>new ny({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class iy{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new ey(e,t,n),this.decoder=new ty(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const oy=({name:e,prefix:t,encode:n,decode:r})=>new iy(e,t,n,r),sy=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=Qb(n,t);return oy({prefix:e,name:t,encode:r,decode:e=>$b(i(e))})},ay=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>oy({prefix:t,name:e,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<((e,t,n,r)=>{const i={};for(let l=0;l=8&&(a-=8,s[u++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(t,r,n,e)}),cy=oy({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});var uy=Object.freeze({__proto__:null,identity:cy});const ly=ay({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var dy=Object.freeze({__proto__:null,base2:ly});const fy=ay({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var hy=Object.freeze({__proto__:null,base8:fy});const py=sy({prefix:"9",name:"base10",alphabet:"0123456789"});var gy=Object.freeze({__proto__:null,base10:py});const my=ay({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),by=ay({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var yy=Object.freeze({__proto__:null,base16:my,base16upper:by});const vy=ay({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),wy=ay({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),xy=ay({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Sy=ay({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ay=ay({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ey=ay({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),_y=ay({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Cy=ay({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Iy=ay({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ky=Object.freeze({__proto__:null,base32:vy,base32upper:wy,base32pad:xy,base32padupper:Sy,base32hex:Ay,base32hexupper:Ey,base32hexpad:_y,base32hexpadupper:Cy,base32z:Iy});const Ty=sy({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),My=sy({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Py=Object.freeze({__proto__:null,base36:Ty,base36upper:My});const Oy=sy({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ry=sy({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ny=Object.freeze({__proto__:null,base58btc:Oy,base58flickr:Ry});const By=ay({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ly=ay({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Dy=ay({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Uy=ay({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var jy=Object.freeze({__proto__:null,base64:By,base64pad:Ly,base64url:Dy,base64urlpad:Uy});const Fy=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),Vy=Fy.reduce(((e,t,n)=>(e[n]=t,e)),[]),qy=Fy.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const zy=oy({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Vy[t]),"")},decode:function(e){const t=[];for(const n of e){const e=qy[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}});var Hy=Object.freeze({__proto__:null,base256emoji:zy}),Wy=function e(t,n,r){n=n||[];for(var i=r=r||0;t>=Gy;)n[r++]=255&t|128,t/=128;for(;-128&t;)n[r++]=255&t|128,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Gy=Math.pow(2,31);var Zy=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(127&r)<=128);return e.bytes=s-n,i};var Ky=Math.pow(2,7),Xy=Math.pow(2,14),Yy=Math.pow(2,21),Jy=Math.pow(2,28),Qy=Math.pow(2,35),$y=Math.pow(2,42),ev=Math.pow(2,49),tv=Math.pow(2,56),nv=Math.pow(2,63),rv={encode:Wy,decode:Zy,encodingLength:function(e){return e(iv.encode(e,t,n),t),sv=e=>iv.encodingLength(e),av=(e,t)=>{const n=t.byteLength,r=sv(e),i=r+sv(n),o=new Uint8Array(i+n);return ov(e,o,0),ov(n,o,r),o.set(t,i),new cv(e,n,t,o)};class cv{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const uv=({name:e,code:t,encode:n})=>new lv(e,t,n);class lv{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?av(this.code,t):t.then((e=>av(this.code,e)))}throw Error("Unknown type, must be binary type")}}const dv=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),fv=uv({name:"sha2-256",code:18,encode:dv("SHA-256")}),hv=uv({name:"sha2-512",code:19,encode:dv("SHA-512")});Object.freeze({__proto__:null,sha256:fv,sha512:hv});const pv=$b,gv={code:0,name:"identity",encode:pv,digest:e=>av(0,pv(e))};Object.freeze({__proto__:null,identity:gv});new TextEncoder,new TextDecoder;const mv={...uy,...dy,...hy,...gy,...yy,...ky,...Py,...Ny,...jy,...Hy};function bv(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const yv=bv("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),vv=bv("ascii","a",(e=>{let t="a";for(let n=0;n{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let n=0;n{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=Zl(t,this.name)}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Zh(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Kh(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Sv{constructor(e,t,n){this.core=e,this.logger=t,this.name="crypto",this.randomSessionIdentifier=Vp(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>{this.isInitialized();return Vf(zf(await this.getClientSeed()).publicKey)},this.generateKeyPair=()=>{this.isInitialized();const e=function(){const e=fh.Au();return{privateKey:wh(e.secretKey,Dp),publicKey:wh(e.publicKey,Dp)}}();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();const t=zf(await this.getClientSeed()),n=this.randomSessionIdentifier,r=Sm;return await Hf(n,e,r,t)},this.generateSharedKey=(e,t,n)=>{this.isInitialized();const r=function(e,t){const n=fh.gi(vh(e,Dp),vh(t,Dp),!0);return wh(new lh.t(dh.mE,n).expand(32),Dp)}(this.getPrivateKey(e),t);return this.setSymKey(r,n)},this.setSymKey=async(e,t)=>{this.isInitialized();const n=t||qp(e);return await this.keychain.set(n,e),n},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,n)=>{this.isInitialized();const r=Kp(n),i=yl(t);if(Yp(r))return function(e,t){const n=Hp(2),r=(0,nd.randomBytes)(12);return Gp({type:n,sealed:vh(e,Fp),iv:r,encoding:t})}(i,n?.encoding);if(Xp(r)){const t=r.senderPublicKey,n=r.receiverPublicKey;e=await this.generateSharedKey(t,n)}const o=this.getSymKey(e),{type:s,senderPublicKey:a}=r;return function(e){const t=Hp(typeof e.type<"u"?e.type:0);if(1===Wp(t)&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?vh(e.senderPublicKey,Dp):void 0,r=typeof e.iv<"u"?vh(e.iv,Dp):(0,nd.randomBytes)(12);return Gp({type:t,sealed:new uh.OK(vh(e.symKey,Dp)).seal(r,vh(e.message,Fp)),iv:r,senderPublicKey:n,encoding:e.encoding})}({type:s,symKey:o,message:i,senderPublicKey:a,encoding:n?.encoding})},this.decode=async(e,t,n)=>{this.isInitialized();const r=function(e,t){const n=Zp({encoded:e,encoding:t?.encoding});return Kp({type:Wp(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?wh(n.senderPublicKey,Dp):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,n);if(Yp(r)){const e=function(e,t){const{sealed:n}=Zp({encoded:e,encoding:t});return wh(n,Fp)}(t,n?.encoding);return bl(e)}if(Xp(r)){const t=r.receiverPublicKey,n=r.senderPublicKey;e=await this.generateSharedKey(t,n)}try{const r=function(e){const t=new uh.OK(vh(e.symKey,Dp)),{sealed:n,iv:r}=Zp({encoded:e.encoded,encoding:e?.encoding}),i=t.open(r,n);if(null===i)throw new Error("Failed to decrypt");return wh(i,Fp)}({symKey:this.getSymKey(e),encoded:t,encoding:n?.encoding});return bl(r)}catch(Cl){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(Cl)}},this.getPayloadType=(e,t=Up)=>Wp(Zp({encoded:e,encoding:t}).type),this.getPayloadSenderPublicKey=(e,t=Up)=>{const n=Zp({encoded:e,encoding:t});return n.senderPublicKey?wh(n.senderPublicKey,Dp):void 0},this.core=e,this.logger=Zl(t,this.name),this.keychain=n||new xv(this.core,this.logger)}get context(){return Gl(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(xm)}catch{e=Vp(),await this.keychain.set(xm,e)}return function(e,t="utf8"){const n=wv[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${e}`):globalThis.Buffer.from(e,"utf8")}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Av extends class{constructor(e,t){this.logger=e,this.core=t}}{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name="messages",this.version="0.3",this.initialized=!1,this.storagePrefix=ym,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(Wu){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(Wu)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();const n=zp(t);let r=this.messages.get(e);return typeof r>"u"&&(r={}),typeof r[n]<"u"||(r[n]=t,this.messages.set(e,r),await this.persist()),n},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>{this.isInitialized();return typeof this.get(e)[zp(t)]<"u"},this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=Zl(e,this.name),this.core=t}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Zh(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Kh(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ev extends Jl{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new Nt.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=(0,qu.toMiliseconds)(qu.ONE_MINUTE),this.failedPublishTimeout=(0,qu.toMiliseconds)(qu.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(e,t,n)=>{var r;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:n}});const i=n?.ttl||Am,o=Qp(n),s=n?.prompt||!1,a=n?.tag||0,c=n?.id||Jg().toString(),u={topic:e,message:t,opts:{ttl:i,relay:o,prompt:s,tag:a,id:c,attestation:n?.attestation}},l=`Failed to publish payload, please try again. id:${c} tag:${a}`,d=Date.now();let f,h=1;try{for(;void 0===f;){if(Date.now()-d>this.publishTimeout)throw new Error(l);this.logger.trace({id:c,attempts:h},`publisher.publish - attempt ${h}`),f=await await Yh(this.rpcPublish(e,t,i,o,s,a,c,n?.attestation).catch((e=>this.logger.warn(e))),this.publishTimeout,l),h++,f||await new Promise((e=>setTimeout(e,this.failedPublishTimeout)))}this.relayer.events.emit(Pm,u),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:n}})}catch(p){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(p),null!=(r=n?.internal)&&r.throwOnFailedPublish)throw p;this.queue.set(c,u)}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=Zl(t,this.name),this.registerEventListeners()}get context(){return Gl(this.logger)}rpcPublish(e,t,n,r,i,o,s,a){var c,u,l,d;const f={method:$p(r.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:i,tag:o,attestation:a},id:s};return xg(null==(c=f.params)?void 0:c.prompt)&&(null==(u=f.params)||delete u.prompt),xg(null==(l=f.params)?void 0:l.tag)&&(null==(d=f.params)||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f}),this.relayer.request(f)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async e=>{const{topic:t,message:n,opts:r}=e;await this.publish(t,n,r)}))}registerEventListeners(){this.relayer.core.heartbeat.on(Gu,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(Mm);this.checkQueue()})),this.relayer.on(Cm,(e=>{this.removeRequestFromQueue(e.id.toString())}))}}class _v{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const r=n.filter((e=>e!==t));r.length?this.map.set(e,r):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Cv=Object.defineProperty,Iv=Object.defineProperties,kv=Object.getOwnPropertyDescriptors,Tv=Object.getOwnPropertySymbols,Mv=Object.prototype.hasOwnProperty,Pv=Object.prototype.propertyIsEnumerable,Ov=(e,t,n)=>t in e?Cv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rv=(e,t)=>{for(var n in t||(t={}))Mv.call(t,n)&&Ov(e,n,t[n]);if(Tv)for(var n of Tv(t))Pv.call(t,n)&&Ov(e,n,t[n]);return e},Nv=(e,t)=>Iv(e,kv(t));class Bv extends $l{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new _v,this.events=new Nt.EventEmitter,this.name="subscription",this.version="0.3",this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ym,this.subscribeTimeout=(0,qu.toMiliseconds)(qu.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const n=Qp(t),r={topic:e,relay:n,transportType:t?.transportType};this.pending.set(e,r);const i=await this.rpcSubscribe(e,n,t);return"string"==typeof i&&(this.onSubscribe(i,r),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),i}catch(n){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(n),n}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),typeof t?.id<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>{if(this.topics.includes(e))return!0;const t=`${this.pendingSubscriptionWatchLabel}_${e}`;return await new Promise(((n,r)=>{const i=new qu.Watch;i.start(t);const o=setInterval((()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(o),i.stop(t),n(!0)),i.elapsed(t)>=zm&&(clearInterval(o),i.stop(t),r(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1))},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Zl(t,this.name),this.clientId=""}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map((async n=>await this.unsubscribeById(e,n,t))))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const r=Qp(n);await this.rpcUnsubscribe(e,t,r);const i=yg("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(r){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r),r}}async rpcSubscribe(e,t,n){var r;n?.transportType===Dm.relay&&await this.restartToComplete();const i={method:$p(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});const o=null==(r=n?.internal)?void 0:r.throwOnFailedPublish;try{const t=zp(e+this.clientId);if(n?.transportType===Dm.link_mode)return setTimeout((()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch((e=>this.logger.warn(e)))}),(0,qu.toMiliseconds)(qu.ONE_SECOND)),t;const r=await Yh(this.relayer.request(i).catch((e=>this.logger.warn(e))),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!r&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return r?t:null}catch(s){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Mm),o)throw s}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:$p(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{return await await Yh(this.relayer.request(t).catch((e=>this.logger.warn(e))),this.subscribeTimeout)}catch{this.relayer.events.emit(Mm)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t={method:$p(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map((e=>e.topic))}};let n;this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{n=await await Yh(this.relayer.request(t).catch((e=>this.logger.warn(e))),this.subscribeTimeout)}catch{this.relayer.events.emit(Mm)}return n}rpcUnsubscribe(e,t,n){const r={method:$p(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}onSubscribe(e,t){this.setSubscription(e,Nv(Rv({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,Rv({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,Rv({},t)),this.topicMap.set(t.topic,e),this.events.emit(jm,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Fm,Nv(Rv({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vm)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=bg("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);vg(t)&&this.onBatchSubscribe(t.map(((t,n)=>Nv(Rv({},e[n]),{id:t}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(Gu,(async()=>{await this.checkPending()})),this.events.on(jm,(async e=>{const t=jm;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(Fm,(async e=>{const t=Fm;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.restartInProgress||(clearInterval(t),e())}),this.pollingInterval)}))}}var Lv=Object.defineProperty,Dv=Object.getOwnPropertySymbols,Uv=Object.prototype.hasOwnProperty,jv=Object.prototype.propertyIsEnumerable,Fv=(e,t,n)=>t in e?Lv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vv=(e,t)=>{for(var n in t||(t={}))Uv.call(t,n)&&Fv(e,n,t[n]);if(Dv)for(var n of Dv(t))jv.call(t,n)&&Fv(e,n,t[n]);return e};class qv extends Ql{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Nt.EventEmitter,this.name="relayer",this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=(0,qu.toMiliseconds)(qu.THIRTY_SECONDS+qu.ONE_SECOND),this.request=async e=>{var t,n;this.logger.debug("Publishing Request Payload");const r=e.id||Jg().toString();await this.toEstablishConnection();try{const i=this.provider.request(e);this.requestsInFlight.set(r,{promise:i,request:e}),this.logger.trace({id:r,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - attempt to publish...");const o=await new Promise((async(e,t)=>{const n=()=>{t(new Error(`relayer.request - publish interrupted, id: ${r}`))};this.provider.on(Nm,n);const o=await i;this.provider.off(Nm,n),e(o)}));return this.logger.trace({id:r,method:e.method,topic:null==(n=e.params)?void 0:n.topic},"relayer.request - published"),o}catch(Hu){throw this.logger.debug(`Failed to Publish Request: ${r}`),Hu}finally{this.requestsInFlight.delete(r)}},this.resetPingTimeout=()=>{if(jh())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout((()=>{var e,t,n;null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)||n.terminate()}),this.heartBeatTimeout)}catch(aM){this.logger.warn(aM)}},this.onPayloadHandler=e=>{this.onProviderPayload(e),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Im)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(Tm,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Om,this.onPayloadHandler),this.provider.on(Rm,this.onConnectHandler),this.provider.on(Nm,this.onDisconnectHandler),this.provider.on(Bm,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?Zl(e.logger,this.name):kl()(Wl({level:e.logger||"error"})),this.messages=new Av(this.logger,e.core),this.subscriber=new Bv(this,this.logger),this.publisher=new Ev(this,this.logger),this.relayUrl=e?.relayUrl||Em,this.projectId=e.projectId,this.bundleId=function(){var e;try{return Fh()&&typeof n.g<"u"&&typeof(null==n.g?void 0:n.g.Application)<"u"?null==(e=n.g.Application)?void 0:e.applicationId:void 0}catch{return}}(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Gl(this.logger)}get connected(){var e,t,n;return 1===(null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.readyState)}get connecting(){var e,t,n;return 0===(null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.readyState)}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:Dm.relay})}async subscribe(e,t){var n,r,i;this.isInitialized(),"relay"===t?.transportType&&await this.toEstablishConnection();const o=typeof(null==(n=t?.internal)?void 0:n.throwOnFailedPublish)>"u"||(null==(r=t?.internal)?void 0:r.throwOnFailedPublish);let s,a=(null==(i=this.subscriber.topicMap.get(e))?void 0:i[0])||"";const c=t=>{t.topic===e&&(this.subscriber.off(jm,c),s())};return await Promise.all([new Promise((e=>{s=e,this.subscriber.on(jm,c)})),new Promise((async(n,r)=>{a=await this.subscriber.subscribe(e,Vv({internal:{throwOnFailedPublish:o}},t)).catch((e=>{o&&r(e)}))||a,n()}))]),a}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map((e=>e.promise)))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await Yh(this.provider.disconnect(),2e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise((async(e,t)=>{const n=()=>{this.provider.off(Nm,n),t(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Nm,n),await Yh(this.provider.connect(),(0,qu.toMiliseconds)(qu.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch((e=>{t(e)})).finally((()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0})),this.subscriber.start().catch((e=>{this.logger.error(e),this.onDisconnectHandler()})),this.hasExperiencedNetworkDisruption=!1,e()}))}catch(aM){this.logger.error(aM);const t=aM;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(t.message))throw aM}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!(await Dg()))throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(0===e?.length)return void this.logger.trace("Batch message events is empty. Ignoring...");const t=e.sort(((e,t)=>e.publishedAt-t.publishedAt));this.logger.trace(`Batch of ${t.length} message events sorted`);for(const r of t)try{await this.onMessageEvent(r)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:n}=e;if(!t.sessionExists){const e={topic:n,expiry:$h(qu.FIVE_MINUTES),relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,e)}this.events.emit(_m,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,n,r,i;if(jh())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(i=null==(r=null==(n=this.provider)?void 0:n.connection)?void 0:r.socket)||i.once("ping",(()=>{this.resetPingTimeout()}))),this.resetPingTimeout()}catch(Hu){this.logger.warn(Hu)}}isConnectionStalled(e){return this.staleConnectionErrors.some((t=>e.includes(t)))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new dm(new pm(Wh({sdkVersion:Lm,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||0===n.length)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!(await this.subscriber.isSubscribed(t)))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const r=this.messages.has(t,n);return r&&this.logger.debug(`Ignoring duplicate message: ${n}`),r}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),am(e)){if(!e.method.endsWith("_subscription"))return;const t=e.params,{topic:n,message:r,publishedAt:i,attestation:o}=t.data,s={topic:n,message:r,publishedAt:i,transportType:Dm.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Vv({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}else cm(e)&&this.events.emit(Cm,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(_m,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=$g(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Om,this.onPayloadHandler),this.provider.off(Rm,this.onConnectHandler),this.provider.off(Nm,this.onDisconnectHandler),this.provider.off(Bm,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Dg();Ug((async t=>{e!==t&&(e=t,t?await this.restartTransport().catch((e=>this.logger.error(e))):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}))}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(km),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout((async()=>{await this.transportOpen().catch((e=>this.logger.error(e)))}),(0,qu.toMiliseconds)(.1))))}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.connected&&(clearInterval(t),e())}),this.connectionStatusPollingInterval)})),await this.transportOpen())}}var zv=Object.defineProperty,Hv=Object.getOwnPropertySymbols,Wv=Object.prototype.hasOwnProperty,Gv=Object.prototype.propertyIsEnumerable,Zv=(e,t,n)=>t in e?zv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kv=(e,t)=>{for(var n in t||(t={}))Wv.call(t,n)&&Zv(e,n,t[n]);if(Hv)for(var n of Hv(t))Gv.call(t,n)&&Zv(e,n,t[n]);return e};class Xv extends class{constructor(e,t,n,r){this.core=e,this.logger=t,this.name=n}}{constructor(e,t,n,r="wc@2:core:",i){super(e,t,n,r),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ym,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!xg(e)?this.map.set(this.getKey(e),e):function(e){var t;return null==(t=e?.proposer)?void 0:t.publicKey}(e)?this.map.set(e.id,e):function(e){return e?.topic}(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((n=>mm()(t[n],e[n]))))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const n=Kv(Kv({},this.getData(e)),t);this.map.set(e,n),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())},this.logger=Zl(t,this.name),this.storagePrefix=r,this.getKey=i}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:t}=bg("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=bg("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Yv{constructor(e,t){this.core=e,this.logger=t,this.name="pairing",this.version="0.3",this.events=new(Bt()),this.initialized=!1,this.storagePrefix=ym,this.ignoredPayloadTypes=[1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async e=>{this.isInitialized();const t=Vp(),n=await this.core.crypto.setSymKey(t),r=$h(qu.FIVE_MINUTES),i={protocol:"irn"},o={topic:n,expiry:r,relay:i,active:!1,methods:e?.methods},s=dg({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:t,relay:i,expiryTimestamp:r,methods:e?.methods});return this.events.emit(Wm,o),this.core.expirer.set(n,r),await this.pairings.set(n,o),await this.core.relayer.subscribe(n,{transportType:e?.transportType}),{topic:n,uri:s}},this.pair=async e=>{this.isInitialized();const t=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:[ab]}});this.isValidPair(e,t);const{topic:n,symKey:r,relay:i,expiryTimestamp:o,methods:s}=ug(e.uri);let a;if(t.props.properties.topic=n,t.addTrace(cb),t.addTrace(ub),this.pairings.keys.includes(n)){if(a=this.pairings.get(n),t.addTrace(hb),a.active)throw t.setError(vb),new Error(`Pairing already exists: ${n}. Please try again with a new connection URI.`);t.addTrace(pb)}const c=o||$h(qu.FIVE_MINUTES),u={topic:n,relay:i,expiry:c,active:!1,methods:s};this.core.expirer.set(n,c),await this.pairings.set(n,u),t.addTrace(lb),e.activatePairing&&await this.activate({topic:n}),this.events.emit(Wm,u),t.addTrace(gb),this.core.crypto.keychain.has(n)||await this.core.crypto.setSymKey(r,n),t.addTrace(db);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{t.setError(bb)}try{await this.core.relayer.subscribe(n,{relay:i})}catch(Nl){throw t.setError(wb),Nl}return t.addTrace(fb),u},this.activate=async({topic:e})=>{this.isInitialized();const t=$h(qu.THIRTY_DAYS);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:n,resolve:r,reject:i}=Xh();this.events.once(tp("pairing_ping",e),(({error:e})=>{e?i(e):r()})),await n()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",yg("USER_DISCONNECTED")),await this.deletePairing(t))},this.formatUriFromPairing=e=>{this.isInitialized();const{topic:t,relay:n,expiry:r,methods:i}=e,o=this.core.crypto.keychain.get(t);return dg({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:o,relay:n,expiryTimestamp:r,methods:i})},this.sendRequest=async(e,t,n)=>{const r=Qg(t,n),i=await this.core.crypto.encode(e,r),o=Hm[t].req;return this.core.history.set(e,r),this.core.relayer.publish(e,i,o),r.id},this.sendResult=async(e,t,n)=>{const r=$g(e,n),i=await this.core.crypto.encode(t,r),o=await this.core.history.get(t,e),s=Hm[o.request.method].res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)},this.sendError=async(e,t,n)=>{const r=em(e,n),i=await this.core.crypto.encode(t,r),o=await this.core.history.get(t,e),s=Hm[o.request.method]?Hm[o.request.method].res:Hm.unregistered_method.res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,yg("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{const e=this.pairings.getAll().filter((e=>ep(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))},this.onRelayEventRequest=e=>{const{topic:t,payload:n}=e;switch(n.method){case"wc_pairingPing":return this.onPairingPingRequest(t,n);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,n);default:return this.onUnknownRpcMethodRequest(t,n)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:n}=e,r=(await this.core.history.get(t,n.id)).request.method;return"wc_pairingPing"===r?this.onPairingPingResponse(t,n):this.onUnknownRpcMethodResponse(r)},this.onPairingPingRequest=async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult(n,e,!0),this.events.emit(Km,{id:n,topic:e})}catch(Hu){await this.sendError(n,e,Hu),this.logger.error(Hu)}},this.onPairingPingResponse=(e,t)=>{const{id:n}=t;setTimeout((()=>{um(t)?this.events.emit(tp("pairing_ping",n),{}):lm(t)&&this.events.emit(tp("pairing_ping",n),{error:t.error})}),500)},this.onPairingDeleteRequest=async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(Zm,{id:n,topic:e})}catch(Hu){await this.sendError(n,e,Hu),this.logger.error(Hu)}},this.onUnknownRpcMethodRequest=async(e,t)=>{const{id:n,method:r}=t;try{if(this.registeredMethods.includes(r))return;const t=yg("WC_METHOD_UNSUPPORTED",r);await this.sendError(n,e,t),this.logger.error(t)}catch(i){await this.sendError(n,e,i),this.logger.error(i)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(yg("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=(e,t)=>{var n;if(!Pg(e)){const{message:n}=bg("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError(yb),new Error(n)}if(!function(e){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(Sg(e,!1))return!!t(e)||t(ap(e))}catch{}return!1}(e.uri)){const{message:n}=bg("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError(yb),new Error(n)}const r=ug(e?.uri);if(null==(n=r?.relay)||!n.protocol){const{message:e}=bg("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(yb),new Error(e)}if(null==r||!r.symKey){const{message:e}=bg("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(yb),new Error(e)}if(null!=r&&r.expiryTimestamp&&(0,qu.toMiliseconds)(r?.expiryTimestamp){if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!Sg(e,!1)){const{message:t}=bg("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=bg("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(ep(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=bg("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}},this.core=e,this.logger=Zl(t,this.name),this.pairings=new Xv(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Gl(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(_m,(async e=>{const{topic:t,message:n,transportType:r}=e;if(!this.pairings.keys.includes(t)||r===Dm.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(t,n);try{am(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):cm(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.core.history.delete(t,i.id))}catch(Hu){this.logger.error(Hu)}}))}registerExpirerEvents(){this.core.expirer.on(tb,(async e=>{const{topic:t}=Qh(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Gm,{topic:t}))}))}}class Jv extends Yl{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new Nt.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ym,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,n)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:n}),this.records.has(t.id))return;const r={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:n,expiry:$h(qu.THIRTY_DAYS)};this.records.set(r.id,r),this.persist(),this.events.emit(Xm,r)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=lm(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(Ym,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((n=>{if(n.topic===e){if(typeof t<"u"&&n.id!==t)return;this.records.delete(n.id),this.events.emit(Jm,n)}})),this.persist()},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=Zl(t,this.name)}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:Qg(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)})),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Qm)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=bg("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Xm,(e=>{const t=Xm;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(Ym,(e=>{const t=Ym;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(Jm,(e=>{const t=Jm;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.core.heartbeat.on(Gu,(()=>{this.cleanup()}))}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach((t=>{(0,qu.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(Jm,t,!1),e=!0)})),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Qv extends ed{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new Nt.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ym,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}},this.set=(e,t)=>{this.isInitialized();const n=this.formatTarget(e),r={target:n,expiry:t};this.expirations.set(n,r),this.checkExpiry(n,r),this.events.emit($m,{target:n,expiration:r})},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),n=this.getExpiration(t);this.expirations.delete(t),this.events.emit(eb,{target:t,expiration:n})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=Zl(t,this.name)}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return function(e){return Jh("topic",e)}(e);if("number"==typeof e)return function(e){return Jh("id",e)}(e);const{message:t}=bg("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(nb)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=bg("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:n}=t;(0,qu.toMiliseconds)(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(tb,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(Gu,(()=>this.checkExpirations())),this.events.on($m,(e=>{const t=$m;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(tb,(e=>{const t=tb;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(eb,(e=>{const t=eb;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class $v extends class{constructor(e,t,n){this.core=e,this.logger=t,this.store=n}}{constructor(e,t,n){super(e,t,n),this.core=e,this.logger=t,this.store=n,this.name="verify-api",this.verifyUrlV3=ob,this.storagePrefix=ym,this.version=2,this.init=async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,qu.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt){if(!Vh()||this.isDevEnv)return;const t=window.location.origin,{id:n,decryptedId:r}=e,i=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${n}&decryptedId=${r}`;try{const e=(0,ih.getDocument)(),t=this.startAbortTimer(5*qu.ONE_SECOND),r=await new Promise(((r,o)=>{const s=()=>{window.removeEventListener("message",c),e.body.removeChild(a),o("attestation aborted")};this.abortController.signal.addEventListener("abort",s);const a=e.createElement("iframe");a.src=i,a.style.display="none",a.addEventListener("error",s,{signal:this.abortController.signal});const c=i=>{if(i.data&&"string"==typeof i.data)try{const o=JSON.parse(i.data);if("verify_attestation"===o.type){if(qf(o.attestation).payload.id!==n)return;clearInterval(t),e.body.removeChild(a),this.abortController.signal.removeEventListener("abort",s),window.removeEventListener("message",c),r(null===o.attestation?"":o.attestation)}}catch(o){this.logger.warn(o)}};e.body.appendChild(a),window.addEventListener("message",c,{signal:this.abortController.signal})}));return this.logger.debug("jwt attestation",r),r}catch(o){this.logger.warn(o)}return""},this.resolve=async e=>{if(this.isDevEnv)return"";const{attestationId:t,hash:n,encryptedId:r}=e;if(""===t)return void this.logger.debug("resolve: attestationId is empty, skipping");if(t){if(qf(t).payload.id!==r)return;const e=await this.isValidJwtAttestation(t);if(e)return e.isVerified?e:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!n)return;const i=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(n,i)},this.fetchAttestation=async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);const n=this.startAbortTimer(5*qu.ONE_SECOND),r=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(n),200===r.status?await r.json():void 0},this.getVerifyUrl=e=>{let t=e||ib;return sb.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${ib}`),t=ib),t},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const e=this.startAbortTimer(qu.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}},this.persistPublicKey=async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async e=>{const t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(r){this.logger.error(r),this.logger.warn("error validating attestation")}const n=await this.fetchAndPersistPublicKey();try{if(n)return this.validateAttestation(e,n)}catch(r){this.logger.error(r),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise((async e=>{const t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))}));const e=await this.fetchPromise;return this.fetchPromise=void 0,e},this.validateAttestation=(e,t)=>{const n=Jp(e,t.publicKey),r={hasExpired:(0,qu.toMiliseconds)(n.exp)this.abortController.abort()),(0,qu.toMiliseconds)(e))}}class ew extends class{constructor(e,t){this.projectId=e,this.logger=t}}{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context="echo",this.registerDeviceToken=async e=>{const{clientId:t,token:n,notificationType:r,enableEncrypted:i=!1}=e,o=`https://echo.walletconnect.com/${this.projectId}/clients`;await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:r,token:n,always_raw:i})})},this.logger=Zl(t,this.context)}}var tw=Object.defineProperty,nw=Object.getOwnPropertySymbols,rw=Object.prototype.hasOwnProperty,iw=Object.prototype.propertyIsEnumerable,ow=(e,t,n)=>t in e?tw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sw=(e,t)=>{for(var n in t||(t={}))rw.call(t,n)&&ow(e,n,t[n]);if(nw)for(var n of nw(t))iw.call(t,n)&&ow(e,n,t[n]);return e};class aw extends class{constructor(e,t,n){this.core=e,this.logger=t,this.telemetryEnabled=n}}{constructor(e,t,n=!0){super(e,t,n),this.core=e,this.logger=t,this.context="event-client",this.storagePrefix=ym,this.storageVersion=.1,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!sp())try{const e={eventId:op(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Hh(this.core.relayer.protocol,this.core.relayer.version,Lm)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}},this.createEvent=e=>{const{event:t="ERROR",type:n="",properties:{topic:r,trace:i}}=e,o=op(),s=this.core.projectId||"",a=Date.now(),c=sw({eventId:o,timestamp:a,props:{event:t,type:n,properties:{topic:r,trace:i}},bundleId:s,domain:this.getAppDomain()},this.setMethods(o));return this.telemetryEnabled&&(this.events.set(o,c),this.shouldPersist=!0),c},this.getEvent=e=>{const{eventId:t,topic:n}=e;if(t)return this.events.get(t);const r=Array.from(this.events.values()).find((e=>e.props.properties.topic===n));return r?sw(sw({},r),this.setMethods(r.eventId)):void 0},this.deleteEvent=e=>{const{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Gu,(async()=>{this.shouldPersist&&await this.persist(),this.events.forEach((e=>{(0,qu.fromMiliseconds)(Date.now())-(0,qu.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)}))}))},this.setMethods=e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)}),this.addTrace=(e,t)=>{const n=this.events.get(e);n&&(n.props.properties.trace.push(t),this.events.set(e,n),this.shouldPersist=!0)},this.setError=(e,t)=>{const n=this.events.get(e);n&&(n.props.type=t,n.timestamp=Date.now(),this.events.set(e,n),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach((e=>{this.events.set(e.eventId,sw(sw({},e),this.setMethods(e.eventId)))}))}catch(e){this.logger.warn(e)}},this.submit=async()=>{if(!this.telemetryEnabled||0===this.events.size)return;const e=[];for(const[n,r]of this.events)r.props.type&&e.push(r);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(const t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(t){this.logger.warn(t)}},this.sendEvent=async e=>{const t=this.getAppDomain()?"":"&sp=desktop";return await fetch(`https://pulse.walletconnect.org/batch?projectId=${this.core.projectId}&st=events_sdk&sv=js-2.17.1${t}`,{method:"POST",body:JSON.stringify(e)})},this.getAppDomain=()=>zh().url,this.logger=Zl(t,this.context),this.telemetryEnabled=n,n?this.restore().then((async()=>{await this.submit(),this.setEventListeners()})):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var cw=Object.defineProperty,uw=Object.getOwnPropertySymbols,lw=Object.prototype.hasOwnProperty,dw=Object.prototype.propertyIsEnumerable,fw=(e,t,n)=>t in e?cw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hw=(e,t)=>{for(var n in t||(t={}))lw.call(t,n)&&fw(e,n,t[n]);if(uw)for(var n of uw(t))dw.call(t,n)&&fw(e,n,t[n]);return e};class pw extends Xl{constructor(e){var t;super(e),this.protocol="wc",this.version=2,this.name=bm,this.events=new Nt.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.dispatchEnvelope=({topic:e,message:t,sessionExists:n})=>{if(!e||!t)return;const r={topic:e,message:t,publishedAt:Date.now(),transportType:Dm.link_mode};this.relayer.onLinkMessageEvent(r,{sessionExists:n})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Em,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=Wl({level:"string"==typeof e?.logger&&e.logger?e.logger:vm}),{logger:r,chunkLoggerController:i}=Kl({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=i,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Zl(r,this.name),this.heartbeat=new Zu,this.crypto=new Sv(this,this.logger,e?.keychain),this.history=new Jv(this,this.logger),this.expirer=new Qv(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new Cl(hw(hw({},wm),e?.storageOptions)),this.relayer=new qv({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Yv(this,this.logger),this.verify=new $v(this,this.logger,this.storage),this.echoClient=new ew(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new aw(this,this.logger,e?.telemetryEnabled)}static async init(e){const t=new pw(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",n),t}get context(){return Gl(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Um,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Um)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const gw=pw,mw="client",bw="wc@2:client:",yw=mw,vw="error",ww="WALLETCONNECT_DEEPLINK_CHOICE",xw="Proposal expired",Sw=qu.SEVEN_DAYS,Aw={wc_sessionPropose:{req:{ttl:qu.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1104},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1106},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:qu.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:qu.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1112},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1114},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:qu.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:qu.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1119}}},Ew={min:qu.FIVE_MINUTES,max:qu.SEVEN_DAYS},_w="IDLE",Cw="ACTIVE",Iw=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],kw="wc@1.5:auth:",Tw="wc@1.5:auth::PUB_KEY";var Mw=Object.defineProperty,Pw=Object.defineProperties,Ow=Object.getOwnPropertyDescriptors,Rw=Object.getOwnPropertySymbols,Nw=Object.prototype.hasOwnProperty,Bw=Object.prototype.propertyIsEnumerable,Lw=(e,t,n)=>t in e?Mw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dw=(e,t)=>{for(var n in t||(t={}))Nw.call(t,n)&&Lw(e,n,t[n]);if(Rw)for(var n of Rw(t))Bw.call(t,n)&&Lw(e,n,t[n]);return e},Uw=(e,t)=>Pw(e,Ow(t));class jw extends class{constructor(e){this.client=e}}{constructor(e){super(e),this.name="engine",this.events=new(Bt()),this.initialized=!1,this.requestQueue={state:_w,queue:[]},this.sessionRequestQueue={state:_w,queue:[]},this.requestQueueDelay=qu.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Aw)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),(0,qu.toMiliseconds)(this.requestQueueDelay)))},this.connect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const t=Uw(Dw({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:n,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:o,relays:s}=t;let a,c=n,u=!1;try{c&&(u=this.client.core.pairing.pairings.get(c).active)}catch(y){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),y}if(!c||!u){const{topic:e,uri:t}=await this.client.core.pairing.create();c=e,a=t}if(!c){const{message:e}=bg("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(e)}const l=await this.client.core.crypto.generateKeyPair(),d=Aw.wc_sessionPropose.req.ttl||qu.FIVE_MINUTES,f=$h(d),h=Dw({requiredNamespaces:r,optionalNamespaces:i,relays:s??[{protocol:"irn"}],proposer:{publicKey:l,metadata:this.client.metadata},expiryTimestamp:f,pairingTopic:c},o&&{sessionProperties:o}),{reject:p,resolve:g,done:m}=Xh(d,xw);this.events.once(tp("session_connect"),(async({error:e,session:t})=>{if(e)p(e);else if(t){t.self.publicKey=l;const e=Uw(Dw({},t),{pairingTopic:h.pairingTopic,requiredNamespaces:h.requiredNamespaces,optionalNamespaces:h.optionalNamespaces,transportType:Dm.relay});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:t.peer.metadata}),this.cleanupDuplicatePairings(e),g(e)}}));const b=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:h,throwOnFailedPublish:!0});return await this.setProposal(b,Dw({id:b},h)),{uri:a,approval:m}},this.pair=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(aM){throw this.client.logger.error("pair() failed"),aM}},this.approve=async e=>{var t,n,r;const i=this.client.core.eventClient.createEvent({properties:{topic:null==(t=e?.id)?void 0:t.toString(),trace:[Ab]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(S){throw i.setError(Ob),S}try{await this.isValidProposalId(e?.id)}catch(S){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),i.setError(Ub),S}try{await this.isValidApprove(e)}catch(S){throw this.client.logger.error("approve() -> isValidApprove() failed"),i.setError(Db),S}const{id:o,relayProtocol:s,namespaces:a,sessionProperties:c,sessionConfig:u}=e,l=this.client.proposal.get(o);this.client.core.eventClient.deleteEvent({eventId:i.eventId});const{pairingTopic:d,proposer:f,requiredNamespaces:h,optionalNamespaces:p}=l;let g=null==(n=this.client.core.eventClient)?void 0:n.getEvent({topic:d});g||(g=null==(r=this.client.core.eventClient)?void 0:r.createEvent({type:Ab,properties:{topic:d,trace:[Ab,Eb]}}));const m=await this.client.core.crypto.generateKeyPair(),b=f.publicKey,y=await this.client.core.crypto.generateSharedKey(m,b),v=Dw(Dw({relay:{protocol:s??"irn"},namespaces:a,controller:{publicKey:m,metadata:this.client.metadata},expiry:$h(Sw)},c&&{sessionProperties:c}),u&&{sessionConfig:u}),w=Dm.relay;g.addTrace(_b);try{await this.client.core.relayer.subscribe(y,{transportType:w})}catch(S){throw g.setError(Nb),S}g.addTrace(Cb);const x=Uw(Dw({},v),{topic:y,requiredNamespaces:h,optionalNamespaces:p,pairingTopic:d,acknowledged:!1,self:v.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:m,transportType:Dm.relay});await this.client.session.set(y,x),g.addTrace(Tb);try{g.addTrace(Mb),await this.sendRequest({topic:y,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch((e=>{throw g?.setError(Lb),e})),g.addTrace(Pb),g.addTrace(Ib),await this.sendResult({id:o,topic:d,result:{relay:{protocol:s??"irn"},responderPublicKey:m},throwOnFailedPublish:!0}).catch((e=>{throw g?.setError(Bb),e})),g.addTrace(kb)}catch(S){throw this.client.logger.error(S),this.client.session.delete(y,yg("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(y),S}return this.client.core.eventClient.deleteEvent({eventId:g.eventId}),await this.client.core.pairing.updateMetadata({topic:d,metadata:f.metadata}),await this.client.proposal.delete(o,yg("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:d}),await this.setExpiry(y,$h(Sw)),{topic:y,acknowledged:()=>Promise.resolve(this.client.session.get(y))}},this.reject=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(i){throw this.client.logger.error("reject() -> isValidReject() failed"),i}const{id:t,reason:n}=e;let r;try{r=this.client.proposal.get(t).pairingTopic}catch(i){throw this.client.logger.error(`reject() -> proposal.get(${t}) failed`),i}r&&(await this.sendError({id:t,topic:r,error:n,rpcOpts:Aw.wc_sessionPropose.reject}),await this.client.proposal.delete(t,yg("USER_DISCONNECTED")))},this.update=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(jl){throw this.client.logger.error("update() -> isValidUpdate() failed"),jl}const{topic:t,namespaces:n}=e,{done:r,resolve:i,reject:o}=Xh(),s=Yg(),a=Jg().toString(),c=this.client.session.get(t).namespaces;return this.events.once(tp("session_update",s),(({error:e})=>{e?o(e):i()})),await this.client.session.update(t,{namespaces:n}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:a}).catch((e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),o(e)})),{acknowledged:r}},this.extend=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(s){throw this.client.logger.error("extend() -> isValidExtend() failed"),s}const{topic:t}=e,n=Yg(),{done:r,resolve:i,reject:o}=Xh();return this.events.once(tp("session_extend",n),(({error:e})=>{e?o(e):i()})),await this.setExpiry(t,$h(Sw)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch((e=>{o(e)})),{acknowledged:r}},this.request=async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(f){throw this.client.logger.error("request() -> isValidRequest() failed"),f}const{chainId:t,request:n,topic:r,expiry:i=Aw.wc_sessionRequest.req.ttl}=e,o=this.client.session.get(r);o?.transportType===Dm.relay&&await this.confirmOnlineStateOrThrow();const s=Yg(),a=Jg().toString(),{done:c,resolve:u,reject:l}=Xh(i,"Request expired. Please try again.");this.events.once(tp("session_request",s),(({error:e,result:t})=>{e?l(e):u(t)}));const d=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);return d?(await this.sendRequest({clientRpcId:s,relayRpcId:a,topic:r,method:"wc_sessionRequest",params:{request:Uw(Dw({},n),{expiryTimestamp:$h(i)}),chainId:t},expiry:i,throwOnFailedPublish:!0,appLink:d}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:r,request:n,chainId:t,id:s}),await c()):await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:s,relayRpcId:a,topic:r,method:"wc_sessionRequest",params:{request:Uw(Dw({},n),{expiryTimestamp:$h(i)}),chainId:t},expiry:i,throwOnFailedPublish:!0}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:r,request:n,chainId:t,id:s}),e()})),new Promise((async e=>{var t;if(null==(t=o.sessionConfig)||!t.disableDeepLink){const e=await async function(e,t){let n="";try{if(Vh()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(i){console.error(i)}return n}(this.client.core.storage,ww);await rp({id:s,topic:r,wcDeepLink:e})}e()})),c()]).then((e=>e[2]))},this.respond=async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:n}=e,{id:r}=n,i=this.client.session.get(t);i.transportType===Dm.relay&&await this.confirmOnlineStateOrThrow();const o=this.getAppLinkIfEnabled(i.peer.metadata,i.transportType);um(n)?await this.sendResult({id:r,topic:t,result:n.result,throwOnFailedPublish:!0,appLink:o}):lm(n)&&await this.sendError({id:r,topic:t,error:n.error,appLink:o}),this.cleanupAfterResponse(e)},this.ping=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(Wu){throw this.client.logger.error("ping() -> isValidPing() failed"),Wu}const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=Yg(),n=Jg().toString(),{done:r,resolve:i,reject:o}=Xh();this.events.once(tp("session_ping",e),(({error:e})=>{e?o(e):i()})),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:n}),r()])}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:t,event:n,chainId:r}=e,i=Jg().toString();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:n,chainId:r},throwOnFailedPublish:!0,relayRpcId:i})},this.disconnect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:yg("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else{if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=bg("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw new Error(e)}await this.client.core.pairing.disconnect({topic:t})}},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>function(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),i=Object.keys(n);let o=!0;return!!Gh(i,r)&&(r.forEach((t=>{const{accounts:r,methods:i,events:s}=e.namespaces[t],a=hg(r),c=n[t];(!Gh(Ih(t,c),a)||!Gh(c.methods,i)||!Gh(c.events,s))&&(o=!1)})),o)}(t,e)))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(e,t)=>{var n;this.isInitialized(),this.isValidAuthenticate(e);const r=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(n=this.client.metadata.redirect)?void 0:n.linkMode),i=r?Dm.link_mode:Dm.relay;i===Dm.relay&&await this.confirmOnlineStateOrThrow();const{chains:o,statement:s="",uri:a,domain:c,nonce:u,type:l,exp:d,nbf:f,methods:h=[],expiry:p}=e,g=[...e.resources||[]],{topic:m,uri:b}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:i});this.client.logger.info({message:"Generated new pairing",pairing:{topic:m,uri:b}});const y=await this.client.core.crypto.generateKeyPair(),v=qp(y);if(await Promise.all([this.client.auth.authKeys.set(Tw,{responseTopic:v,publicKey:y}),this.client.auth.pairingTopics.set(v,{topic:v,pairingTopic:m})]),await this.client.core.relayer.subscribe(v,{transportType:i}),this.client.logger.info(`sending request to new pairing topic: ${m}`),h.length>0){const{namespace:e}=Ch(o[0]);let t=Tp(e,"request",h);Bp(g)&&(t=Pp(t,g.pop())),g.push(t)}const w=p&&p>Aw.wc_sessionAuthenticate.req.ttl?p:Aw.wc_sessionAuthenticate.req.ttl,x={authPayload:{type:l??"caip122",chains:o,statement:s,aud:a,domain:c,version:"1",nonce:u,iat:(new Date).toISOString(),exp:d,nbf:f,resources:g},requester:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:$h(w)},S={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:o,methods:[...new Set(["personal_sign",...h])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:m,proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:$h(Aw.wc_sessionPropose.req.ttl)},{done:A,resolve:E,reject:_}=Xh(w,"Request expired"),C=async({error:e,session:t})=>{if(this.events.off(tp("session_request",k),I),e)_(e);else if(t){t.self.publicKey=y,await this.client.session.set(t.topic,t),await this.setExpiry(t.topic,t.expiry),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:t.peer.metadata});const e=this.client.session.get(t.topic);await this.deleteProposal(T),E({session:e})}},I=async e=>{var n,r,o;if(await this.deletePendingAuthRequest(k,{message:"fulfilled",code:0}),e.error){const t=yg("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(tp("session_connect"),C),_(e.error.message))}await this.deleteProposal(T),this.events.off(tp("session_connect"),C);const{cacaos:s,responder:a}=e.result,c=[],u=[];for(const t of s){await Ap({cacao:t,projectId:this.client.core.projectId})||(this.client.logger.error(t,"Signature verification failed"),_(yg("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:e}=t,n=Bp(e.resources),r=[xp(e.iss)],i=Sp(e.iss);if(n){const e=Rp(n),t=Np(n);c.push(...e),r.push(...t)}for(const t of r)u.push(`${t}:${i}`)}const l=await this.client.core.crypto.generateSharedKey(y,a.publicKey);let d;c.length>0&&(d={topic:l,acknowledged:!0,self:{publicKey:y,metadata:this.client.metadata},peer:a,controller:a.publicKey,expiry:$h(Sw),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:m,namespaces:pg([...new Set(c)],[...new Set(u)]),transportType:i},await this.client.core.relayer.subscribe(l,{transportType:i}),await this.client.session.set(l,d),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:a.metadata}),d=this.client.session.get(l)),null!=(n=this.client.metadata.redirect)&&n.linkMode&&null!=(r=a.metadata.redirect)&&r.linkMode&&null!=(o=a.metadata.redirect)&&o.universal&&t&&(this.client.core.addLinkModeSupportedApp(a.metadata.redirect.universal),this.client.session.update(l,{transportType:Dm.link_mode})),E({auths:s,session:d})},k=Yg(),T=Yg();let M;this.events.once(tp("session_connect"),C),this.events.once(tp("session_request",k),I);try{if(r){const e=Qg("wc_sessionAuthenticate",x,k);this.client.core.history.set(m,e);const n=await this.client.core.crypto.encode("",e,{type:2,encoding:jp});M=fg(t,m,n)}else await Promise.all([this.sendRequest({topic:m,method:"wc_sessionAuthenticate",params:x,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:k}),this.sendRequest({topic:m,method:"wc_sessionPropose",params:S,expiry:Aw.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:T})])}catch(P){throw this.events.off(tp("session_connect"),C),this.events.off(tp("session_request",k),I),P}return await this.setProposal(T,Dw({id:T},S)),await this.setAuthRequest(k,{request:Uw(Dw({},x),{verifyContext:{}}),pairingTopic:m,transportType:i}),{uri:M??b,response:A}},this.approveSessionAuthenticate=async e=>{const{id:t,auths:n}=e,r=this.client.core.eventClient.createEvent({properties:{topic:t.toString(),trace:[jb]}});try{this.isInitialized()}catch(p){throw r.setError(Gb),p}const i=this.getPendingAuthRequest(t);if(!i)throw r.setError(Yb),new Error(`Could not find pending auth request with id ${t}`);const o=i.transportType||Dm.relay;o===Dm.relay&&await this.confirmOnlineStateOrThrow();const s=i.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=qp(s),u={type:1,receiverPublicKey:s,senderPublicKey:a},l=[],d=[];for(const g of n){if(!(await Ap({cacao:g,projectId:this.client.core.projectId}))){r.setError(Zb);const e=yg("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:t,topic:c,error:e,encodeOpts:u}),new Error(e.message)}r.addTrace(Vb);const{p:e}=g,n=Bp(e.resources),i=[xp(e.iss)],o=Sp(e.iss);if(n){const e=Rp(n),t=Np(n);l.push(...e),i.push(...t)}for(const t of i)d.push(`${t}:${o}`)}const f=await this.client.core.crypto.generateSharedKey(a,s);let h;if(r.addTrace(Fb),l?.length>0){h={topic:f,acknowledged:!0,self:{publicKey:a,metadata:this.client.metadata},peer:{publicKey:s,metadata:i.requester.metadata},controller:s,expiry:$h(Sw),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:i.pairingTopic,namespaces:pg([...new Set(l)],[...new Set(d)]),transportType:o},r.addTrace(zb);try{await this.client.core.relayer.subscribe(f,{transportType:o})}catch(p){throw r.setError(Kb),p}r.addTrace(Hb),await this.client.session.set(f,h),r.addTrace(qb),await this.client.core.pairing.updateMetadata({topic:i.pairingTopic,metadata:i.requester.metadata})}r.addTrace(Wb);try{await this.sendResult({topic:c,id:t,result:{cacaos:n,responder:{publicKey:a,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(i.requester.metadata,o)})}catch(p){throw r.setError(Xb),p}return await this.client.auth.requests.delete(t,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:i.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:r.eventId}),{session:h}},this.rejectSessionAuthenticate=async e=>{this.isInitialized();const{id:t,reason:n}=e,r=this.getPendingAuthRequest(t);if(!r)throw new Error(`Could not find pending auth request with id ${t}`);r.transportType===Dm.relay&&await this.confirmOnlineStateOrThrow();const i=r.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),s=qp(i),a={type:1,receiverPublicKey:i,senderPublicKey:o};await this.sendError({id:t,topic:s,error:n,encodeOpts:a,rpcOpts:Aw.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(r.requester.metadata,r.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,yg("USER_DISCONNECTED"))},this.formatAuthMessage=e=>{this.isInitialized();const{request:t,iss:n}=e;return Ep(t,n)},this.processRelayMessageCache=()=>{setTimeout((async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}}),50)},this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter((n=>{var r,i;return(null==(r=n.peerMetadata)?void 0:r.url)&&(null==(i=n.peerMetadata)?void 0:i.url)===e.peer.metadata.url&&n.topic&&n.topic!==t.topic}));if(0===n.length)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(aM){this.client.logger.error(aM)}},this.deleteSession=async e=>{var t;const{topic:n,expirerHasDeleted:r=!1,emitEvent:i=!0,id:o=0}=e,{self:s}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,yg("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(s.publicKey)&&await this.client.core.crypto.deleteKeyPair(s.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),r||this.client.core.expirer.del(n),this.client.core.storage.removeItem(ww).catch((e=>this.client.logger.warn(e))),this.getPendingSessionRequests().forEach((e=>{e.topic===n&&this.deletePendingSessionRequest(e.id,yg("USER_DISCONNECTED"))})),n===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=_w),i&&this.client.events.emit("session_delete",{id:o,topic:n})},this.deleteProposal=async(e,t)=>{if(t)try{const t=this.client.proposal.get(e);this.client.core.eventClient.getEvent({topic:t.pairingTopic})?.setError(Rb)}catch{}await Promise.all([this.client.proposal.delete(e,yg("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")},this.deletePendingSessionRequest=async(e,t,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),n&&(this.sessionRequestQueue.state=_w,this.client.events.emit("session_request_expire",{id:e}))},this.deletePendingAuthRequest=async(e,t,n=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),n?Promise.resolve():this.client.core.expirer.del(e)])},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))},this.setProposal=async(e,t)=>{this.client.core.expirer.set(e,$h(Aw.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)},this.setAuthRequest=async(e,t)=>{const{request:n,pairingTopic:r,transportType:i=Dm.relay}=t;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:r,verifyContext:n.verifyContext,transportType:i})},this.setPendingSessionRequest=async e=>{const{id:t,topic:n,params:r,verifyContext:i}=e,o=r.request.expiryTimestamp||$h(Aw.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,o),await this.client.pendingRequest.set(t,{id:t,topic:n,params:r,verifyContext:i})},this.sendRequest=async e=>{const{topic:t,method:r,params:i,expiry:o,relayRpcId:s,clientRpcId:a,throwOnFailedPublish:c,appLink:u}=e,l=Qg(r,i,a);let d;const f=!!u;try{const e=f?jp:Up;d=await this.client.core.crypto.encode(t,l,{encoding:e})}catch(g){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t} failed`),g}let h;if(Iw.includes(r)){const e=zp(JSON.stringify(l)),t=zp(d);h=await this.client.core.verify.register({id:t,decryptedId:e})}const p=Aw[r].req;if(p.attestation=h,o&&(p.ttl=o),s&&(p.id=s),this.client.core.history.set(t,l),f){const e=fg(u,t,d);await n.g.Linking.openURL(e,this.client.name)}else{const e=Aw[r].req;o&&(e.ttl=o),s&&(e.id=s),c?(e.internal=Uw(Dw({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,d,e)):this.client.core.relayer.publish(t,d,e).catch((e=>this.client.logger.error(e)))}return l.id},this.sendResult=async e=>{const{id:t,topic:r,result:i,throwOnFailedPublish:o,encodeOpts:s,appLink:a}=e,c=$g(t,i);let u;const l=a&&typeof(null==n.g?void 0:n.g.Linking)<"u";try{const e=l?jp:Up;u=await this.client.core.crypto.encode(r,c,Uw(Dw({},s||{}),{encoding:e}))}catch(xl){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),xl}let d;try{d=await this.client.core.history.get(r,t)}catch(xl){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${t}) failed`),xl}if(l){const e=fg(a,r,u);await n.g.Linking.openURL(e,this.client.name)}else{const e=Aw[d.request.method].res;o?(e.internal=Uw(Dw({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,u,e)):this.client.core.relayer.publish(r,u,e).catch((e=>this.client.logger.error(e)))}await this.client.core.history.resolve(c)},this.sendError=async e=>{const{id:t,topic:r,error:i,encodeOpts:o,rpcOpts:s,appLink:a}=e,c=em(t,i);let u;const l=a&&typeof(null==n.g?void 0:n.g.Linking)<"u";try{const e=l?jp:Up;u=await this.client.core.crypto.encode(r,c,Uw(Dw({},o||{}),{encoding:e}))}catch(xl){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),xl}let d;try{d=await this.client.core.history.get(r,t)}catch(xl){throw this.client.logger.error(`sendError() -> history.get(${r}, ${t}) failed`),xl}if(l){const e=fg(a,r,u);await n.g.Linking.openURL(e,this.client.name)}else{const e=s||Aw[d.request.method].res;this.client.core.relayer.publish(r,u,e)}await this.client.core.history.resolve(c)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{let n=!1;ep(t.expiry)&&(n=!0),this.client.core.crypto.keychain.has(t.topic)||(n=!0),n&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{ep(e.expiryTimestamp)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession({topic:e}))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==Cw){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Cw;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(aM){this.client.logger.warn(aM)}}this.requestQueue.state=_w}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=async e=>{const{topic:t,payload:n,attestation:r,transportType:i,encryptedId:o}=e,s=n.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:s}))switch(s){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:t,payload:n,attestation:r,encryptedId:o});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,n);case"wc_sessionPing":return await this.onSessionPingRequest(t,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:n,attestation:r,encryptedId:o,transportType:i});case"wc_sessionEvent":return await this.onSessionEventRequest(t,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:n,attestation:r,encryptedId:o,transportType:i});default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:n,transportType:r}=e,i=(await this.client.core.history.get(t,n.id)).request.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeResponse(t,n,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,n);case"wc_sessionExtend":return this.onSessionExtendResponse(t,n);case"wc_sessionPing":return this.onSessionPingResponse(t,n);case"wc_sessionRequest":return this.onSessionRequestResponse(t,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,n);default:return this.client.logger.info(`Unsupported response method ${i}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:n}=bg("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=e=>{const{topic:t,requestMethod:n}=e,r=this.expectedPairingMethodMap.get(t);return!(!r||r.includes(n))&&!!(r.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async e=>{const{topic:t,payload:n,attestation:r,encryptedId:i}=e,{params:o,id:s}=n;try{const e=this.client.core.eventClient.getEvent({topic:t});this.isValidConnect(Dw({},n.params));const a=o.expiryTimestamp||$h(Aw.wc_sessionPropose.req.ttl),c=Dw({id:s,pairingTopic:t,expiryTimestamp:a},o);await this.setProposal(s,c);const u=await this.getVerifyContext({attestationId:r,hash:zp(JSON.stringify(n)),encryptedId:i,metadata:c.proposer.metadata});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),e?.setError(Sb)),e?.addTrace(mb),this.client.events.emit("session_proposal",{id:s,params:c,verifyContext:u})}catch(a){await this.sendError({id:s,topic:t,error:a,rpcOpts:Aw.wc_sessionPropose.autoReject}),this.client.logger.error(a)}},this.onSessionProposeResponse=async(e,t,n)=>{const{id:r}=t;if(um(t)){const{result:i}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:i});const o=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const s=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:s});const a=i.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});const c=await this.client.core.crypto.generateSharedKey(s,a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});const u=await this.client.core.relayer.subscribe(c,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:e})}else if(lm(t)){await this.client.proposal.delete(r,yg("USER_DISCONNECTED"));const e=tp("session_connect");if(0===this.events.listenerCount(e))throw new Error(`emitting ${e} without any listeners, 954`);this.events.emit(tp("session_connect"),{error:t.error})}},this.onSessionSettleRequest=async(e,t)=>{const{id:n,params:r}=t;try{this.isValidSessionSettleRequest(r);const{relay:n,controller:i,expiry:o,namespaces:s,sessionProperties:a,sessionConfig:c}=t.params,u=Uw(Dw(Dw({topic:e,relay:n,expiry:o,namespaces:s,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:i.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:i.publicKey,metadata:i.metadata}},a&&{sessionProperties:a}),c&&{sessionConfig:c}),{transportType:Dm.relay}),l=tp("session_connect");if(0===this.events.listenerCount(l))throw new Error(`emitting ${l} without any listeners 997`);this.events.emit(tp("session_connect"),{session:u}),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.onSessionSettleResponse=async(e,t)=>{const{id:n}=t;um(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(tp("session_approve",n),{})):lm(t)&&(await this.client.session.delete(e,yg("USER_DISCONNECTED")),this.events.emit(tp("session_approve",n),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:n,id:r}=t;try{const t=`${e}_session_update`,o=Fg.get(t);if(o&&this.isRequestOutOfSync(o,r))return this.client.logger.info(`Discarding out of sync request - ${r}`),void this.sendError({id:r,topic:e,error:yg("INVALID_UPDATE_REQUEST")});this.isValidUpdate(Dw({topic:e},n));try{Fg.set(t,r),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0})}catch(i){throw Fg.delete(t),i}this.client.events.emit("session_update",{id:r,topic:e,params:n})}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:n}=t,r=tp("session_update",n);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);um(t)?this.events.emit(tp("session_update",n),{}):lm(t)&&this.events.emit(tp("session_update",n),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:n}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,$h(Sw)),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(r){await this.sendError({id:n,topic:e,error:r}),this.client.logger.error(r)}},this.onSessionExtendResponse=(e,t)=>{const{id:n}=t,r=tp("session_extend",n);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);um(t)?this.events.emit(tp("session_extend",n),{}):lm(t)&&this.events.emit(tp("session_extend",n),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(r){await this.sendError({id:n,topic:e,error:r}),this.client.logger.error(r)}},this.onSessionPingResponse=(e,t)=>{const{id:n}=t,r=tp("session_ping",n);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);setTimeout((()=>{um(t)?this.events.emit(tp("session_ping",n),{}):lm(t)&&this.events.emit(tp("session_ping",n),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise((t=>{this.client.core.relayer.once(Pm,(async()=>{t(await this.deleteSession({topic:e,id:n}))}))})),this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:yg("USER_DISCONNECTED")})]).catch((e=>this.client.logger.error(e)))}catch(r){this.client.logger.error(r)}},this.onSessionRequest=async e=>{var t,n,r;const{topic:i,payload:o,attestation:s,encryptedId:a,transportType:c}=e,{id:u,params:l}=o;try{await this.isValidRequest(Dw({topic:i},l));const e=this.client.session.get(i),o={id:u,topic:i,params:l,verifyContext:await this.getVerifyContext({attestationId:s,hash:zp(JSON.stringify(Qg("wc_sessionRequest",l,u))),encryptedId:a,metadata:e.peer.metadata,transportType:c})};await this.setPendingSessionRequest(o),c===Dm.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(n=e.peer.metadata.redirect)?void 0:n.universal),null!=(r=this.client.signConfig)&&r.disableRequestQueue?this.emitSessionRequest(o):(this.addSessionRequestToSessionRequestQueue(o),this.processSessionRequestQueue())}catch(xl){await this.sendError({id:u,topic:i,error:xl}),this.client.logger.error(xl)}},this.onSessionRequestResponse=(e,t)=>{const{id:n}=t,r=tp("session_request",n);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);um(t)?this.events.emit(tp("session_request",n),{result:t.result}):lm(t)&&this.events.emit(tp("session_request",n),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:n,params:r}=t;try{const t=`${e}_session_event_${r.event.name}`,i=Fg.get(t);if(i&&this.isRequestOutOfSync(i,n))return void this.client.logger.info(`Discarding out of sync request - ${n}`);this.isValidEmit(Dw({topic:e},r)),this.client.events.emit("session_event",{id:n,topic:e,params:r}),Fg.set(t,n)}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.onSessionAuthenticateResponse=(e,t)=>{const{id:n}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),um(t)?this.events.emit(tp("session_request",n),{result:t.result}):lm(t)&&this.events.emit(tp("session_request",n),{error:t.error})},this.onSessionAuthenticateRequest=async e=>{var t;const{topic:n,payload:r,attestation:i,encryptedId:o,transportType:s}=e;try{const{requester:e,authPayload:a,expiryTimestamp:c}=r.params,u=await this.getVerifyContext({attestationId:i,hash:zp(JSON.stringify(r)),encryptedId:o,metadata:e.metadata,transportType:s}),l={requester:e,pairingTopic:n,id:r.id,authPayload:a,verifyContext:u,expiryTimestamp:c};await this.setAuthRequest(r.id,{request:l,pairingTopic:n,transportType:s}),s===Dm.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:r.params,id:r.id,verifyContext:u})}catch(a){this.client.logger.error(a);const e=r.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),i=this.getAppLinkIfEnabled(r.params.requester.metadata,s),o={type:1,receiverPublicKey:e,senderPublicKey:t};await this.sendError({id:r.id,topic:n,error:a,encodeOpts:o,rpcOpts:Aw.wc_sessionAuthenticate.autoReject,appLink:i})}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=_w,this.processSessionRequestQueue()}),(0,qu.toMiliseconds)(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:e,error:t})=>{const n=this.client.core.history.pending;n.length>0&&n.filter((t=>t.topic===e&&"wc_sessionRequest"===t.request.method)).forEach((e=>{const n=tp("session_request",e.request.id);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);this.events.emit(tp("session_request",e.request.id),{error:t})}))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Cw)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=Cw,this.emitSessionRequest(e)}catch(aM){this.client.logger.error(aM)}else this.client.logger.info("session request queue is empty.")},this.emitSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onPairingCreated=e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest({topic:e.topic,payload:Qg("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id)})},this.isValidConnect=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:n,optionalNamespaces:r,sessionProperties:i,relays:o}=e;if(xg(t)||await this.isValidPairingTopic(t),!function(e,t){let n=!1;return t&&!e?n=!0:e&&vg(e)&&e.length&&e.forEach((e=>{n=Mg(e)})),n}(o,!0)){const{message:e}=bg("MISSING_OR_INVALID",`connect() relays: ${o}`);throw new Error(e)}!xg(n)&&0!==wg(n)&&this.validateNamespaces(n,"requiredNamespaces"),!xg(r)&&0!==wg(r)&&this.validateNamespaces(r,"optionalNamespaces"),xg(i)||this.validateSessionProps(i,"sessionProperties")},this.validateNamespaces=(e,t)=>{const n=function(e,t,n){let r=null;if(e&&wg(e)){const i=kg(e,t);i&&(r=i);const o=Cg(e,t,n);o&&(r=o)}else r=bg("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}(e,"connect()",t);if(n)throw new Error(n.message)},this.isValidApprove=async e=>{if(!Pg(e))throw new Error(bg("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:n,relayProtocol:r,sessionProperties:i}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);const o=this.client.proposal.get(t),s=Tg(n,"approve()");if(s)throw new Error(s.message);const a=Bg(o.requiredNamespaces,n,"approve()");if(a)throw new Error(a.message);if(!Sg(r,!0)){const{message:e}=bg("MISSING_OR_INVALID",`approve() relayProtocol: ${r}`);throw new Error(e)}xg(i)||this.validateSessionProps(i,"sessionProperties")},this.isValidReject=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:n}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!function(e){return!(!e||"object"!=typeof e||!e.code||!Ag(e.code,!1)||!e.message||!Sg(e.message,!1))}(n)){const{message:e}=bg("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:n,namespaces:r,expiry:i}=e;if(!Mg(t)){const{message:e}=bg("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const o=function(e,t){let n=null;return Sg(e?.publicKey,!1)||(n=bg("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}(n,"onSessionSettleRequest()");if(o)throw new Error(o.message);const s=Tg(r,"onSessionSettleRequest()");if(s)throw new Error(s.message);if(ep(i)){const{message:e}=bg("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:n}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const r=this.client.session.get(t),i=Tg(n,"update()");if(i)throw new Error(i.message);const o=Bg(r.requiredNamespaces,n,"update()");if(o)throw new Error(o.message)},this.isValidExtend=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:n,chainId:r,expiry:i}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!Og(o,r)){const{message:e}=bg("MISSING_OR_INVALID",`request() chainId: ${r}`);throw new Error(e)}if(!function(e){return!(xg(e)||!Sg(e.method,!1))}(n)){const{message:e}=bg("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(e)}if(!Rg(o,r,n.method)){const{message:e}=bg("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(e)}if(i&&!function(e,t){return Ag(e,!1)&&e<=t.max&&e>=t.min}(i,Ew)){const{message:e}=bg("MISSING_OR_INVALID",`request() expiry: ${i}. Expiry must be a number (in seconds) between ${Ew.min} and ${Ew.max}`);throw new Error(e)}},this.isValidRespond=async e=>{var t;if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:n,response:r}=e;try{await this.isValidSessionTopic(n)}catch(i){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),i}if(!function(e){return!(xg(e)||xg(e.result)&&xg(e.error)||!Ag(e.id,!1)||!Sg(e.jsonrpc,!1))}(r)){const{message:e}=bg("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:n,chainId:r}=e;await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!Og(i,r)){const{message:e}=bg("MISSING_OR_INVALID",`emit() chainId: ${r}`);throw new Error(e)}if(!function(e){return!(xg(e)||!Sg(e.name,!1))}(n)){const{message:e}=bg("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(e)}if(!Ng(i,r,n.name)){const{message:e}=bg("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidAuthenticate=e=>{const{chains:t,uri:n,domain:r,nonce:i}=e;if(!Array.isArray(t)||0===t.length)throw new Error("chains is required and must be a non-empty array");if(!Sg(n,!1))throw new Error("uri is required parameter");if(!Sg(r,!1))throw new Error("domain is required parameter");if(!Sg(i,!1))throw new Error("nonce is required parameter");if([...new Set(t.map((e=>Ch(e).namespace)))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:o}=Ch(t[0]);if("eip155"!==o)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async e=>{const{attestationId:t,hash:n,encryptedId:r,metadata:i,transportType:o}=e,s={verified:{verifyUrl:i.verifyUrl||ib,validation:"UNKNOWN",origin:i.url||""}};try{if(o===Dm.link_mode){const e=this.getAppLinkIfEnabled(i,o);return s.verified.validation=e&&new URL(e).origin===new URL(i.url).origin?"VALID":"INVALID",s}const e=await this.client.core.verify.resolve({attestationId:t,hash:n,encryptedId:r,verifyUrl:i.verifyUrl});e&&(s.verified.origin=e.origin,s.verified.isScam=e.isScam,s.verified.validation=e.origin===new URL(i.url).origin?"VALID":"INVALID")}catch(a){this.client.logger.warn(a)}return this.client.logger.debug(`Verify context: ${JSON.stringify(s)}`),s},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!Sg(e,!1)){const{message:n}=bg("MISSING_OR_INVALID",`${t} must be in Record format. Received: ${JSON.stringify(e)}`);throw new Error(n)}}))},this.getPendingAuthRequest=e=>{const t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0},this.addToRecentlyDeleted=(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0;const t=this.recentlyDeletedLimit/2;for(const n of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(n)}}},this.checkRecentlyDeleted=e=>{const t=this.recentlyDeletedMap.get(e);if(t){const{message:n}=bg("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw new Error(n)}},this.isLinkModeEnabled=(e,t)=>{var r,i,o,s,a,c,u,l,d;return!(!e||t!==Dm.link_mode)&&(!0===(null==(i=null==(r=this.client.metadata)?void 0:r.redirect)?void 0:i.linkMode)&&void 0!==(null==(s=null==(o=this.client.metadata)?void 0:o.redirect)?void 0:s.universal)&&""!==(null==(c=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:c.universal)&&void 0!==(null==(u=e?.redirect)?void 0:u.universal)&&""!==(null==(l=e?.redirect)?void 0:l.universal)&&!0===(null==(d=e?.redirect)?void 0:d.linkMode)&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(null==n.g?void 0:n.g.Linking)<"u")},this.getAppLinkIfEnabled=(e,t)=>{var n;return this.isLinkModeEnabled(e,t)?null==(n=e?.redirect)?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const t=ip(e,"topic")||"",n=decodeURIComponent(ip(e,"wc_ev")||""),r=this.client.session.keys.includes(t);r&&this.client.session.update(t,{transportType:Dm.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:n,sessionExists:r})},this.registerLinkModeListeners=async()=>{var e;if(sp()||Fh()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){const e=null==n.g?void 0:n.g.Linking;if(typeof e<"u"){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);const t=await e.getInitialURL();t&&setTimeout((()=>{this.handleLinkModeMessage({url:t})}),50)}}}}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(_m,(e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)}))}async onRelayMessage(e){const{topic:t,message:n,attestation:r,transportType:i}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Tw)?this.client.auth.authKeys.get(Tw):{responseTopic:void 0,publicKey:void 0},s=await this.client.core.crypto.decode(t,n,{receiverPublicKey:o,encoding:i===Dm.link_mode?jp:Up});try{am(s)?(this.client.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s,attestation:r,transportType:i,encryptedId:zp(n)})):cm(s)?(await this.client.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s,transportType:i}),this.client.core.history.delete(t,s.id)):this.onRelayEventUnknownPayload({topic:t,payload:s,transportType:i})}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(tb,(async e=>{const{topic:t,id:n}=Qh(e.target);return n&&this.client.pendingRequest.keys.includes(n)?await this.deletePendingSessionRequest(n,bg("EXPIRED"),!0):n&&this.client.auth.requests.keys.includes(n)?await this.deletePendingAuthRequest(n,bg("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n})))}))}registerPairingEvents(){this.client.core.pairing.events.on(Wm,(e=>this.onPairingCreated(e))),this.client.core.pairing.events.on(Zm,(e=>{this.addToRecentlyDeleted(e.topic,"pairing")}))}isValidPairingTopic(e){if(!Sg(e,!1)){const{message:t}=bg("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=bg("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(ep(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=bg("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!Sg(e,!1)){const{message:t}=bg("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=bg("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(ep(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=bg("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=bg("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(Sg(e,!1)){const{message:t}=bg("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=bg("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!function(e){return"number"==typeof e}(e)){const{message:t}=bg("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=bg("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(ep(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=bg("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Fw extends Xv{constructor(e,t){super(e,t,"proposal",bw),this.core=e,this.logger=t}}class Vw extends Xv{constructor(e,t){super(e,t,"session",bw),this.core=e,this.logger=t}}class qw extends Xv{constructor(e,t){super(e,t,"request",bw,(e=>e.id)),this.core=e,this.logger=t}}class zw extends Xv{constructor(e,t){super(e,t,"authKeys",kw,(()=>Tw)),this.core=e,this.logger=t}}class Hw extends Xv{constructor(e,t){super(e,t,"pairingTopics",kw),this.core=e,this.logger=t}}class Ww extends Xv{constructor(e,t){super(e,t,"requests",kw,(e=>e.id)),this.core=e,this.logger=t}}class Gw{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new zw(this.core,this.logger),this.pairingTopics=new Hw(this.core,this.logger),this.requests=new Ww(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class Zw extends class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=yw,this.events=new Nt.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.update=async e=>{try{return await this.engine.update(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.request=async e=>{try{return await this.engine.request(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.find=e=>{try{return this.engine.find(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(aM){throw this.logger.error(aM.message),aM}},this.authenticate=async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(n){throw this.logger.error(n.message),n}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.approveSessionAuthenticate=async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.rejectSessionAuthenticate=async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.name=e?.name||yw,this.metadata=e?.metadata||zh(),this.signConfig=e?.signConfig;const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:kl()(Wl({level:e?.logger||vw}));this.core=e?.core||new gw(e),this.logger=Zl(t,this.name),this.session=new Vw(this.core,this.logger),this.proposal=new Fw(this.core,this.logger),this.pendingRequest=new qw(this.core,this.logger),this.engine=new jw(this),this.auth=new Gw(this.core,this.logger)}static async init(e){const t=new Zw(e);return await t.initialize(),t}get context(){return Gl(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}function Kw(){return"undefined"!==typeof navigator&&/iPhone|iPod/.test(navigator.userAgent)||"undefined"!==typeof navigator&&/iPad/.test(navigator.userAgent)}function Xw(){return"undefined"!==typeof navigator&&/android/i.test(navigator.userAgent)||Kw()}let Yw=function(e){return e.FLOW_AUTHN="flow_authn",e.FLOW_PRE_AUTHZ="flow_pre_authz",e.FLOW_AUTHZ="flow_authz",e.FLOW_USER_SIGN="flow_user_sign",e}({}),Jw=function(e){return e.SESSION_REQUEST="session_proposal",e.SIGNING_REQUEST="signing_request",e}({});async function Qw(e){let{client:t,existingPairing:n}=e;const r=await ga(),i={flow:{methods:[Yw.FLOW_AUTHN,Yw.FLOW_PRE_AUTHZ,Yw.FLOW_AUTHZ,Yw.FLOW_USER_SIGN],chains:[`flow:${r}`],events:["chainChanged","accountsChanged"]}},{uri:o,approval:s}=await t.connect({pairingTopic:n?.topic,requiredNamespaces:i});if(!o)throw new Error("FCL-WC: Error creating session proposal. Could not create a proposal URI.");return{uri:o,approval:s}}const $w=async e=>{let{method:t,body:n,session:r,client:i,abortSignal:o}=e;const[s,a,c]=function(e){const[t,n,r]=Object.values(e.namespaces).map((e=>e.accounts)).flat().filter((e=>e.startsWith("flow:")))[0].split(":");return[`${t}:${n}`,r,r]}(r),u=JSON.stringify({...n,addr:a,address:c}),l=await Promise.race([i.request({topic:r.topic,chainId:s,request:{method:t,params:[u]}}),new Promise(((e,t)=>{o?.aborted&&t(new Error("WalletConnect Request aborted")),o?.addEventListener("abort",(()=>{t(new Error("WalletConnect Request aborted"))}))}))]);if("object"===typeof l&&null!=l)switch(l.status){case"APPROVED":case"REDIRECT":return l.data;case"DECLINED":throw new Error(`Declined: ${l.reason||"No reason supplied"}`);default:throw new Error("Declined: No reason supplied")}};const ex="fcl-plugin-service-walletconnect",tx="WC/RPC",nx=(e,t,n)=>{let{wcRequestHook:r,pairingModalOverride:i}=t;return async t=>{let{service:o,body:s,opts:a,abortSignal:c}=t;const u=await e;let l,d,f;fe(!!u,"WalletConnect is not initialized");const h=o.endpoint,p=function(e){let{uid:t}=e;t&&/^(ftp|http|https):\/\/[^ "]+$/.test(t)||de({title:"WalletConnect Service Warning",message:`service.uid should be a valid universal link url. Found: ${t}`,level:le.warn});return t}(o),g=u.pairing.getAll({active:!0});if(g.length>0&&(d=g?.find((e=>e.peerMetadata?.url===o.uid))),u.session.length>0){const e=u.session.keys.length-1;l=u.session.get(u.session.keys.at(e))}return Xw()&&(f=a.windowRef?a.windowRef:window.open("","_blank")),null==l&&(l=await new Promise(((e,t)=>{(function(e){return async t=>{let{service:n,onClose:r,appLink:i,windowRef:o,client:s,method:a,pairing:c,wcRequestHook:u,pairingModalOverride:l,abortSignal:d}=t;const f=s.opts?.projectId;fe(!!f,"Cannot establish connection, WalletConnect projectId is undefined");let h,p=null;try{const{uri:t,approval:g}=await Qw({client:s,existingPairing:c});if(p=t,u&&u instanceof Function&&u({type:Jw.SESSION_REQUEST,method:a,service:n,session:null,pairing:c??null,uri:t??null}),Xw()){const e=new URLSearchParams({uri:t}).toString();let n=null==c?i+"?"+e:i;o.location.href=n}else c||(l?l(t,r):(h=new(await e)({projectId:f,walletConnectVersion:2}),h.openModal({uri:t,onClose:r})));const m=await Promise.race([g(),new Promise(((e,t)=>{d?.aborted&&t(new Error("Session request aborted")),d?.addEventListener("abort",(()=>{t(new Error("Session request aborted"))}))}))]);return m}catch(g){throw g instanceof Error&&de({title:`${g.name} Error establishing WalletConnect session`,message:`\n ${g.message}\n uri: ${p}\n `,level:le.error}),r(),g}finally{o&&!o.closed&&o.close(),h?.closeModal()}}})(n)({service:o,onClose:function(){t("Declined: Externally Halted")},appLink:p,windowRef:f,client:u,method:h,pairing:d,wcRequestHook:r,pairingModalOverride:i,abortSignal:c}).then(e,t)}))),r&&r instanceof Function&&r({type:Jw.SIGNING_REQUEST,method:h,service:o,session:l??null,pairing:d??null,uri:null}),Xw()&&h!==Yw.FLOW_AUTHN&&function(){if(f)if(p.startsWith("http")&&!Kw()){const e=document.createElement("a");e.href=p,e.target="_blank",e.rel="noreferrer noopener",e.click()}else f.location.href=p;else de({title:"Problem opening deep link in new window",message:"Window failed to open (was it blocked by the browser?)",level:le.warn})}(),await $w({method:h,body:s,session:l,client:u,abortSignal:c}).finally((()=>{f&&!f.closed&&f.close()}))}};let rx=Promise.resolve(null);const ix=e=>{const{FclWcServicePlugin:t,clientPromise:n}=ox(e);return Oc.authn.update(),{FclWcServicePlugin:t,clientPromise:n}},ox=e=>{let{projectId:t,metadata:r,includeBaseWC:i=!1,wcRequestHook:o=null,pairingModalOverride:s=null,wallets:a=[]}=e;if("undefined"===typeof window)throw new Error("FCL Wallet Connect Plugin can only be initialized in the browser");rx=Promise.resolve(rx).catch((()=>null)).then((e=>e||(async e=>{let{projectId:t,metadata:n}=e;fe(null!=t,"FCL Wallet Connect Error: WalletConnect projectId is required");try{return Zw.init({logger:"debug",relayUrl:"wss://relay.walletconnect.com",projectId:t,metadata:n})}catch(r){throw r instanceof Error&&de({title:`${r.name} fcl-wc Init Client`,message:r.message,level:le.error}),r}})({projectId:t,metadata:r}))).catch((e=>{throw de({title:"WalletConnect Client Initialization Error",message:e.message?e.message:e,level:le.error}),e}));const c=function(e){return{name:ex,f_type:"ServicePlugin",type:"discovery-service",serviceStrategy:{method:tx,exec:nx(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{projectId:"",includeBaseWC:!1,wallets:[],wcRequestHook:null,pairingModalOverride:null},n.e(343).then(n.bind(n,59343)).then((e=>e.WalletConnectModal)))},services:[]}}(rx,{projectId:t,includeBaseWC:i,wcRequestHook:o,pairingModalOverride:s,wallets:a});return{FclWcServicePlugin:c,clientPromise:rx}};async function sx(){return rx.then((e=>{if(!e)throw new Error("WalletConnect client not initialized");return e}))}const ax="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",cx=ax.length;function ux(){let e="",t=32;for(;t--;)e+=ax[Math.random()*cx|0];return e}const lx=globalThis.AbortController||n(28599);function dx(e){const t=new lx;return e?.aborted&&t.abort(),e?.addEventListener("abort",(()=>t.abort())),t}let fx=function(e){return e.NOTIFY_QRCODE_CONNECTING="notifyQrCodeConnecting",e.NOTIFY_QRCODE_CONNECTED="notifyQrCodeConnected",e.NOTIFY_QRCODE_ERROR="notifyQrCodeError",e}({}),hx=function(e){return e.REQUEST_WALLETCONNECT_QRCODE="requestWalletConnectQrCode",e.EXEC_SERVICE="execService",e}({});const px="APPROVED",gx=e=>{let{rpc:t,onExecResult:n,authnBody:r,abortSignal:i}=e;const o=function(e){let{rpc:t,authnBody:n}=e;return e=>{let{uri:r,approval:i,onExecResult:o}=e;setTimeout((async()=>{try{const e=await sx(),s=await i();t.notify(fx.NOTIFY_QRCODE_CONNECTING,{uri:r});const a=await $w({method:Yw.FLOW_AUTHN,body:n,session:s,client:e});t.notify(fx.NOTIFY_QRCODE_CONNECTED,{uri:r}),o(a)}catch(e){t.notify(fx.NOTIFY_QRCODE_ERROR,{uri:r,error:e?.message})}}),0)}}({rpc:t,authnBody:r});return async e=>{if(i.aborted)throw new Error("Handler has been terminated");const t=await sx(),{uri:r,approval:s}=await Qw({client:t});return o({uri:r,approval:s,onExecResult:n}),{uri:r}}};function mx(e){let{onExecResult:t,body:n,opts:r,args:i,abortSignal:o}=e;const s=new Vu({notifications:[]});return s.on(hx.REQUEST_WALLETCONNECT_QRCODE,gx({rpc:s,onExecResult:t,authnBody:n,abortSignal:o})),s.on(hx.EXEC_SERVICE,(e=>{let{onExecResult:t,execStrategyOpts:n,execStrategyArgs:r,abortSignal:i}=e;return async e=>{let{service:o}=e;try{const e=await $c({...n,service:o,config:n.config,abortSignal:i},...r.slice(1));if((Au(e)?.status||px)===px)return t(e),null;throw new Error(e?.reason||"Service was declined")}catch(s){throw new Error(s?.message||"Service execution failed")}}})({onExecResult:t,execStrategyOpts:r,execStrategyArgs:i,abortSignal:o})),{connect:s.connect.bind(s),receive:s.receive.bind(s)}}async function bx(e){let{customRpc:t,opts:n,args:r,abortSignal:i}=e;const o={...n.config,client:{...n.config.client,discoveryRpcEnabled:!0}};return $c({...n,config:o,customRpc:t,abortSignal:i},...r.slice(1))}const yx="authn";const vx="FCL_IFRAME";function wx(e){fe(!document.getElementById(vx),"Attempt at triggering multiple Frames",{src:e});const t=document.createElement("iframe");t.src=e,t.id=vx,t.allow="usb *; hid *; clipboard-write",t.frameBorder="0",t.style.cssText="\n position:fixed;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n height: 100%;\n width: 100vw;\n display:block;\n background:rgba(0,0,0,0.25);\n z-index: 2147483647;\n box-sizing: border-box;\n color-scheme: light;\n",document.body.append(t);return[t.contentWindow,()=>{document.getElementById(vx)&&document.getElementById(vx).remove()}]}let xx=null,Sx=null;function Ax(e){null==xx||xx?.closed?xx=function(e,t,n,r,i){const o=n.top.outerHeight/2+n.top.screenY-i/2,s=n.top.outerWidth/2+n.top.screenX-r/2,a=n.open(e,t,`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${r}, height=${i}, top=${o}, left=${s}`);if(!a)throw new Error("Popup failed to open (was it blocked by a popup blocker?)");return a}(e,"FCL_POP",window,640,770):Sx!==e?(xx.location.replace(e),xx.focus()):xx.focus(),Sx=e;return[xx,()=>{xx&&!xx.closed&&xx.close(),xx=null}]}let Ex=null,_x=null;function Cx(e){if(null==Ex||Ex?.closed){if(Ex=window.open(e,"_blank"),!Ex)throw new Error("Tab failed to open (was it blocked by the browser?)")}else _x!==e?(Ex.location.replace(e),Ex.focus()):Ex.focus();_x=e;return[Ex,()=>{Ex&&!Ex.closed&&Ex.close(),Ex=null}]}const Ix=()=>{try{const e={can:!("undefined"===typeof window),get:async e=>JSON.parse(sessionStorage.getItem(e)),put:async(e,t)=>sessionStorage.setItem(e,JSON.stringify(t))};return e}catch(e){return null}},kx=()=>{};const Tx="1.12.1";const Mx=()=>{};const Px=()=>{};const Ox=()=>{};const Rx=()=>{throw new Error("Strategy util has not been implemented on this platform")},Nx={"VIEW/IFRAME":wx,"VIEW/POP":Ax,"VIEW/TAB":Cx,"VIEW/MOBILE_BROWSER":Rx,"VIEW/DEEPLINK":Rx};async function Bx(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{serviceEndpoint:()=>{}};const{serviceEndpoint:n}=t;try{return Nx[e.method](n(e),t)}catch(r){throw console.error("execLocal({service, opts = {}})",r,{service:e,opts:t}),r}}const Lx={[_a["HTTP/RPC"]]:Iu(Bx),[_a["HTTP/POST"]]:Iu(Bx),[_a["IFRAME/RPC"]]:function(e){let{service:t,body:n,config:r,customRpc:i,abortSignal:o,opts:s}=e;return new Promise(((e,a)=>{const c=ux(),u=s.includeOlderJsonRpcCall,{close:l}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:kx,close:kx};const n=t.onClose||kx,r=t.onMessage||kx,i=t.onReady||kx,o=t.onResponse||kx,s=t.onCustomRpc||kx;let a,c;const u=Nu({close:l,send:d,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});return window.addEventListener("message",u),[a,c]=wx(xu(e)),{send:d,close:l};function l(){try{window.removeEventListener("message",u),c(),n()}catch(e){console.error("Frame Close Error",e)}}function d(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Frame Send Error",e,t)}}}(t,{async onReady(e,o){let{send:s}=o;try{s({type:"FCL:VIEW:READY:RESPONSE",fclVersion:Tx,body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:Tx,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),u&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params],deprecated:{message:"jsonrpc is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),i?.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Au(t.data);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execIframeRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Au(t.data.result);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execIframeRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){i?.receive(e)}});o&&(o.aborted&&(a("Declined: Aborted"),l()),o.addEventListener("abort",(()=>{a("Declined: Aborted"),l()})))}))},[_a["POP/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,a)=>{const c=ux(),{redir:u,includeOlderJsonRpcCall:l}=s,{close:d}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:Mx,close:Mx};const n=t.onClose||Mx,r=t.onMessage||Mx,i=t.onReady||Mx,o=t.onResponse||Mx,s=t.onCustomRpc||Mx;let a,c;const u=Nu({close:d,send:f,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});window.addEventListener("message",u),[a,c]=Ax(xu(e));const l=setInterval((function(){a&&a.closed&&d()}),500);return{send:f,close:d};function d(){try{window.removeEventListener("message",u),clearInterval(l),c(),n()}catch(e){console.error("Popup Close Error",e)}}function f(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Popup Send Error",e,t)}}}(t,{customRpc:o,async onReady(e,i){let{send:s}=i;try{s({fclVersion:Tx,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:Tx,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),l&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params]}),o?.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Au(t.data);switch(n.status){case"APPROVED":e(n.data),!u&&r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Au(t.data.result);switch(n.status){case"APPROVED":e(n.data),!u&&r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){o?.receive(e)}});i&&(i.aborted&&(a("Declined: Aborted"),d()),i.addEventListener("abort",(()=>{a("Declined: Aborted"),d()})))}))},[_a["TAB/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,a)=>{const c=ux(),{redir:u,includeOlderJsonRpcCall:l}=s,{close:d}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:Px,close:Px};const n=t.onClose||Px,r=t.onMessage||Px,i=t.onReady||Px,o=t.onResponse||Px,s=t.onCustomRpc||Px;let a,c;const u=Nu({close:d,send:f,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});window.addEventListener("message",u),[a,c]=Cx(xu(e));const l=setInterval((function(){a&&a.closed&&d()}),500);return{send:f,close:d};function d(){try{window.removeEventListener("message",u),clearInterval(l),c(),n()}catch(e){console.error("Tab Close Error",e)}}function f(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Tab Send Error",e,t)}}}(t,{customRpc:o,async onReady(e,i){let{send:s}=i;try{s({fclVersion:Tx,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:Tx,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),l&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params]}),o?.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Au(t.data);switch(n.status){case"APPROVED":e(n.data),!u&&r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Au(t.data.result);switch(n.status){case"APPROVED":e(n.data),!u&&r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){o?.receive(e)}});i&&(i.aborted&&(d(),a("Declined: Aborted")),i.addEventListener("abort",(()=>{d(),a("Declined: Aborted")})))}))},[_a["EXT/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,s)=>{const{close:a}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:Ox,close:Ox};const n=t.onClose||Ox,r=t.onMessage||Ox,i=t.onReady||Ox,o=t.onResponse||Ox,s=t.onCustomRpc||Ox,a=Nu({close:c,send:u,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s});return window.addEventListener("message",a),u({service:e}),{send:u,close:c};function c(){try{window.removeEventListener("message",a),n()}catch(e){console.error("Ext Close Error",e)}}function u(e){try{window&&window.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Ext Send Error",e,t)}}}(t,{async onReady(e,i){let{send:s}=i;try{s({fclVersion:Tx,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),o?.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",body:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Au(t.data);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":s(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:s("Declined: No reason supplied"),r()}}catch(i){throw console.error("execExtRPC onResponse error",i),i}},onClose(){s("Declined: Externally Halted")},onCustomRpc(e){o?.receive(e)}});i&&(i.aborted&&(a(),s("Declined: Aborted")),i.addEventListener("abort",(()=>{a(),s("Declined: Aborted")})))}))}},Dx="undefined"===typeof window,Ux=e=>{const t=e["app.detail.title"],n=e["app.detail.icon"],r=e["app.detail.description"],i=e["app.detail.url"];return{name:t??document.title,description:r??"",url:i??window.location.origin,icons:n?[n]:[]}};const jx={execStrategy:async function(){for(var e=arguments.length,t=new Array(e),n=0;n{const o=mx({onExecResult:e,body:i,opts:r,args:t,abortSignal:a.signal});c=bx({customRpc:o,opts:r,args:t,abortSignal:a.signal}).then(e,n)}));return await u.catch((()=>{})),await Promise.race([new Promise((e=>setTimeout(e,1e3))),c]).catch((()=>{})),a.abort(),u}},Fx=(e=>{let{platform:t,discovery:n}=e;return async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r;try{await wa(e),e=await ya(e);const i=wu({platform:t,discovery:n}),o=await xt().get("fcl.authz",i().authorization);return r=lo([Fo(e.cadence),Oo(aa(e.args||[])),e.limit&&sa(e.limit)&&Po(e.limit),No(e.proposer||e.authz||o),Bo(e.payer||e.authz||o),xo(e.authorizations||[e.authz||o])]).then(fo),r}catch(i){throw i}}})({platform:"web",discovery:jx}),Vx=wu({platform:"web",discovery:jx}),qx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vx().authenticate(e)},zx=()=>Vx().unauthenticate(),Hx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vx().unauthenticate(),Vx().authenticate(e)},Wx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vx().authenticate(e)},Gx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vx().authenticate(e)},Zx=Vx().authorization;xt({"discovery.wallet.method.default":"IFRAME/RPC","fcl.storage.default":Ix()}),xc({coreStrategies:Lx}),function(){if(Dx)return;let e=null,t=!1;xt.subscribe((async n=>{const r={"walletconnect.projectId":n["walletconnect.projectId"],"app.detail.title":n["app.detail.title"],"app.detail.icon":n["app.detail.icon"],"app.detail.description":n["app.detail.description"],"app.detail.url":n["app.detail.url"]},i=r["walletconnect.projectId"],o=e;if(e=JSON.stringify(r,null,2),t)return void(o!==e&&console.warn(`FCL WalletConnect Plugin has been already loaded with different configuration. It is not possible to change the configuration after the plugin has been loaded.\n\nPrevious configuration:\n${o}\n\nCurrent configuration:\n${e}`));if(!!!i)return;if(fe(!!i,"FCL Configuration value for 'walletconnect.projectId' is required"),Ac.getPlugins().has(ex))return t||console.warn("It seems like the FCL WalletConnect plugins has been already loaded manually. This is no longer necessary, please see the documentation for more information."),void(t=!0);t=!0;const{clientPromise:s,FclWcServicePlugin:a}=ix({projectId:i,metadata:Ux(r)});Ac.add([a])}))}();var Kx=n(48764).Buffer;function Xx(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var Yx=function(e){L(n,e);var t=Xx(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),$x=Jx("ascii","a",(e=>{let t="a";for(let n=0;n{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let n=0;n{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...i.accounts)})),n}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const tS={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function nS(e,t){const{message:n,code:r}=tS[e];return{message:t?`${n} ${t}`:n,code:r}}function rS(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function iS(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const oS=iS("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),sS=iS("ascii","a",(e=>{let t="a";for(let n=0;n{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let n=0;nt in e?yS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_S=(e,t)=>{for(var n in t||(t={}))SS.call(t,n)&&ES(e,n,t[n]);if(xS)for(var n of xS(t))AS.call(t,n)&&ES(e,n,t[n]);return e},CS=(e,t)=>vS(e,wS(t));const IS={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class kS{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new Nt.EventEmitter,this.isAvailable=!1,this.registering=!1,!im(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=yl(e),n=await(await bS()(this.url,CS(_S({},IS),{body:t}))).json();this.onPayload({data:n})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!im(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(new Error("HTTP connection is missing or invalid"));e()}))}))}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=yl({id:1,jsonrpc:"2.0",method:"test",params:[]});await bS()(e,CS(_S({},IS),{body:t}))}this.onOpen()}catch(t){const e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?bl(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=em(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e,t=this.url){return Kg(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}class TS extends nm{constructor(e){super(e),this.events=new Nt.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Qg(e.method,e.params||[],e.id||Jg().toString()),t)}async requestStrict(e,t){return new Promise((async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(Hu){r(Hu)}this.events.on(`${e.id}`,(e=>{lm(e)?r(e.error):n(e.result)}));try{await this.connection.send(e,t)}catch(Hu){r(Hu)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),cm(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",(e=>this.onPayload(e))),this.connection.on("close",(e=>this.onClose(e))),this.connection.on("error",(e=>this.events.emit("error",e))),this.connection.on("register_error",(e=>this.onClose())),this.hasRegisteredEventListeners=!0)}}const MS="error",PS="generic",OS="default_chain_changed";var RS=Object.defineProperty,NS=Object.defineProperties,BS=Object.getOwnPropertyDescriptors,LS=Object.getOwnPropertySymbols,DS=Object.prototype.hasOwnProperty,US=Object.prototype.propertyIsEnumerable,jS=(e,t,n)=>t in e?RS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FS=(e,t)=>{for(var n in t||(t={}))DS.call(t,n)&&jS(e,n,t[n]);if(LS)for(var n of LS(t))US.call(t,n)&&jS(e,n,t[n]);return e},VS=(e,t)=>NS(e,BS(t));function qS(e,t,n){var r;const i=cS(e);return(null==(r=t.rpcMap)?void 0:r[i.reference])||`https://rpc.walletconnect.org/v1/?chainId=${i.namespace}:${i.reference}&projectId=${n}`}function zS(e){return e.includes(":")?e.split(":")[1]:e}function HS(e){return e.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))}function WS(e={},t={}){const n=GS(e),r=GS(t);return(0,E.merge)(n,r)}function GS(e){var t,n,r,i;const o={};if(!gS(e))return o;for(const[s,a]of Object.entries(e)){const e=lS(s)?[s]:a.chains,c=a.methods||[],u=a.events||[],l=a.rpcMap||{},d=dS(s);o[d]=VS(FS(FS({},o[d]),a),{chains:uS(e,null==(t=o[d])?void 0:t.chains),methods:uS(c,null==(n=o[d])?void 0:n.methods),events:uS(u,null==(r=o[d])?void 0:r.events),rpcMap:FS(FS({},l),null==(i=o[d])?void 0:i.rpcMap)})}return o}function ZS(e){return e.includes(":")?e.split(":")[2]:e}function KS(e){const t={};for(const[n,r]of Object.entries(e)){const e=r.methods||[],i=r.events||[],o=r.accounts||[],s=lS(n)?[n]:r.chains?r.chains:HS(r.accounts);t[n]={chains:s,methods:e,events:i,accounts:o}}return t}function XS(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}const YS={},JS=e=>YS[e],QS=(e,t)=>{YS[e]=t};class $S{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}var eA=Object.defineProperty,tA=Object.defineProperties,nA=Object.getOwnPropertyDescriptors,rA=Object.getOwnPropertySymbols,iA=Object.prototype.hasOwnProperty,oA=Object.prototype.propertyIsEnumerable,sA=(e,t,n)=>t in e?eA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aA=(e,t)=>{for(var n in t||(t={}))iA.call(t,n)&&sA(e,n,t[n]);if(rA)for(var n of rA(t))oA.call(t,n)&&sA(e,n,t[n]);return e},cA=(e,t)=>tA(e,nA(t));class uA{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(OS,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||qS(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=parseInt(zS(t));e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,n;let r=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0";r=r.startsWith("0x")?r:`0x${r}`;const i=parseInt(r,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:r}]},chainId:null==(n=this.namespace.chains)?void 0:n[0]}),this.setDefaultChain(`${i}`)}return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,n,r;const i=null==(n=null==(t=e.request)?void 0:t.params)?void 0:n[0];if(!i)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),s=(null==(r=o?.sessionProperties)?void 0:r.capabilities)||{};if(null!=s&&s[i])return s?.[i];const a=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:cA(aA({},o.sessionProperties||{}),{capabilities:cA(aA({},s||{}),{[i]:a})})})}catch(c){console.warn("Failed to update session with capabilities",c)}return a}async getCallStatus(e){var t,n;const r=this.client.session.get(e.topic),i=null==(t=r.sessionProperties)?void 0:t.bundler_name;if(i){const t=this.getBundlerUrl(e.chainId,i);try{return await this.getUserOperationReceipt(t,e)}catch(Nl){console.warn("Failed to fetch call status from bundler",Nl,t)}}const o=null==(n=r.sessionProperties)?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(s){console.warn("Failed to fetch call status from custom bundler",s,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var n;const r=new URL(e),i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qg("eth_getUserOperationReceipt",[null==(n=t.request.params)?void 0:n[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}getBundlerUrl(e,t){return`https://rpc.walletconnect.org/v1/bundler?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class lA{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class dA{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class fA{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const n=t||qS(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(OS,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;e[t]=this.createHttpProvider(t,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new TS(new kS(n,JS("disableProviderPing")))}}class hA{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{const n=this.getCardanoRPCUrl(t),r=zS(t);e[r]=this.createHttpProvider(r,n)})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class pA{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class gA{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class mA{constructor(e){this.name="near",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||qS(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(OS,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;e[t]=this.createHttpProvider(t,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace);return typeof n>"u"?void 0:new TS(new kS(n,JS("disableProviderPing")))}}class bA{constructor(e){this.name=PS,this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){var e,t;const n={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach((e=>{const t=cS(e);n[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)})),n}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}var yA=Object.defineProperty,vA=Object.defineProperties,wA=Object.getOwnPropertyDescriptors,xA=Object.getOwnPropertySymbols,SA=Object.prototype.hasOwnProperty,AA=Object.prototype.propertyIsEnumerable,EA=(e,t,n)=>t in e?yA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_A=(e,t)=>{for(var n in t||(t={}))SA.call(t,n)&&EA(e,n,t[n]);if(xA)for(var n of xA(t))AA.call(t,n)&&EA(e,n,t[n]);return e},CA=(e,t)=>vA(e,wA(t));class IA{constructor(e){this.events=new(Bt()),this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:kl()(Wl({level:e?.logger||MS})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new IA(e);return await t.initialize(),t}async request(e,t,n){const[r,i]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(r).request({request:_A({},e),chainId:`${r}:${i}`,topic:this.session.topic,expiry:n})}sendAsync(e,t,n,r){const i=(new Date).getTime();this.request(e,n,r).then((e=>t(null,$g(i,e)))).catch((e=>t(e,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:hS("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:r}=await this.client.authenticate(e,t);n&&(this.uri=n,this.events.emit("display_uri",n));const i=await r();if(this.session=i.session,this.session){const e=KS(this.session.namespaces);this.namespaces=WS(this.namespaces,e),this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await r().then((e=>{this.session=e;const t=KS(e.namespaces);this.namespaces=WS(this.namespaces,t),this.persist("namespaces",this.namespaces)})).catch((e=>{if(e.message!==xw)throw e;t++}))}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,r]=this.validateChain(e),i=this.getProvider(n);i.name===PS?i.setDefaultChain(`${n}:${r}`,t):i.setDefaultChain(r,t)}catch(Wu){if(!/Please call connect/.test(Wu.message))throw Wu}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(pS(t)){for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Zw.init({core:this.providerOpts.core,logger:this.providerOpts.logger||MS,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map((e=>dS(e))))];QS("client",this.client),QS("events",this.events),QS("disableProviderPing",this.disableProviderPing),e.forEach((e=>{if(!this.session)return;const t=function(e,t){const n=Object.keys(t.namespaces).filter((t=>t.includes(e)));if(!n.length)return[];const r=[];return n.forEach((e=>{const n=t.namespaces[e].accounts;r.push(...n)})),r}(e,this.session),n=HS(t),r=WS(this.namespaces,this.optionalNamespaces),i=CA(_A({},r[e]),{accounts:t,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new uA({namespace:i});break;case"algorand":this.rpcProviders[e]=new fA({namespace:i});break;case"solana":this.rpcProviders[e]=new lA({namespace:i});break;case"cosmos":this.rpcProviders[e]=new dA({namespace:i});break;case"polkadot":this.rpcProviders[e]=new $S({namespace:i});break;case"cip34":this.rpcProviders[e]=new hA({namespace:i});break;case"elrond":this.rpcProviders[e]=new pA({namespace:i});break;case"multiversx":this.rpcProviders[e]=new gA({namespace:i});break;case"near":this.rpcProviders[e]=new mA({namespace:i});break;default:this.rpcProviders.generic?this.rpcProviders.generic.updateNamespace(i):this.rpcProviders.generic=new bA({namespace:i})}}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(e=>{this.events.emit("session_ping",e)})),this.client.on("session_event",(e=>{const{params:t}=e,{event:n}=t;if("accountsChanged"===n.name){const e=n.data;e&&pS(e)&&this.events.emit("accountsChanged",e.map(ZS))}else if("chainChanged"===n.name){const e=t.chainId,n=t.event.data,r=dS(e),i=XS(e)!==XS(n)?`${r}:${XS(n)}`:e;this.onChainChanged(i)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)})),this.client.on("session_update",(({topic:e,params:t})=>{var n;const{namespaces:r}=t,i=null==(n=this.client)?void 0:n.session.get(e);this.session=CA(_A({},i),{namespaces:r}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})})),this.client.on("session_delete",(async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",CA(_A({},hS("USER_DISCONNECTED")),{data:e.topic}))})),this.on(OS,(e=>{this.onChainChanged(e,!0)}))}getProvider(e){return this.rpcProviders[e]||this.rpcProviders.generic}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])}))}setNamespaces(e){const{namespaces:t,optionalNamespaces:n,sessionProperties:r}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=r,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map((e=>dS(e))).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const r=dS(Object.keys(this.namespaces)[0]);return[r,this.rpcProviders[r].getDefaultChain()]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[n,r]=this.validateChain(e);r&&(t||this.getProvider(n).setDefaultChain(r),this.namespaces[n]?this.namespaces[n].defaultChain=r:this.namespaces[`${n}:${r}`]?this.namespaces[`${n}:${r}`].defaultChain=r:this.namespaces[`${n}:${r}`]={defaultChain:r},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",r))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`wc@2:universal_provider:/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`wc@2:universal_provider:/${e}`)}}const kA=IA,TA=["eth_sendTransaction","personal_sign"],MA=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],PA=["chainChanged","accountsChanged"],OA=["chainChanged","accountsChanged","message","disconnect","connect"];var RA=Object.defineProperty,NA=Object.defineProperties,BA=Object.getOwnPropertyDescriptors,LA=Object.getOwnPropertySymbols,DA=Object.prototype.hasOwnProperty,UA=Object.prototype.propertyIsEnumerable,jA=(e,t,n)=>t in e?RA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FA=(e,t)=>{for(var n in t||(t={}))DA.call(t,n)&&jA(e,n,t[n]);if(LA)for(var n of LA(t))UA.call(t,n)&&jA(e,n,t[n]);return e},VA=(e,t)=>NA(e,BA(t));function qA(e){return Number(e[0].split(":")[1])}function zA(e){return`0x${e.toString(16)}`}class HA{constructor(){this.events=new Nt.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new HA;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,n){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),n)}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:n}=function(e){const{chains:t,optionalChains:n,methods:r,optionalMethods:i,events:o,optionalEvents:s,rpcMap:a}=e;if(!rS(t))throw new Error("Invalid chains");const c={chains:t,methods:r||TA,events:o||PA,rpcMap:FA({},t.length?{[qA(t)]:a[qA(t)]}:{})},u=o?.filter((e=>!PA.includes(e))),l=r?.filter((e=>!TA.includes(e)));if(!n&&!s&&!i&&(null==u||!u.length)&&(null==l||!l.length))return{required:t.length?c:void 0};const d={chains:[...new Set(u?.length&&l?.length||!n?c.chains.concat(n||[]):n)],methods:[...new Set(c.methods.concat(null!=i&&i.length?i:MA))],events:[...new Set(c.events.concat(null!=s&&s.length?s:OA))],rpcMap:a};return{required:t.length?c:void 0,optional:n.length?d:void 0}}(this.rpc);try{const r=await new Promise((async(r,i)=>{var o;this.rpc.showQrModal&&(null==(o=this.modal)||o.subscribeModal((e=>{!e.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),i(new Error("Connection request reset. Please try again.")))}))),await this.signer.connect(VA(FA({namespaces:FA({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e?.pairingTopic})).then((e=>{r(e)})).catch((e=>{i(new Error(e.message))}))}));if(!r)return;const i=eS(r.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:i),this.setAccounts(i),this.events.emit("connect",{chainId:zA(this.chainId)})}catch(r){throw this.signer.logger.error(r),r}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const n=await new Promise((async(n,r)=>{var i;this.rpc.showQrModal&&(null==(i=this.modal)||i.subscribeModal((e=>{!e.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),r(new Error("Connection request reset. Please try again.")))}))),await this.signer.authenticate(VA(FA({},e),{chains:this.rpc.chains}),t).then((e=>{n(e)})).catch((e=>{r(new Error(e.message))}))})),r=n.session;if(r){const e=eS(r.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:e),this.setAccounts(e),this.events.emit("connect",{chainId:zA(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",(e=>{const{params:t}=e,{event:n}=t;"accountsChanged"===n.name?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===n.name?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)})),this.signer.on("chainChanged",(e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",zA(this.chainId)),this.persist()})),this.signer.on("session_update",(e=>{this.events.emit("session_update",e)})),this.signer.on("session_delete",(e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",VA(FA({},nS("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))})),this.signer.on("display_uri",(e=>{var t,n;this.rpc.showQrModal&&(null==(t=this.modal)||t.closeModal(),null==(n=this.modal)||n.openModal({uri:e})),this.events.emit("display_uri",e)}))}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return"string"==typeof e&&e.startsWith(`${this.namespace}:`)}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter((e=>this.isCompatibleChainId(e))).map((e=>this.parseChainId(e)));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",zA(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,n,r]=e.split(":");return{chainId:`${t}:${n}`,address:r}}setAccounts(e){this.accounts=e.filter((e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId)).map((e=>this.parseAccountId(e).address)),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,n;const r=null!=(t=e?.chains)?t:[],i=null!=(n=e?.optionalChains)?n:[],o=r.concat(i);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const s=r.length?e?.methods||TA:[],a=r.length?e?.events||PA:[],c=e?.optionalMethods||[],u=e?.optionalEvents||[],l=e?.rpcMap||this.buildRpcMap(o,e.projectId),d=e?.qrModalOptions||void 0;return{chains:r?.map((e=>this.formatChainId(e))),optionalChains:i.map((e=>this.formatChainId(e))),methods:s,events:a,optionalMethods:c,optionalEvents:u,rpcMap:l,showQrModal:!(null==e||!e.showQrModal),qrModalOptions:d,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach((e=>{n[e]=this.getRpcUrl(e,t)})),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?qA(this.rpc.chains):qA(this.rpc.optionalChains),this.signer=await kA.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:t}=await n.e(343).then(n.bind(n,59343));e=t}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(FA({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(t){throw this.signer.logger.error(t),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:n,rpcMap:r}=e;t&&rS(t)&&(this.rpc.chains=t.map((e=>this.formatChainId(e))),t.forEach((e=>{this.rpc.rpcMap[e]=r?.[e]||this.getRpcUrl(e)}))),n&&rS(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n?.map((e=>this.formatChainId(e))),n.forEach((e=>{this.rpc.rpcMap[e]=r?.[e]||this.getRpcUrl(e)})))}getRpcUrl(e,t){var n;return(null==(n=this.rpc.rpcMap)?void 0:n[e])||`https://rpc.walletconnect.org/v1/?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}catch(aM){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(aM),await this.disconnect().catch((e=>this.signer.logger.warn(e)))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return"string"==typeof e||e instanceof String?[this.parseAccount(e)]:e.map((e=>this.parseAccount(e)))}}const WA=HA;function GA(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var ZA=function(e){L(n,e);var t=GA(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;othis.data(e,!0))),type:AE.allowNull(a),accessList:AE.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:t,topics:AE.arrayOf(o),data:i,logIndex:a,blockHash:o},e.receipt={to:AE.allowNull(this.address,null),from:AE.allowNull(this.address,null),contractAddress:AE.allowNull(t,null),transactionIndex:a,root:AE.allowNull(s),gasUsed:n,logsBloom:AE.allowNull(i),blockHash:o,transactionHash:o,logs:AE.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:AE.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:AE.allowNull(n),status:AE.allowNull(a),type:c},e.block={hash:AE.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:AE.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:AE.allowNull(t),extraData:i,transactions:AE.allowNull(AE.arrayOf(o)),baseFeePerGas:AE.allowNull(n)},e.blockWithTransactions=(0,JA.shallowCopy)(e.block),e.blockWithTransactions.transactions=AE.allowNull(AE.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:AE.allowNull(r,void 0),toBlock:AE.allowNull(r,void 0),blockHash:AE.allowNull(o,void 0),address:AE.allowNull(t,void 0),topics:AE.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:AE.allowNull(a),blockHash:AE.allowNull(o),transactionIndex:a,removed:AE.allowNull(this.boolean.bind(this)),address:t,data:AE.allowFalsish(i,"0x"),topics:AE.arrayOf(o),transactionHash:o,logIndex:a},e}accessList(e){return(0,ch.accessListify)(e||[])}number(e){return"0x"===e?0:tE.O$.from(e).toNumber()}type(e){return"0x"===e||null==e?0:tE.O$.from(e).toNumber()}bigNumber(e){return tE.O$.from(e)}boolean(e){if("boolean"===typeof e)return e;if("string"===typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"===typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),(0,nE.isHexString)(e))?e.toLowerCase():SE.throwArgumentError("invalid hash","value",e)}data(e,t){const n=this.hex(e,t);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return(0,xE.getAddress)(e)}callAddress(e){if(!(0,nE.isHexString)(e,32))return null;const t=(0,xE.getAddress)((0,nE.hexDataSlice)(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return(0,xE.getContractAddress)(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"===typeof e||(0,nE.isHexString)(e))return(0,nE.hexValue)(e);throw new Error("invalid blockTag")}hash(e,t){const n=this.hex(e,t);return 32!==(0,nE.hexDataLength)(n)?SE.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(null==e)return null;const t=tE.O$.from(e);try{return t.toNumber()}catch(n){}return null}uint256(e){if(!(0,nE.isHexString)(e))throw new Error("invalid uint256");return(0,nE.hexZeroPad)(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const n=null!=e._difficulty?e._difficulty:e.difficulty,r=AE.check(t,e);return r._difficulty=null==n?null:tE.O$.from(n),r}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return AE.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&tE.O$.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=AE.check(this.formats.transaction,e);if(null!=e.chainId){let n=e.chainId;(0,nE.isHexString)(n)&&(n=tE.O$.from(n).toNumber()),t.chainId=n}else{let n=e.networkId;null==n&&null==t.v&&(n=e.chainId),(0,nE.isHexString)(n)&&(n=tE.O$.from(n).toNumber()),"number"!==typeof n&&null!=t.v&&(n=(t.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!==typeof n&&(n=0),t.chainId=n}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return(0,ch.parse)(e)}receiptLog(e){return AE.check(this.formats.receiptLog,e)}receipt(e){const t=AE.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=tE.O$.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&SE.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):SE.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&SE.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return AE.check(this.formats.filter,e)}filterLog(e){return AE.check(this.formats.filterLog,e)}static check(e,t){const n={};for(const i in e)try{const r=e[i](t[i]);void 0!==r&&(n[i]=r)}catch(r){throw r.checkKey=i,r.checkValue=t[i],r}return n}static allowNull(e,t){return function(n){return null==n?t:e(n)}}static allowFalsish(e,t){return function(n){return n?e(n):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const n=[];return t.forEach((function(t){n.push(e(t))})),n}}}var EE=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const _E=new QA.Logger($A);function CE(e){return null==e?"null":(32!==(0,nE.hexDataLength)(e)&&_E.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function IE(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[CE(e)]=!0}));const n=Object.keys(t);return n.sort(),n.join("|")}return CE(e)})).join("&")}function kE(e){if("string"===typeof e){if(e=e.toLowerCase(),32===(0,nE.hexDataLength)(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+IE(e);if(sE.Sg.isForkEvent(e))throw _E.warn("not implemented"),new Error("not implemented");if(e&&"object"===typeof e)return"filter:"+(e.address||"*")+":"+IE(e.topics||[])}throw new Error("invalid event - "+e)}function TE(){return(new Date).getTime()}function ME(e){return new Promise((t=>{setTimeout(t,e)}))}const PE=["block","network","pending","poll"];class OE{constructor(e,t,n){(0,JA.defineReadOnly)(this,"tag",e),(0,JA.defineReadOnly)(this,"listener",t),(0,JA.defineReadOnly)(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],n=""===(r=e[2])?[]:r.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var r;const i={};return n.length>0&&(i.topics=n),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||PE.indexOf(this.tag)>=0}}const RE={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function NE(e){return(0,nE.hexZeroPad)(tE.O$.from(e).toHexString(),32)}function BE(e){return cE.Base58.encode((0,nE.concat)([e,(0,nE.hexDataSlice)((0,yE.JQ)((0,yE.JQ)(e)),0,4)]))}const LE=new RegExp("^(ipfs)://(.*)$","i"),DE=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),LE,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function UE(e,t){try{return(0,iE.ZN)(jE(e,t))}catch(n){}return null}function jE(e,t){if("0x"===e)return null;const n=tE.O$.from((0,nE.hexDataSlice)(e,t,t+32)).toNumber(),r=tE.O$.from((0,nE.hexDataSlice)(e,n,n+32)).toNumber();return(0,nE.hexDataSlice)(e,n+32,n+32+r)}function FE(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):_E.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function VE(e){const t=(0,nE.arrayify)(e);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function qE(e){if(e.length%32===0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function zE(e){const t=[];let n=0;for(let r=0;rtE.O$.from(e).eq(1))).catch((e=>{if(e.code===QA.Logger.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return EE(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:(0,nE.hexConcat)([e,(0,lE.VM)(this.name),t||"0x"])};let r=!1;(yield this.supportsWildcard())&&(r=!0,n.data=(0,nE.hexConcat)(["0x9061b923",zE([(0,lE.Kn)(this.name),n.data])]));try{let e=yield this.provider.call(n);return(0,nE.arrayify)(e).length%32===4&&_E.throwError("resolver threw error",QA.Logger.errors.CALL_EXCEPTION,{transaction:n,data:e}),r&&(e=jE(e,0)),e}catch(i){if(i.code===QA.Logger.errors.CALL_EXCEPTION)return null;throw i}}))}_fetchBytes(e,t){return EE(this,void 0,void 0,(function*(){const n=yield this._fetch(e,t);return null!=n?jE(n,0):null}))}_getAddress(e,t){const n=RE[String(e)];if(null==n&&_E.throwError(`unsupported coin type: ${e}`,QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===n.ilk)return this.provider.formatter.address(t);const r=(0,nE.arrayify)(t);if(null!=n.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return BE((0,nE.concat)([[n.p2pkh],"0x"+e[2]]))}}if(null!=n.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return BE((0,nE.concat)([[n.p2sh],"0x"+e[2]]))}}if(null!=n.prefix){const e=r[1];let t=r[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&r.length===2+e&&e>=1&&e<=75){const e=wE().toWords(r.slice(2));return e.unshift(t),wE().encode(n.prefix,e)}}return null}getAddress(e){return EE(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||e===uE.R?null:this.provider.formatter.callAddress(e)}catch(r){if(r.code===QA.Logger.errors.CALL_EXCEPTION)return null;throw r}const t=yield this._fetchBytes("0xf1cb7e06",NE(e));if(null==t||"0x"===t)return null;const n=this._getAddress(e,t);return null==n&&_E.throwError("invalid or unsupported coin data",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),n}))}getAvatar(){return EE(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let n=0;ne[t]));return"sia://"+t}return _E.throwError("invalid or unsupported content hash data",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return EE(this,void 0,void 0,(function*(){let t=(0,iE.Y0)(e);t=(0,nE.concat)([NE(64),NE(t.length),t]),t.length%32!==0&&(t=(0,nE.concat)([t,(0,nE.hexZeroPad)("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",(0,nE.hexlify)(t));return null==n||"0x"===n?null:(0,iE.ZN)(n)}))}}let WE=null,GE=1;class ZE extends sE.zt{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),(0,JA.defineReadOnly)(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=(0,JA.getStatic)(new.target,"getNetwork")(e);t?((0,JA.defineReadOnly)(this,"_network",t),this.emit("network",t,null)):_E.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return EE(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(e){}null==t&&(t=yield this.detectNetwork()),t||_E.throwError("no network detected",QA.Logger.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:(0,JA.defineReadOnly)(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return(0,oE.poll)((()=>this._ready().then((e=>e),(e=>{if(e.code!==QA.Logger.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==WE&&(WE=new AE),WE}static getNetwork(e){return function(e){if(null==e)return null;if("number"===typeof e){for(const t in bE){const n=bE[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"===typeof e){const t=bE[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=bE[e.name];if(!t)return"number"!==typeof e.chainId&&dE.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&dE.throwArgumentError("network chainId mismatch","network",e);let n=e._defaultProvider||null;return null==n&&t._defaultProvider&&(n=function(e){return e&&"function"===typeof e.renetwork}(t._defaultProvider)?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:n}}(null==e?"homestead":e)}ccipReadFetch(e,t,n){return EE(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let e=0;e=0?null:JSON.stringify({data:i,sender:r}),c=yield(0,oE.fetchJson)({url:s,errorPassThrough:!0},a,((e,t)=>(e.status=t.statusCode,e)));if(c.data)return c.data;const u=c.message||"unknown error";if(c.status>=400&&c.status<500)return _E.throwError(`response not found during CCIP fetch: ${u}`,QA.Logger.errors.SERVER_ERROR,{url:t,errorMessage:u});o.push(u)}return _E.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,QA.Logger.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(e){return EE(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const n=yield t;if(TE()-n.respTime<=e)return n.blockNumber;break}catch(r){if(this._internalBlockNumber===t)break}}const t=TE(),n=(0,JA.resolveProperties)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=TE();return(e=tE.O$.from(e).toNumber()){this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return EE(this,void 0,void 0,(function*(){const e=GE++,t=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(r){return void this.emit("error",r)}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)_E.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",_E.makeError("network block skew detected",QA.Logger.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let e=this._emitted.block+1;e<=n;e++)this.emit("block",e);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&n-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((e=>{switch(e.type){case"tx":{const n=e.hash;let r=this.getTransactionReceipt(n).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+n]=e.blockNumber,this.emit(n,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(r);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);const r=e.filter;r.fromBlock=e._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const o=this.getLogs(r).then((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(r,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(o)}}})),this._lastBlockNumber=n,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return EE(this,void 0,void 0,(function*(){return _E.throwError("provider does not support network detection",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return EE(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield ME(0),this._network;const n=_E.makeError("underlying network changed",QA.Logger.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",n),n}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!==typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=TE();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,n){return EE(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,n||0,null)}))}_waitForTransaction(e,t,n,r){return EE(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,o)=>{const s=[];let a=!1;const c=function(){return!!a||(a=!0,s.forEach((e=>{e()})),!1)},u=e=>{e.confirmations{this.removeListener(e,u)})),r){let n=r.startBlock,i=null;const u=s=>EE(this,void 0,void 0,(function*(){a||(yield ME(1e3),this.getTransactionCount(r.from).then((l=>EE(this,void 0,void 0,(function*(){if(!a){if(l<=r.nonce)n=s;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=n-3,i{a||this.once("block",u)})))}));if(a)return;this.once("block",u),s.push((()=>{this.removeListener("block",u)}))}if("number"===typeof n&&n>0){const e=setTimeout((()=>{c()||o(_E.makeError("timeout exceeded",QA.Logger.errors.TIMEOUT,{timeout:n}))}),n);e.unref&&e.unref(),s.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return EE(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return tE.O$.from(e)}catch(t){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,JA.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getBalance",n);try{return tE.O$.from(r)}catch(i){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:i})}}))}getTransactionCount(e,t){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,JA.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getTransactionCount",n);try{return tE.O$.from(r).toNumber()}catch(i){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:i})}}))}getCode(e,t){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,JA.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getCode",n);try{return(0,nE.hexlify)(r)}catch(i){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:i})}}))}getStorageAt(e,t,n){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,JA.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(t).then((e=>(0,nE.hexValue)(e)))}),i=yield this.perform("getStorageAt",r);try{return(0,nE.hexlify)(i)}catch(o){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:o})}}))}_wrapTransaction(e,t,n){if(null!=t&&32!==(0,nE.hexDataLength)(t))throw new Error("invalid response - sendTransaction");const r=e;return null!=t&&e.hash!==t&&_E.throwError("Transaction hash mismatch from Provider.sendTransaction.",QA.Logger.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),r.wait=(t,r)=>EE(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==r&&(r=0),0!==t&&null!=n&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const o=yield this._waitForTransaction(e.hash,t,r,i);return null==o&&0===t?null:(this._emitted["t:"+e.hash]=o.blockNumber,0===o.status&&_E.throwError("transaction failed",QA.Logger.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),r}sendTransaction(e){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>(0,nE.hexlify)(e))),n=this.formatter.transaction(e);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(n,e,r)}catch(i){throw i.transaction=n,i.transactionHash=n.hash,i}}))}_getTransactionRequest(e){return EE(this,void 0,void 0,(function*(){const t=yield e,n={};return["from","to"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?tE.O$.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(n.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?(0,nE.hexlify)(e):null)))})),this.formatter.transactionRequest(yield(0,JA.resolveProperties)(n))}))}_getFilter(e){return EE(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((n=>{null!=e[n]&&(t[n]=e[n])})),["fromBlock","toBlock"].forEach((n=>{null!=e[n]&&(t[n]=this._getBlockTag(e[n]))})),this.formatter.filter(yield(0,JA.resolveProperties)(t))}))}_call(e,t,n){return EE(this,void 0,void 0,(function*(){n>=10&&_E.throwError("CCIP read exceeded maximum redirections",QA.Logger.errors.SERVER_ERROR,{redirects:n,transaction:e});const r=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(n>=0&&"latest"===t&&null!=r&&"0x556f1830"===i.substring(0,10)&&(0,nE.hexDataLength)(i)%32===4)try{const o=(0,nE.hexDataSlice)(i,4),s=(0,nE.hexDataSlice)(o,0,32);tE.O$.from(s).eq(r)||_E.throwError("CCIP Read sender did not match",QA.Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],c=tE.O$.from((0,nE.hexDataSlice)(o,32,64)).toNumber(),u=tE.O$.from((0,nE.hexDataSlice)(o,c,c+32)).toNumber(),l=(0,nE.hexDataSlice)(o,c+32);for(let t=0;tEE(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",r);if(null==e)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(t){let t=null;for(let r=0;rthis._wrapTransaction(e))),n}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return EE(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return(0,oE.poll)((()=>EE(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(e){return EE(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return(0,oE.poll)((()=>EE(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return r}))),{oncePoll:this})}))}getLogs(e){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield(0,JA.resolveProperties)({filter:this._getFilter(e)}),n=yield this.perform("getLogs",t);return n.forEach((e=>{null==e.removed&&(e.removed=!1)})),AE.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return EE(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return EE(this,void 0,void 0,(function*(){if("number"===typeof(e=yield e)&&e<0){e%1&&_E.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return EE(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const n=yield this._getResolver(t,"getResolver");if(null!=n){const r=new HE(this,n,e);return t===e||(yield r.supportsWildcard())?r:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return EE(this,void 0,void 0,(function*(){null==t&&(t="ENS");const n=yield this.getNetwork();n.ensAddress||_E.throwError("network does not support ENS",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:t,network:n.name});try{const t=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+(0,lE.VM)(e).substring(2)});return this.formatter.callAddress(t)}catch(r){}return null}))}resolveName(e){return EE(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if((0,nE.isHexString)(e))throw n}"string"!==typeof e&&_E.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return EE(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(t,"lookupAddress");if(null==n)return null;const r=UE(yield this.call({to:n,data:"0x691f3431"+(0,lE.VM)(t).substring(2)}),0);return(yield this.resolveName(r))!=e?null:r}))}getAvatar(e){return EE(this,void 0,void 0,(function*(){let t=null;if((0,nE.isHexString)(e)){const n=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(n,"getAvatar");if(!i)return null;t=new HE(this,i,n);try{const e=yield t.getAvatar();if(e)return e.url}catch(r){if(r.code!==QA.Logger.errors.CALL_EXCEPTION)throw r}try{const e=UE(yield this.call({to:i,data:"0x691f3431"+(0,lE.VM)(n).substring(2)}),0);t=yield this.getResolver(e)}catch(r){if(r.code!==QA.Logger.errors.CALL_EXCEPTION)throw r;return null}}else if(t=yield this.getResolver(e),!t)return null;const n=yield t.getAvatar();return null==n?null:n.url}))}perform(e,t){return _E.throwError(e+" not implemented",QA.Logger.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,n){const r=new OE(kE(e),t,n);return this._events.push(r),this._startEvent(r),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let n=!1,r=[],i=kE(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),n=!0,!e.once||(r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),n}listenerCount(e){if(!e)return this._events.length;let t=kE(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=kE(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const n=[];let r=!1,i=kE(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!r||(r=!0,n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const n=kE(e);this._events=this._events.filter((e=>e.tag!==n||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var KE=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const XE=new QA.Logger($A),YE=["call","estimateGas"];function JE(e,t){if(null==e)return null;if("string"===typeof e.message&&e.message.match("reverted")){const n=(0,nE.isHexString)(e.data)?e.data:null;if(!t||n)return{message:e.message,data:n}}if("object"===typeof e){for(const n in e){const r=JE(e[n],t);if(r)return r}return null}if("string"===typeof e)try{return JE(JSON.parse(e),t)}catch(n){}return null}function QE(e,t,n){const r=n.transaction||n.signedTransaction;if("call"===e){const e=JE(t,!0);if(e)return e.data;XE.throwError("missing revert data in call exception; Transaction reverted without a reason string",QA.Logger.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:t})}if("estimateGas"===e){let n=JE(t.body,!1);null==n&&(n=JE(t,!1)),n&&XE.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",QA.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:e,transaction:r,error:t})}let i=t.message;throw t.code===QA.Logger.errors.SERVER_ERROR&&t.error&&"string"===typeof t.error.message?i=t.error.message:"string"===typeof t.body?i=t.body:"string"===typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&XE.throwError("insufficient funds for intrinsic transaction cost",QA.Logger.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/nonce (is )?too low/i)&&XE.throwError("nonce has already been used",QA.Logger.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&XE.throwError("replacement fee too low",QA.Logger.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/only replay-protected/i)&&XE.throwError("legacy pre-eip-155 transactions not supported",QA.Logger.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:r}),YE.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&XE.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",QA.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}function $E(e){return new Promise((function(t){setTimeout(t,e)}))}function e_(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function t_(e){return e?e.toLowerCase():e}const n_={};class r_ extends eE.E{constructor(e,t,n){if(super(),e!==n_)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,JA.defineReadOnly)(this,"provider",t),null==n&&(n=0),"string"===typeof n?((0,JA.defineReadOnly)(this,"_address",this.provider.formatter.address(n)),(0,JA.defineReadOnly)(this,"_index",null)):"number"===typeof n?((0,JA.defineReadOnly)(this,"_index",n),(0,JA.defineReadOnly)(this,"_address",null)):XE.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return XE.throwError("cannot alter JSON-RPC Signer connection",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new i_(n_,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&XE.throwError("unknown account #"+this._index,QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=(0,JA.shallowCopy)(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const n=(0,JA.shallowCopy)(e);n.from=t,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>KE(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&XE.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),(0,JA.resolveProperties)({tx:(0,JA.resolveProperties)(e),sender:t}).then((({tx:t,sender:n})=>{null!=t.from?t.from.toLowerCase()!==n&&XE.throwArgumentError("from address mismatch","transaction",e):t.from=n;const r=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((e=>e),(e=>("string"===typeof e.message&&e.message.match(/user denied/i)&&XE.throwError("user rejected transaction",QA.Logger.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),QE("sendTransaction",e,r))))}))}signTransaction(e){return XE.throwError("signing transactions is unsupported",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return KE(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield(0,oE.poll)((()=>KE(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(n);if(null!==e)return this.provider._wrapTransaction(e,n,t)}))),{oncePoll:this.provider})}catch(r){throw r.transactionHash=n,r}}))}signMessage(e){return KE(this,void 0,void 0,(function*(){const t="string"===typeof e?(0,iE.Y0)(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[(0,nE.hexlify)(t),n.toLowerCase()])}catch(r){throw"string"===typeof r.message&&r.message.match(/user denied/i)&&XE.throwError("user rejected signing",QA.Logger.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),r}}))}_legacySignMessage(e){return KE(this,void 0,void 0,(function*(){const t="string"===typeof e?(0,iE.Y0)(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),(0,nE.hexlify)(t)])}catch(r){throw"string"===typeof r.message&&r.message.match(/user denied/i)&&XE.throwError("user rejected signing",QA.Logger.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),r}}))}_signTypedData(e,t,n){return KE(this,void 0,void 0,(function*(){const r=yield rE.E.resolveNames(e,t,n,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(rE.E.getPayload(r.domain,t,r.value))])}catch(o){throw"string"===typeof o.message&&o.message.match(/user denied/i)&&XE.throwError("user rejected signing",QA.Logger.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:t,value:r.value}}),o}}))}unlock(e){return KE(this,void 0,void 0,(function*(){const t=this.provider,n=yield this.getAddress();return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])}))}}class i_ extends r_{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const o_={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class s_ extends ZE{constructor(e,t){let n=t;null==n&&(n=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(n),e||(e=(0,JA.getStatic)(this.constructor,"defaultUrl")()),"string"===typeof e?(0,JA.defineReadOnly)(this,"connection",Object.freeze({url:e})):(0,JA.defineReadOnly)(this,"connection",Object.freeze((0,JA.shallowCopy)(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return KE(this,void 0,void 0,(function*(){yield $E(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(t){}}if(null!=e){const n=(0,JA.getStatic)(this.constructor,"getNetwork");try{return n(tE.O$.from(e).toNumber())}catch(t){return XE.throwError("could not detect network",QA.Logger.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return XE.throwError("could not detect network",QA.Logger.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new r_(n_,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,JA.deepCopy)(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const i=(0,oE.fetchJson)(this.connection,JSON.stringify(n),e_).then((e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e}));return r&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[t_(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[t_(t.address),t.blockTag]];case"getCode":return["eth_getCode",[t_(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[t_(t.address),(0,nE.hexZeroPad)(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[(0,JA.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,JA.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=t_(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return KE(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&tE.O$.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((t=(0,JA.shallowCopy)(t)).transaction=(0,JA.shallowCopy)(e),delete t.transaction.type)}}const n=this.prepareRequest(e,t);null==n&&XE.throwError(e+" not implemented",QA.Logger.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(r){return QE(e,r,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function r(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;let r=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",r=r.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),r.then((function(){return $E(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){r()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((e=>{}))}(),n})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const n=(0,JA.shallowCopy)(o_);if(t)for(const i in t)t[i]&&(n[i]=!0);(0,JA.checkProperties)(e,n);const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const n=(0,nE.hexValue)(tE.O$.from(e[t]));"gasLimit"===t&&(t="gas"),r[t]=n})),["from","to","data"].forEach((function(t){null!=e[t]&&(r[t]=(0,nE.hexlify)(e[t]))})),e.accessList&&(r.accessList=(0,ch.accessListify)(e.accessList)),r}}const a_=new QA.Logger($A);let c_=1;function u_(e,t){const n="Web3LegacyFetcher";return function(e,r){const i={method:e,params:r,id:c_++,jsonrpc:"2.0"};return new Promise(((e,r)=>{this.emit("debug",{action:"request",fetcher:n,request:(0,JA.deepCopy)(i),provider:this}),t(i,((t,o)=>{if(t)return this.emit("debug",{action:"response",fetcher:n,error:t,request:i,provider:this}),r(t);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const e=new Error(o.error.message);return e.code=o.error.code,e.data=o.error.data,r(e)}e(o.result)}))}))}}class l_ extends s_{constructor(e,t){null==e&&a_.throwArgumentError("missing provider","provider",e);let n=null,r=null,i=null;"function"===typeof e?(n="unknown:",r=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),i=e,e.request?(""===n&&(n="eip-1193:"),r=function(e){return function(t,n){null==n&&(n=[]);const r={method:t,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,JA.deepCopy)(r),provider:this}),e.request(r).then((e=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:e,provider:this}),e}))}}(e)):e.sendAsync?r=u_(0,e.sendAsync.bind(e)):e.send?r=u_(0,e.send.bind(e)):a_.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,t),(0,JA.defineReadOnly)(this,"jsonRpcFetchFunc",r),(0,JA.defineReadOnly)(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}function d_(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var f_=function(e){L(n,e);var t=d_(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o{t=e})).catch(console.error),()=>{t&&h_("pub(accounts.unsubscribe)",{id:t}).catch(console.error)}}}class m_{constructor(e){p_=e}get(){return p_("pub(metadata.list)")}provide(e){return p_("pub(metadata.provide)",e)}}var b_=n(64992),y_=n(98278),v_=n(58373);const w_=(0,b_.k)("PostMessageProvider");let x_,S_;class A_{#e;#t=!1;#n={};constructor(e){this.#e=new v_,x_=e}get isClonable(){return!0}clone(){return new A_(x_)}async connect(){console.error("PostMessageProvider.disconnect() is not implemented.")}async disconnect(){console.error("PostMessageProvider.disconnect() is not implemented.")}get hasSubscriptions(){return!0}get isConnected(){return this.#t}listProviders(){return x_("pub(rpc.listProviders)",void 0)}on(e,t){return this.#e.on(e,t),()=>{this.#e.removeListener(e,t)}}async send(e,t,n,r){if(r){const{callback:n,type:i}=r,o=await x_("pub(rpc.subscribe)",{method:e,params:t,type:i},(e=>{r.callback(null,e)}));return this.#n[`${i}::${o}`]=n,o}return x_("pub(rpc.send)",{method:e,params:t})}async startProvider(e){this.#t=!1,this.#e.emit("disconnected");const t=await x_("pub(rpc.startProvider)",e);return x_("pub(rpc.subscribeConnected)",null,(e=>(this.#t=e,e?this.#e.emit("connected"):this.#e.emit("disconnected"),!0))),t}subscribe(e,t,n,r){return this.send(t,n,!1,{callback:r,type:e})}async unsubscribe(e,t,n){const r=`${e}::${n}`;return(0,y_.o)(this.#n[r])?(w_.debug((()=>`Unable to find active subscription=${r}`)),!1):(delete this.#n[r],this.send(t,[n]))}}let E_=0;class __{constructor(e){S_=e}async signPayload(e){const t=++E_;return{...await S_("pub(extrinsic.sign)",e),id:t}}async signRaw(e){const t=++E_;return{...await S_("pub(bytes.sign)",e),id:t}}}let C_=0;const I_={};function k_(e,t,n){if(self===parent)throw new Error("Please open on mimir wallet");return new Promise(((r,i)=>{const o=`mimir-wallet.${Date.now()}.${++C_}`;I_[o]={reject:i,resolve:r,subscriber:n};const s={id:o,message:e,origin:"mimir-walletdapp",request:t||null};parent.postMessage(s,"*")}))}async function T_(e){return await k_("pub(authorize.tab)",{origin:e}),new class{constructor(e){this.accounts=new g_(e),this.metadata=new m_(e),this.provider=new A_(e),this.signer=new __(e),setInterval((()=>{e("pub(ping)",null).catch((()=>{console.error("Extension unavailable, ping failed")}))}),1e4+Math.floor(1e4*Math.random()))}}(k_)}function M_({data:e,source:t},n=null){const r=!e,i=t===parent;let o=!0;return Array.isArray(n)&&(o=void 0!==n.find((e=>e.test(origin)))),!r&&i&&o&&"mimir-walletwallet"===e.origin}const P_="0.2.1";function O_(){self!==parent&&(window.addEventListener("message",(e=>{if(M_(e)){const{data:t}=e;t.id?function(e){const t=I_[e.id];t?(t.subscriber||delete I_[e.id],e.subscription?t.subscriber(e.subscription):e.error?t.reject(new Error(e.error)):t.resolve(e.response)):console.error(`Unknown response: ${JSON.stringify(e)}`)}(t):console.error("Missing id for response.")}})),function(e,{name:t,version:n}){const r=window;r.injectedWeb3=r.injectedWeb3||{},r.injectedWeb3[t]={enable:t=>e(t),version:n}}(T_,{name:"mimir",version:P_}))}const R_=/^https:\/\/.*\.mimir\.global.*$/;var N_=n(51787);function B_(e){return e&&function(e){return!!e&&(0,N_.vq)(e,-1)}(e)?e:`0x${e&&e.length%2===1?"0":""}${e||""}`}var L_=n(39411);function D_(e,t=-1){const n=(!e||Number.isNaN(e)?0:e).toString(16);return function(e,t=-1,n=!1){const r=Math.ceil(t/4),i=r+2;return B_(-1===t||e.length===i||!n&&e.lengthi?(0,L_.V)(e).slice(-1*r):`${"0".repeat(r)}${(0,L_.V)(e)}`.slice(-1*r))}(n.length%2?`0${n}`:n,t,!0)}var U_=n(249),j_=n(65716),F_=n(53836),V_=n(5442);const q_=(0,j_.Y)("\x19Ethereum Signed Message:\n"),z_=(0,j_.Y)(""),H_=(0,j_.Y)(""),W_=z_.length+H_.length;function G_(e,t){return e.length>=W_&&(0,V_.S)(e.subarray(0,z_.length),z_)&&(0,V_.S)(e.slice(-H_.length),H_)||t&&e.length>=q_.length&&(0,V_.S)(e.subarray(0,q_.length),q_)}var Z_=n(89048),K_=n(50780),X_=n(87286);function Y_(e,t,n,r){const i=(0,j_.Y)(e),o=(0,j_.Y)(n),s=(0,j_.Y)(t);if(32!==o.length)throw new Error(`Invalid publicKey, received ${o.length}, expected 32`);if(64!==s.length)throw new Error(`Invalid signature, received ${s.length} bytes, expected 64`);return!r&&(0,X_.DK)()?(0,X_.B8)(s,i,o):K_.sign.detached.verify(i,s,o)}var J_=n(63848),Q_=n(20086);function $_(e,t,n){return"keccak"===e?(0,Q_.ij)(t,void 0,n):(0,J_.b)(t,void 0,void 0,n)}var eC=n(27760),tC=n(98657);var nC=n(94019);function rC(e,t,n,r="blake2",i){const o=(0,j_.Y)(t).subarray(0,64),s=(0,j_.Y)(e),a=!tC.vc||!i&&(0,X_.DK)()?(0,X_.WH)(s,o,n):(0,eC.LO)(s,eC.Pc.fromCompact(o).toRawBytes(),n);if(!a)throw new Error("Unable to recover publicKey from signature");return"keccak"===r?(0,nC.o)(a,i):function(e,t){if(33===e.length)return e;if(65!==e.length)throw new Error("Invalid publicKey provided");return!tC.vc||!t&&(0,X_.DK)()?(0,X_.RI)(e):eC.E9.fromHex(e).toRawBytes(!0)}(a,i)}function iC(e,t,n){const r=(0,j_.Y)(n),i=(0,j_.Y)(t);if(32!==r.length)throw new Error(`Invalid publicKey, received ${r.length} bytes, expected 32`);if(64!==i.length)throw new Error(`Invalid signature, received ${i.length} bytes, expected 64`);return(0,X_.QK)(i,(0,j_.Y)(e),r)}const oC=e=>(t,n,r)=>function(e,t,n,r="blake2",i){const o=(0,j_.Y)(t);if(65!==o.length)throw new Error(`Expected signature with 65 bytes, ${o.length} found instead`);const s=rC($_(r,e),o,o[64],r,i),a=$_(r,s,i),c=(0,j_.Y)(n);return(0,V_.S)(s,c)||("keccak"===r?(0,V_.S)(a.slice(-20),c.slice(-20)):(0,V_.S)(a,c))}(t,n,r,e),sC=[["ecdsa",oC("blake2")],["ethereum",oC("keccak")]],aC=[["ed25519",Y_],["sr25519",iC],...sC],cC=["ed25519","sr25519","ecdsa"];function uC(e,{message:t,publicKey:n,signature:r},i=aC){return e.isValid=i.some((([i,o])=>{try{if(o(t,r,n))return e.crypto=i,!0}catch(s){}return!1})),e}function lC(e,{message:t,publicKey:n,signature:r}){if(![0,1,2].includes(r[0]))throw new Error(`Unknown crypto type, expected signature prefix [0..2], found ${r[0]}`);const i=cC[r[0]]||"none";e.crypto=i;try{e.isValid={ecdsa:()=>uC(e,{message:t,publicKey:n,signature:r.subarray(1)},sC).isValid,ed25519:()=>Y_(t,r.subarray(1),n),none:()=>{throw Error("no verify for `none` crypto type")},sr25519:()=>iC(t,r.subarray(1),n)}[i]()}catch(o){}return e}function dC(e,t,n){const r=(0,j_.Y)(t);if(![64,65,66].includes(r.length))throw new Error(`Invalid signature length, expected [64..66] bytes, found ${r.length}`);const i=(0,Z_.m)(n),o={message:(0,j_.Y)(e),publicKey:i,signature:r},s={crypto:"none",isValid:!1,isWrapped:G_(o.message,!0),publicKey:i},a=G_(o.message,!1),c=function(e){return[0,1,2].includes(e[0])&&[65,66].includes(e.length)?lC:uC}(r);return c(s,o),"none"!==s.crypto||s.isWrapped&&!a?s:(o.message=a?function(e){const t=(0,j_.Y)(e);return G_(t,!1)?t.subarray(z_.length,t.length-H_.length):t}(o.message):function(e){const t=(0,j_.Y)(e);return G_(t,!0)?t:(0,F_.d)([z_,t,H_])}(o.message),c(s,o))}var fC=n(5320);function hC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pC(e){for(var t=1;t{if(self===parent)return void e(null);const t=n=>{M_(n)&&(e(n.origin),window.removeEventListener("message",t))};window.addEventListener("message",t),k_("pub(ping)",null)})),new Promise((e=>setTimeout((()=>e(null)),300)))]);case 7:i=e.sent,console.info("initMimir:origin",i),i&&R_.test(i)&&(O_(),this.provider=window.injectedWeb3.mimir,console.info("inject:",window.injectedWeb3));case 10:return this.isInit=!0,e.next=13,N(R(n.prototype),"init",this).call(this,t);case 13:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"fetchAccounts",value:function(){var e=(0,w.Z)(A().mark((function e(){var t;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.enable();case 3:return e.next=5,this.wallet.accounts.get(!0);case 5:return t=e.sent,e.abrupt("return",t.map((function(e){return e.address})));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",[]);case 12:case"end":return e.stop()}}),e,this,[[0,9]])})));return function(){return e.apply(this,arguments)}}()},{key:"connect",value:function(){var e=(0,w.Z)(A().mark((function e(){var t;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isConnected){e.next=10;break}if(this.provider){e.next=5;break}window.open("https://app.mimir.global","_blank"),e.next=10;break;case 5:return e.next=7,this.fetchAccounts();case 7:t=e.sent,this.account=t[0],this.isConnected=!0;case 10:return e.abrupt("return",{account:this.account,wallet:"mimir"});case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"enable",value:function(){var e=(0,w.Z)(A().mark((function e(){var t;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.provider.enable("crust files");case 3:if(t=e.sent,console.info("mimir:enable",t),t){e.next=7;break}return e.abrupt("return",!1);case 7:return this.wallet=pC(pC({},t),{},{name:"mimir",version:this.provider.version}),e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(0),console.error("mimir:",e.t0),e.abrupt("return",!1);case 15:case"end":return e.stop()}}),e,this,[[0,11]])})));return function(){return e.apply(this,arguments)}}()},{key:"sign",value:function(){var e=(0,w.Z)(A().mark((function e(t,n){var r,i,o,s,a,c,u,l,d,f,h,p,g;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.provider){e.next=2;break}throw"Error: no wallet";case 2:if(this.wallet.signer){e.next=4;break}throw"Error: wallet error no signer";case 4:return e.next=6,(0,fC.o)();case 6:return r=e.sent,e.next=9,this.fetchAccounts();case 9:return i=e.sent,o=n||i[0],s=r.tx.system.remark("Signature for CrustFiles"),e.next=14,mC(r,o);case 14:return a=e.sent,c=a.signOptions,e.next=18,this.wallet.signer.signPayload({address:o,blockHash:c.blockHash,genesisHash:c.genesisHash,blockNumber:"0x0",era:c.era.toHex(),method:s.inner.method.toHex(),nonce:c.nonce.toHex(),tip:D_(c.tip),specVersion:c.runtimeVersion.toHex(),transactionVersion:c.runtimeVersion.toHex(),signedExtensions:c.signedExtensions,version:4});case 18:return u=e.sent,console.info("mimir:res:",u),l=u.payload,d=r.registry.createType("ExtrinsicEra",l.era),f=r.registry.createType("GenericCall",l.method),console.info("method:",f.toHex()==l.method,f.toHex(),l.method,s.inner.method.toHex()),console.info("era:",d.toHex(),l.era),h=s.inner.signature.createPayload(f,{era:d,blockHash:l.blockHash,genesisHash:l.genesisHash,nonce:l.nonce,runtimeVersion:c.runtimeVersion}),p=h.toU8a({method:!0}),g=(0,U_.c)(p.length>256?r.registry.hash(p):p),e.abrupt("return",g+":"+u.signature);case 29:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"login",value:function(){var e=(0,w.Z)(A().mark((function e(t){var n,r,i,o,s,a,c,u,l,d,f,h,p,g,m,b,y,v,w,x,S,E;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetchAccounts();case 2:if(0!=(n=e.sent).length){e.next=5;break}throw"Error: no account";case 5:if(console.info("mimir:accounts",n),!(t&&t.account&&"mimir"==t.wallet&&n.includes(t.account))){e.next=10;break}return e.abrupt("return",[n,t]);case 10:if(!n.length){e.next=43;break}return e.next=13,(0,fC.o)();case 13:return r=e.sent,i=n[0],o=r.tx.system.remark("Signature for CrustFiles"),e.next=18,mC(r,i);case 18:return s=e.sent,a=s.signOptions,e.next=22,this.wallet.signer.signPayload({address:i,blockHash:a.blockHash,genesisHash:a.genesisHash,blockNumber:"0x0",era:a.era.toHex(),method:o.inner.method.toHex(),nonce:a.nonce.toHex(),tip:D_(a.tip),specVersion:a.runtimeVersion.toHex(),transactionVersion:a.runtimeVersion.toHex(),signedExtensions:a.signedExtensions,version:4});case 22:return c=e.sent,console.info("mimir:res:",c),u=c.payload,l=r.registry.createType("ExtrinsicEra",u.era),d=r.registry.createType("GenericCall",u.method),f=u.address,console.info("method:",d.toHex()==u.method,d.toHex(),u.method,o.inner.method.toHex()),console.info("era:",l.toHex(),u.era),h=o.inner.signature.createPayload(d,{era:l,blockHash:u.blockHash,genesisHash:u.genesisHash,nonce:u.nonce,runtimeVersion:a.runtimeVersion}),p=h.toU8a({method:!0}),g=(0,U_.c)(p.length>256?r.registry.hash(p):p),m=c.signature,b=(0,z.WJ)({wallet:"mimir",account:i}),y="".concat(b,"-").concat(f,"-").concat(g,":").concat(m),v=window.btoa(y),w="".concat(v),x="".concat(v),S={wallet:"mimir",account:i,authBasic:w,authBearer:x,signature:m},E=dC(g,m,f),console.info("mimir:valid",E.isValid),e.abrupt("return",[n,S]);case 43:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),n}(F.cC);function vC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wC(e){for(var t=1;te.message.includes("pending authorization request")?new OC(e.message,this):e,this.enable=e=>MC(this,void 0,void 0,(function*(){if(!e)throw new Error("MissingParamsError: Dapp name is required.");if(!this.installed)throw new RC(`Refresh the browser if ${this.title} is already installed.`,this);try{const t=this.rawExtension,n=yield null===t||void 0===t?void 0:t.enable(e);if(!n)throw new RC(`${this.title} is installed but is not returned by the 'Wallet.enable(dappname)' function`,this);const r=Object.assign(Object.assign({},n),{name:this.extensionName,version:t.version});this._extension=r,this._signer=null===r||void 0===r?void 0:r.signer}catch(t){throw this.transformError(t)}})),this.getAccounts=e=>MC(this,void 0,void 0,(function*(){if(!this._extension)throw new RC("The 'Wallet.enable(dappname)' function should be called first.",this);const t=(yield this._extension.accounts.get(e)).map((e=>{var t,n;return Object.assign(Object.assign({},e),{source:null===(t=this._extension)||void 0===t?void 0:t.name,wallet:this,signer:null===(n=this._extension)||void 0===n?void 0:n.signer})}));return t})),this.subscribeAccounts=e=>MC(this,void 0,void 0,(function*(){if(!this._extension)throw new RC("The 'Wallet.enable(dappname)' function should be called first.",this);const t=this._extension.accounts.subscribe((t=>{const n=t.map((e=>{var t,n;return Object.assign(Object.assign({},e),{source:null===(t=this._extension)||void 0===t?void 0:t.name,wallet:this,signer:null===(n=this._extension)||void 0===n?void 0:n.signer})}));e(n)}));return t}))}get extension(){return this._extension}get signer(){return this._signer}get installed(){var e;const t=window;return!!(null===(e=null===t||void 0===t?void 0:t.injectedWeb3)||void 0===e?void 0:e[this.extensionName])}get rawExtension(){var e;const t=window;return null===(e=null===t||void 0===t?void 0:t.injectedWeb3)||void 0===e?void 0:e[this.extensionName]}}const BC=[new class extends NC{constructor(){super(...arguments),this.extensionName="talisman",this.title="Talisman",this.installUrl="https://talisman.xyz/download",this.noExtensionMessage="You can use any Polkadot compatible wallet but we recommend using Talisman",this.logo={src:"data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22%23D5FF5C%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M16.5349%2012.9159C16.6871%2013.2472%2017.135%2013.3643%2017.3929%2013.1065L17.8651%2012.6345C18.3535%2012.1464%2019.1453%2012.1464%2019.6337%2012.6345C20.1221%2013.1227%2020.1221%2013.9141%2019.6337%2014.4023L15.8097%2018.2246C14.8921%2019.3104%2013.5198%2020%2011.9865%2020C10.3851%2020%208.95942%2019.2478%208.04385%2018.0777L4.36629%2014.4018C3.87791%2013.9136%203.87791%2013.1222%204.36629%2012.634C4.85467%2012.1459%205.64649%2012.1459%206.13487%2012.634L6.60044%2013.0994C6.85253%2013.3514%207.29002%2013.238%207.43894%2012.9141V12.9141C7.46838%2012.8501%207.48439%2012.7814%207.48439%2012.711L7.48438%207.00059C7.48438%206.30991%208.04428%205.75001%208.73496%205.75001C9.42563%205.75001%209.98553%206.30991%209.98553%207.00058L9.98553%209.88892C9.98553%2010.1376%2010.2403%2010.3065%2010.4774%2010.2315V10.2315C10.6276%2010.1841%2010.736%2010.0474%2010.736%209.89001L10.736%205.25041C10.736%204.55974%2011.2959%203.99984%2011.9866%203.99984C12.6773%203.99984%2013.2372%204.55974%2013.2372%205.25041L13.2372%209.89018C13.2372%2010.0476%2013.3456%2010.1842%2013.4957%2010.2316V10.2316C13.7327%2010.3065%2013.9874%2010.1377%2013.9874%209.88909L13.9874%207.00059C13.9874%206.30991%2014.5473%205.75001%2015.2379%205.75001C15.9286%205.75001%2016.4885%206.30991%2016.4885%207.00058L16.4885%2012.7086C16.4885%2012.7805%2016.5049%2012.8506%2016.5349%2012.9159V12.9159Z%22%20fill%3D%22%23FD4848%22%2F%3E%3Cpath%20d%3D%22M15.9885%2015.5C15.9885%2015.5%2014.1969%2018%2011.9867%2018C9.77655%2018%207.98486%2015.5%207.98486%2015.5C7.98486%2015.5%209.77655%2013%2011.9867%2013C14.1969%2013%2015.9885%2015.5%2015.9885%2015.5Z%22%20fill%3D%22%23D5FF5C%22%2F%3E%3Cpath%20d%3D%22M13.8543%2015.5C13.8543%2016.5311%2013.018%2017.3671%2011.9863%2017.3671C10.9545%2017.3671%2010.1183%2016.5311%2010.1183%2015.5C10.1183%2014.4689%2010.9545%2013.6329%2011.9863%2013.6329C13.018%2013.6329%2013.8543%2014.4689%2013.8543%2015.5Z%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cpath%20d%3D%22M13.1041%2015.5C13.1041%2016.1169%2012.6037%2016.6171%2011.9864%2016.6171C11.3691%2016.6171%2010.8688%2016.1169%2010.8688%2015.5C10.8688%2014.8831%2011.3691%2014.3829%2011.9864%2014.3829C12.6037%2014.3829%2013.1041%2014.8831%2013.1041%2015.5Z%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cpath%20d%3D%22M14.605%2015.5C14.605%2016.9453%2013.4327%2018.1171%2011.9866%2018.1171C10.5405%2018.1171%209.36827%2016.9453%209.36827%2015.5C9.36827%2014.0547%2010.5405%2012.8829%2011.9866%2012.8829C13.4327%2012.8829%2014.605%2014.0547%2014.605%2015.5Z%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cpath%20d%3D%22M15.3552%2015.5C15.3552%2017.3595%2013.847%2018.8671%2011.9865%2018.8671C10.1259%2018.8671%208.61778%2017.3595%208.61778%2015.5C8.61778%2013.6405%2010.1259%2012.1329%2011.9865%2012.1329C13.847%2012.1329%2015.3552%2013.6405%2015.3552%2015.5Z%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cpath%20d%3D%22M12.3534%2015.5C12.3534%2015.7027%2012.1891%2015.8671%2011.9863%2015.8671C11.7836%2015.8671%2011.6192%2015.7027%2011.6192%2015.5C11.6192%2015.2973%2011.7836%2015.1329%2011.9863%2015.1329C12.1891%2015.1329%2012.3534%2015.2973%2012.3534%2015.5Z%22%20fill%3D%22%23162BEB%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cellipse%20cx%3D%2211.9863%22%20cy%3D%2215.5%22%20rx%3D%220.5%22%20ry%3D%220.5%22%20fill%3D%22%23FD4848%22%2F%3E%3Cmask%20id%3D%22path-10-inside-1_4684_17034%22%20fill%3D%22white%22%3E%3Cpath%20d%3D%22M15.9885%2015.5C15.9885%2015.5%2014.1969%2018%2011.9867%2018C9.77655%2018%207.98486%2015.5%207.98486%2015.5C7.98486%2015.5%209.77655%2013%2011.9867%2013C14.1969%2013%2015.9885%2015.5%2015.9885%2015.5Z%22%2F%3E%3C%2Fmask%3E%3Cpath%20d%3D%22M15.9885%2015.5C15.9885%2015.5%2014.1969%2018%2011.9867%2018C9.77655%2018%207.98486%2015.5%207.98486%2015.5C7.98486%2015.5%209.77655%2013%2011.9867%2013C14.1969%2013%2015.9885%2015.5%2015.9885%2015.5Z%22%20stroke%3D%22%23D5FF5C%22%20stroke-width%3D%220.531663%22%20mask%3D%22url%28%23path-10-inside-1_4684_17034%29%22%2F%3E%3C%2Fsvg%3E",alt:"Talisman Logo"}}},new class extends NC{constructor(){super(...arguments),this.extensionName="subwallet-js",this.title="SubWallet",this.installUrl="https://chrome.google.com/webstore/detail/subwallet/onhogfjeacnfoofkfgppdlbmlmnplgbn?hl=en&authuser=0",this.noExtensionMessage="You can use any Polkadot compatible wallet but we recommend using Talisman",this.logo={src:"data:image/svg+xml,%3Csvg%20width%3D%22134%22%20height%3D%22134%22%20viewBox%3D%220%200%20134%20134%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cmask%20id%3D%22mask0_699_5101%22%20style%3D%22mask-type%3Aalpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%22134%22%20height%3D%22134%22%3E%3Crect%20width%3D%22134%22%20height%3D%22134%22%20fill%3D%22%23C4C4C4%22%2F%3E%3C%2Fmask%3E%3Cg%20mask%3D%22url%28%23mask0_699_5101%29%22%3E%3Cpath%20d%3D%22M87.9615%2064.3201L87.9456%2047.7455L27.1191%2016.2236V64.3041L66.0589%2085.106L80.2884%2078.8367L37.4403%2056.1046L37.4722%2037.887L87.9615%2064.3201Z%22%20fill%3D%22url%28%23paint0_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M50.7607%2044.8421V50.5052L37.3926%2056.2321L37.4883%2037.6636L50.7607%2044.8421Z%22%20fill%3D%22url%28%23paint1_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M50.8095%2091.822L80.2895%2078.8368L37.4414%2056.2163L50.6819%2050.5054L105.765%2079.2835L50.9212%20103.212L50.8095%2091.822Z%22%20fill%3D%22url%28%23paint2_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M37.4886%2087.9773L50.6493%2082.2982L50.9365%20103.196L105.765%2079.2832V97.118L37.377%20127.077L37.4886%2087.9773Z%22%20fill%3D%22url%28%23paint3_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M27.1191%2082.5857L37.4403%2087.9776L37.3765%20127.013L27.1191%20121.86V82.5857Z%22%20fill%3D%22url%28%23paint4_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M40.1522%2076.7791L50.6489%2082.2986L37.4403%2087.9776L27.1191%2082.5857L40.1522%2076.7791Z%22%20fill%3D%22url%28%23paint5_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M105.765%2056.5993L105.702%2039.9131L87.9785%2047.7457V64.3362L105.765%2056.5993Z%22%20fill%3D%22url%28%23paint6_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M27.1191%2016.2237L45.0337%207.97632L105.732%2039.8811L87.9775%2047.7456L27.1191%2016.2237Z%22%20fill%3D%22url%28%23paint7_linear_699_5101%29%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22paint0_linear_699_5101%22%20x1%3D%2211.9006%22%20y1%3D%2250.6648%22%20x2%3D%22119.372%22%20y2%3D%2250.6648%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23FFD4B2%22%2F%3E%3Cstop%20offset%3D%220.36%22%20stop-color%3D%22%239ACEB7%22%2F%3E%3Cstop%20offset%3D%220.67%22%20stop-color%3D%22%2347C8BB%22%2F%3E%3Cstop%20offset%3D%220.89%22%20stop-color%3D%22%2314C5BE%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%2300C4BF%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear_699_5101%22%20x1%3D%2244.0766%22%20y1%3D%2262.8524%22%20x2%3D%2244.0766%22%20y2%3D%2221.2167%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%2300FECF%22%2F%3E%3Cstop%20offset%3D%220.08%22%20stop-color%3D%22%2300E5D0%22%2F%3E%3Cstop%20offset%3D%220.24%22%20stop-color%3D%22%2300A5D1%22%2F%3E%3Cstop%20offset%3D%220.48%22%20stop-color%3D%22%230040D4%22%2F%3E%3Cstop%20offset%3D%220.54%22%20stop-color%3D%22%230025D5%22%2F%3E%3Cstop%20offset%3D%221%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear_699_5101%22%20x1%3D%2237.4414%22%20y1%3D%2276.8587%22%20x2%3D%22146.891%22%20y2%3D%2276.8587%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23FDEC9F%22%2F%3E%3Cstop%20offset%3D%220.08%22%20stop-color%3D%22%23E4D8A4%22%2F%3E%3Cstop%20offset%3D%220.24%22%20stop-color%3D%22%23A4A6B2%22%2F%3E%3Cstop%20offset%3D%220.47%22%20stop-color%3D%22%233F57C8%22%2F%3E%3Cstop%20offset%3D%220.61%22%20stop-color%3D%22%230025D5%22%2F%3E%3Cstop%20offset%3D%221%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear_699_5101%22%20x1%3D%2215.0596%22%20y1%3D%22103.18%22%20x2%3D%22155.01%22%20y2%3D%22103.18%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20offset%3D%220.05%22%20stop-color%3D%22%2362A5FF%22%2F%3E%3Cstop%20offset%3D%220.45%22%20stop-color%3D%22%231032D1%22%2F%3E%3Cstop%20offset%3D%221%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint4_linear_699_5101%22%20x1%3D%22628.741%22%20y1%3D%223244.93%22%20x2%3D%22797.782%22%20y2%3D%223247.12%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23FFD4B2%22%2F%3E%3Cstop%20offset%3D%220.36%22%20stop-color%3D%22%239ACEB7%22%2F%3E%3Cstop%20offset%3D%220.67%22%20stop-color%3D%22%2347C8BB%22%2F%3E%3Cstop%20offset%3D%220.89%22%20stop-color%3D%22%2314C5BE%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%2300C4BF%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint5_linear_699_5101%22%20x1%3D%2224.5987%22%20y1%3D%2282.3783%22%20x2%3D%2272.5834%22%20y2%3D%2282.3783%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%2300FECF%22%2F%3E%3Cstop%20offset%3D%220.08%22%20stop-color%3D%22%2300E5D0%22%2F%3E%3Cstop%20offset%3D%220.25%22%20stop-color%3D%22%2300A5D1%22%2F%3E%3Cstop%20offset%3D%220.49%22%20stop-color%3D%22%230040D4%22%2F%3E%3Cstop%20offset%3D%220.56%22%20stop-color%3D%22%230025D5%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint6_linear_699_5101%22%20x1%3D%2270.9573%22%20y1%3D%2252.5952%22%20x2%3D%22189.069%22%20y2%3D%2250.4576%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%2300FECF%22%2F%3E%3Cstop%20offset%3D%220.05%22%20stop-color%3D%22%2300E5D0%22%2F%3E%3Cstop%20offset%3D%220.15%22%20stop-color%3D%22%2300A5D1%22%2F%3E%3Cstop%20offset%3D%220.29%22%20stop-color%3D%22%230040D4%22%2F%3E%3Cstop%20offset%3D%220.33%22%20stop-color%3D%22%230025D5%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint7_linear_699_5101%22%20x1%3D%2227.1191%22%20y1%3D%2227.8689%22%20x2%3D%22173.642%22%20y2%3D%2227.8689%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23FFD4AF%22%2F%3E%3Cstop%20offset%3D%220.1%22%20stop-color%3D%22%23E6D5BA%22%2F%3E%3Cstop%20offset%3D%220.31%22%20stop-color%3D%22%23A7D6D5%22%2F%3E%3Cstop%20offset%3D%220.61%22%20stop-color%3D%22%2343D9FF%22%2F%3E%3Cstop%20offset%3D%220.63%22%20stop-color%3D%22%2337B1D0%22%2F%3E%3Cstop%20offset%3D%220.65%22%20stop-color%3D%22%232B8CA5%22%2F%3E%3Cstop%20offset%3D%220.67%22%20stop-color%3D%22%23216B7D%22%2F%3E%3Cstop%20offset%3D%220.7%22%20stop-color%3D%22%23184E5B%22%2F%3E%3Cstop%20offset%3D%220.72%22%20stop-color%3D%22%2310353F%22%2F%3E%3Cstop%20offset%3D%220.75%22%20stop-color%3D%22%230A2228%22%2F%3E%3Cstop%20offset%3D%220.78%22%20stop-color%3D%22%23061316%22%2F%3E%3Cstop%20offset%3D%220.82%22%20stop-color%3D%22%23020809%22%2F%3E%3Cstop%20offset%3D%220.88%22%20stop-color%3D%22%23010202%22%2F%3E%3Cstop%20offset%3D%221%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E",alt:"Subwallet Logo"}}},new class extends NC{constructor(){super(...arguments),this.extensionName="polkadot-js",this.title="Polkadot.js",this.noExtensionMessage="You can use any Polkadot compatible wallet but we recommend using Talisman",this.installUrl="https://polkadot.js.org/extension/",this.logo={src:"data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%20standalone%3D%22yes%22%3F%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20id%3D%22Layer_1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%2215%2015%20140%20140%22%20style%3D%22enable-background%3Anew%200%200%20170%20170%3Bzoom%3A%201%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E.bg0%7Bfill%3A%23FF8C00%7D%20.st0%7Bfill%3A%23FFFFFF%7D%3C%2Fstyle%3E%3Cg%3E%3Ccircle%20class%3D%22bg0%22%20cx%3D%2285%22%20cy%3D%2285%22%20r%3D%2270%22%3E%3C%2Fcircle%3E%3Cg%3E%3Cpath%20class%3D%22st0%22%20d%3D%22M85%2C34.7c-20.8%2C0-37.8%2C16.9-37.8%2C37.8c0%2C4.2%2C0.7%2C8.3%2C2%2C12.3c0.9%2C2.7%2C3.9%2C4.2%2C6.7%2C3.3c2.7-0.9%2C4.2-3.9%2C3.3-6.7%20c-1.1-3.1-1.6-6.4-1.5-9.7C58.1%2C57.6%2C69.5%2C46%2C83.6%2C45.3c15.7-0.8%2C28.7%2C11.7%2C28.7%2C27.2c0%2C14.5-11.4%2C26.4-25.7%2C27.2%20c0%2C0-5.3%2C0.3-7.9%2C0.7c-1.3%2C0.2-2.3%2C0.4-3%2C0.5c-0.3%2C0.1-0.6-0.2-0.5-0.5l0.9-4.4L81%2C73.4c0.6-2.8-1.2-5.6-4-6.2%20c-2.8-0.6-5.6%2C1.2-6.2%2C4c0%2C0-11.8%2C55-11.9%2C55.6c-0.6%2C2.8%2C1.2%2C5.6%2C4%2C6.2c2.8%2C0.6%2C5.6-1.2%2C6.2-4c0.1-0.6%2C1.7-7.9%2C1.7-7.9%20c1.2-5.6%2C5.8-9.7%2C11.2-10.4c1.2-0.2%2C5.9-0.5%2C5.9-0.5c19.5-1.5%2C34.9-17.8%2C34.9-37.7C122.8%2C51.6%2C105.8%2C34.7%2C85%2C34.7z%20M87.7%2C121.7%20c-3.4-0.7-6.8%2C1.4-7.5%2C4.9c-0.7%2C3.4%2C1.4%2C6.8%2C4.9%2C7.5c3.4%2C0.7%2C6.8-1.4%2C7.5-4.9C93.3%2C125.7%2C91.2%2C122.4%2C87.7%2C121.7z%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E",alt:"Polkadotjs Logo"}}},new class extends NC{constructor(){super(...arguments),this.extensionName="enkrypt",this.title="Enkrypt",this.installUrl="https://www.enkrypt.com/#overview",this.noExtensionMessage="You can use any Polkadot compatible wallet but we recommend using Talisman",this.logo={src:"data:image/svg+xml,%3Csvg%20id%3D%22Layer_1%22%20data-name%3D%22Layer%201%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20viewBox%3D%220%200%20120%20120%22%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill-rule%3Aevenodd%3Bfill%3Aurl%28%23radial-gradient%29%3B%7D%3C%2Fstyle%3E%3CradialGradient%20id%3D%22radial-gradient%22%20cx%3D%22-164.98%22%20cy%3D%22566.58%22%20r%3D%221%22%20gradientTransform%3D%22matrix%28-15%2C%20136.5%2C%20135.36%2C%2014.88%2C%20-79032.62%2C%2014076.16%29%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%23704bff%22%2F%3E%3Cstop%20offset%3D%220.21%22%20stop-color%3D%22%23c549ff%22%2F%3E%3C%2FradialGradient%3E%3C%2Fdefs%3E%3Ctitle%3Eenkrypt-logo-color%3C%2Ftitle%3E%3Cpath%20class%3D%22cls-1%22%20d%3D%22M0%2C23.09A23.09%2C23.09%2C0%2C0%2C1%2C23.09%2C0H120V17.72a16.6%2C16.6%2C0%2C0%2C1-16.6%2C16.6H57.84A23.09%2C23.09%2C0%2C0%2C0%2C34.75%2C57.41v5.87a23.1%2C23.1%2C0%2C0%2C0%2C23.09%2C23.1H103.4A16.6%2C16.6%2C0%2C0%2C1%2C120%2C103v17H23.09A23.09%2C23.09%2C0%2C0%2C1%2C0%2C96.91ZM58.84%2C44h46.73A14.43%2C14.43%2C0%2C0%2C1%2C120%2C58.4v3.89a14.43%2C14.43%2C0%2C0%2C1-14.43%2C14.43H58.84A14.44%2C14.44%2C0%2C0%2C1%2C44.4%2C62.29V58.4A14.44%2C14.44%2C0%2C0%2C1%2C58.84%2C44Z%22%2F%3E%3C%2Fsvg%3E",alt:"Enkrypt Logo"}}}];function LC(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var DC,UC,jC,FC,VC,qC,zC=function(e){L(n,e);var t=LC(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;oHC.encodeUTF8(n),toObject(){try{return JSON.parse(HC.encodeUTF8(n))}catch(e){return null}},toUint8Array:()=>n}}};function GC(e){let t="";return e.forEach((e=>{t+=("0"+(255&e).toString(16)).slice(-2)})),t}function ZC(e){if(e.length%2!==0)throw new Error(`Cannot convert ${e} to bytesArray`);const t=new Uint8Array(e.length/2);for(let n=0;n=e.length)throw new Error("Index is out of buffer");return[e.slice(0,t),e.slice(t)]}(e,this.nonceLength),i=K_.box.open(r,n,t,this.keyPair.secretKey);if(!i)throw new Error(`Decryption error: \n message: ${e.toString()} \n sender pubkey: ${t.toString()} \n keypair pubkey: ${this.keyPair.publicKey.toString()} \n keypair secretkey: ${this.keyPair.secretKey.toString()}`);return(new TextDecoder).decode(i)}stringifyKeypair(){return{publicKey:GC(this.keyPair.publicKey),secretKey:GC(this.keyPair.secretKey)}}}var XC=n(34155);function YC(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}c((r=r.apply(e,t||[])).next())}))}class JC extends Error{constructor(e,t){super(e,t),this.message=`${JC.prefix} ${this.constructor.name}${this.info?": "+this.info:""}${e?"\n"+e:""}`,Object.setPrototypeOf(this,JC.prototype)}get info(){return""}}JC.prefix="[TON_CONNECT_SDK_ERROR]";class QC extends JC{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,QC.prototype)}}class $C extends JC{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,$C.prototype)}}class eI extends JC{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,eI.prototype)}}class tI extends JC{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,tI.prototype)}}class nI extends JC{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,nI.prototype)}}class rI extends JC{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,rI.prototype)}}class iI extends JC{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,iI.prototype)}}class oI extends JC{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,oI.prototype)}}class sI extends JC{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,sI.prototype)}}class aI extends JC{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,aI.prototype)}}class cI extends JC{get info(){return"Passed address is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,cI.prototype)}}class uI extends JC{get info(){return"Passed hex is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,uI.prototype)}}class lI extends JC{constructor(...e){super(...e),Object.setPrototypeOf(this,lI.prototype)}}const dI={[DC.UNKNOWN_ERROR]:lI,[DC.USER_REJECTS_ERROR]:rI,[DC.BAD_REQUEST_ERROR]:iI,[DC.UNKNOWN_APP_ERROR]:oI,[DC.MANIFEST_NOT_FOUND_ERROR]:eI,[DC.MANIFEST_CONTENT_ERROR]:$C};const fI=new class{parseError(e){let t=lI;return e.code in dI&&(t=dI[e.code]||lI),new t(e.message)}};const hI={[jC.UNKNOWN_ERROR]:lI,[jC.USER_REJECTS_ERROR]:rI,[jC.BAD_REQUEST_ERROR]:iI,[jC.UNKNOWN_APP_ERROR]:oI};const pI=new class extends class{isError(e){return"error"in e}}{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let t=lI;throw e.error.code in hI&&(t=hI[e.error.code]||lI),new t(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}};class gI{constructor(e,t){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+t}storeLastEventId(e){return YC(this,void 0,void 0,(function*(){return this.storage.setItem(this.storeKey,e)}))}removeLastEventId(){return YC(this,void 0,void 0,(function*(){return this.storage.removeItem(this.storeKey)}))}getLastEventId(){return YC(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);return e||null}))}}function mI(e,t){return function(e){return"/"===e.slice(-1)?e.slice(0,-1):e}(e)+"/"+t}function bI(e){if(!e)return!1;const t=new URL(e);return"tg:"===t.protocol||"t.me"===t.hostname}function yI(e){return e.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}function vI(e,t){return YC(this,void 0,void 0,(function*(){return new Promise(((n,r)=>{var i,o;if(null===(i=null===t||void 0===t?void 0:t.signal)||void 0===i?void 0:i.aborted)return void r(new JC("Delay aborted"));const s=setTimeout((()=>n()),e);null===(o=null===t||void 0===t?void 0:t.signal)||void 0===o||o.addEventListener("abort",(()=>{clearTimeout(s),r(new JC("Delay aborted"))}))}))}))}function wI(e){const t=new AbortController;return(null===e||void 0===e?void 0:e.aborted)?t.abort():null===e||void 0===e||e.addEventListener("abort",(()=>t.abort()),{once:!0}),t}function xI(e,t){var n,r;return YC(this,void 0,void 0,(function*(){const i=null!==(n=null===t||void 0===t?void 0:t.attempts)&&void 0!==n?n:10,o=null!==(r=null===t||void 0===t?void 0:t.delayMs)&&void 0!==r?r:200,s=wI(null===t||void 0===t?void 0:t.signal);if("function"!==typeof e)throw new JC("Expected a function, got "+typeof e);let a,c=0;for(;cYC(this,void 0,void 0,(function*(){if(o=null!==a&&void 0!==a?a:null,null===s||void 0===s||s.abort(),s=wI(a),s.signal.aborted)throw new JC("Resource creation was aborted");r=null!==c&&void 0!==c?c:null;const u=e(s.signal,...c);i=u;const l=yield u;if(i!==u&&l!==n)throw yield t(l),new JC("Resource creation was aborted by a new resource creation");return n=l,n}));return{create:a,current:()=>null!==n&&void 0!==n?n:null,dispose:()=>YC(this,void 0,void 0,(function*(){try{const r=n;n=null;const o=i;i=null;try{null===s||void 0===s||s.abort()}catch(e){}yield Promise.allSettled([r?t(r):Promise.resolve(),o?t(yield o):Promise.resolve()])}catch(e){}})),recreate:e=>YC(this,void 0,void 0,(function*(){const t=n,s=i,c=r,u=o;if(yield vI(e),t===n&&s===i&&c===r&&u===o)return yield a(o,...null!==c&&void 0!==c?c:[]);throw new JC("Resource recreation was aborted by a new resource creation")}))}}(((e,t)=>YC(this,void 0,void 0,(function*(){const n={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:e,openingDeadlineMS:t};return yield function(e){return YC(this,void 0,void 0,(function*(){return yield function(e,t){const n=null===t||void 0===t?void 0:t.timeout,r=wI(null===t||void 0===t?void 0:t.signal);return new Promise(((t,i)=>{if(r.signal.aborted)return void i(new JC("Operation aborted"));let o;"undefined"!==typeof n&&(o=setTimeout((()=>{r.abort(),i(new JC(`Timeout after ${n}ms`))}),n)),r.signal.addEventListener("abort",(()=>{clearTimeout(o),i(new JC("Operation aborted"))}),{once:!0});const s={timeout:n,abort:r.signal};e(t,i,s).finally((()=>clearTimeout(o)))}))}(((t,n,r)=>YC(this,void 0,void 0,(function*(){var i;const o=wI(r.signal).signal;if(o.aborted)return void n(new JC("Bridge connection aborted"));const s=new URL(mI(e.bridgeUrl,e.ssePath));s.searchParams.append("client_id",e.sessionId);const a=yield e.bridgeGatewayStorage.getLastEventId();if(a&&s.searchParams.append("last_event_id",a),o.aborted)return void n(new JC("Bridge connection aborted"));const c=new EventSource(s.toString());c.onerror=r=>YC(this,void 0,void 0,(function*(){if(o.aborted)return c.close(),void n(new JC("Bridge connection aborted"));try{const n=yield e.errorHandler(c,r);n!==c&&c.close(),n&&n!==c&&t(n)}catch(i){c.close(),n(i)}})),c.onopen=()=>{if(o.aborted)return c.close(),void n(new JC("Bridge connection aborted"));t(c)},c.onmessage=t=>{if(o.aborted)return c.close(),void n(new JC("Bridge connection aborted"));e.messageHandler(t)},null===(i=e.signal)||void 0===i||i.addEventListener("abort",(()=>{c.close(),n(new JC("Bridge connection aborted"))}))}))),{timeout:e.openingDeadlineMS,signal:e.signal})}))}(n)}))),(e=>YC(this,void 0,void 0,(function*(){e.close()})))),this.bridgeGatewayStorage=new gI(e,t)}get isReady(){const e=this.eventSource.current();return(null===e||void 0===e?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(null===e||void 0===e?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(null===e||void 0===e?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return YC(this,void 0,void 0,(function*(){yield this.eventSource.create(null===e||void 0===e?void 0:e.signal,null===e||void 0===e?void 0:e.openingDeadlineMS)}))}send(e,t,n,r){var i;return YC(this,void 0,void 0,(function*(){const o={};"number"===typeof r?o.ttl=r:(o.ttl=null===r||void 0===r?void 0:r.ttl,o.signal=null===r||void 0===r?void 0:r.signal,o.attempts=null===r||void 0===r?void 0:r.attempts);const s=new URL(mI(this.bridgeUrl,this.postPath));s.searchParams.append("client_id",this.sessionId),s.searchParams.append("to",t),s.searchParams.append("ttl",((null===o||void 0===o?void 0:o.ttl)||this.defaultTtl).toString()),s.searchParams.append("topic",n);const a=WC.encode(e);yield xI((e=>YC(this,void 0,void 0,(function*(){const t=yield this.post(s,a,e.signal);if(!t.ok)throw new JC(`Bridge send failed, status ${t.status}`)}))),{attempts:null!==(i=null===o||void 0===o?void 0:o.attempts)&&void 0!==i?i:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:null===o||void 0===o?void 0:o.signal})}))}pause(){this.eventSource.dispose().catch((e=>AI(`Bridge pause failed, ${e}`)))}unPause(){return YC(this,void 0,void 0,(function*(){yield this.eventSource.recreate(0)}))}close(){return YC(this,void 0,void 0,(function*(){yield this.eventSource.dispose().catch((e=>AI(`Bridge close failed, ${e}`)))}))}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,t,n){return YC(this,void 0,void 0,(function*(){const r=yield fetch(e,{method:"post",body:t,signal:n});if(!r.ok)throw new JC(`Bridge send failed, status ${r.status}`);return r}))}errorsHandler(e,t){return YC(this,void 0,void 0,(function*(){if(this.isConnecting)AI("Bridge error",JSON.stringify(t));else{if(!this.isReady){if(this.isClosed)return e.close(),SI(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new JC("Bridge error, unknown state")}try{this.errorsListener(t)}catch(t){}}}))}messagesHandler(e){return YC(this,void 0,void 0,(function*(){if(e.data===this.heartbeatMessage)return;if(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed)return;let t;try{t=JSON.parse(e.data)}catch(e){throw new JC(`Bridge message parse failed, message ${e.data}`)}this.listener(t)}))}}function _I(e){return!("connectEvent"in e)}class CI{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return YC(this,void 0,void 0,(function*(){if("injected"===e.type)return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!_I(e)){const t={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},n={type:"http",connectEvent:e.connectEvent,session:t,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(n))}const t={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(t))}))}removeConnection(){return YC(this,void 0,void 0,(function*(){return this.storage.removeItem(this.storeKey)}))}getConnection(){return YC(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const t=JSON.parse(e);if("injected"===t.type)return t;if("connectEvent"in t){const e=new KC(t.session.sessionKeyPair);return{type:"http",connectEvent:t.connectEvent,lastWalletEventId:t.lastWalletEventId,nextRpcRequestId:t.nextRpcRequestId,session:{sessionCrypto:e,bridgeUrl:t.session.bridgeUrl,walletPublicKey:t.session.walletPublicKey}}}return{type:"http",sessionCrypto:new KC(t.sessionCrypto),connectionSource:t.connectionSource}}))}getHttpConnection(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new JC("Trying to read HTTP connection source while nothing is stored");if("injected"===e.type)throw new JC("Trying to read HTTP connection source while injected connection is stored");return e}))}getHttpPendingConnection(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new JC("Trying to read HTTP connection source while nothing is stored");if("injected"===e.type)throw new JC("Trying to read HTTP connection source while injected connection is stored");if(!_I(e))throw new JC("Trying to read HTTP-pending connection while http connection is stored");return e}))}getInjectedConnection(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new JC("Trying to read Injected bridge connection source while nothing is stored");if("http"===(null===e||void 0===e?void 0:e.type))throw new JC("Trying to read Injected bridge connection source while HTTP connection is stored");return e}))}storedConnectionType(){return YC(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;return JSON.parse(e).type}))}storeLastWalletEventId(e){return YC(this,void 0,void 0,(function*(){const t=yield this.getConnection();if(t&&"http"===t.type&&!_I(t))return t.lastWalletEventId=e,this.storeConnection(t)}))}getLastWalletEventId(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId}))}increaseNextRpcRequestId(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const t=e.nextRpcRequestId||0;return e.nextRpcRequestId=t+1,this.storeConnection(e)}}))}getNextRpcRequestId(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0}))}}class II{constructor(e,t){this.storage=e,this.walletConnectionSource=t,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=5e3,this.connectionStorage=new CI(e)}static fromStorage(e){return YC(this,void 0,void 0,(function*(){const t=new CI(e),n=yield t.getHttpConnection();return _I(n)?new II(e,n.connectionSource):new II(e,{bridgeUrl:n.session.bridgeUrl})}))}connect(e,t){var n;const r=wI(null===t||void 0===t?void 0:t.signal);null===(n=this.abortController)||void 0===n||n.abort(),this.abortController=r,this.closeGateways();const i=new KC;this.session={sessionCrypto:i,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:i}).then((()=>YC(this,void 0,void 0,(function*(){r.signal.aborted||(yield xI((e=>this.openGateways(i,{openingDeadlineMS:null===t||void 0===t?void 0:t.openingDeadlineMS,signal:null===e||void 0===e?void 0:e.signal})),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:r.signal}))}))));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var t,n;return YC(this,void 0,void 0,(function*(){const r=wI(null===e||void 0===e?void 0:e.signal);if(null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=r,r.signal.aborted)return;this.closeGateways();const i=yield this.connectionStorage.getHttpConnection();if(!i)return;if(r.signal.aborted)return;const o=null!==(n=null===e||void 0===e?void 0:e.openingDeadlineMS)&&void 0!==n?n:this.defaultOpeningDeadlineMS;if(_I(i))return this.session={sessionCrypto:i.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(i.sessionCrypto,{openingDeadlineMS:o,signal:null===r||void 0===r?void 0:r.signal});if(Array.isArray(this.walletConnectionSource))throw new JC("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=i.session,this.gateway&&(SI("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new EI(this.storage,this.walletConnectionSource.bridgeUrl,i.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!r.signal.aborted){this.listeners.forEach((e=>e(i.connectEvent)));try{yield xI((e=>this.gateway.registerSession({openingDeadlineMS:o,signal:e.signal})),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:r.signal})}catch(s){return void(yield this.disconnect({signal:r.signal}))}}}))}sendRequest(e,t){const n={};return"function"===typeof t?n.onRequestSent=t:(n.onRequestSent=null===t||void 0===t?void 0:t.onRequestSent,n.signal=null===t||void 0===t?void 0:t.signal,n.attempts=null===t||void 0===t?void 0:t.attempts),new Promise(((t,r)=>YC(this,void 0,void 0,(function*(){var i;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new JC("Trying to send bridge request without session");const o=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),SI("Send http-bridge request:",Object.assign(Object.assign({},e),{id:o}));const s=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:o})),ZC(this.session.walletPublicKey));try{yield this.gateway.send(s,this.session.walletPublicKey,e.method,{attempts:null===n||void 0===n?void 0:n.attempts,signal:null===n||void 0===n?void 0:n.signal}),null===(i=null===n||void 0===n?void 0:n.onRequestSent)||void 0===i||i.call(n),this.pendingRequests.set(o.toString(),t)}catch(a){r(a)}}))))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return YC(this,void 0,void 0,(function*(){return new Promise((t=>YC(this,void 0,void 0,(function*(){let n=!1,r=null;const i=()=>{n||(n=!0,this.removeBridgeAndSession().then(t))};try{this.closeGateways();const t=wI(null===e||void 0===e?void 0:e.signal);r=setTimeout((()=>{t.abort()}),this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:i,signal:t.signal,attempts:1})}catch(o){SI("Disconnect error:",o),n||this.removeBridgeAndSession().then(t)}finally{r&&clearTimeout(r),i()}}))))}))}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e))}pause(){var e;null===(e=this.gateway)||void 0===e||e.pause(),this.pendingGateways.forEach((e=>e.pause()))}unPause(){return YC(this,void 0,void 0,(function*(){const e=this.pendingGateways.map((e=>e.unPause()));this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)}))}pendingGatewaysListener(e,t,n){return YC(this,void 0,void 0,(function*(){if(this.pendingGateways.includes(e))return this.closeGateways({except:e}),this.gateway&&(SI("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=t,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n);yield e.close()}))}gatewayListener(e){return YC(this,void 0,void 0,(function*(){const t=JSON.parse(this.session.sessionCrypto.decrypt(WC.decode(e.message).toUint8Array(),ZC(e.from)));if(SI("Wallet message received:",t),!("event"in t)){const e=t.id.toString(),n=this.pendingRequests.get(e);return n?(n(t),void this.pendingRequests.delete(e)):void SI(`Response id ${e} doesn't match any request's id`)}if(void 0!==t.id){const e=yield this.connectionStorage.getLastWalletEventId();if(void 0!==e&&t.id<=e)return void AI(`Received event id (=${t.id}) must be greater than stored last wallet event id (=${e}) `);"connect"!==t.event&&(yield this.connectionStorage.storeLastWalletEventId(t.id))}const n=this.listeners;"connect"===t.event&&(yield this.updateSession(t,e.from)),"disconnect"===t.event&&(SI("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach((e=>e(t)))}))}gatewayErrorsListener(e){return YC(this,void 0,void 0,(function*(){throw new JC(`Bridge error ${JSON.stringify(e)}`)}))}updateSession(e,t){return YC(this,void 0,void 0,(function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:t});const n=e.payload.items.find((e=>"ton_addr"===e.name)),r=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:r,nextRpcRequestId:0})}))}removeBridgeAndSession(){return YC(this,void 0,void 0,(function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()}))}generateUniversalLink(e,t){return bI(e)?this.generateTGUniversalLink(e,t):this.generateRegularUniversalLink(e,t)}generateRegularUniversalLink(e,t){const n=new URL(e);return n.searchParams.append("v",2..toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(t)),n.toString()}generateTGUniversalLink(e,t){const n="tonconnect-"+yI(this.generateRegularUniversalLink("about:blank",t).split("?")[1]),r=this.convertToDirectLink(e),i=new URL(r);return i.searchParams.append("startapp",n),i.toString()}convertToDirectLink(e){const t=new URL(e);return t.searchParams.has("attach")&&(t.searchParams.delete("attach"),t.pathname+="/start"),t.toString()}openGateways(e,t){return YC(this,void 0,void 0,(function*(){return Array.isArray(this.walletConnectionSource)?(this.pendingGateways.map((e=>e.close().catch())),this.pendingGateways=this.walletConnectionSource.map((t=>{const n=new EI(this.storage,t.bridgeUrl,e.sessionId,(()=>{}),(()=>{}));return n.setListener((e=>this.pendingGatewaysListener(n,t.bridgeUrl,e))),n})),void(yield Promise.allSettled(this.pendingGateways.map((e=>xI((n=>this.pendingGateways.some((t=>t===e))?e.registerSession({openingDeadlineMS:null===t||void 0===t?void 0:t.openingDeadlineMS,signal:n.signal}):e.close()),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:null===t||void 0===t?void 0:t.signal})))))):(this.gateway&&(SI("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new EI(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:null===t||void 0===t?void 0:t.openingDeadlineMS,signal:null===t||void 0===t?void 0:t.signal}))}))}closeGateways(e){var t;null===(t=this.gateway)||void 0===t||t.close(),this.pendingGateways.filter((t=>t!==(null===e||void 0===e?void 0:e.except))).forEach((e=>e.close())),this.pendingGateways=[]}}function kI(e,t){return TI(e,[t])}function TI(e,t){return!(!e||"object"!==typeof e)&&t.every((t=>t in e))}class MI{constructor(){this.storage={}}static getInstance(){return MI.instance||(MI.instance=new MI),MI.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var t;return null!==(t=this.storage[e])&&void 0!==t?t:null}key(e){var t;const n=Object.keys(this.storage);return e<0||e>=n.length?null:null!==(t=n[e])&&void 0!==t?t:null}removeItem(e){delete this.storage[e]}setItem(e,t){this.storage[e]=t}}function PI(){if("undefined"!==typeof window)return window}function OI(){if("undefined"!==typeof document)return document}function RI(){var e;const t=null===(e=PI())||void 0===e?void 0:e.location.origin;return t?t+"/tonconnect-manifest.json":""}function NI(){if(function(){try{return"undefined"!==typeof localStorage}catch(lk){return!1}}())return localStorage;if("undefined"!==typeof XC&&null!=XC.versions&&null!=XC.versions.node)throw new JC("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return MI.getInstance()}class BI{constructor(e,t){this.injectedWalletKey=t,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=BI.window;if(!BI.isWindowContainsWallet(n,t))throw new sI;this.connectionStorage=new CI(e),this.injectedWallet=n[t].tonconnect}static fromStorage(e){return YC(this,void 0,void 0,(function*(){const t=new CI(e),n=yield t.getInjectedConnection();return new BI(e,n.jsBridgeKey)}))}static isWalletInjected(e){return BI.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return!!BI.isWindowContainsWallet(this.window,e)&&this.window[e].tonconnect.isWalletBrowser}static getCurrentlyInjectedWallets(){if(!this.window)return[];const e=function(){const e=PI();if(!e)return[];try{return Object.keys(e)}catch(lk){return[]}}().filter((([e,t])=>function(e){try{return!(!kI(e,"tonconnect")||!kI(e.tonconnect,"walletInfo"))&&TI(e.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch(lk){return!1}}(t)));return e.map((([e,t])=>({name:t.tonconnect.walletInfo.name,appName:t.tonconnect.walletInfo.app_name,aboutUrl:t.tonconnect.walletInfo.about_url,imageUrl:t.tonconnect.walletInfo.image,tondns:t.tonconnect.walletInfo.tondns,jsBridgeKey:e,injected:!0,embedded:t.tonconnect.isWalletBrowser,platforms:t.tonconnect.walletInfo.platforms})))}static isWindowContainsWallet(e,t){return!!e&&t in e&&"object"===typeof e[t]&&"tonconnect"in e[t]}connect(e){this._connect(2,e)}restoreConnection(){return YC(this,void 0,void 0,(function*(){try{SI("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();SI("Injected Provider restoring connection response",e),"connect"===e.event?(this.makeSubscriptions(),this.listeners.forEach((t=>t(e)))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}}))}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return YC(this,void 0,void 0,(function*(){return new Promise((e=>{const t=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),t()}catch(n){SI(n),this.sendRequest({method:"disconnect",params:[]},t)}}))}))}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],null===(e=this.unsubscribeCallback)||void 0===e||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e))}sendRequest(e,t){var n;return YC(this,void 0,void 0,(function*(){const r={};"function"===typeof t?r.onRequestSent=t:(r.onRequestSent=null===t||void 0===t?void 0:t.onRequestSent,r.signal=null===t||void 0===t?void 0:t.signal);const i=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),SI("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:i}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:i}));return o.then((e=>SI("Wallet message received:",e))),null===(n=null===r||void 0===r?void 0:r.onRequestSent)||void 0===n||n.call(r),o}))}_connect(e,t){return YC(this,void 0,void 0,(function*(){try{SI(`Injected Provider connect request: protocolVersion: ${e}, message:`,t);const n=yield this.injectedWallet.connect(e,t);SI("Injected Provider connect response:",n),"connect"===n.event&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach((e=>e(n)))}catch(n){SI("Injected Provider connect error:",n);const e={event:"connect_error",payload:{code:0,message:null===n||void 0===n?void 0:n.toString()}};this.listeners.forEach((t=>t(e)))}}))}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen((e=>{SI("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach((t=>t(e))),"disconnect"===e.event&&this.disconnect()}))}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}BI.window=PI();class LI{constructor(){this.localStorage=NI()}getItem(e){return YC(this,void 0,void 0,(function*(){return this.localStorage.getItem(e)}))}removeItem(e){return YC(this,void 0,void 0,(function*(){this.localStorage.removeItem(e)}))}setItem(e,t){return YC(this,void 0,void 0,(function*(){this.localStorage.setItem(e,t)}))}}function DI(e){return function(e){return"jsBridgeKey"in e}(e)&&e.injected}function UI(e){return DI(e)&&e.embedded}function jI(e){return"bridgeUrl"in e}const FI=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://app.delabwallet.com/logo_black.png",about_url:"https://delabwallet.com",bridge:[{type:"js",key:"dewallet"}],platforms:["chrome"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]}];class VI{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",(null===e||void 0===e?void 0:e.walletsListSource)&&(this.walletsListSource=e.walletsListSource),(null===e||void 0===e?void 0:e.cacheTTLMs)&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return YC(this,void 0,void 0,(function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then((()=>{this.walletsListCacheCreationTimestamp=Date.now()})).catch((()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null}))),this.walletsListCache}))}getEmbeddedWallet(){return YC(this,void 0,void 0,(function*(){const e=(yield this.getWallets()).filter(UI);return 1!==e.length?null:e[0]}))}fetchWalletsList(){return YC(this,void 0,void 0,(function*(){let e=[];try{const t=yield fetch(this.walletsListSource);if(e=yield t.json(),!Array.isArray(e))throw new aI("Wrong wallets list format, wallets list must be an array.");const n=e.filter((e=>!this.isCorrectWalletConfigDTO(e)));n.length&&(AI(`Wallet(s) ${n.map((e=>e.name)).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter((e=>this.isCorrectWalletConfigDTO(e))))}catch(n){AI(n),e=FI}let t=[];try{t=BI.getCurrentlyInjectedWallets()}catch(n){AI(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),t)}))}walletConfigDTOListToWalletConfigList(e){return e.map((e=>{const t={name:e.name,appName:e.app_name,imageUrl:e.image,aboutUrl:e.about_url,tondns:e.tondns,platforms:e.platforms};return e.bridge.forEach((n=>{if("sse"===n.type&&(t.bridgeUrl=n.url,t.universalLink=e.universal_url,t.deepLink=e.deepLink),"js"===n.type){const e=n.key;t.jsBridgeKey=e,t.injected=BI.isWalletInjected(e),t.embedded=BI.isInsideWalletBrowser(e)}})),t}))}mergeWalletsLists(e,t){return[...new Set(e.concat(t).map((e=>e.name))).values()].map((n=>{const r=e.find((e=>e.name===n)),i=t.find((e=>e.name===n));return Object.assign(Object.assign({},r&&Object.assign({},r)),i&&Object.assign({},i))}))}isCorrectWalletConfigDTO(e){if(!e||"object"!==typeof e)return!1;if(!("name"in e)||!("image"in e)||!("about_url"in e)||!("platforms"in e)||!("app_name"in e))return!1;if(!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length)return!1;if(!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const t=e.bridge;if(t.some((e=>!e||"object"!==typeof e||!("type"in e))))return!1;const n=t.find((e=>"sse"===e.type));if(n&&(!("url"in n)||!n.url||!e.universal_url))return!1;const r=t.find((e=>"js"===e.type));return!!(!r||"key"in r&&r.key)}}class qI extends JC{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,qI.prototype)}}function zI(e,t){const n=e.includes("SendTransaction"),r=e.find((e=>e&&"object"===typeof e&&"SendTransaction"===e.name));if(!n&&!r)throw new qI("Wallet doesn't support SendTransaction feature.");if(r&&void 0!==r.maxMessages){if(r.maxMessages{var t,n;return{address:null!==(t=e.address)&&void 0!==t?t:null,amount:null!==(n=e.amount)&&void 0!==n?n:null}}))}}function ek(e,t,n){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},GI(e,t)),$I(t,n))}function tk(e,t,n,r){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:r.boc},GI(e,t)),$I(t,n))}function nk(e,t,n,r,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:r,error_code:null!==i&&void 0!==i?i:null},GI(e,t)),$I(t,n))}function rk(e,t,n){return Object.assign({type:"disconnection",scope:n},GI(e,t))}class ik{constructor(){this.window=PI()}dispatchEvent(e,t){var n;return YC(this,void 0,void 0,(function*(){const r=new CustomEvent(e,{detail:t});null===(n=this.window)||void 0===n||n.dispatchEvent(r)}))}addEventListener(e,t,n){var r;return YC(this,void 0,void 0,(function*(){return null===(r=this.window)||void 0===r||r.addEventListener(e,t,n),()=>{var n;return null===(n=this.window)||void 0===n?void 0:n.removeEventListener(e,t)}}))}}class ok{constructor(e){var t;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=null!==(t=null===e||void 0===e?void 0:e.eventDispatcher)&&void 0!==t?t:new ik,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return WI({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return YC(this,void 0,void 0,(function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch(e){}}))}setRequestVersionHandler(){return YC(this,void 0,void 0,(function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",(()=>YC(this,void 0,void 0,(function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",HI(this.tonConnectSdkVersion))}))))}))}requestTonConnectUiVersion(){return YC(this,void 0,void 0,(function*(){return new Promise(((e,t)=>YC(this,void 0,void 0,(function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",(t=>{e(t.detail.version)}),{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",{type:"request-version"})}catch(n){t(n)}}))))}))}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch(t){}}trackConnectionStarted(...e){try{const t=ZI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionCompleted(...e){try{const t=KI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionError(...e){try{const t=XI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionRestoringStarted(...e){try{const t=YI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionRestoringCompleted(...e){try{const t=JI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionRestoringError(...e){try{const t=QI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackDisconnection(...e){try{const t=rk(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackTransactionSentForSignature(...e){try{const t=ek(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackTransactionSigned(...e){try{const t=tk(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackTransactionSigningFailed(...e){try{const t=nk(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}}class sk{constructor(e){if(this.walletsList=new VI,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(null===e||void 0===e?void 0:e.manifestUrl)||RI(),storage:(null===e||void 0===e?void 0:e.storage)||new LI},this.walletsList=new VI({walletsListSource:null===e||void 0===e?void 0:e.walletsListSource,cacheTTLMs:null===e||void 0===e?void 0:e.walletsListCacheTTLMs}),this.tracker=new ok({eventDispatcher:null===e||void 0===e?void 0:e.eventDispatcher,tonConnectSdkVersion:"3.0.3"}),!this.dappSettings.manifestUrl)throw new QC("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new CI(this.dappSettings.storage),(null===e||void 0===e?void 0:e.disableAutoPauseConnection)||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return null!==this._wallet}get account(){var e;return(null===(e=this._wallet)||void 0===e?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach((e=>e(this._wallet)))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,t){return this.statusChangeSubscriptions.push(e),t&&this.statusChangeErrorSubscriptions.push(t),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter((t=>t!==e)),t&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter((e=>e!==t)))}}connect(e,t){var n,r;const i={};if("object"===typeof t&&"tonProof"in t&&(i.request=t),"object"===typeof t&&("openingDeadlineMS"in t||"signal"in t||"request"in t)&&(i.request=null===t||void 0===t?void 0:t.request,i.openingDeadlineMS=null===t||void 0===t?void 0:t.openingDeadlineMS,i.signal=null===t||void 0===t?void 0:t.signal),this.connected)throw new tI;const o=wI(null===i||void 0===i?void 0:i.signal);if(null===(n=this.abortController)||void 0===n||n.abort(),this.abortController=o,o.signal.aborted)throw new JC("Connection was aborted");return null===(r=this.provider)||void 0===r||r.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",(()=>{var e;null===(e=this.provider)||void 0===e||e.closeConnection(),this.provider=null})),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(null===i||void 0===i?void 0:i.request),{openingDeadlineMS:null===i||void 0===i?void 0:i.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var t,n;return YC(this,void 0,void 0,(function*(){this.tracker.trackConnectionRestoringStarted();const r=wI(null===e||void 0===e?void 0:e.signal);if(null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=r,r.signal.aborted)return void this.tracker.trackConnectionRestoringError("Connection restoring was aborted");const[i,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(r.signal.aborted)return void this.tracker.trackConnectionRestoringError("Connection restoring was aborted");let s=null;try{switch(i){case"http":s=yield II.fromStorage(this.dappSettings.storage);break;case"injected":s=yield BI.fromStorage(this.dappSettings.storage);break;default:if(!o)return;s=this.createProvider(o)}}catch(fk){return this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),null===s||void 0===s||s.closeConnection(),void(s=null)}if(r.signal.aborted)return null===s||void 0===s||s.closeConnection(),void this.tracker.trackConnectionRestoringError("Connection restoring was aborted");if(!s)return AI("Provider is not restored"),void this.tracker.trackConnectionRestoringError("Provider is not restored");null===(n=this.provider)||void 0===n||n.closeConnection(),this.provider=s,s.listen(this.walletEventsListener.bind(this));const a=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),null===s||void 0===s||s.closeConnection(),s=null};return r.signal.addEventListener("abort",a),yield xI((t=>YC(this,void 0,void 0,(function*(){yield null===s||void 0===s?void 0:s.restoreConnection({openingDeadlineMS:null===e||void 0===e?void 0:e.openingDeadlineMS,signal:t.signal}),r.signal.removeEventListener("abort",a),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}))),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:null===e||void 0===e?void 0:e.signal})}))}sendTransaction(e,t){return YC(this,void 0,void 0,(function*(){const n={};"function"===typeof t?n.onRequestSent=t:(n.onRequestSent=null===t||void 0===t?void 0:t.onRequestSent,n.signal=null===t||void 0===t?void 0:t.signal);const r=wI(null===n||void 0===n?void 0:n.signal);if(r.signal.aborted)throw new JC("Transaction sending was aborted");this.checkConnection(),zI(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:i}=e,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i{e.hidden?this.pauseConnection():this.unPauseConnection().catch()}))}catch(t){AI("Cannot subscribe to the document.visibilitychange: ",t)}}createProvider(e){let t;return t=!Array.isArray(e)&&function(e){return"jsBridgeKey"in e}(e)?new BI(this.dappSettings.storage,e.jsBridgeKey):new II(this.dappSettings.storage,e),t.listen(this.walletEventsListener.bind(this)),t}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const t=e.items.find((e=>"ton_addr"===e.name)),n=e.items.find((e=>"ton_proof"===e.name));if(!t)throw new JC("ton_addr connection item was not found");const r={device:e.device,provider:this.provider.type,account:{address:t.address,chain:t.network,walletStateInit:t.walletStateInit,publicKey:t.publicKey}};n&&(r.connectItems={tonProof:n}),this.wallet=r,this.tracker.trackConnectionCompleted(r)}onWalletConnectError(e){const t=fI.parseError(e);if(this.statusChangeErrorSubscriptions.forEach((e=>e(t))),SI(t),this.tracker.trackConnectionError(e.message,e.code),t instanceof eI||t instanceof $C)throw AI(t),t}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new nI}createConnectRequest(e){const t=[{name:"ton_addr"}];return(null===e||void 0===e?void 0:e.tonProof)&&t.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:t}}}sk.walletsList=new VI,sk.isWalletInjected=e=>BI.isWalletInjected(e),sk.isInsideWalletBrowser=e=>BI.isInsideWalletBrowser(e);function ak(e,t=!1){const{wc:n,hex:r}=function(e){if(!e.includes(":"))throw new cI(`Wrong address ${e}. Address must include ":".`);const t=e.split(":");if(2!==t.length)throw new cI(`Wrong address ${e}. Address must include ":" only once.`);const n=parseInt(t[0]);if(0!==n&&-1!==n)throw new cI(`Wrong address ${e}. WC must be eq 0 or -1, but ${n} received.`);const r=t[1];if(64!==(null===r||void 0===r?void 0:r.length))throw new cI(`Wrong address ${e}. Hex part must be 64bytes length, but ${null===r||void 0===r?void 0:r.length} received.`);return{wc:n,hex:uk(r)}}(e);let i=81;t&&(i|=128);const o=new Int8Array(34);o[0]=i,o[1]=n,o.set(r,2);const s=new Uint8Array(36);return s.set(o),s.set(function(e){const t=4129;let n=0;const r=new Uint8Array(e.length+2);r.set(e);for(let i of r){let e=128;for(;e>0;)n<<=1,i&e&&(n+=1),e>>=1,n>65535&&(n&=65535,n^=t)}return new Uint8Array([Math.floor(n/256),n%256])}(o),34),WC.encode(s).replace(/\+/g,"-").replace(/\//g,"_")}const ck={};for(let tj=0;tj<=255;tj++){let e=tj.toString(16);e.length<2&&(e="0"+e),ck[e]=tj}function uk(e){const t=(e=e.toLowerCase()).length;if(t%2!==0)throw new uI("Hex string must have length a multiple of 2: "+e);const n=t/2,r=new Uint8Array(n);for(let i=0;it in e?Sk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tk=(e,t)=>{for(var n in t||(t={}))Ck.call(t,n)&&kk(e,n,t[n]);if(_k)for(var n of _k(t))Ik.call(t,n)&&kk(e,n,t[n]);return e},Mk=(e,t)=>Ak(e,Ek(t)),Pk=(e,t,n)=>(kk(e,"symbol"!==typeof t?t+"":t,n),n),Ok=(e,t,n)=>new Promise(((r,i)=>{var o=e=>{try{a(n.next(e))}catch(t){i(t)}},s=e=>{try{a(n.throw(e))}catch(t){i(t)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);a((n=n.apply(e,t)).next())}));const Rk={};const Nk=Symbol("solid-proxy"),Bk=Symbol("solid-track"),Lk={equals:(e,t)=>e===t};let Dk=fT;const Uk={owned:null,cleanups:null,context:null,owner:null},jk={};var Fk=null;let Vk,qk=null,zk=null,Hk=null,Wk=null,Gk=0;function Zk(e,t){const n=zk,r=Fk,i=0===e.length,o=i?Uk:{owned:null,cleanups:null,context:null,owner:void 0===t?r:t},s=i?e:()=>e((()=>eT((()=>mT(o)))));Fk=o,zk=null;try{return dT(s,!0)}finally{zk=n,Fk=r}}function Kk(e,t){const n={value:e,observers:null,observerSlots:null,comparator:(t=t?Object.assign({},Lk,t):Lk).equals||void 0};return[sT.bind(n),e=>("function"===typeof e&&(e=e(n.value)),aT(n,e))]}function Xk(e,t,n){cT(uT(e,t,!0,1))}function Yk(e,t,n){cT(uT(e,t,!1,1))}function Jk(e,t,n){Dk=hT;const r=uT(e,t,!1,1);r.user=!0,Wk?Wk.push(r):cT(r)}function Qk(e,t,n){n=n?Object.assign({},Lk,n):Lk;const r=uT(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,cT(r),sT.bind(r)}function $k(e){return dT(e,!1)}function eT(e){if(null===zk)return e();const t=zk;zk=null;try{return e()}finally{zk=t}}function tT(e){return null===Fk||(null===Fk.cleanups?Fk.cleanups=[e]:Fk.cleanups.push(e)),e}function nT(){return zk}function rT(e,t){const n=Symbol("context");return{id:n,Provider:xT(n),defaultValue:e}}function iT(e){let t;return void 0!==(t=vT(Fk,e.id))?t:e.defaultValue}function oT(e){const t=Qk(e),n=Qk((()=>wT(t())));return n.toArray=()=>{const e=n();return Array.isArray(e)?e:null!=e?[e]:[]},n}function sT(){if(this.sources&&this.state)if(1===this.state)cT(this);else{const e=Hk;Hk=null,dT((()=>pT(this)),!1),Hk=e}if(zk){const e=this.observers?this.observers.length:0;zk.sources?(zk.sources.push(this),zk.sourceSlots.push(e)):(zk.sources=[this],zk.sourceSlots=[e]),this.observers?(this.observers.push(zk),this.observerSlots.push(zk.sources.length-1)):(this.observers=[zk],this.observerSlots=[zk.sources.length-1])}return this.value}function aT(e,t,n){let r=e.value;return e.comparator&&e.comparator(r,t)||(e.value=t,e.observers&&e.observers.length&&dT((()=>{for(let t=0;t1e6)throw Hk=[],new Error}),!1)),t}function cT(e){if(!e.fn)return;mT(e);const t=Fk,n=zk,r=Gk;zk=Fk=e,function(e,t,n){let r;try{r=e.fn(t)}catch(i){e.pure&&(e.state=1,e.owned&&e.owned.forEach(mT),e.owned=null),yT(i)}(!e.updatedAt||e.updatedAt<=n)&&(null!=e.updatedAt&&"observers"in e?aT(e,r):e.value=r,e.updatedAt=n)}(e,e.value,r),zk=n,Fk=t}function uT(e,t,n,r=1,i){const o={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Fk,context:null,pure:n};return null===Fk||Fk!==Uk&&(Fk.owned?Fk.owned.push(o):Fk.owned=[o]),o}function lT(e){if(0===e.state)return;if(2===e.state)return pT(e);if(e.suspense&&eT(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt=0;n--)if(1===(e=t[n]).state)cT(e);else if(2===e.state){const n=Hk;Hk=null,dT((()=>pT(e,t[0])),!1),Hk=n}}function dT(e,t){if(Hk)return e();let n=!1;t||(Hk=[]),Wk?n=!0:Wk=[],Gk++;try{const t=e();return function(e){Hk&&(fT(Hk),Hk=null);if(e)return;const t=Wk;Wk=null,t.length&&dT((()=>Dk(t)),!1)}(n),t}catch(r){n||(Wk=null),Hk=null,yT(r)}}function fT(e){for(let t=0;tn=eT((()=>(Fk.context={[e]:t.value},oT((()=>t.children)))))),void 0),n}}const ST=Symbol("fallback");function AT(e){for(let t=0;te(t||{})))}function _T(){return!0}const CT={get:(e,t,n)=>t===Nk?n:e.get(t),has:(e,t)=>t===Nk||e.has(t),set:_T,deleteProperty:_T,getOwnPropertyDescriptor:(e,t)=>({configurable:!0,enumerable:!0,get:()=>e.get(t),set:_T,deleteProperty:_T}),ownKeys:e=>e.keys()};function IT(e){return(e="function"===typeof e?e():e)?e:{}}function kT(...e){let t=!1;for(let r=0;r=0;n--){const r=IT(e[n])[t];if(void 0!==r)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in IT(e[n]))return!0;return!1},keys(){const t=[];for(let n=0;n=0;r--)if(e[r]){const t=Object.getOwnPropertyDescriptors(e[r]);for(const r in t)r in n||Object.defineProperty(n,r,{enumerable:!0,get(){for(let t=e.length-1;t>=0;t--){const n=(e[t]||{})[r];if(void 0!==n)return n}}})}return n}function TT(e,...t){const n=new Set(t.flat());if(Nk in e){const r=t.map((t=>new Proxy({get:n=>t.includes(n)?e[n]:void 0,has:n=>t.includes(n)&&n in e,keys:()=>t.filter((t=>t in e))},CT)));return r.push(new Proxy({get:t=>n.has(t)?void 0:e[t],has:t=>!n.has(t)&&t in e,keys:()=>Object.keys(e).filter((e=>!n.has(e)))},CT)),r}const r=Object.getOwnPropertyDescriptors(e);return t.push(Object.keys(r).filter((e=>!n.has(e)))),t.map((t=>{const n={};for(let i=0;ie[o],set:()=>!0,enumerable:!0})}return n}))}function MT(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Qk(function(e,t,n={}){let r=[],i=[],o=[],s=0,a=t.length>1?[]:null;return tT((()=>AT(o))),()=>{let c,u,l=e()||[];return l[Bk],eT((()=>{let e,t,f,h,p,g,m,b,y,v=l.length;if(0===v)0!==s&&(AT(o),o=[],r=[],i=[],s=0,a&&(a=[])),n.fallback&&(r=[ST],i[0]=Zk((e=>(o[0]=e,n.fallback()))),s=1);else if(0===s){for(i=new Array(v),u=0;u=g&&b>=g&&r[m]===l[b];m--,b--)f[b]=i[m],h[b]=o[m],a&&(p[b]=a[m]);for(e=new Map,t=new Array(b+1),u=b;u>=g;u--)y=l[u],c=e.get(y),t[u]=void 0===c?-1:c,e.set(y,u);for(c=g;c<=m;c++)y=r[c],u=e.get(y),void 0!==u&&-1!==u?(f[u]=i[c],h[u]=o[c],a&&(p[u]=a[c]),u=t[u],e.set(y,u)):o[c]();for(u=g;ue.each),e.children,t||void 0))}function PT(e){let t=!1;const n=e.keyed,r=Qk((()=>e.when),void 0,{equals:(e,n)=>t?e===n:!e===!n});return Qk((()=>{const i=r();if(i){const r=e.children,o="function"===typeof r&&r.length>0;return t=n||o,o?eT((()=>r(i))):r}return e.fallback}),void 0,void 0)}function OT(e){let t=!1,n=!1;const r=oT((()=>e.children)),i=Qk((()=>{let e=r();Array.isArray(e)||(e=[e]);for(let t=0;te[0]===n[0]&&(t?e[1]===n[1]:!e[1]===!n[1])&&e[2]===n[2]});return Qk((()=>{const[r,o,s]=i();if(r<0)return e.fallback;const a=s.children,c="function"===typeof a&&a.length>0;return t=n||c,c?eT((()=>a(o))):a}),void 0,void 0)}function RT(e){return e}const NT=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline","allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"]),BT=new Set(["innerHTML","textContent","innerText","children"]),LT=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),DT=Object.assign(Object.create(null),{class:"className",formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"}),UT=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),jT=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),FT={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};const VT="_$DX_DELEGATE";function qT(e,t,n){if("undefined"===typeof window)return null;const r=document.createElement("template");r.innerHTML=e;let i=r.content.firstChild;return n&&(i=i.firstChild),i}function zT(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function HT(e,t){null==t?e.removeAttribute("class"):e.className=t}function WT(e,t={},n,r){const i={};return r||Yk((()=>i.children=QT(e,t.children,i.children))),Yk((()=>t.ref&&t.ref(e))),Yk((()=>function(e,t,n,r,i={},o=!1){t||(t={});for(const s in i)if(!(s in t)){if("children"===s)continue;i[s]=YT(e,s,null,i[s],n,o)}for(const s in t){if("children"===s){r||QT(e,t.children);continue}const a=t[s];i[s]=YT(e,s,a,i[s],n,o)}}(e,t,n,!0,i,!0))),i}function GT(e,t,n){return eT((()=>e(t,n)))}function ZT(e,t,n,r){if(void 0===n||r||(r=[]),"function"!==typeof t)return QT(e,t,r,n);Yk((r=>QT(e,t(),r,n)),r)}function KT(e){let t,n;return Rk.context&&(t=Rk.registry.get(n=function(){const e=Rk.context;return`${e.id}${e.count++}`}()))?(Rk.completed&&Rk.completed.add(t),Rk.registry.delete(n),t):e.cloneNode(!0)}function XT(e,t,n){const r=t.trim().split(/\s+/);for(let i=0,o=r.length;ir.call(e,n[1],t))}else e.addEventListener(t,n)}(e,i,n,o),o&&function(e,t=window.document){const n=t[VT]||(t[VT]=new Set);for(let r=0,i=e.length;rt.toUpperCase())))]=n;else{const r=i&&t.indexOf(":")>-1&&FT[t.split(":")[0]];r?function(e,t,n,r){null==r?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r)}(e,r,t,n):zT(e,LT[t]||t,n)}var u;return n}function JT(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>n||document}),Rk.registry&&!Rk.done&&(Rk.done=!0,document.querySelectorAll("[id^=pl-]").forEach((t=>{for(;t&&8!==t.nodeType&&t.nodeValue!=="pl-"+e;){let e=t.nextSibling;t.remove(),t=e}t&&t.remove()})));n;){const r=n[t];if(r&&!n.disabled){const i=n[`${t}Data`];if(void 0!==i?r.call(n,i,e):r.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function QT(e,t,n,r,i){for(Rk.context&&!n&&(n=[...e.childNodes]);"function"===typeof n;)n=n();if(t===n)return n;const o=typeof t,s=void 0!==r;if(e=s&&n[0]&&n[0].parentNode||e,"string"===o||"number"===o){if(Rk.context)return n;if("number"===o&&(t=t.toString()),s){let i=n[0];i&&3===i.nodeType?i.data=t:i=document.createTextNode(t),n=tM(e,n,r,i)}else n=""!==n&&"string"===typeof n?e.firstChild.data=t:e.textContent=t}else if(null==t||"boolean"===o){if(Rk.context)return n;n=tM(e,n,r)}else{if("function"===o)return Yk((()=>{let i=t();for(;"function"===typeof i;)i=i();n=QT(e,i,n,r)})),()=>n;if(Array.isArray(t)){const o=[],a=n&&Array.isArray(n);if($T(o,t,n,i))return Yk((()=>n=QT(e,o,n,r,!0))),()=>n;if(Rk.context){if(!o.length)return n;for(let e=0;er-a){const i=t[s];for(;a=0;o--){const s=t[o];if(i!==s){const t=s.parentNode===e;r||o?t&&s.remove():t?e.replaceChild(i,s):e.insertBefore(i,n)}else r=!0}}else e.insertBefore(i,n);return[i]}function nM(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function rM(e){const{useShadow:t}=e,n=document.createTextNode(""),r=e.mount||document.body;function i(){if(Rk.context){const[t,n]=Kk(!1);return queueMicrotask((()=>n(!0))),()=>t()&&e.children}return()=>e.children}if(r instanceof HTMLHeadElement){const[e,t]=Kk(!1),n=()=>t(!0);Zk((t=>ZT(r,(()=>e()?t():i()()),null))),tT((()=>{Rk.context?queueMicrotask(n):n()}))}else{const o=nM(e.isSVG?"g":"div",e.isSVG),s=t&&o.attachShadow?o.attachShadow({mode:"open"}):o;Object.defineProperty(o,"_$host",{get:()=>n.parentNode,configurable:!0}),ZT(s,i()),r.appendChild(o),e.ref&&e.ref(o),tT((()=>r.removeChild(o)))}return n}function iM(e){const[t,n]=TT(e,["component"]),r=Qk((()=>t.component));return Qk((()=>{const e=r();switch(typeof e){case"function":return eT((()=>e(n)));case"string":const t=jT.has(e),r=Rk.context?KT():nM(e,t);return WT(r,n,t),r}}))}var oM=(e=>(e.DARK="DARK",e.LIGHT="LIGHT",e))(oM||{});let sM={data:""},aM=e=>"object"==typeof window?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||sM,cM=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,uM=/\/\*[^]*?\*\/| +/g,lM=/\n+/g,dM=(e,t)=>{let n="",r="",i="";for(let o in e){let s=e[o];"@"==o[0]?"i"==o[1]?n=o+" "+s+";":r+="f"==o[1]?dM(s,o):o+"{"+dM(s,"k"==o[1]?"":t)+"}":"object"==typeof s?r+=dM(s,t?t.replace(/([^,])+/g,(e=>o.replace(/(^:.*)|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)))):o):null!=s&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=dM.p?dM.p(o,s):o+":"+s+";")}return n+(t&&i?t+"{"+i+"}":i)+r},fM={},hM=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+hM(e[n]);return t}return e},pM=(e,t,n,r,i)=>{let o=hM(e),s=fM[o]||(fM[o]=(e=>{let t=0,n=11;for(;t>>0;return"go"+n})(o));if(!fM[s]){let t=o!==e?e:(e=>{let t,n,r=[{}];for(;t=cM.exec(e.replace(uM,""));)t[4]?r.shift():t[3]?(n=t[3].replace(lM," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(lM," ").trim();return r[0]})(e);fM[s]=dM(i?{["@keyframes "+s]:t}:t,n?"":"."+s)}let a=n&&fM.g?fM.g:null;return n&&(fM.g=fM[s]),c=fM[s],u=t,l=r,(d=a)?u.data=u.data.replace(d,c):-1===u.data.indexOf(c)&&(u.data=l?c+u.data:u.data+c),s;var c,u,l,d},gM=(e,t,n)=>e.reduce(((e,r,i)=>{let o=t[i];if(o&&o.call){let e=o(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":dM(e,""):!1===e?"":e}return e+r+(null==o?"":o)}),"");function mM(e){let t=this||{},n=e.call?e(t.p):e;return pM(n.unshift?n.raw?gM(n,[].slice.call(arguments,1),t.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(t.p):n)),{}):n,aM(t.target),t.g,t.o,t.k)}mM.bind({g:1});let bM=mM.bind({k:1});const yM=rT();function vM(e){return ET(yM.Provider,{value:e.theme,get children(){return e.children}})}function wM(){return iT(yM)}function xM(e){let t=this||{};return(...n)=>{const r=r=>{const i=kT(r,{theme:iT(yM)}),o=kT(i,{get class(){const e=i.class,r="class"in i&&/^go[0-9]+/.test(e);return[e,mM.apply({target:t.target,o:r,p:i,g:t.g},n)].filter(Boolean).join(" ")}}),[s,a]=TT(o,["as","theme"]),c=a,u=s.as||e;let l;return"function"===typeof u?l=u(c):1==t.g?(l=document.createElement(u),WT(l,c)):l=iM(kT({component:u},c)),l};return r.class=e=>eT((()=>mM.apply({target:t.target,p:e,g:t.g},n))),r}}const SM=new Proxy(xM,{get:(e,t)=>e(t)});function AM(){const e=xM.call({g:1},"div").apply(null,arguments);return function(t){return e(t),null}}const EM="tc-root",_M="tc-disable-scroll",CM="tc-using-mouse",IM=()=>{document.body.addEventListener("mousedown",(()=>document.body.classList.add(CM))),document.body.addEventListener("keydown",(e=>{"Tab"===e.key&&document.body.classList.remove(CM)}));return ET(AM` +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[888],{9609:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{AccountInfo:"AccountInfoWithProviders",Address:"AccountId",AddressInfo:"Vec",LookupSource:"AccountId"}}},80663:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{EraBenefits:{total_fee_reduction_quota:"Compact",total_market_active_funds:"Compact",used_fee_reduction_quota:"Compact",active_era:"Compact"},FundsType:{_enum:["SWORK","MARKET"]},FundsUnlockChunk:{value:"Compact",era:"Compact"},MarketBenefit:{total_funds:"Compact",active_funds:"Compact",used_fee_reduction_quota:"Compact",file_reward:"Compact",refreshed_at:"Compact",unlocking_funds:"Vec>"},SworkBenefit:{total_funds:"Compact",active_funds:"Compact",total_fee_reduction_count:"u32",used_fee_reduction_count:"u32",refreshed_at:"Compact",unlocking_funds:"Vec>"}}}},50503:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{BridgeChainId:"u8",ChainId:"u8",ResourceId:"H256",DepositNonce:"u64",ProposalStatus:{_enum:["Initiated","Approved","Rejected"]},ProposalVotes:{votes_for:"Vec",votes_against:"Vec",status:"ProposalStatus",expiry:"BlockNumber"},Erc721Token:{id:"TokenId",metadata:"Vec"},TokenId:"U256"}}},65664:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{ETHAddress:"Vec",EthereumTxHash:"H256"}}},27774:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.typesBundleForPolkadot=t.typesAlias=t.rpc=t.types=t.crustTypes=void 0;const i=r(n(9609)),o=r(n(80663)),s=r(n(50503)),a=r(n(65664)),c=n(16450),u=r(n(72252)),l=r(n(22397)),d=r(n(23426)),f=r(n(78424));t.crustTypes={base:i.default,benefit:o.default,bridge:s.default,claims:a.default,locks:u.default,market:l.default,staking:d.default,swork:f.default},t.types=Object.assign({},c.typesFromDefs(t.crustTypes)),t.rpc=c.jsonrpcFromDefs(t.crustTypes),t.typesAlias=c.typesAliasFromDefs(t.crustTypes);const h={rpc:t.rpc,types:[{minmax:[void 0,void 0],types:Object.assign({},t.types)}],alias:t.typesAlias};t.typesBundleForPolkadot={spec:{crust:h}}},72252:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{Lock:{total:"Compact",last_unlock_at:"BlockNumber",lock_type:"LockType"},LockType:{delay:"BlockNumber",lock_period:"u32"}}}},22397:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{FileInfo:{file_size:"u64",spower:"u64",expired_at:"BlockNumber",calculated_at:"BlockNumber",amount:"Compact",prepaid:"Compact",reported_replica_count:"u32",replicas:"Vec>"},FileInfoV2:{file_size:"u64",spower:"u64",expired_at:"BlockNumber",calculated_at:"BlockNumber",amount:"Compact",prepaid:"Compact",reported_replica_count:"u32",remaining_paid_count:"u32",replicas:"BTreeMap>"},Replica:{who:"AccountId",valid_at:"BlockNumber",anchor:"SworkerAnchor",is_reported:"bool",created_at:"Option"}}}},23426:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{Guarantee:{targets:"Vec>",total:"Compact",submitted_in:"EraIndex",suppressed:"bool"},ValidatorPrefs:{guarantee_fee:"Compact"}}}},78424:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={rpc:{},types:{Group:{members:"BTreeSet",allowlist:"BTreeSet"},IASSig:"Vec",Identity:{anchor:"SworkerAnchor",punishment_deadline:"u64",group:"Option"},ISVBody:"Vec",MerkleRoot:"Vec",ReportSlot:"u64",PKInfo:{code:"SworkerCode",anchor:"Option"},SworkerAnchor:"Vec",SworkerCert:"Vec",SworkerCode:"Vec",SworkerPubKey:"Vec",SworkerSignature:"Vec",WorkReport:{report_slot:"u64",spower:"u64",free:"u64",reported_files_size:"u64",reported_srd_root:"MerkleRoot",reported_files_root:"MerkleRoot"}}}},81556:function(e,t,n){"use strict";n.d(t,{Sg:function(){return c},zt:function(){return u}});var r=n(2593),i=n(6881),o=n(1581);var s=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const a=new o.Logger("abstract-provider/5.7.0");class c extends i.Description{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class u{constructor(){a.checkAbstract(new.target,u),(0,i.defineReadOnly)(this,"_isProvider",!0)}getFeeData(){return s(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield(0,i.resolveProperties)({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let n=null,o=null,s=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,s=r.O$.from("1500000000"),o=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:n,maxFeePerGas:o,maxPriorityFeePerGas:s,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}},48088:function(e,t,n){"use strict";n.d(t,{E:function(){return u},b:function(){return l}});var r=n(6881),i=n(1581);var o=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const s=new i.Logger("abstract-signer/5.7.0"),a=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],c=[i.Logger.errors.INSUFFICIENT_FUNDS,i.Logger.errors.NONCE_EXPIRED,i.Logger.errors.REPLACEMENT_UNDERPRICED];class u{constructor(){s.checkAbstract(new.target,u),(0,r.defineReadOnly)(this,"_isSigner",!0)}getBalance(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return o(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield(0,r.resolveProperties)(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return o(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield(0,r.resolveProperties)(this.checkTransaction(e));return yield this.provider.call(n,t)}))}sendTransaction(e){return o(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),n=yield this.signTransaction(t);return yield this.provider.sendTransaction(n)}))}getChainId(){return o(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const n in e)-1===a.indexOf(n)&&s.throwArgumentError("invalid transaction key: "+n,"transaction",e);const t=(0,r.shallowCopy)(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&s.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return o(this,void 0,void 0,(function*(){const t=yield(0,r.resolveProperties)(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>o(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&s.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const n=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!n?0!==t.type&&1!==t.type||!n||s.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):s.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(n&&s.throwError("network does not support EIP-1559",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):s.throwError("failed to get consistent fee data",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(c.indexOf(e.code)>=0)throw e;return s.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&s.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield(0,r.resolveProperties)(t)}))}_checkProvider(e){this.provider||s.throwError("missing provider",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class l extends u{constructor(e,t){super(),(0,r.defineReadOnly)(this,"address",e),(0,r.defineReadOnly)(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{s.throwError(e,i.Logger.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new l(this.address,e)}}},19485:function(e,t,n){"use strict";n.r(t),n.d(t,{getAddress:function(){return h},getContractAddress:function(){return m},getCreate2Address:function(){return b},getIcapAddress:function(){return g},isAddress:function(){return p}});var r=n(16441),i=n(2593),o=n(38197),s=n(59052);const a=new(n(1581).Logger)("address/5.7.0");function c(e){(0,r.isHexString)(e,20)||a.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let r=0;r<40;r++)n[r]=t[r].charCodeAt(0);const i=(0,r.arrayify)((0,o.keccak256)(n));for(let r=0;r<40;r+=2)i[r>>1]>>4>=8&&(t[r]=t[r].toUpperCase()),(15&i[r>>1])>=8&&(t[r+1]=t[r+1].toUpperCase());return"0x"+t.join("")}const u={};for(let y=0;y<10;y++)u[String(y)]=String(y);for(let y=0;y<26;y++)u[String.fromCharCode(65+y)]=String(10+y);const l=Math.floor((d=9007199254740991,Math.log10?Math.log10(d):Math.log(d)/Math.LN10));var d;function f(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>u[e])).join("");for(;t.length>=l;){let e=t.substring(0,l);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}function h(e){let t=null;if("string"!==typeof e&&a.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=c(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&a.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==f(e)&&a.throwArgumentError("bad icap checksum","address",e),t=(0,i.g$)(e.substring(4));t.length<40;)t="0"+t;t=c("0x"+t)}else a.throwArgumentError("invalid address","address",e);return t}function p(e){try{return h(e),!0}catch(t){}return!1}function g(e){let t=(0,i.t2)(h(e).substring(2)).toUpperCase();for(;t.length<30;)t="0"+t;return"XE"+f("XE00"+t)+t}function m(e){let t=null;try{t=h(e.from)}catch(c){a.throwArgumentError("missing from address","transaction",e)}const n=(0,r.stripZeros)((0,r.arrayify)(i.O$.from(e.nonce).toHexString()));return h((0,r.hexDataSlice)((0,o.keccak256)((0,s.encode)([t,n])),12))}function b(e,t,n){return 32!==(0,r.hexDataLength)(t)&&a.throwArgumentError("salt must be 32 bytes","salt",t),32!==(0,r.hexDataLength)(n)&&a.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",n),h((0,r.hexDataSlice)((0,o.keccak256)((0,r.concat)(["0xff",h(e),t,n])),12))}},59567:function(e,t,n){"use strict";n.d(t,{J:function(){return i},c:function(){return o}});var r=n(16441);function i(e){e=atob(e);const t=[];for(let n=0;n0;)n.push(e%this.base),e=e/this.base|0}let i="";for(let r=0;0===t[r]&&r=0;--r)i+=this.alphabet[n[r]];return i}decode(e){if("string"!==typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let n=0;n>=8;for(;i>0;)t.push(255&i),i>>=8}for(let n=0;e[n]===this._leader&&n0&&(10===arguments[0]?h||(h=!0,u.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?u.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",s.Logger.errors.UNEXPECTED_ARGUMENT,{}):u.throwError("BigNumber.toString does not accept parameters",s.Logger.errors.UNEXPECTED_ARGUMENT,{})),b(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof p)return e;if("string"===typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new p(l,g(e)):e.match(/^-?[0-9]+$/)?new p(l,g(new c(e))):u.throwArgumentError("invalid BigNumber string","value",e);if("number"===typeof e)return e%1&&y("underflow","BigNumber.from",e),(e>=d||e<=-d)&&y("overflow","BigNumber.from",e),p.from(String(e));const t=e;if("bigint"===typeof t)return p.from(t.toString());if((0,o.isBytes)(t))return p.from((0,o.hexlify)(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"===typeof e)return p.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"===typeof e&&((0,o.isHexString)(e)||"-"===e[0]&&(0,o.isHexString)(e.substring(1))))return p.from(e)}return u.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function g(e){if("string"!==typeof e)return g(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&u.throwArgumentError("invalid hex","value",e),"0x00"===(e=g(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function m(e){return p.from(g(e))}function b(e){const t=p.from(e).toHexString();return"-"===t[0]?new c("-"+t.substring(3),16):new c(t.substring(2),16)}function y(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),u.throwError(e,s.Logger.errors.NUMERIC_FAULT,r)}function v(e){return new c(e,36).toString(16)}function w(e){return new c(e,16).toString(36)}},83877:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:n(88677).Buffer}catch(k){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,c=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch(k){o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=p[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modrn(l).toString(e);n=(d=d.idivn(l)).isZero()?g+n:f[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function b(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(e,t,n){return b(e,t,n)}function v(e,t){this.x=e,this.y=t}Math.imul||(m=g),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?g(this,e,t):n<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},v.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new C(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}x.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(S,x),S.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new A;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return w[e]=t,t},C.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},C.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},C.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},C.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},C.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},C.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},C.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},C.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},C.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new I(e)},i(I,C),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},16441:function(e,t,n){"use strict";n.r(t),n.d(t,{arrayify:function(){return u},concat:function(){return l},hexConcat:function(){return y},hexDataLength:function(){return m},hexDataSlice:function(){return b},hexStripZeros:function(){return w},hexValue:function(){return v},hexZeroPad:function(){return x},hexlify:function(){return g},isBytes:function(){return c},isBytesLike:function(){return s},isHexString:function(){return h},joinSignature:function(){return A},splitSignature:function(){return S},stripZeros:function(){return d},zeroPad:function(){return f}});const r=new(n(1581).Logger)("bytes/5.7.0");function i(e){return!!e.toHexString}function o(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function s(e){return h(e)&&!(e.length%2)||c(e)}function a(e){return"number"===typeof e&&e==e&&e%1===0}function c(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!a(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function u(e,t){if(t||(t={}),"number"===typeof e){r.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),o(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e)&&(e=e.toHexString()),h(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":r.throwArgumentError("hex data is odd-length","value",e));const i=[];for(let e=0;eu(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),o(r)}function d(e){let t=u(e);if(0===t.length)return t;let n=0;for(;nt&&r.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),o(n)}function h(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const p="0123456789abcdef";function g(e,t){if(t||(t={}),"number"===typeof e){r.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=p[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"===typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e))return e.toHexString();if(h(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":r.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(c(e)){let t="0x";for(let n=0;n>4]+p[15&r]}return t}return r.throwArgumentError("invalid hexlify value","value",e)}function m(e){if("string"!==typeof e)e=g(e);else if(!h(e)||e.length%2)return null;return(e.length-2)/2}function b(e,t,n){return"string"!==typeof e?e=g(e):(!h(e)||e.length%2)&&r.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function y(e){let t="0x";return e.forEach((e=>{t+=g(e).substring(2)})),t}function v(e){const t=w(g(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function w(e){"string"!==typeof e&&(e=g(e)),h(e)||r.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t2*t+2&&r.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function S(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(s(e)){let n=u(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=g(n.slice(0,32)),t.s=g(n.slice(32,64))):65===n.length?(t.r=g(n.slice(0,32)),t.s=g(n.slice(32,64)),t.v=n[64]):r.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:r.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=g(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=f(u(t._vs),32);t._vs=g(n);const i=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&r.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const o=g(n);null==t.s?t.s=o:t.s!==o&&r.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?r.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&r.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&h(t.r)?t.r=x(t.r,32):r.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&h(t.s)?t.s=x(t.s,32):r.throwArgumentError("signature missing or invalid s","signature",e);const n=u(t.s);n[0]>=128&&r.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const i=g(n);t._vs&&(h(t._vs)||r.throwArgumentError("signature invalid _vs","signature",e),t._vs=x(t._vs,32)),null==t._vs?t._vs=i:t._vs!==i&&r.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function A(e){return g(l([(e=S(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},21046:function(e,t,n){"use strict";n.d(t,{Bz:function(){return a},_Y:function(){return o},fh:function(){return s},tL:function(){return i}});var r=n(2593);const i=r.O$.from(-1),o=r.O$.from(0),s=r.O$.from(1),a=r.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},57218:function(e,t,n){"use strict";n.d(t,{R:function(){return r}});const r="0x0000000000000000000000000000000000000000000000000000000000000000"},35644:function(e,t,n){"use strict";n.d(t,{i:function(){return r}});const r="hash/5.7.0"},32046:function(e,t,n){"use strict";n.d(t,{id:function(){return o}});var r=n(38197),i=n(29251);function o(e){return(0,r.keccak256)((0,i.Y0)(e))}},93684:function(e,t,n){"use strict";n.d(t,{B:function(){return s},r:function(){return a}});var r=n(16441),i=n(38197),o=n(29251);const s="\x19Ethereum Signed Message:\n";function a(e){return"string"===typeof e&&(e=(0,o.Y0)(e)),(0,i.keccak256)((0,r.concat)([(0,o.Y0)(s),(0,o.Y0)(String(e.length)),e]))}},27586:function(e,t,n){"use strict";n.d(t,{Kn:function(){return N},w3:function(){return P},r1:function(){return O},VM:function(){return R}});var r=n(16441),i=n(29251),o=n(38197),s=n(1581),a=n(35644);function c(e,t){null==t&&(t=1);const n=[],r=n.forEach,i=function(e,t){r.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):n.push(e)}))};return i(e,t),n}function u(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function n(){return e[t++]<<8|e[t++]}let r=n(),i=1,o=[0,1];for(let w=1;w>--c&1}const d=Math.pow(2,31),f=d>>>1,h=f>>1,p=d-1;let g=0;for(let w=0;w<31;w++)g=g<<1|l();let m=[],b=0,y=d;for(;;){let e=Math.floor(((g-b+1)*i-1)/y),t=0,n=r;for(;n-t>1;){let r=t+n>>>1;e>>1|l(),s=s<<1^f,a=(a^f)<<1|f|1;b=s,y=1+a-s}let v=r-4;return m.map((t=>{switch(t-v){case 3:return v+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return v+256+(e[a++]<<8|e[a++]);case 1:return v+e[a++];default:return t-1}}))}(e))}function l(e){return 1&e?~e>>1:e>>1}function d(e,t){let n=Array(e);for(let r=0,i=-1;rt[e])):n}function p(e,t,n){let r=Array(e).fill(void 0).map((()=>[]));for(let i=0;ir[t].push(e)));return r}function g(e,t){let n=1+t(),r=t(),i=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(n)}return t}(t);return c(p(i.length,1+e,t).map(((e,t)=>{const o=e[0],s=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*r;return[o+t*n,s.map((e=>e+i))]}))})))}function m(e,t){return p(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const b=u((0,n(59567).J)("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),y=new Set(h(b)),v=new Set(h(b)),w=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(g(n,e))}for(;;){let n=e()-1;if(n<0)break;t.push(m(n,e))}return function(e){const t={};for(let n=0;ne-t));return function n(){let r=[];for(;;){let i=h(e,t);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((e,t)=>t.set.size-e.set.size));let i=e(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:r,valid:o,fe0f:s,save:1==i,check:2==i}}()}(b);function S(e){return(0,i.XL)(e)}function A(e){return e.filter((e=>65039!=e))}function E(e){for(let n of e.split(".")){let e=S(n);try{for(let t=e.lastIndexOf(95)-1;t>=0;t--)if(95!==e[t])throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&45===e[2]&&45===e[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${n}": ${t.message}`)}}return e}function _(e){return E(function(e,t){let n=S(e).reverse(),r=[];for(;n.length;){let e=C(n);if(e){r.push(...t(e));continue}let i=n.pop();if(y.has(i)){r.push(i);continue}if(v.has(i))continue;let o=w[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return E((i=String.fromCodePoint(...r),i.normalize("NFC")));var i}(e,A))}function C(e,t){var n;let r,i,o=x,s=[],a=e.length;for(t&&(t.length=0);a;){let c=e[--a];if(o=null===(n=o.branches.find((e=>e.set.has(c))))||void 0===n?void 0:n.node,!o)break;if(o.save)i=c;else if(o.check&&c===i)break;s.push(c),o.fe0f&&(s.push(65039),a>0&&65039==e[a-1]&&a--),o.valid&&(r=s.slice(),2==o.valid&&r.splice(1,1),t&&t.push(...e.slice(a).reverse()),e.length=a)}return r}const I=new s.Logger(a.i),k=new Uint8Array(32);function T(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function M(e){const t=(0,i.Y0)(_(e)),n=[];if(0===e.length)return n;let r=0;for(let i=0;i=t.length)throw new Error("invalid ENS name; empty component");return n.push(T(t.slice(r))),n}function P(e){return M(e).map((e=>(0,i.ZN)(e))).join(".")}function O(e){try{return 0!==M(e).length}catch(t){}return!1}function R(e){"string"!==typeof e&&I.throwArgumentError("invalid ENS name; not a string","name",e);let t=k;const n=M(e);for(;n.length;)t=(0,o.keccak256)((0,r.concat)([t,(0,o.keccak256)(n.pop())]));return(0,r.hexlify)(t)}function N(e){return(0,r.hexlify)((0,r.concat)(M(e).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}k.fill(0)},67827:function(e,t,n){"use strict";n.d(t,{E:function(){return C}});var r=n(19485),i=n(2593),o=n(16441),s=n(38197),a=n(6881),c=n(1581),u=n(35644),l=n(32046),d=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const f=new c.Logger(u.i),h=new Uint8Array(32);h.fill(0);const p=i.O$.from(-1),g=i.O$.from(0),m=i.O$.from(1),b=i.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const y=(0,o.hexZeroPad)(m.toHexString(),32),v=(0,o.hexZeroPad)(g.toHexString(),32),w={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},x=["name","version","chainId","verifyingContract","salt"];function S(e){return function(t){return"string"!==typeof t&&f.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const A={name:S("name"),version:S("version"),chainId:function(e){try{return i.O$.from(e).toString()}catch(t){}return f.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return(0,r.getAddress)(e).toLowerCase()}catch(t){}return f.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=(0,o.arrayify)(e);if(32!==t.length)throw new Error("bad length");return(0,o.hexlify)(t)}catch(t){}return f.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function E(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],r=parseInt(t[2]||"256");(r%8!==0||r>256||t[2]&&t[2]!==String(r))&&f.throwArgumentError("invalid numeric width","type",e);const s=b.mask(n?r-1:r),a=n?s.add(m).mul(p):g;return function(t){const n=i.O$.from(t);return(n.lt(a)||n.gt(s))&&f.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),(0,o.hexZeroPad)(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const n=parseInt(t[1]);return(0===n||n>32||t[1]!==String(n))&&f.throwArgumentError("invalid bytes width","type",e),function(t){return(0,o.arrayify)(t).length!==n&&f.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=(0,o.arrayify)(e),n=t.length%32;return n?(0,o.hexConcat)([t,h.slice(n)]):(0,o.hexlify)(t)}(t)}}}switch(e){case"address":return function(e){return(0,o.hexZeroPad)((0,r.getAddress)(e),32)};case"bool":return function(e){return e?y:v};case"bytes":return function(e){return(0,s.keccak256)(e)};case"string":return function(e){return(0,l.id)(e)}}return null}function _(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class C{constructor(e){(0,a.defineReadOnly)(this,"types",Object.freeze((0,a.deepCopy)(e))),(0,a.defineReadOnly)(this,"_encoderCache",{}),(0,a.defineReadOnly)(this,"_types",{});const t={},n={},r={};Object.keys(e).forEach((e=>{t[e]={},n[e]=[],r[e]={}}));for(const o in e){const r={};e[o].forEach((i=>{r[i.name]&&f.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(o)}`,"types",e),r[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===o&&f.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e);E(s)||(n[s]||f.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",e),n[s].push(o),t[o][s]=!0)}))}const i=Object.keys(n).filter((e=>0===n[e].length));0===i.length?f.throwArgumentError("missing primary type","types",e):i.length>1&&f.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),(0,a.defineReadOnly)(this,"primaryType",i[0]),function i(o,s){s[o]&&f.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),s[o]=!0,Object.keys(t[o]).forEach((e=>{n[e]&&(i(e,s),Object.keys(s).forEach((t=>{r[t][e]=!0})))})),delete s[o]}(this.primaryType,{});for(const o in r){const t=Object.keys(r[o]);t.sort(),this._types[o]=_(o,e[o])+t.map((t=>_(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=E(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],n=this.getEncoder(e),r=parseInt(t[3]);return t=>{r>=0&&t.length!==r&&f.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(n);return this._types[e]&&(i=i.map(s.keccak256)),(0,s.keccak256)((0,o.hexConcat)(i))}}const n=this.types[e];if(n){const t=(0,l.id)(this._types[e]);return e=>{const r=n.map((({name:t,type:n})=>{const r=this.getEncoder(n)(e[t]);return this._types[n]?(0,s.keccak256)(r):r}));return r.unshift(t),(0,o.hexConcat)(r)}}return f.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||f.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return(0,s.keccak256)(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(E(e))return n(e,t);const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const e=r[1],i=parseInt(r[3]);return i>=0&&t.length!==i&&f.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,n)))}const i=this.types[e];return i?i.reduce(((e,{name:r,type:i})=>(e[r]=this._visit(i,t[r],n),e)),{}):f.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new C(e)}static getPrimaryType(e){return C.from(e).primaryType}static hashStruct(e,t,n){return C.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){const r=w[n];r||f.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:r})}return t.sort(((e,t)=>x.indexOf(e.name)-x.indexOf(t.name))),C.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return(0,o.hexConcat)(["0x1901",C.hashDomain(e),C.from(t).hash(n)])}static hash(e,t,n){return(0,s.keccak256)(C.encode(e,t,n))}static resolveNames(e,t,n,r){return d(this,void 0,void 0,(function*(){e=(0,a.shallowCopy)(e);const i={};e.verifyingContract&&!(0,o.isHexString)(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=C.from(t);s.visit(n,((e,t)=>("address"!==e||(0,o.isHexString)(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield r(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=s.visit(n,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:n}}))}static getPayload(e,t,n){C.hashDomain(e);const r={},s=[];x.forEach((t=>{const n=e[t];null!=n&&(r[t]=A[t](n),s.push({name:t,type:w[t]}))}));const c=C.from(t),u=(0,a.shallowCopy)(t);return u.EIP712Domain?f.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):u.EIP712Domain=s,c.encode(n),{types:u,domain:r,primaryType:c.primaryType,message:c.visit(n,((e,t)=>{if(e.match(/^bytes(\d*)/))return(0,o.hexlify)((0,o.arrayify)(t));if(e.match(/^u?int/))return i.O$.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!==typeof t&&f.throwArgumentError("invalid string","value",t),t}return f.throwArgumentError("unsupported type","type",e)}))}}}},38197:function(e,t,n){"use strict";n.r(t),n.d(t,{keccak256:function(){return s}});var r=n(91094),i=n.n(r),o=n(16441);function s(e){return"0x"+i().keccak_256((0,o.arrayify)(e))}},1581:function(e,t,n){"use strict";n.r(t),n.d(t,{ErrorCode:function(){return l},LogLevel:function(){return u},Logger:function(){return f}});let r=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,a=null;const c=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var u,l;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(u||(u={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(l||(l={}));const d="0123456789abcdef";class f{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==o[n]&&this.throwArgumentError("invalid log level name","logLevel",e),s>o[n]||console.log.apply(console,t)}debug(...e){this._log(f.levels.DEBUG,e)}info(...e){this._log(f.levels.INFO,e)}warn(...e){this._log(f.levels.WARNING,e)}makeError(e,t,n){if(i)return this.makeError("censored error",t,{});t||(t=f.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e>4],n+=d[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(a){r.push(e+"="+JSON.stringify(n[e].toString()))}})),r.push(`code=${t}`),r.push(`version=${this.version}`);const o=e;let s="";switch(t){case l.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case l.CALL_EXCEPTION:case l.INSUFFICIENT_FUNDS:case l.MISSING_NEW:case l.NONCE_EXPIRED:case l.REPLACEMENT_UNDERPRICED:case l.TRANSACTION_REPLACED:case l.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const a=new Error(e);return a.reason=o,a.code=t,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,f.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),c&&this.throwError("platform missing String.prototype.normalize",f.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:c})}checkSafeUint53(e,t){"number"===typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",et&&this.throwError("too many arguments"+n,f.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",f.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",f.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",f.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return a||(a=new f("logger/5.7.0")),a}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),r){if(!e)return;this.globalLogger().throwError("error censorship permanent",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!e,r=!!t}static setLogLevel(e){const t=o[e.toLowerCase()];null!=t?s=t:f.globalLogger().warn("invalid log level - "+e)}static from(e){return new f(e)}}f.errors=l,f.levels=u},6881:function(e,t,n){"use strict";n.r(t),n.d(t,{Description:function(){return g},checkProperties:function(){return u},deepCopy:function(){return p},defineReadOnly:function(){return s},getStatic:function(){return a},resolveProperties:function(){return c},shallowCopy:function(){return l}});var r=n(1581);var i=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const o=new r.Logger("properties/5.7.0");function s(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function a(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!==typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function c(e){return i(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const n=e[t];return Promise.resolve(n).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function u(e,t){e&&"object"===typeof e||o.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((n=>{t[n]||o.throwArgumentError("invalid object key - "+n,"transaction:"+n,e)}))}function l(e){const t={};for(const n in e)t[n]=e[n];return t}const d={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function f(e){if(void 0===e||null===e||d[typeof e])return!0;if(Array.isArray(e)||"object"===typeof e){if(!Object.isFrozen(e))return!1;const n=Object.keys(e);for(let r=0;rp(e))));if("object"===typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&s(t,n,p(r))}return t}return o.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function p(e){return h(e)}class g{constructor(e){for(const t in e)this[t]=p(e[t])}}},59052:function(e,t,n){"use strict";n.r(t),n.d(t,{decode:function(){return f},encode:function(){return u}});var r=n(16441),i=n(1581);const o=new i.Logger("rlp/5.7.0");function s(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function a(e,t,n){let r=0;for(let i=0;it+1+r&&o.throwError("child data too short",i.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:s}}function d(e,t){if(0===e.length&&o.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&o.throwError("data short segment too short",i.Logger.errors.BUFFER_OVERRUN,{});const r=a(e,t+1,n);return t+1+n+r>e.length&&o.throwError("data long segment too short",i.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{});const s=a(e,t+1,n);t+1+n+s>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+n+s,result:(0,r.hexlify)(e.slice(t+1+n,t+1+n+s))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&o.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:(0,r.hexlify)(e.slice(t+1,t+1+n))}}return{consumed:1,result:(0,r.hexlify)(e[t])}}function f(e){const t=(0,r.arrayify)(e),n=d(t,0);return n.consumed!==t.length&&o.throwArgumentError("invalid rlp data","data",e),n.result}},2006:function(e,t,n){"use strict";n.d(t,{Gy:function(){return f},bP:function(){return u},JQ:function(){return l},o:function(){return d}});var r=n(33715),i=n.n(r),o=n(16441),s=n(21261),a=n(1581);const c=new a.Logger("sha2/5.7.0");function u(e){return"0x"+i().ripemd160().update((0,o.arrayify)(e)).digest("hex")}function l(e){return"0x"+i().sha256().update((0,o.arrayify)(e)).digest("hex")}function d(e){return"0x"+i().sha512().update((0,o.arrayify)(e)).digest("hex")}function f(e,t,n){return s.p[e]||c.throwError("unsupported algorithm "+e,a.Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+i().hmac(i()[e],(0,o.arrayify)(t)).update((0,o.arrayify)(n)).digest("hex")}},21261:function(e,t,n){"use strict";var r;n.d(t,{p:function(){return r}}),function(e){e.sha256="sha256",e.sha512="sha512"}(r||(r={}))},67669:function(e,t,n){"use strict";n.r(t),n.d(t,{SigningKey:function(){return K},computePublicKey:function(){return Y},recoverPublicKey:function(){return X}});var r=n(42500),i=n.n(r),o=n(33715),s=n.n(o);"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self&&self;function a(e,t,n){return n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&n.path)}},e(n,n.exports),n.exports}var c=u;function u(e,t){if(!e)throw new Error(t||"Assertion failed")}u.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var l=a((function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}})),d=a((function(e,t){var n=t;n.assert=c,n.toArray=l.toArray,n.zero2=l.zero2,n.toHex=l.toHex,n.encode=l.encode,n.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,r[s]=a,o.iushrn(1)}return r},n.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0===(1&c)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==u?c:-c,n[0].push(s),a=0===(1&u)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==c?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"===typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new(i())(e,"hex","le")}})),f=d.getNAF,h=d.getJSF,p=d.assert;function g(e,t){this.type=e,this.p=new(i())(t.p,16),this.red=t.prime?i().red(t.prime):i().mont(this.p),this.zero=new(i())(0).toRed(this.red),this.one=new(i())(1).toRed(this.red),this.two=new(i())(2).toRed(this.red),this.n=t.n&&new(i())(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var m=g;function b(e,t){this.curve=e,this.type=t,this.precomputed=null}g.prototype.point=function(){throw new Error("Not implemented")},g.prototype.validate=function(){throw new Error("Not implemented")},g.prototype._fixedNafMul=function(e,t){p(e.precomputed);var n=e._getDoubles(),r=f(t,1,this._bitLength),i=(1<=o;c--)s=(s<<1)+r[c];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;a--){for(var c=0;a>=0&&0===o[a];a--)c++;if(a>=0&&c++,s=s.dblp(c),a<0)break;var u=o[a];p(0!==u),s="affine"===e.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},g.prototype._wnafMulAdd=function(e,t,n,r,i){var o,s,a,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(o=0;o=1;o-=2){var g=o-1,m=o;if(1===c[g]&&1===c[m]){var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=h(n[g],n[m]);for(d=Math.max(v[0].length,d),l[g]=new Array(d),l[m]=new Array(d),s=0;s=0;o--){for(var E=0;o>=0;){var _=!0;for(s=0;s=0&&E++,S=S.dblp(E),o<0)break;for(s=0;s0?a=u[s][C-1>>1]:C<0&&(a=u[s][-C-1>>1].neg()),S="affine"===a.type?S.mixedAdd(a):S.add(a))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},b.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},w.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},w.prototype.pointFromX=function(e,t){(e=new(i())(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},w.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},w.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},S.prototype.isInfinity=function(){return this.inf},S.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},S.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},S.prototype.getX=function(){return this.x.fromRed()},S.prototype.getY=function(){return this.y.fromRed()},S.prototype.mul=function(e){return e=new(i())(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},S.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},S.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},S.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},S.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},S.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},y(A,m.BasePoint),w.prototype.jpoint=function(e,t,n){return new A(this,e,t,n)},A.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},A.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},A.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},A.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},A.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},A.prototype.inspect=function(){return this.isInfinity()?"":""},A.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var E=a((function(e,t){var n=t;n.base=m,n.short=x,n.mont=null,n.edwards=null})),_=a((function(e,t){var n,r=t,i=d.assert;function o(e){"short"===e.type?this.curve=new E.short(e):"edwards"===e.type?this.curve=new E.edwards(e):this.curve=new E.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new o(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(c){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function C(e){if(!(this instanceof C))return new C(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=l.toArray(e.entropy,e.entropyEnc||"hex"),n=l.toArray(e.nonce,e.nonceEnc||"hex"),r=l.toArray(e.pers,e.persEnc||"hex");c(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var I=C;C.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},C.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(r=n,n=t,t=null),n&&(n=l.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var P=d.assert;function O(e,t){if(e instanceof O)return e;this._importDER(e,t)||(P(e.r&&e.s,"Signature without r or s"),this.r=new(i())(e.r,16),this.s=new(i())(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var R=O;function N(){this.place=0}function B(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function L(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}O.prototype._importDER=function(e,t){e=d.toArray(e,t);var n=new N;if(48!==e[n.place++])return!1;var r=B(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var o=B(e,n);if(!1===o)return!1;var s=e.slice(n.place,o+n.place);if(n.place+=o,2!==e[n.place++])return!1;var a=B(e,n);if(!1===a)return!1;if(e.length!==a+n.place)return!1;var c=e.slice(n.place,a+n.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new(i())(s),this.s=new(i())(c),this.recoveryParam=null,!0},O.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=L(t),n=L(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];D(r,t.length),(r=r.concat(t)).push(2),D(r,n.length);var i=r.concat(n),o=[48];return D(o,i.length),o=o.concat(i),d.encode(o,e)};var U=function(){throw new Error("unsupported")},j=d.assert;function F(e){if(!(this instanceof F))return new F(e);"string"===typeof e&&(j(Object.prototype.hasOwnProperty.call(_,e),"Unknown curve "+e),e=_[e]),e instanceof _.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var V=F;F.prototype.keyPair=function(e){return new M(this,e)},F.prototype.keyFromPrivate=function(e,t){return M.fromPrivate(this,e,t)},F.prototype.keyFromPublic=function(e,t){return M.fromPublic(this,e,t)},F.prototype.genKeyPair=function(e){e||(e={});for(var t=new I({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||U(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new(i())(2));;){var o=new(i())(t.generate(n));if(!(o.cmp(r)>0))return o.iaddn(1),this.keyFromPrivate(o)}},F.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},F.prototype.sign=function(e,t,n,r){"object"===typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new(i())(e,16));for(var o=this.n.byteLength(),s=t.getPrivate().toArray("be",o),a=e.toArray("be",o),c=new I({hash:this.hash,entropy:s,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new(i())(1)),l=0;;l++){var d=r.k?r.k(l):new(i())(c.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(u)>=0)){var f=this.g.mul(d);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(0!==p.cmpn(0)){var g=d.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==h.cmp(p)?2:0);return r.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),m^=1),new R({r:p,s:g,recoveryParam:m})}}}}}},F.prototype.verify=function(e,t,n,r){e=this._truncateToN(new(i())(e,16)),n=this.keyFromPublic(n,r);var o=(t=new R(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),l=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},F.prototype.recoverPubKey=function(e,t,n,r){j((3&n)===n,"The recovery param is more than two bits"),t=new R(t,r);var o=this.n,s=new(i())(e),a=t.r,c=t.s,u=1&n,l=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var d=t.r.invm(o),f=o.sub(s).mul(d).umod(o),h=c.mul(d).umod(o);return this.g.mulAdd(f,a,h)},F.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new R(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var q=a((function(e,t){var n=t;n.version="6.5.4",n.utils=d,n.rand=function(){throw new Error("unsupported")},n.curve=E,n.curves=_,n.ec=V,n.eddsa=null})).ec,z=n(16441),H=n(6881);const W=new(n(1581).Logger)("signing-key/5.7.0");let G=null;function Z(){return G||(G=new q("secp256k1")),G}class K{constructor(e){(0,H.defineReadOnly)(this,"curve","secp256k1"),(0,H.defineReadOnly)(this,"privateKey",(0,z.hexlify)(e)),32!==(0,z.hexDataLength)(this.privateKey)&&W.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Z().keyFromPrivate((0,z.arrayify)(this.privateKey));(0,H.defineReadOnly)(this,"publicKey","0x"+t.getPublic(!1,"hex")),(0,H.defineReadOnly)(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),(0,H.defineReadOnly)(this,"_isSigningKey",!0)}_addPoint(e){const t=Z().keyFromPublic((0,z.arrayify)(this.publicKey)),n=Z().keyFromPublic((0,z.arrayify)(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const t=Z().keyFromPrivate((0,z.arrayify)(this.privateKey)),n=(0,z.arrayify)(e);32!==n.length&&W.throwArgumentError("bad digest length","digest",e);const r=t.sign(n,{canonical:!0});return(0,z.splitSignature)({recoveryParam:r.recoveryParam,r:(0,z.hexZeroPad)("0x"+r.r.toString(16),32),s:(0,z.hexZeroPad)("0x"+r.s.toString(16),32)})}computeSharedSecret(e){const t=Z().keyFromPrivate((0,z.arrayify)(this.privateKey)),n=Z().keyFromPublic((0,z.arrayify)(Y(e)));return(0,z.hexZeroPad)("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function X(e,t){const n=(0,z.splitSignature)(t),r={r:(0,z.arrayify)(n.r),s:(0,z.arrayify)(n.s)};return"0x"+Z().recoverPubKey((0,z.arrayify)(e),r,n.recoveryParam).encode("hex",!1)}function Y(e,t){const n=(0,z.arrayify)(e);if(32===n.length){const e=new K(n);return t?"0x"+Z().keyFromPrivate(n).getPublic(!0,"hex"):e.publicKey}return 33===n.length?t?(0,z.hexlify)(n):"0x"+Z().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?t?"0x"+Z().keyFromPublic(n).getPublic(!0,"hex"):(0,z.hexlify)(n):W.throwArgumentError("invalid public or private key","key","[REDACTED]")}},42500:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:n(62808).Buffer}catch(k){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,c=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch(k){o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=p[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modrn(l).toString(e);n=(d=d.idivn(l)).isZero()?g+n:f[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function b(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(e,t,n){return b(e,t,n)}function v(e,t){this.x=e,this.y=t}Math.imul||(m=g),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?g(this,e,t):n<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},v.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new C(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}x.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(S,x),S.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new A;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return w[e]=t,t},C.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},C.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},C.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},C.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},C.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},C.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},C.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},C.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},C.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new I(e)},i(I,C),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},29251:function(e,t,n){"use strict";n.d(t,{Uj:function(){return o},te:function(){return c},Uw:function(){return s},U$:function(){return f},uu:function(){return h},Y0:function(){return l},XL:function(){return g},ZN:function(){return p}});var r=n(16441);const i=new(n(1581).Logger)("strings/5.7.0");var o,s;function a(e,t,n,r,i){if(e===s.BAD_PREFIX||e===s.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r>6===2;r++)e++;return e}return e===s.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(o||(o={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(s||(s={}));const c=Object.freeze({error:function(e,t,n,r,o){return i.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)},ignore:a,replace:function(e,t,n,r,i){return e===s.OVERLONG?(r.push(i),0):(r.push(65533),a(e,t,n))}});function u(e,t){null==t&&(t=c.error),e=(0,r.arrayify)(e);const n=[];let i=0;for(;i>7===0){n.push(r);continue}let o=null,a=null;if(192===(224&r))o=1,a=127;else if(224===(240&r))o=2,a=2047;else{if(240!==(248&r)){i+=t(128===(192&r)?s.UNEXPECTED_CONTINUE:s.BAD_PREFIX,i-1,e,n);continue}o=3,a=65535}if(i-1+o>=e.length){i+=t(s.OVERRUN,i-1,e,n);continue}let c=r&(1<<8-o-1)-1;for(let u=0;u1114111?i+=t(s.OUT_OF_RANGE,i-1-o,e,n,c):c>=55296&&c<=57343?i+=t(s.UTF16_SURROGATE,i-1-o,e,n,c):c<=a?i+=t(s.OVERLONG,i-1-o,e,n,c):n.push(c))}return n}function l(e,t=o.current){t!=o.current&&(i.checkNormalize(),e=e.normalize(t));let n=[];for(let r=0;r>6|192),n.push(63&t|128);else if(55296==(64512&t)){r++;const i=e.charCodeAt(r);if(r>=e.length||56320!==(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&t)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(t>>12|224),n.push(t>>6&63|128),n.push(63&t|128)}return(0,r.arrayify)(n)}function d(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function f(e,t){return'"'+u(e,t).map((e=>{if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?d(e):d(55296+((e-=65536)>>10&1023))+d(56320+(1023&e))})).join("")+'"'}function h(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function p(e,t){return h(u(e,t))}function g(e,t=o.current){return u(l(e,t))}},83875:function(e,t,n){"use strict";n.r(t),n.d(t,{TransactionTypes:function(){return h},accessListify:function(){return S},computeAddress:function(){return y},parse:function(){return k},recoverAddress:function(){return v},serialize:function(){return C}});var r=n(19485),i=n(2593),o=n(16441),s=n(21046),a=n(38197),c=n(6881),u=n(59052),l=n(67669),d=n(1581);const f=new d.Logger("transactions/5.7.0");var h;function p(e){return"0x"===e?null:(0,r.getAddress)(e)}function g(e){return"0x"===e?s._Y:i.O$.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(h||(h={}));const m=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],b={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function y(e){const t=(0,l.computePublicKey)(e);return(0,r.getAddress)((0,o.hexDataSlice)((0,a.keccak256)((0,o.hexDataSlice)(t,1)),12))}function v(e,t){return y((0,l.recoverPublicKey)((0,o.arrayify)(e),t))}function w(e,t){const n=(0,o.stripZeros)(i.O$.from(e).toHexString());return n.length>32&&f.throwArgumentError("invalid length for "+t,"transaction:"+t,e),n}function x(e,t){return{address:(0,r.getAddress)(e),storageKeys:(t||[]).map(((t,n)=>(32!==(0,o.hexDataLength)(t)&&f.throwArgumentError("invalid access list storageKey",`accessList[${e}:${n}]`,t),t.toLowerCase())))}}function S(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&f.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),x(e[0],e[1])):x(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const n=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return x(t,Object.keys(n).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function A(e){return S(e).map((e=>[e.address,e.storageKeys]))}function E(e,t){if(null!=e.gasPrice){const t=i.O$.from(e.gasPrice),n=i.O$.from(e.maxFeePerGas||0);t.eq(n)||f.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:n})}const n=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),w(e.maxFeePerGas||0,"maxFeePerGas"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,r.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",A(e.accessList||[])];if(t){const e=(0,o.splitSignature)(t);n.push(w(e.recoveryParam,"recoveryParam")),n.push((0,o.stripZeros)(e.r)),n.push((0,o.stripZeros)(e.s))}return(0,o.hexConcat)(["0x02",u.encode(n)])}function _(e,t){const n=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.gasPrice||0,"gasPrice"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,r.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",A(e.accessList||[])];if(t){const e=(0,o.splitSignature)(t);n.push(w(e.recoveryParam,"recoveryParam")),n.push((0,o.stripZeros)(e.r)),n.push((0,o.stripZeros)(e.s))}return(0,o.hexConcat)(["0x01",u.encode(n)])}function C(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&f.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){(0,c.checkProperties)(e,b);const n=[];m.forEach((function(t){let r=e[t.name]||[];const i={};t.numeric&&(i.hexPad="left"),r=(0,o.arrayify)((0,o.hexlify)(r,i)),t.length&&r.length!==t.length&&r.length>0&&f.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,r),t.maxLength&&(r=(0,o.stripZeros)(r),r.length>t.maxLength&&f.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,r)),n.push((0,o.hexlify)(r))}));let r=0;if(null!=e.chainId?(r=e.chainId,"number"!==typeof r&&f.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!(0,o.isBytesLike)(t)&&t.v>28&&(r=Math.floor((t.v-35)/2)),0!==r&&(n.push((0,o.hexlify)(r)),n.push("0x"),n.push("0x")),!t)return u.encode(n);const i=(0,o.splitSignature)(t);let s=27+i.recoveryParam;return 0!==r?(n.pop(),n.pop(),n.pop(),s+=2*r+8,i.v>28&&i.v!==s&&f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==s&&f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),n.push((0,o.hexlify)(s)),n.push((0,o.stripZeros)((0,o.arrayify)(i.r))),n.push((0,o.stripZeros)((0,o.arrayify)(i.s))),u.encode(n)}(e,t);switch(e.type){case 1:return _(e,t);case 2:return E(e,t)}return f.throwError(`unsupported transaction type: ${e.type}`,d.Logger.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function I(e,t,n){try{const n=g(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(r){f.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=(0,o.hexZeroPad)(t[1],32),e.s=(0,o.hexZeroPad)(t[2],32);try{const t=(0,a.keccak256)(n(e));e.from=v(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(r){}}function k(e){const t=(0,o.arrayify)(e);if(t[0]>127)return function(e){const t=u.decode(e);9!==t.length&&6!==t.length&&f.throwArgumentError("invalid raw transaction","rawTransaction",e);const n={nonce:g(t[0]).toNumber(),gasPrice:g(t[1]),gasLimit:g(t[2]),to:p(t[3]),value:g(t[4]),data:t[5],chainId:0};if(6===t.length)return n;try{n.v=i.O$.from(t[6]).toNumber()}catch(r){return n}if(n.r=(0,o.hexZeroPad)(t[7],32),n.s=(0,o.hexZeroPad)(t[8],32),i.O$.from(n.r).isZero()&&i.O$.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let i=n.v-27;const s=t.slice(0,6);0!==n.chainId&&(s.push((0,o.hexlify)(n.chainId)),s.push("0x"),s.push("0x"),i-=2*n.chainId+8);const c=(0,a.keccak256)(u.encode(s));try{n.from=v(c,{r:(0,o.hexlify)(n.r),s:(0,o.hexlify)(n.s),recoveryParam:i})}catch(r){}n.hash=(0,a.keccak256)(e)}return n.type=null,n}(t);switch(t[0]){case 1:return function(e){const t=u.decode(e.slice(1));8!==t.length&&11!==t.length&&f.throwArgumentError("invalid component count for transaction type: 1","payload",(0,o.hexlify)(e));const n={type:1,chainId:g(t[0]).toNumber(),nonce:g(t[1]).toNumber(),gasPrice:g(t[2]),gasLimit:g(t[3]),to:p(t[4]),value:g(t[5]),data:t[6],accessList:S(t[7])};return 8===t.length||(n.hash=(0,a.keccak256)(e),I(n,t.slice(8),_)),n}(t);case 2:return function(e){const t=u.decode(e.slice(1));9!==t.length&&12!==t.length&&f.throwArgumentError("invalid component count for transaction type: 2","payload",(0,o.hexlify)(e));const n=g(t[2]),r=g(t[3]),i={type:2,chainId:g(t[0]).toNumber(),nonce:g(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:g(t[4]),to:p(t[5]),value:g(t[6]),data:t[7],accessList:S(t[8])};return 9===t.length||(i.hash=(0,a.keccak256)(e),I(i,t.slice(9),E)),i}(t)}return f.throwError(`unsupported transaction type: ${t[0]}`,d.Logger.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}},37707:function(e,t,n){"use strict";n.r(t),n.d(t,{_fetchData:function(){return p},fetchJson:function(){return g},poll:function(){return m}});var r=n(59567),i=n(16441),o=n(6881),s=n(29251),a=n(1581);var c=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};function u(e,t){return c(this,void 0,void 0,(function*(){null==t&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(n.mode=e.mode),e.cache&&(n.cache=e.cache),e.credentials&&(n.credentials=e.credentials),e.redirect&&(n.redirect=e.redirect),e.referrer&&(n.referrer=e.referrer)}const r=yield fetch(e,n),o=yield r.arrayBuffer(),s={};return r.headers.forEach?r.headers.forEach(((e,t)=>{s[t.toLowerCase()]=e})):r.headers.keys().forEach((e=>{s[e.toLowerCase()]=r.headers.get(e)})),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:(0,i.arrayify)(new Uint8Array(o))}}))}var l=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const d=new a.Logger("web/5.7.1");function f(e){return new Promise((t=>{setTimeout(t,e)}))}function h(e,t){if(null==e)return null;if("string"===typeof e)return e;if((0,i.isBytesLike)(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return(0,s.ZN)(e)}catch(n){}return(0,i.hexlify)(e)}return e}function p(e,t,n){const i="object"===typeof e&&null!=e.throttleLimit?e.throttleLimit:12;d.assertArgument(i>0&&i%1===0,"invalid connection throttle limit","connection.throttleLimit",i);const c="object"===typeof e?e.throttleCallback:null,p="object"===typeof e&&"number"===typeof e.throttleSlotInterval?e.throttleSlotInterval:100;d.assertArgument(p>0&&p%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",p);const g="object"===typeof e&&!!e.errorPassThrough,m={};let b=null;const y={method:"GET"};let v=!1,w=12e4;if("string"===typeof e)b=e;else if("object"===typeof e){if(null!=e&&null!=e.url||d.throwArgumentError("missing URL","connection.url",e),b=e.url,"number"===typeof e.timeout&&e.timeout>0&&(w=e.timeout),e.headers)for(const t in e.headers)m[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(v=!0);if(y.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==b.substring(0,6)&&!0!==e.allowInsecureAuthentication&&d.throwError("basic authentication requires a secure https url",a.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:b,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;m.authorization={key:"Authorization",value:"Basic "+(0,r.c)((0,s.Y0)(t))}}null!=e.skipFetchSetup&&(y.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(y.fetchOptions=(0,o.shallowCopy)(e.fetchOptions))}const x=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),S=b?b.match(x):null;if(S)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":S[1]||"text/plain"},body:S[2]?(0,r.J)(S[3]):(A=S[3],(0,s.Y0)(A.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return n&&(t=n(e.body,e)),Promise.resolve(t)}catch(I){d.throwError("processing response error",a.Logger.errors.SERVER_ERROR,{body:h(S[1],S[2]),error:I,requestBody:null,requestMethod:"GET",url:b})}var A;t&&(y.method="POST",y.body=t,null==m["content-type"]&&(m["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==m["content-length"]&&(m["content-length"]={key:"Content-Length",value:String(t.length)}));const E={};Object.keys(m).forEach((e=>{const t=m[e];E[t.key]=t.value})),y.headers=E;const _=function(){let e=null;return{promise:new Promise((function(t,n){w&&(e=setTimeout((()=>{null!=e&&(e=null,n(d.makeError("timeout",a.Logger.errors.TIMEOUT,{requestBody:h(y.body,E["content-type"]),requestMethod:y.method,timeout:w,url:b})))}),w))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),C=function(){return l(this,void 0,void 0,(function*(){for(let e=0;e=300)&&(_.cancel(),d.throwError("bad response",a.Logger.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:h(r,t.headers?t.headers["content-type"]:null),requestBody:h(y.body,E["content-type"]),requestMethod:y.method,url:b})),n)try{const e=yield n(r,t);return _.cancel(),e}catch(I){if(I.throttleRetry&&e"content-type"===e.toLowerCase())).length||(n.headers=(0,o.shallowCopy)(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return p(e,r,((e,t)=>{let r=null;if(null!=e)try{r=JSON.parse((0,s.ZN)(e))}catch(i){d.throwError("invalid JSON",a.Logger.errors.SERVER_ERROR,{body:e,error:i})}return n&&(r=n(r,t)),r}))}function m(e,t){return t||(t={}),null==(t=(0,o.shallowCopy)(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(n,r){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{s()&&r(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let c=0;!function i(){return e().then((function(e){if(void 0!==e)s()&&n(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(c++,c>a)return void(s()&&r(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));et.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){s()&&r(e)}))}()}))}},73627:function(e,t,n){var r,i;"undefined"!==typeof navigator&&(i=window||{},r=function(){return function(e){"use strict";var t,n="http://www.w3.org/2000/svg",r="",i=-999999,o=!1,s=!0,a="",c=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),u=Math.pow,l=Math.sqrt,d=Math.floor,f=(Math.max,Math.min),h={};function p(){return{}}(function(){var e,t=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],n=t.length;for(e=0;e1?n[1]=1:n[1]<=0&&(n[1]=0),I(n[0],n[1],n[2])}function M(e,t){var n=k(255*e[0],255*e[1],255*e[2]);return n[2]+=t,n[2]>1?n[2]=1:n[2]<0&&(n[2]=0),I(n[0],n[1],n[2])}function P(e,t){var n=k(255*e[0],255*e[1],255*e[2]);return n[0]+=t/360,n[0]>1?n[0]-=1:n[0]<0&&(n[0]+=1),I(n[0],n[1],n[2])}var O=function(){var e,t,n=[];for(e=0;e<256;e+=1)t=e.toString(16),n[e]=1===t.length?"0"+t:t;return function(e,t,r){return e<0&&(e=0),t<0&&(t=0),r<0&&(r=0),"#"+n[e]+n[t]+n[r]}}();function R(){}R.prototype={triggerEvent:function(e,t){if(this._cbs[e])for(var n=this._cbs[e],r=0;r0||e>-1e-6&&e<0?r(e*t)/t:e}function O(){var e=this.props;return"matrix("+P(e[0])+","+P(e[1])+","+P(e[4])+","+P(e[5])+","+P(e[12])+","+P(e[13])+")"}return function(){this.reset=i,this.rotate=o,this.rotateX=s,this.rotateY=a,this.rotateZ=c,this.skew=l,this.skewFromAxis=d,this.shear=u,this.scale=f,this.setTransform=h,this.translate=p,this.transform=g,this.applyToPoint=w,this.applyToX=x,this.applyToY=S,this.applyToZ=A,this.applyToPointArray=k,this.applyToTriplePoints=I,this.applyToPointStringified=T,this.toCSS=M,this.to2dCSS=O,this.clone=y,this.cloneFromProps=v,this.equals=b,this.inversePoints=C,this.inversePoint=_,this.getInverseMatrix=E,this._t=this.transform,this.isIdentity=m,this._identity=!0,this._identityCalculated=!1,this.props=N("float32",16),this.reset()}}();!function(e,t){var n,r=this,i=256,o=6,s=52,a="random",c=t.pow(i,o),u=t.pow(2,s),l=2*u,d=i-1;function f(n,r,s){var d=[],f=m(g((r=!0===r?{entropy:!0}:r||{}).entropy?[n,y(e)]:null===n?b():n,3),d),v=new h(d),w=function(){for(var e=v.g(o),t=c,n=0;e=l;)e/=2,t/=2,n>>>=1;return(e+n)/t};return w.int32=function(){return 0|v.g(4)},w.quick=function(){return v.g(4)/4294967296},w.double=w,m(y(v.S),e),(r.pass||s||function(e,n,r,i){return i&&(i.S&&p(i,v),e.state=function(){return p(v,{})}),r?(t[a]=e,n):e})(w,f,"global"in r?r.global:this==t,r.state)}function h(e){var t,n=e.length,r=this,o=0,s=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o0?n=c:t=c}while(Math.abs(a)>o&&++u=i?m(e,l,t,n):0===d?l:g(e,o,o+c,t,n)}},e}();function H(e,t){var n,r,i=e.length;for(n=0;n-.001&&s<.001}function n(n,r,i,o,s,a,c,u,l){if(0===i&&0===a&&0===l)return t(n,r,o,s,c,u);var d,f=e.sqrt(e.pow(o-n,2)+e.pow(s-r,2)+e.pow(a-i,2)),h=e.sqrt(e.pow(c-n,2)+e.pow(u-r,2)+e.pow(l-i,2)),p=e.sqrt(e.pow(c-o,2)+e.pow(u-s,2)+e.pow(l-a,2));return(d=f>h?f>p?f-h-p:p-h-f:p>h?p-h-f:h-f-p)>-1e-4&&d<1e-4}var r=function(e,t,n,r){var i,o,s,a,c,d,f=g,h=0,p=[],m=[],b=Ce.newElement();for(s=n.length,i=0;is?-1:1,u=!0;u;)if(r[o]<=s&&r[o+1]>s?(a=(s-r[o])/(r[o+1]-r[o]),u=!1):o+=c,o<0||o>=i-1){if(o===i-1)return n[o];u=!1}return n[o]+(n[o+1]-n[o])*a}function f(t,n,r,i,o,s){var a=c(o,s),u=1-a;return[e.round(1e3*(u*u*u*t[0]+(a*u*u+u*a*u+u*u*a)*r[0]+(a*a*u+u*a*a+a*u*a)*i[0]+a*a*a*n[0]))/1e3,e.round(1e3*(u*u*u*t[1]+(a*u*u+u*a*u+u*u*a)*r[1]+(a*a*u+u*a*a+a*u*a)*i[1]+a*a*a*n[1]))/1e3]}var h=N("float32",8);function p(t,n,r,i,o,s,a){o<0?o=0:o>1&&(o=1);var u,l=c(o,a),d=c(s=s>1?1:s,a),f=t.length,p=1-l,g=1-d,m=p*p*p,b=l*p*p*3,y=l*l*p*3,v=l*l*l,w=p*p*g,x=l*p*g+p*l*g+p*p*d,S=l*l*g+p*l*d+l*p*d,A=l*l*d,E=p*g*g,_=l*g*g+p*d*g+p*g*d,C=l*d*g+p*d*d+l*g*d,I=l*d*d,k=g*g*g,T=d*g*g+g*d*g+g*g*d,M=d*d*g+g*d*d+d*g*d,P=d*d*d;for(u=0;u=0;t-=1)if("sh"===e[t].ty)if(e[t].ks.k.i)r(e[t].ks.k);else for(o=e[t].ks.k.length,i=0;in[0]||!(n[0]>e[0])&&(e[1]>n[1]||!(n[1]>e[1])&&(e[2]>n[2]||!(n[2]>e[2])&&null))}var o=function(){var e=[4,4,14];function t(e){var t=e.t.d;e.t.d={k:[{s:t,t:0}]}}function n(e){var n,r=e.length;for(n=0;n=0;n-=1)if("sh"===e[n].ty)if(e[n].ks.k.i)e[n].ks.k.c=e[n].closed;else for(i=e[n].ks.k.length,r=0;r0&&(l=!1),l){var d=D("style");d.setAttribute("f-forigin",r[n].fOrigin),d.setAttribute("f-origin",r[n].origin),d.setAttribute("f-family",r[n].fFamily),d.type="text/css",d.innerText="@font-face {font-family: "+r[n].fFamily+"; font-style: normal; src: url('"+r[n].fPath+"');}",t.appendChild(d)}}else if("g"===r[n].fOrigin||1===r[n].origin){for(a=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),u=0;u=c.t-i){a.h&&(a=c),m=0;break}if(c.t-i>e){m=b;break}b=x||e=x?A.points.length-1:0;for(d=A.points[E].point.length,l=0;l=I&&C=x?(n[0]=w[0],n[1]=w[1],n[2]=w[2]):e<=S?(n[0]=a.s[0],n[1]=a.s[1],n[2]=a.s[2]):o(n,r(s(a.s),s(w),(e-S)/(x-S)));else for(b=0;b=x?f=1:e1e-6?(r=Math.acos(i),o=Math.sin(r),s=Math.sin((1-n)*r)/o,a=Math.sin(n*r)/o):(s=1-n,a=n),c[0]=s*u+a*h,c[1]=s*l+a*p,c[2]=s*d+a*g,c[3]=s*f+a*m,c}function o(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],s=Math.atan2(2*r*o-2*n*i,1-2*r*r-2*i*i),a=Math.asin(2*n*r+2*i*o),c=Math.atan2(2*n*o-2*r*i,1-2*n*n-2*i*i);e[0]=s/m,e[1]=a/m,e[2]=c/m}function s(e){var t=e[0]*m,n=e[1]*m,r=e[2]*m,i=Math.cos(t/2),o=Math.cos(n/2),s=Math.cos(r/2),a=Math.sin(t/2),c=Math.sin(n/2),u=Math.sin(r/2);return[a*c*s+i*o*u,a*o*s+i*c*u,i*c*s-a*o*u,i*o*s-a*c*u]}function a(){var t=this.comp.renderedFrame-this.offsetTime,n=this.keyframes[0].t-this.offsetTime,r=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(t===this._caching.lastFrame||this._caching.lastFrame!==e&&(this._caching.lastFrame>=r&&t>=r||this._caching.lastFrame=t&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var i=this.interpolateValue(t,this._caching);this.pv=i}return this._caching.lastFrame=t,this.pv}function c(e){var n;if("unidimensional"===this.propType)n=e*this.mult,t(this.v-n)>1e-5&&(this.v=n,this._mdf=!0);else for(var r=0,i=this.v.length;r1e-5&&(this.v[r]=n,this._mdf=!0),r+=1}function u(){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{var e;this.lock=!0,this._mdf=this._isFirstFrame;var t=this.effectsSequence.length,n=this.kf?this.pv:this.data.k;for(e=0;e=this.p.keyframes[this.p.keyframes.length-1].t?(r=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/n,0),i=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/n,0)):(r=this.p.pv,i=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/n,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){r=[],i=[];var o=this.px,s=this.py;o._caching.lastFrame+o.offsetTime<=o.keyframes[0].t?(r[0]=o.getValueAtTime((o.keyframes[0].t+.01)/n,0),r[1]=s.getValueAtTime((s.keyframes[0].t+.01)/n,0),i[0]=o.getValueAtTime(o.keyframes[0].t/n,0),i[1]=s.getValueAtTime(s.keyframes[0].t/n,0)):o._caching.lastFrame+o.offsetTime>=o.keyframes[o.keyframes.length-1].t?(r[0]=o.getValueAtTime(o.keyframes[o.keyframes.length-1].t/n,0),r[1]=s.getValueAtTime(s.keyframes[s.keyframes.length-1].t/n,0),i[0]=o.getValueAtTime((o.keyframes[o.keyframes.length-1].t-.01)/n,0),i[1]=s.getValueAtTime((s.keyframes[s.keyframes.length-1].t-.01)/n,0)):(r=[o.pv,s.pv],i[0]=o.getValueAtTime((o._caching.lastFrame+o.offsetTime-.01)/n,o.offsetTime),i[1]=s.getValueAtTime((s._caching.lastFrame+s.offsetTime-.01)/n,s.offsetTime))}else r=i=e;this.v.rotate(-Math.atan2(r[1]-i[1],r[0]-i[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function r(){if(!this.a.k&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}}function i(){}function o(e){this._addDynamicProperty(e),this.elem.addDynamicProperty(e),this._isDirty=!0}function s(e,t,n){if(this.elem=e,this.frameId=-1,this.propType="transform",this.data=t,this.v=new q,this.pre=new q,this.appliedTransformations=0,this.initDynamicPropertyContainer(n||e),t.p&&t.p.s?(this.px=J.getProp(e,t.p.x,0,0,this),this.py=J.getProp(e,t.p.y,0,0,this),t.p.z&&(this.pz=J.getProp(e,t.p.z,0,0,this))):this.p=J.getProp(e,t.p||{k:[0,0,0]},1,0,this),t.rx){if(this.rx=J.getProp(e,t.rx,0,m,this),this.ry=J.getProp(e,t.ry,0,m,this),this.rz=J.getProp(e,t.rz,0,m,this),t.or.k[0].ti){var r,i=t.or.k.length;for(r=0;r=this._maxLength&&this.doubleArrayLength(),n){case"v":o=this.v;break;case"i":o=this.i;break;case"o":o=this.o;break;default:o=[]}(!o[r]||o[r]&&!i)&&(o[r]=Se.newElement()),o[r][0]=e,o[r][1]=t},$.prototype.setTripleAt=function(e,t,n,r,i,o,s,a){this.setXYAt(e,t,"v",s,a),this.setXYAt(n,r,"o",s,a),this.setXYAt(i,o,"i",s,a)},$.prototype.reverse=function(){var e=new $;e.setPathData(this.c,this._length);var t=this.v,n=this.o,r=this.i,i=0;this.c&&(e.setTripleAt(t[0][0],t[0][1],r[0][0],r[0][1],n[0][0],n[0][1],0,!1),i=1);var o,s=this._length-1,a=this._length;for(o=i;o=h[h.length-1].t-this.offsetTime)r=h[h.length-1].s?h[h.length-1].s[0]:h[h.length-2].e[0],o=!0;else{for(var p,g,m,b=f,y=h.length-1,v=!0;v&&(p=h[b],!((g=h[b+1]).t-this.offsetTime>e));)b=g.t-this.offsetTime)l=1;else if(er&&t>r)||(this._caching.lastIndex=i=1?o.push({s:e-1,e:t-1}):(o.push({s:e,e:1}),o.push({s:0,e:t-1}));var s,a,c=[],u=o.length;for(s=0;sr+n||(l=a.s*i<=r?0:(a.s*i-r)/n,d=a.e*i>=r+n?1:(a.e*i-r)/n,c.push([l,d]))}return c.length||c.push([0,0]),c},re.prototype.releasePathsData=function(e){var t,n=e.length;for(t=0;t1?1+o:this.s.v<0?0+o:this.s.v+o)>(n=this.e.v>1?1+o:this.e.v<0?0+o:this.e.v+o)){var s=t;t=n,n=s}t=1e-4*Math.round(1e4*t),n=1e-4*Math.round(1e4*n),this.sValue=t,this.eValue=n}else t=this.sValue,n=this.eValue;var a,c,u,l,d,f=this.shapes.length,h=0;if(n===t)for(i=0;i=0;i-=1)if((p=this.shapes[i]).shape._mdf){for((g=p.localShapeCollection).releaseShapes(),2===this.m&&f>1?(b=this.calculateShapeEdges(t,n,p.totalShapeLength,w,h),w+=p.totalShapeLength):b=[[y,v]],c=b.length,a=0;a=1?m.push({s:p.totalShapeLength*(y-1),e:p.totalShapeLength*(v-1)}):(m.push({s:p.totalShapeLength*y,e:p.totalShapeLength}),m.push({s:0,e:p.totalShapeLength*(v-1)}));var x=this.addShapes(p,m[0]);if(m[0].s!==m[0].e){if(m.length>1)if(p.shape.paths.shapes[p.shape.paths._length-1].c){var S=x.pop();this.addPaths(x,g),x=this.addShapes(p,m[1],S)}else this.addPaths(x,g),x=this.addShapes(p,m[1]);this.addPaths(x,g)}}p.shape.paths=g}}},re.prototype.addPaths=function(e,t){var n,r=e.length;for(n=0;nt.e){n.c=!1;break}t.s<=p&&t.e>=p+s.addedLength?(this.addSegment(f[r].v[i-1],f[r].o[i-1],f[r].i[i],f[r].v[i],n,a,m),m=!1):(u=Z.getNewSegment(f[r].v[i-1],f[r].v[i],f[r].o[i-1],f[r].i[i],(t.s-p)/s.addedLength,(t.e-p)/s.addedLength,c[i-1]),this.addSegmentFromArray(u,n,a,m),m=!1,n.c=!1),p+=s.addedLength,a+=1}if(f[r].c&&c.length){if(s=c[i-1],p<=t.e){var b=c[i-1].addedLength;t.s<=p&&t.e>=p+b?(this.addSegment(f[r].v[i-1],f[r].o[i-1],f[r].i[0],f[r].v[0],n,a,m),m=!1):(u=Z.getNewSegment(f[r].v[i-1],f[r].v[0],f[r].o[i-1],f[r].i[0],(t.s-p)/b,(t.e-p)/b,c[i-1]),this.addSegmentFromArray(u,n,a,m),m=!1,n.c=!1)}else n.c=!1;p+=s.addedLength,a+=1}if(n._length&&(n.setXYAt(n.v[l][0],n.v[l][1],"i",l),n.setXYAt(n.v[n._length-1][0],n.v[n._length-1][1],"o",n._length-1)),p>t.e)break;r0;)n-=1,this._elements.unshift(t[n]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},se.prototype.resetElements=function(e){var t,n=e.length;for(t=0;t0?Math.floor(f):Math.ceil(f),g=this.pMatrix.props,m=this.rMatrix.props,b=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var y,v,w=0;if(f>0){for(;wp;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),w-=1;h&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-h,!0),w-=h)}for(r=1===this.data.m?0:this._currentCopies-1,i=1===this.data.m?1:-1,o=this._currentCopies;o;){if(v=(n=(t=this.elemsData[r].it)[t.length-1].transform.mProps.v.props).length,t[t.length-1].transform.mProps._mdf=!0,t[t.length-1].transform.op._mdf=!0,t[t.length-1].transform.op.v=1===this._currentCopies?this.so.v:this.so.v+(this.eo.v-this.so.v)*(r/(this._currentCopies-1)),0!==w){for((0!==r&&1===i||r!==this._currentCopies-1&&-1===i)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15]),this.matrix.transform(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]),this.matrix.transform(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]),y=0;y.01)return!1;n+=1}return!0},ue.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var e=0,t=this.data.k.k.length;e500)&&(this._imageLoaded(),clearInterval(n)),t+=1}.bind(this),50)}function o(t){var n=r(t,this.assetsPath,this.path),i=L("image");c?this.testImageLoaded(i):i.addEventListener("load",this._imageLoaded,!1),i.addEventListener("error",function(){o.img=e,this._imageLoaded()}.bind(this),!1),i.setAttributeNS("http://www.w3.org/1999/xlink","href",n),this._elementHelper.append?this._elementHelper.append(i):this._elementHelper.appendChild(i);var o={img:i,assetData:t};return o}function s(t){var n=r(t,this.assetsPath,this.path),i=D("img");i.crossOrigin="anonymous",i.addEventListener("load",this._imageLoaded,!1),i.addEventListener("error",function(){o.img=e,this._imageLoaded()}.bind(this),!1),i.src=n;var o={img:i,assetData:t};return o}function a(e){var t={assetData:e},n=r(e,this.assetsPath,this.path);return K.loadData(n,function(e){t.img=e,this._footageLoaded()}.bind(this),function(){t.img={},this._footageLoaded()}.bind(this)),t}function u(e,t){var n;this.imagesLoadedCb=t;var r=e.length;for(n=0;n=a+de||!p?(y=(a+de-u)/c.partialLength,V=h.point[0]+(c.point[0]-h.point[0])*y,q=h.point[1]+(c.point[1]-h.point[1])*y,E.translate(-x[0]*I[i].an*.005,-x[1]*U*.01),l=!1):p&&(u+=c.partialLength,(d+=1)>=p.length&&(d=0,g[f+=1]?p=g[f].points:w.v.c?(d=0,p=g[f=0].points):(u-=c.partialLength,p=null)),p&&(h=c,m=(c=p[d]).partialLength));F=I[i].an/2-I[i].add,E.translate(-F,0,0)}else F=I[i].an/2-I[i].add,E.translate(-F,0,0),E.translate(-x[0]*I[i].an*.005,-x[1]*U*.01,0);for(N=0;N1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},ye.prototype.addEffect=function(e){this.effectsSequence.push(e),this.elem.addDynamicProperty(this)},ye.prototype.getValue=function(e){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length||e){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var t=this.currentData,n=this.keysIndex;if(this.lock)this.setCurrentData(this.currentData);else{var r;this.lock=!0,this._mdf=!1;var i=this.effectsSequence.length,o=e||this.data.d.k[this.keysIndex].s;for(r=0;rt);)n+=1;return this.keysIndex!==n&&(this.keysIndex=n),this.data.d.k[this.keysIndex].s},ye.prototype.buildFinalText=function(e){for(var t,n,r=[],i=0,o=e.length,s=!1;i=55296&&t<=56319?(n=e.charCodeAt(i+1))>=56320&&n<=57343?(s||Y.isModifier(t,n)?(r[r.length-1]+=e.substr(i,2),s=!1):r.push(e.substr(i,2)),i+=1):r.push(e.charAt(i)):t>56319?(n=e.charCodeAt(i+1),Y.isZeroWidthJoiner(t,n)?(s=!0,r[r.length-1]+=e.substr(i,2),i+=1):r.push(e.charAt(i))):Y.isZeroWidthJoiner(t)?(r[r.length-1]+=e.charAt(i),s=!0):r.push(e.charAt(i)),i+=1;return r},ye.prototype.completeTextData=function(e){e.__complete=!0;var t,n,r,i,o,s,a,c=this.elem.globalData.fontManager,u=this.data,l=[],d=0,f=u.m.g,h=0,p=0,g=0,m=[],b=0,y=0,v=c.getFontByName(e.f),w=0,x=X(v);e.fWeight=x.weight,e.fStyle=x.style,e.finalSize=e.s,e.finalText=this.buildFinalText(e.t),n=e.finalText.length,e.finalLineHeight=e.lh;var S,A=e.tr/1e3*e.finalSize;if(e.sz)for(var E,_,C=!0,I=e.sz[0],k=e.sz[1];C;){E=0,b=0,n=(_=this.buildFinalText(e.t)).length,A=e.tr/1e3*e.finalSize;var T=-1;for(t=0;tI&&" "!==_[t]?(-1===T?n+=1:t=T,E+=e.finalLineHeight||1.2*e.finalSize,_.splice(t,T===t?1:0,"\r"),T=-1,b=0):(b+=w,b+=A);E+=v.ascent*e.finalSize/100,this.canResize&&e.finalSize>this.minimumFontSize&&ky?b:y,b=-2*A,i="",r=!0,g+=1):i=M,c.chars?(a=c.getCharData(M,v.fStyle,c.getFontByName(e.f).fFamily),w=r?0:a.w*e.finalSize/100):w=c.measureText(i,e.f,e.finalSize)," "===M?P+=w+A:(b+=w+A+P,P=0),l.push({l:w,an:w,add:h,n:r,anIndexes:[],val:i,line:g,animatorJustifyOffset:0}),2==f){if(h+=w,""===i||" "===i||t===n-1){for(""!==i&&" "!==i||(h-=w);p<=t;)l[p].an=h,l[p].ind=d,l[p].extra=w,p+=1;d+=1,h=0}}else if(3==f){if(h+=w,""===i||t===n-1){for(""===i&&(h-=w);p<=t;)l[p].an=h,l[p].ind=d,l[p].extra=w,p+=1;h=0,d+=1}}else l[d].ind=d,l[d].extra=0,d+=1;if(e.l=l,y=b>y?b:y,m.push(b),e.sz)e.boxWidth=e.sz[0],e.justifyOffset=0;else switch(e.boxWidth=y,e.j){case 1:e.justifyOffset=-e.boxWidth;break;case 2:e.justifyOffset=-e.boxWidth/2;break;default:e.justifyOffset=0}e.lineWidths=m;var O,R,N,B,L=u.a;s=L.length;var D=[];for(o=0;o0?i=this.ne.v/100:o=-this.ne.v/100,this.xe.v>0?s=1-this.xe.v/100:a=1+this.xe.v/100;var c=z.getBezierEasing(i,o,s,a).get,u=0,l=this.finalS,d=this.finalE,f=this.data.sh;if(2===f)u=c(u=d===l?r>=d?1:0:e(0,t(.5/(d-l)+(r-l)/(d-l),1)));else if(3===f)u=c(u=d===l?r>=d?0:1:1-e(0,t(.5/(d-l)+(r-l)/(d-l),1)));else if(4===f)d===l?u=0:(u=e(0,t(.5/(d-l)+(r-l)/(d-l),1)))<.5?u*=2:u=1-2*(u-.5),u=c(u);else if(5===f){if(d===l)u=0;else{var h=d-l,p=-h/2+(r=t(e(0,r+.5-l),d-l)),g=h/2;u=Math.sqrt(1-p*p/(g*g))}u=c(u)}else 6===f?(d===l?u=0:(r=t(e(0,r+.5-l),d-l),u=(1+Math.cos(Math.PI+2*Math.PI*r/(d-l)))/2),u=c(u)):(r>=n(l)&&(u=e(0,t(r-l<0?t(d,1)-(l-r):d-r,1))),u=c(u));if(100!==this.sm.v){var m=.01*this.sm.v;0===m&&(m=1e-8);var b=.5-.5*m;u1&&(u=1)}return u*this.a.v},getValue:function(e){this.iterateDynamicProperties(),this._mdf=e||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,e&&2===this.data.r&&(this.e.v=this._currentTextLength);var t=2===this.data.r?1:100/this.data.totalChars,n=this.o.v/t,r=this.s.v/t+n,i=this.e.v/t+n;if(r>i){var o=r;r=i,i=o}this.finalS=r,this.finalE=i}},H([U],r),{getTextSelectorProp:i}}(),we=function(e,t,n){var r=0,i=e,o=B(i);function s(){return r?o[r-=1]:t()}function a(e){r===i&&(o=xe.double(o),i*=2),n&&n(e),o[r]=e,r+=1}return{newElement:s,release:a}},xe=function(){function e(e){return e.concat(B(e.length))}return{double:e}}(),Se=function(){function e(){return N("float32",2)}return we(8,e)}(),Ae=function(){function e(){return new $}function t(e){var t,n=e._length;for(t=0;t0&&(this.maskElement.setAttribute("id",b),this.element.maskedElement.setAttribute(v,"url("+r+"#"+b+")"),s.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}function Pe(){}function Oe(){}function Re(){}function Ne(){}function Be(){}function Le(e,t){this.elem=e,this.pos=t}function De(e,t){this.data=e,this.type=e.ty,this.d="",this.lvl=t,this._mdf=!1,this.closed=!0===e.hd,this.pElem=L("path"),this.msElem=null}function Ue(e,t,n){this.caches=[],this.styles=[],this.transformers=e,this.lStr="",this.sh=n,this.lvl=t,this._isAnimated=!!n.k;for(var r=0,i=e.length;r=0;t-=1)this.elements[t]||(n=this.layers[t]).ip-n.st<=e-this.layers[t].st&&n.op-n.st>e-this.layers[t].st&&this.buildItem(t),this.completeLayers=!!this.elements[t]&&this.completeLayers;this.checkPendingElements()},ke.prototype.createItem=function(e){switch(e.ty){case 2:return this.createImage(e);case 0:return this.createComp(e);case 1:return this.createSolid(e);case 3:default:return this.createNull(e);case 4:return this.createShape(e);case 5:return this.createText(e);case 6:return this.createAudio(e);case 13:return this.createCamera(e);case 15:return this.createFootage(e)}},ke.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},ke.prototype.createAudio=function(e){return new tt(e,this.globalData,this)},ke.prototype.createFootage=function(e){return new FootageElement(e,this.globalData,this)},ke.prototype.buildAllItems=function(){var e,t=this.layers.length;for(e=0;e=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].prepareFrame(e-this.layers[t].st);if(this.globalData._mdf)for(t=0;t1&&(o+=" C"+t.o[r-1][0]+","+t.o[r-1][1]+" "+t.i[0][0]+","+t.i[0][1]+" "+t.v[0][0]+","+t.v[0][1]),n.lastPath!==o){var s="";n.elem&&(t.c&&(s=e.inv?this.solidPath+o:o),n.elem.setAttribute("d",s)),n.lastPath=o}},Me.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null},Pe.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(e){this.hierarchy=e},setAsParent:function(){this._isParent=!0},checkParenting:function(){void 0!==this.data.parent&&this.comp.buildElementParenting(this,this.data.parent,[])}},Oe.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(e,t){var n,r=this.dynamicProperties.length;for(n=0;ne?!0!==this.isInRange&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):!1!==this.isInRange&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,t=this.renderableComponents.length;for(e=0;e0;)c=r.transformers[g].mProps._mdf||c,p-=1,g-=1;if(c)for(p=b-r.styles[l].lvl,g=r.transformers.length-1;p>0;)h=r.transformers[g].mProps.v.props,f.transform(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]),p-=1,g-=1}else f=e;if(s=(d=r.sh.paths)._length,c){for(a="",o=0;o=1?y=.99:y<=-1&&(y=-.99);var v=a*y,w=Math.cos(b+t.a.v)*v+l[0],x=Math.sin(b+t.a.v)*v+l[1];c.setAttribute("fx",w),c.setAttribute("fy",x),u&&!t.g._collapsable&&(t.of.setAttribute("fx",w),t.of.setAttribute("fy",x))}}function c(e,t,n){var r=t.style,i=t.d;i&&(i._mdf||n)&&i.dashStr&&(r.pElem.setAttribute("stroke-dasharray",i.dashStr),r.pElem.setAttribute("stroke-dashoffset",i.dashoffset[0])),t.c&&(t.c._mdf||n)&&r.pElem.setAttribute("stroke","rgb("+d(t.c.v[0])+","+d(t.c.v[1])+","+d(t.c.v[2])+")"),(t.o._mdf||n)&&r.pElem.setAttribute("stroke-opacity",t.o.v),(t.w._mdf||n)&&(r.pElem.setAttribute("stroke-width",t.w.v),r.msElem&&r.msElem.setAttribute("stroke-width",t.w.v))}return{createRenderFunction:n}}();function Ge(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}function Ze(){}function Ke(e,t,n){this.initFrame(),this.initBaseData(e,t,n),this.initFrame(),this.initTransform(e,t,n),this.initHierarchy()}function Xe(){}function Ye(){}function Je(){}function Qe(){}function $e(e,t,n){this.assetData=t.getAssetData(e.refId),this.initElement(e,t,n),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}function et(e,t,n){this.initElement(e,t,n)}function tt(e,t,n){this.initFrame(),this.initRenderable(),this.assetData=t.getAssetData(e.refId),this.initBaseData(e,t,n),this._isPlaying=!1,this._canPlay=!1;var r=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(r),this._currentTime=0,this.globalData.audioController.addAudio(this),this.tm=e.tm?J.getProp(this,e.tm,0,t.frameRate,this):{_placeholder:!0}}function nt(e,t,n){this.layers=e.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?B(this.layers.length):[],this.initElement(e,t,n),this.tm=e.tm?J.getProp(this,e.tm,0,t.frameRate,this):{_placeholder:!0}}function rt(e,t,n){this.textSpans=[],this.renderType="svg",this.initElement(e,t,n)}function it(e,t,n){this.shapes=[],this.shapesData=e.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(e,t,n),this.prevViewData=[]}function ot(e,t){this.filterManager=t;var n=L("feColorMatrix");if(n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","linearRGB"),n.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),n.setAttribute("result","f1"),e.appendChild(n),(n=L("feColorMatrix")).setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),n.setAttribute("result","f2"),e.appendChild(n),this.matrixFilter=n,100!==t.effectElements[2].p.v||t.effectElements[2].p.k){var r,i=L("feMerge");e.appendChild(i),(r=L("feMergeNode")).setAttribute("in","SourceGraphic"),i.appendChild(r),(r=L("feMergeNode")).setAttribute("in","f2"),i.appendChild(r)}}function st(e,t){this.filterManager=t;var n=L("feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),e.appendChild(n),this.matrixFilter=n}function at(e,t){e.setAttribute("x","-100%"),e.setAttribute("y","-100%"),e.setAttribute("width","300%"),e.setAttribute("height","300%"),this.filterManager=t;var n=L("feGaussianBlur");e.appendChild(n),this.feGaussianBlur=n}function ct(e,t){this.initialized=!1,this.filterManager=t,this.elem=e,this.paths=[]}function ut(e,t){this.filterManager=t;var n=L("feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","linearRGB"),n.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),n.setAttribute("result","f1"),e.appendChild(n);var r=L("feComponentTransfer");r.setAttribute("color-interpolation-filters","sRGB"),e.appendChild(r),this.matrixFilter=r;var i=L("feFuncR");i.setAttribute("type","table"),r.appendChild(i),this.feFuncR=i;var o=L("feFuncG");o.setAttribute("type","table"),r.appendChild(o),this.feFuncG=o;var s=L("feFuncB");s.setAttribute("type","table"),r.appendChild(s),this.feFuncB=s}function lt(e,t){this.filterManager=t;var n=this.filterManager.effectElements,r=L("feComponentTransfer");(n[10].p.k||0!==n[10].p.v||n[11].p.k||1!==n[11].p.v||n[12].p.k||1!==n[12].p.v||n[13].p.k||0!==n[13].p.v||n[14].p.k||1!==n[14].p.v)&&(this.feFuncR=this.createFeFunc("feFuncR",r)),(n[17].p.k||0!==n[17].p.v||n[18].p.k||1!==n[18].p.v||n[19].p.k||1!==n[19].p.v||n[20].p.k||0!==n[20].p.v||n[21].p.k||1!==n[21].p.v)&&(this.feFuncG=this.createFeFunc("feFuncG",r)),(n[24].p.k||0!==n[24].p.v||n[25].p.k||1!==n[25].p.v||n[26].p.k||1!==n[26].p.v||n[27].p.k||0!==n[27].p.v||n[28].p.k||1!==n[28].p.v)&&(this.feFuncB=this.createFeFunc("feFuncB",r)),(n[31].p.k||0!==n[31].p.v||n[32].p.k||1!==n[32].p.v||n[33].p.k||1!==n[33].p.v||n[34].p.k||0!==n[34].p.v||n[35].p.k||1!==n[35].p.v)&&(this.feFuncA=this.createFeFunc("feFuncA",r)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(r.setAttribute("color-interpolation-filters","sRGB"),e.appendChild(r),r=L("feComponentTransfer")),(n[3].p.k||0!==n[3].p.v||n[4].p.k||1!==n[4].p.v||n[5].p.k||1!==n[5].p.v||n[6].p.k||0!==n[6].p.v||n[7].p.k||1!==n[7].p.v)&&(r.setAttribute("color-interpolation-filters","sRGB"),e.appendChild(r),this.feFuncRComposed=this.createFeFunc("feFuncR",r),this.feFuncGComposed=this.createFeFunc("feFuncG",r),this.feFuncBComposed=this.createFeFunc("feFuncB",r))}function dt(e,t){var n=t.container.globalData.renderConfig.filterSize;e.setAttribute("x",n.x),e.setAttribute("y",n.y),e.setAttribute("width",n.width),e.setAttribute("height",n.height),this.filterManager=t;var r=L("feGaussianBlur");r.setAttribute("in","SourceAlpha"),r.setAttribute("result","drop_shadow_1"),r.setAttribute("stdDeviation","0"),this.feGaussianBlur=r,e.appendChild(r);var i=L("feOffset");i.setAttribute("dx","25"),i.setAttribute("dy","0"),i.setAttribute("in","drop_shadow_1"),i.setAttribute("result","drop_shadow_2"),this.feOffset=i,e.appendChild(i);var o=L("feFlood");o.setAttribute("flood-color","#00ff00"),o.setAttribute("flood-opacity","1"),o.setAttribute("result","drop_shadow_3"),this.feFlood=o,e.appendChild(o);var s=L("feComposite");s.setAttribute("in","drop_shadow_3"),s.setAttribute("in2","drop_shadow_2"),s.setAttribute("operator","in"),s.setAttribute("result","drop_shadow_4"),e.appendChild(s);var a,c=L("feMerge");e.appendChild(c),a=L("feMergeNode"),c.appendChild(a),(a=L("feMergeNode")).setAttribute("in","SourceGraphic"),this.feMergeNode=a,this.feMerge=c,this.originalNodeAdded=!1,c.appendChild(a)}Ge.prototype={addTransformSequence:function(e){var t,n=e.length,r="_";for(t=0;t=0;r-=1)n=e.transforms[r].transform.mProps.v.props,e.finalTransform.transform(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15]);e._mdf=o},processSequences:function(e){var t,n=this.sequenceList.length;for(t=0;t=0&&!this.shapeModifiers[e].processShapes(this._isFirstFrame);e-=1);}},searchProcessedElement:function(e){for(var t=this.processedElements,n=0,r=t.length;n=0;n-=1)(this.completeLayers||this.elements[n])&&(this.elements[n].prepareFrame(this.renderedFrame-this.layers[n].st),this.elements[n]._mdf&&(this._mdf=!0))}},Qe.prototype.renderInnerContent=function(){var e,t=this.layers.length;for(e=0;e.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},tt.prototype.show=function(){},tt.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},tt.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},tt.prototype.resume=function(){this._canPlay=!0},tt.prototype.setRate=function(e){this.audio.rate(e)},tt.prototype.volume=function(e){this.audio.volume(e)},tt.prototype.getBaseElement=function(){return null},tt.prototype.destroy=function(){},tt.prototype.sourceRectAtTime=function(){},tt.prototype.initExpressions=function(){},H([Te,Qe,Xe],nt),H([Ze,Re,Xe,Pe,Oe,Be,Je],rt),rt.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=L("text"))},rt.prototype.buildTextContents=function(e){for(var t=0,n=e.length,r=[],i="";te?this.textSpans[e]:L(c?"path":"text"),v<=e&&(s.setAttribute("stroke-linecap","butt"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("stroke-miterlimit","4"),this.textSpans[e]=s,this.layerElement.appendChild(s)),s.style.display="inherit"),l.reset(),l.scale(n.finalSize/100,n.finalSize/100),f&&(a[e].n&&(h=-m,p+=n.yOffset,p+=g?1:0,g=!1),this.applyTextPropertiesToMatrix(n,l,a[e].line,h,p),h+=a[e].l||0,h+=m),c?(u=(b=(y=this.globalData.fontManager.getCharData(n.finalText[e],r.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily))&&y.data||{}).shapes?b.shapes[0].it:[],f?d+=this.createPathShape(l,u):s.setAttribute("d",this.createPathShape(l,u))):(f&&s.setAttribute("transform","translate("+l.props[12]+","+l.props[13]+")"),s.textContent=a[e].val,s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"));f&&s&&s.setAttribute("d",d)}else{var w=this.textContainer,x="start";switch(n.j){case 1:x="end";break;case 2:x="middle";break;default:x="start"}w.setAttribute("text-anchor",x),w.setAttribute("letter-spacing",m);var S=this.buildTextContents(n.finalText);for(t=S.length,p=n.ps?n.ps[1]+n.ascent:0,e=0;e1&&a&&this.setShapesAsAnimated(s)}},it.prototype.setShapesAsAnimated=function(e){var t,n=e.length;for(t=0;t=0;a-=1){if((f=this.searchProcessedElement(e[a]))?t[a]=n[f-1]:e[a]._render=s,"fl"===e[a].ty||"st"===e[a].ty||"gf"===e[a].ty||"gs"===e[a].ty)f?t[a].style.closed=!1:t[a]=this.createStyleElement(e[a],i),e[a]._render&&t[a].style.pElem.parentNode!==r&&r.appendChild(t[a].style.pElem),g.push(t[a].style);else if("gr"===e[a].ty){if(f)for(u=t[a].it.length,c=0;c=l?p<0?r:i:r+h*Math.pow((o-e)/p,1/n),d[f]=s,f+=1,a+=256/(c-1);return d.join(" ")},lt.prototype.renderFrame=function(e){if(e||this.filterManager._mdf){var t,n=this.filterManager.effectElements;this.feFuncRComposed&&(e||n[3].p._mdf||n[4].p._mdf||n[5].p._mdf||n[6].p._mdf||n[7].p._mdf)&&(t=this.getTableValue(n[3].p.v,n[4].p.v,n[5].p.v,n[6].p.v,n[7].p.v),this.feFuncRComposed.setAttribute("tableValues",t),this.feFuncGComposed.setAttribute("tableValues",t),this.feFuncBComposed.setAttribute("tableValues",t)),this.feFuncR&&(e||n[10].p._mdf||n[11].p._mdf||n[12].p._mdf||n[13].p._mdf||n[14].p._mdf)&&(t=this.getTableValue(n[10].p.v,n[11].p.v,n[12].p.v,n[13].p.v,n[14].p.v),this.feFuncR.setAttribute("tableValues",t)),this.feFuncG&&(e||n[17].p._mdf||n[18].p._mdf||n[19].p._mdf||n[20].p._mdf||n[21].p._mdf)&&(t=this.getTableValue(n[17].p.v,n[18].p.v,n[19].p.v,n[20].p.v,n[21].p.v),this.feFuncG.setAttribute("tableValues",t)),this.feFuncB&&(e||n[24].p._mdf||n[25].p._mdf||n[26].p._mdf||n[27].p._mdf||n[28].p._mdf)&&(t=this.getTableValue(n[24].p.v,n[25].p.v,n[26].p.v,n[27].p.v,n[28].p.v),this.feFuncB.setAttribute("tableValues",t)),this.feFuncA&&(e||n[31].p._mdf||n[32].p._mdf||n[33].p._mdf||n[34].p._mdf||n[35].p._mdf)&&(t=this.getTableValue(n[31].p.v,n[32].p.v,n[33].p.v,n[34].p.v,n[35].p.v),this.feFuncA.setAttribute("tableValues",t))}},dt.prototype.renderFrame=function(e){if(e||this.filterManager._mdf){if((e||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),e||this.filterManager.effectElements[0].p._mdf){var t=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",O(Math.round(255*t[0]),Math.round(255*t[1]),Math.round(255*t[2])))}if((e||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),e||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var n=this.filterManager.effectElements[3].p.v,r=(this.filterManager.effectElements[2].p.v-90)*m,i=n*Math.cos(r),o=n*Math.sin(r);this.feOffset.setAttribute("dx",i),this.feOffset.setAttribute("dy",o)}}};var ft=[];function ht(e,t,n){this.initialized=!1,this.filterManager=t,this.filterElem=e,this.elem=n,n.matteElement=L("g"),n.matteElement.appendChild(n.layerElement),n.matteElement.appendChild(n.transformedElement),n.baseElement=n.matteElement}function pt(){}ht.prototype.findSymbol=function(e){for(var t=0,n=ft.length;t=0;t-=1)n[t].animation.destroy(e)}function _(e,t,n){var r,i=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),o=i.length;for(r=0;rthis.animationData.op&&(this.animationData.op=e.op,this.totalFrames=Math.floor(e.op-this.animationData.ip));var t,n,r=this.animationData.layers,i=r.length,o=e.layers,s=o.length;for(n=0;nthis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},mt.prototype.renderFrame=function(){if(!1!==this.isLoaded&&this.renderer)try{this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(e){this.triggerRenderFrameError(e)}},mt.prototype.play=function(e){e&&this.name!==e||!0===this.isPaused&&(this.isPaused=!1,this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},mt.prototype.pause=function(e){e&&this.name!==e||!1===this.isPaused&&(this.isPaused=!0,this._idle=!0,this.trigger("_idle"),this.audioController.pause())},mt.prototype.togglePause=function(e){e&&this.name!==e||(!0===this.isPaused?this.play():this.pause())},mt.prototype.stop=function(e){e&&this.name!==e||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},mt.prototype.getMarkerData=function(e){for(var t,n=0;n=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?t>=this.totalFrames?(this.playCount+=1,this.checkSegments(t%this.totalFrames)||(this.setCurrentRawFrameValue(t%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(t):this.checkSegments(t>this.totalFrames?t%this.totalFrames:0)||(n=!0,t=this.totalFrames-1):t<0?this.checkSegments(t%this.totalFrames)||(!this.loop||this.playCount--<=0&&!0!==this.loop?(n=!0,t=0):(this.setCurrentRawFrameValue(this.totalFrames+t%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(t),n&&(this.setCurrentRawFrameValue(t),this.pause(),this.trigger("complete"))}},mt.prototype.adjustSegment=function(e,t){this.playCount=0,e[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=e[0]-e[1],this.timeCompleted=this.totalFrames,this.firstFrame=e[1],this.setCurrentRawFrameValue(this.totalFrames-.001-t)):e[1]>e[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=e[1]-e[0],this.timeCompleted=this.totalFrames,this.firstFrame=e[0],this.setCurrentRawFrameValue(.001+t)),this.trigger("segmentStart")},mt.prototype.setSegment=function(e,t){var n=-1;this.isPaused&&(this.currentRawFrame+this.firstFramet&&(n=t-e)),this.firstFrame=e,this.totalFrames=t-e,this.timeCompleted=this.totalFrames,-1!==n&&this.goToAndStop(n,!0)},mt.prototype.playSegments=function(e,t){if(t&&(this.segments.length=0),"object"===typeof e[0]){var n,r=e.length;for(n=0;n1&&(g=e);y(!(g>=50))}function _t(){return"undefined"!==typeof navigator}function Ct(e,n){"expressions"===e&&(t=n)}function It(e){switch(e){case"propertyFactory":return J;case"shapePropertyFactory":return ee;case"matrix":return q;default:return null}}function kt(){"complete"===document.readyState&&(clearInterval(Lt),wt())}function Tt(e){for(var t=Mt.split("&"),n=0;n=0||(i[n]=e[n]);return i}(e,d),s=r.Children.only(t),a=i.isForwardRef(s)?l:u,c=s&&o&&Object.keys(o).length>0?r.cloneElement(s,o):s;return r.createElement(a,{innerRef:n},c)}},34714:function(e,t,n){"use strict";n.d(t,{I:function(){return i},n:function(){return r}});var r=function(e,t){"function"!==typeof e?null!==e&&"object"===typeof e&&(e.current=t):e(t)},i=function(e){return null!==e&&"object"===typeof e&&e.hasOwnProperty("current")}},46702:function(e,t,n){"use strict";var r=n(64836),i=r(n(18698)),o=r(n(56690)),s=r(n(89728)),a=r(n(66115)),c=r(n(61655)),u=r(n(94993)),l=r(n(73808));function d(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=(0,l.default)(e);if(t){var i=(0,l.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var f=n(67294),h=n(99309).generateQuery,p=[],g=!1,m=function(e){(0,c.default)(n,e);var t=d(n);function n(e){var r;(0,o.default)(this,n),(r=t.call(this,e)).renderCaptcha=r.renderCaptcha.bind((0,a.default)(r)),r.resetCaptcha=r.resetCaptcha.bind((0,a.default)(r)),r.removeCaptcha=r.removeCaptcha.bind((0,a.default)(r)),r.handleOnLoad=r.handleOnLoad.bind((0,a.default)(r)),r.handleSubmit=r.handleSubmit.bind((0,a.default)(r)),r.handleExpire=r.handleExpire.bind((0,a.default)(r)),r.handleError=r.handleError.bind((0,a.default)(r));var i="undefined"!==typeof hcaptcha;return r.ref=f.createRef(),r.state={isApiReady:i,isRemoved:!1,elementId:e.id,captchaId:""},r}return(0,s.default)(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.apihost,n=e.assethost,r=e.endpoint,i=e.host,o=e.imghost,s=e.languageOverride,a=e.reCaptchaCompat,c=e.reportapi,u=e.sentry,l=e.custom;this.state.isApiReady?this.renderCaptcha():(g||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g=!0,window.hcaptchaOnLoad=function(){p=p.filter((function(e){return e(),!1}))};var t=e.apihost||"https://js.hcaptcha.com";delete e.apihost;var n=document.createElement("script");n.src="".concat(t,"/1/api.js?render=explicit&onload=hcaptchaOnLoad"),n.async=!0;var r=h(e);n.src+=""!==r?"&".concat(r):"",document.head.appendChild(n)}({apihost:t,assethost:n,endpoint:r,hl:s,host:i,imghost:o,recaptchacompat:!1===a?"off":null,reportapi:c,sentry:u,custom:l}),p.push(this.handleOnLoad))}},{key:"componentWillUnmount",value:function(){var e=this.state,t=e.isApiReady,n=e.isRemoved,r=e.captchaId;t&&!n&&(hcaptcha.reset(r),hcaptcha.remove(r))}},{key:"shouldComponentUpdate",value:function(e,t){return this.state.isApiReady===t.isApiReady&&this.state.isRemoved===t.isRemoved}},{key:"componentDidUpdate",value:function(e){var t=this;["sitekey","size","theme","tabindex","languageOverride","endpoint"].every((function(n){return e[n]===t.props[n]}))||this.removeCaptcha((function(){t.renderCaptcha()}))}},{key:"renderCaptcha",value:function(e){if(this.state.isApiReady){var t=Object.assign({"error-callback":this.handleError,"expired-callback":this.handleExpire,callback:this.handleSubmit},this.props,{hl:this.props.hl||this.props.languageOverride,languageOverride:void 0}),n=hcaptcha.render(this.ref.current,t);this.setState({isRemoved:!1,captchaId:n},(function(){e&&e()}))}}},{key:"resetCaptcha",value:function(){var e=this.state,t=e.isApiReady,n=e.isRemoved,r=e.captchaId;t&&!n&&hcaptcha.reset(r)}},{key:"removeCaptcha",value:function(e){var t=this.state,n=t.isApiReady,r=t.isRemoved,i=t.captchaId;n&&!r&&this.setState({isRemoved:!0},(function(){hcaptcha.remove(i),e&&e()}))}},{key:"handleOnLoad",value:function(){var e=this;this.setState({isApiReady:!0},(function(){e.renderCaptcha((function(){var t=e.props.onLoad;t&&t()}))}))}},{key:"handleSubmit",value:function(e){var t=this.props.onVerify,n=this.state,r=n.isRemoved,i=n.captchaId;"undefined"===typeof hcaptcha||r||t(hcaptcha.getResponse(i),hcaptcha.getRespKey(i))}},{key:"handleExpire",value:function(){var e=this.props.onExpire,t=this.state,n=t.isApiReady,r=t.isRemoved,i=t.captchaId;n&&!r&&(hcaptcha.reset(i),e&&e())}},{key:"handleError",value:function(e){var t=this.props.onError,n=this.state,r=n.isApiReady,i=n.isRemoved,o=n.captchaId;r&&!i&&(hcaptcha.reset(o),t&&t(e))}},{key:"execute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.state,n=t.isApiReady,r=t.isRemoved,o=t.captchaId;if(n&&!r)return e&&"object"!==(0,i.default)(e)&&(e=null),hcaptcha.execute(o,e)}},{key:"render",value:function(){var e=this.state.elementId;return f.createElement("div",{ref:this.ref,id:e})}}]),n}(f.Component);e.exports=m},99309:function(e,t,n){"use strict";var r=n(64836)(n(27424));e.exports={generateQuery:function(e){return Object.entries(e).filter((function(e){var t=(0,r.default)(e,2),n=(t[0],t[1]);return n||!1===n})).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(i))})).join("&")}}},33037:function(e){e.exports=function(){return e={418:function(e,t){!function(e,t){for(var n in t)e[n]=t[n]}(t,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={splitValues:!1});var n,i=this;this.headersMap={},e&&("undefined"!=typeof Headers&&e instanceof Headers?r.getHeaderKeys(e).forEach((function(n){r.getHeaderValues(e,n).forEach((function(e){t.splitValues?i.append(n,r.splitHeaderValue(e)):i.append(n,e)}))})):"object"==typeof(n=e)&&"object"==typeof n.headersMap&&"function"==typeof n.forEach?e.forEach((function(e,t){i.append(e,t)})):"undefined"!=typeof Map&&e instanceof Map?e.forEach((function(e,t){i.append(t,e)})):"string"==typeof e?this.appendFromString(e):"object"==typeof e&&Object.getOwnPropertyNames(e).forEach((function(t){var n=e[t];Array.isArray(n)?n.forEach((function(e){i.append(t,e)})):i.append(t,n)})))}return e.prototype.appendFromString=function(e){for(var t=e.split("\r\n"),n=0;n0){var o=r.substring(0,i).trim(),s=r.substring(i+1).trim();this.append(o,s)}}},e.prototype.delete=function(e,t){var n=r.normalizeName(e);if(void 0===t)delete this.headersMap[n];else{var i=this.headersMap[n];if(i){var o=i.indexOf(t);o>=0&&i.splice(o,1),0===i.length&&delete this.headersMap[n]}}},e.prototype.append=function(e,t){var n=this,i=r.normalizeName(e);Array.isArray(this.headersMap[i])||(this.headersMap[i]=[]),Array.isArray(t)?t.forEach((function(e){n.headersMap[i].push(r.normalizeValue(e))})):this.headersMap[i].push(r.normalizeValue(t))},e.prototype.set=function(e,t){var n=r.normalizeName(e);if(Array.isArray(t)){var i=[];t.forEach((function(e){i.push(r.normalizeValue(e))})),this.headersMap[n]=i}else this.headersMap[n]=[r.normalizeValue(t)]},e.prototype.has=function(e,t){var n=this.headersMap[r.normalizeName(e)];if(!Array.isArray(n))return!1;if(void 0!==t){var i=r.normalizeValue(t);return n.indexOf(i)>=0}return!0},e.prototype.get=function(e){var t=this.headersMap[r.normalizeName(e)];return void 0!==t?t.concat():[]},e.prototype.forEach=function(e){var t=this;Object.getOwnPropertyNames(this.headersMap).forEach((function(n){e(n,t.headersMap[n])}),this)},e.prototype.toHeaders=function(){if("undefined"!=typeof Headers){var e=new Headers;return this.forEach((function(t,n){n.forEach((function(n){e.append(t,n)}))})),e}throw new Error("Headers class is not defined")},e}();t.BrowserHeaders=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);t.BrowserHeaders=r.BrowserHeaders},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iterateHeaders=function(e,t){for(var n=e[Symbol.iterator](),r=n.next();!r.done;)t(r.value[0]),r=n.next()},t.iterateHeadersKeys=function(e,t){for(var n=e.keys(),r=n.next();!r.done;)t(r.value),r=n.next()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.normalizeName=function(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()},t.normalizeValue=function(e){return"string"!=typeof e&&(e=String(e)),e},t.getHeaderValues=function(e,t){var n=e;if(n instanceof Headers&&n.getAll)return n.getAll(t);var r=n.get(t);return r&&"string"==typeof r?[r]:r},t.getHeaderKeys=function(e){var t=e,n={},i=[];return t.keys?r.iterateHeadersKeys(t,(function(e){n[e]||(n[e]=!0,i.push(e))})):t.forEach?t.forEach((function(e,t){n[t]||(n[t]=!0,i.push(t))})):r.iterateHeaders(t,(function(e){var t=e[0];n[t]||(n[t]=!0,i.push(t))})),i},t.splitHeaderValue=function(e){var t=[];return e.split(", ").forEach((function(e){e.split(",").forEach((function(e){t.push(e)}))})),t}}]))},617:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChunkParser=t.ChunkType=t.encodeASCII=t.decodeASCII=void 0;var r,i=n(65);function o(e){return 9===(t=e)||10===t||13===t||e>=32&&e<=126;var t}function s(e){for(var t=0;t!==e.length;++t)if(!o(e[t]))throw new Error("Metadata is not valid (printable) ASCII");return String.fromCharCode.apply(String,Array.prototype.slice.call(e))}function a(e){return 128==(128&e.getUint8(0))}function c(e){return e.getUint32(1,!1)}function u(e,t,n){return e.byteLength-t>=n}function l(e,t,n){if(e.slice)return e.slice(t,n);var r=e.length;void 0!==n&&(r=n);for(var i=new Uint8Array(r-t),o=0,s=t;s=0?n:o.httpStatusToCode(t);this.props.debug&&s.debug("onHeaders.code",r);var i=e.get("grpc-message")||[];if(this.props.debug&&s.debug("onHeaders.gRPCMessage",i),this.rawOnHeaders(e),r!==o.Code.OK){var a=this.decodeGRPCStatus(i[0]);this.rawOnError(r,a,e)}}},e.prototype.onTransportChunk=function(e){var t=this;if(this.closed)this.props.debug&&s.debug("grpc.onChunk received after request was closed - ignoring");else{var n=[];try{n=this.parser.parse(e)}catch(e){return this.props.debug&&s.debug("onChunk.parsing error",e,e.message),void this.rawOnError(o.Code.Internal,"parsing error: "+e.message)}n.forEach((function(e){if(e.chunkType===i.ChunkType.MESSAGE){var n=t.methodDefinition.responseType.deserializeBinary(e.data);t.rawOnMessage(n)}else e.chunkType===i.ChunkType.TRAILERS&&(t.responseHeaders?(t.responseTrailers=new r.Metadata(e.trailers),t.props.debug&&s.debug("onChunk.trailers",t.responseTrailers)):(t.responseHeaders=new r.Metadata(e.trailers),t.rawOnHeaders(t.responseHeaders)))}))}},e.prototype.onTransportEnd=function(){if(this.props.debug&&s.debug("grpc.onEnd"),this.closed)this.props.debug&&s.debug("grpc.onEnd received after request was closed - ignoring");else if(void 0!==this.responseTrailers){var e=l(this.responseTrailers);if(null!==e){var t=this.responseTrailers.get("grpc-message"),n=this.decodeGRPCStatus(t[0]);this.rawOnEnd(e,n,this.responseTrailers)}else this.rawOnError(o.Code.Internal,"Response closed without grpc-status (Trailers provided)")}else{if(void 0===this.responseHeaders)return void this.rawOnError(o.Code.Unknown,"Response closed without headers");var r=l(this.responseHeaders),i=this.responseHeaders.get("grpc-message");if(this.props.debug&&s.debug("grpc.headers only response ",r,i),null===r)return void this.rawOnEnd(o.Code.Unknown,"Response closed without grpc-status (Headers only)",this.responseHeaders);var a=this.decodeGRPCStatus(i[0]);this.rawOnEnd(r,a,this.responseHeaders)}},e.prototype.decodeGRPCStatus=function(e){if(!e)return"";try{return decodeURIComponent(e)}catch(t){return e}},e.prototype.rawOnEnd=function(e,t,n){var r=this;this.props.debug&&s.debug("rawOnEnd",e,t,n),this.completed||(this.completed=!0,this.onEndCallbacks.forEach((function(i){if(!r.closed)try{i(e,t,n)}catch(e){setTimeout((function(){throw e}),0)}})))},e.prototype.rawOnHeaders=function(e){this.props.debug&&s.debug("rawOnHeaders",e),this.completed||this.onHeadersCallbacks.forEach((function(t){try{t(e)}catch(e){setTimeout((function(){throw e}),0)}}))},e.prototype.rawOnError=function(e,t,n){var i=this;void 0===n&&(n=new r.Metadata),this.props.debug&&s.debug("rawOnError",e,t),this.completed||(this.completed=!0,this.onEndCallbacks.forEach((function(r){if(!i.closed)try{r(e,t,n)}catch(e){setTimeout((function(){throw e}),0)}})))},e.prototype.rawOnMessage=function(e){var t=this;this.props.debug&&s.debug("rawOnMessage",e.toObject()),this.completed||this.closed||this.onMessageCallbacks.forEach((function(n){if(!t.closed)try{n(e)}catch(e){setTimeout((function(){throw e}),0)}}))},e.prototype.onHeaders=function(e){this.onHeadersCallbacks.push(e)},e.prototype.onMessage=function(e){this.onMessageCallbacks.push(e)},e.prototype.onEnd=function(e){this.onEndCallbacks.push(e)},e.prototype.start=function(e){if(this.started)throw new Error("Client already started - cannot .start()");this.started=!0;var t=new r.Metadata(e||{});t.set("content-type","application/grpc-web+proto"),t.set("x-grpc-web","1"),this.transport.start(t)},e.prototype.send=function(e){if(!this.started)throw new Error("Client not started - .start() must be called before .send()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .send()");if(!this.methodDefinition.requestStream&&this.sentFirstMessage)throw new Error("Message already sent for non-client-streaming method - cannot .send()");this.sentFirstMessage=!0;var t=c.frameRequest(e);this.transport.sendMessage(t)},e.prototype.finishSend=function(){if(!this.started)throw new Error("Client not started - .finishSend() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .finishSend()");this.finishedSending=!0,this.transport.finishSend()},e.prototype.close=function(){if(!this.started)throw new Error("Client not started - .start() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .close()");this.closed=!0,this.props.debug&&s.debug("request.abort aborting request"),this.transport.cancel()},e}();function l(e){var t=e.get("grpc-status")||[];if(t.length>0)try{var n=t[0];return parseInt(n,10)}catch(e){return null}return null}},346:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debug=void 0,t.debug=function(){for(var e=[],t=0;t=55296&&n<=56319){var r=e.charCodeAt(t+1);r>=56320&&r<=57343&&(n=65536+(n-55296<<10)+(r-56320))}return n}function d(e){for(var t=new Uint8Array(e.length),n=0,r=0;rs)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},55051:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeFormula=void 0;t.TypeFormula=class{constructor(e,t,n){this.name=e,this.typeParameters=t,this.metadata=n}toString(){const e=this.typeParameters.length>0?`<${this.typeParameters.map((e=>e.toString())).join(", ")}>`:"",t=`${this.name}${e}`;return void 0!==this.metadata?`${t}*${this.metadata}*`:t}}},71154:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeFormulaParser=void 0;const r=n(55051);class i{parseExpression(e){e=e.trim();const t=this.tokenizeExpression(e).filter((e=>e!==i.COMMA)),n=[];for(const r of t)if(this.isPunctuation(r))if(this.isEndOfTypeParameters(r)){const e=this.acquireTypeWithParameters(n);n.push(e)}else{if(!this.isBeginningOfTypeParameters(r))throw new Error(`Unexpected token (punctuation): ${r}`);n.push(r)}else n.push(r);if(1!==n.length)throw new Error(`Unexpected stack length at end of parsing: ${n.length}`);if(i.PUNCTUATION.includes(n[0]))throw new Error("Unexpected root element.");const o=n[0];if(o instanceof r.TypeFormula)return o;if("string"===typeof o)return new r.TypeFormula(o,[]);throw new Error(`Unexpected item on stack: ${o}`)}tokenizeExpression(e){const t=[];let n="";for(const r of e)this.isPunctuation(r)?(n&&(t.push(n.trim()),n=""),t.push(r)):n+=r;return n&&t.push(n.trim()),t}acquireTypeWithParameters(e){const t=this.acquireTypeParameters(e),n=e.pop();if("ManagedDecimal"===n||"ManagedDecimalSigned"===n){const e=t[0].name;return new r.TypeFormula(n,[],e)}return new r.TypeFormula(n,t.reverse())}acquireTypeParameters(e){const t=[];for(;;){const n=e.pop();if(void 0===n)throw new Error("Badly specified type parameters");if(this.isBeginningOfTypeParameters(n))break;if(n instanceof r.TypeFormula)t.push(n);else{if("string"!==typeof n)throw new Error(`Unexpected type parameter object in stack: ${n}`);t.push(new r.TypeFormula(n,[]))}}return t}isPunctuation(e){return i.PUNCTUATION.includes(e)}isEndOfTypeParameters(e){return e===i.END_TYPE_PARAMETERS}isBeginningOfTypeParameters(e){return e===i.BEGIN_TYPE_PARAMETERS}}t.TypeFormulaParser=i,i.BEGIN_TYPE_PARAMETERS="<",i.END_TYPE_PARAMETERS=">",i.COMMA=",",i.PUNCTUATION=[i.COMMA,i.BEGIN_TYPE_PARAMETERS,i.END_TYPE_PARAMETERS]},37570:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const r=n(36946);t.Account=class{constructor(e){this.address=r.Address.empty(),this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}}},80968:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(87698),t)},87698:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.QueryRunnerAdapter=void 0;const i=n(36946),o=n(79793);t.QueryRunnerAdapter=class{constructor(e){this.networkProvider=e.networkProvider}async runQuery(e){const t={address:i.Address.fromBech32(e.contract),caller:e.caller?i.Address.fromBech32(e.caller):void 0,func:e.function,value:e.value,getEncodedArguments:()=>e.arguments.map((e=>r.from(e).toString("hex")))},n=await this.networkProvider.queryContract(t);return new o.SmartContractQueryResponse({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.getReturnDataParts()})}}},36946:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AddressComputer=t.Address=void 0;const c=s(n(92882)),u=a(n(44431)),l=n(71289),d=n(63025),f=s(n(25145)),h=n(82357),p=n(95811),g="0".repeat(16);class m{constructor(e,t){if(!e)return this.publicKey=r.from([]),void(this.hrp=t||l.LibraryConfig.DefaultAddressHrp);if(ArrayBuffer.isView(e)){if(32!=e.length)throw new f.ErrAddressCannotCreate(e);return this.publicKey=r.from(e),void(this.hrp=t||l.LibraryConfig.DefaultAddressHrp)}if(e instanceof m){if(t)throw new f.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");return this.publicKey=e.publicKey,void(this.hrp=e.hrp)}if("string"===typeof e){if(m.isValidHex(e))return this.publicKey=r.from(e,"hex"),void(this.hrp=t||l.LibraryConfig.DefaultAddressHrp);if(t)throw new f.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");const{hrp:n,pubkey:i}=b({value:e,allowCustomHrp:!1});return this.publicKey=i,void(this.hrp=n)}throw new f.ErrAddressCannotCreate(e)}static newFromBech32(e){const{hrp:t,pubkey:n}=b({value:e,allowCustomHrp:!0});return new m(n,t)}static fromBech32(e){const{hrp:t,pubkey:n}=b({value:e,allowCustomHrp:!1});return new m(n,t)}static newFromHex(e,t){if(!m.isValidHex(e))throw new f.ErrAddressCannotCreate(e);return new m(r.from(e,"hex"),t)}static fromHex(e,t){return m.newFromHex(e,t)}static fromAddress(e){return new m(e)}static fromBuffer(e,t){return new m(e,t)}static fromString(e,t){return new m(e,t)}static isValidHex(e){return 32==r.from(e,"hex").length}static empty(){return new m("")}static isValid(e){const t=c.decodeUnsafe(e),n=t?.prefix,i=t?r.from(c.fromWords(t.words)):void 0;return n===l.LibraryConfig.DefaultAddressHrp&&32===i?.length}hex(){return this.toHex()}toHex(){return this.isEmpty()?"":this.publicKey.toString("hex")}bech32(){return this.toBech32()}toBech32(){if(this.isEmpty())return"";let e=c.toWords(this.pubkey());return c.encode(this.hrp,e)}pubkey(){return this.getPublicKey()}getPublicKey(){return this.publicKey}getHrp(){return this.hrp}isEmpty(){return 0==this.publicKey.length}equals(e){return!!e&&this.publicKey.toString()==e.publicKey.toString()}toString(){return this.toBech32()}toJSON(){return{bech32:this.toBech32(),pubkey:this.toHex()}}static Zero(){return new m("0".repeat(64))}isContractAddress(){return this.isSmartContract()}isSmartContract(){return this.toHex().startsWith(g)}}t.Address=m;function b(e){const t=e.value,n=e.allowCustomHrp;let i,o;try{const e=c.decode(t);i=e.prefix,o=r.from(c.fromWords(e.words))}catch(s){throw new f.ErrAddressCannotCreate(t,s)}if(!n&&i!=l.LibraryConfig.DefaultAddressHrp)throw new f.ErrAddressBadHrp(l.LibraryConfig.DefaultAddressHrp,i);return{hrp:i,pubkey:o}}t.AddressComputer=class{constructor(e){this.numberOfShardsWithoutMeta=e||d.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META}computeContractAddress(e,t){const n=r.alloc(8,0),i=e.getPublicKey(),o=i.slice(30),s=r.alloc(8),a=new u.default(t.toString()),c=h.bigIntToBuffer(a);s.write(c.reverse().toString("hex"),"hex");const l=r.concat([i,s]),f=p("keccak256").update(l).digest(),g=r.from(d.WasmVirtualMachine,"hex"),b=r.concat([n,g,f.slice(10,30),o]);return new m(b)}getShardOfAddress(e){return this.getShardOfPubkey(e.getPublicKey(),this.numberOfShardsWithoutMeta)}getShardOfPubkey(e,t){const n=parseInt("11",2),r=parseInt("01",2),i=e[31];if(this.isPubkeyOfMetachain(e))return d.METACHAIN_ID;let o=i&n;return o>t-1&&(o=i&r),o}isPubkeyOfMetachain(e){const t=r.from([0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=r.from(e).slice(0,t.length);if(t.equals(n))return!0;return!!r.alloc(32).equals(r.from(e))}}},70449:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncTimer=void 0;const s=o(n(25145)),a=n(25145),c=n(1853);t.AsyncTimer=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new s.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,c.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise(((t,n)=>{this.rejectionFunc=n;this.timeoutHandle=setTimeout((()=>{this.rejectionFunc=null,this.stop(),t()}),e)}))}abort(){c.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new a.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(c.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}}},89364:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Compatibility=void 0;const r=n(36946);t.Compatibility=class{static guardAddressIsSetAndNonZero(e,t,n){e&&""!=e.bech32()?e.bech32()==r.Address.Zero().bech32()&&console.warn(`${t}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`):console.warn(`${t}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`)}}},71289:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LibraryConfig=void 0;class n{}t.LibraryConfig=n,n.DefaultAddressHrp="erd"},63025:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ESDT_CONTRACT_ADDRESS=t.DELEGATION_MANAGER_SC_ADDRESS=t.CONTRACT_DEPLOY_ADDRESS=t.BECH32_ADDRESS_LENGTH=t.DEFAULT_HRP=t.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER=t.UNKNOWN_SIGNER=t.SDK_JS_SIGNER=t.METACHAIN_ID=t.WasmVirtualMachine=t.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=t.HEX_TRANSACTION_HASH_LENGTH=t.MESSAGE_PREFIX=t.DEFAULT_MESSAGE_VERSION=t.ESDT_CONTRACT_ADDRESS_HEX=t.DELEGATION_MANAGER_SC_ADDRESS_HEX=t.CONTRACT_DEPLOY_ADDRESS_HEX=t.VM_TYPE_WASM_VM=t.ARGUMENTS_SEPARATOR=t.ESDT_TRANSFER_VALUE=t.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=t.ESDTNFT_TRANSFER_FUNCTION_NAME=t.ESDT_TRANSFER_FUNCTION_NAME=t.ESDT_TRANSFER_GAS_LIMIT=t.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=t.TRANSACTION_VERSION_DEFAULT=t.TRANSACTION_OPTIONS_TX_GUARDED=t.TRANSACTION_OPTIONS_TX_HASH_SIGN=t.TRANSACTION_OPTIONS_DEFAULT=t.TRANSACTION_MIN_GAS_PRICE=void 0,t.TRANSACTION_MIN_GAS_PRICE=1e9,t.TRANSACTION_OPTIONS_DEFAULT=0,t.TRANSACTION_OPTIONS_TX_HASH_SIGN=1,t.TRANSACTION_OPTIONS_TX_GUARDED=2,t.TRANSACTION_VERSION_DEFAULT=2,t.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=2,t.ESDT_TRANSFER_GAS_LIMIT=5e5,t.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer",t.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer",t.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer",t.ESDT_TRANSFER_VALUE="0",t.ARGUMENTS_SEPARATOR="@",t.VM_TYPE_WASM_VM=new Uint8Array([5,0]),t.CONTRACT_DEPLOY_ADDRESS_HEX="0000000000000000000000000000000000000000000000000000000000000000",t.DELEGATION_MANAGER_SC_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000004ffff",t.ESDT_CONTRACT_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000002ffff",t.DEFAULT_MESSAGE_VERSION=1,t.MESSAGE_PREFIX="\x17Elrond Signed Message:\n",t.HEX_TRANSACTION_HASH_LENGTH=64,t.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=3,t.WasmVirtualMachine="0500",t.METACHAIN_ID=4294967295,t.SDK_JS_SIGNER="sdk-js",t.UNKNOWN_SIGNER="unknown",t.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER="EGLD-000000",t.DEFAULT_HRP="erd",t.BECH32_ADDRESS_LENGTH=62,t.CONTRACT_DEPLOY_ADDRESS="erd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gq4hu",t.DELEGATION_MANAGER_SC_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqylllslmq6y6",t.ESDT_CONTRACT_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"},42315:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(10545),t)},10545:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionsConverter=void 0;const i=n(47480),o=n(66679),s=n(73416);t.TransactionsConverter=class{transactionToPlainObject(e){return{nonce:Number(e.nonce),value:e.value.toString(),receiver:e.receiver,sender:e.sender,senderUsername:this.toBase64OrUndefined(e.senderUsername),receiverUsername:this.toBase64OrUndefined(e.receiverUsername),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:this.toBase64OrUndefined(e.data),chainID:e.chainID.valueOf(),version:e.version,options:0==e.options?void 0:e.options,guardian:e.guardian?e.guardian:void 0,signature:this.toHexOrUndefined(e.signature),guardianSignature:this.toHexOrUndefined(e.guardianSignature),relayer:e.relayer?e.relayer:void 0,innerTransactions:e.innerTransactions.length?e.innerTransactions.map((e=>this.transactionToPlainObject(e))):void 0}}toBase64OrUndefined(e){return e&&e.length?r.from(e).toString("base64"):void 0}toHexOrUndefined(e){return e&&e.length?r.from(e).toString("hex"):void 0}plainObjectToTransaction(e){return new o.Transaction({nonce:BigInt(e.nonce),value:BigInt(e.value||""),receiver:e.receiver,receiverUsername:this.bufferFromBase64(e.receiverUsername).toString(),sender:e.sender,senderUsername:this.bufferFromBase64(e.senderUsername).toString(),guardian:e.guardian,gasPrice:BigInt(e.gasPrice),gasLimit:BigInt(e.gasLimit),data:this.bufferFromBase64(e.data),chainID:String(e.chainID),version:Number(e.version),options:Number(e.options),signature:this.bufferFromHex(e.signature),guardianSignature:this.bufferFromHex(e.guardianSignature),relayer:e.relayer,innerTransactions:e.innerTransactions?e.innerTransactions.map((e=>this.plainObjectToTransaction(e))):void 0})}bufferFromBase64(e){return r.from(e||"","base64")}bufferFromHex(e){return r.from(e||"","hex")}transactionOnNetworkToOutcome(e){const t=(new i.ResultsParser).parseUntypedOutcome(e),n=new s.SmartContractCallOutcome({function:e.function,returnCode:t.returnCode.toString(),returnMessage:t.returnMessage,returnDataParts:t.values}),r=e.contractResults.items.map((e=>this.smartContractResultOnNetworkToSmartContractResult(e))),o=new s.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map((e=>this.eventOnNetworkToEvent(e)))});return new s.TransactionOutcome({logs:o,smartContractResults:r,directSmartContractCallOutcome:n})}smartContractResultOnNetworkToSmartContractResult(e){return new s.SmartContractResult({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:r.from(e.data),logs:new s.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map((e=>this.eventOnNetworkToEvent(e)))})})}eventOnNetworkToEvent(e){const t=e.dataPayload?.valueOf()||r.from(e.data||""),n=e.additionalData?.map((e=>r.from(e.valueOf())))||[];return 0===n.length&&t.length&&n.push(r.from(t)),new s.TransactionEvent({address:e.address.bech32(),identifier:e.identifier,topics:e.topics.map((e=>r.from(e.hex(),"hex"))),dataItems:n})}}},25145:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrSmartContractQuery=t.ErrParseTransactionOutcome=t.ErrInvalidInnerTransaction=t.ErrBadUsage=t.ErrInvalidTokenIdentifier=t.ErrIsCompletedFieldIsMissingOnTransaction=t.ErrGasLimitShouldBe0ForInnerTransaction=t.ErrInvalidRelayedV2BuilderArguments=t.ErrInvalidRelayedV1BuilderArguments=t.ErrNotImplemented=t.ErrContractInteraction=t.ErrCodec=t.ErrCannotParseTransactionOutcome=t.ErrCannotParseContractResults=t.ErrMissingFieldOnEnum=t.ErrMissingFieldOnStruct=t.ErrTypingSystem=t.ErrMock=t.ErrContractHasNoAddress=t.ErrContract=t.ErrExpectedTransactionEventsNotFound=t.ErrExpectedTransactionStatusNotReached=t.ErrTransactionWatcherTimeout=t.ErrAsyncTimerAborted=t.ErrAsyncTimerAlreadyRunning=t.ErrInvalidFunctionName=t.ErrSignatureCannotCreate=t.ErrTransactionOptionsInvalid=t.ErrTransactionVersionInvalid=t.ErrNonceInvalid=t.ErrNotEnoughGas=t.ErrAddressEmpty=t.ErrAddressBadHrp=t.ErrAddressCannotCreate=t.ErrUnexpectedCondition=t.ErrInvariantFailed=t.ErrBadType=t.ErrUnsupportedOperation=t.ErrInvalidArgument=t.Err=void 0;class n extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}summary(){let e=[];e.push({name:this.name,message:this.message});let t=this.inner;for(;t;)e.push({name:t.name,message:t.message}),t=t.inner;return e}}t.Err=n;t.ErrInvalidArgument=class extends n{constructor(e,t){super(`Invalid argument: ${e}`,t)}};t.ErrUnsupportedOperation=class extends n{constructor(e,t="not specified"){super(`Operation "${e}" not supported. Reason: ${t}`)}};t.ErrBadType=class extends n{constructor(e,t,n){super(`Bad type of "${e}": ${n}. Expected type: ${t}`)}};t.ErrInvariantFailed=class extends n{constructor(e){super(`Invariant failed: [${e}]`)}};t.ErrUnexpectedCondition=class extends n{constructor(e){super(`Unexpected condition: [${e}]`)}};t.ErrAddressCannotCreate=class extends n{constructor(e,t){super(`Cannot create address from: ${e}`,t)}};t.ErrAddressBadHrp=class extends n{constructor(e,t){super(`Wrong address HRP. Expected: ${e}, got ${t}`)}};t.ErrAddressEmpty=class extends n{constructor(){super("Address is empty")}};t.ErrNotEnoughGas=class extends n{constructor(e){super(`Not enough gas provided: ${e}`)}};t.ErrNonceInvalid=class extends n{constructor(e){super(`Invalid nonce: ${e}`)}};t.ErrTransactionVersionInvalid=class extends n{constructor(e){super(`Invalid transaction version: ${e}`)}};t.ErrTransactionOptionsInvalid=class extends n{constructor(e){super(`Invalid transaction options: ${e}`)}};t.ErrSignatureCannotCreate=class extends n{constructor(e,t){super(`Cannot create signature from: ${e}`,t)}};t.ErrInvalidFunctionName=class extends n{constructor(){super("Invalid function name")}};t.ErrAsyncTimerAlreadyRunning=class extends n{constructor(){super("Async timer already running")}};t.ErrAsyncTimerAborted=class extends n{constructor(){super("Async timer aborted")}};t.ErrTransactionWatcherTimeout=class extends n{constructor(){super("TransactionWatcher has timed out")}};t.ErrExpectedTransactionStatusNotReached=class extends n{constructor(){super("Expected transaction status not reached")}};t.ErrExpectedTransactionEventsNotFound=class extends n{constructor(){super("Expected transaction events not found")}};class r extends n{constructor(e){super(e)}}t.ErrContract=r;t.ErrContractHasNoAddress=class extends r{constructor(){super("\nThe smart contract has no address set. Make sure you provide the address in the constructor, or call setAddress() appropriately.\nIf you need to recompute the address of the contract, make use of SmartContract.computeAddress() (static method). \n")}};t.ErrMock=class extends n{constructor(e){super(e)}};t.ErrTypingSystem=class extends n{constructor(e){super(e)}};t.ErrMissingFieldOnStruct=class extends n{constructor(e,t){super(`field ${e} does not exist on struct ${t}`)}};t.ErrMissingFieldOnEnum=class extends n{constructor(e,t){super(`field ${e} does not exist on enum ${t}`)}};t.ErrCannotParseContractResults=class extends n{constructor(e){super(`cannot parse contract results: ${e}`)}};t.ErrCannotParseTransactionOutcome=class extends n{constructor(e,t){super(`cannot parse outcome of transaction ${e}: ${t}`)}};t.ErrCodec=class extends n{constructor(e){super(e)}};t.ErrContractInteraction=class extends n{constructor(e){super(e)}};t.ErrNotImplemented=class extends n{constructor(){super("Method not yet implemented")}};t.ErrInvalidRelayedV1BuilderArguments=class extends n{constructor(){super("invalid arguments for relayed v1 builder")}};t.ErrInvalidRelayedV2BuilderArguments=class extends n{constructor(){super("invalid arguments for relayed v2 builder")}};t.ErrGasLimitShouldBe0ForInnerTransaction=class extends n{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};t.ErrIsCompletedFieldIsMissingOnTransaction=class extends n{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};t.ErrInvalidTokenIdentifier=class extends n{constructor(e){super(e)}};t.ErrBadUsage=class extends n{constructor(e){super(e)}};t.ErrInvalidInnerTransaction=class extends n{constructor(e){super(e)}};t.ErrParseTransactionOutcome=class extends n{constructor(e){super(e)}};t.ErrSmartContractQuery=class extends n{constructor(e,t){super(t),this.returnCode=e}}},5884:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GasEstimator=t.DefaultGasConfiguration=void 0,t.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};const n=8e5;t.GasEstimator=class{constructor(e){this.gasConfiguration=e||t.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+1e5}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+n}forMultiESDTNFTTransfer(e,t){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+n)*t+this.gasConfiguration.gasPerDataByte*e}}},57136:function(e,t,n){"use strict";n.g.Buffer||(n.g.Buffer=n(47115).lW)},93827:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=void 0;const a=s(n(25145));class c{constructor(e){if(e)if(e instanceof r)this.hash=e;else{if("string"!==typeof e)throw new a.ErrBadType("hash","buffer | string",e);this.hash=r.from(e,"hex")}else this.hash=r.from([])}static empty(){return new c(r.from([]))}isEmpty(){return 0==this.hash.length}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}}t.Hash=c},3053:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(57136),i(n(37570),t),i(n(80968),t),i(n(36946),t),i(n(70449),t),i(n(71289),t),i(n(42315),t),i(n(25145),t),i(n(5884),t),i(n(28445),t),i(n(3879),t),i(n(1853),t),i(n(60173),t),i(n(43186),t),i(n(59903),t),i(n(77312),t),i(n(40655),t),i(n(90788),t),i(n(47480),t),i(n(23787),t),i(n(43927),t),i(n(66679),t),i(n(86030),t),i(n(94712),t),i(n(9465),t),i(n(91808),t),i(n(15360),t),i(n(44425),t),i(n(59670),t)},28445:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3879:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1853:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=t.LogLevel=void 0,function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error",e[e.None=5]="None"}(n=t.LogLevel||(t.LogLevel={}));class r{static setLevel(e){r.logLevel=e}static trace(e,...t){r.logLevel>=n.Debug||console.debug(e,t)}static debug(e,...t){r.logLevel>=n.Debug||console.debug(e,t)}static info(e,...t){r.logLevel>=n.Info||console.log(e,t)}static warn(e,...t){r.logLevel>=n.Warn||console.warn(e,t)}static error(e,...t){r.logLevel>=n.Error||console.error(e,t)}}t.Logger=r,r.logLevel=n.Debug},60173:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.MessageComputer=t.Message=void 0;const i=n(63025),o=n(36946),s=n(95811);class a{constructor(e){this.data=e.data,this.signature=e.signature,this.address=e.address,this.version=e.version||i.DEFAULT_MESSAGE_VERSION,this.signer=e.signer||i.SDK_JS_SIGNER}}t.Message=a;t.MessageComputer=class{constructor(){}computeBytesForSigning(e){const t=r.from(e.data.length.toString()),n=r.concat([t,e.data]);let o=r.concat([r.from(i.MESSAGE_PREFIX),n]);return s("keccak256").update(o).digest()}computeBytesForVerifying(e){return this.computeBytesForSigning(e)}packMessage(e){return{message:r.from(e.data).toString("hex"),signature:e.signature?r.from(e.signature).toString("hex"):"",address:e.address?e.address.bech32():"",version:e.version,signer:e.signer}}unpackMessage(e){const t=this.trimHexPrefix(e.message),n=r.from(t,"hex"),s=this.trimHexPrefix(e.signature||""),c=r.from(s,"hex");let u;e.address&&(u=o.Address.fromBech32(e.address));const l=e.version||i.DEFAULT_MESSAGE_VERSION,d=e.signer||i.UNKNOWN_SIGNER;return new a({data:n,signature:c,address:u,version:l,signer:d})}trimHexPrefix(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}}},43186:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionOptions=t.TransactionVersion=void 0;const s=n(63025),a=o(n(25145));class c{constructor(e){if((e=Number(e))<1)throw new a.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new c(s.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new c(s.TRANSACTION_VERSION_DEFAULT)}valueOf(){return this.value}}t.TransactionVersion=c;class u{constructor(e){if((e=Number(e))<0)throw new a.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new u(s.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let t=0;return e.hashSign&&(t|=s.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(t|=s.TRANSACTION_OPTIONS_TX_GUARDED),new u(t)}isWithHashSign(){return(this.value&s.TRANSACTION_OPTIONS_TX_HASH_SIGN)==s.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&s.TRANSACTION_OPTIONS_TX_GUARDED)==s.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=s.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=s.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}}t.TransactionOptions=u},98454:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GuardianData=t.AccountOnNetwork=void 0;const i=r(n(44431)),o=n(18682);class s{constructor(e){this.address=new o.Address(""),this.nonce=0,this.balance=new i.default(0),this.code="",this.userName="",Object.assign(this,e)}static fromHttpResponse(e){let t=new s;return t.address=new o.Address(e.address||""),t.nonce=Number(e.nonce||0),t.balance=new i.default(e.balance||0),t.code=e.code||"",t.userName=e.username||"",t}}t.AccountOnNetwork=s;class a{constructor(e){this.guarded=!1,Object.assign(this,e)}static fromHttpResponse(e){const t=new a;return t.guarded=e.guarded||!1,e.activeGuardian&&(t.activeGuardian=c.fromHttpResponse(e.activeGuardian)),e.pendingGuardian&&(t.pendingGuardian=c.fromHttpResponse(e.pendingGuardian)),t}getCurrentGuardianAddress(){if(this.guarded)return this.activeGuardian?.address}}t.GuardianData=a;class c{constructor(){this.activationEpoch=0,this.address=new o.Address(""),this.serviceUID=""}static fromHttpResponse(e){const t=new c;return t.activationEpoch=Number(e.activationEpoch||0),t.address=new o.Address(e.address||""),t.serviceUID=e.serviceUID||"",t}}},41829:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApiNetworkProvider=void 0;const i=r(n(9669)),o=n(98454),s=n(64402),a=n(94241),c=n(45145),u=n(37207),l=n(10417),d=n(11775),f=n(46733),h=n(40221),p=n(18682),g=n(24704),m=n(49238),b=n(57912),y=n(35190),v=n(4613),w=n(61196);t.ApiNetworkProvider=class{constructor(e,t){this.userAgentPrefix=`${a.BaseUserAgent}/api`,this.url=e;let n=this.getProxyConfig(t);this.config={...s.defaultAxiosConfig,...t},this.backingProxyNetworkProvider=new g.ProxyNetworkProvider(e,n),w.extendUserAgent(this.userAgentPrefix,this.config)}getProxyConfig(e){let t=JSON.parse(JSON.stringify(e||{}));return t={...s.defaultAxiosConfig,...t},t}async getNetworkConfig(){return await this.backingProxyNetworkProvider.getNetworkConfig()}async getNetworkStatus(){return await this.backingProxyNetworkProvider.getNetworkStatus()}async getNetworkStakeStatistics(){let e=await this.doGetGeneric("stake");return f.NetworkStake.fromHttpResponse(e)}async getNetworkGeneralStatistics(){let e=await this.doGetGeneric("stats");return d.NetworkGeneralStatistics.fromHttpResponse(e)}async getAccount(e){let t=await this.doGetGeneric(`accounts/${e.bech32()}`);return o.AccountOnNetwork.fromHttpResponse(t)}async getGuardianData(e){return await this.backingProxyNetworkProvider.getGuardianData(e)}async getFungibleTokensOfAccount(e,t){t=t||s.defaultPagination;let n=`accounts/${e.bech32()}/tokens?${this.buildPaginationParams(t)}`,r=(await this.doGetGeneric(n)).map((e=>b.FungibleTokenOfAccountOnNetwork.fromHttpResponse(e)));return r.sort(((e,t)=>e.identifier.localeCompare(t.identifier))),r}async getNonFungibleTokensOfAccount(e,t){t=t||s.defaultPagination;let n=`accounts/${e.bech32()}/nfts?${this.buildPaginationParams(t)}`,r=(await this.doGetGeneric(n)).map((e=>b.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(e)));return r.sort(((e,t)=>e.identifier.localeCompare(t.identifier))),r}async getFungibleTokenOfAccount(e,t){let n=await this.doGetGeneric(`accounts/${e.bech32()}/tokens/${t}`);return b.FungibleTokenOfAccountOnNetwork.fromHttpResponse(n)}async getNonFungibleTokenOfAccount(e,t,n){let r=new p.Nonce(n).hex(),i=await this.doGetGeneric(`accounts/${e.bech32()}/nfts/${t}-${r}`);return b.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(i)}async getMexPairs(e){let t="mex/pairs";return e&&(t=`${t}?from=${e.from}&size=${e.size}`),(await this.doGetGeneric(t)).map((e=>h.PairOnNetwork.fromApiHttpResponse(e)))}async getTransaction(e){let t=await this.doGetGeneric(`transactions/${e}`);return y.TransactionOnNetwork.fromApiHttpResponse(e,t)}async getTransactionStatus(e){let t=await this.doGetGeneric(`transactions/${e}?fields=status`);return new v.TransactionStatus(t.status)}async sendTransaction(e){const t=y.prepareTransactionForBroadcasting(e);return(await this.doPostGeneric("transactions",t)).txHash}async sendTransactions(e){return await this.backingProxyNetworkProvider.sendTransactions(e)}async simulateTransaction(e){return await this.backingProxyNetworkProvider.simulateTransaction(e)}async queryContract(e){try{let t=new c.ContractQueryRequest(e).toHttpRequest(),n=await this.doPostGeneric("query",t);return u.ContractQueryResponse.fromHttpResponse(n)}catch(t){throw new l.ErrContractQuery(t)}}async getDefinitionOfFungibleToken(e){let t=await this.doGetGeneric(`tokens/${e}`);return m.DefinitionOfFungibleTokenOnNetwork.fromApiHttpResponse(t)}async getDefinitionOfTokenCollection(e){let t=await this.doGetGeneric(`collections/${e}`);return m.DefinitionOfTokenCollectionOnNetwork.fromApiHttpResponse(t)}async getNonFungibleToken(e,t){let n=new p.Nonce(t).hex(),r=await this.doGetGeneric(`nfts/${e}-${n}`);return b.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(r)}async doGetGeneric(e){return await this.doGet(e)}async doPostGeneric(e,t){return await this.doPost(e,t)}buildPaginationParams(e){return`from=${e.from}&size=${e.size}`}async doGet(e){let t=`${this.url}/${e}`;try{return(await i.default.get(t,this.config)).data}catch(n){this.handleApiError(n,e)}}async doPost(e,t){let n=`${this.url}/${e}`;try{return(await i.default.post(n,t,{...this.config,headers:{"Content-Type":"application/json",...this.config.headers}})).data}catch(r){this.handleApiError(r,e)}}handleApiError(e,t){if(!e.response)throw new l.ErrNetworkProvider(t,e.toString(),e);const n=e.response.data,r=n.message||n.error||JSON.stringify(n);throw new l.ErrNetworkProvider(t,r,e)}}},64402:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultPagination=t.defaultAxiosConfig=void 0;const r=n(4400)({constructorAction:"ignore"});t.defaultAxiosConfig={timeout:5e3,transformResponse:[function(e){return r.parse(e)}]},t.defaultPagination={from:0,size:100}},94241:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.UnknownClientName=t.BaseUserAgent=t.EsdtContractAddress=t.MaxUint64AsBigNumber=void 0;const i=r(n(44431)),o=n(18682);t.MaxUint64AsBigNumber=new i.default("18446744073709551615"),t.EsdtContractAddress=new o.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),t.BaseUserAgent="multiversx-sdk",t.UnknownClientName="unknown"},45145:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractQueryRequest=void 0;t.ContractQueryRequest=class{constructor(e){this.query=e}toHttpRequest(){let e={},t=this.query;return e.scAddress=t.address.bech32(),e.caller=t.caller?.bech32()?t.caller.bech32():void 0,e.funcName=t.func.toString(),e.value=t.value?t.value.toString():void 0,e.args=t.getEncodedArguments(),e}}},37207:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ContractQueryResponse=void 0;const o=i(n(44431)),s=n(94241);class a{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let t=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,r=e.returnMessage||e.ReturnMessage,i=new o.default(e.gasRemaining||e.GasRemaining||0),c=s.MaxUint64AsBigNumber.minus(i).toNumber();return new a({returnData:t,returnCode:n,returnMessage:r,gasUsed:c})}getReturnDataParts(){return this.returnData.map((e=>r.from(e||"","base64")))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}}t.ContractQueryResponse=a},73673:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.ContractResultItem=t.ContractResults=void 0;const i=n(6271),o=n(18682);class s{constructor(e){this.items=e,this.items.sort((function(e,t){return e.nonce.valueOf()-t.nonce.valueOf()}))}static fromProxyHttpResponse(e){let t=e.map((e=>a.fromProxyHttpResponse(e)));return new s(t)}static fromApiHttpResponse(e){let t=e.map((e=>a.fromApiHttpResponse(e)));return new s(t)}}t.ContractResults=s;class a{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new o.Address(""),this.sender=new o.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new i.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return a.fromHttpResponse(e)}static fromApiHttpResponse(e){let t=a.fromHttpResponse(e);return t.data=r.from(t.data,"base64").toString(),t.callType=Number(t.callType),t}static fromHttpResponse(e){let t=new a;return t.hash=e.hash,t.nonce=Number(e.nonce||0),t.value=(e.value||0).toString(),t.receiver=new o.Address(e.receiver),t.sender=new o.Address(e.sender),t.previousHash=e.prevTxHash,t.originalHash=e.originalTxHash,t.gasLimit=Number(e.gasLimit||0),t.gasPrice=Number(e.gasPrice||0),t.data=e.data||"",t.callType=e.callType,t.returnMessage=e.returnMessage,t.logs=i.TransactionLogs.fromHttpResponse(e.logs||{}),t}}t.ContractResultItem=a},10417:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrContractQuery=t.ErrNetworkProvider=t.ErrUnexpectedCondition=t.Err=void 0;class n extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}}t.Err=n;t.ErrUnexpectedCondition=class extends n{constructor(e){super(`Unexpected condition: [${e}]`)}};t.ErrNetworkProvider=class extends n{constructor(e,t,n){super(`Request error on url [${e}]: [${t}]`,n)}};t.ErrContractQuery=class extends n{constructor(e){super(e.message.replace("executeQuery:",""))}}},59670:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkStatus=t.NetworkStake=t.NetworkGeneralStatistics=t.NetworkConfig=t.NonFungibleTokenOfAccountOnNetwork=t.FungibleTokenOfAccountOnNetwork=t.DefinitionOfTokenCollectionOnNetwork=t.DefinitionOfFungibleTokenOnNetwork=t.TransactionOnNetwork=t.TransactionStatus=t.TransactionReceipt=t.TransactionLogsOnNetwork=t.TransactionEventTopic=t.TransactionEventData=t.TransactionEventOnNetwork=t.ContractResults=t.ContractResultItem=t.ContractQueryResponse=t.AccountOnNetwork=t.ProxyNetworkProvider=t.ApiNetworkProvider=void 0;var r=n(41829);Object.defineProperty(t,"ApiNetworkProvider",{enumerable:!0,get:function(){return r.ApiNetworkProvider}});var i=n(24704);Object.defineProperty(t,"ProxyNetworkProvider",{enumerable:!0,get:function(){return i.ProxyNetworkProvider}});var o=n(98454);Object.defineProperty(t,"AccountOnNetwork",{enumerable:!0,get:function(){return o.AccountOnNetwork}});var s=n(37207);Object.defineProperty(t,"ContractQueryResponse",{enumerable:!0,get:function(){return s.ContractQueryResponse}});var a=n(73673);Object.defineProperty(t,"ContractResultItem",{enumerable:!0,get:function(){return a.ContractResultItem}}),Object.defineProperty(t,"ContractResults",{enumerable:!0,get:function(){return a.ContractResults}});var c=n(18751);Object.defineProperty(t,"TransactionEventOnNetwork",{enumerable:!0,get:function(){return c.TransactionEvent}}),Object.defineProperty(t,"TransactionEventData",{enumerable:!0,get:function(){return c.TransactionEventData}}),Object.defineProperty(t,"TransactionEventTopic",{enumerable:!0,get:function(){return c.TransactionEventTopic}});var u=n(6271);Object.defineProperty(t,"TransactionLogsOnNetwork",{enumerable:!0,get:function(){return u.TransactionLogs}});var l=n(62958);Object.defineProperty(t,"TransactionReceipt",{enumerable:!0,get:function(){return l.TransactionReceipt}});var d=n(4613);Object.defineProperty(t,"TransactionStatus",{enumerable:!0,get:function(){return d.TransactionStatus}});var f=n(35190);Object.defineProperty(t,"TransactionOnNetwork",{enumerable:!0,get:function(){return f.TransactionOnNetwork}});var h=n(49238);Object.defineProperty(t,"DefinitionOfFungibleTokenOnNetwork",{enumerable:!0,get:function(){return h.DefinitionOfFungibleTokenOnNetwork}}),Object.defineProperty(t,"DefinitionOfTokenCollectionOnNetwork",{enumerable:!0,get:function(){return h.DefinitionOfTokenCollectionOnNetwork}});var p=n(57912);Object.defineProperty(t,"FungibleTokenOfAccountOnNetwork",{enumerable:!0,get:function(){return p.FungibleTokenOfAccountOnNetwork}}),Object.defineProperty(t,"NonFungibleTokenOfAccountOnNetwork",{enumerable:!0,get:function(){return p.NonFungibleTokenOfAccountOnNetwork}});var g=n(89553);Object.defineProperty(t,"NetworkConfig",{enumerable:!0,get:function(){return g.NetworkConfig}});var m=n(11775);Object.defineProperty(t,"NetworkGeneralStatistics",{enumerable:!0,get:function(){return m.NetworkGeneralStatistics}});var b=n(46733);Object.defineProperty(t,"NetworkStake",{enumerable:!0,get:function(){return b.NetworkStake}});var y=n(34547);Object.defineProperty(t,"NetworkStatus",{enumerable:!0,get:function(){return y.NetworkStatus}})},89553:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkConfig=void 0;const i=r(n(44431));class o{constructor(){this.ChainID="T",this.GasPerDataByte=1500,this.TopUpFactor=0,this.RoundDuration=0,this.RoundsPerEpoch=0,this.TopUpRewardsGradientPoint=new i.default(0),this.MinGasLimit=5e4,this.MinGasPrice=1e9,this.GasPriceModifier=1,this.MinTransactionVersion=1}static fromHttpResponse(e){let t=new o;return t.ChainID=String(e.erd_chain_id),t.GasPerDataByte=Number(e.erd_gas_per_data_byte),t.TopUpFactor=Number(e.erd_top_up_factor),t.RoundDuration=Number(e.erd_round_duration),t.RoundsPerEpoch=Number(e.erd_rounds_per_epoch),t.TopUpRewardsGradientPoint=new i.default(e.erd_rewards_top_up_gradient_point),t.MinGasLimit=Number(e.erd_min_gas_limit),t.MinGasPrice=Number(e.erd_min_gas_price),t.MinTransactionVersion=Number(e.erd_min_transaction_version),t.GasPriceModifier=Number(e.erd_gas_price_modifier),t}}t.NetworkConfig=o},11775:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkGeneralStatistics=void 0;class n{constructor(){this.Shards=0,this.Blocks=0,this.Accounts=0,this.Transactions=0,this.RefreshRate=0,this.Epoch=0,this.RoundsPassed=0,this.RoundsPerEpoch=0}static fromHttpResponse(e){let t=new n;return t.Shards=Number(e.shards),t.Blocks=Number(e.blocks),t.Accounts=Number(e.accounts),t.Transactions=Number(e.transactions),t.RefreshRate=Number(e.refreshRate),t.Epoch=Number(e.epoch),t.RoundsPassed=Number(e.roundsPassed),t.RoundsPerEpoch=Number(e.roundsPerEpoch),t}}t.NetworkGeneralStatistics=n},46733:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkStake=void 0;const i=r(n(44431));class o{constructor(){this.TotalValidators=0,this.ActiveValidators=0,this.QueueSize=0,this.TotalStaked=new i.default(0)}static fromHttpResponse(e){let t=new o;return t.TotalValidators=Number(e.totalValidators),t.ActiveValidators=Number(e.activeValidators),t.QueueSize=Number(e.queueSize),t.TotalStaked=new i.default(e.totalStaked),t}}t.NetworkStake=o},34547:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkStatus=void 0;class n{constructor(){this.CurrentRound=0,this.EpochNumber=0,this.HighestFinalNonce=0,this.Nonce=0,this.NonceAtEpochStart=0,this.NoncesPassedInCurrentEpoch=0,this.RoundAtEpochStart=0,this.RoundsPassedInCurrentEpoch=0,this.RoundsPerEpoch=0}static fromHttpResponse(e){let t=new n;return t.CurrentRound=Number(e.erd_current_round),t.EpochNumber=Number(e.erd_epoch_number),t.HighestFinalNonce=Number(e.erd_highest_final_nonce),t.Nonce=Number(e.erd_nonce),t.NonceAtEpochStart=Number(e.erd_nonce_at_epoch_start),t.NoncesPassedInCurrentEpoch=Number(e.erd_nonces_passed_in_current_epoch),t.RoundAtEpochStart=Number(e.erd_round_at_epoch_start),t.RoundsPassedInCurrentEpoch=Number(e.erd_rounds_passed_in_current_epoch),t.RoundsPerEpoch=Number(e.erd_rounds_per_epoch),t}}t.NetworkStatus=n},40221:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PairOnNetwork=void 0;const i=n(18682),o=r(n(44431));class s{constructor(e){this.address=new i.Address(""),this.id="",this.symbol="",this.name="",this.price=new o.default(0),this.baseId="",this.basePrice=new o.default(0),this.baseSymbol="",this.baseName="",this.quoteId="",this.quotePrice=new o.default(0),this.quoteSymbol="",this.quoteName="",this.totalValue=new o.default(0),this.volume24h=new o.default(0),this.state="",this.type="",this.rawResponse={},Object.assign(this,e)}static fromApiHttpResponse(e){let t=new s;return t.address=new i.Address(e.address||""),t.id=e.id||"",t.symbol=e.symbol||"",t.name=e.name||"",t.price=new o.default(e.price||0),t.baseId=e.baseId||"",t.basePrice=new o.default(e.basePrice||0),t.baseSymbol=e.baseSymbol||"",t.baseName=e.baseName||"",t.quoteId=e.quoteId||"",t.quotePrice=new o.default(e.quotePrice||0),t.quoteSymbol=e.quoteSymbol||"",t.quoteName=e.quoteName||"",t.totalValue=new o.default(e.totalValue||0),t.volume24h=new o.default(e.volume24h||0),t.state=e.state||"",t.type=e.type||"",t.rawResponse=e,t}}t.PairOnNetwork=s},18682:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.zeroPadStringIfOddLength=t.isPaddedHex=t.numberToPaddedHex=t.Nonce=t.Address=void 0;const a=s(n(92882));class c{constructor(e){this.value=e}static fromPubkey(e){let t=a.toWords(e),n=a.encode("erd",t);return new c(n)}bech32(){return this.value}toString(){return this.bech32()}}t.Address=c;function u(e){return l(e.toString(16))}function l(e){return(e=e||"").length%2==1?"0"+e:e}t.Nonce=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return u(this.value)}},t.numberToPaddedHex=u,t.isPaddedHex=function(e){e=e||"";let t=r.from(e,"hex").toString("hex");return e.toUpperCase()==t.toUpperCase()},t.zeroPadStringIfOddLength=l},24704:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyNetworkProvider=void 0;const o=i(n(9669)),s=n(98454),a=n(64402),c=n(94241),u=n(45145),l=n(37207),d=n(10417),f=n(89553),h=n(34547),p=n(49238),g=n(57912),m=n(35190),b=n(4613),y=n(61196);t.ProxyNetworkProvider=class{constructor(e,t){this.userAgentPrefix=`${c.BaseUserAgent}/proxy`,this.url=e,this.config={...a.defaultAxiosConfig,...t},y.extendUserAgent(this.userAgentPrefix,this.config)}async getNetworkConfig(){let e=await this.doGetGeneric("network/config");return f.NetworkConfig.fromHttpResponse(e.config)}async getNetworkStatus(){let e=await this.doGetGeneric("network/status/4294967295");return h.NetworkStatus.fromHttpResponse(e.status)}async getNetworkStakeStatistics(){throw new Error("Method not implemented.")}async getNetworkGeneralStatistics(){throw new Error("Method not implemented.")}async getAccount(e){let t=await this.doGetGeneric(`address/${e.bech32()}`);return s.AccountOnNetwork.fromHttpResponse(t.account)}async getGuardianData(e){const t=await this.doGetGeneric(`address/${e.bech32()}/guardian-data`);return s.GuardianData.fromHttpResponse(t.guardianData)}async getFungibleTokensOfAccount(e,t){let n=`address/${e.bech32()}/esdt`,r=await this.doGetGeneric(n),i=Object.values(r.esdts).filter((e=>!e.nonce)).map((e=>g.FungibleTokenOfAccountOnNetwork.fromHttpResponse(e)));return i.sort(((e,t)=>e.identifier.localeCompare(t.identifier))),i}async getNonFungibleTokensOfAccount(e,t){let n=`address/${e.bech32()}/esdt`,r=await this.doGetGeneric(n),i=Object.values(r.esdts).filter((e=>e.nonce>=0)).map((e=>g.NonFungibleTokenOfAccountOnNetwork.fromProxyHttpResponse(e)));return i.sort(((e,t)=>e.identifier.localeCompare(t.identifier))),i}async getFungibleTokenOfAccount(e,t){let n=await this.doGetGeneric(`address/${e.bech32()}/esdt/${t}`);return g.FungibleTokenOfAccountOnNetwork.fromHttpResponse(n.tokenData)}async getNonFungibleTokenOfAccount(e,t,n){let r=await this.doGetGeneric(`address/${e.bech32()}/nft/${t}/nonce/${n.valueOf()}`);return g.NonFungibleTokenOfAccountOnNetwork.fromProxyHttpResponseByNonce(r.tokenData)}async getTransaction(e,t){let n;!0===t&&(n=this.getTransactionStatus(e));let r=this.buildUrlWithQueryParameters(`transaction/${e}`,{withResults:"true"}),i=await this.doGetGeneric(r);if(n){const t=await n;return m.TransactionOnNetwork.fromProxyHttpResponse(e,i.transaction,t)}return m.TransactionOnNetwork.fromProxyHttpResponse(e,i.transaction)}async getTransactionStatus(e){let t=await this.doGetGeneric(`transaction/${e}/process-status`);return new b.TransactionStatus(t.status)}async sendTransaction(e){const t=m.prepareTransactionForBroadcasting(e);return(await this.doPostGeneric("transaction/send",t)).txHash}async sendTransactions(e){const t=e.map((e=>m.prepareTransactionForBroadcasting(e))),n=await this.doPostGeneric("transaction/send-multiple",t),r=Array(e.length).fill(null);for(let i=0;i[t]})).getReturnDataParts()}async getDefinitionOfTokenCollection(e){let t=await this.getTokenProperties(e);return p.DefinitionOfTokenCollectionOnNetwork.fromResponseOfGetTokenProperties(e,t)}async getNonFungibleToken(e,t){throw new Error("Method not implemented.")}async doGetGeneric(e){return await this.doGet(e)}async doPostGeneric(e,t){return await this.doPost(e,t)}async doGet(e){let t=`${this.url}/${e}`;try{return(await o.default.get(t,this.config)).data.data}catch(n){this.handleApiError(n,e)}}async doPost(e,t){let n=`${this.url}/${e}`;try{return(await o.default.post(n,t,{...this.config,headers:{"Content-Type":"application/json",...this.config.headers}})).data.data}catch(r){this.handleApiError(r,e)}}buildUrlWithQueryParameters(e,t){let n=new URLSearchParams;for(let[r,i]of Object.entries(t))i&&n.append(r,i);return`${e}?${n.toString()}`}handleApiError(e,t){if(!e.response)throw new d.ErrNetworkProvider(t,e.toString(),e);const n=e.response.data,r=n.message||n.error||JSON.stringify(n);throw new d.ErrNetworkProvider(t,r,e)}}},49238:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DefinitionOfTokenCollectionOnNetwork=t.DefinitionOfFungibleTokenOnNetwork=void 0;const i=r(n(44431)),o=n(18682);class s{constructor(){this.identifier="",this.name="",this.ticker="",this.owner=new o.Address(""),this.decimals=0,this.supply=new i.default(0),this.isPaused=!1,this.canUpgrade=!1,this.canMint=!1,this.canBurn=!1,this.canChangeOwner=!1,this.canPause=!1,this.canFreeze=!1,this.canWipe=!1,this.canAddSpecialRoles=!1,this.assets={}}static fromApiHttpResponse(e){let t=new s;return t.identifier=e.identifier||"",t.name=e.name||"",t.ticker=e.ticker||"",t.owner=new o.Address(e.owner||""),t.decimals=e.decimals||0,t.supply=new i.default(e.supply||"0"),t.isPaused=e.isPaused||!1,t.canUpgrade=e.canUpgrade||!1,t.canMint=e.canMint||!1,t.canBurn=e.canBurn||!1,t.canChangeOwner=e.canChangeOwner||!1,t.canPause=e.canPause||!1,t.canFreeze=e.canFreeze||!1,t.canWipe=e.canWipe||!1,t.assets=e.assets||{},t}static fromResponseOfGetTokenProperties(e,t){let n=new s,[r,a,u,l,...d]=t,f=c(d);return n.identifier=e,n.name=r.toString(),n.ticker=e,n.owner=o.Address.fromPubkey(u),n.decimals=f.NumDecimals.toNumber(),n.supply=new i.default(l.toString()).shiftedBy(-n.decimals),n.isPaused=f.IsPaused,n.canUpgrade=f.CanUpgrade,n.canMint=f.CanMint,n.canBurn=f.CanBurn,n.canChangeOwner=f.CanChangeOwner,n.canPause=f.CanPause,n.canFreeze=f.CanFreeze,n.canWipe=f.CanWipe,n}}t.DefinitionOfFungibleTokenOnNetwork=s;class a{constructor(){this.collection="",this.type="",this.name="",this.ticker="",this.owner=new o.Address(""),this.decimals=0,this.canPause=!1,this.canFreeze=!1,this.canWipe=!1,this.canUpgrade=!1,this.canChangeOwner=!1,this.canAddSpecialRoles=!1,this.canTransferNftCreateRole=!1,this.canCreateMultiShard=!1}static fromApiHttpResponse(e){let t=new a;return t.collection=e.collection||"",t.type=e.type||"",t.name=e.name||"",t.ticker=e.ticker||"",t.owner=new o.Address(e.owner||""),t.decimals=e.decimals||0,t.canPause=e.canPause||!1,t.canFreeze=e.canFreeze||!1,t.canWipe=e.canWipe||!1,t.canUpgrade=e.canUpgrade||!1,t.canAddSpecialRoles=e.canAddSpecialRoles||!1,t.canTransferNftCreateRole=e.canTransferNftCreateRole||!1,t}static fromResponseOfGetTokenProperties(e,t){let n=new a,[r,i,s,u,l,...d]=t,f=c(d);return n.collection=e,n.type=i.toString(),n.name=r.toString(),n.ticker=e,n.owner=o.Address.fromPubkey(s),n.decimals=f.NumDecimals.toNumber()??0,n.canPause=f.CanPause||!1,n.canFreeze=f.CanFreeze||!1,n.canWipe=f.CanWipe||!1,n.canUpgrade=f.CanUpgrade||!1,n.canChangeOwner=f.CanChangeOwner||!1,n.canAddSpecialRoles=f.CanAddSpecialRoles||!1,n.canTransferNftCreateRole=f.CanTransferNFTCreateRole||!1,n.canCreateMultiShard=f.CanCreateMultiShard||!1,n}}function c(e){let t={};for(let n of e){let[e,r]=n.toString().split("-");t[e]=u(r)}return t}function u(e){switch(e){case"true":return!0;case"false":return!1;default:return new i.default(e)}}t.DefinitionOfTokenCollectionOnNetwork=a},57912:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.NonFungibleTokenOfAccountOnNetwork=t.FungibleTokenOfAccountOnNetwork=void 0;const i=n(44431),o=n(18682);class s{constructor(){this.identifier="",this.balance=new i.BigNumber(0),this.rawResponse={}}static fromHttpResponse(e){let t=new s;return t.identifier=e.tokenIdentifier||e.identifier||"",t.balance=new i.BigNumber(e.balance||0),t.rawResponse=e,t}}t.FungibleTokenOfAccountOnNetwork=s;class a{constructor(e){this.identifier="",this.collection="",this.timestamp=0,this.attributes=r.from([]),this.nonce=0,this.type="",this.name="",this.creator=new o.Address(""),this.supply=new i.BigNumber(0),this.decimals=0,this.royalties=new i.BigNumber(0),this.assets=[],this.balance=new i.BigNumber(0),Object.assign(this,e)}static fromProxyHttpResponse(e){let t=a.fromHttpResponse(e);return t.identifier=e.tokenIdentifier||"",t.collection=a.parseCollectionFromIdentifier(t.identifier),t.royalties=new i.BigNumber(e.royalties||0).div(100),t}static fromProxyHttpResponseByNonce(e){let t=a.fromHttpResponse(e),n=new o.Nonce(t.nonce).hex();return t.identifier=`${e.tokenIdentifier}-${n}`,t.collection=e.tokenIdentifier||"",t.royalties=new i.BigNumber(e.royalties||0).div(100),t}static fromApiHttpResponse(e){let t=a.fromHttpResponse(e);return t.identifier=e.identifier||"",t.collection=e.collection||"",t}static fromHttpResponse(e){let t=new a;return t.timestamp=Number(e.timestamp||0),t.attributes=r.from(e.attributes||"","base64"),t.nonce=e.nonce||0,t.type=e.type||"",t.name=e.name||"",t.creator=new o.Address(e.creator||""),t.decimals=Number(e.decimals||0),t.supply=new i.BigNumber(e.balance||1),t.royalties=new i.BigNumber(e.royalties||0),t.assets=e.assets||[],t.balance=new i.BigNumber(e.balance||1),t}static parseCollectionFromIdentifier(e){return e.split("-").slice(0,2).join("-")}}t.NonFungibleTokenOfAccountOnNetwork=a},18751:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionEventTopic=t.TransactionEventData=t.TransactionEvent=void 0;const i=n(18682);class o{constructor(e){this.address=new i.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new s(r.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new o;return t.address=new i.Address(e.address),t.identifier=e.identifier||"",t.topics=(e.topics||[]).map((e=>new a(e))),t.dataPayload=s.fromBase64(e.data),t.additionalData=(e.additionalData||[]).map(s.fromBase64),t.data=t.dataPayload.toString(),t}findFirstOrNoneTopic(e){return this.topics.filter((t=>e(t)))[0]}getLastTopic(){return this.topics[this.topics.length-1]}}t.TransactionEvent=o;class s{constructor(e){this.raw=e}static fromBase64(e){return new s(r.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}}t.TransactionEventData=s;class a{constructor(e){this.raw=r.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}}t.TransactionEventTopic=a},6271:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionLogs=void 0;const r=n(10417),i=n(18682),o=n(18751);class s{constructor(e){this.address=new i.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new s;return t.address=new i.Address(e.address),t.events=(e.events||[]).map((e=>o.TransactionEvent.fromHttpResponse(e))),t}findSingleOrNoneEvent(e,t){let n=this.findEvents(e,t);if(n.length>1)throw new r.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,t){return this.findEvents(e,t)[0]}findEvents(e,t){let n=this.events.filter((t=>t.identifier==e));return t&&(n=n.filter((e=>t(e)))),n}}t.TransactionLogs=s},62958:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionReceipt=void 0;const r=n(18682);class i{constructor(){this.value="",this.sender=new r.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let t=new i;return t.value=(e.value||0).toString(),t.sender=new r.Address(e.sender),t.data=e.data,t.hash=e.txHash,t}}t.TransactionReceipt=i},4613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionStatus=void 0;class n{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new n("unknown")}isPending(){return"received"==this.status||"pending"==this.status}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return"executed"==this.status||"success"==this.status||"successful"==this.status}isFailed(){return"fail"==this.status||"failed"==this.status||"unsuccessful"==this.status||this.isInvalid()}isInvalid(){return"invalid"==this.status}toString(){return this.status}valueOf(){return this.status}equals(e){return!!e&&this.status==e.status}}t.TransactionStatus=n},35190:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionOnNetwork=t.prepareTransactionForBroadcasting=void 0;const i=n(4613),o=n(73673),s=n(18682),a=n(6271),c=n(62958);t.prepareTransactionForBroadcasting=function(e){return"toSendable"in e?e.toSendable():{nonce:Number(e.nonce),value:e.value.toString(),receiver:e.receiver,sender:e.sender,senderUsername:e.senderUsername?r.from(e.senderUsername).toString("base64"):void 0,receiverUsername:e.receiverUsername?r.from(e.receiverUsername).toString("base64"):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:0===e.data.length?void 0:r.from(e.data).toString("base64"),chainID:e.chainID,version:e.version,options:e.options,guardian:e.guardian||void 0,signature:r.from(e.signature).toString("hex"),guardianSignature:0===e.guardianSignature.length?void 0:r.from(e.guardianSignature).toString("hex")}};class u{constructor(e){this.hash="",this.type="",this.nonce=0,this.round=0,this.epoch=0,this.value="",this.receiver=new s.Address(""),this.sender=new s.Address(""),this.gasLimit=0,this.gasPrice=0,this.function="",this.data=r.from([]),this.signature="",this.status=i.TransactionStatus.createUnknown(),this.timestamp=0,this.blockNonce=0,this.hyperblockNonce=0,this.hyperblockHash="",this.receipt=new c.TransactionReceipt,this.contractResults=new o.ContractResults([]),this.logs=new a.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e,t,n){let r=u.fromHttpResponse(e,t);return r.contractResults=o.ContractResults.fromProxyHttpResponse(t.smartContractResults||[]),n&&(r.status=n,r.isCompleted=r.status.isSuccessful()||r.status.isFailed()),r}static fromApiHttpResponse(e,t){let n=u.fromHttpResponse(e,t);return n.contractResults=o.ContractResults.fromApiHttpResponse(t.results||[]),n.isCompleted=!n.status.isPending(),n}static fromHttpResponse(e,t){let n=new u;return n.hash=e,n.type=t.type||"",n.nonce=t.nonce||0,n.round=t.round,n.epoch=t.epoch||0,n.value=(t.value||0).toString(),n.sender=new s.Address(t.sender),n.receiver=new s.Address(t.receiver),n.gasPrice=t.gasPrice||0,n.gasLimit=t.gasLimit||0,n.function=t.function||"",n.data=r.from(t.data||"","base64"),n.status=new i.TransactionStatus(t.status),n.timestamp=t.timestamp||0,n.blockNonce=t.blockNonce||0,n.hyperblockNonce=t.hyperblockNonce||0,n.hyperblockHash=t.hyperblockHash||"",n.receipt=c.TransactionReceipt.fromHttpResponse(t.receipt||{}),n.logs=a.TransactionLogs.fromHttpResponse(t.logs||{}),n}getDateTime(){return new Date(1e3*this.timestamp)}}t.TransactionOnNetwork=u},61196:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendUserAgent=void 0;const r=n(9669),i=n(94241);t.extendUserAgent=function(e,t){t.headers||(t.headers=new r.AxiosHeaders({})),t.clientName||console.log("Can you please provide the client name of the application that uses the SDK? It will be used for metrics.");const n=r.AxiosHeaders.from(t.headers).normalize(!0),o=t.clientName||i.UnknownClientName,s=n.hasUserAgent()?n.getUserAgent():"",a=s?`${s} ${e}/${o}`:`${e}/${o}`;n.setUserAgent(a,!0)}},38299:function(e,t,n){"use strict";var r,i,o;i=[n(62100)],void 0===(o="function"===typeof(r=function(e){var t=e.Reader,n=e.Writer,r=e.util,i=e.roots.default||(e.roots.default={});return i.proto=function(){var o={};return o.Transaction=function(){function o(e){if(this.InnerTransactions=[],e)for(var t=Object.keys(e),n=0;n>>3){case 1:o.Nonce=e.uint64();break;case 2:o.Value=e.bytes();break;case 3:o.RcvAddr=e.bytes();break;case 4:o.RcvUserName=e.bytes();break;case 5:o.SndAddr=e.bytes();break;case 6:o.SndUserName=e.bytes();break;case 7:o.GasPrice=e.uint64();break;case 8:o.GasLimit=e.uint64();break;case 9:o.Data=e.bytes();break;case 10:o.ChainID=e.bytes();break;case 11:o.Version=e.uint32();break;case 12:o.Signature=e.bytes();break;case 13:o.Options=e.uint32();break;case 14:o.GuardianAddr=e.bytes();break;case 15:o.GuardianSignature=e.bytes();break;case 16:o.Relayer=e.bytes();break;case 17:o.InnerTransactions&&o.InnerTransactions.length||(o.InnerTransactions=[]),o.InnerTransactions.push(i.proto.Transaction.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof t||(e=new t(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!==typeof e||null===e)return"object expected";if(null!=e.Nonce&&e.hasOwnProperty("Nonce")&&!r.isInteger(e.Nonce)&&!(e.Nonce&&r.isInteger(e.Nonce.low)&&r.isInteger(e.Nonce.high)))return"Nonce: integer|Long expected";if(null!=e.Value&&e.hasOwnProperty("Value")&&!(e.Value&&"number"===typeof e.Value.length||r.isString(e.Value)))return"Value: buffer expected";if(null!=e.RcvAddr&&e.hasOwnProperty("RcvAddr")&&!(e.RcvAddr&&"number"===typeof e.RcvAddr.length||r.isString(e.RcvAddr)))return"RcvAddr: buffer expected";if(null!=e.RcvUserName&&e.hasOwnProperty("RcvUserName")&&!(e.RcvUserName&&"number"===typeof e.RcvUserName.length||r.isString(e.RcvUserName)))return"RcvUserName: buffer expected";if(null!=e.SndAddr&&e.hasOwnProperty("SndAddr")&&!(e.SndAddr&&"number"===typeof e.SndAddr.length||r.isString(e.SndAddr)))return"SndAddr: buffer expected";if(null!=e.SndUserName&&e.hasOwnProperty("SndUserName")&&!(e.SndUserName&&"number"===typeof e.SndUserName.length||r.isString(e.SndUserName)))return"SndUserName: buffer expected";if(null!=e.GasPrice&&e.hasOwnProperty("GasPrice")&&!r.isInteger(e.GasPrice)&&!(e.GasPrice&&r.isInteger(e.GasPrice.low)&&r.isInteger(e.GasPrice.high)))return"GasPrice: integer|Long expected";if(null!=e.GasLimit&&e.hasOwnProperty("GasLimit")&&!r.isInteger(e.GasLimit)&&!(e.GasLimit&&r.isInteger(e.GasLimit.low)&&r.isInteger(e.GasLimit.high)))return"GasLimit: integer|Long expected";if(null!=e.Data&&e.hasOwnProperty("Data")&&!(e.Data&&"number"===typeof e.Data.length||r.isString(e.Data)))return"Data: buffer expected";if(null!=e.ChainID&&e.hasOwnProperty("ChainID")&&!(e.ChainID&&"number"===typeof e.ChainID.length||r.isString(e.ChainID)))return"ChainID: buffer expected";if(null!=e.Version&&e.hasOwnProperty("Version")&&!r.isInteger(e.Version))return"Version: integer expected";if(null!=e.Signature&&e.hasOwnProperty("Signature")&&!(e.Signature&&"number"===typeof e.Signature.length||r.isString(e.Signature)))return"Signature: buffer expected";if(null!=e.Options&&e.hasOwnProperty("Options")&&!r.isInteger(e.Options))return"Options: integer expected";if(null!=e.GuardianAddr&&e.hasOwnProperty("GuardianAddr")&&!(e.GuardianAddr&&"number"===typeof e.GuardianAddr.length||r.isString(e.GuardianAddr)))return"GuardianAddr: buffer expected";if(null!=e.GuardianSignature&&e.hasOwnProperty("GuardianSignature")&&!(e.GuardianSignature&&"number"===typeof e.GuardianSignature.length||r.isString(e.GuardianSignature)))return"GuardianSignature: buffer expected";if(null!=e.Relayer&&e.hasOwnProperty("Relayer")&&!(e.Relayer&&"number"===typeof e.Relayer.length||r.isString(e.Relayer)))return"Relayer: buffer expected";if(null!=e.InnerTransactions&&e.hasOwnProperty("InnerTransactions")){if(!Array.isArray(e.InnerTransactions))return"InnerTransactions: array expected";for(var t=0;t>>0,e.Nonce.high>>>0).toNumber(!0))),null!=e.Value&&("string"===typeof e.Value?r.base64.decode(e.Value,t.Value=r.newBuffer(r.base64.length(e.Value)),0):e.Value.length>=0&&(t.Value=e.Value)),null!=e.RcvAddr&&("string"===typeof e.RcvAddr?r.base64.decode(e.RcvAddr,t.RcvAddr=r.newBuffer(r.base64.length(e.RcvAddr)),0):e.RcvAddr.length>=0&&(t.RcvAddr=e.RcvAddr)),null!=e.RcvUserName&&("string"===typeof e.RcvUserName?r.base64.decode(e.RcvUserName,t.RcvUserName=r.newBuffer(r.base64.length(e.RcvUserName)),0):e.RcvUserName.length>=0&&(t.RcvUserName=e.RcvUserName)),null!=e.SndAddr&&("string"===typeof e.SndAddr?r.base64.decode(e.SndAddr,t.SndAddr=r.newBuffer(r.base64.length(e.SndAddr)),0):e.SndAddr.length>=0&&(t.SndAddr=e.SndAddr)),null!=e.SndUserName&&("string"===typeof e.SndUserName?r.base64.decode(e.SndUserName,t.SndUserName=r.newBuffer(r.base64.length(e.SndUserName)),0):e.SndUserName.length>=0&&(t.SndUserName=e.SndUserName)),null!=e.GasPrice&&(r.Long?(t.GasPrice=r.Long.fromValue(e.GasPrice)).unsigned=!0:"string"===typeof e.GasPrice?t.GasPrice=parseInt(e.GasPrice,10):"number"===typeof e.GasPrice?t.GasPrice=e.GasPrice:"object"===typeof e.GasPrice&&(t.GasPrice=new r.LongBits(e.GasPrice.low>>>0,e.GasPrice.high>>>0).toNumber(!0))),null!=e.GasLimit&&(r.Long?(t.GasLimit=r.Long.fromValue(e.GasLimit)).unsigned=!0:"string"===typeof e.GasLimit?t.GasLimit=parseInt(e.GasLimit,10):"number"===typeof e.GasLimit?t.GasLimit=e.GasLimit:"object"===typeof e.GasLimit&&(t.GasLimit=new r.LongBits(e.GasLimit.low>>>0,e.GasLimit.high>>>0).toNumber(!0))),null!=e.Data&&("string"===typeof e.Data?r.base64.decode(e.Data,t.Data=r.newBuffer(r.base64.length(e.Data)),0):e.Data.length>=0&&(t.Data=e.Data)),null!=e.ChainID&&("string"===typeof e.ChainID?r.base64.decode(e.ChainID,t.ChainID=r.newBuffer(r.base64.length(e.ChainID)),0):e.ChainID.length>=0&&(t.ChainID=e.ChainID)),null!=e.Version&&(t.Version=e.Version>>>0),null!=e.Signature&&("string"===typeof e.Signature?r.base64.decode(e.Signature,t.Signature=r.newBuffer(r.base64.length(e.Signature)),0):e.Signature.length>=0&&(t.Signature=e.Signature)),null!=e.Options&&(t.Options=e.Options>>>0),null!=e.GuardianAddr&&("string"===typeof e.GuardianAddr?r.base64.decode(e.GuardianAddr,t.GuardianAddr=r.newBuffer(r.base64.length(e.GuardianAddr)),0):e.GuardianAddr.length>=0&&(t.GuardianAddr=e.GuardianAddr)),null!=e.GuardianSignature&&("string"===typeof e.GuardianSignature?r.base64.decode(e.GuardianSignature,t.GuardianSignature=r.newBuffer(r.base64.length(e.GuardianSignature)),0):e.GuardianSignature.length>=0&&(t.GuardianSignature=e.GuardianSignature)),null!=e.Relayer&&("string"===typeof e.Relayer?r.base64.decode(e.Relayer,t.Relayer=r.newBuffer(r.base64.length(e.Relayer)),0):e.Relayer.length>=0&&(t.Relayer=e.Relayer)),e.InnerTransactions){if(!Array.isArray(e.InnerTransactions))throw TypeError(".proto.Transaction.InnerTransactions: array expected");t.InnerTransactions=[];for(var n=0;n>>0,e.Nonce.high>>>0).toNumber(!0):e.Nonce),null!=e.Value&&e.hasOwnProperty("Value")&&(n.Value=t.bytes===String?r.base64.encode(e.Value,0,e.Value.length):t.bytes===Array?Array.prototype.slice.call(e.Value):e.Value),null!=e.RcvAddr&&e.hasOwnProperty("RcvAddr")&&(n.RcvAddr=t.bytes===String?r.base64.encode(e.RcvAddr,0,e.RcvAddr.length):t.bytes===Array?Array.prototype.slice.call(e.RcvAddr):e.RcvAddr),null!=e.RcvUserName&&e.hasOwnProperty("RcvUserName")&&(n.RcvUserName=t.bytes===String?r.base64.encode(e.RcvUserName,0,e.RcvUserName.length):t.bytes===Array?Array.prototype.slice.call(e.RcvUserName):e.RcvUserName),null!=e.SndAddr&&e.hasOwnProperty("SndAddr")&&(n.SndAddr=t.bytes===String?r.base64.encode(e.SndAddr,0,e.SndAddr.length):t.bytes===Array?Array.prototype.slice.call(e.SndAddr):e.SndAddr),null!=e.SndUserName&&e.hasOwnProperty("SndUserName")&&(n.SndUserName=t.bytes===String?r.base64.encode(e.SndUserName,0,e.SndUserName.length):t.bytes===Array?Array.prototype.slice.call(e.SndUserName):e.SndUserName),null!=e.GasPrice&&e.hasOwnProperty("GasPrice")&&("number"===typeof e.GasPrice?n.GasPrice=t.longs===String?String(e.GasPrice):e.GasPrice:n.GasPrice=t.longs===String?r.Long.prototype.toString.call(e.GasPrice):t.longs===Number?new r.LongBits(e.GasPrice.low>>>0,e.GasPrice.high>>>0).toNumber(!0):e.GasPrice),null!=e.GasLimit&&e.hasOwnProperty("GasLimit")&&("number"===typeof e.GasLimit?n.GasLimit=t.longs===String?String(e.GasLimit):e.GasLimit:n.GasLimit=t.longs===String?r.Long.prototype.toString.call(e.GasLimit):t.longs===Number?new r.LongBits(e.GasLimit.low>>>0,e.GasLimit.high>>>0).toNumber(!0):e.GasLimit),null!=e.Data&&e.hasOwnProperty("Data")&&(n.Data=t.bytes===String?r.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),null!=e.ChainID&&e.hasOwnProperty("ChainID")&&(n.ChainID=t.bytes===String?r.base64.encode(e.ChainID,0,e.ChainID.length):t.bytes===Array?Array.prototype.slice.call(e.ChainID):e.ChainID),null!=e.Version&&e.hasOwnProperty("Version")&&(n.Version=e.Version),null!=e.Signature&&e.hasOwnProperty("Signature")&&(n.Signature=t.bytes===String?r.base64.encode(e.Signature,0,e.Signature.length):t.bytes===Array?Array.prototype.slice.call(e.Signature):e.Signature),null!=e.Options&&e.hasOwnProperty("Options")&&(n.Options=e.Options),null!=e.GuardianAddr&&e.hasOwnProperty("GuardianAddr")&&(n.GuardianAddr=t.bytes===String?r.base64.encode(e.GuardianAddr,0,e.GuardianAddr.length):t.bytes===Array?Array.prototype.slice.call(e.GuardianAddr):e.GuardianAddr),null!=e.GuardianSignature&&e.hasOwnProperty("GuardianSignature")&&(n.GuardianSignature=t.bytes===String?r.base64.encode(e.GuardianSignature,0,e.GuardianSignature.length):t.bytes===Array?Array.prototype.slice.call(e.GuardianSignature):e.GuardianSignature),null!=e.Relayer&&e.hasOwnProperty("Relayer")&&(n.Relayer=t.bytes===String?r.base64.encode(e.Relayer,0,e.Relayer.length):t.bytes===Array?Array.prototype.slice.call(e.Relayer):e.Relayer),e.InnerTransactions&&e.InnerTransactions.length){n.InnerTransactions=[];for(var s=0;sthis.convertToProtoMessage(e))),s}serializeTransactionValue(e){let t=new c.default(e.toString());if(t.isZero())return r.from([0,0]);let n=f.bigIntToBuffer(t);return n=r.concat([r.from([0]),n]),n}isGuardedTransaction(e){const t=e.guardian.length>0,n=e.guardianSignature.length>0;return this.isWithGuardian(e)&&t&&n}isWithGuardian(e){return(e.options&l.TRANSACTION_OPTIONS_TX_GUARDED)==l.TRANSACTION_OPTIONS_TX_GUARDED}deserializeTransaction(e){throw new d.ErrUnsupportedOperation("deserializeTransaction")}}},4317:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavascriptPrototypesInHierarchy=void 0,t.getJavascriptPrototypesInHierarchy=function(e,t){let n=[],r=Object.getPrototypeOf(e);for(;r&&t(r);)n.push(r),r=Object.getPrototypeOf(r);return n}},59903:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.RelayedTransactionV1Builder=void 0;const i=n(36946),o=n(25145),s=n(66679),a=n(94712),c=n(4400);t.RelayedTransactionV1Builder=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new o.ErrInvalidRelayedV1BuilderArguments;const e=this.prepareInnerTransaction(),t=`relayedTx@${r.from(e).toString("hex")}`,n=new a.TransactionPayload(t),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf();let c=new s.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&c.setNonce(this.relayerNonce),c}prepareInnerTransaction(){if(!this.innerTransaction)return"";const e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new i.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new i.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:BigInt(this.innerTransaction.getValue().toString()),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:r.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:0==this.innerTransaction.getOptions().valueOf()?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new i.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?r.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?r.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return c.stringify(e)}}},77312:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelayedTransactionV2Builder=void 0;const r=n(25145),i=n(47480),o=n(66679),s=n(94712);t.RelayedTransactionV2Builder=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new r.ErrInvalidRelayedV2BuilderArguments;if(0!=this.innerTransaction.getGasLimit())throw new r.ErrGasLimitShouldBe0ForInnerTransaction;const{argumentsString:e}=(new i.ArgSerializer).valuesToString([new i.AddressValue(this.innerTransaction.getReceiver()),new i.U64Value(this.innerTransaction.getNonce().valueOf()),new i.BytesValue(this.innerTransaction.getData().valueOf()),new i.BytesValue(this.innerTransaction.getSignature())]),t=`relayedTxV2@${e}`,n=new s.TransactionPayload(t);let a=new o.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID,version:this.innerTransaction.getVersion(),options:this.innerTransaction.getOptions()});return this.relayerNonce&&a.setNonce(this.relayerNonce),a}}},40655:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.SignableMessage=void 0;const i=n(36946),o=n(40188),s=n(63025),a=n(95811);t.SignableMessage=class{constructor(e){this.message=r.from([]),this.signature=r.from([]),this.version=1,this.signer="ErdJS",this.address=i.Address.empty(),Object.assign(this,e)}serializeForSigning(){const e=r.from(this.message.length.toString()),t=r.concat([e,this.message]);let n=r.concat([r.from(s.MESSAGE_PREFIX),t]);return a("keccak256").update(n).digest()}serializeForSigningRaw(){return r.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=o.interpretSignatureAsBuffer(e)}getMessageSize(){const e=r.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}}},40188:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.interpretSignatureAsBuffer=t.Signature=void 0;const a=s(n(25145));class c{constructor(e){if(this.valueHex="",e)return"string"===typeof e?c.fromHex(e):e instanceof r?c.fromBuffer(e):void 0}static empty(){return new c}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!c.isValidHex(e))throw new a.ErrSignatureCannotCreate(e);return c.fromValidHex(e)}static isValidHex(e){return 64==r.from(e,"hex").length}static fromValidHex(e){let t=new c;return t.valueHex=e,t}static fromBuffer(e){if(64!=e.length)throw new a.ErrSignatureCannotCreate(e);return c.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}}t.Signature=c,t.interpretSignatureAsBuffer=function(e){if(ArrayBuffer.isView(e))return r.from(e);if(null!=e.hex)return r.from(e.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${e}`)}},90788:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.SmartContractQueriesController=void 0;const i=n(25145),o=n(79793),s=n(47480),a=n(6058);t.SmartContractQueriesController=class{constructor(e){this.abi=e.abi,this.queryRunner=e.queryRunner,this.legacyResultsParser=new s.ResultsParser}async query(e){const t=this.createQuery(e),n=await this.runQuery(t);return this.raiseForStatus(n),this.parseQueryResponse(n)}raiseForStatus(e){if(!("ok"===e.returnCode))throw new i.ErrSmartContractQuery(e.returnCode,e.returnMessage)}createQuery(e){const t=this.encodeArguments(e.function,e.arguments);return new o.SmartContractQuery({contract:e.contract,caller:e.caller,function:e.function,arguments:t,value:e.value})}encodeArguments(e,t){const n=this.abi?.getEndpoint(e);if(n){const e=s.NativeSerializer.nativeToTypedValues(t,n);return(new s.ArgSerializer).valuesToBuffers(e)}if(this.areArgsOfTypedValue(t))return(new s.ArgSerializer).valuesToBuffers(t);if(this.areArgsBuffers(t))return t.map((e=>r.from(e)));throw new i.Err("cannot encode arguments: when ABI is not available, they must be either typed values or buffers")}areArgsOfTypedValue(e){return e.every((e=>a.isTyped(e)))}areArgsBuffers(e){for(const t of e)if(!ArrayBuffer.isView(t))return!1;return!0}async runQuery(e){return await this.queryRunner.runQuery(e)}parseQueryResponse(e){if(!this.abi)return e.returnDataParts;const t={returnCode:e.returnCode,returnMessage:e.returnMessage,getReturnDataParts:()=>e.returnDataParts.map((e=>r.from(e)))},n=e.function,i=this.abi.getEndpoint(n);return this.legacyResultsParser.parseQueryResponse(t,i).values.map((e=>e.valueOf()))}}},79793:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SmartContractQueryResponse=t.SmartContractQuery=void 0;t.SmartContractQuery=class{constructor(e){this.contract=e.contract,this.caller=e.caller,this.value=e.value,this.function=e.function,this.arguments=e.arguments}};t.SmartContractQueryResponse=class{constructor(e){this.function=e.function,this.returnCode=e.returnCode,this.returnMessage=e.returnMessage,this.returnDataParts=e.returnDataParts}}},14558:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.ArgSerializer=void 0;const i=n(63025),o=n(92377),s=n(6058),a=n(79967),c=n(46522),u=n(79554),l={codec:new o.BinaryCodec};t.ArgSerializer=class{constructor(e){e={...l,...e},this.codec=e.codec}stringToValues(e,t){let n=this.stringToBuffers(e);return this.buffersToValues(n,t)}stringToBuffers(e){return e.split(i.ARGUMENTS_SEPARATOR).map((e=>r.from(e,"hex")))}buffersToValues(e,t){const n=this;let r=[],i=0,o=(e=e||[]).length;for(let s=0;s=o}return r}valuesToString(e){let t=this.valuesToStrings(e);return{argumentsString:t.join(i.ARGUMENTS_SEPARATOR),count:t.length}}valuesToStrings(e){return this.valuesToBuffers(e).map((e=>e.toString("hex")))}valuesToBuffers(e){const t=this,n=[];for(const i of e)r(i);function r(e){if(e.hasExactClass(a.OptionalValue.ClassName)){const t=e;return void(t.isSet()&&r(t.getTypedValue()))}if(e.hasExactClass(u.VariadicValue.ClassName))return void function(e){if(e.getType().isCounted){const r=new s.U32Value(e.getItems().length);n.push(t.codec.encodeTopLevel(r))}for(const t of e.getItems())r(t)}(e);if(e.hasExactClass(c.CompositeValue.ClassName)){const t=e;for(const e of t.getItems())r(e);return}const i=t.codec.encodeTopLevel(e);n.push(i)}return n}}},73913:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentErrorContext=void 0;const r=n(25145);t.ArgumentErrorContext=class{constructor(e,t,n){this.endpointName=e,this.argumentIndex=t,this.parameterDefinition=n}throwError(e){throw new r.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type})\nNested error: ${e}`)}convertError(e,t){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${t})`)}unhandledType(e,t){this.throwError(`Unhandled type (function: ${e}, type: ${t})`)}guardSameLength(e,t){(e=e||[]).length!=t.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${t.length} (argument: ${e})`)}guardHasField(e,t){t in(e=e||{})||this.throwError(`Struct argument does not contain a field named "${t}" (argument: ${JSON.stringify(e)})`)}}},37327:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.Code=void 0;const i=n(17462);class o{constructor(e){this.hex=e}static fromBuffer(e){return new o(e.toString("hex"))}static fromHex(e){return new o(e)}toString(){return this.hex}valueOf(){return r.from(this.hex,"hex")}computeHash(){const e=i(32).update(this.valueOf()).digest();return r.from(e)}}t.Code=o},69259:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.CodeMetadata=void 0;class i{constructor(e=!0,t=!1,n=!1,r=!1){this.upgradeable=e,this.readable=t,this.payable=n,this.payableBySc=r}static fromBytes(e){return i.fromBuffer(r.from(e))}static fromBuffer(e){if(e.lengththis.optionCodec.decodeTopLevel(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,t),onArray:()=>this.arrayCodec.decodeTopLevel(e,t),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,t),onStruct:()=>this.structCodec.decodeTopLevel(e,t),onTuple:()=>this.tupleCodec.decodeTopLevel(e,t),onEnum:()=>this.enumCodec.decodeTopLevel(e,t),onManagedDecimal:()=>this.managedDecimalCodec.decodeTopLevel(e,t),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.decodeTopLevel(e,t)})}decodeNested(e,t){this.constraints.checkBufferLength(e);let[n,r]=a.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeNested(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,t),onArray:()=>this.arrayCodec.decodeNested(e,t),onPrimitive:()=>this.primitiveCodec.decodeNested(e,t),onStruct:()=>this.structCodec.decodeNested(e,t),onTuple:()=>this.tupleCodec.decodeNested(e,t),onEnum:()=>this.enumCodec.decodeNested(e,t),onManagedDecimal:()=>this.managedDecimalCodec.decodeNested(e,t),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.decodeNested(e,t)});return[n,r]}encodeNested(e){return c.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),a.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e),onManagedDecimal:()=>this.managedDecimalCodec.encodeNested(e),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.encodeNested(e)})}encodeTopLevel(e){return c.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),a.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e),onManagedDecimal:()=>this.managedDecimalCodec.encodeTopLevel(e),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.encodeTopLevel(e)})}};class y{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new s.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new s.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}}t.BinaryCodecConstraints=y},71572:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeBigNumber=t.decodeString=t.decodeBool=t.decodeUnsignedNumber=void 0;const i=r(n(44431)),o=n(6058),s=new(n(33831).BinaryCodec);t.decodeUnsignedNumber=function(e){let t=s.decodeTopLevel(e,new o.BigUIntType);return Number(t.valueOf())},t.decodeBool=function(e){let t=s.decodeTopLevel(e,new o.BooleanType);return Boolean(t.valueOf())},t.decodeString=function(e){let t=s.decodeTopLevel(e,new o.BytesType);return String(t.valueOf())},t.decodeBigNumber=function(e){let t=s.decodeTopLevel(e,new o.BigUIntType);return new i.default(t.valueOf())}},70895:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanBinaryCodec=void 0;const a=s(n(25145)),c=n(6058);class u{decodeNested(e){let t=e.readUInt8(0);return[new c.BooleanValue(t==u.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new a.ErrInvalidArgument("buffer should be of size <= 1");let t=e[0];return new c.BooleanValue(t==u.TRUE)}encodeNested(e){return e.isTrue()?r.from([u.TRUE]):r.from([u.FALSE])}encodeTopLevel(e){return e.isTrue()?r.from([u.TRUE]):r.from([])}}t.BooleanBinaryCodec=u,u.TRUE=1,u.FALSE=0},12523:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.BytesBinaryCodec=void 0;const i=n(4212),o=n(4413);t.BytesBinaryCodec=class{decodeNested(e){let t=e.readUInt32BE(0),n=e.slice(o.SizeOfU32,o.SizeOfU32+t);return[new i.BytesValue(n),o.SizeOfU32+t]}decodeTopLevel(e){return new i.BytesValue(e)}encodeNested(e){let t=r.alloc(o.SizeOfU32);return t.writeUInt32BE(e.getLength()),r.concat([t,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}}},87270:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeMetadataCodec=void 0;const r=n(69259),i=n(93242);t.CodeMetadataCodec=class{decodeNested(e){const t=r.CodeMetadata.fromBuffer(e);return[new i.CodeMetadataValue(t),length]}decodeTopLevel(e){const t=r.CodeMetadata.fromBuffer(e);return new i.CodeMetadataValue(t)}encodeNested(e){return e.valueOf().toBuffer()}encodeTopLevel(e){return e.valueOf().toBuffer()}}},4413:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SizeOfU32=void 0,t.SizeOfU32=4},54424:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.EnumBinaryCodec=void 0;const i=n(6058),o=n(30418);t.EnumBinaryCodec=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new o.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[n]=this.decodeNested(e,t);return n}decodeNested(e,t){let[n,r]=this.readDiscriminant(e);e=e.slice(r);let o=t.getVariantByDiscriminant(n),s=o.getFieldsDefinitions(),[a,c]=this.fieldsCodec.decodeNested(e,s);return[new i.EnumValue(t,o,a),r+c]}readDiscriminant(e){let[t,n]=this.binaryCodec.decodeNested(e,new i.U8Type);return[t.valueOf(),n]}encodeNested(e){let t=new i.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(t),o=e.getFields(),s=this.fieldsCodec.encodeNested(o);return r.concat([n,s])}encodeTopLevel(e){let t=e.getFields(),n=t.length>0,o=this.fieldsCodec.encodeNested(t),s=new i.U8Value(e.discriminant),a=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return r.concat([a,o])}}},30418:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.FieldsBinaryCodec=void 0;const i=n(6058);t.FieldsBinaryCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let n=[],r=0;for(const o of t){let[t,s]=this.binaryCodec.decodeNested(e,o.type);e=e.slice(s),r+=s;let a=new i.Field(t,o.name);n.push(a)}return[n,r]}encodeNested(e){let t=[];for(const n of e){let e=this.binaryCodec.encodeNested(n.value);t.push(e)}return r.concat(t)}}},65407:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.H256BinaryCodec=void 0;const r=n(22779);t.H256BinaryCodec=class{decodeNested(e){let t=e.slice(0,32);return[new r.H256Value(t),32]}decodeTopLevel(e){let[t,n]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}}},92377:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(33831),t),i(n(71572),t)},33530:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.ListBinaryCodec=void 0;const i=n(6058),o=n(4413);t.ListBinaryCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let n=t.getFirstTypeParameter(),r=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let a=e,c=o.SizeOfU32;e=a.slice(c);for(let i=0;i0;){let[t,i]=this.binaryCodec.decodeNested(e,n);r.push(t),s+=i,e=o.slice(s),this.binaryCodec.constraints.checkListLength(r.length)}return new i.List(t,r)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=r.alloc(o.SizeOfU32);t.writeUInt32BE(e.getLength());let n=[];for(const r of e.getItems()){let e=this.binaryCodec.encodeNested(r);n.push(e)}return r.concat([t,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=[];for(const n of e.getItems()){let e=this.binaryCodec.encodeNested(n);t.push(e)}return r.concat(t)}}},93972:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagedDecimalCodec=void 0;const o=i(n(44431)),s=n(6058),a=n(68683),c=n(4413);t.ManagedDecimalCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){const n=e.readUInt32BE(0),r=e.slice(0,n);return[this.decodeTopLevel(r,t),n]}decodeTopLevel(e,t){if(0===e.length)return new s.ManagedDecimalValue(new o.default(0),0);if(t.isVariable()){const t=e.length-c.SizeOfU32,[n]=this.binaryCodec.decodeNested(e.slice(0,t),new s.BigUIntType),r=e.readUInt32BE(t);return new s.ManagedDecimalValue(n.valueOf().shiftedBy(-r),r)}const n=a.bufferToBigInt(e),r=t.getMetadata(),i="usize"!==r?parseInt(r.toString()):0;return new s.ManagedDecimalValue(n.shiftedBy(-i),i)}encodeNested(e){let t=[];const n=new s.BigUIntValue(e.valueOf().shiftedBy(e.getScale()));return e.isVariable()?(t.push(r.from(this.binaryCodec.encodeNested(n))),t.push(r.from(this.binaryCodec.encodeNested(new s.U32Value(e.getScale()))))):t.push(this.binaryCodec.encodeTopLevel(n)),r.concat(t)}encodeTopLevel(e){return this.encodeNested(e)}}},82245:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagedDecimalSignedCodec=void 0;const o=i(n(44431)),s=n(6058),a=n(68683),c=n(4413);t.ManagedDecimalSignedCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){const n=e.readUInt32BE(0),r=e.slice(0,n);return[this.decodeTopLevel(r,t),n]}decodeTopLevel(e,t){if(0===e.length)return new s.ManagedDecimalSignedValue(new o.default(0),0);if(t.isVariable()){const t=e.length-c.SizeOfU32,[n]=this.binaryCodec.decodeNested(e.slice(0,t),new s.BigIntType),r=e.readUInt32BE(t);return new s.ManagedDecimalSignedValue(n.valueOf().shiftedBy(-r),r)}const n=a.bufferToBigInt(e),r=t.getMetadata(),i="usize"!==r?parseInt(r.toString()):0;return new s.ManagedDecimalSignedValue(n.shiftedBy(-i),i)}encodeNested(e){let t=[];const n=new s.BigIntValue(e.valueOf().shiftedBy(e.getScale()));return e.isVariable()?(t.push(r.from(this.binaryCodec.encodeNested(n))),t.push(r.from(this.binaryCodec.encodeNested(new s.U32Value(e.getScale()))))):t.push(r.from(this.binaryCodec.encodeTopLevel(n))),r.concat(t)}encodeTopLevel(e){return this.encodeNested(e)}}},68649:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.NothingCodec=void 0;const i=n(6058);t.NothingCodec=class{decodeNested(){return[new i.NothingValue,0]}decodeTopLevel(){return new i.NothingValue}encodeNested(){return r.from([])}encodeTopLevel(){return r.from([])}}},84925:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericalBinaryCodec=void 0;const o=i(n(44431)),s=n(6058),a=n(4413),c=n(68683);t.NumericalBinaryCodec=class{decodeNested(e,t){let n=0,r=t.sizeInBytes;r||(n=a.SizeOfU32,r=e.readUInt32BE(0));let i=e.slice(n,n+r);return[this.decodeTopLevel(i,t),r+n]}decodeTopLevel(e,t){let n=c.cloneBuffer(e);if(0==e.length)return new s.NumericalValue(t,new o.default(0));if(!t.withSign||c.isMsbZero(n)){let e=c.bufferToBigInt(n);return new s.NumericalValue(t,e)}c.flipBufferBitsInPlace(n);let r=c.bufferToBigInt(n).multipliedBy(new o.default(-1)).minus(new o.default(1));return new s.NumericalValue(t,r)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let t=this.encodeTopLevel(e),n=r.alloc(a.SizeOfU32);return n.writeUInt32BE(t.length),r.concat([n,t])}encodeNestedFixedSize(e,t){if(e.value.isZero())return r.alloc(t,0);if(!e.withSign){const n=c.bigIntToBuffer(e.value),i=r.alloc(t-n.length,0);return r.concat([i,n])}if(e.value.isPositive()){let n=c.bigIntToBuffer(e.value);c.isMsbOne(n)&&(n=c.prependByteToBuffer(n,0));const i=r.alloc(t-n.length,0);return r.concat([i,n])}let n=e.value.plus(new o.default(1)),i=c.bigIntToBuffer(n);c.flipBufferBitsInPlace(i),c.isMsbZero(i)&&(i=c.prependByteToBuffer(i,255));const s=r.alloc(t-i.length,255);return r.concat([s,i])}encodeTopLevel(e){let t=e.withSign;return e.value.isZero()?r.alloc(0):t?this.encodePrimitive(e):c.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let t=c.bigIntToBuffer(e.value);return c.isMsbOne(t)&&(t=c.prependByteToBuffer(t,0)),t}let t=e.value.plus(new o.default(1)),n=c.bigIntToBuffer(t);return c.flipBufferBitsInPlace(n),c.isMsbZero(n)&&(n=c.prependByteToBuffer(n,255)),n}}},76726:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.OptionValueBinaryCodec=void 0;const a=s(n(25145)),c=n(6058);t.OptionValueBinaryCodec=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){if(0==e[0])return[c.OptionValue.newMissingTyped(t),1];if(1!=e[0])throw new a.ErrCodec("invalid buffer for optional value");let[n,r]=this.binaryCodec.decodeNested(e.slice(1),t);return[c.OptionValue.newProvided(n),r+1]}decodeTopLevel(e,t){if(0==e.length)return new c.OptionValue(t);if(1!=e[0])throw new a.ErrCodec("invalid buffer for optional value");let[n,r]=this.binaryCodec.decodeNested(e.slice(1),t);return new c.OptionValue(t,n)}encodeNested(e){return e.isSet()?r.concat([r.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):r.from([0])}encodeTopLevel(e){return e.isSet()?r.concat([r.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):r.from([])}}},43840:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PrimitiveBinaryCodec=void 0;const r=n(6058),i=n(54284),o=n(70895),s=n(84925),a=n(65407),c=n(12523),u=n(77856),l=n(87270),d=n(68649),f=n(50218);t.PrimitiveBinaryCodec=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new o.BooleanBinaryCodec,this.numericalCodec=new s.NumericalBinaryCodec,this.addressCodec=new i.AddressBinaryCodec,this.h256Codec=new a.H256BinaryCodec,this.bytesCodec=new c.BytesBinaryCodec,this.stringCodec=new f.StringBinaryCodec,this.tokenIdentifierCodec=new u.TokenIdentifierCodec,this.codeMetadataCodec=new l.CodeMetadataCodec,this.nothingCodec=new d.NothingCodec}decodeNested(e,t){return r.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,t),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onCodeMetadata:()=>this.codeMetadataCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,t){return r.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,t),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onCodeMetadata:()=>this.codeMetadataCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return r.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onCodeMetadata:()=>this.codeMetadataCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return r.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onCodeMetadata:()=>this.codeMetadataCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}}},50218:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.StringBinaryCodec=void 0;const i=n(6058),o=n(4212),s=n(12523);t.StringBinaryCodec=class{constructor(){this.bytesBinaryCodec=new s.BytesBinaryCodec}decodeNested(e){let[t,n]=this.bytesBinaryCodec.decodeNested(e);return[new i.StringValue(t.valueOf().toString()),n]}decodeTopLevel(e){return new i.StringValue(e.toString())}encodeNested(e){let t=o.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(t)}encodeTopLevel(e){return r.from(e.valueOf())}}},61327:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StructBinaryCodec=void 0;const r=n(6058),i=n(30418);t.StructBinaryCodec=class{constructor(e){this.fieldsCodec=new i.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[n]=this.decodeNested(e,t);return n}decodeNested(e,t){let n=t.getFieldsDefinitions(),[i,o]=this.fieldsCodec.decodeNested(e,n);return[new r.Struct(t,i),o]}encodeNested(e){let t=e.getFields();return this.fieldsCodec.encodeNested(t)}encodeTopLevel(e){return this.encodeNested(e)}}},77856:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenIdentifierCodec=void 0;const i=n(4212),o=n(38433),s=n(12523);t.TokenIdentifierCodec=class{constructor(){this.bytesCodec=new s.BytesBinaryCodec}decodeNested(e){let[t,n]=this.bytesCodec.decodeNested(e);return[new o.TokenIdentifierValue(t.toString()),n]}decodeTopLevel(e){let t=this.bytesCodec.decodeTopLevel(e);return new o.TokenIdentifierValue(t.toString())}encodeNested(e){let t=i.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(t)}encodeTopLevel(e){return r.from(e.valueOf())}}},17362:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TupleBinaryCodec=void 0;const r=n(61327);t.TupleBinaryCodec=class{constructor(e){this.structCodec=new r.StructBinaryCodec(e)}decodeTopLevel(e,t){return this.structCodec.decodeTopLevel(e,t)}decodeNested(e,t){return this.structCodec.decodeNested(e,t)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}}},68683:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.prependByteToBuffer=t.flipBufferBitsInPlace=t.getHexMagnitudeOfBigInt=t.bigIntToBuffer=t.bufferToBigInt=t.cloneBuffer=t.isMsbZero=t.isMsbOne=void 0;const o=i(n(44431)),s=n(89439);function a(e,t=0){return 1==e[t]>>7}function c(e){return(e=new o.default(e))?(e.isNegative()&&(e=e.multipliedBy(new o.default(-1))),s.numberToPaddedHex(e)):""}t.isMsbOne=a,t.isMsbZero=function(e,t=0){return!a(e,t)},t.cloneBuffer=function(e){let t=r.alloc(e.length);return e.copy(t),t},t.bufferToBigInt=function(e){let t=e.toString("hex");return new o.default(`0x${t}`,16)},t.bigIntToBuffer=function(e){let t=c(e);return r.from(t,"hex")},t.getHexMagnitudeOfBigInt=c,t.flipBufferBitsInPlace=function(e){for(let t=0;tnew s.TokenTransfer(e))),this}withSingleESDTNFTTransfer(e){return this.tokenTransfers=[e].map((e=>new s.TokenTransfer(e))),this}withMultiESDTNFTTransfer(e){return this.tokenTransfers=e.map((e=>new s.TokenTransfer(e))),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withVersion(e){return this.version=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return(new c.InteractionChecker).checkInteraction(this,this.getEndpoint()),this}}},46038:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionChecker=void 0;const a=o(n(25145)),c=s(n(44431));t.InteractionChecker=class{checkInteraction(e,t){this.checkPayable(e,t),this.checkArguments(e,t)}checkPayable(e,t){let n=!new c.default(e.getValue().toString()).isZero(),r=t.modifiers.isPayableInEGLD();if(n&&!r)throw new a.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,t){let n=t.input,r=e.getArguments(),i=n.length,o=r.length;if(i!=o)throw new a.ErrContractInteraction(`bad arguments, expected: ${i}, got: ${o}`);for(let s=0;s0&&t[0].type.getCardinality().isComposite()&&(r=1/0,i=!0);for(let o of t){if(o.type.getCardinality().isSingular())break;n-=1}return{min:n,max:r,variadic:i}}function n(e,t,s){return e&&l.isTyped(e)?e:t instanceof l.OptionType?function(e,t,r){if(null==e)return l.OptionValue.newMissing();let i=n(e,t.getFirstTypeParameter(),r);return l.OptionValue.newProvided(i)}(e,t,s):t instanceof l.OptionalType?function(e,t,r){if(null==e)return new l.OptionalValue(t);let i=n(e,t.getFirstTypeParameter(),r);return new l.OptionalValue(t,i)}(e,t,s):t instanceof l.VariadicType?function(e,t,r){if(t.isCounted)throw new a.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');null==e&&(e=[]);void 0===e.map&&r.convertError(e,"Variadic");let i=e.map((function(e){return n(e,t.getFirstTypeParameter(),r)}));return new l.VariadicValue(t,i)}(e,t,s):t instanceof l.CompositeType?function(e,t,r){let i=[],o=t.getTypeParameters();r.guardSameLength(e,o);for(let s=0;s0!=e.nonce.valueOf()&&e.data.startsWith("@")));if(!t)return null;let{returnCode:n,returnDataParts:r}=this.sliceDataFieldInParts(t.data),i=t.returnMessage||n.toString();return{returnCode:n,returnMessage:i,values:r}}createBundleOnSignalError(e){let t=e.findSingleOrNoneEvent(l.OnSignalError);if(!t)return null;let{returnCode:n,returnDataParts:r}=this.sliceDataFieldInParts(t.data),i=t.getLastTopic()?.toString()||n.toString();return{returnCode:n,returnMessage:i,values:r}}createBundleOnTooMuchGasWarning(e){let t=e.findSingleOrNoneEvent(l.OnWriteLog,(e=>void 0!=e.findFirstOrNoneTopic((e=>e.toString().startsWith(d.TooMuchGas)))));if(!t)return null;let{returnCode:n,returnDataParts:r}=this.sliceDataFieldInParts(t.data);return{returnCode:n,returnMessage:n.toString(),values:r}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,t){let n=new o.Address(t.bech32()).hex(),r=e.findSingleOrNoneEvent(l.OnWriteLog,(e=>void 0!=e.findFirstOrNoneTopic((e=>e.hex()==n))));if(!r)return null;let{returnCode:i,returnDataParts:s}=this.sliceDataFieldInParts(r.data),a=i.toString();return{returnCode:i,returnMessage:a,values:s}}createBundleWithCustomHeuristics(e,t){return null}createBundleWithFallbackHeuristics(e,t){let n=new o.Address(t.receiver);for(const r of e.contractResults.items){let t=r.logs.findSingleOrNoneEvent(l.OnWriteLog,(t=>{let r=t.address.bech32()==e.sender.bech32(),i=t.topics[0]?.hex()==n.hex();return r&&i}));if(t){let{returnCode:e,returnDataParts:n}=this.sliceDataFieldInParts(t.data),r=e.toString();return{returnCode:e,returnMessage:r,values:n}}}for(const r of e.contractResults.items){let e=r.logs.findSingleOrNoneEvent(l.OnWriteLog,(e=>e.address.bech32()==n.toBech32()));if(e){const{returnCode:t,returnDataParts:n}=this.sliceDataFieldInParts(e.data),r=t.toString();return{returnCode:t,returnMessage:r,values:n}}}return null}sliceDataFieldInParts(e){let t=1;e.startsWith("ESDTTransfer")&&(t=3);let n=this.argsSerializer.stringToBuffers(e),i=n[t]||r.from([]),o=n.slice(t+1);if(0==i.length)throw new s.ErrCannotParseContractResults("no return code");return{returnCode:u.ReturnCode.fromBuffer(i),returnDataParts:o}}parseEvent(e,t){const n=e.topics.map((e=>r.from(e.valueOf()))).slice(1),i=e.dataPayload?.valueOf()||r.from([]),o=e.additionalData?.map((e=>r.from(e.valueOf())))||[];return 0===o.length&&i.length&&o.push(r.from(i)),this.doParseEvent({topics:n,dataItems:o,eventDefinition:t})}doParseEvent(e){const t={},n=e.eventDefinition.inputs.filter((e=>e.indexed)),r=this.argsSerializer.buffersToValues(e.topics,n);for(let s=0;s!e.indexed)),o=this.argsSerializer.buffersToValues(e.dataItems,i);for(let s=0;sc.EndpointDefinition.fromJSON(e))),m=[];for(const c in o){const e=o[c];if("struct"==e.type)m.push(d.StructType.fromJSON({name:c,fields:e.fields}));else{if("enum"!=e.type&&"explicit-enum"!=e.type)throw new s.ErrTypingSystem(`Cannot handle custom type: ${c}`);m.push(u.EnumType.fromJSON({name:c,variants:e.variants}))}}const b=a.map((e=>l.EventDefinition.fromJSON(e)));return new h({name:t,constructorDefinition:f,upgradeConstructorDefinition:p,endpoints:g,customTypes:m,events:b}).remapToKnownTypes()}getCustomType(e){const t=this.customTypes.find((t=>t.getName()==e));return a.guardValueIsSetWithMessage(`custom type [${e}] not found`,t),t}getStruct(e){const t=this.customTypes.find((t=>t.getName()==e&&t.hasExactClass(d.StructType.ClassName)));return a.guardValueIsSetWithMessage(`struct [${e}] not found`,t),t}getStructs(e){return e.map((e=>this.getStruct(e)))}getEnum(e){const t=this.customTypes.find((t=>t.getName()==e&&t.hasExactClass(u.EnumType.ClassName)));return a.guardValueIsSetWithMessage(`enum [${e}] not found`,t),t}getEnums(e){return e.map((e=>this.getEnum(e)))}getEndpoints(){return this.endpoints}getEndpoint(e){const t=this.endpoints.find((t=>t.name==e));return a.guardValueIsSetWithMessage(`endpoint [${e}] not found`,t),t}getEvent(e){const t=this.events.find((t=>t.identifier==e));return a.guardValueIsSetWithMessage(`event [${e}] not found`,t),t}remapToKnownTypes(){const e=new f.TypeMapper([]),t=[];for(const s of this.customTypes)this.mapCustomTypeDepthFirst(s,this.customTypes,e,t);if(this.customTypes.length!=t.length)throw new s.ErrTypingSystem("Did not re-map all custom types");const n=p(this.constructorDefinition,e),r=this.upgradeConstructorDefinition?p(this.upgradeConstructorDefinition,e):void 0,i=[];for(const s of this.endpoints)i.push(p(s,e));const o=this.events.map((t=>function(e,t){const n=e.inputs.map((e=>new l.EventTopicDefinition({name:e.name,type:t.mapType(e.type),indexed:e.indexed})));return new l.EventDefinition(e.identifier,n)}(t,e)));return new h({name:this.name,constructorDefinition:n,upgradeConstructorDefinition:r,endpoints:i,customTypes:t,events:o})}mapCustomTypeDepthFirst(e,t,n,r){if(r.findIndex((t=>t.getName()==e.getName()))>=0)return;for(const o of e.getNamesOfDependencies()){const e=t.find((e=>e.getName()==o));e&&this.mapCustomTypeDepthFirst(e,t,n,r)}const i=n.mapType(e);r.push(i)}}function p(e,t){const n=e.input.map((e=>new c.EndpointParameterDefinition(e.name,e.description,t.mapType(e.type)))),r=e.output.map((e=>new c.EndpointParameterDefinition(e.name,e.description,t.mapType(e.type))));return new c.EndpointDefinition(e.name,n,r,e.modifiers,e.title)}t.AbiRegistry=h},88740:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddressValue=t.AddressType=void 0;const r=n(36946),i=n(31479);class o extends i.PrimitiveType{constructor(){super("Address")}getClassName(){return o.ClassName}}t.AddressType=o,o.ClassName="AddressType";class s extends i.PrimitiveValue{constructor(e){super(new o),this.value=r.Address.newFromBech32(e.bech32())}getClassName(){return s.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}}t.AddressValue=s,s.ClassName="AddressValue"},79967:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalValue=t.OptionalType=void 0;const r=n(44425),i=n(31479);class o extends i.Type{constructor(e){super("Optional",[e],i.TypeCardinality.variable(1))}getClassName(){return o.ClassName}isAssignableFrom(e){if(!e.hasExactClass(o.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(i.NullType.ClassName);return t||n}}t.OptionalType=o,o.ClassName="OptionalType";class s extends i.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return s.ClassName}static newMissing(){let e=new o(new i.NullType);return new s(e)}isSet(){return!!this.value}getTypedValue(){return r.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}}t.OptionalValue=s,s.ClassName="OptionalValue"},43726:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanValue=t.BooleanType=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("bool")}getClassName(){return i.ClassName}}t.BooleanType=i,i.ClassName="BooleanType";class o extends r.PrimitiveValue{constructor(e){super(new i),this.value=e}getClassName(){return o.ClassName}equals(e){return this.value===e.value}isTrue(){return!0===this.value}isFalse(){return!this.isTrue()}valueOf(){return this.value}}t.BooleanValue=o,o.ClassName="BooleanValue"},4212:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.BytesValue=t.BytesType=void 0;const i=n(31479);class o extends i.PrimitiveType{constructor(){super("bytes")}getClassName(){return o.ClassName}}t.BytesType=o,o.ClassName="BytesType";class s extends i.PrimitiveValue{constructor(e){super(new o),this.value=e}getClassName(){return s.ClassName}static fromUTF8(e){let t=r.from(e,"utf-8");return new s(t)}static fromHex(e){let t=r.from(e,"hex");return new s(t)}getLength(){return this.value.length}equals(e){return this.getLength()==e.getLength()&&this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}}t.BytesValue=s,s.ClassName="BytesValue"},93242:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeMetadataValue=t.CodeMetadataType=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("CodeMetadata")}}t.CodeMetadataType=i;class o extends r.PrimitiveValue{constructor(e){super(new i),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}}t.CodeMetadataValue=o},37471:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CollectionOfTypedValues=void 0;t.CollectionOfTypedValues=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map((e=>e.valueOf()))}equals(e){if(this.getLength()!=e.getLength())return!1;for(let t=0;te.getType())),n=new o(...t);return new s(n,e)}getItems(){return this.items}valueOf(){return this.items.map((e=>e?.valueOf()))}equals(e){if(this.getType().differs(e.getType()))return!1;for(let t=0;ts.fromJSON(e))),n=e.outputs.map((e=>s.fromJSON(e))),r=new o(e.mutability,e.payableInTokens,e.onlyOwner);return new i(e.name,t,n,r,e.title)}}t.EndpointDefinition=i;class o{constructor(e,t,n){this.mutability=e||"",this.payableInTokens=t||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return!!this.payableInTokens.includes(e)||!this.payableInTokens.includes(`!${e}`)&&!!this.payableInTokens.includes("*")}isPayable(){return 0!=this.payableInTokens.length}isReadonly(){return"readonly"==this.mutability}isOnlyOwner(){return this.onlyOwner}}t.EndpointModifiers=o;class s{constructor(e,t,n){this.name=e,this.description=t,this.type=n}static fromJSON(e){let t=(new r.TypeExpressionParser).parse(e.type);return new s(e.name||"?",e.description||"N / A",t)}}t.EndpointParameterDefinition=s},3913:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EnumValue=t.EnumVariantDefinition=t.EnumType=void 0;const r=n(25145),i=n(44425),o=n(43149),s=n(31479);class a extends s.CustomType{constructor(e,t){super(e),this.variants=[],this.variants=t}getClassName(){return a.ClassName}static fromJSON(e){const t=a.assignMissingDiscriminants(e.variants||[]).map((e=>c.fromJSON(e)));return new a(e.name,t)}static assignMissingDiscriminants(e){return e.every((e=>void 0==e.discriminant))?e.map(((e,t)=>({...e,discriminant:t}))):e}getVariantByDiscriminant(e){let t=this.variants.find((t=>t.discriminant==e));return i.guardValueIsSet(`variant by discriminant (${e})`,t),t}getVariantByName(e){let t=this.variants.find((t=>t.name==e));return i.guardValueIsSet(`variant by name (${e})`,t),t}getNamesOfDependencies(){const e=[];for(const t of this.variants)e.push(...t.getNamesOfDependencies());return[...new Set(e)]}}t.EnumType=a,a.ClassName="EnumType";class c{constructor(e,t,n=[]){this.fieldsDefinitions=[],i.guardTrue(t<256,"discriminant for simple enum should be less than 256"),this.name=e,this.discriminant=t,this.fieldsDefinitions=n}static fromJSON(e){let t=(e.fields||[]).map((e=>o.FieldDefinition.fromJSON(e)));return new c(e.name,e.discriminant,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find((t=>t.name==e))}getNamesOfDependencies(){return o.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}}t.EnumVariantDefinition=c;class u extends s.TypedValue{constructor(e,t,n){super(e),this.fields=[],this.name=t.name,this.discriminant=t.discriminant,this.fields=n,this.fieldsByName=new Map(n.map((e=>[e.name,e])));let r=t.getFieldsDefinitions();o.Fields.checkTyping(this.fields,r)}getClassName(){return u.ClassName}static fromName(e,t){let n=e.getVariantByName(t);return new u(e,n,[])}static fromDiscriminant(e,t){let n=e.getVariantByDiscriminant(t);return new u(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),n=e.getFields();const r=this.name==e.name,i=this.discriminant==e.discriminant,s=o.Fields.equals(t,n);return r&&i&&s}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new r.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(((t,n)=>e.fields[n]=t.value.valueOf())),e}}t.EnumValue=u,u.ClassName="EnumValue"},32746:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTopicDefinition=t.EventDefinition=void 0;const r=n(65955);class i{constructor(e,t){this.inputs=[],this.identifier=e,this.inputs=t||[]}static fromJSON(e){e.identifier=null==e.identifier?"?":e.identifier,e.inputs=e.inputs||[];const t=e.inputs.map((e=>o.fromJSON(e)));return new i(e.identifier,t)}}t.EventDefinition=i;class o{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){const t=(new r.TypeExpressionParser).parse(e.type);return new o({name:e.name||"?",type:t,indexed:e.indexed})}}t.EventTopicDefinition=o},88316:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createListOfTokenIdentifiers=t.createListOfAddresses=void 0;const r=n(88740),i=n(75902),o=n(38433);t.createListOfAddresses=function(e){let t=e.map((e=>new r.AddressValue(e)));return i.List.fromItems(t)},t.createListOfTokenIdentifiers=function(e){let t=e.map((e=>new o.TokenIdentifierValue(e)));return i.List.fromItems(t)}},43149:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Fields=t.Field=t.FieldDefinition=void 0;const s=o(n(25145)),a=n(65955);class c{constructor(e,t,n){this.name=e,this.description=t,this.type=n}static fromJSON(e){let t=(new a.TypeExpressionParser).parse(e.type);return new c(e.name,e.description,t)}}t.FieldDefinition=c;t.Field=class{constructor(e,t=""){this.value=e,this.name=t}checkTyping(e){const t=this.value.getType();if(!t.equals(e.type))throw new s.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${t}"`);if(this.name!=e.name)throw new s.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};t.Fields=class{static checkTyping(e,t){if(e.length!=t.length)throw new s.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n0,"array length > 0"),this.length=e}getClassName(){return s.ClassName}}t.ArrayVecType=s,s.ClassName="ArrayVecType";class a extends o.TypedValue{constructor(e,t){super(e),r.guardLength(t,e.length),this.backingCollection=new i.CollectionOfTypedValues(t)}getClassName(){return a.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}}t.ArrayVec=a,a.ClassName="ArrayVec"},22779:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.H256Value=t.H256Type=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("H256")}getClassName(){return i.ClassName}}t.H256Type=i,i.ClassName="H256Type";class o extends r.PrimitiveValue{constructor(e){super(new i),this.value=e}getClassName(){return o.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}}t.H256Value=o,o.ClassName="H256Value"},6058:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(89676),t),i(n(88740),t),i(n(79967),t),i(n(43726),t),i(n(4212),t),i(n(93242),t),i(n(46522),t),i(n(78891),t),i(n(3913),t),i(n(88316),t),i(n(43149),t),i(n(75902),t),i(n(87762),t),i(n(22779),t),i(n(30594),t),i(n(69511),t),i(n(69754),t),i(n(67706),t),i(n(272),t),i(n(38433),t),i(n(43802),t),i(n(65955),t),i(n(52725),t),i(n(31479),t),i(n(79554),t),i(n(79027),t),i(n(95218),t)},79027:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagedDecimalValue=t.ManagedDecimalType=void 0;const i=r(n(44431)),o=n(31479);class s extends o.Type{constructor(e){super("ManagedDecimal",void 0,void 0,e)}getClassName(){return s.ClassName}getMetadata(){return this.metadata}isVariable(){return"usize"==this.metadata}}t.ManagedDecimalType=s,s.ClassName="ManagedDecimalType";class a extends o.TypedValue{constructor(e,t,n=!1){super(new s(n?"usize":t)),this.value=new i.default(e),this.scale=t,this.variable=n}getClassName(){return a.ClassName}getScale(){return this.scale}getPrecision(){return this.value.toFixed(this.scale).replace(".","").length}equals(e){return this.getPrecision()==e.getPrecision()&&new i.default(this.value).eq(e.value)}valueOf(){return this.value}toString(){return this.value.toFixed(this.scale)}isVariable(){return this.variable}}t.ManagedDecimalValue=a,a.ClassName="ManagedDecimalValue"},95218:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagedDecimalSignedValue=t.ManagedDecimalSignedType=void 0;const i=r(n(44431)),o=n(31479);class s extends o.Type{constructor(e){super("ManagedDecimalSigned",void 0,void 0,e)}getClassName(){return s.ClassName}getMetadata(){return this.metadata}isVariable(){return"usize"==this.metadata}}t.ManagedDecimalSignedType=s,s.ClassName="ManagedDecimalSignedType";class a extends o.TypedValue{constructor(e,t,n=!1){super(new s(n?"usize":t)),this.value=new i.default(e),this.scale=t,this.variable=n}getClassName(){return a.ClassName}getPrecision(){return this.value.toFixed(this.scale).replace(".","").length}getScale(){return this.scale}equals(e){return this.getPrecision()==e.getPrecision()&&new i.default(this.value).eq(e.value)}valueOf(){return this.value}toString(){return this.value.toFixed(this.scale)}isVariable(){return this.variable}}t.ManagedDecimalSignedValue=a,a.ClassName="ManagedDecimalSignedValue"},30594:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.onPrimitiveTypeSelect=t.onPrimitiveValueSelect=t.onTypedValueSelect=t.onTypeSelect=void 0;const s=o(n(25145)),a=n(88740),c=n(43726),u=n(4212),l=n(93242),d=n(3913),f=n(75902),h=n(22779),p=n(69754),g=n(69511),m=n(272),b=n(38433),y=n(43802),v=n(31479),w=n(87762),x=n(67706),S=n(79027),A=n(95218);t.onTypeSelect=function(e,t){if(e.hasExactClass(f.OptionType.ClassName))return t.onOption();if(e.hasExactClass(f.ListType.ClassName))return t.onList();if(e.hasExactClass(w.ArrayVecType.ClassName))return t.onArray();if(e.hasClassOrSuperclass(v.PrimitiveType.ClassName))return t.onPrimitive();if(e.hasExactClass(m.StructType.ClassName))return t.onStruct();if(e.hasExactClass(y.TupleType.ClassName))return t.onTuple();if(e.hasExactClass(d.EnumType.ClassName))return t.onEnum();if(e.hasExactClass(S.ManagedDecimalType.ClassName))return t.onManagedDecimal();if(e.hasExactClass(A.ManagedDecimalSignedType.ClassName))return t.onManagedDecimalSigned();if(t.onOther)return t.onOther();throw new s.ErrTypingSystem(`type isn't known: ${e}`)},t.onTypedValueSelect=function(e,t){if(e.hasClassOrSuperclass(v.PrimitiveValue.ClassName))return t.onPrimitive();if(e.hasExactClass(f.OptionValue.ClassName))return t.onOption();if(e.hasExactClass(f.List.ClassName))return t.onList();if(e.hasExactClass(w.ArrayVec.ClassName))return t.onArray();if(e.hasExactClass(m.Struct.ClassName))return t.onStruct();if(e.hasExactClass(y.Tuple.ClassName))return t.onTuple();if(e.hasExactClass(d.EnumValue.ClassName))return t.onEnum();if(e.hasExactClass(S.ManagedDecimalValue.ClassName))return t.onManagedDecimal();if(e.hasExactClass(A.ManagedDecimalSignedValue.ClassName))return t.onManagedDecimalSigned();if(t.onOther)return t.onOther();throw new s.ErrTypingSystem(`value isn't typed: ${e}`)},t.onPrimitiveValueSelect=function(e,t){if(e.hasExactClass(c.BooleanValue.ClassName))return t.onBoolean();if(e.hasClassOrSuperclass(p.NumericalValue.ClassName))return t.onNumerical();if(e.hasExactClass(a.AddressValue.ClassName))return t.onAddress();if(e.hasExactClass(u.BytesValue.ClassName))return t.onBytes();if(e.hasExactClass(x.StringValue.ClassName))return t.onString();if(e.hasExactClass(h.H256Value.ClassName))return t.onH256();if(e.hasExactClass(b.TokenIdentifierValue.ClassName))return t.onTypeIdentifier();if(e.hasExactClass(l.CodeMetadataValue.ClassName))return t.onCodeMetadata();if(e.hasExactClass(g.NothingValue.ClassName))return t.onNothing();if(t.onOther)return t.onOther();throw new s.ErrTypingSystem(`value isn't a primitive: ${e.getType()}`)},t.onPrimitiveTypeSelect=function(e,t){if(e.hasExactClass(c.BooleanType.ClassName))return t.onBoolean();if(e.hasClassOrSuperclass(p.NumericalType.ClassName))return t.onNumerical();if(e.hasExactClass(a.AddressType.ClassName))return t.onAddress();if(e.hasExactClass(u.BytesType.ClassName))return t.onBytes();if(e.hasExactClass(x.StringType.ClassName))return t.onString();if(e.hasExactClass(h.H256Type.ClassName))return t.onH256();if(e.hasExactClass(b.TokenIdentifierType.ClassName))return t.onTokenIndetifier();if(e.hasExactClass(l.CodeMetadataType.ClassName))return t.onCodeMetadata();if(e.hasExactClass(g.NothingType.ClassName))return t.onNothing();if(t.onOther)return t.onOther();throw new s.ErrTypingSystem(`type isn't a known primitive: ${e}`)}},69511:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NothingValue=t.NothingType=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("nothing")}getClassName(){return i.ClassName}}t.NothingType=i,i.ClassName="NothingType";class o extends r.PrimitiveValue{constructor(){super(new i)}getClassName(){return o.ClassName}equals(e){return!1}valueOf(){return{}}}t.NothingValue=o,o.ClassName="NothingValue"},69754:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BigIntValue=t.BigUIntValue=t.I64Value=t.U64Value=t.I32Value=t.U32Value=t.I16Value=t.U16Value=t.I8Value=t.U8Value=t.NumericalValue=t.BigIntType=t.BigUIntType=t.I64Type=t.U64Type=t.I32Type=t.U32Type=t.I16Type=t.U16Type=t.I8Type=t.U8Type=t.NumericalType=void 0;const a=s(n(44431)),c=o(n(25145)),u=n(31479);class l extends u.PrimitiveType{constructor(e,t,n){super(e),this.sizeInBytes=t,this.withSign=n}getClassName(){return l.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}}t.NumericalType=l,l.ClassName="NumericalType";class d extends l{constructor(){super("u8",1,!1)}getClassName(){return d.ClassName}}t.U8Type=d,d.ClassName="U8Type";class f extends l{constructor(){super("i8",1,!0)}getClassName(){return f.ClassName}}t.I8Type=f,f.ClassName="I8Type";class h extends l{constructor(){super("u16",2,!1)}getClassName(){return h.ClassName}}t.U16Type=h,h.ClassName="U16Type";class p extends l{constructor(){super("i16",2,!0)}getClassName(){return p.ClassName}}t.I16Type=p,p.ClassName="I16Type";class g extends l{constructor(){super("u32",4,!1)}getClassName(){return g.ClassName}}t.U32Type=g,g.ClassName="U32Type";class m extends l{constructor(){super("i32",4,!0)}getClassName(){return m.ClassName}}t.I32Type=m,m.ClassName="I32Type";class b extends l{constructor(){super("u64",8,!1)}getClassName(){return b.ClassName}}t.U64Type=b,b.ClassName="U64Type";class y extends l{constructor(){super("i64",8,!0)}getClassName(){return y.ClassName}}t.I64Type=y,y.ClassName="I64Type";class v extends l{constructor(){super("BigUint",0,!1)}getClassName(){return v.ClassName}}t.BigUIntType=v,v.ClassName="BigUIntType";class w extends l{constructor(){super("Bigint",0,!0)}getClassName(){return w.ClassName}}t.BigIntType=w,w.ClassName="BigIntType";class x extends u.PrimitiveValue{constructor(e,t){if(super(e),"bigint"===typeof t&&(t=t.toString()),this.value=new a.default(t),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new c.ErrInvalidArgument(`not a number: ${t}`);if(!this.withSign&&this.value.isNegative())throw new c.ErrInvalidArgument(`negative, but type is unsigned: ${t}`)}getClassName(){return x.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}}t.NumericalValue=x,x.ClassName="NumericalValue";class S extends x{constructor(e){super(new d,e)}getClassName(){return S.ClassName}}t.U8Value=S,S.ClassName="U8Value";class A extends x{constructor(e){super(new f,e)}getClassName(){return A.ClassName}}t.I8Value=A,A.ClassName="I8Value";class E extends x{constructor(e){super(new h,e)}getClassName(){return E.ClassName}}t.U16Value=E,E.ClassName="U16Value";class _ extends x{constructor(e){super(new p,e)}getClassName(){return _.ClassName}}t.I16Value=_,_.ClassName="I16Value";class C extends x{constructor(e){super(new g,e)}getClassName(){return C.ClassName}}t.U32Value=C,C.ClassName="U32Value";class I extends x{constructor(e){super(new m,e)}getClassName(){return I.ClassName}}t.I32Value=I,I.ClassName="I32Value";class k extends x{constructor(e){super(new b,e)}getClassName(){return k.ClassName}}t.U64Value=k,k.ClassName="U64Value";class T extends x{constructor(e){super(new y,e)}getClassName(){return T.ClassName}}t.I64Value=T,T.ClassName="I64Value";class M extends x{constructor(e){super(new v,e)}getClassName(){return M.ClassName}}t.BigUIntValue=M,M.ClassName="BigUIntValue";class P extends x{constructor(e){super(new w,e)}getClassName(){return P.ClassName}}t.BigIntValue=P,P.ClassName="BigIntValue"},67706:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.StringValue=t.StringType=void 0;const i=n(31479);class o extends i.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return o.ClassName}}t.StringType=o,o.ClassName="StringType";class s extends i.PrimitiveValue{constructor(e){super(new o),this.value=e}getClassName(){return s.ClassName}static fromUTF8(e){return new s(e)}static fromHex(e){let t=r.from(e,"hex").toString();return new s(t)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}}t.StringValue=s,s.ClassName="StringValue"},272:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Struct=t.StructType=void 0;const r=n(25145),i=n(43149),o=n(31479);class s extends o.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return s.ClassName}static fromJSON(e){let t=(e.fields||[]).map((e=>i.FieldDefinition.fromJSON(e)));return new s(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find((t=>t.name==e))}getNamesOfDependencies(){return i.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}}t.StructType=s,s.ClassName="StructType";class a extends o.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map((e=>[e.name,e]))),this.checkTyping()}getClassName(){return a.ClassName}checkTyping(){let e=this.getType().getFieldsDefinitions();i.Fields.checkTyping(this.fields,e)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new r.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(const t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),n=e.getFields();return i.Fields.equals(t,n)}}t.Struct=a,a.ClassName="Struct"},38433:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenIdentifierValue=t.TokenIdentifierType=void 0;const r=n(31479);class i extends r.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return i.ClassName}}t.TokenIdentifierType=i,i.ClassName="TokenIdentifierType";class o extends r.PrimitiveValue{constructor(e){super(new i),this.value=e}static egld(){return new o("EGLD")}static esdtTokenIdentifier(e){return new o(e)}getClassName(){return o.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()==e.getLength()&&this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}}t.TokenIdentifierValue=o,o.ClassName="TokenIdentifierValue"},43802:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Tuple=t.TupleType=void 0;const s=o(n(25145)),a=n(43149),c=n(272);class u extends c.StructType{constructor(...e){super(u.prepareName(e),u.prepareFieldDefinitions(e))}getClassName(){return u.ClassName}static prepareName(e){return`tuple<${e.map((e=>e.toString())).join(", ")}>`}static prepareFieldDefinitions(e){return e.map(((e,t)=>new a.FieldDefinition(l(t),"anonymous tuple field",e)))}}function l(e){return`field${e}`}t.TupleType=u,u.ClassName="TupleType";class d extends c.Struct{constructor(e,t){super(e,t)}getClassName(){return d.ClassName}static fromItems(e){if(e.length<1)throw new s.ErrTypingSystem("bad tuple items");let t=e.map((e=>e.getType())),n=new u(...t),r=e.map(((e,t)=>new a.Field(e,l(t))));return new d(n,r)}}t.Tuple=d,d.ClassName="Tuple"},65955:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeExpressionParser=void 0;const r=n(71154),i=n(25145),o=n(31479);t.TypeExpressionParser=class{constructor(){this.backingTypeFormulaParser=new r.TypeFormulaParser}parse(e){try{return this.doParse(e)}catch(t){throw new i.ErrTypingSystem(`Failed to parse type expression: ${e}. Error: ${t}`)}}doParse(e){const t=this.backingTypeFormulaParser.parseExpression(e);return this.typeFormulaToType(t)}typeFormulaToType(e){const t=e.typeParameters.map((e=>this.typeFormulaToType(e)));return new o.Type(e.name,t,void 0,e.metadata)}}},52725:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TypeMapper=void 0;const s=o(n(25145)),a=n(88740),c=n(79967),u=n(43726),l=n(4212),d=n(93242),f=n(46522),h=n(3913),p=n(43149),g=n(75902),m=n(87762),b=n(22779),y=n(79027),v=n(95218),w=n(69511),x=n(69754),S=n(67706),A=n(272),E=n(38433),_=n(43802),C=n(79554);t.TypeMapper=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...e)=>new g.OptionType(e[0])],["List",(...e)=>new g.ListType(e[0])],["VarArgs",(...e)=>new C.VariadicType(e[0])],["MultiResultVec",(...e)=>new C.VariadicType(e[0])],["variadic",(...e)=>new C.VariadicType(e[0])],["counted-variadic",(...e)=>new C.VariadicType(e[0],!0)],["OptionalArg",(...e)=>new c.OptionalType(e[0])],["optional",(...e)=>new c.OptionalType(e[0])],["OptionalResult",(...e)=>new c.OptionalType(e[0])],["multi",(...e)=>new f.CompositeType(...e)],["MultiArg",(...e)=>new f.CompositeType(...e)],["MultiResult",(...e)=>new f.CompositeType(...e)],["multi",(...e)=>new f.CompositeType(...e)],["tuple",(...e)=>new _.TupleType(...e)],["tuple2",(...e)=>new _.TupleType(...e)],["tuple3",(...e)=>new _.TupleType(...e)],["tuple4",(...e)=>new _.TupleType(...e)],["tuple5",(...e)=>new _.TupleType(...e)],["tuple6",(...e)=>new _.TupleType(...e)],["tuple7",(...e)=>new _.TupleType(...e)],["tuple8",(...e)=>new _.TupleType(...e)],["array2",(...e)=>new m.ArrayVecType(2,e[0])],["array8",(...e)=>new m.ArrayVecType(8,e[0])],["array16",(...e)=>new m.ArrayVecType(16,e[0])],["array20",(...e)=>new m.ArrayVecType(20,e[0])],["array32",(...e)=>new m.ArrayVecType(32,e[0])],["array46",(...e)=>new m.ArrayVecType(46,e[0])],["array48",(...e)=>new m.ArrayVecType(48,e[0])],["array64",(...e)=>new m.ArrayVecType(64,e[0])],["array128",(...e)=>new m.ArrayVecType(128,e[0])],["array256",(...e)=>new m.ArrayVecType(256,e[0])],["ManagedDecimal",(...e)=>new y.ManagedDecimalType(e)],["ManagedDecimalSigned",(...e)=>new v.ManagedDecimalSignedType(e)]]),this.closedTypesMap=new Map([["u8",new x.U8Type],["u16",new x.U16Type],["u32",new x.U32Type],["u64",new x.U64Type],["U64",new x.U64Type],["BigUint",new x.BigUIntType],["i8",new x.I8Type],["i16",new x.I16Type],["i32",new x.I32Type],["i64",new x.I64Type],["Bigint",new x.BigIntType],["BigInt",new x.BigIntType],["bool",new u.BooleanType],["bytes",new l.BytesType],["Address",new a.AddressType],["H256",new b.H256Type],["utf-8 string",new S.StringType],["TokenIdentifier",new E.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new E.TokenIdentifierType],["CodeMetadata",new d.CodeMetadataType],["nothing",new w.NothingType],["AsyncCall",new w.NothingType]]),this.learnedTypesMap=new Map;for(const t of e)"ManagedDecimal"===t.getName()||"ManagedDecimalSigned"===t.getName()?this.learnedTypesMap.set(`${t.getName()}_${t.getMetadata()}`,t):this.learnedTypesMap.set(t.getName(),t)}mapType(e){let t=this.mapTypeRecursively(e);if(t)return t.isGenericType()||this.learnType(t),t;throw new s.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let t=e.isGenericType(),n=e.hasMetadata(),r=this.learnedTypesMap.get(e.getName());if(r)return r;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(h.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(A.StructType.ClassName)?this.mapStructType(e):t||n?this.mapGenericType(e):null)}learnType(e){if("ManagedDecimal"===e.getName()||"ManagedDecimalSigned"===e.getName()){const t=`${e.getName()}_${e.getMetadata()}`;this.learnedTypesMap.delete(t),this.learnedTypesMap.set(t,e)}else{const t=e.getName();this.learnedTypesMap.delete(t),this.learnedTypesMap.set(t,e)}}mapStructType(e){let t=this.mappedFields(e.getFieldsDefinitions());return new A.StructType(e.getName(),t)}mapEnumType(e){let t=e.variants.map((e=>new h.EnumVariantDefinition(e.name,e.discriminant,this.mappedFields(e.getFieldsDefinitions()))));return new h.EnumType(e.getName(),t)}mappedFields(e){return e.map((e=>new p.FieldDefinition(e.name,e.description,this.mapType(e.type))))}mapGenericType(e){let t=e.getTypeParameters().map((e=>this.mapType(e))),n=this.openTypesFactories.get(e.getName());if(!n)throw new s.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return e.hasMetadata()?n(e.getMetadata()):n(...t)}}},31479:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NullType=t.TypePlaceholder=t.isTyped=t.PrimitiveValue=t.TypedValue=t.CustomType=t.PrimitiveType=t.TypeCardinality=t.Type=void 0;const r=n(4317),i=n(44425);class o{constructor(e,t=[],n=s.fixed(1),r){i.guardValueIsSet("name",e),this.name=e,this.typeParameters=t,this.cardinality=n,this.metadata=r}getName(){return this.name}getClassName(){return o.ClassName}getClassHierarchy(){return r.getJavascriptPrototypesInHierarchy(this,(e=>e.belongsToTypesystem)).map((e=>e.getClassName())).reverse()}getFullyQualifiedName(){return this.isGenericType()||this.hasMetadata()?this.getFullNameForGeneric():`multiversx:types:${this.getName()}`}getFullNameForGeneric(){const e=this.getTypeParameters().length>0,t=e?`${this.getTypeParameters().map((e=>e.getFullyQualifiedName())).join(", ")}`:"";let n=`multiversx:types:${this.getName()}`;return e&&(n=`${n}<${t}>`),void 0!==this.metadata&&(n=`${n}*${this.metadata}*`),n}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}getMetadata(){return this.metadata}isGenericType(){return this.typeParameters.length>0}hasMetadata(){return!!this.metadata}getFirstTypeParameter(){return i.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map((e=>e.toString())).join(", "),t=e?`<${e}>`:"";return`${this.name}${t}`}equals(e){return o.equals(this,e)}static equals(e,t){return e.getFullyQualifiedName()==t.getFullyQualifiedName()}static equalsMany(e,t){return e.every(((e,n)=>e.equals(t[n])))}static isAssignableFromMany(e,t){return e.every(((e,n)=>e.isAssignableFrom(t[n])))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!o.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let t=this.getFullyQualifiedName();return!!o.getFullyQualifiedNamesInHierarchy(e).includes(t)||e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return r.getJavascriptPrototypesInHierarchy(e,(e=>e.belongsToTypesystem)).map((t=>t.getFullyQualifiedName.call(e)))}getNamesOfDependencies(){const e=[];for(const t of this.typeParameters)e.push(t.getName()),e.push(...t.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map((e=>e.toJSON()))}}getCardinality(){return this.cardinality}belongsToTypesystem(){}}t.Type=o,o.ClassName="Type";class s{constructor(e,t){this.lowerBound=e,this.upperBound=t}static fixed(e){return new s(e,e)}static variable(e){return new s(0,e)}isSingular(){return 1==this.lowerBound&&1==this.upperBound}isSingularOrNone(){return 0==this.lowerBound&&1==this.upperBound}isComposite(){return 1!=this.upperBound}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||s.MaxCardinality}}t.TypeCardinality=s,s.MaxCardinality=4096;class a extends o{constructor(e){super(e)}getClassName(){return a.ClassName}}t.PrimitiveType=a,a.ClassName="PrimitiveType";class c extends o{getClassName(){return c.ClassName}}t.CustomType=c,c.ClassName="CustomType";class u{constructor(e){this.type=e}getClassName(){return u.ClassName}getClassHierarchy(){return r.getJavascriptPrototypesInHierarchy(this,(e=>e.belongsToTypesystem)).map((e=>e.getClassName())).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}}t.TypedValue=u,u.ClassName="TypedValue";class l extends u{constructor(e){super(e)}getClassName(){return l.ClassName}}t.PrimitiveValue=l,l.ClassName="PrimitiveValue",t.isTyped=function(e){return void 0!==e.belongsToTypesystem};class d extends o{constructor(){super("...")}getClassName(){return d.ClassName}}t.TypePlaceholder=d,d.ClassName="TypePlaceholder";class f extends o{constructor(){super("?")}getClassName(){return f.ClassName}}t.NullType=f,f.ClassName="NullType"},79554:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VariadicValue=t.CountedVariadicType=t.VariadicType=void 0;const r=n(31479);class i extends r.Type{constructor(e,t=!1){super("Variadic",[e],r.TypeCardinality.variable()),this.isCounted=t}getClassName(){return i.ClassName}}t.VariadicType=i,i.ClassName="VariadicType";class o extends r.Type{constructor(e){super("Variadic",[e],r.TypeCardinality.variable())}getClassName(){return i.ClassName}}t.CountedVariadicType=o,o.ClassName="VariadicType";class s extends r.TypedValue{constructor(e,t){super(e),this.items=t}getClassName(){return s.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,t){if(0==e.length)return new s(new i(new r.TypePlaceholder,t),[]);const n=e[0].getType();return new s(new i(n,t),e)}getItems(){return this.items}valueOf(){return this.items.map((e=>e.valueOf()))}equals(e){if(this.getType().differs(e.getType()))return!1;for(let t=0;te.valueOf().toString()))}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTSetRole");return{userAddress:t.address.toString(),tokenIdentifier:this.extractTokenIdentifier(t),roles:t.topics.slice(3).map((e=>e.valueOf().toString()))}}parseNFTCreate(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTNFTCreate");return{tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),initialQuantity:this.extractAmount(t)}}parseLocalMint(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTLocalMint");return{userAddress:t.address.toString(),tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),mintedSupply:this.extractAmount(t)}}parseLocalBurn(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTLocalBurn");return{userAddress:t.address.toString(),tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),burntSupply:this.extractAmount(t)}}parsePause(e){this.ensureNoError(e);this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(t),r=this.extractNonce(t),i=this.extractAmount(t);return{userAddress:this.extractAddress(t),tokenIdentifier:n,nonce:r,balance:i}}parseUnfreeze(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(t),r=this.extractNonce(t),i=this.extractAmount(t);return{userAddress:this.extractAddress(t),tokenIdentifier:n,nonce:r,balance:i}}parseWipe(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(t),r=this.extractNonce(t),i=this.extractAmount(t);return{userAddress:this.extractAddress(t),tokenIdentifier:n,nonce:r,balance:i}}parseUpdateAttributes(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),n=this.extractTokenIdentifier(t),r=this.extractNonce(t),i=t.topics[3]?.valueOf();return{tokenIdentifier:n,nonce:r,attributes:i}}parseAddQuantity(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity");return{tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),addedQuantity:this.extractAmount(t)}}parseBurnQuantity(e){this.ensureNoError(e);const t=this.findSingleEventByIdentifier(e,"ESDTNFTBurn");return{tokenIdentifier:this.extractTokenIdentifier(t),nonce:this.extractNonce(t),burntQuantity:this.extractAmount(t)}}ensureNoError(e){for(const t of e.logs.events)if("signalError"==t.identifier){const n=r.from(t.data.substring(1),"hex").toString(),i=t.topics[1]?.valueOf().toString();throw new o.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${i} (${n})`)}}findSingleEventByIdentifier(e,t){const n=this.gatherAllEvents(e).filter((e=>e.identifier==t));if(0==n.length)throw new o.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${t}`);if(n.length>1)throw new o.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${t}`);return n[0]}gatherAllEvents(e){const t=[];t.push(...e.logs.events);for(const n of e.contractResults.items)t.push(...n.logs.events);return t}extractTokenIdentifier(e){return e.topics[0]?.valueOf().toString()}extractNonce(e){return s.bufferToBigInt(e.topics[1]?.valueOf()).toFixed(0)}extractAmount(e){return s.bufferToBigInt(e.topics[2]?.valueOf()).toFixed(0)}extractAddress(e){return i.Address.fromBuffer(e.topics[3]?.valueOf()).toString()}}},43927:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenPayment=t.TokenComputer=t.TokenTransfer=t.Token=void 0;const o=i(n(44431)),s=n(25145),a=n(63025),c="EGLD";o.default.set({ROUNDING_MODE:1});class u{constructor(e){this.identifier=e.identifier,this.nonce=e.nonce||0n}}t.Token=u;class l{constructor(e){if(this.isLegacyTokenTransferOptions(e)){const t=new o.default(e.amountAsBigInteger);if(!t.isInteger()||t.isNegative())throw new s.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=t,this.numDecimals=e.numDecimals||0,this.token=new u({identifier:e.tokenIdentifier,nonce:BigInt(e.nonce)}),this.amount=BigInt(this.amountAsBigInteger.toFixed(0))}else this.token=e.token,this.amount=e.amount,this.tokenIdentifier=e.token.identifier,this.nonce=Number(e.token.nonce),this.amountAsBigInteger=new o.default(this.amount.toString()),this.numDecimals=0}static newFromEgldAmount(e){const t=new u({identifier:a.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER});return new l({token:t,amount:e})}isLegacyTokenTransferOptions(e){return void 0!==e.tokenIdentifier}static egldFromAmount(e){const t=new o.default(e).shiftedBy(18).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new l({tokenIdentifier:c,nonce:0,amountAsBigInteger:e,numDecimals:18})}static fungibleFromAmount(e,t,n){const r=new o.default(t).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,r,n)}static fungibleFromBigInteger(e,t,n=0){return new l({tokenIdentifier:e,nonce:0,amountAsBigInteger:t,numDecimals:n})}static nonFungible(e,t){return new l({tokenIdentifier:e,nonce:t,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,t,n){return new l({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,t,n,r){const i=new o.default(n).shiftedBy(r).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,i,r)}static metaEsdtFromBigInteger(e,t,n,r=0){return new l({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:r})}toString(){return this.amount.toString()}valueOf(){return new o.default(this.amount.toString())}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.token.identifier==c}isFungible(){return 0n==this.token.nonce}}t.TokenTransfer=l;t.TokenComputer=class{constructor(){}isFungible(e){return 0n===e.nonce}extractNonceFromExtendedIdentifier(e){const t=e.split("-");if(this.checkIfExtendedIdentifierWasProvided(t),this.checkLengthOfRandomSequence(t[1]),2==t.length)return 0;const n=r.from(t[2],"hex");return(i=n).readUIntBE(0,i.length);var i}extractIdentifierFromExtendedIdentifier(e){const t=e.split("-");return this.checkIfExtendedIdentifierWasProvided(t),this.ensureTokenTickerValidity(t[0]),this.checkLengthOfRandomSequence(t[1]),t[0]+"-"+t[1]}checkIfExtendedIdentifierWasProvided(e){if(e.length<2||e.length>3)throw new s.ErrInvalidTokenIdentifier("Invalid extended token identifier provided")}checkLengthOfRandomSequence(e){if(6!==e.length)throw new s.ErrInvalidTokenIdentifier("The identifier is not valid. The random sequence does not have the right length")}ensureTokenTickerValidity(e){if(e.length<3||e.length>10)throw new s.ErrInvalidTokenIdentifier("The token ticker should be between 3 and 10 characters");if(!e.match(/^[a-zA-Z0-9]+$/))throw new s.ErrInvalidTokenIdentifier("The token ticker should only contain alphanumeric characters");if(e!=e.toUpperCase())throw new s.ErrInvalidTokenIdentifier("The token ticker should be upper case")}};t.TokenPayment=class extends l{constructor(e,t,n,r){super({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:r})}}},66679:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionHash=t.Transaction=void 0;const i=n(44431),o=n(36946),s=n(63025),a=n(10545),c=n(93827),u=n(43186),l=n(40188),d=n(94712),f=n(86030);t.Transaction=class{constructor(e){this.nonce=BigInt(e.nonce?.valueOf()||0n),this.value=e.value?BigInt(new i.BigNumber(e.value.toString()).toFixed(0)):0n,this.sender=this.addressAsBech32(e.sender),this.receiver=this.addressAsBech32(e.receiver),this.senderUsername=e.senderUsername||"",this.receiverUsername=e.receiverUsername||"",this.gasPrice=BigInt(e.gasPrice?.valueOf()||s.TRANSACTION_MIN_GAS_PRICE),this.gasLimit=BigInt(e.gasLimit.valueOf()),this.data=e.data?.valueOf()||new Uint8Array,this.chainID=e.chainID.valueOf(),this.version=Number(e.version?.valueOf()||s.TRANSACTION_VERSION_DEFAULT),this.options=Number(e.options?.valueOf()||s.TRANSACTION_OPTIONS_DEFAULT),this.guardian=e.guardian?this.addressAsBech32(e.guardian):"",this.signature=e.signature||r.from([]),this.guardianSignature=e.guardianSignature||r.from([]),this.relayer=e.relayer||"",this.innerTransactions=e.innerTransactions||[]}addressAsBech32(e){return"string"===typeof e?e:e.bech32()}getNonce(){return Number(this.nonce)}setNonce(e){this.nonce=BigInt(e.valueOf())}getValue(){return this.value}setValue(e){this.value=BigInt(e.toString())}getSender(){return o.Address.fromBech32(this.sender)}setSender(e){this.sender="string"===typeof e?e:e.bech32()}getReceiver(){return o.Address.fromBech32(this.receiver)}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return new o.Address(this.guardian)}getGasPrice(){return Number(this.gasPrice)}setGasPrice(e){this.gasPrice=BigInt(e.valueOf())}getGasLimit(){return Number(this.gasLimit)}setGasLimit(e){this.gasLimit=BigInt(e.valueOf())}getData(){return new d.TransactionPayload(r.from(this.data))}getChainID(){return this.chainID}setChainID(e){this.chainID=e.valueOf()}getVersion(){return new u.TransactionVersion(this.version)}setVersion(e){this.version=e.valueOf()}getOptions(){return new u.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=e.valueOf()}getSignature(){return r.from(this.signature)}getGuardianSignature(){return r.from(this.guardianSignature)}setGuardian(e){this.guardian="string"===typeof e?e:e.bech32()}getHash(){return h.compute(this)}serializeForSigning(){const e=(new f.TransactionComputer).computeBytesForSigning(this);return r.from(e)}isGuardedTransaction(){const e=this.guardian.length>0,t=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&t}toPlainObject(){return(new a.TransactionsConverter).transactionToPlainObject(this)}static fromPlainObject(e){return(new a.TransactionsConverter).plainObjectToTransaction(e)}applySignature(e){this.signature=l.interpretSignatureAsBuffer(e)}applyGuardianSignature(e){this.guardianSignature=l.interpretSignatureAsBuffer(e)}toSendable(){return this.toPlainObject()}computeFee(e){const t=(new f.TransactionComputer).computeTransactionFee(this,e);return new i.BigNumber(t.toString())}};class h extends c.Hash{constructor(e){super(e)}static compute(e){const t=(new f.TransactionComputer).computeTransactionHash(e);return new h(r.from(t).toString("hex"))}}t.TransactionHash=h},86030:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionComputer=void 0;const c=a(n(44431)),u=n(63025),l=s(n(25145)),d=n(87748),f=n(66679),h=n(17462),p=n(95811);t.TransactionComputer=class{constructor(){}computeTransactionFee(e,t){const n=BigInt(t.MinGasLimit+e.data.length*t.GasPerDataByte);if(n>e.gasLimit)throw new l.ErrNotEnoughGas(parseInt(e.gasLimit.toString(),10));const r=e.gasPrice,i=n*r;if(n===e.gasLimit)return i;return i+(e.gasLimit-n)*BigInt(new c.default(r.toString()).multipliedBy(new c.default(t.GasPriceModifier)).toFixed(0))}computeBytesForSigning(e){this.ensureValidTransactionFields(e);const t=this.toPlainObject(e),n=JSON.stringify(t);return new Uint8Array(r.from(n))}computeBytesForVerifying(e){return this.hasOptionsSetForHashSigning(e)?this.computeHashForSigning(e):this.computeBytesForSigning(e)}computeHashForSigning(e){const t=this.toPlainObject(e),n=r.from(JSON.stringify(t));return p("keccak256").update(n).digest()}computeTransactionHash(e){const t=(new d.ProtoSerializer).serializeTransaction(new f.Transaction(e)),n=h(32).update(t).digest("hex");return r.from(n,"hex")}hasOptionsSetForGuardedTransaction(e){return(e.options&u.TRANSACTION_OPTIONS_TX_GUARDED)==u.TRANSACTION_OPTIONS_TX_GUARDED}hasOptionsSetForHashSigning(e){return(e.options&u.TRANSACTION_OPTIONS_TX_HASH_SIGN)==u.TRANSACTION_OPTIONS_TX_HASH_SIGN}applyGuardian(e,t){e.versionthis.toPlainObject(e,!0))):void 0,n}toHexOrUndefined(e){return e&&e.length?r.from(e).toString("hex"):void 0}toBase64OrUndefined(e){return e&&e.length?r.from(e).toString("base64"):void 0}ensureValidTransactionFields(e){if(!e.chainID.length)throw new l.ErrBadUsage("The `chainID` field is not set");if(e.version= ${u.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS}`)}}},94712:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionPayload=void 0;class i{constructor(e){this.data=r.from(e||[])}static fromEncoded(e){if(!e)return new i("");let t=r.from(e,"base64").toString();return new i(t)}isEmpty(){return 0==this.data.length}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map((e=>r.from(e,"hex")))}length(){return r.from(this.data).length}}t.TransactionPayload=i},9465:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionWatcher=void 0;const r=n(70449),i=n(63025),o=n(25145),s=n(1853);class a{constructor(e,t={}){this.fetcher=new c(e),this.pollingIntervalMilliseconds=t.pollingIntervalMilliseconds||a.DefaultPollingInterval,this.timeoutMilliseconds=t.timeoutMilliseconds||a.DefaultTimeout,this.patienceMilliseconds=t.patienceMilliseconds||a.DefaultPatience}async awaitPending(e){return this.awaitConditionally((e=>e.status.isPending()),(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionStatusNotReached))}async awaitCompleted(e){return this.awaitConditionally((e=>{if(void 0===e.isCompleted)throw new o.ErrIsCompletedFieldIsMissingOnTransaction;return e.isCompleted}),(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionStatusNotReached))}async awaitAllEvents(e,t){return this.awaitConditionally((e=>{const n=this.getAllTransactionEvents(e).map((e=>e.identifier));return t.every((e=>n.includes(e)))}),(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionEventsNotFound))}async awaitAnyEvent(e,t){return this.awaitConditionally((e=>{const n=this.getAllTransactionEvents(e).map((e=>e.identifier));return void 0!=t.find((e=>n.includes(e)))}),(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionEventsNotFound))}async awaitOnCondition(e,t){return this.awaitConditionally(t,(async()=>{const t=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(t)}),(()=>new o.ErrExpectedTransactionStatusNotReached))}transactionOrTxHashToTxHash(e){const t="string"===typeof e?e:e.getHash().hex();if(t.length!==i.HEX_TRANSACTION_HASH_LENGTH)throw new o.Err(`Invalid transaction hash length. The length of a hex encoded hash should be ${i.HEX_TRANSACTION_HASH_LENGTH}.`);return t}async awaitConditionally(e,t,n){const i=new r.AsyncTimer("watcher:periodic"),a=new r.AsyncTimer("watcher:patience"),c=new r.AsyncTimer("watcher:timeout");let u,l=!1,d=!1;for(c.start(this.timeoutMilliseconds).finally((()=>{c.stop(),l=!0}));!l;){await i.start(this.pollingIntervalMilliseconds);try{if(u=await t(),d=e(u),d||l)break}catch(f){if(s.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof o.ErrIsCompletedFieldIsMissingOnTransaction)throw f;if(!(f instanceof o.Err))throw f}}if(d&&await a.start(this.patienceMilliseconds),c.isStopped()||c.stop(),!u||!d)throw n();return u}getAllTransactionEvents(e){const t=[...e.logs.events];for(const n of e.contractResults.items)t.push(...n.logs.events);return t}}t.TransactionWatcher=a,a.DefaultPollingInterval=6e3,a.DefaultTimeout=15*a.DefaultPollingInterval,a.DefaultPatience=0,a.NoopOnStatusReceived=e=>{};class c{constructor(e){this.fetcher=e}async getTransaction(e){return s.Logger.debug(`transactionWatcher, getTransaction(${e})`),await this.fetcher.getTransaction(e)}}},69043:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.AccountTransactionsFactory=void 0;const i=n(36946),o=n(87926);t.AccountTransactionsFactory=class{constructor(e){this.config=e.config}createTransactionForSavingKeyValue(e){const t=["SaveKeyValue",...this.computeDataPartsForSavingKeyValue(e.keyValuePairs)],n=this.computeExtraGasForSavingKeyValue(e.keyValuePairs);return new o.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:n,addDataMovementGas:!0}).build()}computeExtraGasForSavingKeyValue(e){let t=0n;return e.forEach(((e,n)=>{t+=this.config.gasLimitPersistPerByte*BigInt(n.length+e.length)+this.config.gasLimitStorePerByte*BigInt(e.length)})),t+this.config.gasLimitSaveKeyValue}computeDataPartsForSavingKeyValue(e){const t=[];return e.forEach(((e,n)=>{t.push(r.from(n).toString("hex"),r.from(e).toString("hex"))})),t}createTransactionForSettingGuardian(e){const t=["SetGuardian",i.Address.fromBech32(e.guardianAddress.bech32()).toHex(),r.from(e.serviceID).toString("hex")];return new o.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitSetGuardian,addDataMovementGas:!0}).build()}createTransactionForGuardingAccount(e){return new o.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:["GuardAccount"],gasLimit:this.config.gasLimitGuardAccount,addDataMovementGas:!0}).build()}createTransactionForUnguardingAccount(e){return new o.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:["UnGuardAccount"],gasLimit:this.config.gasLimitUnguardAccount,addDataMovementGas:!0}).build()}}},85149:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationTransactionsFactory=void 0;const i=n(36946),o=n(63025),s=n(25145),a=n(47480),c=n(87926);t.DelegationTransactionsFactory=class{constructor(e){this.config=e.config,this.argSerializer=new a.ArgSerializer,this.delegationManagerAddress=i.Address.fromHex(o.DELEGATION_MANAGER_SC_ADDRESS_HEX,this.config.addressHrp)}createTransactionForNewDelegationContract(e){const t=["createNewDelegationContract",...this.argSerializer.valuesToStrings([new a.BigUIntValue(e.totalDelegationCap),new a.BigUIntValue(e.serviceFee)])],n=this.config.gasLimitCreateDelegationContract+this.config.additionalGasLimitForDelegationOperations;return new c.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.delegationManagerAddress,dataParts:t,gasLimit:n,addDataMovementGas:!0,amount:e.amount}).build()}createTransactionForAddingNodes(e){if(e.publicKeys.length!==e.signedMessages.length)throw new s.Err("The number of public keys should match the number of signed messages");const t=e.signedMessages.map((e=>new a.BytesValue(r.from(e)))),n=this.argSerializer.valuesToStrings(t),i=e.publicKeys.length,o=["addNodes"];for(let r=0;r1&&(s=this.dataArgsBuilder.buildDataPartsForMultiESDTNFTTransfer(o,n),o=e.sender);s.push(s.length?d.utf8ToHex(e.function):e.function);const a=this.abi?.getEndpoint(e.function),c=this.argsToDataParts(t,a);return s.push(...c),new h.TransactionBuilder({config:this.config,sender:e.sender,receiver:o,dataParts:s,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}createTransactionForUpgrade(e){const t=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,r=e.isReadable??!0,i=e.isPayable??!1,o=e.isPayableBySmartContract??!0,s=e.arguments||[],c=new a.CodeMetadata(n,r,i,o),u=["upgradeContract",d.byteArrayToHex(e.bytecode),c.toString()],l=this.getEndpointForUpgrade(),f=this.argsToDataParts(s,l);return u.push(...f),new h.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:u,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:t}).build()}getEndpointForUpgrade(){if(this.abi){if(this.abi.upgradeConstructorDefinition)return this.abi.upgradeConstructorDefinition;try{return this.abi.getEndpoint("upgrade")}catch(e){return s.Logger.warn("In the ABI, cannot find the 'upgrade' endpoint definition. Will use the constructor definition (fallback)."),this.abi.constructorDefinition}}}createTransactionForClaimingDeveloperRewards(e){return new h.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:["ClaimDeveloperRewards"],gasLimit:this.config.gasLimitClaimDeveloperRewards,addDataMovementGas:!1}).build()}createTransactionForChangingOwnerAddress(e){const t=["ChangeOwnerAddress",r.Address.fromBech32(e.newOwner.bech32()).toHex()];return new h.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:t,gasLimit:this.config.gasLimitChangeOwnerAddress,addDataMovementGas:!1}).build()}argsToDataParts(e,t){if(t){const n=c.NativeSerializer.nativeToTypedValues(e,t);return(new a.ArgSerializer).valuesToStrings(n)}if(this.areArgsOfTypedValue(e))return(new a.ArgSerializer).valuesToStrings(e);throw new o.Err("Can't convert args to TypedValues")}areArgsOfTypedValue(e){return e.every((e=>u.isTyped(e)))}}},11158:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenManagementTransactionsFactory=void 0;const i=n(36946),o=n(63025),s=n(25145),a=n(1853),c=n(47480),u=n(87926);t.TokenManagementTransactionsFactory=class{constructor(e){this.config=e.config,this.argSerializer=new c.ArgSerializer,this.trueAsString="true",this.falseAsString="false",this.esdtContractAddress=i.Address.fromHex(o.ESDT_CONTRACT_ADDRESS_HEX,this.config.addressHrp)}createTransactionForIssuingFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=[new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.BigUIntValue(e.initialSupply),new c.BigUIntValue(e.numDecimals),new c.StringValue("canFreeze"),new c.StringValue(this.boolToString(e.canFreeze)),new c.StringValue("canWipe"),new c.StringValue(this.boolToString(e.canWipe)),new c.StringValue("canPause"),new c.StringValue(this.boolToString(e.canPause)),new c.StringValue("canChangeOwner"),new c.StringValue(this.boolToString(e.canChangeOwner)),new c.StringValue("canUpgrade"),new c.StringValue(this.boolToString(e.canUpgrade)),new c.StringValue("canAddSpecialRoles"),new c.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issue",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=[new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue("canFreeze"),new c.StringValue(this.boolToString(e.canFreeze)),new c.StringValue("canWipe"),new c.StringValue(this.boolToString(e.canWipe)),new c.StringValue("canPause"),new c.StringValue(this.boolToString(e.canPause)),new c.StringValue("canTransferNFTCreateRole"),new c.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new c.StringValue("canChangeOwner"),new c.StringValue(this.boolToString(e.canChangeOwner)),new c.StringValue("canUpgrade"),new c.StringValue(this.boolToString(e.canUpgrade)),new c.StringValue("canAddSpecialRoles"),new c.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueSemiFungible",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=[new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue("canFreeze"),new c.StringValue(this.boolToString(e.canFreeze)),new c.StringValue("canWipe"),new c.StringValue(this.boolToString(e.canWipe)),new c.StringValue("canPause"),new c.StringValue(this.boolToString(e.canPause)),new c.StringValue("canTransferNFTCreateRole"),new c.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new c.StringValue("canChangeOwner"),new c.StringValue(this.boolToString(e.canChangeOwner)),new c.StringValue("canUpgrade"),new c.StringValue(this.boolToString(e.canUpgrade)),new c.StringValue("canAddSpecialRoles"),new c.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueNonFungible",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=[new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.BigUIntValue(e.numDecimals),new c.StringValue("canFreeze"),new c.StringValue(this.boolToString(e.canFreeze)),new c.StringValue("canWipe"),new c.StringValue(this.boolToString(e.canWipe)),new c.StringValue("canPause"),new c.StringValue(this.boolToString(e.canPause)),new c.StringValue("canTransferNFTCreateRole"),new c.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new c.StringValue("canChangeOwner"),new c.StringValue(this.boolToString(e.canChangeOwner)),new c.StringValue("canUpgrade"),new c.StringValue(this.boolToString(e.canUpgrade)),new c.StringValue("canAddSpecialRoles"),new c.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["registerMetaESDT",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringAndSettingRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();const t=["registerAndSetAllRoles",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue(e.tokenType),new c.BigUIntValue(e.numDecimals)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForSettingBurnRoleGlobally(e){const t=["setBurnRoleGlobally",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForUnsettingBurnRoleGlobally(e){const t=["unsetBurnRoleGlobally",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnFungibleToken(e){const t=[new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)];e.addRoleLocalMint&&t.push(new c.StringValue("ESDTRoleLocalMint")),e.addRoleLocalBurn&&t.push(new c.StringValue("ESDTRoleLocalBurn")),e.addRoleESDTTransferRole&&t.push(new c.StringValue("ESDTTransferRole"));const n=["setSpecialRole",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnSemiFungibleToken(e){const t=[new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)];e.addRoleNFTCreate&&t.push(new c.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&t.push(new c.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTAddQuantity&&t.push(new c.StringValue("ESDTRoleNFTAddQuantity")),e.addRoleESDTTransferRole&&t.push(new c.StringValue("ESDTTransferRole")),e.addRoleESDTModifyCreator&&t.push(new c.StringValue("ESDTRoleModifyCreator"));const n=["setSpecialRole",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnMetaESDT(e){return this.createTransactionForSettingSpecialRoleOnSemiFungibleToken(e)}createTransactionForSettingSpecialRoleOnNonFungibleToken(e){const t=[new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)];e.addRoleNFTCreate&&t.push(new c.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&t.push(new c.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTUpdateAttributes&&t.push(new c.StringValue("ESDTRoleNFTUpdateAttributes")),e.addRoleNFTAddURI&&t.push(new c.StringValue("ESDTRoleNFTAddURI")),e.addRoleESDTTransferRole&&t.push(new c.StringValue("ESDTTransferRole")),e.addRoleESDTModifyCreator&&t.push(new c.StringValue("ESDTRoleModifyCreator")),e.addRoleNFTRecreate&&t.push(new c.StringValue("ESDTRoleNFTRecreate")),e.addRoleESDTSetNewURI&&t.push(new c.StringValue("ESDTRoleSetNewURI")),e.addRoleESDTModifyRoyalties&&t.push(new c.StringValue("ESDTRoleModifyRoyalties"));const n=["setSpecialRole",...this.argSerializer.valuesToStrings(t)];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForCreatingNFT(e){const t=["ESDTNFTCreate",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.initialQuantity),new c.StringValue(e.name),new c.BigUIntValue(e.royalties),new c.StringValue(e.hash),new c.BytesValue(r.from(e.attributes)),...e.uris.map((e=>new c.StringValue(e)))])],n=e.name+e.hash+e.attributes+e.uris.join(""),i=this.config.gasLimitStorePerByte+BigInt(n.length);return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtNftCreate+i,addDataMovementGas:!0}).build()}createTransactionForPausing(e){const t=["pause",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForUnpausing(e){const t=["unPause",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForFreezing(e){const t=["freeze",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForUnfreezing(e){const t=["UnFreeze",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForWiping(e){const t=["wipe",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.AddressValue(e.user)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitWiping,addDataMovementGas:!0}).build()}createTransactionForLocalMint(e){const t=["ESDTLocalMint",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.supplyToMint)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtLocalMint,addDataMovementGas:!0}).build()}createTransactionForLocalBurning(e){const t=["ESDTLocalBurn",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.supplyToBurn)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtLocalBurn,addDataMovementGas:!0}).build()}createTransactionForUpdatingAttributes(e){const t=["ESDTNFTUpdateAttributes",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),new c.BytesValue(r.from(e.attributes))])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtNftUpdateAttributes,addDataMovementGas:!0}).build()}createTransactionForAddingQuantity(e){const t=["ESDTNFTAddQuantity",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),new c.BigUIntValue(e.quantityToAdd)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtNftAddQuantity,addDataMovementGas:!0}).build()}createTransactionForBurningQuantity(e){const t=["ESDTNFTBurn",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),new c.BigUIntValue(e.quantityToBurn)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtNftBurn,addDataMovementGas:!0}).build()}createTransactionForModifyingRoyalties(e){const t=["ESDTModifyRoyalties",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),new c.BigUIntValue(e.newRoyalties)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtModifyRoyalties,addDataMovementGas:!0}).build()}createTransactionForSettingNewUris(e){if(!e.newUris.length)throw new s.ErrBadUsage("No URIs provided");const t=["ESDTSetNewURIs",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),...e.newUris.map((e=>new c.StringValue(e)))])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitSetNewUris,addDataMovementGas:!0}).build()}createTransactionForModifyingCreator(e){const t=["ESDTModifyCreator",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtModifyCreator,addDataMovementGas:!0}).build()}createTransactionForUpdatingMetadata(e){const t=["ESDTMetaDataUpdate",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),...e.newTokenName?[new c.StringValue(e.newTokenName)]:[],...e.newRoyalties?[new c.BigUIntValue(e.newRoyalties)]:[],...e.newHash?[new c.StringValue(e.newHash)]:[],...e.newAttributes?[new c.BytesValue(r.from(e.newAttributes))]:[],...e.newUris?e.newUris.map((e=>new c.StringValue(e))):[]])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitEsdtMetadataUpdate,addDataMovementGas:!0}).build()}createTransactionForMetadataRecreate(e){const t=["ESDTMetaDataRecreate",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier),new c.BigUIntValue(e.tokenNonce),...e.newTokenName?[new c.StringValue(e.newTokenName)]:[],...e.newRoyalties?[new c.BigUIntValue(e.newRoyalties)]:[],...e.newHash?[new c.StringValue(e.newHash)]:[],...e.newAttributes?[new c.BytesValue(r.from(e.newAttributes))]:[],...e.newUris?e.newUris.map((e=>new c.StringValue(e))):[]])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:t,gasLimit:this.config.gasLimitNftMetadataRecreate,addDataMovementGas:!0}).build()}createTransactionForChangingTokenToDynamic(e){const t=["changeToDynamic",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitNftChangeToDynamic,addDataMovementGas:!0}).build()}createTransactionForUpdatingTokenId(e){const t=["updateTokenID",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenIdentifier)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitUpdateTokenId,addDataMovementGas:!0}).build()}createTransactionForRegisteringDynamicToken(e){const t=["registerDynamic",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue(e.tokenType)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitRegisterDynamic,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringDynamicAndSettingRoles(e){const t=["registerAndSetAllRolesDynamic",...this.argSerializer.valuesToStrings([new c.StringValue(e.tokenName),new c.StringValue(e.tokenTicker),new c.StringValue(e.tokenType)])];return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:t,gasLimit:this.config.gasLimitRegisterDynamic,addDataMovementGas:!0,amount:this.config.issueCost}).build()}notifyAboutUnsettingBurnRoleGlobally(){a.Logger.info('\n==========\nIMPORTANT!\n==========\nYou are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally).\nOnce the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).')}boolToString(e){return e?this.trueAsString:this.falseAsString}}},95312:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenTransfersDataBuilder=void 0;const r=n(14558),i=n(6058),o=n(43927);t.TokenTransfersDataBuilder=class{constructor(){this.tokenComputer=new o.TokenComputer,this.argsSerializer=new r.ArgSerializer}buildDataPartsForESDTTransfer(e){return["ESDTTransfer",...this.argsSerializer.valuesToStrings([new i.TokenIdentifierValue(e.token.identifier),new i.BigUIntValue(e.amount)])]}buildDataPartsForSingleESDTNFTTransfer(e,t){const n=e.token,r=this.tokenComputer.extractIdentifierFromExtendedIdentifier(n.identifier);return["ESDTNFTTransfer",...this.argsSerializer.valuesToStrings([new i.TokenIdentifierValue(r),new i.BigUIntValue(n.nonce),new i.BigUIntValue(e.amount),new i.AddressValue(t)])]}buildDataPartsForMultiESDTNFTTransfer(e,t){const n=[new i.AddressValue(e),new i.U32Value(t.length)];for(const r of t){const e=this.tokenComputer.extractIdentifierFromExtendedIdentifier(r.token.identifier);n.push(new i.TokenIdentifierValue(e),new i.BigUIntValue(r.token.nonce),new i.BigUIntValue(r.amount))}return["MultiESDTNFTTransfer",...this.argsSerializer.valuesToStrings(n)]}}},87926:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionBuilder=void 0;const r=n(63025),i=n(66679),o=n(94712);t.TransactionBuilder=class{constructor(e){this.config=e.config,this.sender=e.sender,this.receiver=e.receiver,this.dataParts=e.dataParts,this.providedGasLimit=e.gasLimit,this.addDataMovementGas=e.addDataMovementGas,this.amount=e.amount}computeGasLimit(e){if(!this.addDataMovementGas)return this.providedGasLimit;return this.config.minGasLimit+this.config.gasLimitPerByte*BigInt(e.length())+this.providedGasLimit}buildTransactionPayload(){const e=this.dataParts.join(r.ARGUMENTS_SEPARATOR);return new o.TransactionPayload(e)}build(){const e=this.buildTransactionPayload(),t=this.computeGasLimit(e);return new i.Transaction({sender:this.sender.bech32(),receiver:this.receiver.bech32(),gasLimit:t,value:this.amount||0n,data:e.valueOf(),chainID:this.config.chainID})}}},70556:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionsFactoryConfig=void 0;const r=n(71289);t.TransactionsFactoryConfig=class{constructor(e){this.chainID=e.chainID,this.addressHrp=r.LibraryConfig.DefaultAddressHrp,this.minGasLimit=50000n,this.gasLimitPerByte=1500n,this.gasLimitIssue=60000000n,this.gasLimitToggleBurnRoleGlobally=60000000n,this.gasLimitEsdtLocalMint=300000n,this.gasLimitEsdtLocalBurn=300000n,this.gasLimitSetSpecialRole=60000000n,this.gasLimitPausing=60000000n,this.gasLimitFreezing=60000000n,this.gasLimitWiping=60000000n,this.gasLimitEsdtNftCreate=3000000n,this.gasLimitEsdtNftUpdateAttributes=1000000n,this.gasLimitEsdtNftAddQuantity=1000000n,this.gasLimitEsdtNftBurn=1000000n,this.gasLimitStorePerByte=10000n,this.issueCost=50000000000000000n,this.gasLimitEsdtModifyRoyalties=60000000n,this.gasLimitEsdtModifyCreator=60000000n,this.gasLimitEsdtMetadataUpdate=60000000n,this.gasLimitSetNewUris=60000000n,this.gasLimitNftMetadataRecreate=60000000n,this.gasLimitNftChangeToDynamic=60000000n,this.gasLimitUpdateTokenId=60000000n,this.gasLimitRegisterDynamic=60000000n,this.gasLimitStake=5000000n,this.gasLimitUnstake=5000000n,this.gasLimitUnbond=5000000n,this.gasLimitCreateDelegationContract=50000000n,this.gasLimitDelegationOperations=1000000n,this.additionalGasLimitPerValidatorNode=6000000n,this.additionalGasLimitForDelegationOperations=10000000n,this.gasLimitSaveKeyValue=100000n,this.gasLimitPersistPerByte=1000n,this.gasLimitSetGuardian=250000n,this.gasLimitGuardAccount=250000n,this.gasLimitUnguardAccount=250000n,this.gasLimitESDTTransfer=200000n,this.gasLimitESDTNFTTransfer=200000n,this.gasLimitMultiESDTNFTTransfer=200000n,this.gasLimitClaimDeveloperRewards=6000000n,this.gasLimitChangeOwnerAddress=6000000n}}},159:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransferTransactionsFactory=void 0;const r=n(25145),i=n(47480),o=n(43927),s=n(66679),a=n(94712),c=n(95312),u=n(87926),l=8e5;t.TransferTransactionsFactory=class{constructor(e){this.isGasEstimator(e)?this.gasEstimator=e:(this.config=e.config,this.tokenComputer=new o.TokenComputer,this.tokenTransfersDataBuilder=new c.TokenTransfersDataBuilder)}isGasEstimator(e){return"object"===typeof e&&"function"===typeof e.forEGLDTransfer&&"function"===typeof e.forESDTTransfer&&"function"===typeof e.forESDTNFTTransfer&&"function"===typeof e.forMultiESDTNFTTransfer}isGasEstimatorDefined(){return void 0!==this.gasEstimator}ensureConfigIsDefined(){if(void 0===this.config)throw new r.Err("'config' is not defined")}createTransactionForNativeTokenTransfer(e){this.ensureConfigIsDefined();const t=e.data||new Uint8Array;return new s.Transaction({sender:e.sender.bech32(),receiver:e.receiver.bech32(),chainID:this.config.chainID,gasLimit:this.computeGasForMoveBalance(this.config,t),data:t,value:e.nativeAmount})}createTransactionForESDTTokenTransfer(e){this.ensureConfigIsDefined();const t=e.tokenTransfers.length;if(0===t)throw new r.ErrBadUsage("No token transfer has been provided");if(1===t)return this.createSingleESDTTransferTransaction(e);const n=this.tokenTransfersDataBuilder.buildDataPartsForMultiESDTNFTTransfer(e.receiver,e.tokenTransfers),i=this.config.gasLimitMultiESDTNFTTransfer*BigInt(t)+BigInt(l);return new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:n,gasLimit:i,addDataMovementGas:!0}).build()}createTransactionForTransfer(e){const t=e.nativeAmount??0n;let n=e.tokenTransfers?[...e.tokenTransfers]:[];const i=n.length;if(i&&e.data?.length)throw new r.ErrBadUsage("Can't set data field when sending esdt tokens");if(t&&0===i||e.data)return this.createTransactionForNativeTokenTransfer({sender:e.sender,receiver:e.receiver,nativeAmount:t,data:e.data});const s=t?o.TokenTransfer.newFromEgldAmount(t):void 0;return s&&n.push(s),this.createTransactionForESDTTokenTransfer({sender:e.sender,receiver:e.receiver,tokenTransfers:n})}createEGLDTransfer(e){if(!this.isGasEstimatorDefined())throw new r.Err("You are calling a legacy function to create an EGLD transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForNativeTokenTransfer` method.");const t=e.data?.length()||0,n=this.gasEstimator.forEGLDTransfer(t);return new s.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||n,data:e.data,chainID:e.chainID})}createESDTTransfer(e){if(!this.isGasEstimatorDefined())throw new r.Err("You are calling a legacy function to create an ESDT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");const{argumentsString:t}=(new i.ArgSerializer).valuesToString([i.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new i.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${t}`,o=new a.TransactionPayload(n),c=o.length()||0,u=this.gasEstimator.forESDTTransfer(c);return new s.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||u,data:o,chainID:e.chainID})}createESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new r.Err("You are calling a legacy function to create an ESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");const{argumentsString:t}=(new i.ArgSerializer).valuesToString([i.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new i.U64Value(e.tokenTransfer.nonce),new i.BigUIntValue(e.tokenTransfer.valueOf()),new i.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${t}`,o=new a.TransactionPayload(n),c=o.length()||0,u=this.gasEstimator.forESDTNFTTransfer(c);return new s.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||u,data:o,chainID:e.chainID})}createMultiESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new r.Err("You are calling a legacy function to create a MultiESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");const t=[new i.AddressValue(e.destination),new i.U16Value(e.tokenTransfers.length)];for(const r of e.tokenTransfers)t.push(i.BytesValue.fromUTF8(r.tokenIdentifier),new i.U64Value(r.nonce),new i.BigUIntValue(r.valueOf()));const{argumentsString:n}=(new i.ArgSerializer).valuesToString(t),o=`MultiESDTNFTTransfer@${n}`,c=new a.TransactionPayload(o),u=c.length()||0,l=this.gasEstimator.forMultiESDTNFTTransfer(u,e.tokenTransfers.length);return new s.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||l,data:c,chainID:e.chainID})}createSingleESDTTransferTransaction(e){this.ensureConfigIsDefined();let t=[];const n=e.tokenTransfers[0];let r=0n,i=e.receiver;return this.tokenComputer.isFungible(n.token)?(t=this.tokenTransfersDataBuilder.buildDataPartsForESDTTransfer(n),r=this.config.gasLimitESDTTransfer+BigInt(1e5)):(t=this.tokenTransfersDataBuilder.buildDataPartsForSingleESDTNFTTransfer(n,i),r=this.config.gasLimitESDTNFTTransfer+BigInt(l),i=e.sender),new u.TransactionBuilder({config:this.config,sender:e.sender,receiver:i,dataParts:t,gasLimit:r,addDataMovementGas:!0}).build()}computeGasForMoveBalance(e,t){return e.minGasLimit+e.gasLimitPerByte*BigInt(t.length)}}},38917:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationTransactionsOutcomeParser=void 0;const i=n(36946),o=n(10545),s=n(25145),a=n(73416);t.DelegationTransactionsOutcomeParser=class{constructor(){}parseCreateNewDelegationContract(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return a.findEventsByIdentifier(e,"SCDeploy").map((e=>({contractAddress:this.extractContractAddress(e)})))}ensureTransactionOutcome(e){return"hash"in e?(new o.TransactionsConverter).transactionOnNetworkToOutcome(e):e}ensureNoError(e){for(const t of e)if("signalError"==t.identifier){const e=r.from(t.dataItems[0]?.toString().slice(1)).toString()||"",n=this.decodeTopicAsString(t.topics[1]);throw new s.ErrParseTransactionOutcome(`encountered signalError: ${n} (${r.from(e,"hex").toString()})`)}}extractContractAddress(e){if(!e.topics[0]?.length)return"";const t=r.from(e.topics[0]);return i.Address.fromBuffer(t).bech32()}decodeTopicAsString(e){return r.from(e).toString()}}},15360:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(38917),t),i(n(73416),t),i(n(92067),t),i(n(20517),t),i(n(64886),t)},73416:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gatherAllEvents=t.findEventsByFirstTopic=t.findEventsByIdentifier=t.findEventsByPredicate=t.SmartContractCallOutcome=t.TransactionOutcome=t.SmartContractResult=t.TransactionLogs=t.TransactionEvent=void 0;t.TransactionEvent=class{constructor(e){this.address="",this.identifier="",this.topics=[],this.dataItems=[],Object.assign(this,e)}};class n{constructor(e){this.address="",this.events=[],Object.assign(this,e)}}t.TransactionLogs=n;t.SmartContractResult=class{constructor(e){this.sender="",this.receiver="",this.data=new Uint8Array,this.logs=new n({}),Object.assign(this,e)}};t.TransactionOutcome=class{constructor(e){this.directSmartContractCallOutcome=new r({}),this.smartContractResults=[],this.logs=new n({}),Object.assign(this,e)}};class r{constructor(e){this.function="",this.returnDataParts=[],this.returnMessage="",this.returnCode="",Object.assign(this,e)}}function i(e,t){return o(e).filter(t)}function o(e){const t=[];t.push(...e.logs.events);for(const n of e.smartContractResults)t.push(...n.logs.events);return t}t.SmartContractCallOutcome=r,t.findEventsByPredicate=i,t.findEventsByIdentifier=function(e,t){return i(e,(e=>e.identifier==t))},t.findEventsByFirstTopic=function(e,t){return i(e,(e=>e.topics[0]?.toString()==t))},t.gatherAllEvents=o},92067:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.SmartContractTransactionsOutcomeParser=void 0;const i=n(36946),o=n(63025),s=n(25145),a=n(47480),c=n(73416);var u;!function(e){e.SCDeploy="SCDeploy",e.SignalError="signalError",e.WriteLog="writeLog"}(u||(u={}));t.SmartContractTransactionsOutcomeParser=class{constructor(e){this.abi=e?.abi,this.legacyResultsParser=e?.legacyResultsParser||new a.ResultsParser}parseDeploy(e){return"transactionOutcome"in e?this.parseDeployGivenTransactionOutcome(e.transactionOutcome):this.parseDeployGivenTransactionOnNetwork(e.transactionOnNetwork)}parseDeployGivenTransactionOutcome(e){const t=e.directSmartContractCallOutcome,n=c.findEventsByIdentifier(e,u.SCDeploy).map((e=>this.parseScDeployEvent(e)));return{returnCode:t.returnCode,returnMessage:t.returnMessage,contracts:n}}parseDeployGivenTransactionOnNetwork(e){const t=this.findDirectSmartContractCallOutcome(e),n=e.logs.events.concat(e.contractResults.items.flatMap((e=>e.logs.events))).filter((e=>e.identifier===u.SCDeploy)).map((e=>this.parseScDeployEvent({topics:e.topics.map((e=>r.from(e.hex(),"hex")))})));return{returnCode:t.returnCode,returnMessage:t.returnMessage,contracts:n}}parseScDeployEvent(e){const t=e.topics[0],n=e.topics[1],r=e.topics[2];return{address:t?.length?new i.Address(t).toBech32():"",ownerAddress:n?.length?new i.Address(n).toBech32():"",codeHash:r}}parseExecute(e){return"transactionOutcome"in e?this.parseExecuteGivenTransactionOutcome(e.transactionOutcome,e.function):this.parseExecuteGivenTransactionOnNetwork(e.transactionOnNetwork,e.function)}parseExecuteGivenTransactionOutcome(e,t){const n=e.directSmartContractCallOutcome;if(!this.abi)return{values:n.returnDataParts,returnCode:n.returnCode,returnMessage:n.returnMessage};if(!(t=t||n.function))throw new s.Err('Function name is not available in the transaction outcome, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');const i=this.abi.getEndpoint(t),o={returnCode:new a.ReturnCode(n.returnCode),returnMessage:n.returnMessage,values:n.returnDataParts.map((e=>r.from(e)))},c=this.legacyResultsParser.parseOutcomeFromUntypedBundle(o,i);return{values:c.values.map((e=>e.valueOf())),returnCode:c.returnCode.toString(),returnMessage:c.returnMessage}}parseExecuteGivenTransactionOnNetwork(e,t){const n=this.findDirectSmartContractCallOutcome(e);if(!this.abi)return{values:n.returnDataParts,returnCode:n.returnCode,returnMessage:n.returnMessage};if(!(t=t||n.function))throw new s.Err('Function name is not available in the transaction, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');const i=new a.ArgSerializer,o=this.abi.getEndpoint(t),c=n.returnDataParts.map((e=>r.from(e))),u=i.buffersToValues(c,o.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:u}}findDirectSmartContractCallOutcome(e){let t=this.findDirectSmartContractCallOutcomeWithinSmartContractResults(e);return t||(t=this.findDirectSmartContractCallOutcomeIfError(e),t||(t=this.findDirectSmartContractCallOutcomeWithinWriteLogEvents(e),t||new c.SmartContractCallOutcome({function:e.function,returnCode:"",returnMessage:"",returnDataParts:[]})))}findDirectSmartContractCallOutcomeWithinSmartContractResults(e){const t=new a.ArgSerializer,n=[];for(const a of e.contractResults.items){const t=a.data.startsWith(o.ARGUMENTS_SEPARATOR),r=a.receiver.bech32()===e.sender.bech32(),i=a.previousHash===e.hash;t&&r&&i&&n.push(a)}if(0===n.length)return null;if(n.length>1)throw new Error(`More than one smart contract result (holding the return data) found for transaction: ${e.hash}`);const[r]=n,[i,s,...u]=t.stringToBuffers(r.data);return new c.SmartContractCallOutcome({function:e.function,returnCode:s?.toString(),returnMessage:r.returnMessage||s?.toString(),returnDataParts:u})}findDirectSmartContractCallOutcomeIfError(e){const t=new a.ArgSerializer,n=u.SignalError,r=[];r.push(...e.logs.events.filter((e=>e.identifier===n)));for(const a of e.contractResults.items)a.previousHash==e.hash&&r.push(...a.logs.events.filter((e=>e.identifier===n)));if(0===r.length)return null;if(r.length>1)throw new Error(`More than one "${n}" event found for transaction: ${e.hash}`);const[i]=r,o=i.dataPayload?.valueOf().toString()||"",s=i.getLastTopic()?.toString(),l=t.stringToBuffers(o),d=l[l.length-1];return new c.SmartContractCallOutcome({function:e.function,returnCode:d?.toString()||n,returnMessage:s||d?.toString()||n,returnDataParts:[]})}findDirectSmartContractCallOutcomeWithinWriteLogEvents(e){const t=new a.ArgSerializer,n=u.WriteLog,r=[];r.push(...e.logs.events.filter((e=>e.identifier===n)));for(const a of e.contractResults.items)a.previousHash==e.hash&&r.push(...a.logs.events.filter((e=>e.identifier===n)));if(0===r.length)return null;if(r.length>1)throw new Error(`More than one "${n}" event found for transaction: ${e.hash}`);const[i]=r,o=i.dataPayload?.valueOf().toString()||"",[s,l,...d]=t.stringToBuffers(o);return new c.SmartContractCallOutcome({function:e.function,returnCode:l?.toString(),returnMessage:l?.toString(),returnDataParts:d})}}},20517:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenManagementTransactionsOutcomeParser=void 0;const i=n(36946),o=n(10545),s=n(25145),a=n(68683),c=n(73416);t.TokenManagementTransactionsOutcomeParser=class{constructor(){}parseIssueFungible(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"issue").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseIssueNonFungible(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"issueNonFungible").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseIssueSemiFungible(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"issueSemiFungible").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseRegisterMetaEsdt(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"registerMetaESDT").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseRegisterAndSetAllRoles(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);const t=c.findEventsByIdentifier(e,"registerAndSetAllRoles"),n=c.findEventsByIdentifier(e,"ESDTSetRole");if(t.length!==n.length)throw new s.ErrParseTransactionOutcome("Register Events and Set Role events mismatch. Should have the same number of events.");return t.map(((e,t)=>({tokenIdentifier:this.extractTokenIdentifier(e),roles:n[t].topics.slice(3).map((e=>this.decodeTopicAsString(e)))})))}parseSetBurnRoleGlobally(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events)}parseUnsetBurnRoleGlobally(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events)}parseSetSpecialRole(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTSetRole").map((e=>this.getOutputForSetSpecialRoleEvent(e)))}getOutputForSetSpecialRoleEvent(e){return{userAddress:e.address,tokenIdentifier:this.extractTokenIdentifier(e),roles:e.topics.slice(3).map((e=>this.decodeTopicAsString(e)))}}parseNftCreate(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTNFTCreate").map((e=>this.getOutputForNftCreateEvent(e)))}getOutputForNftCreateEvent(e){return{tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),initialQuantity:this.extractAmount(e)}}parseLocalMint(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTLocalMint").map((e=>this.getOutputForLocalMintEvent(e)))}getOutputForLocalMintEvent(e){return{userAddress:e.address,tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),mintedSupply:this.extractAmount(e)}}parseLocalBurn(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTLocalBurn").map((e=>this.getOutputForLocalBurnEvent(e)))}getOutputForLocalBurnEvent(e){return{userAddress:e.address,tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),burntSupply:this.extractAmount(e)}}parsePause(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTPause").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseUnpause(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTUnPause").map((e=>({tokenIdentifier:this.extractTokenIdentifier(e)})))}parseFreeze(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTFreeze").map((e=>this.getOutputForFreezeEvent(e)))}getOutputForFreezeEvent(e){return{userAddress:this.extractAddress(e),tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),balance:this.extractAmount(e)}}parseUnfreeze(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTUnFreeze").map((e=>this.getOutputForUnfreezeEvent(e)))}getOutputForUnfreezeEvent(e){return{userAddress:this.extractAddress(e),tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),balance:this.extractAmount(e)}}parseWipe(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTWipe").map((e=>this.getOutputForWipeEvent(e)))}getOutputForWipeEvent(e){return{userAddress:this.extractAddress(e),tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),balance:this.extractAmount(e)}}parseUpdateAttributes(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTNFTUpdateAttributes").map((e=>this.getOutputForUpdateAttributesEvent(e)))}getOutputForUpdateAttributesEvent(e){return{tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),attributes:e.topics[3]?e.topics[3]:new Uint8Array}}parseAddQuantity(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTNFTAddQuantity").map((e=>this.getOutputForAddQuantityEvent(e)))}getOutputForAddQuantityEvent(e){return{tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),addedQuantity:this.extractAmount(e)}}parseBurnQuantity(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);return c.findEventsByIdentifier(e,"ESDTNFTBurn").map((e=>this.getOutputForBurnQuantityEvent(e)))}getOutputForBurnQuantityEvent(e){return{tokenIdentifier:this.extractTokenIdentifier(e),nonce:this.extractNonce(e),burntQuantity:this.extractAmount(e)}}ensureTransactionOutcome(e){return"hash"in e?(new o.TransactionsConverter).transactionOnNetworkToOutcome(e):e}ensureNoError(e){for(const t of e)if("signalError"==t.identifier){const e=r.from(t.dataItems[0]?.toString().slice(1)).toString()||"",n=this.decodeTopicAsString(t.topics[1]);throw new s.ErrParseTransactionOutcome(`encountered signalError: ${n} (${r.from(e,"hex").toString()})`)}}extractTokenIdentifier(e){return e.topics[0]?.length?this.decodeTopicAsString(e.topics[0]):""}extractNonce(e){if(!e.topics[1]?.length)return BigInt(0);const t=r.from(e.topics[1]);return BigInt(a.bufferToBigInt(t).toFixed(0))}extractAmount(e){if(!e.topics[2]?.length)return BigInt(0);const t=r.from(e.topics[2]);return BigInt(a.bufferToBigInt(t).toFixed(0))}extractAddress(e){if(!e.topics[3]?.length)return"";const t=r.from(e.topics[3]);return i.Address.fromBuffer(t).bech32()}decodeTopicAsString(e){return r.from(e).toString()}}},64886:function(e,t,n){"use strict";var r=n(47115).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionEventsParser=void 0;const i=n(47480);t.TransactionEventsParser=class{constructor(e){this.legacyResultsParser=new i.ResultsParser,this.abi=e.abi,this.firstTopicIsIdentifier=e.firstTopicIsIdentifier??!0}parseEvents(e){const t=[];for(const n of e.events){const e=this.parseEvent({event:n});t.push(e)}return t}parseEvent(e){const t=e.event.topics.map((e=>r.from(e))),n=this.firstTopicIsIdentifier?t[0]?.toString():e.event.identifier;this.firstTopicIsIdentifier&&t.shift();const i=e.event.dataItems.map((e=>r.from(e))),o=this.abi.getEvent(n);return this.legacyResultsParser.doParseEvent({topics:t,dataItems:i,eventDefinition:o})}}},89439:function(e,t,n){"use strict";var r=n(47115).lW,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.addressToHex=t.bigIntToHex=t.byteArrayToHex=t.boolToHex=t.utf8ToHex=t.zeroPadStringIfOddLength=t.isPaddedHex=t.numberToPaddedHex=void 0;const c=a(n(44431)),u=n(36946),l=s(n(68683));function d(e){return(e=e||"").length%2==1?"0"+e:e}function f(e){return d(r.from(e).toString("hex"))}t.numberToPaddedHex=function(e){let t;return t="bigint"===typeof e||"number"===typeof e?e:new c.default(e),d(t.toString(16))},t.isPaddedHex=function(e){e=e||"";let t=r.from(e,"hex").toString("hex");return e.toUpperCase()==t.toUpperCase()},t.zeroPadStringIfOddLength=d,t.utf8ToHex=f,t.boolToHex=function(e){return f(e.toString())},t.byteArrayToHex=function(e){return d(r.from(e).toString("hex"))},t.bigIntToHex=function(e){return 0==e?"":l.getHexMagnitudeOfBigInt(e)},t.addressToHex=function(e){return u.Address.fromBech32(e.toString()).pubkey().toString("hex")}},44425:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=t.guardEmpty=t.guardNotEmpty=t.guardLength=t.guardSameLength=t.guardValueIsSetWithMessage=t.guardValueIsSet=t.guardTrue=void 0;const s=o(n(25145));function a(e,t){if(null==t||void 0===t)throw new s.ErrInvariantFailed(e)}function c(e){return e.isEmpty?e.isEmpty():0===e.length}t.guardTrue=function(e,t){if(!e)throw new s.ErrInvariantFailed(`[<${t}>] isn't true`)},t.guardValueIsSet=function(e,t){a(`${e} isn't set (null or undefined)`,t)},t.guardValueIsSetWithMessage=a,t.guardSameLength=function(e,t){if(t=t||[],(e=e||[]).length!=t.length)throw new s.ErrInvariantFailed("arrays do not have the same length")},t.guardLength=function(e,t){let n=e.length||0;if(n!=t)throw new s.ErrInvariantFailed(`wrong length, expected: ${t}, actual: ${n}`)},t.guardNotEmpty=function(e,t){if(c(e))throw new s.ErrInvariantFailed(`${t} is empty`)},t.guardEmpty=function(e,t){if(!c(e))throw new s.ErrInvariantFailed(`${t} is not empty`)},t.isEmpty=c},78654:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrAccountNotConnected=t.ErrCannotSignSingleTransaction=t.Err=void 0;class n extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}}t.Err=n;t.ErrCannotSignSingleTransaction=class extends n{constructor(){super("Cannot sign single transaction.")}};t.ErrAccountNotConnected=class extends n{constructor(){super("Account is not connected.")}}},80299:function(e,t,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionProvider=void 0;const o=n(3053),s=n(66679),a=n(78654),c=n(54803);class u{constructor(){if(this.account={address:""},this.initialized=!1,u._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");u._instance=this}static getInstance(){return u._instance}setAddress(e){return this.account.address=e,u._instance}init(){return i(this,void 0,void 0,(function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized}))}login(){return i(this,arguments,void 0,(function*(e={}){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");const{token:t}=e,n=t||"";return yield this.startBgrMsgChannel(c.Operation.Connect,n),this.account}))}logout(){return i(this,void 0,void 0,(function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(c.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0}))}disconnect(){this.account={address:""}}getAddress(){return i(this,void 0,void 0,(function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""}))}isInitialized(){return this.initialized}isConnected(){return Boolean(this.account.address)}getAccount(){return this.account}setAccount(e){this.account=e}signTransaction(e){return i(this,void 0,void 0,(function*(){this.ensureConnected();const t=yield this.signTransactions([e]);if(1!=t.length)throw new a.ErrCannotSignSingleTransaction;return t[0]}))}ensureConnected(){if(!this.account.address)throw new a.ErrAccountNotConnected}signTransactions(e){return i(this,void 0,void 0,(function*(){this.ensureConnected();const t=yield this.startBgrMsgChannel(c.Operation.SignTransactions,{from:this.account.address,transactions:e.map((e=>e.toPlainObject()))});try{return t.map((e=>s.Transaction.fromPlainObject(e)))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}}))}signMessage(e){return i(this,void 0,void 0,(function*(){var t;this.ensureConnected();const n={account:this.account.address,message:r.from(e.data).toString()},i=(yield this.startBgrMsgChannel(c.Operation.SignMessage,n)).signature,s=r.from(i,"hex");return new o.Message({data:r.from(e.data),address:null!==(t=e.address)&&void 0!==t?t:o.Address.fromBech32(this.account.address),signer:"extension",version:e.version,signature:s})}))}cancelAction(){return this.startBgrMsgChannel(c.Operation.CancelAction,{})}startBgrMsgChannel(e,t){return new Promise((n=>{window.postMessage({target:"erdw-inpage",type:e,data:t},window.origin);const r=e=>{e.isTrusted&&"erdw-contentScript"===e.data.target&&("connectResponse"===e.data.type?(e.data.data&&Boolean(e.data.data.address)&&(this.account=e.data.data),window.removeEventListener("message",r),n(e.data.data)):(window.removeEventListener("message",r),n(e.data.data)))};window.addEventListener("message",r,!1)}))}}t.ExtensionProvider=u,u._instance=new u},91571:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(80299),t)},54803:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Operation=void 0,function(e){e.Connect="connect",e.Logout="logout",e.SignTransactions="signTransactions",e.SignMessage="signMessage",e.CancelAction="cancelAction"}(n||(t.Operation=n={}))},50681:function(e,t,n){"use strict";var r=n(48764).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenTransferProperties=t.TransactionMetadataTransfer=t.TransactionMetadata=t.TransactionToDecode=t.TransactionDecoder=void 0;const i=n(3084);t.TransactionDecoder=class{getTransactionMetadata(e){const t=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(t);if(n)return n;const r=this.getNftTransferMetadata(t);if(r)return r;const i=this.getMultiTransferMetadata(t);return i||t}getNormalTransactionMetadata(e){const t=new s;if(t.sender=e.sender,t.receiver=e.receiver,t.value=BigInt(e.value),e.data){const r=this.base64Decode(e.data).split("@"),i=r.slice(1);if(i.every((e=>this.isSmartContractArgument(e)))&&(t.functionName=r[0],t.functionArgs=i),"relayedTx"===t.functionName&&t.functionArgs&&1===t.functionArgs.length)try{const e=JSON.parse(this.hexToString(t.functionArgs[0]));return e.value=e.value.toString(),e.sender=this.bech32Encode(this.base64ToHex(e.sender)),e.receiver=this.bech32Encode(this.base64ToHex(e.receiver)),this.getNormalTransactionMetadata(e)}catch(n){}if("relayedTxV2"===t.functionName&&t.functionArgs&&4===t.functionArgs.length)try{const n=new o;return n.sender=e.receiver,n.receiver=this.bech32Encode(t.functionArgs[0]),n.data=this.base64Encode(this.hexToString(t.functionArgs[2])),n.value="0",this.getNormalTransactionMetadata(n)}catch(n){}}return t}getMultiTransferMetadata(e){if(e.sender!==e.receiver)return;if("MultiESDTNFTTransfer"!==e.functionName)return;const t=e.functionArgs;if(!t)return;if(t.length<3)return;if(!this.isAddressValid(t[0]))return;const n=this.bech32Encode(t[0]),r=this.hexToNumber(t[1]),i=new s;i.transfers||(i.transfers=[]);let o=2;for(let s=0;so&&(i.functionName=this.hexToString(t[o++]),i.functionArgs=t.slice(o++)),i}getNftTransferMetadata(e){if(e.sender!==e.receiver)return;if("ESDTNFTTransfer"!==e.functionName)return;const t=e.functionArgs;if(!t)return;if(t.length<4)return;if(!this.isAddressValid(t[3]))return;const n=this.hexToString(t[0]),r=t[1],i=this.hexToBigInt(t[2]),o=this.bech32Encode(t[3]),a=new s;return a.sender=e.sender,a.receiver=o,a.value=i,t.length>4&&(a.functionName=this.hexToString(t[4]),a.functionArgs=t.slice(5)),a.transfers=[{value:i,properties:{collection:n,identifier:`${n}-${r}`}}],a}base64Encode(e){return r.from(e).toString("base64")}base64Decode(e){return r.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if("ESDTTransfer"!==e.functionName)return;const t=e.functionArgs;if(!t)return;if(t.length<2)return;const n=this.hexToString(t[0]),r=this.hexToBigInt(t[1]),i=new s;return i.sender=e.sender,i.receiver=e.receiver,t.length>2&&(i.functionName=this.hexToString(t[2]),i.functionArgs=t.slice(3)),i.transfers=[{value:r,properties:{identifier:n}}],i.value=r,i}bech32Encode(e){const t=r.from(e,"hex"),n=i.bech32.toWords(t);return i.bech32.encode("erd",n)}isAddressValid(e){return 32==r.from(e,"hex").length}isSmartContractArgument(e){return!!this.isHex(e)&&e.length%2===0}isHex(e){return!1===new RegExp(/[^a-f0-9]/gi).test(e)}base64ToHex(e){return r.from(e,"base64").toString("hex")}hexToString(e){return r.from(e,"hex").toString("ascii")}hexToBigInt(e){return e?BigInt("0x"+e):BigInt(0)}};class o{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}}t.TransactionToDecode=o;class s{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}}t.TransactionMetadata=s;t.TransactionMetadataTransfer=class{constructor(){this.value=BigInt(0)}};t.TokenTransferProperties=class{}},3084:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={};for(let d=0;d>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function o(e){let t=1;for(let n=0;n126)return"Invalid prefix ("+e+")";t=i(t)^r>>5}t=i(t);for(let n=0;n=n;)o-=n,a.push(i>>o&s);if(r)o>0&&a.push(i<=t)return"Excess padding";if(i<n)return"Exceeds length limit";const s=e.toLowerCase(),a=e.toUpperCase();if(e!==s&&e!==a)return"Mixed-case string "+e;const c=(e=s).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const u=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let d=o(u);if("string"===typeof d)return d;const f=[];for(let t=0;t=l.length||f.push(n)}return d!==t?"Invalid checksum for "+e:{prefix:u,words:f}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const n=s(e,t);if("object"===typeof n)return n},decode:function(e,t){const n=s(e,t);if("object"===typeof n)return n;throw new Error(n)},encode:function(e,r,s){if(s=s||90,e.length+7+r.length>s)throw new TypeError("Exceeds length limit");let a=o(e=e.toLowerCase());if("string"===typeof a)throw new Error(a);let c=e+"1";for(let t=0;t>5!==0)throw new Error("Non 5-bit word");a=i(a)^e,c+=n.charAt(e)}for(let t=0;t<6;++t)a=i(a);a^=t;for(let t=0;t<6;++t){c+=n.charAt(a>>5*(5-t)&31)}return c},toWords:a,fromWordsUnsafe:c,fromWords:u}}t.bech32=l("bech32"),t.bech32m=l("bech32m")},58368:function(e,t){var n="undefined"!==typeof self?self:this,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function x(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];S.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(_){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:x(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new S(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=v,e.Response=S),t.Headers=f,t.Request=v,t.Response=S,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},5586:function(e,t,n){"use strict";const r=n(79742),i=n(80645),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},47275:function(e,t){var n="undefined"!==typeof self?self:this,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function x(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];S.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(_){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:x(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new S(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=v,e.Response=S),t.Headers=f,t.Request=v,t.Response=S,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},16450:function(e,t,n){"use strict";var r=n(64836);Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"jsonrpcFromDefs",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"typesAliasFromDefs",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"typesFromDefs",{enumerable:!0,get:function(){return s.default}});var i=r(n(98544)),o=r(n(49651)),s=r(n(64540))},98544:function(e,t,n){"use strict";var r=n(64836);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){return Object.keys(e).filter((t=>{var n;return 0!==Object.keys((null===(n=e[t])||void 0===n?void 0:n.rpc)||{}).length})).forEach((n=>{t[n]={},Object.entries(e[n].rpc).forEach((([e,r])=>{const i=!!r.pubsub;t[n][e]=s(s({},r),{},{isSubscription:i,jsonrpc:`${n}_${e}`,method:e,section:n})}))})),t};var i=r(n(38416));function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t(0,i.default)({},t,e)),t)};var i=r(n(72378))},64540:function(e,t,n){"use strict";var r=n(64836);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){return Object.values(e).reduce(((e,{types:t})=>s(s({},e),t)),t)};var i=r(n(38416));function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t\n ${r.isMobile()?"":"
    \n \n\n
    \n Pera Connect\n\n v1.3.4\n
    \n
    \n "} \n\n \n \n \n
    \n`;class p extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=d,this.shadowRoot.append(f.content.cloneNode(!0),e),this.onClose()}}onClose(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-modal-header-close-button"),n=this.getAttribute("modal-id");t&&n===r.PERA_WALLET_REDIRECT_MODAL_ID&&t.addEventListener("click",(()=>{r.removeModalWrapperFromDOM(r.PERA_WALLET_REDIRECT_MODAL_ID)}))}}var g="data:image/svg+xml,%3csvg fill='none' height='80' width='80' xmlns='http://www.w3.org/2000/svg'%3e%3cpath clip-rule='evenodd' d='M39.9 80V68.99h-9.8V80h-.2V68.99h-3.5a6.503 6.503 0 0 1-6.247-4.7 6.514 6.514 0 0 1-4.445-4.444 6.503 6.503 0 0 1-4.695-6.246v-3.5H0v-.2h11.013v-9.8H0v-.2h11.013v-9.8H0v-.2h11.013v-3.5a6.503 6.503 0 0 1 4.694-6.246 6.513 6.513 0 0 1 4.447-4.447 6.503 6.503 0 0 1 6.246-4.696h3.5V0h.2v11.011h9.8V0h.2v11.011h9.8V0h.2v11.011h3.5a6.503 6.503 0 0 1 6.247 4.697 6.514 6.514 0 0 1 4.443 4.444 6.503 6.503 0 0 1 4.701 6.248v3.5H80v.2H68.991v9.8H80v.2H68.991v9.8H80v.2H68.991v3.5a6.503 6.503 0 0 1-4.701 6.248 6.514 6.514 0 0 1-4.443 4.442 6.503 6.503 0 0 1-6.247 4.7h-3.5V80h-.2V68.99h-9.8V80zm28.89-40.1a28.728 28.728 0 0 0-1.746-9.8h-2.5v9.8h4.247zm-4.246.2h4.247a28.729 28.729 0 0 1-1.747 9.8h-2.5zm-.2-.2v-9.8H60.1v9.8zm-4.244.2h4.244v9.8H60.1zm-.2-.2a19.807 19.807 0 0 0-2.633-9.8H50.1v9.8zm-9.8.2h9.8a19.807 19.807 0 0 1-2.633 9.8H50.1zm-.2-.2v-9.8h-9.8v9.8zm-9.8.2h9.8v9.8h-9.8zm-.2-.2v-9.8h-9.8v9.8zm-9.8.2h9.8v9.8h-9.8zm-.2-.2v-9.8h-7.167a19.807 19.807 0 0 0-2.633 9.8zm-9.8.2h9.8v9.8h-7.167a19.807 19.807 0 0 1-2.633-9.8zm-.2-.2v-9.8h-4.245v9.8zm-4.245.2H19.9v9.8h-4.245zm-.2-.2v-9.8H12.96a28.726 28.726 0 0 0-1.748 9.8h4.242zm-4.242.2h4.242v9.8H12.96a28.726 28.726 0 0 1-1.748-9.8zm0 13.5v-3.5h1.608a28.876 28.876 0 0 0 2.634 5.327v2.617c0 .543.066 1.07.192 1.575a6.303 6.303 0 0 1-4.434-6.019zm4.242 1.449a28.674 28.674 0 0 1-2.42-4.949h2.42zm.2.32V50.1H19.9v9.8h-.702a28.915 28.915 0 0 1-3.543-4.53zM20.1 59.9v-9.8h2.518a20.2 20.2 0 0 0 7.282 7.282V59.9zm0-10h2.403a19.966 19.966 0 0 1-2.403-7.053zm9.8 7.25a20 20 0 0 1-7.05-7.05h7.05zm.2.117V50.1h9.8v9.8a19.807 19.807 0 0 1-9.8-2.633zm10 2.633v-9.8h9.8v7.167a19.807 19.807 0 0 1-9.8 2.633zm10-2.75V50.1h7.05a20 20 0 0 1-7.05 7.05zm0 .232a20.2 20.2 0 0 0 7.282-7.282H59.9v9.8h-9.8zm7.397-7.482H59.9v-7.053a19.966 19.966 0 0 1-2.403 7.053zm2.603 10v-9.8h4.244v5.28a28.91 28.91 0 0 1-3.538 4.52zm4.444-4.841V50.1h2.426a28.67 28.67 0 0 1-2.426 4.959zm0 .378a28.881 28.881 0 0 0 2.64-5.337h1.607v3.5a6.303 6.303 0 0 1-4.44 6.021 6.514 6.514 0 0 0 .193-1.577zm2.713-5.537h1.534v-6.477a28.817 28.817 0 0 1-1.534 6.477zm-56.044 0h1.535a28.807 28.807 0 0 1-1.535-6.477zm57.578-20v-3.5a6.303 6.303 0 0 0-4.44-6.02c.126.504.193 1.031.193 1.575v2.608a28.877 28.877 0 0 1 2.639 5.337zm-1.534.2h1.534v6.477a28.815 28.815 0 0 0-1.534-6.477zm-.288-.2a28.673 28.673 0 0 0-2.425-4.958V29.9zm-2.625 0v-5.279a28.911 28.911 0 0 0-3.538-4.521H60.1v9.8zm-4.444 0v-9.8h-9.8v2.518a20.2 20.2 0 0 1 7.282 7.282zm-2.403.2H59.9v7.053a19.966 19.966 0 0 0-2.403-7.053zm-.347-.2a20 20 0 0 0-7.05-7.05v7.05zm-7.25 0v-7.167a19.807 19.807 0 0 0-9.8-2.633v9.8zm-10 0v-9.8a19.807 19.807 0 0 0-9.8 2.633V29.9zm-10 0v-7.05a20 20 0 0 0-7.05 7.05zm-7.282 0a20.2 20.2 0 0 1 7.282-7.282V20.1h-9.8v9.8zm-2.518.2h2.403a19.966 19.966 0 0 0-2.403 7.053zm-.2-.2v-9.8h-.701a28.915 28.915 0 0 0-3.544 4.53v5.27zm-4.445 0v-4.948a28.665 28.665 0 0 0-2.42 4.948zm-2.634 0a28.874 28.874 0 0 1 2.634-5.327v-2.618c0-.543.066-1.07.191-1.574a6.303 6.303 0 0 0-4.433 6.019v3.5zm-1.608.2h1.535a28.81 28.81 0 0 0-1.535 6.477zM36.58 68.79H30.1v-1.536c2.06.749 4.23 1.27 6.479 1.535zm3.321-.001a28.726 28.726 0 0 1-9.8-1.748v-2.497h9.8zm-10-1.822v-2.423h-4.953a28.678 28.678 0 0 0 4.953 2.423zm10-2.623h-9.8V60.1h9.8zm-10 0V60.1h-9.8v.702a28.915 28.915 0 0 0 4.526 3.542H29.9zm7.254-4.444H30.1v-2.403a19.966 19.966 0 0 0 7.053 2.403zm0-39.8a19.966 19.966 0 0 0-7.054 2.403V20.1h7.053zm2.746-.2h-9.8v-4.245h9.8zm-10 0v-4.245h-5.27a28.907 28.907 0 0 0-4.53 3.544v.701zm10-4.445h-9.8V12.96a28.729 28.729 0 0 1 9.8-1.749zm-10 0v-2.421a28.668 28.668 0 0 0-4.95 2.42h4.95zm6.679-4.244a28.81 28.81 0 0 0-6.479 1.536V11.21h6.479zm-6.679 1.61v-1.61h-3.5a6.303 6.303 0 0 0-6.02 4.436 6.514 6.514 0 0 1 1.575-.192h2.617A28.877 28.877 0 0 1 29.9 12.82zm0 55.968V67.18a28.878 28.878 0 0 1-5.331-2.636h-2.614c-.543 0-1.07-.067-1.575-.192a6.303 6.303 0 0 0 6.02 4.437zm20.2 0h3.5a6.303 6.303 0 0 0 6.02-4.438 6.513 6.513 0 0 1-1.576.193h-2.608a28.879 28.879 0 0 1-5.336 2.638zm-.2-1.534v1.534h-6.475a28.808 28.808 0 0 0 6.475-1.534zm.2-.287a28.671 28.671 0 0 0 4.957-2.424H50.1v2.424zm-.2-2.424v2.499a28.728 28.728 0 0 1-9.8 1.746v-4.245zm.2-.2h5.278a28.914 28.914 0 0 0 4.522-3.538V60.1h-9.8zm-.2-4.244v4.244h-9.8V60.1zm0-2.603V59.9h-7.053a19.966 19.966 0 0 0 7.053-2.403zm0-37.397v2.403a19.966 19.966 0 0 0-7.053-2.403H49.9zm.2-.2h9.8v-.705a28.911 28.911 0 0 0-4.526-3.54H50.1V19.9zm-.2-4.245V19.9h-9.8v-4.245h9.8zm.2-.2h4.954a28.676 28.676 0 0 0-4.954-2.423zm-.2-2.497v2.497h-9.8V11.21a28.75 28.75 0 0 1 9.8 1.747zm.2-.14a28.877 28.877 0 0 1 5.332 2.637h2.612c.543 0 1.071.066 1.576.192a6.303 6.303 0 0 0-6.02-4.436h-3.5zm-.2-1.607v1.534a28.812 28.812 0 0 0-6.475-1.534H49.9zm-34.245 44.53v2.303c0 .567.075 1.117.215 1.64a6.309 6.309 0 0 0 1.643.216h1.41a29.118 29.118 0 0 1-3.268-4.16zm3.458 4.359h-1.6a6.513 6.513 0 0 1-1.578-.193 6.315 6.315 0 0 0 4.157 4.157 6.517 6.517 0 0 1-.192-1.575v-1.602a29.35 29.35 0 0 1-.787-.787zm.787.509a29.029 29.029 0 0 1-.508-.509h.508zm.2.469v1.411c0 .567.075 1.117.215 1.64.523.14 1.073.215 1.64.215h2.3a29.118 29.118 0 0 1-4.155-3.266zm35.649 3.266h2.295c.567 0 1.117-.075 1.64-.216a6.286 6.286 0 0 0 .216-1.639v-1.407a29.116 29.116 0 0 1-4.151 3.262zm4.35-3.454v1.598a6.53 6.53 0 0 1-.192 1.574 6.314 6.314 0 0 0 4.155-4.154 6.509 6.509 0 0 1-1.572.191h-1.6a29.08 29.08 0 0 1-.791.791zm.982-.991h1.41c.565 0 1.114-.075 1.636-.215a6.31 6.31 0 0 0 .216-1.641V55.75a29.113 29.113 0 0 1-3.262 4.15zm3.262-35.65v-2.295c0-.568-.075-1.117-.216-1.64a6.307 6.307 0 0 0-1.637-.215h-1.41a29.112 29.112 0 0 1 3.263 4.15zM60.89 19.9h1.6c.542 0 1.069.066 1.573.192a6.314 6.314 0 0 0-4.156-4.157 6.51 6.51 0 0 1 .192 1.576v1.598c.269.259.532.522.79.791zm-.991-.981V17.51a6.31 6.31 0 0 0-.216-1.64 6.308 6.308 0 0 0-1.64-.216h-2.299a29.108 29.108 0 0 1 4.155 3.264zm-35.641-3.264h-2.304a6.31 6.31 0 0 0-1.639.215 6.306 6.306 0 0 0-.216 1.641v1.412a29.115 29.115 0 0 1 4.159-3.268zM19.9 19.113v-1.602c0-.543.067-1.072.193-1.577a6.315 6.315 0 0 0-4.159 4.16 6.518 6.518 0 0 1 1.58-.194h1.6c.257-.267.519-.53.786-.787zm-.508.787h.508v-.508c-.171.167-.34.337-.508.508zm-.47.2h-1.409a6.31 6.31 0 0 0-1.643.216 6.308 6.308 0 0 0-.215 1.639v2.305a29.107 29.107 0 0 1 3.268-4.16zm41.178-.712c.173.168.344.34.512.512H60.1zm.513 40.712c-.169.173-.34.344-.513.513V60.1z' fill='%2394a3b8' fill-rule='evenodd'/%3e%3crect fill='black' height='80' rx='16' width='80'/%3e%3cpath d='M43.47 19.752c1.24 5.14.821 9.663-.937 10.1-1.758.438-4.19-3.375-5.43-8.517-1.241-5.14-.822-9.663.936-10.1 1.759-.438 4.19 3.376 5.43 8.517zm20.49 4.42c-2.749-2.913-8.216-2.123-12.212 1.763s-5.008 9.398-2.26 12.31 8.215 2.123 12.211-1.763 5.008-9.398 2.26-12.31zM42.102 68.769c1.758-.438 2.116-5.216.8-10.673-1.318-5.456-3.81-9.525-5.57-9.088-1.757.438-2.115 5.216-.798 10.672 1.317 5.457 3.81 9.526 5.568 9.089zM24.18 26.838c5.073 1.496 8.78 4.12 8.28 5.862-.5 1.741-5.019 1.94-10.091.444-5.073-1.496-8.78-4.12-8.28-5.861.501-1.742 5.019-1.941 10.092-.445zm32.924 19.664c5.384 1.588 9.343 4.286 8.843 6.028-.5 1.741-5.27 1.866-10.654.278-5.385-1.588-9.343-4.286-8.843-6.028.5-1.741 5.27-1.866 10.654-.278zm-27.216-3.654c-1.258-1.304-5.384.594-9.215 4.24-3.832 3.644-5.919 7.656-4.66 8.96 1.257 1.304 5.383-.594 9.215-4.239s5.918-7.657 4.66-8.96z' fill='%23fe5'/%3e%3c/svg%3e",m=".pera-wallet-download-qr-code-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n margin: 26px auto 0;\n padding: 10px;\n box-shadow: 0px 20px 60px rgba(26, 35, 91, 0.15), 0px 4px 12px rgba(26, 35, 91, 0.05), 0px 1px 4px rgba(26, 35, 91, 0.06);\n border-radius: 24px;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-download-qr-code-wrapper {\n margin-top: 51px;\n }\n}";l(m);const b=document.createElement("template");b.innerHTML='\n
    \n';class y extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=m,this.shadowRoot.append(b.content.cloneNode(!0),e)}}connectedCallback(){var e;const t=new a.default({width:205,height:205,type:"svg",data:r.PERA_DOWNLOAD_URL,image:g,dotsOptions:{color:"#000",type:"extra-rounded"},imageOptions:{crossOrigin:"anonymous",margin:10},cornersSquareOptions:{type:"extra-rounded"},cornersDotOptions:{type:"dot"}}),n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-download-qr-code-wrapper");n&&t.append(n)}}var v="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8.5 19L15.5 12L8.5 5' stroke='%233C3C49' stroke-width='2'/%3e%3c/svg%3e",w=".pera-wallet-connect-modal-desktop-mode {\n display: grid;\n grid-template-columns: 205px auto;\n gap: 70px;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view {\n display: block;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item--active .pera-wallet-accordion-item__content {\n height: 364px;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-accordion-item--web-wallet {\n display: none;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-accordion-item .pera-wallet-accordion-toggle {\n padding: 26px 24px 12px;\n border-radius: 24px 24px 0 0;\n transition: all ease-in 0.2s;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-accordion-item .pera-wallet-accordion-item__content {\n height: 434px;\n border-radius: 0 0 24px 24px;\n transition: height ease-in 0.2s;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-accordion-item .pera-wallet-accordion-icon {\n transform: rotate(90deg);\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__default-view--web-wallet-not-avaliable .pera-wallet-connect-modal-desktop-mode__download-pera-description {\n margin-top: 50px;\n}\n.pera-wallet-connect-modal-desktop-mode--default .pera-wallet-connect-modal-desktop-mode__download-view {\n display: none;\n}\n.pera-wallet-connect-modal-desktop-mode--download .pera-wallet-connect-modal-desktop-mode__default-view {\n display: none;\n}\n.pera-wallet-connect-modal-desktop-mode--download .pera-wallet-connect-modal-desktop-mode__download-view {\n display: block;\n}\n.pera-wallet-connect-modal-desktop-mode--download .pera-wallet-connect-modal-desktop-mode__download-view .pera-wallet-connect-modal-download-pera-view__footer a {\n display: flex;\n cursor: pointer;\n}\n.pera-wallet-connect-modal-desktop-mode--compact {\n grid-template-columns: unset;\n gap: unset;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet {\n padding: 28px 40px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet .pera-wallet-connect-modal-desktop-mode__web-wallet__logo-wrapper {\n box-shadow: unset;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet .pera-wallet-connect-modal-desktop-mode__web-wallet__description {\n margin-bottom: 16px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet .pera-wallet-connect-modal-desktop-mode__web-wallet__launch-button {\n width: 172px;\n height: 40px;\n margin: 0 auto;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__web-wallet-iframe {\n height: 100%;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view {\n overflow: hidden;\n border-radius: 24px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item {\n margin-bottom: 0;\n border-radius: 0;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item:not(:last-child) {\n border-bottom: 1px solid #e6e8ee;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item #pera-wallet-iframe {\n height: 100%;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-toggle {\n padding: 20px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-toggle__text, .pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-toggle__content-with-label__text {\n color: #626268;\n font-size: 14px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.09px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-toggle__bold-color {\n font-weight: 600;\n color: #1a1a1a;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-accordion-item--active .pera-wallet-accordion-item__content {\n height: 265px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-modal-desktop-mode__download-pera-container {\n display: flex;\n justify-content: space-between;\n margin-top: 14px;\n padding: 0 20px;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-modal-desktop-mode__download-pera-description,\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-modal-desktop-mode__download-pera-button {\n margin: 0;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-modal-desktop-mode__download-pera-button {\n font-weight: 500;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-qr-code-wrapper {\n margin: 4px auto 0;\n padding: 0;\n box-shadow: unset;\n}\n.pera-wallet-connect-modal-desktop-mode--compact .pera-wallet-connect-modal-desktop-mode__default-view .pera-wallet-connect-qr-code-wrapper svg {\n padding: 8px;\n box-shadow: 0px 20px 60px rgba(26, 35, 91, 0.15), 0px 4px 12px rgba(26, 35, 91, 0.05), 0px 1px 4px rgba(26, 35, 91, 0.06);\n border-radius: 12px;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account {\n width: 100%;\n height: 100%;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account.pera-wallet-connect-modal-desktop-mode--default {\n overflow: hidden;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account .pera-wallet-connect-modal-desktop-mode__web-wallet-iframe {\n position: unset;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account .pera-wallet-accordion {\n overflow: hidden;\n}\n.pera-wallet-connect-modal-desktop-mode--select-account #pera-wallet-iframe {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n border-radius: 16px;\n}\n\n.pera-wallet-connect-modal-desktop-mode__accordion__description,\n.pera-wallet-connect-modal-desktop-mode__connect-button-wrapper {\n padding: 0 40px 20px 64px;\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n height: calc(100% - 88px);\n padding: 48px 52px 40px;\n margin: 0 auto;\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 72px;\n height: 72px;\n margin: 0 auto 16px;\n background: #ffffff;\n border-radius: 50%;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.1), 0px 10px 16px rgba(20, 37, 63, 0.06);\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet__description {\n margin: 0 auto 32px;\n font-size: 14px;\n line-height: 24px;\n letter-spacing: -0.1px;\n text-align: center;\n color: #6a6a81;\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet__launch-button {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n padding: 14px 0;\n color: #ffffff;\n background-color: #6b46fe;\n border-radius: 12px;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n letter-spacing: -0.1;\n border: none;\n outline: none;\n cursor: pointer;\n}\n\n.pera-wallet-connect-modal-desktop-mode__web-wallet-iframe {\n position: relative;\n width: fit-content;\n margin: 0 auto;\n}\n\n.pera-wallet-connect-modal-desktop-mode__connect-button {\n display: block;\n width: 100%;\n height: 48px;\n border: unset;\n border-radius: 6px;\n background-color: #333333;\n color: white;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 13px;\n}\n\n.pera-wallet-connect-qr-code-wrapper {\n width: fit-content;\n margin: 24px auto 0;\n padding: 10px;\n box-shadow: 0px 20px 60px rgba(26, 35, 91, 0.15), 0px 4px 12px rgba(26, 35, 91, 0.05), 0px 1px 4px rgba(26, 35, 91, 0.06);\n border-radius: 24px;\n}\n\n.pera-wallet-connect-modal-desktop-mode__download-pera-description {\n color: #838aa6;\n text-align: center;\n margin: 32px 0 12px;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n letter-spacing: -0.04px;\n}\n\n.pera-wallet-connect-modal-desktop-mode__download-pera-button {\n display: flex;\n align-items: center;\n gap: 8px;\n margin: 0 auto;\n padding: 0;\n color: #6b46fe;\n background-color: transparent;\n outline: none;\n border: none;\n font-weight: 600;\n font-size: 13px;\n line-height: 20px;\n letter-spacing: 0.01px;\n cursor: pointer;\n}\n\n.pera-wallet-connect-modal-download-pera-view__back-button {\n display: flex;\n align-items: center;\n gap: 16px;\n margin-bottom: 14px;\n padding: 12px 24px;\n color: #3c3c49;\n background-color: #ffffff;\n outline: none;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n border: unset;\n border-radius: 24px;\n font-size: 14px;\n font-weight: 600;\n line-height: 24px;\n letter-spacing: -0.1px;\n cursor: pointer;\n}\n\n.pera-wallet-connect-modal-download-pera-view {\n padding: 32px 37px 28px;\n background-color: #ffffff;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n border-radius: 24px;\n}\n\n.pera-wallet-connect-modal-download-pera-view__title {\n margin-bottom: 8px;\n color: #3c3c49;\n font-weight: 600;\n font-size: 15px;\n line-height: 18px;\n text-align: center;\n letter-spacing: -0.13px;\n}\n\n.pera-wallet-connect-modal-download-pera-view__footer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n margin-top: 53px;\n}\n\n.pera-wallet-connect-modal-download-pera-view__footer__button {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 8px 16px;\n color: #6a6a81;\n background-color: #ffffff;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n text-decoration: none;\n border-radius: 12px;\n font-weight: 500;\n font-size: 13px;\n line-height: 200%;\n letter-spacing: -0.04px;\n cursor: pointer;\n}\n\n#pera-wallet-iframe {\n width: 285px;\n height: 376px;\n margin: 0 auto;\n border: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-connect-modal-desktop-mode {\n grid-template-columns: 1fr;\n gap: 24px;\n }\n .pera-wallet-connect-qr-code-wrapper {\n margin-top: 16px;\n }\n .pera-wallet-connect-modal-download-pera-view {\n padding: 24px;\n }\n .pera-wallet-download-qr-code-wrapper {\n margin-top: 32px;\n }\n .pera-wallet-connect-modal-download-pera-view__footer {\n margin-top: 40px;\n }\n}";l(w);var x=".pera-wallet-accordion-item {\n background-color: #ffffff;\n border-radius: 24px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.02), 0px 4px 12px rgba(0, 0, 0, 0.03);\n}\n.pera-wallet-accordion-item:not(:last-of-type) {\n margin-bottom: 20px;\n}\n.pera-wallet-accordion-item:not(:last-of-type) .pera-wallet-accordion-panel {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.pera-wallet-accordion-item .pera-wallet-accordion-item__content {\n height: 0;\n overflow: hidden;\n color: #69708d;\n background-color: #ffffff;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n letter-spacing: -0.04px;\n transition: height ease-in 0.2s;\n}\n.pera-wallet-accordion-item--active .pera-wallet-accordion-toggle {\n padding: 26px 24px 12px;\n border-radius: 24px 24px 0 0;\n transition: all ease-in 0.2s;\n}\n.pera-wallet-accordion-item--active .pera-wallet-accordion-item__content {\n border-radius: 0 0 24px 24px;\n transition: height ease-in 0.2s;\n}\n.pera-wallet-accordion-item--active .pera-wallet-accordion-icon {\n transform: rotate(90deg);\n}\n\n.pera-wallet-accordion-toggle {\n position: relative;\n display: flex;\n align-items: center;\n gap: 16px;\n padding: 12px 24px;\n color: #2c3559;\n background-color: #ffffff;\n border: none;\n border-radius: 24px;\n outline: none;\n cursor: pointer;\n font-size: 16px;\n line-height: 18px;\n letter-spacing: -0.1px;\n font-weight: 600;\n transition: all ease-in 0.2s;\n}\n.pera-wallet-accordion-toggle__text, .pera-wallet-accordion-toggle__content-with-label__text {\n color: #626268;\n}\n\n.pera-wallet-accordion-icon {\n transition: all ease-in 0.2s;\n}\n\n.pera-wallet-accordion-toggle__bold-color {\n color: #1A1A1A;\n font-weight: 600;\n}\n\n.pera-wallet-accordion-toggle__content-with-label {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.pera-wallet-accordion-toggle__label {\n padding: 4px 9px;\n color: #1C786C;\n background: #E0FAEE;\n border-radius: 12px;\n font-size: 11px;\n font-weight: 600;\n line-height: 18px;\n letter-spacing: 0.01px;\n}\n\n.pera-wallet-accordion-toggle__button {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n background: transparent;\n box-shadow: none;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-accordion-toggle {\n font-size: 14px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.1px;\n }\n}";l(x);const S=document.createElement("template"),A=document.createElement("style"),E=document.createElement("style");A.textContent=w,E.textContent=x,S.innerHTML="\n
    \n \n\n
    \n \n\n
    \n \n \n\n Back\n \n\n
    \n

    \n Download Pera Wallet\n

    \n\n \n\n
    \n \n \"App\n \n\n \n \"Play\n \n\n \n \"Download\n\n Download APK File\n \n
    \n
    \n
    \n
    \n ";class _ extends HTMLElement{constructor(){var e;if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){if(this.shadowRoot.append(S.content.cloneNode(!0),A,E),this.shadowRoot.addEventListener("click",(e=>{this.handleAccordion(e)})),"true"===this.getAttribute("compact-mode")){const e=this.shadowRoot.getElementById("pera-wallet-connect-modal-desktop-mode");null==e||e.classList.add("pera-wallet-connect-modal-desktop-mode--compact")}const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".pera-wallet-connect-modal-desktop-mode__default-view"),n="true"===this.getAttribute("promote-mobile"),{webWalletOption:r,mobileWalletOption:i}=function(e){const t=`\n
    \n \n \n \n \n \n
    \n
    \n Connect With\n \n \n Pera Web\n \n
    \n \n NEW\n
    \n
    \n \n
    \n
    \n \n \n \n
    \n \n \n Connect with Pera Web to continue\n

    \n
    \n \n \n Launch Pera Web\n \n \n \n
    `,n=`\n
    \n \n \n \n \n \n
    \n Connect with\n \n \n Pera Mobile\n \n
    \n
    \n \n
    \n
    \n \n
    \n \n Don\u2019t have Pera Wallet app?\n

    \n \n \n QR Icon\n \n Download Pera Wallet\n \n
    \n
    \n
    `;return{mobileWalletOption:document.createRange().createContextualFragment(n),webWalletOption:document.createRange().createContextualFragment(t)}}(n);n?(null==t||t.appendChild(i),null==t||t.appendChild(r)):(null==t||t.appendChild(r),null==t||t.appendChild(i))}}connectedCallback(){var e;const t=this.getAttribute("should-display-new-badge"),n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-web-new-label");"false"===t&&(null==n||n.setAttribute("style","display:none")),this.handleChangeView()}handleChangeView(){var e,t,n;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-desktop-mode-download-pera-button"),i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pera-wallet-connect-modal-download-pera-view-back-button"),o=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById("pera-wallet-connect-web-wallet-launch-button");r&&r.addEventListener("click",(()=>{this.onClickDownload()})),i&&i.addEventListener("click",(()=>{this.onClickBack()})),o&&o.addEventListener("click",(()=>{this.webWalletConnect()})),this.renderQRCode(),this.checkWebWalletAvaliability()}webWalletConnect(){"true"===this.getAttribute("is-web-wallet-avaliable")&&window.onWebWalletConnect()}handleAccordion(e){var t,n;if(e.target instanceof Element){if(!e.target.classList.contains("pera-wallet-accordion-toggle__button"))return;if(this.shadowRoot&&(null===(t=e.target.parentElement)||void 0===t?void 0:t.parentElement)){const t=null===(n=e.target.parentElement)||void 0===n?void 0:n.parentElement;if(!t)return;if(t.classList.contains("pera-wallet-accordion-item--active"))return;const r=this.shadowRoot.querySelectorAll(".pera-wallet-accordion-item.pera-wallet-accordion-item--active");for(let e=0;e{this.onClickLaunch()})))}}onClickLaunch(){if(I.innerHTML=`\n
    \n \n
    \n `,this.shadowRoot){const e=document.createElement("style");e.textContent=C,this.shadowRoot.innerHTML="",this.shadowRoot.append(I.content.cloneNode(!0),e)}}}var T='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");\n.pera-wallet-modal {\n --pera-wallet-modal-font-family: "Inter", sans-serif;\n --pera-wallet-modal-compact-width: 380px;\n --pera-wallet-modal-compact-height: 396px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 999999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n}\n.pera-wallet-modal--select-account .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body {\n top: 40px;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: unset;\n height: calc(100 * var(--vh));\n padding: 20px;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);\n border-radius: 20px 20px 0px 0px;\n animation: 0.3s PeraWalletConnectMobileSlideIn ease-out;\n overflow-y: auto;\n transform: unset;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body::before {\n background-image: unset;\n}\n.pera-wallet-modal--compact:not(.pera-wallet-modal--mobile) .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n padding: 0;\n}\n.pera-wallet-modal * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-modal ul,\n.pera-wallet-modal ol,\n.pera-wallet-modal li {\n list-style-type: none;\n}\n\n.pera-wallet-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: auto;\n height: 48px;\n padding: 14px;\n border: none;\n border-radius: 12px;\n outline: none;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 14px;\n}\n\n.pera-wallet-modal__logo img {\n display: block;\n width: 32px;\n}\n\n.pera-wallet-modal__body {\n position: relative;\n top: 50%;\n left: 50%;\n width: 700px;\n max-width: calc(100vw - 80px);\n padding: 28px;\n background-color: #f3f3f7;\n box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.08);\n border-radius: 24px;\n animation: 0.3s PeraWalletConnectSlideIn ease-out;\n transform: translate(-50%, -50%);\n}\n.pera-wallet-modal__body::before {\n --background-line: #1e0972 0 1.2px, transparent 0 calc(100% - 1.2px), #1e0972;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: "";\n background-image: linear-gradient(var(--background-line)), linear-gradient(90deg, var(--background-line));\n background-size: 116px 116px;\n mix-blend-mode: overlay;\n border-radius: 24px;\n opacity: 0.8;\n pointer-events: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-modal--desktop .pera-wallet-modal__body {\n width: 100%;\n max-width: calc(100vw - 32px);\n padding: 24px;\n }\n}\n@keyframes PeraWalletConnectSlideIn {\n 0% {\n opacity: 0;\n transform: translate(-50%, calc(-50% + 24px));\n }\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n}\n@keyframes PeraWalletConnectMobileSlideIn {\n 0% {\n top: 30%;\n opacity: 0;\n }\n 100% {\n top: 40px;\n opacity: 1;\n }\n}';l(T);const M=document.createElement("template");let P=r.isMobile()?`${r.PERA_WALLET_MODAL_CLASSNAME} ${r.PERA_WALLET_MODAL_CLASSNAME}--mobile`:`${r.PERA_WALLET_MODAL_CLASSNAME} ${r.PERA_WALLET_MODAL_CLASSNAME}--desktop`;class O extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=T,"true"===this.getAttribute("compact-mode")&&(P=`${P} ${r.PERA_WALLET_MODAL_CLASSNAME}--compact`),r.isMobile()?(M.innerHTML=`\n
    \n
    \n \n \n \n
    \n
    \n `,this.shadowRoot.append(M.content.cloneNode(!0),e)):(M.innerHTML=`\n
    \n
    \n \n \n \n
    \n
    \n `,this.shadowRoot.append(M.content.cloneNode(!0),e))}}}var R='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");\n.pera-wallet-modal {\n --pera-wallet-modal-font-family: "Inter", sans-serif;\n --pera-wallet-modal-compact-width: 380px;\n --pera-wallet-modal-compact-height: 396px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 999999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n}\n.pera-wallet-modal--select-account .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body {\n top: 40px;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: unset;\n height: calc(100 * var(--vh));\n padding: 20px;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);\n border-radius: 20px 20px 0px 0px;\n animation: 0.3s PeraWalletConnectMobileSlideIn ease-out;\n overflow-y: auto;\n transform: unset;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body::before {\n background-image: unset;\n}\n.pera-wallet-modal--compact:not(.pera-wallet-modal--mobile) .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n padding: 0;\n}\n.pera-wallet-modal * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-modal ul,\n.pera-wallet-modal ol,\n.pera-wallet-modal li {\n list-style-type: none;\n}\n\n.pera-wallet-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: auto;\n height: 48px;\n padding: 14px;\n border: none;\n border-radius: 12px;\n outline: none;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 14px;\n}\n\n.pera-wallet-modal__logo img {\n display: block;\n width: 32px;\n}\n\n.pera-wallet-modal__body {\n position: relative;\n top: 50%;\n left: 50%;\n width: 700px;\n max-width: calc(100vw - 80px);\n padding: 28px;\n background-color: #f3f3f7;\n box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.08);\n border-radius: 24px;\n animation: 0.3s PeraWalletConnectSlideIn ease-out;\n transform: translate(-50%, -50%);\n}\n.pera-wallet-modal__body::before {\n --background-line: #1e0972 0 1.2px, transparent 0 calc(100% - 1.2px), #1e0972;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: "";\n background-image: linear-gradient(var(--background-line)), linear-gradient(90deg, var(--background-line));\n background-size: 116px 116px;\n mix-blend-mode: overlay;\n border-radius: 24px;\n opacity: 0.8;\n pointer-events: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-modal--desktop .pera-wallet-modal__body {\n width: 100%;\n max-width: calc(100vw - 32px);\n padding: 24px;\n }\n}\n@keyframes PeraWalletConnectSlideIn {\n 0% {\n opacity: 0;\n transform: translate(-50%, calc(-50% + 24px));\n }\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n}\n@keyframes PeraWalletConnectMobileSlideIn {\n 0% {\n top: 30%;\n opacity: 0;\n }\n 100% {\n top: 40px;\n opacity: 1;\n }\n}\n.pera-wallet-redirect-modal {\n display: grid;\n grid-template-columns: 1fr;\n gap: 56px;\n grid-template-rows: auto 48px;\n height: 100%;\n padding: 4px;\n padding-bottom: 70px;\n}\n\n.pera-wallet-redirect-modal__content {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n}\n\n.pera-wallet-redirect-modal__content__title {\n margin: 20px 0 8px;\n color: #3c3c49;\n font-size: 18px;\n font-weight: 600;\n line-height: 22px;\n letter-spacing: -0.26px;\n}\n\n.pera-wallet-redirect-modal__content__description,\n.pera-wallet-redirect-modal__content__install-pera-text {\n color: #3c3c49;\n max-width: 271px;\n font-size: 14px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -0.09px;\n text-align: center;\n}\n\n.pera-wallet-redirect-modal__content__description {\n margin-bottom: 24px;\n}\n\n.pera-wallet-redirect-modal__content__install-pera-text__link {\n color: #6b46fe;\n font-size: 14px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -0.09px;\n text-align: center;\n}\n\n.pera-wallet-redirect-modal__launch-pera-wallet-button {\n display: block;\n padding: 14px;\n color: #ffffff;\n background-color: #6b46fe;\n border-radius: 12px;\n text-decoration: none;\n text-align: center;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.09px;\n font-weight: 500;\n}';l(R);const N=document.createElement("template");N.innerHTML=`\n
    \n
    \n \n\n
    \n
    \n \n\n

    \n Can't Launch Pera\n

    \n\n

    \n We couldn't redirect you to Pera Wallet automatically. Please try again.\n

    \n\n

    \n Don't have Pera Wallet installed yet?\n
    \n \n \n Tap here to install.\n \n

    \n
    \n\n \n Launch Pera Wallet\n \n
    \n
    \n
    \n`;class B extends HTMLElement{constructor(){var e,t;if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const n=document.createElement("style");n.textContent=R,this.shadowRoot.append(N.content.cloneNode(!0),n);const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-redirect-modal-download-pera-link");null==r||r.addEventListener("click",(()=>{this.onClose()}));const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pera-wallet-redirect-modal-launch-pera-link");null==i||i.addEventListener("click",(()=>{this.onClose(),window.open(u(),"_blank")}))}}connectedCallback(){const e=window.open(u(),"_blank");e&&!e.closed&&this.onClose()}onClose(){r.removeModalWrapperFromDOM(r.PERA_WALLET_REDIRECT_MODAL_ID)}}var L="data:image/svg+xml,%3csvg width='32' height='35' viewBox='0 0 32 35' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M18.2837 5.09271C19.0234 8.12325 18.7827 10.7913 17.7463 11.0519C16.7098 11.3126 15.27 9.06712 14.5304 6.03657C13.7908 3.00603 14.0315 0.337996 15.0679 0.0773547C16.1044 -0.183287 17.5441 2.06216 18.2837 5.09271Z' fill='%233C3C49'/%3e%3cpath d='M30.376 7.66915C28.7507 5.95537 25.5271 6.42918 23.1759 8.72745C20.8247 11.0257 20.2361 14.2781 21.8614 15.9919C23.4866 17.7057 26.7102 17.2319 29.0614 14.9336C31.4127 12.6354 32.0012 9.38294 30.376 7.66915Z' fill='%233C3C49'/%3e%3cpath d='M17.5511 34.0071C18.5876 33.7465 18.7914 30.9276 18.0064 27.711C17.2214 24.4945 15.7448 22.0982 14.7084 22.3589C13.6719 22.6195 13.4681 25.4383 14.2531 28.6549C15.0381 31.8715 16.5147 34.2677 17.5511 34.0071Z' fill='%233C3C49'/%3e%3cpath d='M6.91617 9.3015C9.9105 10.1763 12.1008 11.7187 11.8083 12.7466C11.5158 13.7745 8.85126 13.8986 5.85693 13.0239C2.8626 12.1491 0.672334 10.6067 0.964835 9.57881C1.25734 8.5509 3.92184 8.42674 6.91617 9.3015Z' fill='%233C3C49'/%3e%3cpath d='M26.3656 20.8508C29.5437 21.7793 31.883 23.3652 31.5905 24.3932C31.298 25.4211 28.4845 25.5017 25.3063 24.5732C22.1282 23.6448 19.7889 22.0588 20.0814 21.0309C20.3739 20.003 23.1874 19.9224 26.3656 20.8508Z' fill='%233C3C49'/%3e%3cpath d='M10.3069 18.7365C9.56299 17.9692 7.13209 19.0948 4.87736 21.2506C2.62264 23.4064 1.39791 25.776 2.14185 26.5432C2.8858 27.3105 5.3167 26.1849 7.57143 24.0291C9.82615 21.8733 11.0509 19.5037 10.3069 18.7365Z' fill='%233C3C49'/%3e%3c/svg%3e",D=".pera-wallet-connect-modal-information-section {\n padding: 12px;\n padding-right: 0;\n}\n.pera-wallet-connect-modal-information-section--mobile {\n padding: 0;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__pera-icon {\n margin-bottom: 16px;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__connect-pera-title {\n margin-bottom: 8px;\n color: #3c3c49;\n font-size: 18px;\n font-weight: 600;\n line-height: 22px;\n letter-spacing: -0.2px;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__title {\n margin-bottom: 24px;\n color: #3c3c49;\n font-size: 14px;\n line-height: 24px;\n letter-spacing: -0.09px;\n font-weight: 400;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__features-item__icon-wrapper {\n background-color: #f2f3f8;\n}\n.pera-wallet-connect-modal-information-section--mobile .pera-wallet-connect-modal-information-section__features-item__description {\n color: #6a6a81;\n}\n.pera-wallet-connect-modal-information-section * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.pera-wallet-connect-modal-information-section__pera-icon {\n margin-bottom: 32px;\n}\n\n.pera-wallet-connect-modal-information-section__title {\n margin-bottom: 148px;\n color: #3c3c49;\n font-size: 20px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.5px;\n}\n\n.pera-wallet-connect-modal-information-section__secondary-title {\n margin-bottom: 20px;\n color: #9d9dae;\n font-size: 11px;\n font-weight: 600;\n line-height: 18px;\n letter-spacing: 0.06px;\n text-transform: uppercase;\n}\n\n.pera-wallet-connect-modal-information-section__features-item {\n display: grid;\n align-items: center;\n grid-template-columns: 36px auto;\n gap: 16px;\n}\n.pera-wallet-connect-modal-information-section__features-item:not(:last-of-type) {\n margin-bottom: 24px;\n}\n\n.pera-wallet-connect-modal-information-section__features-item__icon-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n background-color: #ffffff;\n border-radius: 50%;\n}\n\n.pera-wallet-connect-modal-information-section__features-item__description {\n color: #6a6a81;\n font-size: 12px;\n font-weight: 500;\n line-height: 18px;\n letter-spacing: 0.01px;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-connect-modal-information-section--desktop {\n padding: 0;\n }\n .pera-wallet-connect-modal-information-section--desktop .pera-wallet-connect-modal-information-section__pera-icon {\n margin-bottom: 12px;\n }\n .pera-wallet-connect-modal-information-section--desktop .pera-wallet-connect-modal-information-section__title {\n margin-bottom: 24px;\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.26px;\n }\n .pera-wallet-connect-modal-information-section--desktop .pera-wallet-connect-modal-information-section__features-item {\n display: none;\n }\n .pera-wallet-connect-modal-information-section__secondary-title {\n display: none;\n }\n}";l(D);const U=document.createElement("template"),j=r.isMobile()?"pera-wallet-connect-modal-information-section pera-wallet-connect-modal-information-section--mobile":"pera-wallet-connect-modal-information-section pera-wallet-connect-modal-information-section--desktop";U.innerHTML=`\n
    \n \n\n

    \n Connect to Pera Wallet\n

    \n\n

    \n Simply the best Algorand wallet.\n

    \n\n

    \n Features\n

    \n\n
      \n
    • \n
      \n Layer Icon\n
      \n \n \n Connect to any Algorand dApp securely\n

      \n
    • \n\n
    • \n \n Tick Icon\n
    \n\n \n Your private keys are safely stored locally\n

    \n \n\n
  • \n \n Note Icon\n \n\n \n View NFTs, buy and swap crypto and more\n

    \n
  • \n \n \n`;class F extends HTMLElement{constructor(){var e,t,n,i;super(),this.attachShadow({mode:"open"});const o="true"===(null===(e=document.querySelector("pera-wallet-connect-modal"))||void 0===e?void 0:e.getAttribute("compact-mode"));if(this.shadowRoot&&(!o&&!r.isMobile()||r.isMobile())){const e=document.createElement("style");e.textContent=D,this.shadowRoot.append(U.content.cloneNode(!0),e),r.isMobile()?null===(t=this.shadowRoot.getElementById("pera-wallet-connect-modal-information-section-title"))||void 0===t||t.setAttribute("style","display: none;"):(null===(n=this.shadowRoot.getElementById("pera-wallet-connect-modal-information-section-pera-icon"))||void 0===n||n.setAttribute("src","data:image/svg+xml,%3csvg width='84' height='38' viewBox='0 0 84 38' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M19.806 8.62773C20.4416 11.2609 20.2268 13.5772 19.3262 13.8012C18.4256 14.0253 17.1803 12.0723 16.5448 9.43906C15.9092 6.80585 16.1241 4.48959 17.0246 4.26555C17.9252 4.04151 19.1705 5.99452 19.806 8.62773Z' fill='%233C3C49'/%3e%3cpath d='M30.3007 10.8917C28.8932 9.3999 26.0929 9.80424 24.0461 11.7948C21.9994 13.7853 21.4812 16.6082 22.8887 18.1C24.2962 19.5917 27.0964 19.1874 29.1432 17.1969C31.1899 15.2064 31.7082 12.3834 30.3007 10.8917Z' fill='%233C3C49'/%3e%3cpath d='M19.1061 33.734C20.0067 33.5099 20.1899 31.0627 19.5153 28.2678C18.8408 25.473 17.5639 23.3889 16.6633 23.613C15.7627 23.837 15.5795 26.2843 16.2541 29.0791C16.9286 31.874 18.2056 33.958 19.1061 33.734Z' fill='%233C3C49'/%3e%3cpath d='M9.92571 12.2574C12.5239 13.0236 14.4224 14.3678 14.1662 15.2597C13.9099 16.1517 11.5959 16.2536 8.99771 15.4874C6.3995 14.7212 4.50098 13.377 4.75724 12.4851C5.0135 11.5931 7.3275 11.4912 9.92571 12.2574Z' fill='%233C3C49'/%3e%3cpath d='M26.7892 22.3292C29.5469 23.1424 31.5747 24.5247 31.3184 25.4167C31.0621 26.3086 28.6189 26.3724 25.8612 25.5592C23.1035 24.7459 21.0757 23.3636 21.3319 22.4717C21.5882 21.5797 24.0315 21.5159 26.7892 22.3292Z' fill='%233C3C49'/%3e%3cpath d='M12.8493 20.4577C12.205 19.7898 10.0916 20.7619 8.12896 22.6289C6.16631 24.4959 5.09759 26.5509 5.7419 27.2188C6.38622 27.8867 8.49958 26.9146 10.4622 25.0476C12.4249 23.1806 13.4936 21.1256 12.8493 20.4577Z' fill='%233C3C49'/%3e%3cpath d='M41.691 12.5347V11.9635H39.3366V27.1957H41.691V23.0915C41.691 22.6472 41.691 22.2876 41.6482 21.801H41.691C42.5471 23.1973 44.0026 23.9377 45.7148 23.9377C48.6043 23.9377 51.1299 21.7587 51.1299 17.7179C51.1299 13.7617 48.6043 11.625 45.7148 11.625C44.0668 11.625 42.6113 12.3443 41.691 13.7617H41.6482C41.691 13.2963 41.691 12.9578 41.691 12.5347ZM45.1155 21.9279C42.9324 21.9068 41.6696 20.0662 41.6696 17.6967C41.6696 15.4542 42.9324 13.656 45.1155 13.6348C47.2559 13.6137 48.6685 15.2638 48.6685 17.7179C48.6685 20.2354 47.2559 21.9491 45.1155 21.9279Z' fill='%233C3C49'/%3e%3cpath d='M63.4932 16.7236C63.4932 13.8041 61.1388 11.625 57.9283 11.625C54.5037 11.625 52.1279 13.931 52.1279 17.7814C52.1279 21.4836 54.4609 23.9377 57.9283 23.9377C60.7749 23.9377 62.8939 22.2876 63.3862 20.0239H60.8177C60.4111 21.1663 59.2981 21.9279 57.9283 21.9279C56.1732 21.9279 54.889 20.6797 54.6107 18.6064H63.4932V16.7236ZM57.9283 13.6348C59.662 13.6348 60.8606 14.8195 61.1174 16.5332H54.6321C54.9318 14.883 56.1518 13.6348 57.9283 13.6348Z' fill='%233C3C49'/%3e%3cpath d='M65.224 23.5992H67.5784V17.0409C67.5784 14.7984 68.8198 13.6348 70.7462 13.6348H72.009V11.625H71.003C69.2693 11.625 68.1991 12.7674 67.5784 13.7617H67.5356V11.9635H65.224V23.5992Z' fill='%233C3C49'/%3e%3cpath d='M83.0154 21.5683C82.6944 21.5683 82.5445 21.3779 82.5445 20.9971V15.8773C82.5445 13.4233 81.3459 11.625 77.8144 11.625C74.3898 11.625 72.8273 13.3175 72.6561 15.7292H75.0105C75.1603 14.4176 76.2091 13.6348 77.8144 13.6348C79.1842 13.6348 80.1259 14.2272 80.1259 15.158C80.1259 15.9196 79.5909 16.3851 77.8358 16.3851H76.894C74.0901 16.3851 72.2066 17.5063 72.2066 20.0662C72.2066 22.753 74.1972 23.98 76.5301 23.98C78.2638 23.98 79.7407 23.2184 80.3186 21.5894C80.3828 22.7742 81.1747 23.5992 82.673 23.5992H84V21.5683H83.0154ZM80.1902 18.1833C80.1902 20.8067 78.7561 21.9491 76.9154 21.9491C75.3101 21.9491 74.668 21.0182 74.668 20.0662C74.668 19.1565 75.2245 18.416 76.9368 18.416H77.2793C78.9273 18.416 79.9547 17.8448 80.1688 16.8505H80.1902V18.1833Z' fill='%233C3C49'/%3e%3c/svg%3e"),null===(i=this.shadowRoot.getElementById("pera-wallet-connect-modal-information-section-connect-pera-mobile"))||void 0===i||i.setAttribute("style","display: none;"))}}}var V='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");\n.pera-wallet-modal {\n --pera-wallet-modal-font-family: "Inter", sans-serif;\n --pera-wallet-modal-compact-width: 380px;\n --pera-wallet-modal-compact-height: 396px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 999999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n}\n.pera-wallet-modal--select-account .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body {\n top: 40px;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: unset;\n height: calc(100 * var(--vh));\n padding: 20px;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);\n border-radius: 20px 20px 0px 0px;\n animation: 0.3s PeraWalletConnectMobileSlideIn ease-out;\n overflow-y: auto;\n transform: unset;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body::before {\n background-image: unset;\n}\n.pera-wallet-modal--compact:not(.pera-wallet-modal--mobile) .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n padding: 0;\n}\n.pera-wallet-modal * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-modal ul,\n.pera-wallet-modal ol,\n.pera-wallet-modal li {\n list-style-type: none;\n}\n\n.pera-wallet-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: auto;\n height: 48px;\n padding: 14px;\n border: none;\n border-radius: 12px;\n outline: none;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 14px;\n}\n\n.pera-wallet-modal__logo img {\n display: block;\n width: 32px;\n}\n\n.pera-wallet-modal__body {\n position: relative;\n top: 50%;\n left: 50%;\n width: 700px;\n max-width: calc(100vw - 80px);\n padding: 28px;\n background-color: #f3f3f7;\n box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.08);\n border-radius: 24px;\n animation: 0.3s PeraWalletConnectSlideIn ease-out;\n transform: translate(-50%, -50%);\n}\n.pera-wallet-modal__body::before {\n --background-line: #1e0972 0 1.2px, transparent 0 calc(100% - 1.2px), #1e0972;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: "";\n background-image: linear-gradient(var(--background-line)), linear-gradient(90deg, var(--background-line));\n background-size: 116px 116px;\n mix-blend-mode: overlay;\n border-radius: 24px;\n opacity: 0.8;\n pointer-events: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-modal--desktop .pera-wallet-modal__body {\n width: 100%;\n max-width: calc(100vw - 32px);\n padding: 24px;\n }\n}\n@keyframes PeraWalletConnectSlideIn {\n 0% {\n opacity: 0;\n transform: translate(-50%, calc(-50% + 24px));\n }\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n}\n@keyframes PeraWalletConnectMobileSlideIn {\n 0% {\n top: 30%;\n opacity: 0;\n }\n 100% {\n top: 40px;\n opacity: 1;\n }\n}\n.pera-wallet-connect-modal-pending-message-section {\n display: grid;\n grid-template-columns: 1fr;\n grid-template-rows: auto 48px;\n gap: 56px;\n height: 100%;\n padding: 4px;\n padding-bottom: 70px;\n}\n\n.pera-wallet-connect-modal-pending-message {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n text-align: center;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n height: 100%;\n margin-top: 10px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__title {\n margin: 16px 0 12px;\n color: #3c3c49;\n font-size: 18px;\n font-weight: 500;\n line-height: 24px;\n letter-spacing: -0.26px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__description {\n color: #6a6a81;\n font-size: 14px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -0.01px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__button {\n display: block;\n width: 100%;\n padding: 14px;\n border-radius: 12px;\n text-decoration: none;\n text-align: center;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.09px;\n font-weight: 500;\n color: #ffffff;\n background-color: #6b46fe;\n border: none;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor {\n display: flex;\n gap: 12px;\n margin-bottom: 20px;\n padding: 16px;\n background: #ffffff;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n border-radius: 12px;\n text-decoration: none;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor__image {\n width: 24px;\n height: 24px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor__title-wrapper {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 4px;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor__title {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n letter-spacing: -0.1px;\n color: #3c3c49;\n}\n.pera-wallet-connect-modal-pending-message--try-again-view__resolving-anchor__description {\n /* stylelint-disable value-no-vendor-prefix */\n /* stylelint-disable property-no-vendor-prefix */\n display: -webkit-box;\n max-width: 100%;\n -webkit-line-clamp: 2;\n /* autoprefixer: ignore next */\n -webkit-box-orient: vertical;\n overflow: hidden;\n /* stylelint-enable value-no-vendor-prefix */\n /* stylelint-enable property-no-vendor-prefix */\n margin: 0;\n font-size: 12px;\n font-weight: 400;\n line-height: 18px;\n letter-spacing: 0.01px;\n color: #9d9dae;\n}\n\n.pera-wallet-connect-modal-pending-message__animation-wrapper {\n width: 56px;\n height: 56px;\n background-color: #6b46fe;\n border-radius: 50%;\n}\n\n.pera-wallet-connect-modal-pending-message__text {\n max-width: 271px;\n margin-top: 24px;\n color: #3c3c49;\n font-size: 18px;\n font-weight: 500;\n line-height: 28px;\n letter-spacing: -0.26px;\n}\n\n.pera-wallet-connect-modal-pending-message__cancel-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n padding: 14px;\n color: #6a6a81;\n background-color: #ffffff;\n box-shadow: 0px 0px 1px rgba(12, 26, 75, 0.24), 0px 3px 8px -1px rgba(50, 50, 71, 0.05);\n border-radius: 12px;\n text-decoration: none;\n text-align: center;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.09px;\n font-weight: 500;\n border: none;\n}';l(V);const q=document.createElement("template");q.innerHTML='\n
    \n
    \n
    \n\n
    \n Please wait while we connect you to Pera Wallet\n
    \n
    \n\n \n Cancel\n \n
    \n\n
    \n';const z=`\n
    \n
    \n Pera Wallet Logo\n\n

    \n Couldn\u2019t establish connection\n

    \n\n

    \n Having issues? Before trying again, make sure to read the support article below and apply the possible solutions.\n

    \n
    \n\n
    \n \n \n\n
    \n \n \n Resolving WalletConnect issues\n \n\n Send Icon\n
    \n\n \n Unfortunately there are several known issues related to WalletConnect that our team is working on. Some of these issues are related to the WalletConnect JavaScript implementation on the dApp ...\n

    \n
    \n \n\n \n
    \n \n `;class H extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=V,this.shadowRoot.append(q.content.cloneNode(!0),e)}}connectedCallback(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-pending-message-cancel-button");null==t||t.addEventListener("click",(()=>{this.onClose()})),this.addAudioForConnection(),this.renderLottieAnimation(),setTimeout((()=>{var e;if(q.innerHTML=z,this.shadowRoot){const t=document.createElement("style");t.textContent=V,this.shadowRoot.innerHTML="",this.shadowRoot.append(q.content.cloneNode(!0),t);const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-pending-message-try-again-button");null==n||n.addEventListener("click",(()=>{this.onClose()}))}}),3e4)}onClose(){r.removeModalWrapperFromDOM(r.PERA_WALLET_CONNECT_MODAL_ID)}addAudioForConnection(){var e;if("true"===this.getAttribute("should-use-sound")&&r.isIOS()){const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-pending-message-audio-wrapper"),n=document.createElement("audio");n.src="https://s3.amazonaws.com/wc.perawallet.app/audio.mp3",n.autoplay=!0,n.loop=!0,null==t||t.appendChild(n)}}renderLottieAnimation(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-connect-modal-pending-message-animation-wrapper");t&&c.default.loadAnimation({container:t,renderer:"svg",loop:!0,autoplay:!0,path:"https://s3.amazonaws.com/wc.perawallet.app/static/pera-loader-animation.json"})}}var W='.pera-wallet-sign-txn-toast {\n --pera-wallet-sign-txn-toast-width: 422px;\n --pera-wallet-sign-txn-toast-height: 134px;\n --pera-wallet-sign-txn-toast-font-family: "Inter", sans-serif;\n position: fixed;\n bottom: 28px;\n right: 35px;\n z-index: 11;\n overflow: hidden;\n width: var(--pera-wallet-sign-txn-toast-width);\n height: var(--pera-wallet-sign-txn-toast-height);\n background: #edeffb;\n border-radius: 8px;\n animation: 0.2s PeraWalletSignTxnToastSlideIn ease-out;\n}\n.pera-wallet-sign-txn-toast * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-sign-txn-toast-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-sign-txn-toast ul,\n.pera-wallet-sign-txn-toast ol,\n.pera-wallet-sign-txn-toast li {\n list-style-type: none;\n}\n\n.pera-wallet-sign-txn-toast__header__close-button {\n position: absolute;\n top: 10px;\n right: 10px;\n width: 20px;\n height: 20px;\n margin: 0;\n padding: 0;\n background: transparent;\n border: none;\n cursor: pointer;\n}\n\n.pera-wallet-sign-txn-toast__content__lottie-animation {\n position: absolute;\n top: -75px;\n left: -100px;\n width: 368px;\n height: 368px;\n}\n\n.pera-wallet-sign-txn-toast__content__description {\n position: absolute;\n top: 40px;\n right: 48px;\n max-width: 197px;\n color: #3c3c49;\n font-size: 14px;\n line-height: 22px;\n letter-spacing: -0.1px;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-sign-txn-toast {\n display: none;\n }\n}\n@keyframes PeraWalletSignTxnToastSlideIn {\n 0% {\n bottom: 12px;\n opacity: 0;\n }\n 100% {\n bottom: 26px;\n opacity: 1;\n }\n}';l(W);const G=document.createElement("template");G.innerHTML='\n
    \n
    \n \n \n \n
    \n
    \n
    \n

    \n Please launch Pera Wallet on your iOS or Android device to sign this transaction.\n

    \n
    \n
    \n';class Z extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");e.textContent=W,this.shadowRoot.append(G.content.cloneNode(!0),e);const t=this.shadowRoot.getElementById("pera-wallet-sign-txn-toast-close-button");null==t||t.addEventListener("click",(()=>{r.removeModalWrapperFromDOM(r.PERA_WALLET_SIGN_TXN_TOAST_ID)})),this.renderLottieAnimation()}}renderLottieAnimation(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pera-wallet-sign-txn-toast-lottie-animation");t&&c.default.loadAnimation({container:t,renderer:"svg",loop:!0,autoplay:!0,path:"https://s3.amazonaws.com/wc.perawallet.app/static/sign-toast-animation.json"})}}var K='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");\n.pera-wallet-modal {\n --pera-wallet-modal-font-family: "Inter", sans-serif;\n --pera-wallet-modal-compact-width: 380px;\n --pera-wallet-modal-compact-height: 396px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 999999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n}\n.pera-wallet-modal--select-account .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body {\n top: 40px;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: unset;\n height: calc(100 * var(--vh));\n padding: 20px;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);\n border-radius: 20px 20px 0px 0px;\n animation: 0.3s PeraWalletConnectMobileSlideIn ease-out;\n overflow-y: auto;\n transform: unset;\n}\n.pera-wallet-modal--mobile .pera-wallet-modal__body::before {\n background-image: unset;\n}\n.pera-wallet-modal--compact:not(.pera-wallet-modal--mobile) .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n padding: 0;\n}\n.pera-wallet-modal * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font-family: var(--pera-wallet-modal-font-family);\n font-smooth: antialiased;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.pera-wallet-modal ul,\n.pera-wallet-modal ol,\n.pera-wallet-modal li {\n list-style-type: none;\n}\n\n.pera-wallet-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: auto;\n height: 48px;\n padding: 14px;\n border: none;\n border-radius: 12px;\n outline: none;\n cursor: pointer;\n font-family: var(--pera-wallet-modal-font-family);\n font-size: 14px;\n}\n\n.pera-wallet-modal__logo img {\n display: block;\n width: 32px;\n}\n\n.pera-wallet-modal__body {\n position: relative;\n top: 50%;\n left: 50%;\n width: 700px;\n max-width: calc(100vw - 80px);\n padding: 28px;\n background-color: #f3f3f7;\n box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.08);\n border-radius: 24px;\n animation: 0.3s PeraWalletConnectSlideIn ease-out;\n transform: translate(-50%, -50%);\n}\n.pera-wallet-modal__body::before {\n --background-line: #1e0972 0 1.2px, transparent 0 calc(100% - 1.2px), #1e0972;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: "";\n background-image: linear-gradient(var(--background-line)), linear-gradient(90deg, var(--background-line));\n background-size: 116px 116px;\n mix-blend-mode: overlay;\n border-radius: 24px;\n opacity: 0.8;\n pointer-events: none;\n}\n\n@media (max-width: 767px) {\n .pera-wallet-modal--desktop .pera-wallet-modal__body {\n width: 100%;\n max-width: calc(100vw - 32px);\n padding: 24px;\n }\n}\n@keyframes PeraWalletConnectSlideIn {\n 0% {\n opacity: 0;\n transform: translate(-50%, calc(-50% + 24px));\n }\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n}\n@keyframes PeraWalletConnectMobileSlideIn {\n 0% {\n top: 30%;\n opacity: 0;\n }\n 100% {\n top: 40px;\n opacity: 1;\n }\n}\n.pera-wallet-sign-txn-modal.pera-wallet-modal .pera-wallet-modal__body {\n width: 480px;\n height: 578px;\n background-color: #ffffff;\n background-image: unset;\n padding: 0;\n}\n.pera-wallet-sign-txn-modal.pera-wallet-modal .pera-wallet-modal__body .pera-wallet-sign-txn-modal__body__content {\n width: 100%;\n height: 100%;\n}\n.pera-wallet-sign-txn-modal.pera-wallet-modal .pera-wallet-modal__body #pera-wallet-iframe {\n width: 100%;\n height: 100%;\n border-radius: 16px;\n margin: 0 auto;\n border: none;\n}\n\n.pera-wallet-sign-txn-modal--compact.pera-wallet-modal .pera-wallet-modal__body {\n width: var(--pera-wallet-modal-compact-width);\n height: var(--pera-wallet-modal-compact-height);\n}';l(K);const X=document.createElement("template");X.innerHTML=`\n
    \n
    \n \n\n
    \n
    \n
    \n`;class Y extends HTMLElement{constructor(){if(super(),this.attachShadow({mode:"open"}),this.shadowRoot){const e=document.createElement("style");if(e.textContent=K,this.shadowRoot.append(X.content.cloneNode(!0),e),"true"===this.getAttribute("compact-mode")){const e=this.shadowRoot.getElementById("pera-wallet-sign-txn-modal");null==e||e.classList.add("pera-wallet-sign-txn-modal--compact")}}}}function J(){document.documentElement.style.setProperty("--vh",.01*window.innerHeight+"px")}window.addEventListener("DOMContentLoaded",(()=>{J()})),window.addEventListener("resize",(()=>{J()})),window.customElements.define("pera-wallet-connect-modal",O),window.customElements.define("pera-wallet-modal-desktop-mode",_),window.customElements.define("pera-wallet-modal-header",p),window.customElements.define("pera-wallet-modal-touch-screen-mode",k),window.customElements.define("pera-wallet-redirect-modal",B),window.customElements.define("pera-wallet-connect-modal-information-section",F),window.customElements.define("pera-wallet-connect-modal-pending-message-section",H),window.customElements.define("pera-wallet-sign-txn-toast",Z),window.customElements.define("pera-wallet-sign-txn-modal",Y),window.customElements.define("pera-wallet-download-qr-code",y)},8150:function(e,t,n){"use strict";var r=n(93548).lW,i=n(92725),o=n(81338),s=n(51206);function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(i),u=a(o),l=a(s);function d(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}class f extends Error{constructor(e,t,...n){super(...n),Error.captureStackTrace&&Error.captureStackTrace(this,f),this.name="PeraWalletConnectError",this.data=e,this.message=t}}const h=new class{constructor(e){this.listener=void 0,this.channel=e.channel}setupListener({onReceiveMessage:e}){this.close(),this.listener=t=>{if("object"==typeof t.data)try{t.data.channel===this.channel&&e(t)}catch(e){console.error(e)}},window.addEventListener("message",this.listener)}sendMessage({message:e,targetWindow:t,origin:n,timeout:r=1e3}){setTimeout((()=>{const r={channel:this.channel,message:e};t.postMessage(r,{targetOrigin:n||"*"})}),r)}close(){this.listener&&(window.removeEventListener("message",this.listener),this.listener=void 0)}}({channel:"pera-web-wallet"});function p(){const e=document.querySelector('meta[name="name"]'),t=document.querySelector('meta[name="description"]');let{title:n}=document,r="";return e instanceof HTMLMetaElement&&(n=e.content),t instanceof HTMLMetaElement&&(r=t.content),{title:n,description:r,url:window.location.origin,favicon:g()[0]}}function g(){const e=document.getElementsByTagName("link"),t=[];for(let n=0;n-1){const e=r.getAttribute("href");if(e&&-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=`${window.location.protocol}//${window.location.host}`;if(0===e.indexOf("/"))n+=e;else{const t=window.location.pathname.split("/");t.pop(),n+=`${t.join("/")}/${e}`}t.push(n)}else if(0===(null==e?void 0:e.indexOf("//"))){const n=window.location.protocol+e;t.push(n)}else e&&t.push(e)}}return t}function m(e){return new Promise(((t,n)=>{try{const r=window.open(e,"_blank");let i=0;const o=setInterval((()=>{if(i+=1,50===i)return clearInterval(o),void n(new f({type:"MESSAGE_NOT_RECEIVED"},"Couldn't open Pera Wallet, please try again."));r&&(!0===r.closed&&(clearInterval(o),n(new f({type:"OPERATION_CANCELLED"},"Operation cancelled by user"))),h.sendMessage({message:{type:"TAB_OPEN"},origin:e,targetWindow:r}))}),700);h.setupListener({onReceiveMessage:e=>{"TAB_OPEN_RECEIVED"===e.data.message.type&&(clearInterval(o),t(r))}})}catch(e){n(e)}}))}function b(e){const t=document.createElement("div");return t.setAttribute("id",e),document.body.appendChild(t),t}function y(){b("pera-wallet-redirect-modal-wrapper").innerHTML=""}function v(){b("pera-wallet-sign-txn-toast-wrapper").innerHTML=""}function w(e){const t=document.getElementById(e);t&&t.remove()}const x="PeraWallet.Wallet",S="walletconnect";function A(){return"undefined"==typeof localStorage?void 0:localStorage}function E(e,t){var n;null===(n=A())||void 0===n||n.setItem(x,JSON.stringify({type:t||"pera-wallet",accounts:e,selectedAccount:e[0]}))}function _(){var e;const t=null===(e=A())||void 0===e?void 0:e.getItem(x);return t?JSON.parse(t):null}function C(){return new Promise(((e,t)=>{var n,r;try{null===(n=A())||void 0===n||n.removeItem(S),null===(r=A())||void 0===r||r.removeItem(x),e(void 0)}catch(e){t(e)}}))}function I(e){const t=e.slice();for(let n=t.length-1;n>0;n--){const e=Math.floor(Math.random()*(n+1));[t[n],t[e]]=[t[e],t[n]]}return t}function k(){return d(this,void 0,void 0,(function*(){let e={bridgeURL:"",webWalletURL:"",isWebWalletAvailable:!1,shouldDisplayNewBadge:!1,shouldUseSound:!0,silent:!1,promoteMobile:!1};try{const t=yield function(e,t={}){return fetch("https://wc.perawallet.app/config.json",t).then((e=>e.json())).then((e=>e))}(0,{cache:"no-store"});void 0!==t.web_wallet&&t.web_wallet_url&&(e.isWebWalletAvailable=t.web_wallet),void 0!==t.display_new_badge&&(e.shouldDisplayNewBadge=t.display_new_badge),void 0!==t.use_sound&&(e.shouldUseSound=t.use_sound),void 0!==t.silent&&(e.silent=t.silent),void 0!==t.promote_mobile&&(e.promoteMobile=t.promote_mobile),e=Object.assign(Object.assign({},e),{bridgeURL:I(t.servers||[])[0]||"",webWalletURL:t.web_wallet_url||""})}catch(e){console.log(e)}return e}))}function T(e){return Uint8Array.from(window.atob(e),(e=>e.charCodeAt(0)))}function M(e,t){return{id:Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3)),jsonrpc:"2.0",method:e,params:t}}function P(){return"undefined"!=typeof navigator}function O(){return P()&&/Android/i.test(navigator.userAgent)}function R(){return P()&&/iPhone|iPod|Android/i.test(navigator.userAgent)}const N=O()?"algorand://":"perawallet-wc://";function B(e){return{ROOT:`https://${e}`,CONNECT:`https://${e}/connect`,TRANSACTION_SIGN:`https://${e}/transaction/sign`}}function L({method:e,signTxnRequestParams:t,signer:n,chainId:r,webWalletURL:i,resolve:o,reject:s}){const a=B(i);!function(){d(this,void 0,void 0,(function*(){try{const i=yield m(a.TRANSACTION_SIGN);if(i){let o;"SIGN_TXN"===e?o={type:"SIGN_TXN",txn:t}:"SIGN_DATA"===e&&n&&r&&(o={type:"SIGN_DATA",data:t,signer:n,chainId:r}),o&&h.sendMessage({message:o,origin:a.TRANSACTION_SIGN,targetWindow:i})}const c=setInterval((()=>{!0===(null==i?void 0:i.closed)&&(s(new f({type:`${e}_CANCELLED`},"Transaction signing is cancelled by user.")),clearInterval(c))}),2e3);h.setupListener({onReceiveMessage:t=>function({event:e,newPeraWalletTab:t,method:n,resolve:r,reject:i}){switch(e.data.message.type){case"SIGN_TXN_CALLBACK":null==t||t.close(),r(e.data.message.signedTxns.map((e=>T(e.signedTxn))));break;case"SIGN_DATA_CALLBACK":null==t||t.close(),r(e.data.message.signedData.map((e=>T(e.signedData))));break;case"SIGN_TXN_NETWORK_MISMATCH":i(new f({type:`${n}_NETWORK_MISMATCH`,detail:e.data.message.error},e.data.message.error||"Network mismatch"));break;case"SIGN_TXN_CALLBACK_ERROR":null==t||t.close(),i(new f({type:`${n}_CANCELLED`},e.data.message.error));break;case"SESSION_DISCONNECTED":null==t||t.close(),C(),i(new f({type:"SESSION_DISCONNECTED",detail:e.data.message.error},e.data.message.error))}}({event:t,newPeraWalletTab:i,method:e,resolve:o,reject:s})})}catch(e){s(e)}}))}()}function D({webWalletURL:e,chainId:t,resolve:n,reject:r}){const i=B(e);return function(){return d(this,void 0,void 0,(function*(){try{const e=yield m(i.CONNECT);e&&h.sendMessage({message:{type:"CONNECT",data:Object.assign(Object.assign({},p()),{chainId:t})},origin:i.CONNECT,targetWindow:e});const s=setInterval((()=>{!0===(null==e?void 0:e.closed)&&(r(new f({type:"CONNECT_CANCELLED"},"Connect is cancelled by user")),clearInterval(s),o())}),2e3);h.setupListener({onReceiveMessage:t=>function({event:e,newPeraWalletTab:t,resolve:n,reject:r}){if(n&&"CONNECT_CALLBACK"===e.data.message.type){const r=e.data.message.data.addresses;E(r,"pera-wallet-web"),n(r),w("pera-wallet-connect-modal-wrapper"),null==t||t.close()}else"CONNECT_NETWORK_MISMATCH"===e.data.message.type&&(r(new f({type:"CONNECT_NETWORK_MISMATCH",detail:e.data.message.error},e.data.message.error||"Your wallet is connected to a different network to this dApp. Update your wallet to the correct network (MainNet or TestNet) to continue.")),w("pera-wallet-connect-modal-wrapper"),null==t||t.close())}({event:t,newPeraWalletTab:e,resolve:n,reject:r})})}catch(e){o(),r(e)}}))};function o(){w("pera-wallet-connect-modal-wrapper")}}function U({isWebWalletAvailable:e,shouldDisplayNewBadge:t,shouldUseSound:n,compactMode:r,promoteMobile:i}){return{open:(o={isWebWalletAvailable:e,shouldDisplayNewBadge:t,shouldUseSound:n,compactMode:r,promoteMobile:i},e=>{if(!document.getElementById("pera-wallet-connect-modal-wrapper")){const t=b("pera-wallet-connect-modal-wrapper"),n=`${e}&algorand=true`,{isWebWalletAvailable:r,shouldDisplayNewBadge:i,shouldUseSound:s,compactMode:a,promoteMobile:c}=o;t.innerHTML=``}}),close:()=>w("pera-wallet-connect-modal-wrapper")};var o}"undefined"!=typeof window&&(window.global=window,window.Buffer=window.Buffer||n(93548).lW,Promise.resolve().then((function(){return n(37400)}))),t.PERA_DOWNLOAD_URL="https://perawallet.app/download/",t.PERA_WALLET_APP_DEEP_LINK=N,t.PERA_WALLET_CONNECT_MODAL_ID="pera-wallet-connect-modal-wrapper",t.PERA_WALLET_MODAL_CLASSNAME="pera-wallet-modal",t.PERA_WALLET_REDIRECT_MODAL_ID="pera-wallet-redirect-modal-wrapper",t.PERA_WALLET_SIGN_TXN_MODAL_ID="pera-wallet-sign-txn-modal-wrapper",t.PERA_WALLET_SIGN_TXN_TOAST_ID="pera-wallet-sign-txn-toast-wrapper",t.PeraWalletConnect=class{constructor(e){this.bridge=(null==e?void 0:e.bridge)||"",this.connector=null,this.shouldShowSignTxnToast=void 0===(null==e?void 0:e.shouldShowSignTxnToast)||e.shouldShowSignTxnToast,this.chainId=null==e?void 0:e.chainId,this.compactMode=(null==e?void 0:e.compactMode)||!1}get platform(){return function(){const e=_();let t=null;return"pera-wallet"===(null==e?void 0:e.type)?t="mobile":"pera-wallet-web"===(null==e?void 0:e.type)&&(t="web"),t}()}get isConnected(){var e;return"mobile"===this.platform?!!this.connector:"web"===this.platform&&!!(null===(e=_())||void 0===e?void 0:e.accounts.length)}connect(){return new Promise(((e,t)=>d(this,void 0,void 0,(function*(){var n;try{if(null===(n=this.connector)||void 0===n?void 0:n.connected)try{yield this.connector.killSession()}catch(e){}const{isWebWalletAvailable:r,bridgeURL:i,webWalletURL:o,shouldDisplayNewBadge:s,shouldUseSound:a,promoteMobile:u}=yield k(),l=D({resolve:e,reject:t,webWalletURL:o,chainId:this.chainId,isCompactMode:this.compactMode});r&&(window.onWebWalletConnect=l),this.connector=new c.default({bridge:this.bridge||i||"https://bridge.walletconnect.org",qrcodeModal:U({isWebWalletAvailable:r,shouldDisplayNewBadge:s,shouldUseSound:a,compactMode:this.compactMode,promoteMobile:u})}),yield this.connector.createSession({chainId:this.chainId||4160}),function(e,t){var n,r,i,o;const s=document.getElementById(e),a=null===(r=null===(n=null==s?void 0:s.querySelector(e.replace("-wrapper","")))||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.querySelector(".pera-wallet-modal"),c=null===(o=null===(i=null==a?void 0:a.querySelector("pera-wallet-modal-header"))||void 0===i?void 0:i.shadowRoot)||void 0===o?void 0:o.getElementById("pera-wallet-modal-header-close-button");null==c||c.addEventListener("click",(()=>{t(),w(e)}))}("pera-wallet-connect-modal-wrapper",(()=>t(new f({type:"CONNECT_MODAL_CLOSED"},"Connect modal is closed by user")))),this.connector.on("connect",((n,r)=>{var i,o;n&&t(n),e((null===(i=this.connector)||void 0===i?void 0:i.accounts)||[]),E((null===(o=this.connector)||void 0===o?void 0:o.accounts)||[])}))}catch(e){console.log(e),t(new f({type:"SESSION_CONNECT",detail:e},e.message||"There was an error while connecting to Pera Wallet"))}}))))}reconnectSession(){return new Promise(((e,t)=>d(this,void 0,void 0,(function*(){var n,r;try{const i=_();if(!i)return void e([]);if("pera-wallet-web"===(null==i?void 0:i.type)){const{isWebWalletAvailable:n}=yield k();n?e(i.accounts||[]):t(new f({type:"SESSION_RECONNECT",detail:"Pera Web is not available"},"Pera Web is not available"))}this.connector&&e(this.connector.accounts||[]),this.bridge=(null===(n=function(){var e;const t=null===(e=A())||void 0===e?void 0:e.getItem(S);return t?JSON.parse(t):null}())||void 0===n?void 0:n.bridge)||"",this.bridge&&(this.connector=new c.default({bridge:this.bridge}),e((null===(r=this.connector)||void 0===r?void 0:r.accounts)||[])),this.isConnected||e([])}catch(e){yield this.disconnect(),t(new f({type:"SESSION_RECONNECT",detail:e},e.message||"There was an error while reconnecting to Pera Wallet"))}}))))}disconnect(){var e;return d(this,void 0,void 0,(function*(){let t;this.isConnected&&"mobile"===this.platform&&(t=null===(e=this.connector)||void 0===e?void 0:e.killSession(),null==t||t.then((()=>{this.connector=null}))),yield C()}))}signTransactionWithMobile(e){return d(this,void 0,void 0,(function*(){const t=M("algo_signTxn",[e]);try{try{const{silent:e}=yield k(),n=(yield this.connector.sendCustomRequest(t,{forcePushNotification:!e})).filter(Boolean);return"string"==typeof n[0]?n.map(T):n.map((e=>Uint8Array.from(e)))}catch(e){return yield Promise.reject(new f({type:"SIGN_TRANSACTIONS",detail:e},e.message||"Failed to sign transaction"))}}finally{w("pera-wallet-redirect-modal-wrapper"),w("pera-wallet-sign-txn-toast-wrapper")}}))}signTransactionWithWeb(e,t){return new Promise(((n,r)=>L({signTxnRequestParams:e,webWalletURL:t,method:"SIGN_TXN",resolve:n,reject:r})))}signDataWithMobile({data:e,signer:t,chainId:n}){return d(this,void 0,void 0,(function*(){const r=M("algo_signData",e.map((e=>Object.assign(Object.assign({},e),{signer:t,chainId:n}))));try{try{const{silent:e}=yield k(),t=(yield this.connector.sendCustomRequest(r,{forcePushNotification:!e})).filter(Boolean);return"string"==typeof t[0]?t.map(T):t.map((e=>Uint8Array.from(e)))}catch(e){return yield Promise.reject(new f({type:"SIGN_TRANSACTIONS",detail:e},e.message||"Failed to sign transaction"))}}finally{w("pera-wallet-redirect-modal-wrapper"),w("pera-wallet-sign-txn-toast-wrapper")}}))}signDataWithWeb({data:e,signer:t,chainId:n,webWalletURL:r}){return new Promise(((i,o)=>L({method:"SIGN_DATA",signTxnRequestParams:e,signer:t,chainId:n,webWalletURL:r,resolve:i,reject:o})))}signTransaction(e,t){return d(this,void 0,void 0,(function*(){if("mobile"===this.platform&&(R()?y():!R()&&this.shouldShowSignTxnToast&&v(),!this.connector))throw new Error("PeraWalletConnect was not initialized correctly.");const n=e.flatMap((e=>e.map((e=>function(e,t){let n;t&&!(e.signers||[]).includes(t)&&(n=[]);const i={txn:(o=e.txn,r.from(u.default.encodeUnsignedTransaction(o)).toString("base64"))};var o;return Array.isArray(n)&&(i.signers=n),e.authAddr&&(i.authAddr=e.authAddr),e.message&&(i.message=e.message),e.msig&&(i.msig=e.msig),i}(e,t)))));if("web"===this.platform){const{webWalletURL:e}=yield k();return this.signTransactionWithWeb(n,e)}return this.signTransactionWithMobile(n)}))}signData(e,t){return d(this,void 0,void 0,(function*(){const n=this.chainId||4160;if("mobile"===this.platform&&(R()?y():!R()&&this.shouldShowSignTxnToast&&v(),!this.connector))throw new Error("PeraWalletConnect was not initialized correctly.");if("web"===this.platform){const{webWalletURL:r}=yield k();return this.signDataWithWeb({data:e,signer:t,chainId:n,webWalletURL:r})}const i=e.map((e=>Object.assign(Object.assign({},e),{data:r.from(e.data).toString("base64")})));return this.signDataWithMobile({data:i,signer:t,chainId:n})}))}},t.closePeraWalletSignTxnToast=function(){w("pera-wallet-sign-txn-toast-wrapper")},t.detectBrowser=function(){if(!P())return null;const{userAgent:e}=navigator;let t;return t=e.match(/DuckDuckGo/i)?"DuckDuckGo":e.match(/OPX/i)?"Opera GX":navigator.brave?"Brave":l.default.getParser(navigator.userAgent).getBrowserName(),t},t.isAndroid=O,t.isIOS=function(){return P()&&/iPhone|iPad|iPod/i.test(navigator.userAgent)},t.isMobile=R,t.removeModalWrapperFromDOM=w},92339:function(e,t,n){"use strict";var r=n(8150);n(92725),n(81338),n(51206),t.DQ=r.PeraWalletConnect,r.closePeraWalletSignTxnToast},92725:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Ze}});var r={};n.r(r),n.d(r,{decrypt:function(){return Ge},encrypt:function(){return We},generateKey:function(){return ze},verifyHmac:function(){return He}});var i=n(68364),o=n(40957),s=n(34155),a=function(){for(var e=0,t=0,n=arguments.length;t1)}())}function S(){return!function(){const e=v();return!(!e||!e.name)&&"node"===e.name.toLowerCase()}()&&!!A()}o.getFromWindow,o.getFromWindowOrThrow,o.getDocumentOrThrow,o.getDocument,o.getNavigatorOrThrow;const A=o.getNavigator,E=(o.getLocationOrThrow,o.getLocation),_=(o.getCryptoOrThrow,o.getCrypto,o.getLocalStorageOrThrow,o.getLocalStorage);function C(){return i.D()}const I=function(e){if("string"!==typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}},k=function(e){return"string"===typeof e?e:JSON.stringify(e)};function T(e){let t=null,n=null;const r=_();return r&&(n=r.getItem(e)),t=n?I(n):n,t}function M(e){const t=_();t&&t.removeItem(e)}const P="WALLETCONNECT_DEEPLINK_CHOICE";const O=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],R=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"];var N=n(11460),B=n.n(N),L=(n(4501),n(65054)),D=n.n(L),U=n(48764).Buffer;const j="hex",F="utf8",V="0";function q(e){return new Uint8Array(e)}function z(e,t=!1){const n=e.toString(j);return t?ne(n):n}function H(e){return e.toString(F)}function W(e){return D()(e)}function G(e,t=!1){return z(W(e),t)}function Z(e){return H(W(e))}function K(e){return U.from(te(e),j)}function X(e){return q(K(e))}function Y(e){return U.from(e,F)}function J(e){return q(Y(e))}function Q(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}function $(...e){let t=[];return e.forEach((e=>t=t.concat(Array.from(e)))),new Uint8Array([...t])}function ee(e,t=8,n="0"){return function(e,t,n="0"){return ie(e,t,!0,n)}(e,function(e,t=8){const n=e%t;return n?(e-n)/t*t+t:e}(e.length,t),n)}function te(e){return e.replace(/^0x/,"")}function ne(e){return e.startsWith("0x")?e:`0x${e}`}function re(e){return(e=ee(e=te(e),2))&&(e=ne(e)),e}function ie(e,t,n,r="0"){const i=t-e.length;let o=e;if(i>0){const t=r.repeat(i);o=n?t+e:e+t}return o}function oe(e){return W(new Uint8Array(e))}function se(e,t){return function(e,t=!1){return z(Y(e),t)}(e,!t)}function ae(e,t){const n=te(re(new(B())(e).toString(16)));return t?n:ne(n)}var ce=n(91094);var ue=n(1468);function le(){return Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}function de(e){return re(e)}function fe(e){return function(e){const t=e.startsWith("0x");return e=(e=te(e)).startsWith(V)?e.substring(1):e,t?ne(e):e}(ne(e))}const he=le;function pe(){return((e,t)=>{for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t})()}function ge(e,t){return Q(e,t)}function me(e){return"undefined"!==typeof e.result}function be(e){return"undefined"!==typeof e.error}function ye(e){return"undefined"!==typeof e.event}function ve(e){e=te(e.toLowerCase());const t=te((0,ce.keccak_256)(Y(e)));let n="";for(let r=0;r7?n+=e[r].toUpperCase():n+=e[r];return ne(n)}function we(e){var t;return(t=e)&&t.length&&!ge(e[0])&&(e[0]=se(e[0])),e}function xe(e){if("undefined"!==typeof e.type&&"0"!==e.type)return e;if("undefined"===typeof e.from||(!(t=e.from)||"0x"!==t.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(t)||!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t)&&t!==ve(t)))throw new Error("Transaction object must include a valid 'from' value.");var t;function n(e){let t=e;return("number"===typeof e||"string"===typeof e&&!function(e){return""===e||"string"===typeof e&&""===e.trim()}(e))&&(ge(e)?"string"===typeof e&&(t=de(e)):t=ae(e)),"string"===typeof t&&(t=fe(t)),t}const r={from:de(e.from),to:"undefined"===typeof e.to?void 0:de(e.to),gasPrice:"undefined"===typeof e.gasPrice?"":n(e.gasPrice),gas:"undefined"===typeof e.gas?"undefined"===typeof e.gasLimit?"":n(e.gasLimit):n(e.gas),value:"undefined"===typeof e.value?"":n(e.value),nonce:"undefined"===typeof e.nonce?"":n(e.nonce),data:"undefined"===typeof e.data?"":de(e.data)||"0x"},i=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((e=>{("undefined"===typeof r[e]||"string"===typeof r[e]&&!r[e].trim().length)&&i.includes(e)&&delete r[e]})),r}var Se=n(66151);function Ae(e,t){let n=Ee(e);return n=Object.assign(Object.assign({},n),t),e=function(e){return Se.stringify(e)}(n),e}function Ee(e){return Se.parse(e)}var _e=class{constructor(){this._eventEmitters=[],"undefined"!==typeof window&&"undefined"!==typeof window.addEventListener&&(window.addEventListener("online",(()=>this.trigger("online"))),window.addEventListener("offline",(()=>this.trigger("offline"))))}on(e,t){this._eventEmitters.push({event:e,callback:t})}trigger(e){let t=[];e&&(t=this._eventEmitters.filter((t=>t.event===e))),t.forEach((e=>{e.callback()}))}};const Ce="undefined"!==typeof n.g.WebSocket?n.g.WebSocket:n(68007);var Ie=class{constructor(e){if(this.opts=e,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=e.protocol,this._version=e.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=e.subscriptions||[],this._netMonitor=e.netMonitor||new _e,!e.url||"string"!==typeof e.url)throw new Error("Missing or invalid WebSocket url");this._url=e.url,this._netMonitor.on("online",(()=>this._socketCreate()))}set readyState(e){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(e){}get connecting(){return 0===this.readyState}set connected(e){}get connected(){return 1===this.readyState}set closing(e){}get closing(){return 2===this.readyState}set closed(e){}get closed(){return 3===this.readyState}open(){this._socketCreate()}close(){this._socketClose()}send(e,t,n){if(!t||"string"!==typeof t)throw new Error("Missing or invalid topic field");this._socketSend({topic:t,type:"pub",payload:e,silent:!!n})}subscribe(e){this._socketSend({topic:e,type:"sub",payload:"",silent:!0})}on(e,t){this._events.push({event:e,callback:t})}_socketCreate(){if(this._nextSocket)return;const e=function(e,t,n){var r,i;const o=(e.startsWith("https")?e.replace("https","wss"):e.startsWith("http")?e.replace("http","ws"):e).split("?"),s=S()?{protocol:t,version:n,env:"browser",host:(null===(r=E())||void 0===r?void 0:r.host)||""}:{protocol:t,version:n,env:(null===(i=v())||void 0===i?void 0:i.name)||""},a=Ae(function(e){const t=-1!==e.indexOf("?")?e.indexOf("?"):void 0;return"undefined"!==typeof t?e.substr(t):""}(o[1]||""),s);return o[0]+"?"+a}(this._url,this._protocol,this._version);if(this._nextSocket=new Ce(e),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=e=>this._socketReceive(e),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=e=>this._socketError(e),this._nextSocket.onclose=()=>{setTimeout((()=>{this._nextSocket=null,this._socketCreate()}),1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(e){const t=JSON.stringify(e);this._socket&&1===this._socket.readyState?this._socket.send(t):(this._setToQueue(e),this._socketCreate())}async _socketReceive(e){let t;try{t=JSON.parse(e.data)}catch(n){return}if(this._socketSend({topic:t.topic,type:"ack",payload:"",silent:!0}),this._socket&&1===this._socket.readyState){const e=this._events.filter((e=>"message"===e.event));e&&e.length&&e.forEach((e=>e.callback(t)))}}_socketError(e){const t=this._events.filter((e=>"error"===e.event));t&&t.length&&t.forEach((t=>t.callback(e)))}_queueSubscriptions(){this._subscriptions.forEach((e=>this._queue.push({topic:e,type:"sub",payload:"",silent:!0}))),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(e){this._queue.push(e)}_pushQueue(){this._queue.forEach((e=>this._socketSend(e))),this._queue=[]}};const ke="Session currently connected",Te="Session currently disconnected",Me="JSON RPC response format is invalid",Pe="User close QRCode Modal";var Oe=class{constructor(){this._eventEmitters=[]}subscribe(e){this._eventEmitters.push(e)}unsubscribe(e){this._eventEmitters=this._eventEmitters.filter((t=>t.event!==e))}trigger(e){let t,n=[];t="undefined"!==typeof e.method?e.method:me(e)||be(e)?`response:${e.id}`:ye(e)?e.event:"",t&&(n=this._eventEmitters.filter((e=>e.event===t))),n&&n.length||function(e){return O.includes(e)||e.startsWith("wc_")}(t)||ye(t)||(n=this._eventEmitters.filter((e=>"call_request"===e.event))),n.forEach((t=>{if(be(e)){const n=new Error(e.error.message);t.callback(n,null)}else t.callback(null,e)}))}};var Re=class{constructor(e="walletconnect"){this.storageId=e}getSession(){let e=null;const t=T(this.storageId);return t&&"undefined"!==typeof t.bridge&&(e=t),e}setSession(e){return function(e,t){const n=k(t),r=_();r&&r.setItem(e,n)}(this.storageId,e),e}removeSession(){M(this.storageId)}};const Ne="abcdefghijklmnopqrstuvwxyz0123456789".split("").map((e=>`https://${e}.bridge.walletconnect.org`));function Be(){return Ne[Math.floor(Math.random()*Ne.length)]}var Le=class{constructor(e){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new Oe,this._clientMeta=C()||e.connectorOpts.clientMeta||null,this._cryptoLib=e.cryptoLib,this._sessionStorage=e.sessionStorage||new Re(e.connectorOpts.storageId),this._qrcodeModal=e.connectorOpts.qrcodeModal,this._qrcodeModalOptions=e.connectorOpts.qrcodeModalOptions,this._signingMethods=[...R,...e.connectorOpts.signingMethods||[]],!e.connectorOpts.bridge&&!e.connectorOpts.uri&&!e.connectorOpts.session)throw new Error("Missing one of the required parameters: bridge / uri / session");var t;e.connectorOpts.bridge&&(this.bridge=function(e){return"walletconnect.org"===function(e){return function(e){let t=e.indexOf("//")>-1?e.split("/")[2]:e.split("/")[0];return t=t.split(":")[0],t=t.split("?")[0],t}(e).split(".").slice(-2).join(".")}(e)}(t=e.connectorOpts.bridge)?Be():t),e.connectorOpts.uri&&(this.uri=e.connectorOpts.uri);const n=e.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e.transport||new Ie({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),e.connectorOpts.uri&&this._subscribeToSessionRequest(),e.pushServerOpts&&this._registerPushServer(e.pushServerOpts)}set bridge(e){e&&(this._bridge=e)}get bridge(){return this._bridge}set key(e){if(!e)return;const t=X(e).buffer;this._key=t}get key(){if(this._key){return e=this._key,t=!0,G(new Uint8Array(e),!t)}var e,t;return""}set clientId(e){e&&(this._clientId=e)}get clientId(){let e=this._clientId;return e||(e=this._clientId=pe()),this._clientId}set peerId(e){e&&(this._peerId=e)}get peerId(){return this._peerId}set clientMeta(e){}get clientMeta(){let e=this._clientMeta;return e||(e=this._clientMeta=C()),e}set peerMeta(e){this._peerMeta=e}get peerMeta(){return this._peerMeta}set handshakeTopic(e){e&&(this._handshakeTopic=e)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(e){e&&(this._handshakeId=e)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(e){if(!e)return;const{handshakeTopic:t,bridge:n,key:r}=this._parseUri(e);this.handshakeTopic=t,this.bridge=n,this.key=r}set chainId(e){this._chainId=e}get chainId(){return this._chainId}set networkId(e){this._networkId=e}get networkId(){return this._networkId}set accounts(e){this._accounts=e}get accounts(){return this._accounts}set rpcUrl(e){this._rpcUrl=e}get rpcUrl(){return this._rpcUrl}set connected(e){}get connected(){return this._connected}set pending(e){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(e){e&&(this._connected=e.connected,this.accounts=e.accounts,this.chainId=e.chainId,this.bridge=e.bridge,this.key=e.key,this.clientId=e.clientId,this.clientMeta=e.clientMeta,this.peerId=e.peerId,this.peerMeta=e.peerMeta,this.handshakeId=e.handshakeId,this.handshakeTopic=e.handshakeTopic)}on(e,t){const n={event:e,callback:t};this._eventManager.subscribe(n)}off(e){this._eventManager.unsubscribe(e)}async createInstantRequest(e){this._key=await this._generateKey();const t=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(e)}]});this.handshakeId=t.id,this.handshakeTopic=pe(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",(()=>{throw new Error(Pe)}));const n=()=>{this.killSession()};try{const e=await this._sendCallRequest(t);return e&&n(),e}catch(r){throw n(),r}}async connect(e){if(!this._qrcodeModal)throw new Error("QRCode Modal not provided");return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(e),new Promise((async(e,t)=>{this.on("modal_closed",(()=>t(new Error(Pe)))),this.on("connect",((n,r)=>{if(n)return t(n);e(r.params[0])}))})))}async createSession(e){if(this._connected)throw new Error(ke);if(this.pending)return;this._key=await this._generateKey();const t=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:e&&e.chainId?e.chainId:null}]});this.handshakeId=t.id,this.handshakeTopic=pe(),this._sendSessionRequest(t,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(e){if(this._connected)throw new Error(ke);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const t={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},n={id:this.handshakeId,jsonrpc:"2.0",result:t};this._sendResponse(n),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(e){if(this._connected)throw new Error(ke);const t=e&&e.message?e.message:"Session Rejected",n=this._formatResponse({id:this.handshakeId,error:{message:t}});this._sendResponse(n),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:t}]}),this._removeStorageSession()}updateSession(e){if(!this._connected)throw new Error(Te);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const t={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},n=this._formatRequest({method:"wc_sessionUpdate",params:[t]});this._sendSessionRequest(n,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(e){const t=e?e.message:"Session Disconnected",n=this._formatRequest({method:"wc_sessionUpdate",params:[{approved:!1,chainId:null,networkId:null,accounts:null}]});await this._sendRequest(n),this._handleSessionDisconnect(t)}async sendTransaction(e){if(!this._connected)throw new Error(Te);const t=xe(e),n=this._formatRequest({method:"eth_sendTransaction",params:[t]});return await this._sendCallRequest(n)}async signTransaction(e){if(!this._connected)throw new Error(Te);const t=xe(e),n=this._formatRequest({method:"eth_signTransaction",params:[t]});return await this._sendCallRequest(n)}async signMessage(e){if(!this._connected)throw new Error(Te);const t=this._formatRequest({method:"eth_sign",params:e});return await this._sendCallRequest(t)}async signPersonalMessage(e){if(!this._connected)throw new Error(Te);e=we(e);const t=this._formatRequest({method:"personal_sign",params:e});return await this._sendCallRequest(t)}async signTypedData(e){if(!this._connected)throw new Error(Te);const t=this._formatRequest({method:"eth_signTypedData",params:e});return await this._sendCallRequest(t)}async updateChain(e){if(!this._connected)throw new Error("Session currently disconnected");const t=this._formatRequest({method:"wallet_updateChain",params:[e]});return await this._sendCallRequest(t)}unsafeSend(e,t){return this._sendRequest(e,t),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:t}]}),new Promise(((t,n)=>{this._subscribeToResponse(e.id,((e,r)=>{if(e)n(e);else{if(!r)throw new Error("Missing JSON RPC response");t(r)}}))}))}async sendCustomRequest(e,t){if(!this._connected)throw new Error(Te);switch(e.method){case"eth_accounts":return this.accounts;case"eth_chainId":return ae(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":e.params&&(e.params[0]=xe(e.params[0]));break;case"personal_sign":e.params&&(e.params=we(e.params))}const n=this._formatRequest(e);return await this._sendCallRequest(n,t)}approveRequest(e){if(!me(e))throw new Error('JSON-RPC success response must include "result" field');{const t=this._formatResponse(e);this._sendResponse(t)}}rejectRequest(e){if(!be(e))throw new Error('JSON-RPC error response must include "error" field');{const t=this._formatResponse(e);this._sendResponse(t)}}transportClose(){this._transport.close()}async _sendRequest(e,t){const n=this._formatRequest(e),r=await this._encrypt(n),i="undefined"!==typeof(null===t||void 0===t?void 0:t.topic)?t.topic:this.peerId,o=JSON.stringify(r),s="undefined"!==typeof(null===t||void 0===t?void 0:t.forcePushNotification)?!t.forcePushNotification:function(e){return!!e.method.startsWith("wc_")||!R.includes(e.method)}(n);this._transport.send(o,i,s)}async _sendResponse(e){const t=await this._encrypt(e),n=this.peerId,r=JSON.stringify(t);this._transport.send(r,n,!0)}async _sendSessionRequest(e,t,n){this._sendRequest(e,n),this._subscribeToSessionResponse(e.id,t)}_sendCallRequest(e,t){return this._sendRequest(e,t),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:t}]}),this._subscribeToCallResponse(e.id)}_formatRequest(e){if("undefined"===typeof e.method)throw new Error('JSON RPC request must have valid "method" value');return{id:"undefined"===typeof e.id?he():e.id,jsonrpc:"2.0",method:e.method,params:"undefined"===typeof e.params?[]:e.params}}_formatResponse(e){if("undefined"===typeof e.id)throw new Error('JSON RPC request must have valid "id" value');const t={id:e.id,jsonrpc:"2.0"};if(be(e)){const n=function(e){const t=e.message||"Failed or Rejected Request";let n=-32e3;if(e&&!e.code)switch(t){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}const r={code:n,message:t};return e.data&&(r.data=e.data),r}(e.error);return Object.assign(Object.assign(Object.assign({},t),e),{error:n})}if(me(e)){return Object.assign(Object.assign({},t),e)}throw new Error(Me)}_handleSessionDisconnect(e){const t=e||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),M(P)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:t}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(e,t){t&&t.approved?(this._connected?(t.chainId&&(this.chainId=t.chainId),t.accounts&&(this.accounts=t.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,t.chainId&&(this.chainId=t.chainId),t.accounts&&(this.accounts=t.accounts),t.peerId&&!this.peerId&&(this.peerId=t.peerId),t.peerMeta&&!this.peerMeta&&(this.peerMeta=t.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(e)}async _handleIncomingMessages(e){if(![this.clientId,this.handshakeTopic].includes(e.topic))return;let t;try{t=JSON.parse(e.payload)}catch(r){return}const n=await this._decrypt(t);n&&this._eventManager.trigger(n)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(e,t){this.on(`response:${e}`,t)}_subscribeToSessionResponse(e,t){this._subscribeToResponse(e,((e,n)=>{e?this._handleSessionResponse(e.message):me(n)?this._handleSessionResponse(t,n.result):n.error&&n.error.message?this._handleSessionResponse(n.error.message):this._handleSessionResponse(t)}))}_subscribeToCallResponse(e){return new Promise(((t,n)=>{this._subscribeToResponse(e,((e,r)=>{e?n(e):me(r)?t(r.result):r.error&&r.error.message?n(r.error):n(new Error(Me))}))}))}_subscribeToInternalEvents(){this.on("display_uri",(()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,(()=>{this._eventManager.trigger({event:"modal_closed",params:[]})}),this._qrcodeModalOptions)})),this.on("connect",(()=>{this._qrcodeModal&&this._qrcodeModal.close()})),this.on("call_request_sent",((e,t)=>{const{request:n}=t.params[0];if(x()&&this._signingMethods.includes(n.method)){const e=T(P);e&&(window.location.href=e.href)}})),this.on("wc_sessionRequest",((e,t)=>{e&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:e.toString()}]}),this.handshakeId=t.id,this.peerId=t.params[0].peerId,this.peerMeta=t.params[0].peerMeta;const n=Object.assign(Object.assign({},t),{method:"session_request"});this._eventManager.trigger(n)})),this.on("wc_sessionUpdate",((e,t)=>{e&&this._handleSessionResponse(e.message),this._handleSessionResponse("Session disconnected",t.params[0])}))}_initTransport(){this._transport.on("message",(e=>this._handleIncomingMessages(e))),this._transport.on("open",(()=>this._eventManager.trigger({event:"transport_open",params:[]}))),this._transport.on("close",(()=>this._eventManager.trigger({event:"transport_close",params:[]}))),this._transport.on("error",(()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]}))),this._transport.open()}_formatUri(){return`${this.protocol}:${this.handshakeTopic}@${this.version}?bridge=${encodeURIComponent(this.bridge)}&key=${this.key}`}_parseUri(e){const t=function(e){const t=e.indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=function(e){const t=e.split("@");return{handshakeTopic:t[0],version:parseInt(t[1],10)}}(e.substring(t+1,n)),o=function(e){const t=Ee(e);return{key:t.key||"",bridge:t.bridge||""}}("undefined"!==typeof n?e.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}(e);if(t.protocol===this.protocol){if(!t.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const e=t.handshakeTopic;if(!t.bridge)throw Error("Invalid or missing bridge url parameter value");const n=decodeURIComponent(t.bridge);if(!t.key)throw Error("Invalid or missing key parameter value");return{handshakeTopic:e,bridge:n,key:t.key}}throw new Error("URI format is invalid")}async _generateKey(){if(this._cryptoLib){return await this._cryptoLib.generateKey()}return null}async _encrypt(e){const t=this._key;if(this._cryptoLib&&t){return await this._cryptoLib.encrypt(e,t)}return null}async _decrypt(e){const t=this._key;if(this._cryptoLib&&t){return await this._cryptoLib.decrypt(e,t)}return null}_getStorageSession(){let e=null;return this._sessionStorage&&(e=this._sessionStorage.getSession()),e}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(e){if(!e.url||"string"!==typeof e.url)throw Error("Invalid or missing pushServerOpts.url parameter value");if(!e.type||"string"!==typeof e.type)throw Error("Invalid or missing pushServerOpts.type parameter value");if(!e.token||"string"!==typeof e.token)throw Error("Invalid or missing pushServerOpts.token parameter value");const t={bridge:this.bridge,topic:this.clientId,type:e.type,token:e.token,peerName:"",language:e.language||""};this.on("connect",(async(n,r)=>{if(n)throw n;if(e.peerMeta){const e=r.params[0].peerMeta.name;t.peerName=e}try{const n=await fetch(`${e.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)});if(!(await n.json()).success)throw Error("Failed to register in Push Server")}catch(n){throw Error("Failed to register in Push Server")}}))}};const De="AES-CBC",Ue="HMAC";async function je(e,t="AES-CBC"){return ue.getSubtleCrypto().importKey("raw",e,function(e){return e===De?{length:256,name:De}:{hash:{name:"SHA-256"},name:Ue}}(t),!0,function(e){return e===De?["encrypt","decrypt"]:["sign","verify"]}(t))}function Fe(e,t,n){return async function(e,t,n){const r=ue.getSubtleCrypto(),i=await je(t,De),o=await r.encrypt({iv:e,name:De},i,n);return new Uint8Array(o)}(e,t,n)}function Ve(e,t,n){return async function(e,t,n){const r=ue.getSubtleCrypto(),i=await je(t,De),o=await r.decrypt({iv:e,name:De},i,n);return new Uint8Array(o)}(e,t,n)}async function qe(e,t){const n=await async function(e,t){const n=ue.getSubtleCrypto(),r=await je(e,Ue),i=await n.sign({length:256,name:Ue},r,t);return new Uint8Array(i)}(e,t);return n}async function ze(e){const t=function(e){return ue.getBrowerCrypto().getRandomValues(new Uint8Array(e))}((e||256)/8);return q(W(t)).buffer}async function He(e,t){const n=X(e.data),r=X(e.iv),i=G(X(e.hmac),!1),o=$(n,r),s=G(await qe(t,o),!1);return te(i)===te(s)}async function We(e,t,n){const r=q(oe(t)),i=q(oe(n||await ze(128))),o=G(i,!1),s=J(JSON.stringify(e)),a=await Fe(i,r,s),c=G(a,!1),u=$(a,i);return{data:c,hmac:G(await qe(r,u),!1),iv:o}}async function Ge(e,t){const n=q(oe(t));if(!n)throw new Error("Missing key: required for decryption");if(!(await He(e,n)))return null;const r=X(e.data),i=X(e.iv),o=Z(await Ve(i,n,r));let s;try{s=JSON.parse(o)}catch(a){return null}return s}var Ze=class extends Le{constructor(e,t){super({cryptoLib:r,connectorOpts:e,pushServerOpts:t})}}},93548:function(e,t,n){"use strict";const r=n(79742),i=n(80645),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},84730:function(e){"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!==typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,c=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch(k){o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=p[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modrn(l).toString(e);n=(d=d.idivn(l)).isZero()?g+n:f[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function b(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(e,t,n){return b(e,t,n)}function v(e,t){this.x=e,this.y=t}Math.imul||(m=g),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?g(this,e,t):n<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},v.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new C(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}x.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(S,x),S.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new A;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return w[e]=t,t},C.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},C.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},C.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},C.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},C.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},C.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},C.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},C.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},C.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new I(e)},i(I,C),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},34537:function(e){"use strict";e.exports=function(e,t){var n=new Array(arguments.length-1),r=0,i=2,o=!0;for(;i1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),i=new Array(123),o=0;o<64;)i[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,n){for(var i,o=null,s=[],a=0,c=0;t>2],i=(3&u)<<4,c=1;break;case 1:s[a++]=r[i|u>>4],i=(15&u)<<2,c=2;break;case 2:s[a++]=r[i|u>>6],s[a++]=r[63&u],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=r[i],s[a++]=61,1===c&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";n.decode=function(e,t,n){for(var r,o=n,a=0,c=0;c1)break;if(void 0===(u=i[u]))throw Error(s);switch(a){case 0:r=u,a=1;break;case 1:t[n++]=r<<2|(48&u)>>4,r=u,a=2;break;case 2:t[n++]=(15&r)<<4|(60&u)>>2,r=u,a=3;break;case 3:t[n++]=(3&r)<<6|u,a=0}}if(1===a)throw Error(s);return n-o},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},19211:function(e){"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,r)}}function s(e,t,n){var r=e(t,n),i=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,r),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function a(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:o,e.writeDoubleBE=r?o:i,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,n,r,i,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,i,o+t),e(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))e(0,i,o+t),e(2146959360,i,o+n);else if(r>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+n);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+n);else{var c=Math.floor(Math.log(r)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=r*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+n)}}}function s(e,t,n,r,i){var o=e(r,i+t),s=e(r,i+n),a=2*(s>>31)+1,c=s>>>20&2047,u=4294967296*(1048575&s)+o;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function n(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function r(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},67199:function(module){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},76662:function(e){"use strict";e.exports=function(e,t,n){var r=n||8192,i=r>>>1,o=null,s=r;return function(n){if(n<1||n>i)return e(n);s+n>r&&(o=e(r),s=0);var a=t.call(o,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},94997:function(e,t){"use strict";var n=t;n.length=function(e){for(var t=0,n=0,r=0;r191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},n.write=function(e,t,n){for(var r,i,o=n,s=0;s>6|192,t[n++]=63&r|128):55296===(64512&r)&&56320===(64512&(i=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&i),++s,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}},55664:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(58875);n(45697);var i=n(67294);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n=0;r-=1)this.handlers[r].called||(this.handlers[r].called=!0,this.handlers[r](e));for(var i=n;i>=0;i-=1)this.handlers[i].called=!1}else(0,this.handlers[n])(e)}},{key:"hasHandlers",value:function(){return this.handlers.length>0}},{key:"removeHandlers",value:function(t){for(var n=[],r=this.handlers.length,i=0;i0;var t=this.handlerSets.get(e);return!!t&&t.hasHandlers()}},{key:"removeHandlers",value:function(t,n){var r=g(this.handlerSets);if(!r.has(t))return new e(this.poolName,r);var i=r.get(t).removeHandlers(n);return i.hasHandlers()?r.set(t,i):r.delete(t),new e(this.poolName,r)}}]),e}();u(y,"createByType",(function(e,t,n){var r=new Map;return r.set(t,new p(n)),new y(e,r)}));var v=function(){function e(t){var n=this;s(this,e),u(this,"handlers",new Map),u(this,"pools",new Map),u(this,"target",void 0),u(this,"createEmitter",(function(e){return function(t){n.pools.forEach((function(n){n.dispatchEvent(e,t)}))}})),this.target=t}return c(e,[{key:"addHandlers",value:function(e,t,n){if(this.pools.has(e)){var r=this.pools.get(e);this.pools.set(e,r.addHandlers(t,n))}else this.pools.set(e,y.createByType(e,t,n));this.handlers.has(t)||this.addTargetHandler(t)}},{key:"hasHandlers",value:function(){return this.handlers.size>0}},{key:"removeHandlers",value:function(e,t,n){if(this.pools.has(e)){var r=this.pools.get(e).removeHandlers(t,n);r.hasHandlers()?this.pools.set(e,r):this.pools.delete(e);var i=!1;this.pools.forEach((function(e){return i=i||e.hasHandlers(t)})),i||this.removeTargetHandler(t)}}},{key:"addTargetHandler",value:function(e){var t=this.createEmitter(e);this.handlers.set(e,t),this.target.addEventListener(e,t,!0)}},{key:"removeTargetHandler",value:function(e){this.handlers.has(e)&&(this.target.removeEventListener(e,this.handlers.get(e),!0),this.handlers.delete(e))}}]),e}(),w=function(){function e(){var t=this;s(this,e),u(this,"targets",new Map),u(this,"getTarget",(function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=b(e);if(t.targets.has(r))return t.targets.get(r);if(!n)return null;var i=new v(r);return t.targets.set(r,i),i})),u(this,"removeTarget",(function(e){t.targets.delete(b(e))}))}return c(e,[{key:"sub",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.canUseDOM){var i=n.target,o=void 0===i?document:i,s=n.pool,a=void 0===s?"default":s;this.getTarget(o).addHandlers(a,e,m(t))}}},{key:"unsub",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.canUseDOM){var i=n.target,o=void 0===i?document:i,s=n.pool,a=void 0===s?"default":s,c=this.getTarget(o,!1);c&&(c.removeHandlers(a,e,m(t)),c.hasHandlers()||this.removeTarget(o))}}}]),e}(),x=new w,S=function(e){function t(){return s(this,t),h(this,d(t).apply(this,arguments))}return l(t,i.PureComponent),c(t,[{key:"componentDidMount",value:function(){this.subscribe(this.props)}},{key:"componentDidUpdate",value:function(e){this.unsubscribe(e),this.subscribe(this.props)}},{key:"componentWillUnmount",value:function(){this.unsubscribe(this.props)}},{key:"subscribe",value:function(e){var t=e.name,n=e.on,r=e.pool,i=e.target;x.sub(t,n,{pool:r,target:i})}},{key:"unsubscribe",value:function(e){var t=e.name,n=e.on,r=e.pool,i=e.target;x.unsub(t,n,{pool:r,target:i})}},{key:"render",value:function(){return null}}]),t}();u(S,"defaultProps",{pool:"default",target:"document"}),S.propTypes={},t.instance=x,t.default=S},9695:function(e,t,n){"use strict";var r;r=n(55664),e.exports=r.default,e.exports.instance=r.instance},98099:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(97117);function i(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}function o(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}function d(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}function f(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),l(e/4294967296>>>0,t,n),l(e>>>0,t,n+4),t}function h(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),d(e>>>0,t,n),d(e/4294967296>>>0,t,n+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=d,t.writeInt32LE=d,t.readInt64BE=function(e,t){void 0===t&&(t=0);var n=s(e,t),r=s(e,t+4);return 4294967296*n+r-4294967296*(r>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var n=c(e,t);return 4294967296*c(e,t+4)+n-4294967296*(n>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var n=u(e,t);return 4294967296*u(e,t+4)+n},t.writeUint64BE=f,t.writeInt64BE=f,t.writeUint64LE=h,t.writeInt64LE=h,t.readUintBE=function(e,t,n){if(void 0===n&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,i=1,o=e/8+n-1;o>=n;o--)r+=t[o]*i,i*=256;return r},t.readUintLE=function(e,t,n){if(void 0===n&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,i=1,o=n;o=i;s--)n[s]=t/o&255,o*=256;return n},t.writeUintLE=function(e,t,n,i){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!r.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s>>16|O<<16)|0)>>>20|E<<12,_=(_^=T=T+(R=(R^=x=x+_|0)>>>16|R<<16)|0)>>>20|_<<12,C=(C^=M=M+(N=(N^=S=S+C|0)>>>16|N<<16)|0)>>>20|C<<12,I=(I^=P=P+(B=(B^=A=A+I|0)>>>16|B<<16)|0)>>>20|I<<12,C=(C^=M=M+(N=(N^=S=S+C|0)>>>24|N<<8)|0)>>>25|C<<7,I=(I^=P=P+(B=(B^=A=A+I|0)>>>24|B<<8)|0)>>>25|I<<7,_=(_^=T=T+(R=(R^=x=x+_|0)>>>24|R<<8)|0)>>>25|_<<7,E=(E^=k=k+(O=(O^=w=w+E|0)>>>24|O<<8)|0)>>>25|E<<7,_=(_^=M=M+(B=(B^=w=w+_|0)>>>16|B<<16)|0)>>>20|_<<12,C=(C^=P=P+(O=(O^=x=x+C|0)>>>16|O<<16)|0)>>>20|C<<12,I=(I^=k=k+(R=(R^=S=S+I|0)>>>16|R<<16)|0)>>>20|I<<12,E=(E^=T=T+(N=(N^=A=A+E|0)>>>16|N<<16)|0)>>>20|E<<12,I=(I^=k=k+(R=(R^=S=S+I|0)>>>24|R<<8)|0)>>>25|I<<7,E=(E^=T=T+(N=(N^=A=A+E|0)>>>24|N<<8)|0)>>>25|E<<7,C=(C^=P=P+(O=(O^=x=x+C|0)>>>24|O<<8)|0)>>>25|C<<7,_=(_^=M=M+(B=(B^=w=w+_|0)>>>24|B<<8)|0)>>>25|_<<7;r.writeUint32LE(w+i|0,e,0),r.writeUint32LE(x+o|0,e,4),r.writeUint32LE(S+s|0,e,8),r.writeUint32LE(A+a|0,e,12),r.writeUint32LE(E+c|0,e,16),r.writeUint32LE(_+u|0,e,20),r.writeUint32LE(C+l|0,e,24),r.writeUint32LE(I+d|0,e,28),r.writeUint32LE(k+f|0,e,32),r.writeUint32LE(T+h|0,e,36),r.writeUint32LE(M+p|0,e,40),r.writeUint32LE(P+g|0,e,44),r.writeUint32LE(O+m|0,e,48),r.writeUint32LE(R+b|0,e,52),r.writeUint32LE(N+y|0,e,56),r.writeUint32LE(B+v|0,e,60)}function s(e,t,n,r,s){if(void 0===s&&(s=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(r.length>>=8,t++;if(r>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=s,t.stream=function(e,t,n,r){return void 0===r&&(r=0),i.wipe(n),s(e,t,n,n,r)}},15501:function(e,t,n){"use strict";var r=n(25439),i=n(63027),o=n(17309),s=n(98099),a=n(4153);t.Cv=32,t.WH=12,t.pg=16;var c=new Uint8Array(16),u=function(){function e(e){if(this.nonceLength=t.WH,this.tagLength=t.pg,e.length!==t.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);r.stream(this._key,s,a,4);var c,u=t.length+this.tagLength;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(u);return r.streamXOR(this._key,s,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),n),o.wipe(s),c},e.prototype.open=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&a.update(c.subarray(r.length%16))),a.update(n),n.length%16>0&&a.update(c.subarray(n.length%16));var u=new Uint8Array(8);r&&s.writeUint64LE(r.length,u),a.update(u),s.writeUint64LE(n.length,u),a.update(u);for(var l=a.digest(),d=0;d>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,n){return~(e-1)&t|e-1&n},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=n,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==n(e,t)}},31050:function(e,t,n){"use strict";t.Xx=t._w=t.aP=t.KS=t.jQ=void 0;const r=n(31416),i=n(93350),o=n(17309);function s(e){const t=new Float64Array(16);if(e)for(let n=0;n>16&1),n[t-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,m(r,n,1-e)}for(let i=0;i<16;i++)e[2*i]=255&r[i],e[2*i+1]=r[i]>>8}function y(e,t){let n=0;for(let r=0;r<32;r++)n|=e[r]^t[r];return(1&n-1>>>8)-1}function v(e,t){const n=new Uint8Array(32),r=new Uint8Array(32);return b(n,e),b(r,t),y(n,r)}function w(e){const t=new Uint8Array(32);return b(t,e),1&t[0]}function x(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function S(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function A(e,t,n){let r,i,o=0,s=0,a=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,g=0,m=0,b=0,y=0,v=0,w=0,x=0,S=0,A=0,E=0,_=0,C=0,I=0,k=0,T=0,M=0,P=0,O=0,R=0,N=0,B=0,L=n[0],D=n[1],U=n[2],j=n[3],F=n[4],V=n[5],q=n[6],z=n[7],H=n[8],W=n[9],G=n[10],Z=n[11],K=n[12],X=n[13],Y=n[14],J=n[15];r=t[0],o+=r*L,s+=r*D,a+=r*U,c+=r*j,u+=r*F,l+=r*V,d+=r*q,f+=r*z,h+=r*H,p+=r*W,g+=r*G,m+=r*Z,b+=r*K,y+=r*X,v+=r*Y,w+=r*J,r=t[1],s+=r*L,a+=r*D,c+=r*U,u+=r*j,l+=r*F,d+=r*V,f+=r*q,h+=r*z,p+=r*H,g+=r*W,m+=r*G,b+=r*Z,y+=r*K,v+=r*X,w+=r*Y,x+=r*J,r=t[2],a+=r*L,c+=r*D,u+=r*U,l+=r*j,d+=r*F,f+=r*V,h+=r*q,p+=r*z,g+=r*H,m+=r*W,b+=r*G,y+=r*Z,v+=r*K,w+=r*X,x+=r*Y,S+=r*J,r=t[3],c+=r*L,u+=r*D,l+=r*U,d+=r*j,f+=r*F,h+=r*V,p+=r*q,g+=r*z,m+=r*H,b+=r*W,y+=r*G,v+=r*Z,w+=r*K,x+=r*X,S+=r*Y,A+=r*J,r=t[4],u+=r*L,l+=r*D,d+=r*U,f+=r*j,h+=r*F,p+=r*V,g+=r*q,m+=r*z,b+=r*H,y+=r*W,v+=r*G,w+=r*Z,x+=r*K,S+=r*X,A+=r*Y,E+=r*J,r=t[5],l+=r*L,d+=r*D,f+=r*U,h+=r*j,p+=r*F,g+=r*V,m+=r*q,b+=r*z,y+=r*H,v+=r*W,w+=r*G,x+=r*Z,S+=r*K,A+=r*X,E+=r*Y,_+=r*J,r=t[6],d+=r*L,f+=r*D,h+=r*U,p+=r*j,g+=r*F,m+=r*V,b+=r*q,y+=r*z,v+=r*H,w+=r*W,x+=r*G,S+=r*Z,A+=r*K,E+=r*X,_+=r*Y,C+=r*J,r=t[7],f+=r*L,h+=r*D,p+=r*U,g+=r*j,m+=r*F,b+=r*V,y+=r*q,v+=r*z,w+=r*H,x+=r*W,S+=r*G,A+=r*Z,E+=r*K,_+=r*X,C+=r*Y,I+=r*J,r=t[8],h+=r*L,p+=r*D,g+=r*U,m+=r*j,b+=r*F,y+=r*V,v+=r*q,w+=r*z,x+=r*H,S+=r*W,A+=r*G,E+=r*Z,_+=r*K,C+=r*X,I+=r*Y,k+=r*J,r=t[9],p+=r*L,g+=r*D,m+=r*U,b+=r*j,y+=r*F,v+=r*V,w+=r*q,x+=r*z,S+=r*H,A+=r*W,E+=r*G,_+=r*Z,C+=r*K,I+=r*X,k+=r*Y,T+=r*J,r=t[10],g+=r*L,m+=r*D,b+=r*U,y+=r*j,v+=r*F,w+=r*V,x+=r*q,S+=r*z,A+=r*H,E+=r*W,_+=r*G,C+=r*Z,I+=r*K,k+=r*X,T+=r*Y,M+=r*J,r=t[11],m+=r*L,b+=r*D,y+=r*U,v+=r*j,w+=r*F,x+=r*V,S+=r*q,A+=r*z,E+=r*H,_+=r*W,C+=r*G,I+=r*Z,k+=r*K,T+=r*X,M+=r*Y,P+=r*J,r=t[12],b+=r*L,y+=r*D,v+=r*U,w+=r*j,x+=r*F,S+=r*V,A+=r*q,E+=r*z,_+=r*H,C+=r*W,I+=r*G,k+=r*Z,T+=r*K,M+=r*X,P+=r*Y,O+=r*J,r=t[13],y+=r*L,v+=r*D,w+=r*U,x+=r*j,S+=r*F,A+=r*V,E+=r*q,_+=r*z,C+=r*H,I+=r*W,k+=r*G,T+=r*Z,M+=r*K,P+=r*X,O+=r*Y,R+=r*J,r=t[14],v+=r*L,w+=r*D,x+=r*U,S+=r*j,A+=r*F,E+=r*V,_+=r*q,C+=r*z,I+=r*H,k+=r*W,T+=r*G,M+=r*Z,P+=r*K,O+=r*X,R+=r*Y,N+=r*J,r=t[15],w+=r*L,x+=r*D,S+=r*U,A+=r*j,E+=r*F,_+=r*V,C+=r*q,I+=r*z,k+=r*H,T+=r*W,M+=r*G,P+=r*Z,O+=r*K,R+=r*X,N+=r*Y,B+=r*J,o+=38*x,s+=38*S,a+=38*A,c+=38*E,u+=38*_,l+=38*C,d+=38*I,f+=38*k,h+=38*T,p+=38*M,g+=38*P,m+=38*O,b+=38*R,y+=38*N,v+=38*B,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=g,e[11]=m,e[12]=b,e[13]=y,e[14]=v,e[15]=w}function E(e,t){A(e,t,t)}function _(e,t){const n=s();let r;for(r=0;r<16;r++)n[r]=t[r];for(r=253;r>=0;r--)E(n,n),2!==r&&4!==r&&A(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function C(e,t){const n=s(),r=s(),i=s(),o=s(),a=s(),c=s(),u=s(),d=s(),f=s();S(n,e[1],e[0]),S(f,t[1],t[0]),A(n,n,f),x(r,e[0],e[1]),x(f,t[0],t[1]),A(r,r,f),A(i,e[3],t[3]),A(i,i,l),A(o,e[2],t[2]),x(o,o,o),S(a,r,n),S(c,o,i),x(u,o,i),x(d,r,n),A(e[0],a,c),A(e[1],d,u),A(e[2],u,c),A(e[3],a,d)}function I(e,t,n){for(let r=0;r<4;r++)m(e[r],t[r],n)}function k(e,t){const n=s(),r=s(),i=s();_(i,t[2]),A(n,t[0],i),A(r,t[1],i),b(e,r),e[31]^=w(n)<<7}function T(e,t,n){p(e[0],a),p(e[1],c),p(e[2],c),p(e[3],a);for(let r=255;r>=0;--r){const i=n[r/8|0]>>(7&r)&1;I(e,t,i),C(t,e),C(e,e),I(e,t,i)}}function M(e,t){const n=[s(),s(),s(),s()];p(n[0],d),p(n[1],f),p(n[2],c),A(n[3],d,f),T(e,n,t)}function P(e){if(e.length!==t.aP)throw new Error(`ed25519: seed must be ${t.aP} bytes`);const n=(0,i.hash)(e);n[0]&=248,n[31]&=127,n[31]|=64;const r=new Uint8Array(32),o=[s(),s(),s(),s()];M(o,n),k(r,o);const a=new Uint8Array(64);return a.set(e),a.set(r,32),{publicKey:r,secretKey:a}}t._w=P;const O=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function R(e,t){let n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>4)*O[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*O[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function N(e){const t=new Float64Array(64);for(let n=0;n<64;n++)t[n]=e[n];for(let n=0;n<64;n++)e[n]=0;R(e,t)}function B(e,t){const n=s(),r=s(),i=s(),o=s(),l=s(),d=s(),f=s();return p(e[2],c),function(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}(e[1],t),E(i,e[1]),A(o,i,u),S(i,i,e[2]),x(o,e[2],o),E(l,o),E(d,l),A(f,d,l),A(n,f,i),A(n,n,o),function(e,t){const n=s();let r;for(r=0;r<16;r++)n[r]=t[r];for(r=250;r>=0;r--)E(n,n),1!==r&&A(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}(n,n),A(n,n,i),A(n,n,o),A(n,n,o),A(e[0],n,o),E(r,e[0]),A(r,r,o),v(r,i)&&A(e[0],e[0],h),E(r,e[0]),A(r,r,o),v(r,i)?-1:(w(e[0])===t[31]>>7&&S(e[0],a,e[0]),A(e[3],e[0],e[1]),0)}t.Xx=function(e,t){const n=new Float64Array(64),r=[s(),s(),s(),s()],o=(0,i.hash)(e.subarray(0,32));o[0]&=248,o[31]&=127,o[31]|=64;const a=new Uint8Array(64);a.set(o.subarray(32),32);const c=new i.SHA512;c.update(a.subarray(32)),c.update(t);const u=c.digest();c.clean(),N(u),M(r,u),k(a,r),c.reset(),c.update(a.subarray(0,32)),c.update(e.subarray(32)),c.update(t);const l=c.digest();N(l);for(let i=0;i<32;i++)n[i]=u[i];for(let i=0;i<32;i++)for(let e=0;e<32;e++)n[i+e]+=l[i]*o[e];return R(a.subarray(32),n),a}},79984:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return"undefined"!==typeof e.saveState&&"undefined"!==typeof e.restoreState&&"undefined"!==typeof e.cleanSavedState}},512:function(e,t,n){"use strict";var r=n(25629),i=n(17309),o=function(){function e(e,t,n,i){void 0===n&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=r.hmac(this._hash,n,t);this._hmac=new r.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;nthis.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var i=0;i>>16&65535)*r+n*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},63027:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4153),i=n(17309);t.DIGEST_LENGTH=16;var o=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var n=e[0]|e[1]<<8;this._r[0]=8191&n;var r=e[2]|e[3]<<8;this._r[1]=8191&(n>>>13|r<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(r>>>10|i<<6);var o=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=e[8]|e[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var u=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,n){for(var r=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],d=this._h[7],f=this._h[8],h=this._h[9],p=this._r[0],g=this._r[1],m=this._r[2],b=this._r[3],y=this._r[4],v=this._r[5],w=this._r[6],x=this._r[7],S=this._r[8],A=this._r[9];n>=16;){var E=e[t+0]|e[t+1]<<8;i+=8191&E;var _=e[t+2]|e[t+3]<<8;o+=8191&(E>>>13|_<<3);var C=e[t+4]|e[t+5]<<8;s+=8191&(_>>>10|C<<6);var I=e[t+6]|e[t+7]<<8;a+=8191&(C>>>7|I<<9);var k=e[t+8]|e[t+9]<<8;c+=8191&(I>>>4|k<<12),u+=k>>>1&8191;var T=e[t+10]|e[t+11]<<8;l+=8191&(k>>>14|T<<2);var M=e[t+12]|e[t+13]<<8;d+=8191&(T>>>11|M<<5);var P=e[t+14]|e[t+15]<<8,O=0,R=O;R+=i*p,R+=o*(5*A),R+=s*(5*S),R+=a*(5*x),O=(R+=c*(5*w))>>>13,R&=8191,R+=u*(5*v),R+=l*(5*y),R+=d*(5*b),R+=(f+=8191&(M>>>8|P<<8))*(5*m);var N=O+=(R+=(h+=P>>>5|r)*(5*g))>>>13;N+=i*g,N+=o*p,N+=s*(5*A),N+=a*(5*S),O=(N+=c*(5*x))>>>13,N&=8191,N+=u*(5*w),N+=l*(5*v),N+=d*(5*y),N+=f*(5*b),O+=(N+=h*(5*m))>>>13,N&=8191;var B=O;B+=i*m,B+=o*g,B+=s*p,B+=a*(5*A),O=(B+=c*(5*S))>>>13,B&=8191,B+=u*(5*x),B+=l*(5*w),B+=d*(5*v),B+=f*(5*y);var L=O+=(B+=h*(5*b))>>>13;L+=i*b,L+=o*m,L+=s*g,L+=a*p,O=(L+=c*(5*A))>>>13,L&=8191,L+=u*(5*S),L+=l*(5*x),L+=d*(5*w),L+=f*(5*v);var D=O+=(L+=h*(5*y))>>>13;D+=i*y,D+=o*b,D+=s*m,D+=a*g,O=(D+=c*p)>>>13,D&=8191,D+=u*(5*A),D+=l*(5*S),D+=d*(5*x),D+=f*(5*w);var U=O+=(D+=h*(5*v))>>>13;U+=i*v,U+=o*y,U+=s*b,U+=a*m,O=(U+=c*g)>>>13,U&=8191,U+=u*p,U+=l*(5*A),U+=d*(5*S),U+=f*(5*x);var j=O+=(U+=h*(5*w))>>>13;j+=i*w,j+=o*v,j+=s*y,j+=a*b,O=(j+=c*m)>>>13,j&=8191,j+=u*g,j+=l*p,j+=d*(5*A),j+=f*(5*S);var F=O+=(j+=h*(5*x))>>>13;F+=i*x,F+=o*w,F+=s*v,F+=a*y,O=(F+=c*b)>>>13,F&=8191,F+=u*m,F+=l*g,F+=d*p,F+=f*(5*A);var V=O+=(F+=h*(5*S))>>>13;V+=i*S,V+=o*x,V+=s*w,V+=a*v,O=(V+=c*y)>>>13,V&=8191,V+=u*b,V+=l*m,V+=d*g,V+=f*p;var q=O+=(V+=h*(5*A))>>>13;q+=i*A,q+=o*S,q+=s*x,q+=a*w,O=(q+=c*v)>>>13,q&=8191,q+=u*y,q+=l*b,q+=d*m,q+=f*g,i=R=8191&(O=(O=((O+=(q+=h*p)>>>13)<<2)+O|0)+(R&=8191)|0),o=N+=O>>>=13,s=B&=8191,a=L&=8191,c=D&=8191,u=U&=8191,l=j&=8191,d=F&=8191,f=V&=8191,h=q&=8191,t+=16,n-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=d,this._h[8]=f,this._h[9]=h},e.prototype.finish=function(e,t){void 0===t&&(t=0);var n,r,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(n=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=n,n=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*n,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,s[0]=this._h[0]+5,n=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+n,n=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,r=(1^n)-1,o=0;o<10;o++)s[o]&=r;for(r=~r,o=0;o<10;o++)this._h[o]=this._h[o]&r|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,n=0,r=e.length;if(this._leftover){(t=16-this._leftover)>r&&(t=r);for(var i=0;i=16&&(t=r-r%16,this._blocks(e,n,t),n+=t,r-=t),r){for(i=0;i256)throw new Error("randomString charset is too long");let i="";const c=n.length,u=256-256%c;for(;e>0;){const t=s(Math.ceil(256*e/u),r);for(let r=0;r0;r++){const o=t[r];o0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=a(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.mE=o;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,n,i,o){for(;o>=64;){for(var a=t[0],c=t[1],u=t[2],l=t[3],d=t[4],f=t[5],h=t[6],p=t[7],g=0;g<16;g++){var m=i+4*g;e[g]=r.readUint32BE(n,m)}for(g=16;g<64;g++){var b=e[g-2],y=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,v=((b=e[g-15])>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;e[g]=(y+e[g-7]|0)+(v+e[g-16]|0)}for(g=0;g<64;g++){y=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&f^~d&h)|0)+(p+(s[g]+e[g]|0)|0)|0,v=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&u^c&u)|0;p=h,h=f,f=d,d=l+y|0,l=u,u=c,c=a,a=y+v|0}t[0]+=a,t[1]+=c,t[2]+=u,t[3]+=l,t[4]+=d,t[5]+=f,t[6]+=h,t[7]+=p,i+=64,o-=64}return i}t.vp=function(e){var t=new o;t.update(e);var n=t.digest();return t.clean(),n}},93350:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(98099),i=n(17309);t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},e.prototype.update=function(e,n){if(void 0===n&&(n=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var r=0;if(this._bytesHashed+=n,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],n--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(n>=this.blockSize&&(r=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,r,n),n%=this.blockSize);n>0;)this._buffer[this._bufferLength++]=e[r++],n--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%128<112?128:256;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.stateHi),i.wipe(e.stateLo),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA512=o;var s=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(e,t,n,i,o,a,c){for(var u,l,d,f,h,p,g,m,b=n[0],y=n[1],v=n[2],w=n[3],x=n[4],S=n[5],A=n[6],E=n[7],_=i[0],C=i[1],I=i[2],k=i[3],T=i[4],M=i[5],P=i[6],O=i[7];c>=128;){for(var R=0;R<16;R++){var N=8*R+a;e[R]=r.readUint32BE(o,N),t[R]=r.readUint32BE(o,N+4)}for(R=0;R<80;R++){var B,L,D=b,U=y,j=v,F=w,V=x,q=S,z=A,H=_,W=C,G=I,Z=k,K=T,X=M,Y=P;if(h=65535&(l=O),p=l>>>16,g=65535&(u=E),m=u>>>16,h+=65535&(l=(T>>>14|x<<18)^(T>>>18|x<<14)^(x>>>9|T<<23)),p+=l>>>16,g+=65535&(u=(x>>>14|T<<18)^(x>>>18|T<<14)^(T>>>9|x<<23)),m+=u>>>16,h+=65535&(l=T&M^~T&P),p+=l>>>16,g+=65535&(u=x&S^~x&A),m+=u>>>16,u=s[2*R],h+=65535&(l=s[2*R+1]),p+=l>>>16,g+=65535&u,m+=u>>>16,u=e[R%16],p+=(l=t[R%16])>>>16,g+=65535&u,m+=u>>>16,g+=(p+=(h+=65535&l)>>>16)>>>16,h=65535&(l=f=65535&h|p<<16),p=l>>>16,g=65535&(u=d=65535&g|(m+=g>>>16)<<16),m=u>>>16,h+=65535&(l=(_>>>28|b<<4)^(b>>>2|_<<30)^(b>>>7|_<<25)),p+=l>>>16,g+=65535&(u=(b>>>28|_<<4)^(_>>>2|b<<30)^(_>>>7|b<<25)),m+=u>>>16,p+=(l=_&C^_&I^C&I)>>>16,g+=65535&(u=b&y^b&v^y&v),m+=u>>>16,B=65535&(g+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=g>>>16)<<16,L=65535&h|p<<16,h=65535&(l=Z),p=l>>>16,g=65535&(u=F),m=u>>>16,p+=(l=f)>>>16,g+=65535&(u=d),m+=u>>>16,y=D,v=U,w=j,x=F=65535&(g+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=g>>>16)<<16,S=V,A=q,E=z,b=B,C=H,I=W,k=G,T=Z=65535&h|p<<16,M=K,P=X,O=Y,_=L,R%16===15)for(N=0;N<16;N++)u=e[N],h=65535&(l=t[N]),p=l>>>16,g=65535&u,m=u>>>16,u=e[(N+9)%16],h+=65535&(l=t[(N+9)%16]),p+=l>>>16,g+=65535&u,m+=u>>>16,d=e[(N+1)%16],h+=65535&(l=((f=t[(N+1)%16])>>>1|d<<31)^(f>>>8|d<<24)^(f>>>7|d<<25)),p+=l>>>16,g+=65535&(u=(d>>>1|f<<31)^(d>>>8|f<<24)^d>>>7),m+=u>>>16,d=e[(N+14)%16],p+=(l=((f=t[(N+14)%16])>>>19|d<<13)^(d>>>29|f<<3)^(f>>>6|d<<26))>>>16,g+=65535&(u=(d>>>19|f<<13)^(f>>>29|d<<3)^d>>>6),m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,e[N]=65535&g|m<<16,t[N]=65535&h|p<<16}h=65535&(l=_),p=l>>>16,g=65535&(u=b),m=u>>>16,u=n[0],p+=(l=i[0])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[0]=b=65535&g|m<<16,i[0]=_=65535&h|p<<16,h=65535&(l=C),p=l>>>16,g=65535&(u=y),m=u>>>16,u=n[1],p+=(l=i[1])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[1]=y=65535&g|m<<16,i[1]=C=65535&h|p<<16,h=65535&(l=I),p=l>>>16,g=65535&(u=v),m=u>>>16,u=n[2],p+=(l=i[2])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[2]=v=65535&g|m<<16,i[2]=I=65535&h|p<<16,h=65535&(l=k),p=l>>>16,g=65535&(u=w),m=u>>>16,u=n[3],p+=(l=i[3])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[3]=w=65535&g|m<<16,i[3]=k=65535&h|p<<16,h=65535&(l=T),p=l>>>16,g=65535&(u=x),m=u>>>16,u=n[4],p+=(l=i[4])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[4]=x=65535&g|m<<16,i[4]=T=65535&h|p<<16,h=65535&(l=M),p=l>>>16,g=65535&(u=S),m=u>>>16,u=n[5],p+=(l=i[5])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[5]=S=65535&g|m<<16,i[5]=M=65535&h|p<<16,h=65535&(l=P),p=l>>>16,g=65535&(u=A),m=u>>>16,u=n[6],p+=(l=i[6])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[6]=A=65535&g|m<<16,i[6]=P=65535&h|p<<16,h=65535&(l=O),p=l>>>16,g=65535&(u=E),m=u>>>16,u=n[7],p+=(l=i[7])>>>16,g+=65535&u,m+=u>>>16,m+=(g+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[7]=E=65535&g|m<<16,i[7]=O=65535&h|p<<16,a+=128,c-=128}return a}t.hash=function(e){var t=new o;t.update(e);var n=t.digest();return t.clean(),n}},17309:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t=0;--o){const e=n[o>>>3]>>>(7&o)&1;u(i,s,e),u(p,g,e),l(m,i,p),d(i,i,p),l(p,s,g),d(s,s,g),h(g,m),h(b,i),f(i,p,i),f(p,s,m),l(m,i,p),d(i,i,p),h(s,i),d(p,g,b),f(i,p,a),l(i,i,g),f(p,p,i),f(i,g,b),f(g,s,r),h(s,m),u(i,s,e),u(p,g,e)}for(let o=0;o<16;o++)r[o+16]=i[o],r[o+32]=p[o],r[o+48]=s[o],r[o+64]=g[o];const y=r.subarray(32),v=r.subarray(16);!function(e,t){const n=o();for(let r=0;r<16;r++)n[r]=t[r];for(let r=253;r>=0;r--)h(n,n),2!==r&&4!==r&&f(n,n,t);for(let r=0;r<16;r++)e[r]=n[r]}(y,y),f(v,v,y);const w=new Uint8Array(32);return function(e,t){const n=o(),r=o();for(let i=0;i<16;i++)r[i]=t[i];c(r),c(r),c(r);for(let i=0;i<2;i++){n[0]=r[0]-65517;for(let t=1;t<15;t++)n[t]=r[t]-65535-(n[t-1]>>16&1),n[t-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,u(r,n,1-e)}for(let i=0;i<16;i++)e[2*i]=255&r[i],e[2*i+1]=r[i]>>8}(w,v),w}function g(e){return p(e,s)}function m(e){if(e.length!==t.KS)throw new Error(`x25519: seed must be ${t.KS} bytes`);const n=new Uint8Array(e);return{publicKey:g(n),secretKey:n}}t.Au=function(e){const t=(0,r.randomBytes)(32,e),n=m(t);return(0,i.wipe)(t),n},t.gi=function(e,n,r=!1){if(e.length!==t.kz)throw new Error("X25519: incorrect secret key length");if(n.length!==t.kz)throw new Error("X25519: incorrect public key length");const i=p(e,n);if(r){let e=0;for(let t=0;tr.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=r.getAttribute("content");if(e)return e}}return""}const i=function(){let t=n("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:n("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const n=e.getElementsByTagName("link"),r=[];for(let e=0;e-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=t.protocol+"//"+t.host;if(0===e.indexOf("/"))n+=e;else{const r=t.pathname.split("/");r.pop();n+=r.join("/")+"/"+e}r.push(n)}else if(0===e.indexOf("//")){const n=t.protocol+e;r.push(n)}else r.push(e)}}return r}(),name:i}}},40926:function(e,t,n){"use strict";function r(){return(null===n.g||void 0===n.g?void 0:n.g.crypto)||(null===n.g||void 0===n.g?void 0:n.g.msCrypto)||{}}function i(){const e=r();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=r,t.getSubtleCrypto=i,t.isBrowserCryptoAvailable=function(){return!!r()&&!!i()}},88618:function(e,t,n){"use strict";var r=n(34155);function i(){return"undefined"===typeof document&&"undefined"!==typeof navigator&&"ReactNative"===navigator.product}function o(){return"undefined"!==typeof r&&"undefined"!==typeof r.versions&&"undefined"!==typeof r.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=i,t.isNode=o,t.isBrowser=function(){return!i()&&!o()}},1468:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(40926),t),i(n(88618),t)},74235:function(e,t,n){"use strict";var r=t;r.version=n(97037).i8,r.utils=n(54569),r.rand=n(29931),r.curve=n(62247),r.curves=n(99876),r.ec=n(66618),r.eddsa=n(66908)},34791:function(e,t,n){"use strict";var r=n(13550),i=n(54569),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var n=e._getDoubles(),r=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+r[l];u.push(c)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var d=s[u];a(0!==d),c="affine"===e.type?d>0?c.mixedAdd(i[d-1>>1]):c.mixedAdd(i[-d-1>>1].neg()):d>0?c.add(i[d-1>>1]):c.add(i[-d-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,r,i){var a,c,u,l=this._wnafT1,d=this._wnafT2,f=this._wnafT3,h=0;for(a=0;a=1;a-=2){var g=a-1,m=a;if(1===l[g]&&1===l[m]){var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(n[g],n[m]);for(h=Math.max(v[0].length,h),f[g]=new Array(h),f[m]=new Array(h),c=0;c=0;a--){for(var E=0;a>=0;){var _=!0;for(c=0;c=0&&E++,S=S.dblp(E),a<0)break;for(c=0;c0?u=d[c][C-1>>1]:C<0&&(u=d[c][-C-1>>1].neg()),S="affine"===u.type?S.mixedAdd(u):S.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),s=o.redSub(n),a=r.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),d=s.redMul(o);return this.curve.point(c,u,d,l)},u.prototype._projDbl=function(){var e,t,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(c)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(r.redSub(c)),n=u.redMul(o))}else r=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(a.redISub(c)),n=r.redMul(o);return this.curve.point(e,t,n)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),s=i.redSub(r),a=i.redAdd(r),c=n.redAdd(t),u=o.redMul(s),l=a.redMul(c),d=o.redMul(c),f=s.redMul(a);return this.curve.point(u,l,f,d)},u.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(s.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(s.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},u.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},62247:function(e,t,n){"use strict";var r=t;r.base=n(34791),r.short=n(70690),r.mont=n(2856),r.edwards=n(44852)},2856:function(e,t,n){"use strict";var r=n(13550),i=n(35717),o=n(34791),s=n(54569);function a(e){o.call(this,"mont",e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,n){o.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(t,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),s=i.redMul(r),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},70690:function(e,t,n){"use strict";var r=n(54569),i=n(13550),o=n(35717),s=n(34791),a=r.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,n,r){s.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,n,r){s.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),n=new i(2).toRed(t).redInvm(),r=n.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,r,o,s,a,c,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),b=new i(1),y=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),l=m.sub(v.mul(p));var w=b.sub(v.mul(g));if(!r&&u.cmp(d)<0)t=c.neg(),n=p,r=u.neg(),o=l;else if(r&&2===++y)break;c=u,h=f,f=u,m=p,p=l,b=g,g=w}s=u.neg(),a=l;var x=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(x)>=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},u.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},99876:function(e,t,n){"use strict";var r,i=t,o=n(33715),s=n(62247),a=n(54569).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var n=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(47593)}catch(l){r=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},66618:function(e,t,n){"use strict";var r=n(13550),i=n(2156),o=n(54569),s=n(99876),a=n(29931),c=o.assert,u=n(96446),l=n(53302);function d(e){if(!(this instanceof d))return new d(e);"string"===typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=d,d.prototype.keyPair=function(e){return new u(this,e)},d.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(t.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},d.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,n,o){"object"===typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new r(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new r(1)),f=0;;f++){var h=o.k?o.k(f):new r(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new l({r:m,s:b,recoveryParam:y})}}}}}},d.prototype.verify=function(e,t,n,i){e=this._truncateToN(new r(e,16)),n=this.keyFromPublic(n,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),d)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),d)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},d.prototype.recoverPubKey=function(e,t,n,i){c((3&n)===n,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new r(e),a=t.r,u=t.s,d=1&n,f=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),d):this.curve.pointFromX(a,d);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),g=u.mul(h).umod(o);return this.g.mulAdd(p,a,g)},d.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new l(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},96446:function(e,t,n){"use strict";var r=n(13550),i=n(54569).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"===typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new r(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},53302:function(e,t,n){"use strict";var r=n(13550),i=n(54569),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;if(0===e[t.place])return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var o=c(e,n);if(!1===o)return!1;if(o+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var s=c(e,n);if(!1===s)return!1;if(0!==(128&e[n.place]))return!1;var u=e.slice(n.place,s+n.place);if(n.place+=s,2!==e[n.place++])return!1;var l=c(e,n);if(!1===l)return!1;if(e.length!==l+n.place)return!1;if(0!==(128&e[n.place]))return!1;var d=e.slice(n.place,l+n.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new r(u),this.s=new r(d),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=u(t),n=u(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];l(r,t.length),(r=r.concat(t)).push(2),l(r,n.length);var o=r.concat(n),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},66908:function(e,t,n){"use strict";var r=n(33715),i=n(99876),o=n(54569),s=o.assert,a=o.parseBytes,c=n(72791),u=n(93021);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=r.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,n){if(e=a(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(o>>1)-1?(o>>1)-c:c,s.isubn(a)):a=0,i[r]=a,s.iushrn(1)}return i},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0===(1&c)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==u?c:-c,n[0].push(s),a=0===(1&u)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==c?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},638:function(e,t,n){"use strict";function r(){return(null===n.g||void 0===n.g?void 0:n.g.crypto)||(null===n.g||void 0===n.g?void 0:n.g.msCrypto)||{}}function i(){const e=r();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=r,t.getSubtleCrypto=i,t.isBrowserCryptoAvailable=function(){return!!r()&&!!i()}},19066:function(e,t,n){"use strict";var r=n(34155);function i(){return"undefined"===typeof document&&"undefined"!==typeof navigator&&"ReactNative"===navigator.product}function o(){return"undefined"!==typeof r&&"undefined"!==typeof r.versions&&"undefined"!==typeof r.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=i,t.isNode=o,t.isBrowser=function(){return!i()&&!o()}},93109:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(70655);r.__exportStar(n(638),t),r.__exportStar(n(19066),t)},72030:function(e){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},43014:function(){},24080:function(e,t,n){"use strict";var r=t;r.version=n(98738).i8,r.utils=n(66583),r.rand=n(29931),r.curve=n(88759),r.curves=n(7589),r.ec=n(30701),r.eddsa=n(3389)},42392:function(e,t,n){"use strict";var r=n(13550),i=n(66583),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var n=e._getDoubles(),r=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+r[l];u.push(c)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var d=s[u];a(0!==d),c="affine"===e.type?d>0?c.mixedAdd(i[d-1>>1]):c.mixedAdd(i[-d-1>>1].neg()):d>0?c.add(i[d-1>>1]):c.add(i[-d-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,r,i){var a,c,u,l=this._wnafT1,d=this._wnafT2,f=this._wnafT3,h=0;for(a=0;a=1;a-=2){var g=a-1,m=a;if(1===l[g]&&1===l[m]){var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(n[g],n[m]);for(h=Math.max(v[0].length,h),f[g]=new Array(h),f[m]=new Array(h),c=0;c=0;a--){for(var E=0;a>=0;){var _=!0;for(c=0;c=0&&E++,S=S.dblp(E),a<0)break;for(c=0;c0?u=d[c][C-1>>1]:C<0&&(u=d[c][-C-1>>1].neg()),S="affine"===u.type?S.mixedAdd(u):S.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),s=o.redSub(n),a=r.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),d=s.redMul(o);return this.curve.point(c,u,d,l)},u.prototype._projDbl=function(){var e,t,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(c)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(r.redSub(c)),n=u.redMul(o))}else r=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(a.redISub(c)),n=r.redMul(o);return this.curve.point(e,t,n)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),s=i.redSub(r),a=i.redAdd(r),c=n.redAdd(t),u=o.redMul(s),l=a.redMul(c),d=o.redMul(c),f=s.redMul(a);return this.curve.point(u,l,f,d)},u.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(s.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(s.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},u.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},88759:function(e,t,n){"use strict";var r=t;r.base=n(42392),r.short=n(74930),r.mont=n(12283),r.edwards=n(58467)},12283:function(e,t,n){"use strict";var r=n(13550),i=n(35717),o=n(42392),s=n(66583);function a(e){o.call(this,"mont",e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,n){o.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(t,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),s=i.redMul(r),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},74930:function(e,t,n){"use strict";var r=n(66583),i=n(13550),o=n(35717),s=n(42392),a=r.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,n,r){s.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,n,r){s.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),n=new i(2).toRed(t).redInvm(),r=n.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,r,o,s,a,c,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),b=new i(1),y=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),l=m.sub(v.mul(p));var w=b.sub(v.mul(g));if(!r&&u.cmp(d)<0)t=c.neg(),n=p,r=u.neg(),o=l;else if(r&&2===++y)break;c=u,h=f,f=u,m=p,p=l,b=g,g=w}s=u.neg(),a=l;var x=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(x)>=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},u.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},7589:function(e,t,n){"use strict";var r,i=t,o=n(33715),s=n(88759),a=n(66583).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var n=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(45380)}catch(l){r=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},30701:function(e,t,n){"use strict";var r=n(13550),i=n(2156),o=n(66583),s=n(7589),a=n(29931),c=o.assert,u=n(6744),l=n(83005);function d(e){if(!(this instanceof d))return new d(e);"string"===typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=d,d.prototype.keyPair=function(e){return new u(this,e)},d.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(t.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},d.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,n,o){"object"===typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new r(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new r(1)),f=0;;f++){var h=o.k?o.k(f):new r(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new l({r:m,s:b,recoveryParam:y})}}}}}},d.prototype.verify=function(e,t,n,i){e=this._truncateToN(new r(e,16)),n=this.keyFromPublic(n,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),d)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),d)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},d.prototype.recoverPubKey=function(e,t,n,i){c((3&n)===n,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new r(e),a=t.r,u=t.s,d=1&n,f=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),d):this.curve.pointFromX(a,d);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),g=u.mul(h).umod(o);return this.g.mulAdd(p,a,g)},d.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new l(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},6744:function(e,t,n){"use strict";var r=n(13550),i=n(66583).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"===typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new r(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},83005:function(e,t,n){"use strict";var r=n(13550),i=n(66583),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;if(0===e[t.place])return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var o=c(e,n);if(!1===o)return!1;if(o+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var s=c(e,n);if(!1===s)return!1;if(0!==(128&e[n.place]))return!1;var u=e.slice(n.place,s+n.place);if(n.place+=s,2!==e[n.place++])return!1;var l=c(e,n);if(!1===l)return!1;if(e.length!==l+n.place)return!1;if(0!==(128&e[n.place]))return!1;var d=e.slice(n.place,l+n.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new r(u),this.s=new r(d),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=u(t),n=u(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];l(r,t.length),(r=r.concat(t)).push(2),l(r,n.length);var o=r.concat(n),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},3389:function(e,t,n){"use strict";var r=n(33715),i=n(7589),o=n(66583),s=o.assert,a=o.parseBytes,c=n(51250),u=n(19713);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=r.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,n){if(e=a(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(o>>1)-1?(o>>1)-c:c,s.isubn(a)):a=0,i[r]=a,s.iushrn(1)}return i},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0===(1&c)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==u?c:-c,n[0].push(s),a=0===(1&u)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==c?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},68007:function(e){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},36900:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(70655);r.__exportStar(n(46869),t),r.__exportStar(n(88033),t)},46869:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_THOUSAND=t.ONE_HUNDRED=void 0,t.ONE_HUNDRED=100,t.ONE_THOUSAND=1e3},88033:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=5*t.ONE_MINUTE,t.TEN_MINUTES=10*t.ONE_MINUTE,t.THIRTY_MINUTES=30*t.ONE_MINUTE,t.SIXTY_MINUTES=60*t.ONE_MINUTE,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=3*t.ONE_HOUR,t.SIX_HOURS=6*t.ONE_HOUR,t.TWELVE_HOURS=12*t.ONE_HOUR,t.TWENTY_FOUR_HOURS=24*t.ONE_HOUR,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=3*t.ONE_DAY,t.FIVE_DAYS=5*t.ONE_DAY,t.SEVEN_DAYS=7*t.ONE_DAY,t.THIRTY_DAYS=30*t.ONE_DAY,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=2*t.ONE_WEEK,t.THREE_WEEKS=3*t.ONE_WEEK,t.FOUR_WEEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY},66736:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(70655);r.__exportStar(n(18526),t),r.__exportStar(n(47001),t),r.__exportStar(n(52939),t),r.__exportStar(n(36900),t)},52939:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(70655).__exportStar(n(88766),t)},88766:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0;t.IWatch=class{}},83207:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;const r=n(36900);t.toMiliseconds=function(e){return e*r.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/r.ONE_THOUSAND)}},83873:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}},18526:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(70655);r.__exportStar(n(83873),t),r.__exportStar(n(83207),t)},47001:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Watch=void 0;class n{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if("undefined"!==typeof t.elapsed)throw new Error(`Watch already stopped for label: ${e}`);const n=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:n})}get(e){const t=this.timestamps.get(e);if("undefined"===typeof t)throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}t.Watch=n,t.default=n},13964:function(e,t,n){"use strict";var r=t;r.version=n(15220).i8,r.utils=n(63039),r.rand=n(29931),r.curve=n(30472),r.curves=n(1538),r.ec=n(57387),r.eddsa=n(58625)},9568:function(e,t,n){"use strict";var r=n(13550),i=n(63039),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var n=e._getDoubles(),r=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+r[l];u.push(c)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var d=s[u];a(0!==d),c="affine"===e.type?d>0?c.mixedAdd(i[d-1>>1]):c.mixedAdd(i[-d-1>>1].neg()):d>0?c.add(i[d-1>>1]):c.add(i[-d-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,r,i){var a,c,u,l=this._wnafT1,d=this._wnafT2,f=this._wnafT3,h=0;for(a=0;a=1;a-=2){var g=a-1,m=a;if(1===l[g]&&1===l[m]){var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(n[g],n[m]);for(h=Math.max(v[0].length,h),f[g]=new Array(h),f[m]=new Array(h),c=0;c=0;a--){for(var E=0;a>=0;){var _=!0;for(c=0;c=0&&E++,S=S.dblp(E),a<0)break;for(c=0;c0?u=d[c][C-1>>1]:C<0&&(u=d[c][-C-1>>1].neg()),S="affine"===u.type?S.mixedAdd(u):S.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),s=o.redSub(n),a=r.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),d=s.redMul(o);return this.curve.point(c,u,d,l)},u.prototype._projDbl=function(){var e,t,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(c)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(r.redSub(c)),n=u.redMul(o))}else r=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(a.redISub(c)),n=r.redMul(o);return this.curve.point(e,t,n)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),s=i.redSub(r),a=i.redAdd(r),c=n.redAdd(t),u=o.redMul(s),l=a.redMul(c),d=o.redMul(c),f=s.redMul(a);return this.curve.point(u,l,f,d)},u.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(s.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(s.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},u.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},30472:function(e,t,n){"use strict";var r=t;r.base=n(9568),r.short=n(39573),r.mont=n(60208),r.edwards=n(2629)},60208:function(e,t,n){"use strict";var r=n(13550),i=n(35717),o=n(9568),s=n(63039);function a(e){o.call(this,"mont",e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,n){o.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(t,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),s=i.redMul(r),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},39573:function(e,t,n){"use strict";var r=n(63039),i=n(13550),o=n(35717),s=n(9568),a=r.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,n,r){s.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,n,r){s.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),n=new i(2).toRed(t).redInvm(),r=n.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,r,o,s,a,c,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),b=new i(1),y=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),l=m.sub(v.mul(p));var w=b.sub(v.mul(g));if(!r&&u.cmp(d)<0)t=c.neg(),n=p,r=u.neg(),o=l;else if(r&&2===++y)break;c=u,h=f,f=u,m=p,p=l,b=g,g=w}s=u.neg(),a=l;var x=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(x)>=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},u.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},1538:function(e,t,n){"use strict";var r,i=t,o=n(33715),s=n(30472),a=n(63039).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var n=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(69008)}catch(l){r=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},57387:function(e,t,n){"use strict";var r=n(13550),i=n(2156),o=n(63039),s=n(1538),a=n(29931),c=o.assert,u=n(63896),l=n(25207);function d(e){if(!(this instanceof d))return new d(e);"string"===typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=d,d.prototype.keyPair=function(e){return new u(this,e)},d.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(t.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},d.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,n,o){"object"===typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new r(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new r(1)),f=0;;f++){var h=o.k?o.k(f):new r(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new l({r:m,s:b,recoveryParam:y})}}}}}},d.prototype.verify=function(e,t,n,i){e=this._truncateToN(new r(e,16)),n=this.keyFromPublic(n,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),d)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),d)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},d.prototype.recoverPubKey=function(e,t,n,i){c((3&n)===n,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new r(e),a=t.r,u=t.s,d=1&n,f=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),d):this.curve.pointFromX(a,d);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),g=u.mul(h).umod(o);return this.g.mulAdd(p,a,g)},d.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new l(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},63896:function(e,t,n){"use strict";var r=n(13550),i=n(63039).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"===typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new r(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},25207:function(e,t,n){"use strict";var r=n(13550),i=n(63039),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;if(0===e[t.place])return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var o=c(e,n);if(!1===o)return!1;if(o+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var s=c(e,n);if(!1===s)return!1;if(0!==(128&e[n.place]))return!1;var u=e.slice(n.place,s+n.place);if(n.place+=s,2!==e[n.place++])return!1;var l=c(e,n);if(!1===l)return!1;if(e.length!==l+n.place)return!1;if(0!==(128&e[n.place]))return!1;var d=e.slice(n.place,l+n.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new r(u),this.s=new r(d),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=u(t),n=u(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];l(r,t.length),(r=r.concat(t)).push(2),l(r,n.length);var o=r.concat(n),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},58625:function(e,t,n){"use strict";var r=n(33715),i=n(1538),o=n(63039),s=o.assert,a=o.parseBytes,c=n(28509),u=n(73022);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=r.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,n){if(e=a(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(o>>1)-1?(o>>1)-c:c,s.isubn(a)):a=0,i[r]=a,s.iushrn(1)}return i},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0===(1&c)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==u?c:-c,n[0].push(s),a=0===(1&u)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==c?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},11460:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s=n(36563).Buffer}catch(E){}function a(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function c(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"===typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"===typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=6)i=a(e,n,n+6),this.words[r]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=a(e,t,n+6),this.words[r]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var f=l[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?g+n:u[f-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r("undefined"!==typeof s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,u=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function p(e,t,n){return(new g).mulp(e,t,n)}function g(e,t){this.x=e,this.y=t}Math.imul||(h=f),o.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?h(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},g.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},g.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):n.strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},i(y,b),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new x}return m[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},i(A,S),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},66151:function(e,t,n){"use strict";const r=n(70610),i=n(44020),o=n(80500);function s(e){if("string"!==typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function c(e,t){return t.decode?i(e):e}function u(e){return Array.isArray(e)?e.sort():"object"===typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"===typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"===typeof n&&n.split("").indexOf(e.arrayFormatSeparator)>-1?n.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===n?n:c(n,e);r[t]=i};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!==typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){let[e,s]=o(t.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator"].includes(t.arrayFormat)?s:c(s,t),n(c(e,t),s,r)}for(const i of Object.keys(r)){const e=r[i];if("object"===typeof e&&null!==e)for(const n of Object.keys(e))e[n]=f(e[n],t);else r[i]=f(e,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce(((e,t)=>{const n=r[t];return Boolean(n)&&"object"===typeof n&&!Array.isArray(n)?e[t]=u(n):e[t]=n,e}),Object.create(null))}t.extract=d,t.parse=h,t.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>{return t.skipNull&&(null===(r=e[n])||void 0===r)||t.skipEmptyString&&""===e[n];var r},r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[",i,"]"].join("")]:[...n,[a(t,e),"[",a(i,e),"]=",a(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[]"].join("")]:[...n,[a(t,e),"[]=",a(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null===r||void 0===r||0===r.length?n:0===n.length?[[a(t,e),"=",a(r,e)].join("")]:[[n,a(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,a(t,e)]:[...n,[a(t,e),"=",a(r,e)].join("")]}}(t),i={};for(const s of Object.keys(e))n(s)||(i[s]=e[s]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((n=>{const i=e[n];return void 0===i?"":null===i?a(n,t):Array.isArray(i)?i.reduce(r(n),[]).join("&"):a(n,t)+"="+a(i,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=o(e,"#");return Object.assign({url:n.split("?")[0]||"",query:h(d(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:c(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=l(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),s=Object.assign(o,e.query);let c=t.stringify(s,n);c&&(c=`?${c}`);let u=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(u=`#${a(e.fragmentIdentifier,n)}`),`${r}${c}${u}`}},62873:function(e,t){"use strict";function n(e){let t;return"undefined"!==typeof window&&"undefined"!==typeof window[e]&&(t=window[e]),t}function r(e){const t=n(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=n,t.getFromWindowOrThrow=r,t.getDocumentOrThrow=function(){return r("document")},t.getDocument=function(){return n("document")},t.getNavigatorOrThrow=function(){return r("navigator")},t.getNavigator=function(){return n("navigator")},t.getLocationOrThrow=function(){return r("location")},t.getLocation=function(){return n("location")},t.getCryptoOrThrow=function(){return r("crypto")},t.getCrypto=function(){return n("crypto")},t.getLocalStorageOrThrow=function(){return r("localStorage")},t.getLocalStorage=function(){return n("localStorage")}},65755:function(e,t,n){"use strict";t.D=void 0;const r=n(62873);t.D=function(){let e,t;try{e=r.getDocumentOrThrow(),t=r.getLocationOrThrow()}catch(o){return null}function n(...t){const n=e.getElementsByTagName("meta");for(let e=0;er.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=r.getAttribute("content");if(e)return e}}return""}const i=function(){let t=n("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:n("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const n=e.getElementsByTagName("link"),r=[];for(let e=0;e-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=t.protocol+"//"+t.host;if(0===e.indexOf("/"))n+=e;else{const r=t.pathname.split("/");r.pop();n+=r.join("/")+"/"+e}r.push(n)}else if(0===e.indexOf("//")){const n=t.protocol+e;r.push(n)}else r.push(e)}}return r}(),name:i}}},28599:function(e){"use strict";const{AbortController:t,AbortSignal:n}="undefined"!==typeof self?self:"undefined"!==typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=n,e.exports.default=t},66424:function(e,t,n){var r=n(34155);e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"encode",(function(){return T})),n.d(t,"decode",(function(){return H})),n.d(t,"decodeAsync",(function(){return Q})),n.d(t,"decodeArrayStream",(function(){return $})),n.d(t,"decodeStream",(function(){return ee})),n.d(t,"Decoder",(function(){return q})),n.d(t,"Encoder",(function(){return I})),n.d(t,"ExtensionCodec",(function(){return E})),n.d(t,"ExtData",(function(){return p})),n.d(t,"EXT_TIMESTAMP",(function(){return b})),n.d(t,"encodeDateToTimeSpec",(function(){return v})),n.d(t,"encodeTimeSpecToTimestamp",(function(){return y})),n.d(t,"decodeTimestampToTimeSpec",(function(){return x})),n.d(t,"encodeTimestampExtension",(function(){return w})),n.d(t,"decodeTimestampExtension",(function(){return S}));var i=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},o=function(){for(var e=[],t=0;t=55296&&i<=56319&&r65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|1023&d),s.push(d)}else s.push(c);s.length>=4096&&(a+=String.fromCharCode.apply(String,o(s)),s.length=0)}return s.length>0&&(a+=String.fromCharCode.apply(String,o(s))),a}var f=s?new TextDecoder:null,h="undefined"!=typeof r?200:0,p=function(e,t){this.type=e,this.data=t};function g(e,t,n){var r=Math.floor(n/4294967296),i=n;e.setUint32(t,r),e.setUint32(t+4,i)}function m(e,t){var n=e.getInt32(t),r=e.getUint32(t+4),i=nMath.floor(Number.MAX_SAFE_INTEGER/4294967296);return i||o?BigInt(n)*BigInt(4294967296)+BigInt(r):4294967296*n+r}var b=-1;function y(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var i=new Uint8Array(4);return(t=new DataView(i.buffer)).setUint32(0,n),i}var o=n/4294967296,s=4294967295&n;return i=new Uint8Array(8),(t=new DataView(i.buffer)).setUint32(0,r<<2|3&o),t.setUint32(4,s),i}return i=new Uint8Array(12),(t=new DataView(i.buffer)).setUint32(0,r),g(t,4,n),i}function v(e){var t=e.getTime(),n=Math.floor(t/1e3),r=1e6*(t-1e3*n),i=Math.floor(r/1e9);return{sec:n+i,nsec:r-1e9*i}}function w(e){return e instanceof Date?y(v(e)):null}function x(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:m(t,4),nsec:t.getUint32(0)};default:throw new Error("Unrecognized data size for timestamp: "+e.length)}}function S(e){var t=x(e);return new Date(1e3*t.sec+t.nsec/1e6)}var A={type:b,encode:w,decode:S},E=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(A)}return e.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var i=1+t;this.builtInEncoders[i]=n,this.builtInDecoders[i]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},I=function(){function e(e,t,n,r,i,o,s,a){void 0===e&&(e=E.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=100),void 0===r&&(r=2048),void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),this.extensionCodec=e,this.context=t,this.maxDepth=n,this.initialBufferSize=r,this.sortKeys=i,this.forceFloat32=o,this.ignoreUndefined=s,this.forceIntegerToFloat=a,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return e.prototype.getUint8Array=function(){return this.bytes.subarray(0,this.pos)},e.prototype.reinitializeState=function(){this.pos=0},e.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.getUint8Array()},e.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth "+t);null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):"bigint"==typeof e?this.encodebigint(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.encodebigint=function(e){e>=BigInt(0)?e=BigInt(-32)?this.writeU8(224|Number(e)+32):e>=BigInt(-128)?(this.writeU8(208),this.writeI8(Number(e))):e>=BigInt(-32768)?(this.writeU8(209),this.writeI16(Number(e))):e>=BigInt(-2147483648)?(this.writeU8(210),this.writeI32(Number(e))):(this.writeU8(211),this.writeBig64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: "+e+" bytes in UTF-8");this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){var t=e.length;if(s&&t>u){var n=a(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),l(e,this.bytes,this.pos),this.pos+=n}else n=a(e),this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),function(e,t,n){for(var r=e.length,i=n,o=0;o>6&31|192;else{if(s>=55296&&s<=56319&&o>12&15|224,t[i++]=s>>6&63|128):(t[i++]=s>>18&7|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128)}t[i++]=63&s|128}else t[i++]=s}}(e,this.bytes,this.pos),this.pos+=n},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: "+Object.prototype.toString.apply(e));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: "+t);this.writeU8(198),this.writeU32(t)}var n=_(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n,r,i=e.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else{if(!(i<4294967296))throw new Error("Too large array: "+i);this.writeU8(221),this.writeU32(i)}try{for(var o=C(e),s=o.next();!s.done;s=o.next()){var a=s.value;this.doEncode(a,t+1)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e.prototype.countWithoutUndefined=function(e,t){var n,r,i=0;try{for(var o=C(t),s=o.next();!s.done;s=o.next())void 0!==e[s.value]&&i++}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},e.prototype.encodeMap=function(e,t){var n,r,i=Object.keys(e);this.sortKeys&&i.sort();var o=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.length;if(o<16)this.writeU8(128+o);else if(o<65536)this.writeU8(222),this.writeU16(o);else{if(!(o<4294967296))throw new Error("Too large map object: "+o);this.writeU8(223),this.writeU32(o)}try{for(var s=C(i),a=s.next();!a.done;a=s.next()){var c=a.value,u=e[c];this.ignoreUndefined&&void 0===u||(this.encodeString(c),this.doEncode(u,t+1))}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}},e.prototype.encodeExtension=function(e){var t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large extension object: "+t);this.writeU8(201),this.writeU32(t)}this.writeI8(e.type),this.writeU8a(e.data)},e.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},e.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},e.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},e.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},e.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},e.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},e.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},e.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},e.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},e.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),function(e,t,n){var r=n/4294967296,i=n;e.setUint32(t,r),e.setUint32(t+4,i)}(this.view,this.pos,e),this.pos+=8},e.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),g(this.view,this.pos,e),this.pos+=8},e.prototype.writeBig64=function(e){this.ensureBufferSizeToWrite(8),function(e,t,n){var r=Number(n/BigInt(4294967296)),i=Number(n%BigInt(4294967296));r<0&&0!==i&&(r-=1),e.setUint32(t,r),e.setUint32(t+4,i)}(this.view,this.pos,e),this.pos+=8},e}(),k={};function T(e,t){return void 0===t&&(t=k),new I(t.extensionCodec,t.context,t.maxDepth,t.initialBufferSize,t.sortKeys,t.forceFloat32,t.ignoreUndefined,t.forceIntegerToFloat).encode(e)}function M(e){return(e<0?"-":"")+"0x"+Math.abs(e).toString(16).padStart(2,"0")}var P=function(){function e(e,t){void 0===e&&(e=16),void 0===t&&(t=16),this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(var n=0;n0&&e<=this.maxKeyLength},e.prototype.get=function(e,t,n){var r=this.caches[n-1],i=r.length;e:for(var o=0;o=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},e.prototype.decode=function(e,t,n){var r=this.get(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var i=d(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,i),i},e}(),O=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},R=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof B?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}},D=new DataView(new ArrayBuffer(0)),U=new Uint8Array(D.buffer),j=function(){try{D.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),F=new j("Insufficient data"),V=new P,q=function(){function e(e,t,n,r,i,o,s,a){void 0===e&&(e=E.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=4294967295),void 0===r&&(r=4294967295),void 0===i&&(i=4294967295),void 0===o&&(o=4294967295),void 0===s&&(s=4294967295),void 0===a&&(a=V),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=r,this.maxArrayLength=i,this.maxMapLength=o,this.maxExtLength=s,this.keyDecoder=a,this.totalPos=0,this.pos=0,this.view=D,this.bytes=U,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1},e.prototype.setBuffer=function(e){this.bytes=_(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=_(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining()){var t=this.bytes.subarray(this.pos),n=_(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return void 0===e&&(e=1),this.view.byteLength-this.pos>=e},e.prototype.createNoExtraBytesError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra "+(t.byteLength-n)+" of "+t.byteLength+" byte(s) found at buffer["+e+"]")},e.prototype.decode=function(e){return this.reinitializeState(),this.setBuffer(e),this.doDecodeSingleSync()},e.prototype.doDecodeSingleSync=function(){var e=this.doDecodeSync();if(this.hasRemaining())throw this.createNoExtraBytesError(this.pos);return e},e.prototype.decodeAsync=function(e){var t,n,r,i;return O(this,void 0,void 0,(function(){var o,s,a,c,u,l,d,f;return R(this,(function(h){switch(h.label){case 0:o=!1,h.label=1;case 1:h.trys.push([1,6,7,12]),t=N(e),h.label=2;case 2:return[4,t.next()];case 3:if((n=h.sent()).done)return[3,5];if(a=n.value,o)throw this.createNoExtraBytesError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),o=!0}catch(e){if(!(e instanceof j))throw e}this.totalPos+=this.pos,h.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=h.sent(),r={error:c},[3,12];case 7:return h.trys.push([7,,10,11]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,9];case 8:h.sent(),h.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(o){if(this.hasRemaining())throw this.createNoExtraBytesError(this.totalPos);return[2,s]}throw l=(u=this).headByte,d=u.pos,f=u.totalPos,new RangeError("Insufficient data in parcing "+M(l)+" at "+f+" ("+d+" in the current buffer)")}}))}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return L(this,arguments,(function(){var n,r,i,o,s,a,c,u,l;return R(this,(function(d){switch(d.label){case 0:n=t,r=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),i=N(e),d.label=2;case 2:return[4,B(i.next())];case 3:if((o=d.sent()).done)return[3,12];if(s=o.value,t&&0===r)throw this.createNoExtraBytesError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,B(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof j))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),u={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),o&&!o.done&&(l=i.return)?[4,B(l.call(i))]:[3,16];case 15:d.sent(),d.label=16;case 16:return[3,18];case 17:if(u)throw u.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!==(r=e-128)){this.pushMapState(r),this.complete();continue e}t={}}else if(e<160){if(0!==(r=e-144)){this.pushArrayState(r),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(r=this.readU16())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(221===e){if(0!==(r=this.readU32())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(222===e){if(0!==(r=this.readU16())){this.pushMapState(r),this.complete();continue e}t={}}else if(223===e){if(0!==(r=this.readU32())){this.pushMapState(r),this.complete();continue e}t={}}else if(196===e){var r=this.lookU8();t=this.decodeBinary(r,1)}else if(197===e)r=this.lookU16(),t=this.decodeBinary(r,2);else if(198===e)r=this.lookU32(),t=this.decodeBinary(r,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)r=this.lookU8(),t=this.decodeExtension(r,1);else if(200===e)r=this.lookU16(),t=this.decodeExtension(r,2);else{if(201!==e)throw new Error("Unrecognized type byte: "+M(e));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var i=this.stack;i.length>0;){var o=i[i.length-1];if(0===o.type){if(o.array[o.position]=t,o.position++,o.position!==o.size)continue e;i.pop(),t=o.array}else{if(1===o.type){if(s=void 0,"string"!==(s=typeof t)&&"number"!==s)throw new Error("The type of key must be string or number but "+typeof t);o.key=t,o.type=2;continue e}if(o.map[o.key]=t,o.readCount++,o.readCount!==o.size){o.key=null,o.type=1;continue e}i.pop(),t=o.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new Error("Unrecognized array type byte: "+M(e))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Error("Max length exceeded: map length ("+e+") > maxMapLengthLength ("+this.maxMapLength+")");this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new Error("Max length exceeded: array length ("+e+") > maxArrayLength ("+this.maxArrayLength+")");this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new Error("Max length exceeded: UTF-8 byte length ("+e+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLengthh?function(e,t,n){var r=e.subarray(t,t+n);return f.decode(r)}(this.bytes,i,e):d(this.bytes,i,e),this.pos+=t+e,r},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new Error("Max length exceeded: bin length ("+e+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(e+t))throw F;var n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new Error("Max length exceeded: ext length ("+e+") > maxExtLength ("+this.maxExtLength+")");var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n,r,i=(e=this.view,t=this.pos,n=e.getUint32(t),r=e.getUint32(t+4),n>Math.floor(Number.MAX_SAFE_INTEGER/4294967296)?BigInt(n)*BigInt(4294967296)+BigInt(r):4294967296*n+r);return this.pos+=8,i},e.prototype.readI64=function(){var e=m(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),z={};function H(e,t){return void 0===t&&(t=z),new q(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}var W=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof G?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}};function K(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function X(e){return null!=e[Symbol.asyncIterator]?e:function(e){return Z(this,arguments,(function(){var t,n,r,i;return W(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,G(t.read())];case 3:return n=o.sent(),r=n.done,i=n.value,r?[4,G(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return K(i),[4,G(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}var Y=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},J=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e===t[n]))}function b(...e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;for(let i=0;iBigInt("0xffffffffffffffff"))throw new Error("Input is not a 64-bit unsigned integer");const t=new Uint8Array(8);return new DataView(t.buffer).setBigUint64(0,BigInt(e)),t}function M(e,t="safe"){if("safe"!==t&&"mixed"!==t&&"bigint"!==t)throw new Error(`Unknown decodingMode option: ${t}`);if(0===e.byteLength||e.byteLength>8)throw new Error(`Data has unacceptable length. Expected length is between 1 and 8, got ${e.byteLength}`);const n=b(new Uint8Array(8-e.byteLength),e),r=new DataView(n.buffer).getBigUint64(0),i=r>BigInt(Number.MAX_SAFE_INTEGER);if("safe"===t){if(i)throw new Error(`Integer exceeds maximum safe integer: ${r.toString()}. Try decoding with "mixed" or "safe" decodingMode.`);return Number(r)}return"mixed"!==t||i?r:Number(r)}const P=new Uint8Array([77,117,108,116,105,115,105,103,65,100,100,114]),O=a.lW.from("appID"),R="address seems to be malformed";function N(e){if("string"!==typeof e||58!==e.length)throw new Error(R);const t=k().decode.asBytes(e.toString());if(36!==t.length)throw new Error(R);const n=new Uint8Array(t.slice(0,32)),r=new Uint8Array(t.slice(C,36));if(!m(y(n).slice(28,32),r))throw new Error("wrong checksum for address");return{publicKey:n,checksum:r}}function B(e){try{N(e)}catch(t){return!1}return!0}function L(e){const t=y(e).slice(C-4,C);return k().encode(b(e,t)).toString().slice(0,58)}function D({version:e,threshold:t,pks:n}){if(1!==e||e>255||e<0)throw new Error("invalid multisig version");if(0===t||0===n.length||t>n.length||t>255)throw new Error("bad multisig threshold");if(32!==C)throw new Error("nacl public key length is not 32 bytes");const r=new Uint8Array(P.length+2+32*n.length);r.set(P,0),r.set([e],P.length),r.set([t],P.length+1);for(let i=0;iN(e).publicKey))}))}function j(e){const t=y(b(O,T(e)));return L(new Uint8Array(t))}var F=n(66424);function V(e){return F.encode(e,{sortKeys:!0})}function q(e){const t=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&(!e[t]||0===e[t].length))return{containsEmpty:!0,firstEmptyKey:t};return{containsEmpty:!1,firstEmptyKey:void 0}}(e);if(t.containsEmpty)throw new Error("The object contains empty or 0 values. First empty or 0 value encountered during encoding: "+t.firstEmptyKey);return V(e)}function z(e){return F.decode(e)}function H(e,t,n){return null==e?[]:e.map((e=>function(e,t,n){const r=e.appIndex,i=e.name,o=0===r||r===n;let s=0;if(null!=t&&(s=t.indexOf(r)+1),0===s&&!o)throw new Error(`Box ref with appId ${r} not in foreign-apps`);return{i:s,n:i}}(e,t,n)))}var W,G;!function(e){e.pay="pay",e.keyreg="keyreg",e.acfg="acfg",e.axfer="axfer",e.afrz="afrz",e.appl="appl",e.stpf="stpf"}(W||(W={})),function(e){e[e.NoOpOC=0]="NoOpOC",e[e.OptInOC=1]="OptInOC",e[e.CloseOutOC=2]="CloseOutOC",e[e.ClearStateOC=3]="ClearStateOC",e[e.UpdateApplicationOC=4]="UpdateApplicationOC",e[e.DeleteApplicationOC=5]="DeleteApplicationOC"}(G||(G={}));const Z=1e3;function K(e,t,n){if(null==e)return;let r;if("string"===typeof e?r=a.lW.from(e,"base64"):e.constructor===Uint8Array?r=a.lW.from(e):a.lW.isBuffer(e)&&(r=e),null==r||r.byteLength!==n)throw Error(`${t} must be a ${n} byte Uint8Array or Buffer or base64 string.`);return r}class X{constructor({...e}){this.name="Transaction",this.tag=a.lW.from("TX");const t={type:W.pay,flatFee:!1,nonParticipation:!1};if("undefined"===typeof e.type&&(e.type=t.type),"undefined"===typeof e.flatFee&&(e.flatFee=t.flatFee),e.type===W.keyreg&&"undefined"!==typeof e.voteKey&&"undefined"===typeof e.nonParticipation&&(e.nonParticipation=t.nonParticipation),void 0!==e.suggestedParams){const t=e;t.genesisHash=t.suggestedParams.genesisHash,t.fee=t.suggestedParams.fee,void 0!==t.suggestedParams.flatFee&&(t.flatFee=t.suggestedParams.flatFee),t.firstRound=t.suggestedParams.firstRound,t.lastRound=t.suggestedParams.lastRound,t.genesisID=t.suggestedParams.genesisID}const n=e;if(n.from=N(n.from),void 0!==n.to&&(n.to=N(n.to)),void 0!==n.closeRemainderTo&&(n.closeRemainderTo=N(n.closeRemainderTo)),void 0!==n.assetManager&&(n.assetManager=N(n.assetManager)),void 0!==n.assetReserve&&(n.assetReserve=N(n.assetReserve)),void 0!==n.assetFreeze&&(n.assetFreeze=N(n.assetFreeze)),void 0!==n.assetClawback&&(n.assetClawback=N(n.assetClawback)),void 0!==n.assetRevocationTarget&&(n.assetRevocationTarget=N(n.assetRevocationTarget)),void 0!==n.freezeAccount&&(n.freezeAccount=N(n.freezeAccount)),void 0!==n.reKeyTo&&(n.reKeyTo=N(n.reKeyTo)),void 0===n.genesisHash)throw Error("genesis hash must be specified and in a base64 string.");if(n.genesisHash=a.lW.from(n.genesisHash,"base64"),void 0!==n.amount&&(!(Number.isSafeInteger(n.amount)||"bigint"===typeof n.amount&&n.amount<=BigInt("0xffffffffffffffff"))||n.amount<0))throw Error("Amount must be a positive number and smaller than 2^64-1. If the number is larger than 2^53-1, use bigint.");if(!Number.isSafeInteger(n.fee)||n.fee<0)throw Error("fee must be a positive number and smaller than 2^53-1");if(!Number.isSafeInteger(n.firstRound)||n.firstRound<0)throw Error("firstRound must be a positive number");if(!Number.isSafeInteger(n.lastRound)||n.lastRound<0)throw Error("lastRound must be a positive number");if(void 0!==n.extraPages&&(!Number.isInteger(n.extraPages)||n.extraPages<0||n.extraPages>3))throw Error("extraPages must be an Integer between and including 0 to 3");if(void 0!==n.assetTotal&&(!(Number.isSafeInteger(n.assetTotal)||"bigint"===typeof n.assetTotal&&n.assetTotal<=BigInt("0xffffffffffffffff"))||n.assetTotal<0))throw Error("Total asset issuance must be a positive number and smaller than 2^64-1. If the number is larger than 2^53-1, use bigint.");if(void 0!==n.assetDecimals&&(!Number.isSafeInteger(n.assetDecimals)||n.assetDecimals<0||n.assetDecimals>19))throw Error(`assetDecimals must be a positive number and smaller than ${19..toString()}`);if(void 0!==n.assetIndex&&(!Number.isSafeInteger(n.assetIndex)||n.assetIndex<0))throw Error("Asset index must be a positive number and smaller than 2^53-1");if(void 0!==n.appIndex&&(!Number.isSafeInteger(n.appIndex)||n.appIndex<0))throw Error("Application index must be a positive number and smaller than 2^53-1");if(void 0!==n.appLocalInts&&(!Number.isSafeInteger(n.appLocalInts)||n.appLocalInts<0))throw Error("Application local ints count must be a positive number and smaller than 2^53-1");if(void 0!==n.appLocalByteSlices&&(!Number.isSafeInteger(n.appLocalByteSlices)||n.appLocalByteSlices<0))throw Error("Application local byte slices count must be a positive number and smaller than 2^53-1");if(void 0!==n.appGlobalInts&&(!Number.isSafeInteger(n.appGlobalInts)||n.appGlobalInts<0))throw Error("Application global ints count must be a positive number and smaller than 2^53-1");if(void 0!==n.appGlobalByteSlices&&(!Number.isSafeInteger(n.appGlobalByteSlices)||n.appGlobalByteSlices<0))throw Error("Application global byte slices count must be a positive number and smaller than 2^53-1");if(void 0!==n.appApprovalProgram&&n.appApprovalProgram.constructor!==Uint8Array)throw Error("appApprovalProgram must be a Uint8Array.");if(void 0!==n.appClearProgram&&n.appClearProgram.constructor!==Uint8Array)throw Error("appClearProgram must be a Uint8Array.");if(void 0!==n.appArgs){if(!Array.isArray(n.appArgs))throw Error("appArgs must be an Array of Uint8Array.");n.appArgs=n.appArgs.slice(),n.appArgs.forEach((e=>{if(e.constructor!==Uint8Array)throw Error("each element of AppArgs must be a Uint8Array.")}))}else n.appArgs=[];if(void 0!==n.appAccounts){if(!Array.isArray(n.appAccounts))throw Error("appAccounts must be an Array of addresses.");n.appAccounts=n.appAccounts.map((e=>N(e)))}if(void 0!==n.appForeignApps){if(!Array.isArray(n.appForeignApps))throw Error("appForeignApps must be an Array of integers.");n.appForeignApps=n.appForeignApps.slice(),n.appForeignApps.forEach((e=>{if(!Number.isSafeInteger(e)||e<0)throw Error("each foreign application index must be a positive number and smaller than 2^53-1")}))}if(void 0!==n.appForeignAssets){if(!Array.isArray(n.appForeignAssets))throw Error("appForeignAssets must be an Array of integers.");n.appForeignAssets=n.appForeignAssets.slice(),n.appForeignAssets.forEach((e=>{if(!Number.isSafeInteger(e)||e<0)throw Error("each foreign asset index must be a positive number and smaller than 2^53-1")}))}if(void 0!==n.boxes){if(!Array.isArray(n.boxes))throw Error("boxes must be an Array of BoxReference.");n.boxes=n.boxes.slice(),n.boxes.forEach((e=>{if(!Number.isSafeInteger(e.appIndex)||e.name.constructor!==Uint8Array)throw Error("box app index must be a number and name must be an Uint8Array.")}))}if(void 0!==n.assetMetadataHash&&0!==n.assetMetadataHash.length){if("string"===typeof n.assetMetadataHash&&(n.assetMetadataHash=new Uint8Array(a.lW.from(n.assetMetadataHash))),n.assetMetadataHash.constructor!==Uint8Array||32!==n.assetMetadataHash.byteLength)throw Error("assetMetadataHash must be a 32 byte Uint8Array or string.");n.assetMetadataHash.every((e=>0===e))&&(n.assetMetadataHash=void 0)}else n.assetMetadataHash=void 0;if(void 0!==n.note){if(n.note.constructor!==Uint8Array)throw Error("note must be a Uint8Array.")}else n.note=new Uint8Array(0);if(void 0!==n.lease){if(n.lease.constructor!==Uint8Array)throw Error("lease must be a Uint8Array.");if(32!==n.lease.length)throw Error(`lease must be of length ${32..toString()}.`);n.lease.every((e=>0===e))&&(n.lease=new Uint8Array(0))}else n.lease=new Uint8Array(0);if(n.voteKey=K(n.voteKey,"voteKey",32),n.selectionKey=K(n.selectionKey,"selectionKey",32),n.stateProofKey=K(n.stateProofKey,"stateProofKey",64),n.nonParticipation&&(n.voteKey||n.selectionKey||n.voteFirst||n.stateProofKey||n.voteLast||n.voteKeyDilution))throw new Error("nonParticipation is true but participation params are present.");if(!n.nonParticipation&&(n.voteKey||n.selectionKey||n.stateProofKey||n.voteFirst||n.voteLast||n.voteKeyDilution)&&!(n.voteKey&&n.selectionKey&&n.voteFirst&&n.voteLast&&n.voteKeyDilution))throw new Error("online key registration missing at least one of the following fields: voteKey, selectionKey, voteFirst, voteLast, voteKeyDilution");if(delete n.suggestedParams,Object.assign(this,function(e){const t={...e};return Object.keys(t).forEach((e=>{"undefined"===typeof t[e]&&delete t[e]})),t}(n)),n.flatFee||(this.fee*=this.estimateSize(),this.feea.lW.from(e)))),void 0!==this.appAccounts&&(e.apat=this.appAccounts.map((e=>a.lW.from(e.publicKey)))),e.note.length||delete e.note,e.lx.length||delete e.lx,e.amt||delete e.amt,e.fee||delete e.fee,e.fv||delete e.fv,e.gen||delete e.gen,e.apid||delete e.apid,e.apls.nui||delete e.apls.nui,e.apls.nbs||delete e.apls.nbs,e.apls.nui||e.apls.nbs||delete e.apls,e.apgs.nui||delete e.apgs.nui,e.apgs.nbs||delete e.apgs.nbs,e.apaa&&e.apaa.length||delete e.apaa,e.apgs.nui||e.apgs.nbs||delete e.apgs,e.apap||delete e.apap,e.apsu||delete e.apsu,e.apan||delete e.apan,e.apfa&&e.apfa.length||delete e.apfa,e.apas&&e.apas.length||delete e.apas;for(const t of e.apbx)t.i||delete t.i,t.n&&t.n.length||delete t.n;return e.apbx&&e.apbx.length||delete e.apbx,e.apat&&e.apat.length||delete e.apat,e.apep||delete e.apep,void 0===e.grp&&delete e.grp,e}if("stpf"===this.type){const e={fee:this.fee,fv:this.firstRound,lv:this.lastRound,note:a.lW.from(this.note),snd:a.lW.from(this.from.publicKey),type:this.type,gen:this.genesisID,gh:this.genesisHash,lx:a.lW.from(this.lease),sptype:this.stateProofType,spmsg:a.lW.from(this.stateProofMessage),sp:a.lW.from(this.stateProof)};return e.sptype||delete e.sptype,e.note.length||delete e.note,e.lx.length||delete e.lx,e.amt||delete e.amt,e.fee||delete e.fee,e.fv||delete e.fv,e.gen||delete e.gen,e.apid||delete e.apid,e.apaa&&e.apaa.length||delete e.apaa,e.apap||delete e.apap,e.apsu||delete e.apsu,e.apan||delete e.apan,e.apfa&&e.apfa.length||delete e.apfa,e.apas&&e.apas.length||delete e.apas,e.apat&&e.apat.length||delete e.apat,e.apep||delete e.apep,void 0===e.grp&&delete e.grp,e}}static from_obj_for_encoding(e){const t=Object.create(this.prototype);if(t.name="Transaction",t.tag=a.lW.from("TX"),t.genesisID=e.gen,t.genesisHash=a.lW.from(e.gh),(n=e.type)!==W.pay&&n!==W.keyreg&&n!==W.acfg&&n!==W.axfer&&n!==W.afrz&&n!==W.appl&&n!==W.stpf)throw new Error(`Unrecognized transaction type: ${e.type}`);var n;return t.type=e.type,t.fee=e.fee,t.firstRound=e.fv,t.lastRound=e.lv,t.note=new Uint8Array(e.note),t.lease=new Uint8Array(e.lx),t.from=N(L(new Uint8Array(e.snd))),void 0!==e.grp&&(t.group=a.lW.from(e.grp)),void 0!==e.rekey&&(t.reKeyTo=N(L(new Uint8Array(e.rekey)))),"pay"===e.type?(t.amount=e.amt,t.to=N(L(new Uint8Array(e.rcv))),void 0!==e.close&&(t.closeRemainderTo=N(L(e.close)))):"keyreg"===e.type?(void 0!==e.votekey&&(t.voteKey=a.lW.from(e.votekey)),void 0!==e.selkey&&(t.selectionKey=a.lW.from(e.selkey)),void 0!==e.sprfkey&&(t.stateProofKey=a.lW.from(e.sprfkey)),void 0!==e.votekd&&(t.voteKeyDilution=e.votekd),void 0!==e.votefst&&(t.voteFirst=e.votefst),void 0!==e.votelst&&(t.voteLast=e.votelst),void 0!==e.nonpart&&(t.nonParticipation=e.nonpart)):"acfg"===e.type?(void 0!==e.caid&&(t.assetIndex=e.caid),void 0!==e.apar&&(t.assetTotal=e.apar.t,t.assetDefaultFrozen=e.apar.df,void 0!==e.apar.dc&&(t.assetDecimals=e.apar.dc),void 0!==e.apar.m&&(t.assetManager=N(L(new Uint8Array(e.apar.m)))),void 0!==e.apar.r&&(t.assetReserve=N(L(new Uint8Array(e.apar.r)))),void 0!==e.apar.f&&(t.assetFreeze=N(L(new Uint8Array(e.apar.f)))),void 0!==e.apar.c&&(t.assetClawback=N(L(new Uint8Array(e.apar.c)))),void 0!==e.apar.un&&(t.assetUnitName=e.apar.un),void 0!==e.apar.an&&(t.assetName=e.apar.an),void 0!==e.apar.au&&(t.assetURL=e.apar.au),void 0!==e.apar.am&&(t.assetMetadataHash=e.apar.am))):"axfer"===e.type?(void 0!==e.xaid&&(t.assetIndex=e.xaid),void 0!==e.aamt&&(t.amount=e.aamt),void 0!==e.aclose&&(t.closeRemainderTo=N(L(new Uint8Array(e.aclose)))),void 0!==e.asnd&&(t.assetRevocationTarget=N(L(new Uint8Array(e.asnd)))),t.to=N(L(new Uint8Array(e.arcv)))):"afrz"===e.type?(void 0!==e.afrz&&(t.freezeState=e.afrz),void 0!==e.faid&&(t.assetIndex=e.faid),t.freezeAccount=N(L(new Uint8Array(e.fadd)))):"appl"===e.type?(void 0!==e.apid&&(t.appIndex=e.apid),void 0!==e.apan&&(t.appOnComplete=e.apan),void 0!==e.apls&&(void 0!==e.apls.nui&&(t.appLocalInts=e.apls.nui),void 0!==e.apls.nbs&&(t.appLocalByteSlices=e.apls.nbs)),void 0!==e.apgs&&(void 0!==e.apgs.nui&&(t.appGlobalInts=e.apgs.nui),void 0!==e.apgs.nbs&&(t.appGlobalByteSlices=e.apgs.nbs)),void 0!==e.apep&&(t.extraPages=e.apep),void 0!==e.apap&&(t.appApprovalProgram=new Uint8Array(e.apap)),void 0!==e.apsu&&(t.appClearProgram=new Uint8Array(e.apsu)),void 0!==e.apaa&&(t.appArgs=e.apaa.map((e=>new Uint8Array(e)))),void 0!==e.apat&&(t.appAccounts=e.apat.map((e=>N(L(new Uint8Array(e)))))),void 0!==e.apfa&&(t.appForeignApps=e.apfa),void 0!==e.apas&&(t.appForeignAssets=e.apas),void 0!==e.apbx&&(t.boxes=e.apbx.map((e=>({appIndex:e.i?t.appForeignApps[e.i-1]:0,name:e.n}))))):"stpf"===e.type&&(void 0!==e.sptype&&(t.stateProofType=e.sptype),void 0!==e.sp&&(t.stateProof=e.sp),void 0!==e.spmsg&&(t.stateProofMessage=e.spmsg)),t}estimateSize(){return this.toByte().length+75}bytesToSign(){const e=this.toByte();return a.lW.from(b(this.tag,e))}toByte(){return q(this.get_obj_for_encoding())}rawSignTxn(e){const t=A(this.bytesToSign(),e);return a.lW.from(t)}signTxn(e){const t={sig:this.rawSignTxn(e),txn:this.get_obj_for_encoding()},n=S(e).publicKey;return L(n)!==L(this.from.publicKey)&&(t.sgnr=a.lW.from(n)),new Uint8Array(q(t))}attachSignature(e,t){if(!x(t.length))throw new Error("Invalid signature length");const n={sig:a.lW.from(t),txn:this.get_obj_for_encoding()};if(e!==L(this.from.publicKey)){const t=N(e).publicKey;n.sgnr=a.lW.from(t)}return new Uint8Array(q(n))}rawTxID(){const e=this.toByte(),t=a.lW.from(b(this.tag,e));return a.lW.from(y(t))}txID(){const e=this.rawTxID();return k().encode(e).slice(0,52)}addLease(e,t=0){let n;if(void 0!==e){if(e.constructor!==Uint8Array)throw Error("lease must be a Uint8Array.");if(32!==e.length)throw Error(`lease must be of length ${32..toString()}.`);n=new Uint8Array(e)}else n=new Uint8Array(0);this.lease=n,0!==t&&(this.fee+=37*t)}addRekey(e,t=0){void 0!==e&&(this.reKeyTo=N(e)),0!==t&&(this.fee+=37*t)}_getDictForDisplay(){const e={...this};return e.tag=e.tag.toString(),e.from=L(e.from.publicKey),void 0!==e.to&&(e.to=L(e.to.publicKey)),void 0!==e.freezeAccount&&(e.freezeAccount=L(e.freezeAccount.publicKey)),void 0!==e.closeRemainderTo&&(e.closeRemainderTo=L(e.closeRemainderTo.publicKey)),void 0!==e.assetManager&&(e.assetManager=L(e.assetManager.publicKey)),void 0!==e.assetReserve&&(e.assetReserve=L(e.assetReserve.publicKey)),void 0!==e.assetFreeze&&(e.assetFreeze=L(e.assetFreeze.publicKey)),void 0!==e.assetClawback&&(e.assetClawback=L(e.assetClawback.publicKey)),void 0!==e.assetRevocationTarget&&(e.assetRevocationTarget=L(e.assetRevocationTarget.publicKey)),void 0!==e.reKeyTo&&(e.reKeyTo=L(e.reKeyTo.publicKey)),e.genesisHash=e.genesisHash.toString("base64"),e}prettyPrint(){console.log(this._getDictForDisplay())}toString(){return JSON.stringify(this._getDictForDisplay())}}function Y(e){return q({txn:e.get_obj_for_encoding()})}function J(e){return q(e.get_obj_for_encoding())}function Q(e){const t=z(e);return X.from_obj_for_encoding(t)}function $(e){const t=z(e);return{...t,txn:X.from_obj_for_encoding(t.txn)}}function ee(e){return e instanceof X?e:new X(e)}class te{constructor({bidderKey:e,bidAmount:t,bidID:n,auctionKey:r,auctionID:i,maxPrice:o}){this.name="Bid",this.tag=a.lW.from([97,66]);const s=N(e),c=N(r);if(!Number.isSafeInteger(t)||t<0)throw Error("Bid amount must be positive and 2^53-1");if(!Number.isSafeInteger(n)||n<0)throw Error("BidID must be positive and 2^53-1");if(!Number.isSafeInteger(i)||i<0)throw Error("auctionID must be positive");Object.assign(this,{bidderKey:s,bidAmount:t,bidID:n,auctionKey:c,auctionID:i,maxPrice:o})}get_obj_for_encoding(){return{bidder:a.lW.from(this.bidderKey.publicKey),cur:this.bidAmount,price:this.maxPrice,id:this.bidID,auc:a.lW.from(this.auctionKey.publicKey),aid:this.auctionID}}signBid(e){const t=q(this.get_obj_for_encoding()),n=A(a.lW.from(b(this.tag,t)),e),r={sig:a.lW.from(n),bid:this.get_obj_for_encoding()};return new Uint8Array(q({t:"b",b:r}))}}const ne=1e6,re="Microalgos should be positive and less than 2^53 - 1.";function ie(e){if(e<0||!Number.isSafeInteger(e))throw new Error(re);return e/ne}function oe(e){const t=e*ne;return Math.round(t)}class se extends Error{constructor(e,t){super(e),this.response=t,this.name="URLTokenBaseHTTPError",this.response=t}}class ae{constructor(e,t,n,r={}){this.defaultHeaders=r;const i=t.endsWith("/")?t:`${t}/`,o=new URL(i);if("undefined"!==typeof n&&(o.port=n.toString()),0===o.protocol.length)throw new Error("Invalid base server URL, protocol must be defined.");this.baseURL=o,this.tokenHeader=e}getURL(e,t){let n;n=e.startsWith("./")?e:e.startsWith("/")?`.${e}`:`./${e}`;const r=new URL(n,this.baseURL);if(t)for(const[i,o]of Object.entries(t))r.searchParams.set(i,o);return r.toString()}static formatFetchResponseHeaders(e){const t={};return e.forEach(((e,n)=>{t[e]=n})),t}static async checkHttpError(e){if(e.ok)return;let t=null,n=null;try{t=new Uint8Array(await e.arrayBuffer());const r=JSON.parse(a.lW.from(t).toString());r.message&&(n=r.message)}catch(i){}let r=`Network request error. Received status ${e.status} (${e.statusText})`;throw n&&(r+=`: ${n}`),new se(r,{body:t,status:e.status,headers:ae.formatFetchResponseHeaders(e.headers)})}static async formatFetchResponse(e){return await this.checkHttpError(e),{body:new Uint8Array(await e.arrayBuffer()),status:e.status,headers:ae.formatFetchResponseHeaders(e.headers)}}async get(e,t,n={}){const r={...this.tokenHeader,...this.defaultHeaders,...n},i=await fetch(this.getURL(e,t),{headers:r});return ae.formatFetchResponse(i)}async post(e,t,n,r={}){const i={...this.tokenHeader,...this.defaultHeaders,...r},o=await fetch(this.getURL(e,n),{method:"POST",body:t,headers:i});return ae.formatFetchResponse(o)}async delete(e,t,n,r={}){const i={...this.tokenHeader,...this.defaultHeaders,...r},o=await fetch(this.getURL(e,n),{method:"DELETE",body:t,headers:i});return ae.formatFetchResponse(o)}}function ce(e){return Object.keys(e).reduce(((t,n)=>(t[n.toLowerCase()]=e[n],t)),{})}class ue{constructor(e,t,n,r={}){this.bc=void 0!==t?new ae(e,t,n,r):e}static parseJSON(e,t,n={}){try{return 0===Object.keys(n).length?e&&JSON.parse(e):e&&function(e,t){const n=t&&t.intDecoding?t.intDecoding:p.DEFAULT;return g.parse(e,((e,t)=>{if(null!=t&&"object"===typeof t&&null==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,Object.prototype),"bigint"===typeof t){if("safe"===n&&t>Number.MAX_SAFE_INTEGER)throw new Error(`Integer exceeds maximum safe integer: ${t.toString()}. Try parsing with a different intDecoding option.`);return"bigint"===n||"mixed"===n&&t>Number.MAX_SAFE_INTEGER?t:Number(t)}return"number"===typeof t&&"bigint"===n&&Number.isInteger(t)?BigInt(t):t}))}(e,n)}catch(r){const n=r;throw n.rawResponse=e||null,n.statusCode=t,n}}static serializeData(e,t){if(!e)return new Uint8Array(0);if("application/json"===t["content-type"])return new Uint8Array(a.lW.from(JSON.stringify(e)));if("string"===typeof e)return new Uint8Array(a.lW.from(e));if(e instanceof Uint8Array)return e;throw new Error("provided data is neither a string nor a Uint8Array and content-type is not application/json")}static prepareResponse(e,t,n,r={}){let i,{body:o}=e;return"application/msgpack"!==t&&(i=o&&a.lW.from(o).toString()||""),n&&"application/json"===t&&(o=ue.parseJSON(i,e.status,r)),{...e,body:o,text:i,ok:2===Math.trunc(e.status/100)}}static prepareResponseError(e){return e.response&&(e.response=ue.prepareResponse(e.response,"application/json",!0),e.status=e.response.status),e}async get(e,t,n={},r={},i=!0){const o=function(e){return void 0!==e&&Object.prototype.hasOwnProperty.call(e,"format")&&"msgpack"===e.format?"application/msgpack":"application/json"}(t),s={...n,accept:o};try{const n=await this.bc.get(e,function(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(e[t]&&0!==e[t].length||delete e[t]);return e}(t),s);return ue.prepareResponse(n,o,i,r)}catch(a){throw ue.prepareResponseError(a)}}async post(e,t,n={},r,i=!0){const o={"content-type":"application/json",...ce(n)};try{const n=await this.bc.post(e,ue.serializeData(t,o),r,o);return ue.prepareResponse(n,"application/json",i)}catch(s){throw ue.prepareResponseError(s)}}async delete(e,t,n={},r=!0){const i={"content-type":"application/json",...ce(n)},o=await this.bc.delete(e,ue.serializeData(t,i),void 0,i);return ue.prepareResponse(o,"application/json",r)}}class le{constructor(e,t,n,r,i={}){if("function"===typeof t.get)this.c=new ue(t);else{let o;o="string"===typeof t?function(e="",t){const n={};return""===e||(n[t]=e),n}(t,e):t,this.c=new ue(o,n,r,i)}this.intDecoding=p.DEFAULT}setIntEncoding(e){this.intDecoding=e}getIntEncoding(){return this.intDecoding}}function de(e,t){let n;if(e instanceof Uint8Array)n=t?e:a.lW.from(e).toString("base64");else if("function"===typeof e.get_obj_for_encoding)n=e.get_obj_for_encoding(t);else if(Array.isArray(e)){n=[];for(const r of e)n.push(de(r,t))}else if("object"===typeof e){const r={};for(const n of Object.keys(e))r[n]=de(e[n],t);n=r}else{if(!function(e){return void 0===e||null==e||"object"!==typeof e&&"function"!==typeof e}(e))throw new Error(`Unsupported value: ${String(e)}`);n=e}return n}class fe{get_obj_for_encoding(e=!1){const t={};for(const n of Object.keys(this.attribute_map)){const r=this.attribute_map[n],i=this[n];"undefined"!==typeof i&&(t[r]=null===i?null:de(i,e))}return t}}class he extends fe{constructor({address:e,amount:t,amountWithoutPendingRewards:n,minBalance:r,pendingRewards:i,rewards:o,round:s,status:a,totalAppsOptedIn:c,totalAssetsOptedIn:u,totalCreatedApps:l,totalCreatedAssets:d,appsLocalState:f,appsTotalExtraPages:h,appsTotalSchema:p,assets:g,authAddr:m,createdApps:b,createdAssets:y,participation:v,rewardBase:w,sigType:x,totalBoxBytes:S,totalBoxes:A}){super(),this.address=e,this.amount=t,this.amountWithoutPendingRewards=n,this.minBalance=r,this.pendingRewards=i,this.rewards=o,this.round=s,this.status=a,this.totalAppsOptedIn=c,this.totalAssetsOptedIn=u,this.totalCreatedApps=l,this.totalCreatedAssets=d,this.appsLocalState=f,this.appsTotalExtraPages=h,this.appsTotalSchema=p,this.assets=g,this.authAddr=m,this.createdApps=b,this.createdAssets=y,this.participation=v,this.rewardBase=w,this.sigType=x,this.totalBoxBytes=S,this.totalBoxes=A,this.attribute_map={address:"address",amount:"amount",amountWithoutPendingRewards:"amount-without-pending-rewards",minBalance:"min-balance",pendingRewards:"pending-rewards",rewards:"rewards",round:"round",status:"status",totalAppsOptedIn:"total-apps-opted-in",totalAssetsOptedIn:"total-assets-opted-in",totalCreatedApps:"total-created-apps",totalCreatedAssets:"total-created-assets",appsLocalState:"apps-local-state",appsTotalExtraPages:"apps-total-extra-pages",appsTotalSchema:"apps-total-schema",assets:"assets",authAddr:"auth-addr",createdApps:"created-apps",createdAssets:"created-assets",participation:"participation",rewardBase:"reward-base",sigType:"sig-type",totalBoxBytes:"total-box-bytes",totalBoxes:"total-boxes"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["amount-without-pending-rewards"])throw new Error(`Response is missing required field 'amount-without-pending-rewards': ${e}`);if("undefined"===typeof e["min-balance"])throw new Error(`Response is missing required field 'min-balance': ${e}`);if("undefined"===typeof e["pending-rewards"])throw new Error(`Response is missing required field 'pending-rewards': ${e}`);if("undefined"===typeof e.rewards)throw new Error(`Response is missing required field 'rewards': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.status)throw new Error(`Response is missing required field 'status': ${e}`);if("undefined"===typeof e["total-apps-opted-in"])throw new Error(`Response is missing required field 'total-apps-opted-in': ${e}`);if("undefined"===typeof e["total-assets-opted-in"])throw new Error(`Response is missing required field 'total-assets-opted-in': ${e}`);if("undefined"===typeof e["total-created-apps"])throw new Error(`Response is missing required field 'total-created-apps': ${e}`);if("undefined"===typeof e["total-created-assets"])throw new Error(`Response is missing required field 'total-created-assets': ${e}`);return new he({address:e.address,amount:e.amount,amountWithoutPendingRewards:e["amount-without-pending-rewards"],minBalance:e["min-balance"],pendingRewards:e["pending-rewards"],rewards:e.rewards,round:e.round,status:e.status,totalAppsOptedIn:e["total-apps-opted-in"],totalAssetsOptedIn:e["total-assets-opted-in"],totalCreatedApps:e["total-created-apps"],totalCreatedAssets:e["total-created-assets"],appsLocalState:"undefined"!==typeof e["apps-local-state"]?e["apps-local-state"].map(Se.from_obj_for_encoding):void 0,appsTotalExtraPages:e["apps-total-extra-pages"],appsTotalSchema:"undefined"!==typeof e["apps-total-schema"]?_e.from_obj_for_encoding(e["apps-total-schema"]):void 0,assets:"undefined"!==typeof e.assets?e.assets.map(Ie.from_obj_for_encoding):void 0,authAddr:e["auth-addr"],createdApps:"undefined"!==typeof e["created-apps"]?e["created-apps"].map(ye.from_obj_for_encoding):void 0,createdAssets:"undefined"!==typeof e["created-assets"]?e["created-assets"].map(Ce.from_obj_for_encoding):void 0,participation:"undefined"!==typeof e.participation?me.from_obj_for_encoding(e.participation):void 0,rewardBase:e["reward-base"],sigType:e["sig-type"],totalBoxBytes:e["total-box-bytes"],totalBoxes:e["total-boxes"]})}}class pe extends fe{constructor({round:e,appLocalState:t,createdApp:n}){super(),this.round=e,this.appLocalState=t,this.createdApp=n,this.attribute_map={round:"round",appLocalState:"app-local-state",createdApp:"created-app"}}static from_obj_for_encoding(e){if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);return new pe({round:e.round,appLocalState:"undefined"!==typeof e["app-local-state"]?Se.from_obj_for_encoding(e["app-local-state"]):void 0,createdApp:"undefined"!==typeof e["created-app"]?Ae.from_obj_for_encoding(e["created-app"]):void 0})}}class ge extends fe{constructor({round:e,assetHolding:t,createdAsset:n}){super(),this.round=e,this.assetHolding=t,this.createdAsset=n,this.attribute_map={round:"round",assetHolding:"asset-holding",createdAsset:"created-asset"}}static from_obj_for_encoding(e){if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);return new ge({round:e.round,assetHolding:"undefined"!==typeof e["asset-holding"]?Ie.from_obj_for_encoding(e["asset-holding"]):void 0,createdAsset:"undefined"!==typeof e["created-asset"]?Te.from_obj_for_encoding(e["created-asset"]):void 0})}}class me extends fe{constructor({selectionParticipationKey:e,voteFirstValid:t,voteKeyDilution:n,voteLastValid:r,voteParticipationKey:i,stateProofKey:o}){super(),this.selectionParticipationKey="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.voteFirstValid=t,this.voteKeyDilution=n,this.voteLastValid=r,this.voteParticipationKey="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.stateProofKey="string"===typeof o?new Uint8Array(a.lW.from(o,"base64")):o,this.attribute_map={selectionParticipationKey:"selection-participation-key",voteFirstValid:"vote-first-valid",voteKeyDilution:"vote-key-dilution",voteLastValid:"vote-last-valid",voteParticipationKey:"vote-participation-key",stateProofKey:"state-proof-key"}}static from_obj_for_encoding(e){if("undefined"===typeof e["selection-participation-key"])throw new Error(`Response is missing required field 'selection-participation-key': ${e}`);if("undefined"===typeof e["vote-first-valid"])throw new Error(`Response is missing required field 'vote-first-valid': ${e}`);if("undefined"===typeof e["vote-key-dilution"])throw new Error(`Response is missing required field 'vote-key-dilution': ${e}`);if("undefined"===typeof e["vote-last-valid"])throw new Error(`Response is missing required field 'vote-last-valid': ${e}`);if("undefined"===typeof e["vote-participation-key"])throw new Error(`Response is missing required field 'vote-participation-key': ${e}`);return new me({selectionParticipationKey:e["selection-participation-key"],voteFirstValid:e["vote-first-valid"],voteKeyDilution:e["vote-key-dilution"],voteLastValid:e["vote-last-valid"],voteParticipationKey:e["vote-participation-key"],stateProofKey:e["state-proof-key"]})}}class be extends fe{constructor({address:e,delta:t}){super(),this.address=e,this.delta=t,this.attribute_map={address:"address",delta:"delta"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if(!Array.isArray(e.delta))throw new Error(`Response is missing required array field 'delta': ${e}`);return new be({address:e.address,delta:e.delta.map(Xe.from_obj_for_encoding)})}}class ye extends fe{constructor({id:e,params:t}){super(),this.id=e,this.params=t,this.attribute_map={id:"id",params:"params"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);if("undefined"===typeof e.params)throw new Error(`Response is missing required field 'params': ${e}`);return new ye({id:e.id,params:Ae.from_obj_for_encoding(e.params)})}}class ve extends fe{constructor({id:e,appBoxes:t,appGlobals:n,appLocals:r}){super(),this.id=e,this.appBoxes=t,this.appGlobals=n,this.appLocals=r,this.attribute_map={id:"id",appBoxes:"app-boxes",appGlobals:"app-globals",appLocals:"app-locals"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);return new ve({id:e.id,appBoxes:"undefined"!==typeof e["app-boxes"]?we.from_obj_for_encoding(e["app-boxes"]):void 0,appGlobals:"undefined"!==typeof e["app-globals"]?we.from_obj_for_encoding(e["app-globals"]):void 0,appLocals:"undefined"!==typeof e["app-locals"]?e["app-locals"].map(we.from_obj_for_encoding):void 0})}}class we extends fe{constructor({kvs:e,account:t}){super(),this.kvs=e,this.account=t,this.attribute_map={kvs:"kvs",account:"account"}}static from_obj_for_encoding(e){if(!Array.isArray(e.kvs))throw new Error(`Response is missing required array field 'kvs': ${e}`);return new we({kvs:e.kvs.map(Me.from_obj_for_encoding),account:e.account})}}class xe extends fe{constructor({account:e,app:t}){super(),this.account=e,this.app=t,this.attribute_map={account:"account",app:"app"}}static from_obj_for_encoding(e){if("undefined"===typeof e.account)throw new Error(`Response is missing required field 'account': ${e}`);if("undefined"===typeof e.app)throw new Error(`Response is missing required field 'app': ${e}`);return new xe({account:e.account,app:e.app})}}class Se extends fe{constructor({id:e,schema:t,keyValue:n}){super(),this.id=e,this.schema=t,this.keyValue=n,this.attribute_map={id:"id",schema:"schema",keyValue:"key-value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);if("undefined"===typeof e.schema)throw new Error(`Response is missing required field 'schema': ${e}`);return new Se({id:e.id,schema:_e.from_obj_for_encoding(e.schema),keyValue:"undefined"!==typeof e["key-value"]?e["key-value"].map(wt.from_obj_for_encoding):void 0})}}class Ae extends fe{constructor({approvalProgram:e,clearStateProgram:t,creator:n,extraProgramPages:r,globalState:i,globalStateSchema:o,localStateSchema:s}){super(),this.approvalProgram="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.clearStateProgram="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.creator=n,this.extraProgramPages=r,this.globalState=i,this.globalStateSchema=o,this.localStateSchema=s,this.attribute_map={approvalProgram:"approval-program",clearStateProgram:"clear-state-program",creator:"creator",extraProgramPages:"extra-program-pages",globalState:"global-state",globalStateSchema:"global-state-schema",localStateSchema:"local-state-schema"}}static from_obj_for_encoding(e){if("undefined"===typeof e["approval-program"])throw new Error(`Response is missing required field 'approval-program': ${e}`);if("undefined"===typeof e["clear-state-program"])throw new Error(`Response is missing required field 'clear-state-program': ${e}`);if("undefined"===typeof e.creator)throw new Error(`Response is missing required field 'creator': ${e}`);return new Ae({approvalProgram:e["approval-program"],clearStateProgram:e["clear-state-program"],creator:e.creator,extraProgramPages:e["extra-program-pages"],globalState:"undefined"!==typeof e["global-state"]?e["global-state"].map(wt.from_obj_for_encoding):void 0,globalStateSchema:"undefined"!==typeof e["global-state-schema"]?_e.from_obj_for_encoding(e["global-state-schema"]):void 0,localStateSchema:"undefined"!==typeof e["local-state-schema"]?_e.from_obj_for_encoding(e["local-state-schema"]):void 0})}}class Ee extends fe{constructor({appStateType:e,key:t,operation:n,account:r,newValue:i}){super(),this.appStateType=e,this.key="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.operation=n,this.account=r,this.newValue=i,this.attribute_map={appStateType:"app-state-type",key:"key",operation:"operation",account:"account",newValue:"new-value"}}static from_obj_for_encoding(e){if("undefined"===typeof e["app-state-type"])throw new Error(`Response is missing required field 'app-state-type': ${e}`);if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.operation)throw new Error(`Response is missing required field 'operation': ${e}`);return new Ee({appStateType:e["app-state-type"],key:e.key,operation:e.operation,account:e.account,newValue:"undefined"!==typeof e["new-value"]?Pe.from_obj_for_encoding(e["new-value"]):void 0})}}class _e extends fe{constructor({numUint:e,numByteSlice:t}){super(),this.numUint=e,this.numByteSlice=t,this.attribute_map={numUint:"num-uint",numByteSlice:"num-byte-slice"}}static from_obj_for_encoding(e){if("undefined"===typeof e["num-uint"])throw new Error(`Response is missing required field 'num-uint': ${e}`);if("undefined"===typeof e["num-byte-slice"])throw new Error(`Response is missing required field 'num-byte-slice': ${e}`);return new _e({numUint:e["num-uint"],numByteSlice:e["num-byte-slice"]})}}class Ce extends fe{constructor({index:e,params:t}){super(),this.index=e,this.params=t,this.attribute_map={index:"index",params:"params"}}static from_obj_for_encoding(e){if("undefined"===typeof e.index)throw new Error(`Response is missing required field 'index': ${e}`);if("undefined"===typeof e.params)throw new Error(`Response is missing required field 'params': ${e}`);return new Ce({index:e.index,params:Te.from_obj_for_encoding(e.params)})}}class Ie extends fe{constructor({amount:e,assetId:t,isFrozen:n}){super(),this.amount=e,this.assetId=t,this.isFrozen=n,this.attribute_map={amount:"amount",assetId:"asset-id",isFrozen:"is-frozen"}}static from_obj_for_encoding(e){if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["asset-id"])throw new Error(`Response is missing required field 'asset-id': ${e}`);if("undefined"===typeof e["is-frozen"])throw new Error(`Response is missing required field 'is-frozen': ${e}`);return new Ie({amount:e.amount,assetId:e["asset-id"],isFrozen:e["is-frozen"]})}}class ke extends fe{constructor({account:e,asset:t}){super(),this.account=e,this.asset=t,this.attribute_map={account:"account",asset:"asset"}}static from_obj_for_encoding(e){if("undefined"===typeof e.account)throw new Error(`Response is missing required field 'account': ${e}`);if("undefined"===typeof e.asset)throw new Error(`Response is missing required field 'asset': ${e}`);return new ke({account:e.account,asset:e.asset})}}class Te extends fe{constructor({creator:e,decimals:t,total:n,clawback:r,defaultFrozen:i,freeze:o,manager:s,metadataHash:c,name:u,nameB64:l,reserve:d,unitName:f,unitNameB64:h,url:p,urlB64:g}){super(),this.creator=e,this.decimals=t,this.total=n,this.clawback=r,this.defaultFrozen=i,this.freeze=o,this.manager=s,this.metadataHash="string"===typeof c?new Uint8Array(a.lW.from(c,"base64")):c,this.name=u,this.nameB64="string"===typeof l?new Uint8Array(a.lW.from(l,"base64")):l,this.reserve=d,this.unitName=f,this.unitNameB64="string"===typeof h?new Uint8Array(a.lW.from(h,"base64")):h,this.url=p,this.urlB64="string"===typeof g?new Uint8Array(a.lW.from(g,"base64")):g,this.attribute_map={creator:"creator",decimals:"decimals",total:"total",clawback:"clawback",defaultFrozen:"default-frozen",freeze:"freeze",manager:"manager",metadataHash:"metadata-hash",name:"name",nameB64:"name-b64",reserve:"reserve",unitName:"unit-name",unitNameB64:"unit-name-b64",url:"url",urlB64:"url-b64"}}static from_obj_for_encoding(e){if("undefined"===typeof e.creator)throw new Error(`Response is missing required field 'creator': ${e}`);if("undefined"===typeof e.decimals)throw new Error(`Response is missing required field 'decimals': ${e}`);if("undefined"===typeof e.total)throw new Error(`Response is missing required field 'total': ${e}`);return new Te({creator:e.creator,decimals:e.decimals,total:e.total,clawback:e.clawback,defaultFrozen:e["default-frozen"],freeze:e.freeze,manager:e.manager,metadataHash:e["metadata-hash"],name:e.name,nameB64:e["name-b64"],reserve:e.reserve,unitName:e["unit-name"],unitNameB64:e["unit-name-b64"],url:e.url,urlB64:e["url-b64"]})}}class Me extends fe{constructor({key:e,value:t}){super(),this.key="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new Me({key:e.key,value:Pe.from_obj_for_encoding(e.value)})}}class Pe extends fe{constructor({type:e,bytes:t,uint:n}){super(),this.type=e,this.bytes="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.uint=n,this.attribute_map={type:"type",bytes:"bytes",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.type)throw new Error(`Response is missing required field 'type': ${e}`);return new Pe({type:e.type,bytes:e.bytes,uint:e.uint})}}class Oe extends fe{constructor({blockhash:e}){super(),this.blockhash=e,this.attribute_map={blockhash:"blockHash"}}static from_obj_for_encoding(e){if("undefined"===typeof e.blockHash)throw new Error(`Response is missing required field 'blockHash': ${e}`);return new Oe({blockhash:e.blockHash})}}class Re extends fe{constructor({block:e,cert:t}){super(),this.block=e,this.cert=t,this.attribute_map={block:"block",cert:"cert"}}static from_obj_for_encoding(e){if("undefined"===typeof e.block)throw new Error(`Response is missing required field 'block': ${e}`);return new Re({block:e.block,cert:e.cert})}}class Ne extends fe{constructor({blocktxids:e}){super(),this.blocktxids=e,this.attribute_map={blocktxids:"blockTxids"}}static from_obj_for_encoding(e){if(!Array.isArray(e.blockTxids))throw new Error(`Response is missing required array field 'blockTxids': ${e}`);return new Ne({blocktxids:e.blockTxids})}}class Be extends fe{constructor({name:e,round:t,value:n}){super(),this.name="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.round=t,this.value="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.attribute_map={name:"name",round:"round",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new Be({name:e.name,round:e.round,value:e.value})}}class Le extends fe{constructor({name:e}){super(),this.name="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.attribute_map={name:"name"}}static from_obj_for_encoding(e){if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);return new Le({name:e.name})}}class De extends fe{constructor({app:e,name:t}){super(),this.app=e,this.name="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={app:"app",name:"name"}}static from_obj_for_encoding(e){if("undefined"===typeof e.app)throw new Error(`Response is missing required field 'app': ${e}`);if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);return new De({app:e.app,name:e.name})}}class Ue extends fe{constructor({boxes:e}){super(),this.boxes=e,this.attribute_map={boxes:"boxes"}}static from_obj_for_encoding(e){if(!Array.isArray(e.boxes))throw new Error(`Response is missing required array field 'boxes': ${e}`);return new Ue({boxes:e.boxes.map(Le.from_obj_for_encoding)})}}class je extends fe{constructor({branch:e,buildNumber:t,channel:n,commitHash:r,major:i,minor:o}){super(),this.branch=e,this.buildNumber=t,this.channel=n,this.commitHash=r,this.major=i,this.minor=o,this.attribute_map={branch:"branch",buildNumber:"build_number",channel:"channel",commitHash:"commit_hash",major:"major",minor:"minor"}}static from_obj_for_encoding(e){if("undefined"===typeof e.branch)throw new Error(`Response is missing required field 'branch': ${e}`);if("undefined"===typeof e.build_number)throw new Error(`Response is missing required field 'build_number': ${e}`);if("undefined"===typeof e.channel)throw new Error(`Response is missing required field 'channel': ${e}`);if("undefined"===typeof e.commit_hash)throw new Error(`Response is missing required field 'commit_hash': ${e}`);if("undefined"===typeof e.major)throw new Error(`Response is missing required field 'major': ${e}`);if("undefined"===typeof e.minor)throw new Error(`Response is missing required field 'minor': ${e}`);return new je({branch:e.branch,buildNumber:e.build_number,channel:e.channel,commitHash:e.commit_hash,major:e.major,minor:e.minor})}}class Fe extends fe{constructor({hash:e,result:t,sourcemap:n}){super(),this.hash=e,this.result=t,this.sourcemap=n,this.attribute_map={hash:"hash",result:"result",sourcemap:"sourcemap"}}static from_obj_for_encoding(e){if("undefined"===typeof e.hash)throw new Error(`Response is missing required field 'hash': ${e}`);if("undefined"===typeof e.result)throw new Error(`Response is missing required field 'result': ${e}`);return new Fe({hash:e.hash,result:e.result,sourcemap:e.sourcemap})}}class Ve extends fe{constructor({result:e}){super(),this.result=e,this.attribute_map={result:"result"}}static from_obj_for_encoding(e){if("undefined"===typeof e.result)throw new Error(`Response is missing required field 'result': ${e}`);return new Ve({result:e.result})}}class qe extends fe{constructor({accounts:e,apps:t,latestTimestamp:n,protocolVersion:r,round:i,sources:o,txns:s}){super(),this.accounts=e,this.apps=t,this.latestTimestamp=n,this.protocolVersion=r,this.round=i,this.sources=o,this.txns=s,this.attribute_map={accounts:"accounts",apps:"apps",latestTimestamp:"latest-timestamp",protocolVersion:"protocol-version",round:"round",sources:"sources",txns:"txns"}}static from_obj_for_encoding(e){if(!Array.isArray(e.accounts))throw new Error(`Response is missing required array field 'accounts': ${e}`);if(!Array.isArray(e.apps))throw new Error(`Response is missing required array field 'apps': ${e}`);if("undefined"===typeof e["latest-timestamp"])throw new Error(`Response is missing required field 'latest-timestamp': ${e}`);if("undefined"===typeof e["protocol-version"])throw new Error(`Response is missing required field 'protocol-version': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if(!Array.isArray(e.sources))throw new Error(`Response is missing required array field 'sources': ${e}`);if(!Array.isArray(e.txns))throw new Error(`Response is missing required array field 'txns': ${e}`);return new qe({accounts:e.accounts.map(he.from_obj_for_encoding),apps:e.apps.map(ye.from_obj_for_encoding),latestTimestamp:e["latest-timestamp"],protocolVersion:e["protocol-version"],round:e.round,sources:e.sources.map(He.from_obj_for_encoding),txns:e.txns})}}class ze extends fe{constructor({error:e,protocolVersion:t,txns:n}){super(),this.error=e,this.protocolVersion=t,this.txns=n,this.attribute_map={error:"error",protocolVersion:"protocol-version",txns:"txns"}}static from_obj_for_encoding(e){if("undefined"===typeof e.error)throw new Error(`Response is missing required field 'error': ${e}`);if("undefined"===typeof e["protocol-version"])throw new Error(`Response is missing required field 'protocol-version': ${e}`);if(!Array.isArray(e.txns))throw new Error(`Response is missing required array field 'txns': ${e}`);return new ze({error:e.error,protocolVersion:e["protocol-version"],txns:e.txns.map(Ge.from_obj_for_encoding)})}}class He extends fe{constructor({fieldName:e,source:t,txnIndex:n,appIndex:r}){super(),this.fieldName=e,this.source=t,this.txnIndex=n,this.appIndex=r,this.attribute_map={fieldName:"field-name",source:"source",txnIndex:"txn-index",appIndex:"app-index"}}static from_obj_for_encoding(e){if("undefined"===typeof e["field-name"])throw new Error(`Response is missing required field 'field-name': ${e}`);if("undefined"===typeof e.source)throw new Error(`Response is missing required field 'source': ${e}`);if("undefined"===typeof e["txn-index"])throw new Error(`Response is missing required field 'txn-index': ${e}`);if("undefined"===typeof e["app-index"])throw new Error(`Response is missing required field 'app-index': ${e}`);return new He({fieldName:e["field-name"],source:e.source,txnIndex:e["txn-index"],appIndex:e["app-index"]})}}class We extends fe{constructor({line:e,pc:t,stack:n,error:r,scratch:i}){super(),this.line=e,this.pc=t,this.stack=n,this.error=r,this.scratch=i,this.attribute_map={line:"line",pc:"pc",stack:"stack",error:"error",scratch:"scratch"}}static from_obj_for_encoding(e){if("undefined"===typeof e.line)throw new Error(`Response is missing required field 'line': ${e}`);if("undefined"===typeof e.pc)throw new Error(`Response is missing required field 'pc': ${e}`);if(!Array.isArray(e.stack))throw new Error(`Response is missing required array field 'stack': ${e}`);return new We({line:e.line,pc:e.pc,stack:e.stack.map(xt.from_obj_for_encoding),error:e.error,scratch:"undefined"!==typeof e.scratch?e.scratch.map(xt.from_obj_for_encoding):void 0})}}class Ge extends fe{constructor({disassembly:e,appCallMessages:t,appCallTrace:n,budgetAdded:r,budgetConsumed:i,globalDelta:o,localDeltas:s,logicSigDisassembly:a,logicSigMessages:c,logicSigTrace:u,logs:l}){super(),this.disassembly=e,this.appCallMessages=t,this.appCallTrace=n,this.budgetAdded=r,this.budgetConsumed=i,this.globalDelta=o,this.localDeltas=s,this.logicSigDisassembly=a,this.logicSigMessages=c,this.logicSigTrace=u,this.logs=l,this.attribute_map={disassembly:"disassembly",appCallMessages:"app-call-messages",appCallTrace:"app-call-trace",budgetAdded:"budget-added",budgetConsumed:"budget-consumed",globalDelta:"global-delta",localDeltas:"local-deltas",logicSigDisassembly:"logic-sig-disassembly",logicSigMessages:"logic-sig-messages",logicSigTrace:"logic-sig-trace",logs:"logs"}}static from_obj_for_encoding(e){if(!Array.isArray(e.disassembly))throw new Error(`Response is missing required array field 'disassembly': ${e}`);return new Ge({disassembly:e.disassembly,appCallMessages:e["app-call-messages"],appCallTrace:"undefined"!==typeof e["app-call-trace"]?e["app-call-trace"].map(We.from_obj_for_encoding):void 0,budgetAdded:e["budget-added"],budgetConsumed:e["budget-consumed"],globalDelta:"undefined"!==typeof e["global-delta"]?e["global-delta"].map(Xe.from_obj_for_encoding):void 0,localDeltas:"undefined"!==typeof e["local-deltas"]?e["local-deltas"].map(be.from_obj_for_encoding):void 0,logicSigDisassembly:e["logic-sig-disassembly"],logicSigMessages:e["logic-sig-messages"],logicSigTrace:"undefined"!==typeof e["logic-sig-trace"]?e["logic-sig-trace"].map(We.from_obj_for_encoding):void 0,logs:e.logs})}}class Ze extends fe{constructor({message:e,data:t}){super(),this.message=e,this.data=t,this.attribute_map={message:"message",data:"data"}}static from_obj_for_encoding(e){if("undefined"===typeof e.message)throw new Error(`Response is missing required field 'message': ${e}`);return new Ze({message:e.message,data:e.data})}}class Ke extends fe{constructor({action:e,bytes:t,uint:n}){super(),this.action=e,this.bytes=t,this.uint=n,this.attribute_map={action:"action",bytes:"bytes",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.action)throw new Error(`Response is missing required field 'action': ${e}`);return new Ke({action:e.action,bytes:e.bytes,uint:e.uint})}}class Xe extends fe{constructor({key:e,value:t}){super(),this.key=e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new Xe({key:e.key,value:Ke.from_obj_for_encoding(e.value)})}}class Ye extends fe{constructor({offset:e}){super(),this.offset=e,this.attribute_map={offset:"offset"}}static from_obj_for_encoding(e){if("undefined"===typeof e.offset)throw new Error(`Response is missing required field 'offset': ${e}`);return new Ye({offset:e.offset})}}class Je extends fe{constructor({round:e}){super(),this.round=e,this.attribute_map={round:"round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);return new Je({round:e.round})}}class Qe extends fe{constructor({key:e,value:t}){super(),this.key="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.value="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){return new Qe({key:e.key,value:e.value})}}class $e extends fe{constructor({delta:e,ids:t}){super(),this.delta=e,this.ids=t,this.attribute_map={delta:"Delta",ids:"Ids"}}static from_obj_for_encoding(e){if("undefined"===typeof e.Delta)throw new Error(`Response is missing required field 'Delta': ${e}`);if(!Array.isArray(e.Ids))throw new Error(`Response is missing required array field 'Ids': ${e}`);return new $e({delta:e.Delta,ids:e.Ids})}}class et extends fe{constructor({index:e,proof:t,treedepth:n}){super(),this.index=e,this.proof="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.treedepth=n,this.attribute_map={index:"index",proof:"proof",treedepth:"treedepth"}}static from_obj_for_encoding(e){if("undefined"===typeof e.index)throw new Error(`Response is missing required field 'index': ${e}`);if("undefined"===typeof e.proof)throw new Error(`Response is missing required field 'proof': ${e}`);if("undefined"===typeof e.treedepth)throw new Error(`Response is missing required field 'treedepth': ${e}`);return new et({index:e.index,proof:e.proof,treedepth:e.treedepth})}}class tt extends fe{constructor({catchupTime:e,lastRound:t,lastVersion:n,nextVersion:r,nextVersionRound:i,nextVersionSupported:o,stoppedAtUnsupportedRound:s,timeSinceLastRound:a,catchpoint:c,catchpointAcquiredBlocks:u,catchpointProcessedAccounts:l,catchpointProcessedKvs:d,catchpointTotalAccounts:f,catchpointTotalBlocks:h,catchpointTotalKvs:p,catchpointVerifiedAccounts:g,catchpointVerifiedKvs:m,lastCatchpoint:b,upgradeDelay:y,upgradeNextProtocolVoteBefore:v,upgradeNoVotes:w,upgradeNodeVote:x,upgradeVoteRounds:S,upgradeVotes:A,upgradeVotesRequired:E,upgradeYesVotes:_}){super(),this.catchupTime=e,this.lastRound=t,this.lastVersion=n,this.nextVersion=r,this.nextVersionRound=i,this.nextVersionSupported=o,this.stoppedAtUnsupportedRound=s,this.timeSinceLastRound=a,this.catchpoint=c,this.catchpointAcquiredBlocks=u,this.catchpointProcessedAccounts=l,this.catchpointProcessedKvs=d,this.catchpointTotalAccounts=f,this.catchpointTotalBlocks=h,this.catchpointTotalKvs=p,this.catchpointVerifiedAccounts=g,this.catchpointVerifiedKvs=m,this.lastCatchpoint=b,this.upgradeDelay=y,this.upgradeNextProtocolVoteBefore=v,this.upgradeNoVotes=w,this.upgradeNodeVote=x,this.upgradeVoteRounds=S,this.upgradeVotes=A,this.upgradeVotesRequired=E,this.upgradeYesVotes=_,this.attribute_map={catchupTime:"catchup-time",lastRound:"last-round",lastVersion:"last-version",nextVersion:"next-version",nextVersionRound:"next-version-round",nextVersionSupported:"next-version-supported",stoppedAtUnsupportedRound:"stopped-at-unsupported-round",timeSinceLastRound:"time-since-last-round",catchpoint:"catchpoint",catchpointAcquiredBlocks:"catchpoint-acquired-blocks",catchpointProcessedAccounts:"catchpoint-processed-accounts",catchpointProcessedKvs:"catchpoint-processed-kvs",catchpointTotalAccounts:"catchpoint-total-accounts",catchpointTotalBlocks:"catchpoint-total-blocks",catchpointTotalKvs:"catchpoint-total-kvs",catchpointVerifiedAccounts:"catchpoint-verified-accounts",catchpointVerifiedKvs:"catchpoint-verified-kvs",lastCatchpoint:"last-catchpoint",upgradeDelay:"upgrade-delay",upgradeNextProtocolVoteBefore:"upgrade-next-protocol-vote-before",upgradeNoVotes:"upgrade-no-votes",upgradeNodeVote:"upgrade-node-vote",upgradeVoteRounds:"upgrade-vote-rounds",upgradeVotes:"upgrade-votes",upgradeVotesRequired:"upgrade-votes-required",upgradeYesVotes:"upgrade-yes-votes"}}static from_obj_for_encoding(e){if("undefined"===typeof e["catchup-time"])throw new Error(`Response is missing required field 'catchup-time': ${e}`);if("undefined"===typeof e["last-round"])throw new Error(`Response is missing required field 'last-round': ${e}`);if("undefined"===typeof e["last-version"])throw new Error(`Response is missing required field 'last-version': ${e}`);if("undefined"===typeof e["next-version"])throw new Error(`Response is missing required field 'next-version': ${e}`);if("undefined"===typeof e["next-version-round"])throw new Error(`Response is missing required field 'next-version-round': ${e}`);if("undefined"===typeof e["next-version-supported"])throw new Error(`Response is missing required field 'next-version-supported': ${e}`);if("undefined"===typeof e["stopped-at-unsupported-round"])throw new Error(`Response is missing required field 'stopped-at-unsupported-round': ${e}`);if("undefined"===typeof e["time-since-last-round"])throw new Error(`Response is missing required field 'time-since-last-round': ${e}`);return new tt({catchupTime:e["catchup-time"],lastRound:e["last-round"],lastVersion:e["last-version"],nextVersion:e["next-version"],nextVersionRound:e["next-version-round"],nextVersionSupported:e["next-version-supported"],stoppedAtUnsupportedRound:e["stopped-at-unsupported-round"],timeSinceLastRound:e["time-since-last-round"],catchpoint:e.catchpoint,catchpointAcquiredBlocks:e["catchpoint-acquired-blocks"],catchpointProcessedAccounts:e["catchpoint-processed-accounts"],catchpointProcessedKvs:e["catchpoint-processed-kvs"],catchpointTotalAccounts:e["catchpoint-total-accounts"],catchpointTotalBlocks:e["catchpoint-total-blocks"],catchpointTotalKvs:e["catchpoint-total-kvs"],catchpointVerifiedAccounts:e["catchpoint-verified-accounts"],catchpointVerifiedKvs:e["catchpoint-verified-kvs"],lastCatchpoint:e["last-catchpoint"],upgradeDelay:e["upgrade-delay"],upgradeNextProtocolVoteBefore:e["upgrade-next-protocol-vote-before"],upgradeNoVotes:e["upgrade-no-votes"],upgradeNodeVote:e["upgrade-node-vote"],upgradeVoteRounds:e["upgrade-vote-rounds"],upgradeVotes:e["upgrade-votes"],upgradeVotesRequired:e["upgrade-votes-required"],upgradeYesVotes:e["upgrade-yes-votes"]})}}class nt extends fe{constructor({poolError:e,txn:t,applicationIndex:n,assetClosingAmount:r,assetIndex:i,closeRewards:o,closingAmount:s,confirmedRound:a,globalStateDelta:c,innerTxns:u,localStateDelta:l,logs:d,receiverRewards:f,senderRewards:h}){super(),this.poolError=e,this.txn=t,this.applicationIndex=n,this.assetClosingAmount=r,this.assetIndex=i,this.closeRewards=o,this.closingAmount=s,this.confirmedRound=a,this.globalStateDelta=c,this.innerTxns=u,this.localStateDelta=l,this.logs=d,this.receiverRewards=f,this.senderRewards=h,this.attribute_map={poolError:"pool-error",txn:"txn",applicationIndex:"application-index",assetClosingAmount:"asset-closing-amount",assetIndex:"asset-index",closeRewards:"close-rewards",closingAmount:"closing-amount",confirmedRound:"confirmed-round",globalStateDelta:"global-state-delta",innerTxns:"inner-txns",localStateDelta:"local-state-delta",logs:"logs",receiverRewards:"receiver-rewards",senderRewards:"sender-rewards"}}static from_obj_for_encoding(e){if("undefined"===typeof e["pool-error"])throw new Error(`Response is missing required field 'pool-error': ${e}`);if("undefined"===typeof e.txn)throw new Error(`Response is missing required field 'txn': ${e}`);return new nt({poolError:e["pool-error"],txn:e.txn,applicationIndex:e["application-index"],assetClosingAmount:e["asset-closing-amount"],assetIndex:e["asset-index"],closeRewards:e["close-rewards"],closingAmount:e["closing-amount"],confirmedRound:e["confirmed-round"],globalStateDelta:"undefined"!==typeof e["global-state-delta"]?e["global-state-delta"].map(Xe.from_obj_for_encoding):void 0,innerTxns:"undefined"!==typeof e["inner-txns"]?e["inner-txns"].map(nt.from_obj_for_encoding):void 0,localStateDelta:"undefined"!==typeof e["local-state-delta"]?e["local-state-delta"].map(be.from_obj_for_encoding):void 0,logs:e.logs,receiverRewards:e["receiver-rewards"],senderRewards:e["sender-rewards"]})}}class rt extends fe{constructor({topTransactions:e,totalTransactions:t}){super(),this.topTransactions=e,this.totalTransactions=t,this.attribute_map={topTransactions:"top-transactions",totalTransactions:"total-transactions"}}static from_obj_for_encoding(e){if(!Array.isArray(e["top-transactions"]))throw new Error(`Response is missing required array field 'top-transactions': ${e}`);if("undefined"===typeof e["total-transactions"])throw new Error(`Response is missing required field 'total-transactions': ${e}`);return new rt({topTransactions:e["top-transactions"],totalTransactions:e["total-transactions"]})}}class it extends fe{constructor({txid:e}){super(),this.txid=e,this.attribute_map={txid:"txId"}}static from_obj_for_encoding(e){if("undefined"===typeof e.txId)throw new Error(`Response is missing required field 'txId': ${e}`);return new it({txid:e.txId})}}class ot extends fe{constructor({newValue:e,slot:t}){super(),this.newValue=e,this.slot=t,this.attribute_map={newValue:"new-value",slot:"slot"}}static from_obj_for_encoding(e){if("undefined"===typeof e["new-value"])throw new Error(`Response is missing required field 'new-value': ${e}`);if("undefined"===typeof e.slot)throw new Error(`Response is missing required field 'slot': ${e}`);return new ot({newValue:Pe.from_obj_for_encoding(e["new-value"]),slot:e.slot})}}class st extends fe{constructor({appInitialStates:e}){super(),this.appInitialStates=e,this.attribute_map={appInitialStates:"app-initial-states"}}static from_obj_for_encoding(e){return new st({appInitialStates:"undefined"!==typeof e["app-initial-states"]?e["app-initial-states"].map(ve.from_obj_for_encoding):void 0})}}class at extends fe{constructor({txnGroups:e,allowEmptySignatures:t,allowMoreLogging:n,allowUnnamedResources:r,execTraceConfig:i,extraOpcodeBudget:o,round:s}){super(),this.txnGroups=e,this.allowEmptySignatures=t,this.allowMoreLogging=n,this.allowUnnamedResources=r,this.execTraceConfig=i,this.extraOpcodeBudget=o,this.round=s,this.attribute_map={txnGroups:"txn-groups",allowEmptySignatures:"allow-empty-signatures",allowMoreLogging:"allow-more-logging",allowUnnamedResources:"allow-unnamed-resources",execTraceConfig:"exec-trace-config",extraOpcodeBudget:"extra-opcode-budget",round:"round"}}static from_obj_for_encoding(e){if(!Array.isArray(e["txn-groups"]))throw new Error(`Response is missing required array field 'txn-groups': ${e}`);return new at({txnGroups:e["txn-groups"].map(ct.from_obj_for_encoding),allowEmptySignatures:e["allow-empty-signatures"],allowMoreLogging:e["allow-more-logging"],allowUnnamedResources:e["allow-unnamed-resources"],execTraceConfig:"undefined"!==typeof e["exec-trace-config"]?lt.from_obj_for_encoding(e["exec-trace-config"]):void 0,extraOpcodeBudget:e["extra-opcode-budget"],round:e.round})}}class ct extends fe{constructor({txns:e}){super(),this.txns=e,this.attribute_map={txns:"txns"}}static from_obj_for_encoding(e){if(!Array.isArray(e.txns))throw new Error(`Response is missing required array field 'txns': ${e}`);return new ct({txns:e.txns})}}class ut extends fe{constructor({lastRound:e,txnGroups:t,version:n,evalOverrides:r,execTraceConfig:i,initialStates:o}){super(),this.lastRound=e,this.txnGroups=t,this.version=n,this.evalOverrides=r,this.execTraceConfig=i,this.initialStates=o,this.attribute_map={lastRound:"last-round",txnGroups:"txn-groups",version:"version",evalOverrides:"eval-overrides",execTraceConfig:"exec-trace-config",initialStates:"initial-states"}}static from_obj_for_encoding(e){if("undefined"===typeof e["last-round"])throw new Error(`Response is missing required field 'last-round': ${e}`);if(!Array.isArray(e["txn-groups"]))throw new Error(`Response is missing required array field 'txn-groups': ${e}`);if("undefined"===typeof e.version)throw new Error(`Response is missing required field 'version': ${e}`);return new ut({lastRound:e["last-round"],txnGroups:e["txn-groups"].map(dt.from_obj_for_encoding),version:e.version,evalOverrides:"undefined"!==typeof e["eval-overrides"]?pt.from_obj_for_encoding(e["eval-overrides"]):void 0,execTraceConfig:"undefined"!==typeof e["exec-trace-config"]?lt.from_obj_for_encoding(e["exec-trace-config"]):void 0,initialStates:"undefined"!==typeof e["initial-states"]?st.from_obj_for_encoding(e["initial-states"]):void 0})}}class lt extends fe{constructor({enable:e,scratchChange:t,stackChange:n,stateChange:r}){super(),this.enable=e,this.scratchChange=t,this.stackChange=n,this.stateChange=r,this.attribute_map={enable:"enable",scratchChange:"scratch-change",stackChange:"stack-change",stateChange:"state-change"}}static from_obj_for_encoding(e){return new lt({enable:e.enable,scratchChange:e["scratch-change"],stackChange:e["stack-change"],stateChange:e["state-change"]})}}class dt extends fe{constructor({txnResults:e,appBudgetAdded:t,appBudgetConsumed:n,failedAt:r,failureMessage:i,unnamedResourcesAccessed:o}){super(),this.txnResults=e,this.appBudgetAdded=t,this.appBudgetConsumed=n,this.failedAt=r,this.failureMessage=i,this.unnamedResourcesAccessed=o,this.attribute_map={txnResults:"txn-results",appBudgetAdded:"app-budget-added",appBudgetConsumed:"app-budget-consumed",failedAt:"failed-at",failureMessage:"failure-message",unnamedResourcesAccessed:"unnamed-resources-accessed"}}static from_obj_for_encoding(e){if(!Array.isArray(e["txn-results"]))throw new Error(`Response is missing required array field 'txn-results': ${e}`);return new dt({txnResults:e["txn-results"].map(ft.from_obj_for_encoding),appBudgetAdded:e["app-budget-added"],appBudgetConsumed:e["app-budget-consumed"],failedAt:e["failed-at"],failureMessage:e["failure-message"],unnamedResourcesAccessed:"undefined"!==typeof e["unnamed-resources-accessed"]?ht.from_obj_for_encoding(e["unnamed-resources-accessed"]):void 0})}}class ft extends fe{constructor({txnResult:e,appBudgetConsumed:t,execTrace:n,logicSigBudgetConsumed:r,unnamedResourcesAccessed:i}){super(),this.txnResult=e,this.appBudgetConsumed=t,this.execTrace=n,this.logicSigBudgetConsumed=r,this.unnamedResourcesAccessed=i,this.attribute_map={txnResult:"txn-result",appBudgetConsumed:"app-budget-consumed",execTrace:"exec-trace",logicSigBudgetConsumed:"logic-sig-budget-consumed",unnamedResourcesAccessed:"unnamed-resources-accessed"}}static from_obj_for_encoding(e){if("undefined"===typeof e["txn-result"])throw new Error(`Response is missing required field 'txn-result': ${e}`);return new ft({txnResult:nt.from_obj_for_encoding(e["txn-result"]),appBudgetConsumed:e["app-budget-consumed"],execTrace:"undefined"!==typeof e["exec-trace"]?mt.from_obj_for_encoding(e["exec-trace"]):void 0,logicSigBudgetConsumed:e["logic-sig-budget-consumed"],unnamedResourcesAccessed:"undefined"!==typeof e["unnamed-resources-accessed"]?ht.from_obj_for_encoding(e["unnamed-resources-accessed"]):void 0})}}class ht extends fe{constructor({accounts:e,appLocals:t,apps:n,assetHoldings:r,assets:i,boxes:o,extraBoxRefs:s}){super(),this.accounts=e,this.appLocals=t,this.apps=n,this.assetHoldings=r,this.assets=i,this.boxes=o,this.extraBoxRefs=s,this.attribute_map={accounts:"accounts",appLocals:"app-locals",apps:"apps",assetHoldings:"asset-holdings",assets:"assets",boxes:"boxes",extraBoxRefs:"extra-box-refs"}}static from_obj_for_encoding(e){return new ht({accounts:e.accounts,appLocals:"undefined"!==typeof e["app-locals"]?e["app-locals"].map(xe.from_obj_for_encoding):void 0,apps:e.apps,assetHoldings:"undefined"!==typeof e["asset-holdings"]?e["asset-holdings"].map(ke.from_obj_for_encoding):void 0,assets:e.assets,boxes:"undefined"!==typeof e.boxes?e.boxes.map(De.from_obj_for_encoding):void 0,extraBoxRefs:e["extra-box-refs"]})}}class pt extends fe{constructor({allowEmptySignatures:e,allowUnnamedResources:t,extraOpcodeBudget:n,maxLogCalls:r,maxLogSize:i}){super(),this.allowEmptySignatures=e,this.allowUnnamedResources=t,this.extraOpcodeBudget=n,this.maxLogCalls=r,this.maxLogSize=i,this.attribute_map={allowEmptySignatures:"allow-empty-signatures",allowUnnamedResources:"allow-unnamed-resources",extraOpcodeBudget:"extra-opcode-budget",maxLogCalls:"max-log-calls",maxLogSize:"max-log-size"}}static from_obj_for_encoding(e){return new pt({allowEmptySignatures:e["allow-empty-signatures"],allowUnnamedResources:e["allow-unnamed-resources"],extraOpcodeBudget:e["extra-opcode-budget"],maxLogCalls:e["max-log-calls"],maxLogSize:e["max-log-size"]})}}class gt extends fe{constructor({pc:e,scratchChanges:t,spawnedInners:n,stackAdditions:r,stackPopCount:i,stateChanges:o}){super(),this.pc=e,this.scratchChanges=t,this.spawnedInners=n,this.stackAdditions=r,this.stackPopCount=i,this.stateChanges=o,this.attribute_map={pc:"pc",scratchChanges:"scratch-changes",spawnedInners:"spawned-inners",stackAdditions:"stack-additions",stackPopCount:"stack-pop-count",stateChanges:"state-changes"}}static from_obj_for_encoding(e){if("undefined"===typeof e.pc)throw new Error(`Response is missing required field 'pc': ${e}`);return new gt({pc:e.pc,scratchChanges:"undefined"!==typeof e["scratch-changes"]?e["scratch-changes"].map(ot.from_obj_for_encoding):void 0,spawnedInners:e["spawned-inners"],stackAdditions:"undefined"!==typeof e["stack-additions"]?e["stack-additions"].map(Pe.from_obj_for_encoding):void 0,stackPopCount:e["stack-pop-count"],stateChanges:"undefined"!==typeof e["state-changes"]?e["state-changes"].map(Ee.from_obj_for_encoding):void 0})}}class mt extends fe{constructor({approvalProgramHash:e,approvalProgramTrace:t,clearStateProgramHash:n,clearStateProgramTrace:r,innerTrace:i,logicSigHash:o,logicSigTrace:s}){super(),this.approvalProgramHash="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.approvalProgramTrace=t,this.clearStateProgramHash="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.clearStateProgramTrace=r,this.innerTrace=i,this.logicSigHash="string"===typeof o?new Uint8Array(a.lW.from(o,"base64")):o,this.logicSigTrace=s,this.attribute_map={approvalProgramHash:"approval-program-hash",approvalProgramTrace:"approval-program-trace",clearStateProgramHash:"clear-state-program-hash",clearStateProgramTrace:"clear-state-program-trace",innerTrace:"inner-trace",logicSigHash:"logic-sig-hash",logicSigTrace:"logic-sig-trace"}}static from_obj_for_encoding(e){return new mt({approvalProgramHash:e["approval-program-hash"],approvalProgramTrace:"undefined"!==typeof e["approval-program-trace"]?e["approval-program-trace"].map(gt.from_obj_for_encoding):void 0,clearStateProgramHash:e["clear-state-program-hash"],clearStateProgramTrace:"undefined"!==typeof e["clear-state-program-trace"]?e["clear-state-program-trace"].map(gt.from_obj_for_encoding):void 0,innerTrace:"undefined"!==typeof e["inner-trace"]?e["inner-trace"].map(mt.from_obj_for_encoding):void 0,logicSigHash:e["logic-sig-hash"],logicSigTrace:"undefined"!==typeof e["logic-sig-trace"]?e["logic-sig-trace"].map(gt.from_obj_for_encoding):void 0})}}class bt extends fe{constructor({message:e,stateproof:t}){super(),this.message=e,this.stateproof="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={message:"Message",stateproof:"StateProof"}}static from_obj_for_encoding(e){if("undefined"===typeof e.Message)throw new Error(`Response is missing required field 'Message': ${e}`);if("undefined"===typeof e.StateProof)throw new Error(`Response is missing required field 'StateProof': ${e}`);return new bt({message:yt.from_obj_for_encoding(e.Message),stateproof:e.StateProof})}}class yt extends fe{constructor({blockheaderscommitment:e,firstattestedround:t,lastattestedround:n,lnprovenweight:r,voterscommitment:i}){super(),this.blockheaderscommitment="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.firstattestedround=t,this.lastattestedround=n,this.lnprovenweight=r,this.voterscommitment="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.attribute_map={blockheaderscommitment:"BlockHeadersCommitment",firstattestedround:"FirstAttestedRound",lastattestedround:"LastAttestedRound",lnprovenweight:"LnProvenWeight",voterscommitment:"VotersCommitment"}}static from_obj_for_encoding(e){if("undefined"===typeof e.BlockHeadersCommitment)throw new Error(`Response is missing required field 'BlockHeadersCommitment': ${e}`);if("undefined"===typeof e.FirstAttestedRound)throw new Error(`Response is missing required field 'FirstAttestedRound': ${e}`);if("undefined"===typeof e.LastAttestedRound)throw new Error(`Response is missing required field 'LastAttestedRound': ${e}`);if("undefined"===typeof e.LnProvenWeight)throw new Error(`Response is missing required field 'LnProvenWeight': ${e}`);if("undefined"===typeof e.VotersCommitment)throw new Error(`Response is missing required field 'VotersCommitment': ${e}`);return new yt({blockheaderscommitment:e.BlockHeadersCommitment,firstattestedround:e.FirstAttestedRound,lastattestedround:e.LastAttestedRound,lnprovenweight:e.LnProvenWeight,voterscommitment:e.VotersCommitment})}}class vt extends fe{constructor({currentRound:e,onlineMoney:t,totalMoney:n}){super(),this.currentRound=e,this.onlineMoney=t,this.totalMoney=n,this.attribute_map={currentRound:"current_round",onlineMoney:"online-money",totalMoney:"total-money"}}static from_obj_for_encoding(e){if("undefined"===typeof e.current_round)throw new Error(`Response is missing required field 'current_round': ${e}`);if("undefined"===typeof e["online-money"])throw new Error(`Response is missing required field 'online-money': ${e}`);if("undefined"===typeof e["total-money"])throw new Error(`Response is missing required field 'total-money': ${e}`);return new vt({currentRound:e.current_round,onlineMoney:e["online-money"],totalMoney:e["total-money"]})}}class wt extends fe{constructor({key:e,value:t}){super(),this.key=e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new wt({key:e.key,value:xt.from_obj_for_encoding(e.value)})}}class xt extends fe{constructor({type:e,bytes:t,uint:n}){super(),this.type=e,this.bytes=t,this.uint=n,this.attribute_map={type:"type",bytes:"bytes",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.type)throw new Error(`Response is missing required field 'type': ${e}`);if("undefined"===typeof e.bytes)throw new Error(`Response is missing required field 'bytes': ${e}`);if("undefined"===typeof e.uint)throw new Error(`Response is missing required field 'uint': ${e}`);return new xt({type:e.type,bytes:e.bytes,uint:e.uint})}}class St extends fe{constructor({deltas:e}){super(),this.deltas=e,this.attribute_map={deltas:"Deltas"}}static from_obj_for_encoding(e){if(!Array.isArray(e.Deltas))throw new Error(`Response is missing required array field 'Deltas': ${e}`);return new St({deltas:e.Deltas.map($e.from_obj_for_encoding)})}}class At extends fe{constructor({consensusVersion:e,fee:t,genesisHash:n,genesisId:r,lastRound:i,minFee:o}){super(),this.consensusVersion=e,this.fee=t,this.genesisHash="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.genesisId=r,this.lastRound=i,this.minFee=o,this.attribute_map={consensusVersion:"consensus-version",fee:"fee",genesisHash:"genesis-hash",genesisId:"genesis-id",lastRound:"last-round",minFee:"min-fee"}}static from_obj_for_encoding(e){if("undefined"===typeof e["consensus-version"])throw new Error(`Response is missing required field 'consensus-version': ${e}`);if("undefined"===typeof e.fee)throw new Error(`Response is missing required field 'fee': ${e}`);if("undefined"===typeof e["genesis-hash"])throw new Error(`Response is missing required field 'genesis-hash': ${e}`);if("undefined"===typeof e["genesis-id"])throw new Error(`Response is missing required field 'genesis-id': ${e}`);if("undefined"===typeof e["last-round"])throw new Error(`Response is missing required field 'last-round': ${e}`);if("undefined"===typeof e["min-fee"])throw new Error(`Response is missing required field 'min-fee': ${e}`);return new At({consensusVersion:e["consensus-version"],fee:e.fee,genesisHash:e["genesis-hash"],genesisId:e["genesis-id"],lastRound:e["last-round"],minFee:e["min-fee"]})}}class Et extends fe{constructor({idx:e,proof:t,stibhash:n,treedepth:r,hashtype:i}){super(),this.idx=e,this.proof="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.stibhash="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.treedepth=r,this.hashtype=i,this.attribute_map={idx:"idx",proof:"proof",stibhash:"stibhash",treedepth:"treedepth",hashtype:"hashtype"}}static from_obj_for_encoding(e){if("undefined"===typeof e.idx)throw new Error(`Response is missing required field 'idx': ${e}`);if("undefined"===typeof e.proof)throw new Error(`Response is missing required field 'proof': ${e}`);if("undefined"===typeof e.stibhash)throw new Error(`Response is missing required field 'stibhash': ${e}`);if("undefined"===typeof e.treedepth)throw new Error(`Response is missing required field 'treedepth': ${e}`);return new Et({idx:e.idx,proof:e.proof,stibhash:e.stibhash,treedepth:e.treedepth,hashtype:e.hashtype})}}class _t extends fe{constructor({build:e,genesisHashB64:t,genesisId:n,versions:r}){super(),this.build=e,this.genesisHashB64="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.genesisId=n,this.versions=r,this.attribute_map={build:"build",genesisHashB64:"genesis_hash_b64",genesisId:"genesis_id",versions:"versions"}}static from_obj_for_encoding(e){if("undefined"===typeof e.build)throw new Error(`Response is missing required field 'build': ${e}`);if("undefined"===typeof e.genesis_hash_b64)throw new Error(`Response is missing required field 'genesis_hash_b64': ${e}`);if("undefined"===typeof e.genesis_id)throw new Error(`Response is missing required field 'genesis_id': ${e}`);if(!Array.isArray(e.versions))throw new Error(`Response is missing required array field 'versions': ${e}`);return new _t({build:je.from_obj_for_encoding(e.build),genesisHashB64:e.genesis_hash_b64,genesisId:e.genesis_id,versions:e.versions})}}class Ct{constructor(e,t){this.c=e,this.query={},this.intDecoding=t||p.DEFAULT}prepare(e){return e}async do(e={}){const t={};"default"!==this.intDecoding&&(t.intDecoding=this.intDecoding);const n=await this.c.get(this.path(),this.query,e,t);return this.prepare(n.body)}async doRaw(e={}){return(await this.c.get(this.path(),this.query,e,{},!1)).body}setIntDecoding(e){if("default"!==e&&"safe"!==e&&"mixed"!==e&&"bigint"!==e)throw new Error(`Invalid method for int decoding: ${e}`);return this.intDecoding=e,this}}class It extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}`}exclude(e){return this.query.exclude=e,this}}class kt extends Ct{constructor(e,t,n,r){super(e,t),this.account=n,this.assetID=r,this.account=n,this.assetID=r}path(){return`/v2/accounts/${this.account}/assets/${this.assetID}`}}class Tt extends Ct{constructor(e,t,n,r){super(e,t),this.account=n,this.applicationID=r,this.account=n,this.applicationID=r}path(){return`/v2/accounts/${this.account}/applications/${this.applicationID}`}}class Mt extends Ct{constructor(e,t){if(super(e),!Number.isInteger(t))throw Error("roundNumber should be an integer");this.round=t,this.query={format:"msgpack"}}path(){return`/v2/blocks/${this.round}`}prepare(e){if(e&&e.byteLength>0)return z(e)}}function Pt(e={}){let t=e;return Object.keys(t).every((e=>"content-type"!==e.toLowerCase()))&&(t={...e},t["Content-Type"]="text/plain"),t}class Ot extends Ct{constructor(e,t){super(e),this.source=t,this.source=t}path(){return"/v2/teal/compile"}sourcemap(e=!0){return this.query.sourcemap=e,this}async do(e={}){const t=Pt(e);return(await this.c.post(this.path(),a.lW.from(this.source),t,this.query)).body}}class Rt extends Ct{constructor(e,t){super(e),this.blob=q(t.get_obj_for_encoding(!0))}path(){return"/v2/teal/dryrun"}async do(e={}){const t=Pt(e);return(await this.c.post(this.path(),a.lW.from(this.blob),t)).body}}class Nt extends Ct{path(){return"/genesis"}}class Bt extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/assets/${this.index}`}}class Lt extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/applications/${this.index}`}}class Dt extends Ct{constructor(e,t,n){if(super(e,t),!Number.isInteger(n))throw Error("roundNumber should be an integer");this.round=n}path(){return`/v2/blocks/${this.round}/hash`}}class Ut extends Ct{constructor(e,t,n){if(super(e,t),!Number.isInteger(n))throw Error("roundNumber should be an integer");this.round=n}path(){return`/v2/blocks/${this.round}/txids`}}class jt extends Ct{constructor(e,t,n,r){super(e,t),this.index=n,this.index=n;const i=a.lW.from(r).toString("base64");this.query.name=encodeURI(`b64:${i}`)}path(){return`/v2/applications/${this.index}/box`}prepare(e){return Be.from_obj_for_encoding(e)}}class Ft extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n,this.query.max=0}path(){return`/v2/applications/${this.index}/boxes`}max(e){return this.query.max=e,this}prepare(e){return Ue.from_obj_for_encoding(e)}}class Vt extends Ct{path(){return"/health"}async do(e={}){const t=await this.c.get(this.path(),{},e);if(!t.ok)throw new Error(`Health response: ${t.status}`);return{}}}class qt extends Ct{constructor(e,t){super(e),this.txid=t,this.txid=t,this.query.format="msgpack"}prepare(e){if(e&&e.byteLength>0)return z(e)}path(){return`/v2/transactions/pending/${this.txid}`}max(e){return this.query.max=e,this}}class zt extends Ct{constructor(e){super(e),this.query.format="msgpack"}path(){return"/v2/transactions/pending"}prepare(e){if(e&&e.byteLength>0)return z(e)}max(e){return this.query.max=e,this}}class Ht extends Ct{constructor(e,t){super(e),this.address=t,this.address=t,this.query.format="msgpack"}prepare(e){if(e&&e.byteLength>0)return z(e)}path(){return`/v2/accounts/${this.address}/transactions/pending`}max(e){return this.query.max=e,this}}class Wt extends Ct{constructor(e,t,n,r){super(e,t),this.round=n,this.txID=r,this.round=n,this.txID=r}path(){return`/v2/blocks/${this.round}/transactions/${this.txID}/proof`}hashType(e){return this.query.hashtype=e,this}}function Gt(e){return e&&void 0!==e.byteLength}class Zt extends Ct{constructor(e,t){super(e);let n=t;if(Array.isArray(t)){if(!t.every(Gt))throw new TypeError("Array elements must be byte arrays");n=b(...t)}else if(!Gt(n))throw new TypeError("Argument must be byte array");this.txnBytesToPost=n}path(){return"/v2/transactions"}async do(e={}){const t=function(e={}){let t=e;return Object.keys(t).every((e=>"content-type"!==e.toLowerCase()))&&(t={...e},t["Content-Type"]="application/x-binary"),t}(e);return(await this.c.post(this.path(),a.lW.from(this.txnBytesToPost),t)).body}}class Kt extends Ct{path(){return"/v2/status"}}class Xt extends Ct{constructor(e,t,n){if(super(e,t),this.round=n,!Number.isInteger(n))throw Error("round should be an integer");this.round=n}path(){return`/v2/status/wait-for-block-after/${this.round}`}}class Yt extends Ct{path(){return"/v2/transactions/params"}prepare(e){return{flatFee:!1,fee:e.fee,firstRound:e["last-round"],lastRound:e["last-round"]+1e3,genesisID:e["genesis-id"],genesisHash:e["genesis-hash"],minFee:e["min-fee"]}}}class Jt extends Ct{path(){return"/v2/ledger/supply"}}class Qt extends Ct{path(){return"/versions"}}class $t extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n}path(){return`/v2/blocks/${this.round}/lightheader/proof`}}class en extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n}path(){return`/v2/stateproofs/${this.round}`}}class tn extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n}path(){return`/v2/ledger/sync/${this.round}`}async do(e={}){return(await this.c.post(this.path(),e)).body}}class nn extends Ct{path(){return"/v2/ledger/sync"}prepare(e){return Je.from_obj_for_encoding(e)}}class rn extends Ct{constructor(e,t,n){super(e,t),this.offset=n,this.offset=n}path(){return`/v2/devmode/blocks/offset/${this.offset}`}async do(e={}){return(await this.c.post(this.path(),e)).body}}class on extends Ct{path(){return"/v2/devmode/blocks/offset"}prepare(e){return Ye.from_obj_for_encoding(e)}}class sn extends Ct{constructor(e,t){super(e),this.source=t,this.source=t}path(){return"/v2/teal/disassemble"}async do(e={}){const t=function(e={}){let t=e;return Object.keys(t).every((e=>"content-type"!==e.toLowerCase()))&&(t={...e},t["Content-Type"]="text/plain"),t}(e);return(await this.c.post(this.path(),a.lW.from(this.source),t,this.query)).body}}class an extends Ct{constructor(e,t){super(e),this.query.format="msgpack",this.requestBytes=V(t.get_obj_for_encoding(!0))}path(){return"/v2/transactions/simulate"}async do(e={}){const t=function(e={}){let t=e;return Object.keys(t).every((e=>"content-type"!==e.toLowerCase()))&&(t={...e},t["Content-Type"]="application/msgpack"),t}(e),n=await this.c.post(this.path(),a.lW.from(this.requestBytes),t,this.query,!1);return this.prepare(n.body)}prepare(e){const t=z(e);return ut.from_obj_for_encoding(t)}}class cn extends Ct{path(){return"/ready"}}class un extends Ct{path(){return"/v2/ledger/sync"}async do(e={}){return(await this.c.delete(this.path(),e)).body}}class ln extends Ct{constructor(e,t,n){super(e,t),this.id=n,this.id=n,this.query={format:"json"}}path(){return`/v2/deltas/txn/group/${this.id}`}}class dn extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n,this.query={format:"json"}}path(){return`/v2/deltas/${this.round}`}}class fn extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n,this.query={format:"json"}}path(){return`/v2/deltas/${this.round}/txn/group`}prepare(e){return St.from_obj_for_encoding(e)}}class hn extends le{constructor(e,t,n,r={}){super("X-Algo-API-Token",e,t,n,r)}healthCheck(){return new Vt(this.c)}versionsCheck(){return new Qt(this.c)}sendRawTransaction(e){return new Zt(this.c,e)}accountInformation(e){return new It(this.c,this.intDecoding,e)}accountAssetInformation(e,t){return new kt(this.c,this.intDecoding,e,t)}accountApplicationInformation(e,t){return new Tt(this.c,this.intDecoding,e,t)}block(e){return new Mt(this.c,e)}getBlockHash(e){return new Dt(this.c,this.intDecoding,e)}getBlockTxids(e){return new Ut(this.c,this.intDecoding,e)}pendingTransactionInformation(e){return new qt(this.c,e)}pendingTransactionsInformation(){return new zt(this.c)}pendingTransactionByAddress(e){return new Ht(this.c,e)}status(){return new Kt(this.c,this.intDecoding)}statusAfterBlock(e){return new Xt(this.c,this.intDecoding,e)}getTransactionParams(){return new Yt(this.c)}supply(){return new Jt(this.c,this.intDecoding)}compile(e){return new Ot(this.c,e)}disassemble(e){return new sn(this.c,e)}dryrun(e){return new Rt(this.c,e)}getAssetByID(e){return new Bt(this.c,this.intDecoding,e)}getApplicationByID(e){return new Lt(this.c,this.intDecoding,e)}getApplicationBoxByName(e,t){return new jt(this.c,this.intDecoding,e,t)}getApplicationBoxes(e){return new Ft(this.c,this.intDecoding,e)}genesis(){return new Nt(this.c,this.intDecoding)}getTransactionProof(e,t){return new Wt(this.c,this.intDecoding,e,t)}getLightBlockHeaderProof(e){return new $t(this.c,this.intDecoding,e)}getStateProof(e){return new en(this.c,this.intDecoding,e)}simulateRawTransactions(e){const t=[];if(Array.isArray(e))for(const r of e)t.push(z(r));else t.push(z(e));const n=new at({txnGroups:[new ct({txns:t})]});return this.simulateTransactions(n)}simulateTransactions(e){return new an(this.c,e)}setBlockOffsetTimestamp(e){return new rn(this.c,this.intDecoding,e)}getBlockOffsetTimestamp(){return new on(this.c,this.intDecoding)}setSyncRound(e){return new tn(this.c,this.intDecoding,e)}unsetSyncRound(){return new un(this.c,this.intDecoding)}getSyncRound(){return new nn(this.c,this.intDecoding)}ready(){return new cn(this.c,this.intDecoding)}getLedgerStateDeltaForTransactionGroup(e){return new ln(this.c,this.intDecoding,e)}getLedgerStateDelta(e){return new dn(this.c,this.intDecoding,e)}getTransactionGroupLedgerStateDeltasForRound(e){return new fn(this.c,this.intDecoding,e)}}class pn extends le{constructor(e,t="http://127.0.0.1",n=7833,r={}){super("X-KMD-API-Token",e,t,n,r)}async versions(){return(await this.c.get("/versions")).body}async listWallets(){return(await this.c.get("/v1/wallets")).body}async createWallet(e,t,n=new Uint8Array,r="sqlite"){const i={wallet_name:e,wallet_driver_name:r,wallet_password:t,master_derivation_key:a.lW.from(n).toString("base64")};return(await this.c.post("/v1/wallet",i)).body}async initWalletHandle(e,t){const n={wallet_id:e,wallet_password:t};return(await this.c.post("/v1/wallet/init",n)).body}async releaseWalletHandle(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/wallet/release",t)).body}async renewWalletHandle(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/wallet/renew",t)).body}async renameWallet(e,t,n){const r={wallet_id:e,wallet_password:t,wallet_name:n};return(await this.c.post("/v1/wallet/rename",r)).body}async getWallet(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/wallet/info",t)).body}async exportMasterDerivationKey(e,t){const n={wallet_handle_token:e,wallet_password:t},r=await this.c.post("/v1/master-key/export",n);return{master_derivation_key:a.lW.from(r.body.master_derivation_key,"base64")}}async importKey(e,t){const n={wallet_handle_token:e,private_key:a.lW.from(t).toString("base64")};return(await this.c.post("/v1/key/import",n)).body}async exportKey(e,t,n){const r={wallet_handle_token:e,address:n,wallet_password:t},i=await this.c.post("/v1/key/export",r);return{private_key:a.lW.from(i.body.private_key,"base64")}}async generateKey(e){const t={wallet_handle_token:e,display_mnemonic:!1};return(await this.c.post("/v1/key",t)).body}async deleteKey(e,t,n){const r={wallet_handle_token:e,address:n,wallet_password:t};return(await this.c.delete("/v1/key",r)).body}async listKeys(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/key/list",t)).body}async signTransaction(e,t,n){const r=ee(n),i={wallet_handle_token:e,wallet_password:t,transaction:a.lW.from(r.toByte()).toString("base64")},o=await this.c.post("/v1/transaction/sign",i);return 200===o.status?a.lW.from(o.body.signed_transaction,"base64"):o.body}async signTransactionWithSpecificPublicKey(e,t,n,r){const i=ee(n),o={wallet_handle_token:e,wallet_password:t,transaction:a.lW.from(i.toByte()).toString("base64"),public_key:a.lW.from(r).toString("base64")},s=await this.c.post("/v1/transaction/sign",o);return 200===s.status?a.lW.from(s.body.signed_transaction,"base64"):s.body}async listMultisig(e){const t={wallet_handle_token:e};return(await this.c.post("/v1/multisig/list",t)).body}async importMultisig(e,t,n,r){const i={wallet_handle_token:e,multisig_version:t,threshold:n,pks:r};return(await this.c.post("/v1/multisig/import",i)).body}async exportMultisig(e,t){const n={wallet_handle_token:e,address:t};return(await this.c.post("/v1/multisig/export",n)).body}async signMultisigTransaction(e,t,n,r,i){const o=ee(n),s={wallet_handle_token:e,transaction:a.lW.from(o.toByte()).toString("base64"),public_key:a.lW.from(r).toString("base64"),partial_multisig:i,wallet_password:t};return(await this.c.post("/v1/multisig/sign",s)).body}async deleteMultisig(e,t,n){const r={wallet_handle_token:e,address:n,wallet_password:t};return(await this.c.delete("/v1/multisig",r)).body}}class gn extends Ct{path(){return"/health"}}class mn extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/assets/${this.index}/balances`}limit(e){return this.query.limit=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}}function bn(e){return"string"===typeof e?e:a.lW.from(e).toString("base64")}class yn extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/transactions`}notePrefix(e){return this.query["note-prefix"]=bn(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}assetID(e){return this.query["asset-id"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e,this}afterTime(e){return this.query["after-time"]=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}}class vn extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/assets/${this.index}/transactions`}notePrefix(e){return this.query["note-prefix"]=bn(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e,this}afterTime(e){return this.query["after-time"]=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}addressRole(e){return this.query["address-role"]=e,this}address(e){return this.query.address=e,this}excludeCloseTo(e){return this.query["exclude-close-to"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}}class wn extends Ct{constructor(e,t,n){super(e,t),this.round=n,this.round=n}path(){return`/v2/blocks/${this.round}`}headerOnly(e){return this.query["header-only"]=e,this}}class xn extends Ct{constructor(e,t,n){super(e,t),this.txID=n,this.txID=n}path(){return`/v2/transactions/${this.txID}`}}class Sn extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}`}round(e){return this.query.round=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}exclude(e){return this.query.exclude=e,this}}class An extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/assets`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}assetId(e){return this.query["asset-id"]=e,this}}class En extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/created-assets`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}assetID(e){return this.query["asset-id"]=e,this}}class _n extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/apps-local-state`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}applicationID(e){return this.query["application-id"]=e,this}}class Cn extends Ct{constructor(e,t,n){super(e,t),this.account=n,this.account=n}path(){return`/v2/accounts/${this.account}/created-applications`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}applicationID(e){return this.query["application-id"]=e,this}}class In extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/assets/${this.index}`}includeAll(e=!0){return this.query["include-all"]=e,this}}class kn extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/applications/${this.index}`}includeAll(e=!0){return this.query["include-all"]=e,this}}class Tn extends Ct{constructor(e,t,n){super(e,t),this.appID=n,this.appID=n}path(){return`/v2/applications/${this.appID}/logs`}limit(e){return this.query.limit=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}nextToken(e){return this.query.next=e,this}sender(e){return this.query["sender-address"]=e,this}txid(e){return this.query.txid=e,this}}class Mn extends fe{constructor({address:e,amount:t,amountWithoutPendingRewards:n,pendingRewards:r,rewards:i,round:o,status:s,totalAppsOptedIn:a,totalAssetsOptedIn:c,totalBoxBytes:u,totalBoxes:l,totalCreatedApps:d,totalCreatedAssets:f,appsLocalState:h,appsTotalExtraPages:p,appsTotalSchema:g,assets:m,authAddr:b,closedAtRound:y,createdApps:v,createdAssets:w,createdAtRound:x,deleted:S,participation:A,rewardBase:E,sigType:_}){super(),this.address=e,this.amount=t,this.amountWithoutPendingRewards=n,this.pendingRewards=r,this.rewards=i,this.round=o,this.status=s,this.totalAppsOptedIn=a,this.totalAssetsOptedIn=c,this.totalBoxBytes=u,this.totalBoxes=l,this.totalCreatedApps=d,this.totalCreatedAssets=f,this.appsLocalState=h,this.appsTotalExtraPages=p,this.appsTotalSchema=g,this.assets=m,this.authAddr=b,this.closedAtRound=y,this.createdApps=v,this.createdAssets=w,this.createdAtRound=x,this.deleted=S,this.participation=A,this.rewardBase=E,this.sigType=_,this.attribute_map={address:"address",amount:"amount",amountWithoutPendingRewards:"amount-without-pending-rewards",pendingRewards:"pending-rewards",rewards:"rewards",round:"round",status:"status",totalAppsOptedIn:"total-apps-opted-in",totalAssetsOptedIn:"total-assets-opted-in",totalBoxBytes:"total-box-bytes",totalBoxes:"total-boxes",totalCreatedApps:"total-created-apps",totalCreatedAssets:"total-created-assets",appsLocalState:"apps-local-state",appsTotalExtraPages:"apps-total-extra-pages",appsTotalSchema:"apps-total-schema",assets:"assets",authAddr:"auth-addr",closedAtRound:"closed-at-round",createdApps:"created-apps",createdAssets:"created-assets",createdAtRound:"created-at-round",deleted:"deleted",participation:"participation",rewardBase:"reward-base",sigType:"sig-type"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["amount-without-pending-rewards"])throw new Error(`Response is missing required field 'amount-without-pending-rewards': ${e}`);if("undefined"===typeof e["pending-rewards"])throw new Error(`Response is missing required field 'pending-rewards': ${e}`);if("undefined"===typeof e.rewards)throw new Error(`Response is missing required field 'rewards': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.status)throw new Error(`Response is missing required field 'status': ${e}`);if("undefined"===typeof e["total-apps-opted-in"])throw new Error(`Response is missing required field 'total-apps-opted-in': ${e}`);if("undefined"===typeof e["total-assets-opted-in"])throw new Error(`Response is missing required field 'total-assets-opted-in': ${e}`);if("undefined"===typeof e["total-box-bytes"])throw new Error(`Response is missing required field 'total-box-bytes': ${e}`);if("undefined"===typeof e["total-boxes"])throw new Error(`Response is missing required field 'total-boxes': ${e}`);if("undefined"===typeof e["total-created-apps"])throw new Error(`Response is missing required field 'total-created-apps': ${e}`);if("undefined"===typeof e["total-created-assets"])throw new Error(`Response is missing required field 'total-created-assets': ${e}`);return new Mn({address:e.address,amount:e.amount,amountWithoutPendingRewards:e["amount-without-pending-rewards"],pendingRewards:e["pending-rewards"],rewards:e.rewards,round:e.round,status:e.status,totalAppsOptedIn:e["total-apps-opted-in"],totalAssetsOptedIn:e["total-assets-opted-in"],totalBoxBytes:e["total-box-bytes"],totalBoxes:e["total-boxes"],totalCreatedApps:e["total-created-apps"],totalCreatedAssets:e["total-created-assets"],appsLocalState:"undefined"!==typeof e["apps-local-state"]?e["apps-local-state"].map(Ln.from_obj_for_encoding):void 0,appsTotalExtraPages:e["apps-total-extra-pages"],appsTotalSchema:"undefined"!==typeof e["apps-total-schema"]?qn.from_obj_for_encoding(e["apps-total-schema"]):void 0,assets:"undefined"!==typeof e.assets?e.assets.map(Gn.from_obj_for_encoding):void 0,authAddr:e["auth-addr"],closedAtRound:e["closed-at-round"],createdApps:"undefined"!==typeof e["created-apps"]?e["created-apps"].map(Bn.from_obj_for_encoding):void 0,createdAssets:"undefined"!==typeof e["created-assets"]?e["created-assets"].map(Hn.from_obj_for_encoding):void 0,createdAtRound:e["created-at-round"],deleted:e.deleted,participation:"undefined"!==typeof e.participation?Pn.from_obj_for_encoding(e.participation):void 0,rewardBase:e["reward-base"],sigType:e["sig-type"]})}}class Pn extends fe{constructor({selectionParticipationKey:e,voteFirstValid:t,voteKeyDilution:n,voteLastValid:r,voteParticipationKey:i,stateProofKey:o}){super(),this.selectionParticipationKey="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.voteFirstValid=t,this.voteKeyDilution=n,this.voteLastValid=r,this.voteParticipationKey="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.stateProofKey="string"===typeof o?new Uint8Array(a.lW.from(o,"base64")):o,this.attribute_map={selectionParticipationKey:"selection-participation-key",voteFirstValid:"vote-first-valid",voteKeyDilution:"vote-key-dilution",voteLastValid:"vote-last-valid",voteParticipationKey:"vote-participation-key",stateProofKey:"state-proof-key"}}static from_obj_for_encoding(e){if("undefined"===typeof e["selection-participation-key"])throw new Error(`Response is missing required field 'selection-participation-key': ${e}`);if("undefined"===typeof e["vote-first-valid"])throw new Error(`Response is missing required field 'vote-first-valid': ${e}`);if("undefined"===typeof e["vote-key-dilution"])throw new Error(`Response is missing required field 'vote-key-dilution': ${e}`);if("undefined"===typeof e["vote-last-valid"])throw new Error(`Response is missing required field 'vote-last-valid': ${e}`);if("undefined"===typeof e["vote-participation-key"])throw new Error(`Response is missing required field 'vote-participation-key': ${e}`);return new Pn({selectionParticipationKey:e["selection-participation-key"],voteFirstValid:e["vote-first-valid"],voteKeyDilution:e["vote-key-dilution"],voteLastValid:e["vote-last-valid"],voteParticipationKey:e["vote-participation-key"],stateProofKey:e["state-proof-key"]})}}class On extends fe{constructor({account:e,currentRound:t}){super(),this.account=e,this.currentRound=t,this.attribute_map={account:"account",currentRound:"current-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.account)throw new Error(`Response is missing required field 'account': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new On({account:Mn.from_obj_for_encoding(e.account),currentRound:e["current-round"]})}}class Rn extends fe{constructor({address:e,delta:t}){super(),this.address=e,this.delta=t,this.attribute_map={address:"address",delta:"delta"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if(!Array.isArray(e.delta))throw new Error(`Response is missing required array field 'delta': ${e}`);return new Rn({address:e.address,delta:e.delta.map(sr.from_obj_for_encoding)})}}class Nn extends fe{constructor({accounts:e,currentRound:t,nextToken:n}){super(),this.accounts=e,this.currentRound=t,this.nextToken=n,this.attribute_map={accounts:"accounts",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.accounts))throw new Error(`Response is missing required array field 'accounts': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Nn({accounts:e.accounts.map(Mn.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Bn extends fe{constructor({id:e,params:t,createdAtRound:n,deleted:r,deletedAtRound:i}){super(),this.id=e,this.params=t,this.createdAtRound=n,this.deleted=r,this.deletedAtRound=i,this.attribute_map={id:"id",params:"params",createdAtRound:"created-at-round",deleted:"deleted",deletedAtRound:"deleted-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);if("undefined"===typeof e.params)throw new Error(`Response is missing required field 'params': ${e}`);return new Bn({id:e.id,params:Fn.from_obj_for_encoding(e.params),createdAtRound:e["created-at-round"],deleted:e.deleted,deletedAtRound:e["deleted-at-round"]})}}class Ln extends fe{constructor({id:e,schema:t,closedOutAtRound:n,deleted:r,keyValue:i,optedInAtRound:o}){super(),this.id=e,this.schema=t,this.closedOutAtRound=n,this.deleted=r,this.keyValue=i,this.optedInAtRound=o,this.attribute_map={id:"id",schema:"schema",closedOutAtRound:"closed-out-at-round",deleted:"deleted",keyValue:"key-value",optedInAtRound:"opted-in-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.id)throw new Error(`Response is missing required field 'id': ${e}`);if("undefined"===typeof e.schema)throw new Error(`Response is missing required field 'schema': ${e}`);return new Ln({id:e.id,schema:qn.from_obj_for_encoding(e.schema),closedOutAtRound:e["closed-out-at-round"],deleted:e.deleted,keyValue:"undefined"!==typeof e["key-value"]?e["key-value"].map(xr.from_obj_for_encoding):void 0,optedInAtRound:e["opted-in-at-round"]})}}class Dn extends fe{constructor({appsLocalStates:e,currentRound:t,nextToken:n}){super(),this.appsLocalStates=e,this.currentRound=t,this.nextToken=n,this.attribute_map={appsLocalStates:"apps-local-states",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e["apps-local-states"]))throw new Error(`Response is missing required array field 'apps-local-states': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Dn({appsLocalStates:e["apps-local-states"].map(Ln.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Un extends fe{constructor({logs:e,txid:t}){super(),this.logs=e,this.txid=t,this.attribute_map={logs:"logs",txid:"txid"}}static from_obj_for_encoding(e){if(!Array.isArray(e.logs))throw new Error(`Response is missing required array field 'logs': ${e}`);if("undefined"===typeof e.txid)throw new Error(`Response is missing required field 'txid': ${e}`);return new Un({logs:e.logs,txid:e.txid})}}class jn extends fe{constructor({applicationId:e,currentRound:t,logData:n,nextToken:r}){super(),this.applicationId=e,this.currentRound=t,this.logData=n,this.nextToken=r,this.attribute_map={applicationId:"application-id",currentRound:"current-round",logData:"log-data",nextToken:"next-token"}}static from_obj_for_encoding(e){if("undefined"===typeof e["application-id"])throw new Error(`Response is missing required field 'application-id': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new jn({applicationId:e["application-id"],currentRound:e["current-round"],logData:"undefined"!==typeof e["log-data"]?e["log-data"].map(Un.from_obj_for_encoding):void 0,nextToken:e["next-token"]})}}class Fn extends fe{constructor({approvalProgram:e,clearStateProgram:t,creator:n,extraProgramPages:r,globalState:i,globalStateSchema:o,localStateSchema:s}){super(),this.approvalProgram="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.clearStateProgram="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.creator=n,this.extraProgramPages=r,this.globalState=i,this.globalStateSchema=o,this.localStateSchema=s,this.attribute_map={approvalProgram:"approval-program",clearStateProgram:"clear-state-program",creator:"creator",extraProgramPages:"extra-program-pages",globalState:"global-state",globalStateSchema:"global-state-schema",localStateSchema:"local-state-schema"}}static from_obj_for_encoding(e){if("undefined"===typeof e["approval-program"])throw new Error(`Response is missing required field 'approval-program': ${e}`);if("undefined"===typeof e["clear-state-program"])throw new Error(`Response is missing required field 'clear-state-program': ${e}`);return new Fn({approvalProgram:e["approval-program"],clearStateProgram:e["clear-state-program"],creator:e.creator,extraProgramPages:e["extra-program-pages"],globalState:"undefined"!==typeof e["global-state"]?e["global-state"].map(xr.from_obj_for_encoding):void 0,globalStateSchema:"undefined"!==typeof e["global-state-schema"]?qn.from_obj_for_encoding(e["global-state-schema"]):void 0,localStateSchema:"undefined"!==typeof e["local-state-schema"]?qn.from_obj_for_encoding(e["local-state-schema"]):void 0})}}class Vn extends fe{constructor({currentRound:e,application:t}){super(),this.currentRound=e,this.application=t,this.attribute_map={currentRound:"current-round",application:"application"}}static from_obj_for_encoding(e){if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Vn({currentRound:e["current-round"],application:"undefined"!==typeof e.application?Bn.from_obj_for_encoding(e.application):void 0})}}class qn extends fe{constructor({numByteSlice:e,numUint:t}){super(),this.numByteSlice=e,this.numUint=t,this.attribute_map={numByteSlice:"num-byte-slice",numUint:"num-uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e["num-byte-slice"])throw new Error(`Response is missing required field 'num-byte-slice': ${e}`);if("undefined"===typeof e["num-uint"])throw new Error(`Response is missing required field 'num-uint': ${e}`);return new qn({numByteSlice:e["num-byte-slice"],numUint:e["num-uint"]})}}class zn extends fe{constructor({applications:e,currentRound:t,nextToken:n}){super(),this.applications=e,this.currentRound=t,this.nextToken=n,this.attribute_map={applications:"applications",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.applications))throw new Error(`Response is missing required array field 'applications': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new zn({applications:e.applications.map(Bn.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Hn extends fe{constructor({index:e,params:t,createdAtRound:n,deleted:r,destroyedAtRound:i}){super(),this.index=e,this.params=t,this.createdAtRound=n,this.deleted=r,this.destroyedAtRound=i,this.attribute_map={index:"index",params:"params",createdAtRound:"created-at-round",deleted:"deleted",destroyedAtRound:"destroyed-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.index)throw new Error(`Response is missing required field 'index': ${e}`);if("undefined"===typeof e.params)throw new Error(`Response is missing required field 'params': ${e}`);return new Hn({index:e.index,params:Kn.from_obj_for_encoding(e.params),createdAtRound:e["created-at-round"],deleted:e.deleted,destroyedAtRound:e["destroyed-at-round"]})}}class Wn extends fe{constructor({balances:e,currentRound:t,nextToken:n}){super(),this.balances=e,this.currentRound=t,this.nextToken=n,this.attribute_map={balances:"balances",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.balances))throw new Error(`Response is missing required array field 'balances': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Wn({balances:e.balances.map(dr.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Gn extends fe{constructor({amount:e,assetId:t,isFrozen:n,deleted:r,optedInAtRound:i,optedOutAtRound:o}){super(),this.amount=e,this.assetId=t,this.isFrozen=n,this.deleted=r,this.optedInAtRound=i,this.optedOutAtRound=o,this.attribute_map={amount:"amount",assetId:"asset-id",isFrozen:"is-frozen",deleted:"deleted",optedInAtRound:"opted-in-at-round",optedOutAtRound:"opted-out-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["asset-id"])throw new Error(`Response is missing required field 'asset-id': ${e}`);if("undefined"===typeof e["is-frozen"])throw new Error(`Response is missing required field 'is-frozen': ${e}`);return new Gn({amount:e.amount,assetId:e["asset-id"],isFrozen:e["is-frozen"],deleted:e.deleted,optedInAtRound:e["opted-in-at-round"],optedOutAtRound:e["opted-out-at-round"]})}}class Zn extends fe{constructor({assets:e,currentRound:t,nextToken:n}){super(),this.assets=e,this.currentRound=t,this.nextToken=n,this.attribute_map={assets:"assets",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.assets))throw new Error(`Response is missing required array field 'assets': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Zn({assets:e.assets.map(Gn.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Kn extends fe{constructor({creator:e,decimals:t,total:n,clawback:r,defaultFrozen:i,freeze:o,manager:s,metadataHash:c,name:u,nameB64:l,reserve:d,unitName:f,unitNameB64:h,url:p,urlB64:g}){super(),this.creator=e,this.decimals=t,this.total=n,this.clawback=r,this.defaultFrozen=i,this.freeze=o,this.manager=s,this.metadataHash="string"===typeof c?new Uint8Array(a.lW.from(c,"base64")):c,this.name=u,this.nameB64="string"===typeof l?new Uint8Array(a.lW.from(l,"base64")):l,this.reserve=d,this.unitName=f,this.unitNameB64="string"===typeof h?new Uint8Array(a.lW.from(h,"base64")):h,this.url=p,this.urlB64="string"===typeof g?new Uint8Array(a.lW.from(g,"base64")):g,this.attribute_map={creator:"creator",decimals:"decimals",total:"total",clawback:"clawback",defaultFrozen:"default-frozen",freeze:"freeze",manager:"manager",metadataHash:"metadata-hash",name:"name",nameB64:"name-b64",reserve:"reserve",unitName:"unit-name",unitNameB64:"unit-name-b64",url:"url",urlB64:"url-b64"}}static from_obj_for_encoding(e){if("undefined"===typeof e.creator)throw new Error(`Response is missing required field 'creator': ${e}`);if("undefined"===typeof e.decimals)throw new Error(`Response is missing required field 'decimals': ${e}`);if("undefined"===typeof e.total)throw new Error(`Response is missing required field 'total': ${e}`);return new Kn({creator:e.creator,decimals:e.decimals,total:e.total,clawback:e.clawback,defaultFrozen:e["default-frozen"],freeze:e.freeze,manager:e.manager,metadataHash:e["metadata-hash"],name:e.name,nameB64:e["name-b64"],reserve:e.reserve,unitName:e["unit-name"],unitNameB64:e["unit-name-b64"],url:e.url,urlB64:e["url-b64"]})}}class Xn extends fe{constructor({asset:e,currentRound:t}){super(),this.asset=e,this.currentRound=t,this.attribute_map={asset:"asset",currentRound:"current-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.asset)throw new Error(`Response is missing required field 'asset': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Xn({asset:Hn.from_obj_for_encoding(e.asset),currentRound:e["current-round"]})}}class Yn extends fe{constructor({assets:e,currentRound:t,nextToken:n}){super(),this.assets=e,this.currentRound=t,this.nextToken=n,this.attribute_map={assets:"assets",currentRound:"current-round",nextToken:"next-token"}}static from_obj_for_encoding(e){if(!Array.isArray(e.assets))throw new Error(`Response is missing required array field 'assets': ${e}`);if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);return new Yn({assets:e.assets.map(Hn.from_obj_for_encoding),currentRound:e["current-round"],nextToken:e["next-token"]})}}class Jn extends fe{constructor({genesisHash:e,genesisId:t,previousBlockHash:n,round:r,seed:i,timestamp:o,transactionsRoot:s,transactionsRootSha256:c,participationUpdates:u,rewards:l,stateProofTracking:d,transactions:f,txnCounter:h,upgradeState:p,upgradeVote:g}){super(),this.genesisHash="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.genesisId=t,this.previousBlockHash="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.round=r,this.seed="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.timestamp=o,this.transactionsRoot="string"===typeof s?new Uint8Array(a.lW.from(s,"base64")):s,this.transactionsRootSha256="string"===typeof c?new Uint8Array(a.lW.from(c,"base64")):c,this.participationUpdates=u,this.rewards=l,this.stateProofTracking=d,this.transactions=f,this.txnCounter=h,this.upgradeState=p,this.upgradeVote=g,this.attribute_map={genesisHash:"genesis-hash",genesisId:"genesis-id",previousBlockHash:"previous-block-hash",round:"round",seed:"seed",timestamp:"timestamp",transactionsRoot:"transactions-root",transactionsRootSha256:"transactions-root-sha256",participationUpdates:"participation-updates",rewards:"rewards",stateProofTracking:"state-proof-tracking",transactions:"transactions",txnCounter:"txn-counter",upgradeState:"upgrade-state",upgradeVote:"upgrade-vote"}}static from_obj_for_encoding(e){if("undefined"===typeof e["genesis-hash"])throw new Error(`Response is missing required field 'genesis-hash': ${e}`);if("undefined"===typeof e["genesis-id"])throw new Error(`Response is missing required field 'genesis-id': ${e}`);if("undefined"===typeof e["previous-block-hash"])throw new Error(`Response is missing required field 'previous-block-hash': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.seed)throw new Error(`Response is missing required field 'seed': ${e}`);if("undefined"===typeof e.timestamp)throw new Error(`Response is missing required field 'timestamp': ${e}`);if("undefined"===typeof e["transactions-root"])throw new Error(`Response is missing required field 'transactions-root': ${e}`);if("undefined"===typeof e["transactions-root-sha256"])throw new Error(`Response is missing required field 'transactions-root-sha256': ${e}`);return new Jn({genesisHash:e["genesis-hash"],genesisId:e["genesis-id"],previousBlockHash:e["previous-block-hash"],round:e.round,seed:e.seed,timestamp:e.timestamp,transactionsRoot:e["transactions-root"],transactionsRootSha256:e["transactions-root-sha256"],participationUpdates:"undefined"!==typeof e["participation-updates"]?fr.from_obj_for_encoding(e["participation-updates"]):void 0,rewards:"undefined"!==typeof e.rewards?Qn.from_obj_for_encoding(e.rewards):void 0,stateProofTracking:"undefined"!==typeof e["state-proof-tracking"]?e["state-proof-tracking"].map(yr.from_obj_for_encoding):void 0,transactions:"undefined"!==typeof e.transactions?e.transactions.map(Ar.from_obj_for_encoding):void 0,txnCounter:e["txn-counter"],upgradeState:"undefined"!==typeof e["upgrade-state"]?$n.from_obj_for_encoding(e["upgrade-state"]):void 0,upgradeVote:"undefined"!==typeof e["upgrade-vote"]?er.from_obj_for_encoding(e["upgrade-vote"]):void 0})}}class Qn extends fe{constructor({feeSink:e,rewardsCalculationRound:t,rewardsLevel:n,rewardsPool:r,rewardsRate:i,rewardsResidue:o}){super(),this.feeSink=e,this.rewardsCalculationRound=t,this.rewardsLevel=n,this.rewardsPool=r,this.rewardsRate=i,this.rewardsResidue=o,this.attribute_map={feeSink:"fee-sink",rewardsCalculationRound:"rewards-calculation-round",rewardsLevel:"rewards-level",rewardsPool:"rewards-pool",rewardsRate:"rewards-rate",rewardsResidue:"rewards-residue"}}static from_obj_for_encoding(e){if("undefined"===typeof e["fee-sink"])throw new Error(`Response is missing required field 'fee-sink': ${e}`);if("undefined"===typeof e["rewards-calculation-round"])throw new Error(`Response is missing required field 'rewards-calculation-round': ${e}`);if("undefined"===typeof e["rewards-level"])throw new Error(`Response is missing required field 'rewards-level': ${e}`);if("undefined"===typeof e["rewards-pool"])throw new Error(`Response is missing required field 'rewards-pool': ${e}`);if("undefined"===typeof e["rewards-rate"])throw new Error(`Response is missing required field 'rewards-rate': ${e}`);if("undefined"===typeof e["rewards-residue"])throw new Error(`Response is missing required field 'rewards-residue': ${e}`);return new Qn({feeSink:e["fee-sink"],rewardsCalculationRound:e["rewards-calculation-round"],rewardsLevel:e["rewards-level"],rewardsPool:e["rewards-pool"],rewardsRate:e["rewards-rate"],rewardsResidue:e["rewards-residue"]})}}class $n extends fe{constructor({currentProtocol:e,nextProtocol:t,nextProtocolApprovals:n,nextProtocolSwitchOn:r,nextProtocolVoteBefore:i}){super(),this.currentProtocol=e,this.nextProtocol=t,this.nextProtocolApprovals=n,this.nextProtocolSwitchOn=r,this.nextProtocolVoteBefore=i,this.attribute_map={currentProtocol:"current-protocol",nextProtocol:"next-protocol",nextProtocolApprovals:"next-protocol-approvals",nextProtocolSwitchOn:"next-protocol-switch-on",nextProtocolVoteBefore:"next-protocol-vote-before"}}static from_obj_for_encoding(e){if("undefined"===typeof e["current-protocol"])throw new Error(`Response is missing required field 'current-protocol': ${e}`);return new $n({currentProtocol:e["current-protocol"],nextProtocol:e["next-protocol"],nextProtocolApprovals:e["next-protocol-approvals"],nextProtocolSwitchOn:e["next-protocol-switch-on"],nextProtocolVoteBefore:e["next-protocol-vote-before"]})}}class er extends fe{constructor({upgradeApprove:e,upgradeDelay:t,upgradePropose:n}){super(),this.upgradeApprove=e,this.upgradeDelay=t,this.upgradePropose=n,this.attribute_map={upgradeApprove:"upgrade-approve",upgradeDelay:"upgrade-delay",upgradePropose:"upgrade-propose"}}static from_obj_for_encoding(e){return new er({upgradeApprove:e["upgrade-approve"],upgradeDelay:e["upgrade-delay"],upgradePropose:e["upgrade-propose"]})}}class tr extends fe{constructor({name:e,value:t}){super(),this.name="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.value="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={name:"name",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new tr({name:e.name,value:e.value})}}class nr extends fe{constructor({name:e}){super(),this.name="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.attribute_map={name:"name"}}static from_obj_for_encoding(e){if("undefined"===typeof e.name)throw new Error(`Response is missing required field 'name': ${e}`);return new nr({name:e.name})}}class rr extends fe{constructor({applicationId:e,boxes:t,nextToken:n}){super(),this.applicationId=e,this.boxes=t,this.nextToken=n,this.attribute_map={applicationId:"application-id",boxes:"boxes",nextToken:"next-token"}}static from_obj_for_encoding(e){if("undefined"===typeof e["application-id"])throw new Error(`Response is missing required field 'application-id': ${e}`);if(!Array.isArray(e.boxes))throw new Error(`Response is missing required array field 'boxes': ${e}`);return new rr({applicationId:e["application-id"],boxes:e.boxes.map(nr.from_obj_for_encoding),nextToken:e["next-token"]})}}class ir extends fe{constructor({message:e,data:t}){super(),this.message=e,this.data=t,this.attribute_map={message:"message",data:"data"}}static from_obj_for_encoding(e){if("undefined"===typeof e.message)throw new Error(`Response is missing required field 'message': ${e}`);return new ir({message:e.message,data:e.data})}}class or extends fe{constructor({action:e,bytes:t,uint:n}){super(),this.action=e,this.bytes=t,this.uint=n,this.attribute_map={action:"action",bytes:"bytes",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.action)throw new Error(`Response is missing required field 'action': ${e}`);return new or({action:e.action,bytes:e.bytes,uint:e.uint})}}class sr extends fe{constructor({key:e,value:t}){super(),this.key=e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new sr({key:e.key,value:or.from_obj_for_encoding(e.value)})}}class ar extends fe{constructor({hashType:e}){super(),this.hashType=e,this.attribute_map={hashType:"hash-type"}}static from_obj_for_encoding(e){return new ar({hashType:e["hash-type"]})}}class cr extends fe{constructor({dbAvailable:e,isMigrating:t,message:n,round:r,version:i,data:o,errors:s}){super(),this.dbAvailable=e,this.isMigrating=t,this.message=n,this.round=r,this.version=i,this.data=o,this.errors=s,this.attribute_map={dbAvailable:"db-available",isMigrating:"is-migrating",message:"message",round:"round",version:"version",data:"data",errors:"errors"}}static from_obj_for_encoding(e){if("undefined"===typeof e["db-available"])throw new Error(`Response is missing required field 'db-available': ${e}`);if("undefined"===typeof e["is-migrating"])throw new Error(`Response is missing required field 'is-migrating': ${e}`);if("undefined"===typeof e.message)throw new Error(`Response is missing required field 'message': ${e}`);if("undefined"===typeof e.round)throw new Error(`Response is missing required field 'round': ${e}`);if("undefined"===typeof e.version)throw new Error(`Response is missing required field 'version': ${e}`);return new cr({dbAvailable:e["db-available"],isMigrating:e["is-migrating"],message:e.message,round:e.round,version:e.version,data:e.data,errors:e.errors})}}class ur extends fe{constructor({blockHeadersCommitment:e,firstAttestedRound:t,latestAttestedRound:n,lnProvenWeight:r,votersCommitment:i}){super(),this.blockHeadersCommitment="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.firstAttestedRound=t,this.latestAttestedRound=n,this.lnProvenWeight=r,this.votersCommitment="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.attribute_map={blockHeadersCommitment:"block-headers-commitment",firstAttestedRound:"first-attested-round",latestAttestedRound:"latest-attested-round",lnProvenWeight:"ln-proven-weight",votersCommitment:"voters-commitment"}}static from_obj_for_encoding(e){return new ur({blockHeadersCommitment:e["block-headers-commitment"],firstAttestedRound:e["first-attested-round"],latestAttestedRound:e["latest-attested-round"],lnProvenWeight:e["ln-proven-weight"],votersCommitment:e["voters-commitment"]})}}class lr extends fe{constructor({hashFactory:e,path:t,treeDepth:n}){super(),this.hashFactory=e,this.path=t,this.treeDepth=n,this.attribute_map={hashFactory:"hash-factory",path:"path",treeDepth:"tree-depth"}}static from_obj_for_encoding(e){return new lr({hashFactory:"undefined"!==typeof e["hash-factory"]?ar.from_obj_for_encoding(e["hash-factory"]):void 0,path:e.path,treeDepth:e["tree-depth"]})}}class dr extends fe{constructor({address:e,amount:t,isFrozen:n,deleted:r,optedInAtRound:i,optedOutAtRound:o}){super(),this.address=e,this.amount=t,this.isFrozen=n,this.deleted=r,this.optedInAtRound=i,this.optedOutAtRound=o,this.attribute_map={address:"address",amount:"amount",isFrozen:"is-frozen",deleted:"deleted",optedInAtRound:"opted-in-at-round",optedOutAtRound:"opted-out-at-round"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["is-frozen"])throw new Error(`Response is missing required field 'is-frozen': ${e}`);return new dr({address:e.address,amount:e.amount,isFrozen:e["is-frozen"],deleted:e.deleted,optedInAtRound:e["opted-in-at-round"],optedOutAtRound:e["opted-out-at-round"]})}}class fr extends fe{constructor({expiredParticipationAccounts:e}){super(),this.expiredParticipationAccounts=e,this.attribute_map={expiredParticipationAccounts:"expired-participation-accounts"}}static from_obj_for_encoding(e){return new fr({expiredParticipationAccounts:e["expired-participation-accounts"]})}}class hr extends fe{constructor({partProofs:e,positionsToReveal:t,reveals:n,saltVersion:r,sigCommit:i,sigProofs:o,signedWeight:s}){super(),this.partProofs=e,this.positionsToReveal=t,this.reveals=n,this.saltVersion=r,this.sigCommit="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.sigProofs=o,this.signedWeight=s,this.attribute_map={partProofs:"part-proofs",positionsToReveal:"positions-to-reveal",reveals:"reveals",saltVersion:"salt-version",sigCommit:"sig-commit",sigProofs:"sig-proofs",signedWeight:"signed-weight"}}static from_obj_for_encoding(e){return new hr({partProofs:"undefined"!==typeof e["part-proofs"]?lr.from_obj_for_encoding(e["part-proofs"]):void 0,positionsToReveal:e["positions-to-reveal"],reveals:"undefined"!==typeof e.reveals?e.reveals.map(gr.from_obj_for_encoding):void 0,saltVersion:e["salt-version"],sigCommit:e["sig-commit"],sigProofs:"undefined"!==typeof e["sig-proofs"]?lr.from_obj_for_encoding(e["sig-proofs"]):void 0,signedWeight:e["signed-weight"]})}}class pr extends fe{constructor({verifier:e,weight:t}){super(),this.verifier=e,this.weight=t,this.attribute_map={verifier:"verifier",weight:"weight"}}static from_obj_for_encoding(e){return new pr({verifier:"undefined"!==typeof e.verifier?vr.from_obj_for_encoding(e.verifier):void 0,weight:e.weight})}}class gr extends fe{constructor({participant:e,position:t,sigSlot:n}){super(),this.participant=e,this.position=t,this.sigSlot=n,this.attribute_map={participant:"participant",position:"position",sigSlot:"sig-slot"}}static from_obj_for_encoding(e){return new gr({participant:"undefined"!==typeof e.participant?pr.from_obj_for_encoding(e.participant):void 0,position:e.position,sigSlot:"undefined"!==typeof e["sig-slot"]?mr.from_obj_for_encoding(e["sig-slot"]):void 0})}}class mr extends fe{constructor({lowerSigWeight:e,signature:t}){super(),this.lowerSigWeight=e,this.signature=t,this.attribute_map={lowerSigWeight:"lower-sig-weight",signature:"signature"}}static from_obj_for_encoding(e){return new mr({lowerSigWeight:e["lower-sig-weight"],signature:"undefined"!==typeof e.signature?br.from_obj_for_encoding(e.signature):void 0})}}class br extends fe{constructor({falconSignature:e,merkleArrayIndex:t,proof:n,verifyingKey:r}){super(),this.falconSignature="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.merkleArrayIndex=t,this.proof=n,this.verifyingKey="string"===typeof r?new Uint8Array(a.lW.from(r,"base64")):r,this.attribute_map={falconSignature:"falcon-signature",merkleArrayIndex:"merkle-array-index",proof:"proof",verifyingKey:"verifying-key"}}static from_obj_for_encoding(e){return new br({falconSignature:e["falcon-signature"],merkleArrayIndex:e["merkle-array-index"],proof:"undefined"!==typeof e.proof?lr.from_obj_for_encoding(e.proof):void 0,verifyingKey:e["verifying-key"]})}}class yr extends fe{constructor({nextRound:e,onlineTotalWeight:t,type:n,votersCommitment:r}){super(),this.nextRound=e,this.onlineTotalWeight=t,this.type=n,this.votersCommitment="string"===typeof r?new Uint8Array(a.lW.from(r,"base64")):r,this.attribute_map={nextRound:"next-round",onlineTotalWeight:"online-total-weight",type:"type",votersCommitment:"voters-commitment"}}static from_obj_for_encoding(e){return new yr({nextRound:e["next-round"],onlineTotalWeight:e["online-total-weight"],type:e.type,votersCommitment:e["voters-commitment"]})}}class vr extends fe{constructor({commitment:e,keyLifetime:t}){super(),this.commitment="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.keyLifetime=t,this.attribute_map={commitment:"commitment",keyLifetime:"key-lifetime"}}static from_obj_for_encoding(e){return new vr({commitment:e.commitment,keyLifetime:e["key-lifetime"]})}}class wr extends fe{constructor({numByteSlice:e,numUint:t}){super(),this.numByteSlice=e,this.numUint=t,this.attribute_map={numByteSlice:"num-byte-slice",numUint:"num-uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e["num-byte-slice"])throw new Error(`Response is missing required field 'num-byte-slice': ${e}`);if("undefined"===typeof e["num-uint"])throw new Error(`Response is missing required field 'num-uint': ${e}`);return new wr({numByteSlice:e["num-byte-slice"],numUint:e["num-uint"]})}}class xr extends fe{constructor({key:e,value:t}){super(),this.key=e,this.value=t,this.attribute_map={key:"key",value:"value"}}static from_obj_for_encoding(e){if("undefined"===typeof e.key)throw new Error(`Response is missing required field 'key': ${e}`);if("undefined"===typeof e.value)throw new Error(`Response is missing required field 'value': ${e}`);return new xr({key:e.key,value:Sr.from_obj_for_encoding(e.value)})}}class Sr extends fe{constructor({bytes:e,type:t,uint:n}){super(),this.bytes=e,this.type=t,this.uint=n,this.attribute_map={bytes:"bytes",type:"type",uint:"uint"}}static from_obj_for_encoding(e){if("undefined"===typeof e.bytes)throw new Error(`Response is missing required field 'bytes': ${e}`);if("undefined"===typeof e.type)throw new Error(`Response is missing required field 'type': ${e}`);if("undefined"===typeof e.uint)throw new Error(`Response is missing required field 'uint': ${e}`);return new Sr({bytes:e.bytes,type:e.type,uint:e.uint})}}class Ar extends fe{constructor({fee:e,firstValid:t,lastValid:n,sender:r,applicationTransaction:i,assetConfigTransaction:o,assetFreezeTransaction:s,assetTransferTransaction:c,authAddr:u,closeRewards:l,closingAmount:d,confirmedRound:f,createdApplicationIndex:h,createdAssetIndex:p,genesisHash:g,genesisId:m,globalStateDelta:b,group:y,id:v,innerTxns:w,intraRoundOffset:x,keyregTransaction:S,lease:A,localStateDelta:E,logs:_,note:C,paymentTransaction:I,receiverRewards:k,rekeyTo:T,roundTime:M,senderRewards:P,signature:O,stateProofTransaction:R,txType:N}){super(),this.fee=e,this.firstValid=t,this.lastValid=n,this.sender=r,this.applicationTransaction=i,this.assetConfigTransaction=o,this.assetFreezeTransaction=s,this.assetTransferTransaction=c,this.authAddr=u,this.closeRewards=l,this.closingAmount=d,this.confirmedRound=f,this.createdApplicationIndex=h,this.createdAssetIndex=p,this.genesisHash="string"===typeof g?new Uint8Array(a.lW.from(g,"base64")):g,this.genesisId=m,this.globalStateDelta=b,this.group="string"===typeof y?new Uint8Array(a.lW.from(y,"base64")):y,this.id=v,this.innerTxns=w,this.intraRoundOffset=x,this.keyregTransaction=S,this.lease="string"===typeof A?new Uint8Array(a.lW.from(A,"base64")):A,this.localStateDelta=E,this.logs=_,this.note="string"===typeof C?new Uint8Array(a.lW.from(C,"base64")):C,this.paymentTransaction=I,this.receiverRewards=k,this.rekeyTo=T,this.roundTime=M,this.senderRewards=P,this.signature=O,this.stateProofTransaction=R,this.txType=N,this.attribute_map={fee:"fee",firstValid:"first-valid",lastValid:"last-valid",sender:"sender",applicationTransaction:"application-transaction",assetConfigTransaction:"asset-config-transaction",assetFreezeTransaction:"asset-freeze-transaction",assetTransferTransaction:"asset-transfer-transaction",authAddr:"auth-addr",closeRewards:"close-rewards",closingAmount:"closing-amount",confirmedRound:"confirmed-round",createdApplicationIndex:"created-application-index",createdAssetIndex:"created-asset-index",genesisHash:"genesis-hash",genesisId:"genesis-id",globalStateDelta:"global-state-delta",group:"group",id:"id",innerTxns:"inner-txns",intraRoundOffset:"intra-round-offset",keyregTransaction:"keyreg-transaction",lease:"lease",localStateDelta:"local-state-delta",logs:"logs",note:"note",paymentTransaction:"payment-transaction",receiverRewards:"receiver-rewards",rekeyTo:"rekey-to",roundTime:"round-time",senderRewards:"sender-rewards",signature:"signature",stateProofTransaction:"state-proof-transaction",txType:"tx-type"}}static from_obj_for_encoding(e){if("undefined"===typeof e.fee)throw new Error(`Response is missing required field 'fee': ${e}`);if("undefined"===typeof e["first-valid"])throw new Error(`Response is missing required field 'first-valid': ${e}`);if("undefined"===typeof e["last-valid"])throw new Error(`Response is missing required field 'last-valid': ${e}`);if("undefined"===typeof e.sender)throw new Error(`Response is missing required field 'sender': ${e}`);return new Ar({fee:e.fee,firstValid:e["first-valid"],lastValid:e["last-valid"],sender:e.sender,applicationTransaction:"undefined"!==typeof e["application-transaction"]?Er.from_obj_for_encoding(e["application-transaction"]):void 0,assetConfigTransaction:"undefined"!==typeof e["asset-config-transaction"]?_r.from_obj_for_encoding(e["asset-config-transaction"]):void 0,assetFreezeTransaction:"undefined"!==typeof e["asset-freeze-transaction"]?Cr.from_obj_for_encoding(e["asset-freeze-transaction"]):void 0,assetTransferTransaction:"undefined"!==typeof e["asset-transfer-transaction"]?Ir.from_obj_for_encoding(e["asset-transfer-transaction"]):void 0,authAddr:e["auth-addr"],closeRewards:e["close-rewards"],closingAmount:e["closing-amount"],confirmedRound:e["confirmed-round"],createdApplicationIndex:e["created-application-index"],createdAssetIndex:e["created-asset-index"],genesisHash:e["genesis-hash"],genesisId:e["genesis-id"],globalStateDelta:"undefined"!==typeof e["global-state-delta"]?e["global-state-delta"].map(sr.from_obj_for_encoding):void 0,group:e.group,id:e.id,innerTxns:"undefined"!==typeof e["inner-txns"]?e["inner-txns"].map(Ar.from_obj_for_encoding):void 0,intraRoundOffset:e["intra-round-offset"],keyregTransaction:"undefined"!==typeof e["keyreg-transaction"]?kr.from_obj_for_encoding(e["keyreg-transaction"]):void 0,lease:e.lease,localStateDelta:"undefined"!==typeof e["local-state-delta"]?e["local-state-delta"].map(Rn.from_obj_for_encoding):void 0,logs:e.logs,note:e.note,paymentTransaction:"undefined"!==typeof e["payment-transaction"]?Tr.from_obj_for_encoding(e["payment-transaction"]):void 0,receiverRewards:e["receiver-rewards"],rekeyTo:e["rekey-to"],roundTime:e["round-time"],senderRewards:e["sender-rewards"],signature:"undefined"!==typeof e.signature?Pr.from_obj_for_encoding(e.signature):void 0,stateProofTransaction:"undefined"!==typeof e["state-proof-transaction"]?Br.from_obj_for_encoding(e["state-proof-transaction"]):void 0,txType:e["tx-type"]})}}class Er extends fe{constructor({applicationId:e,accounts:t,applicationArgs:n,approvalProgram:r,clearStateProgram:i,extraProgramPages:o,foreignApps:s,foreignAssets:c,globalStateSchema:u,localStateSchema:l,onCompletion:d}){super(),this.applicationId=e,this.accounts=t,this.applicationArgs=n,this.approvalProgram="string"===typeof r?new Uint8Array(a.lW.from(r,"base64")):r,this.clearStateProgram="string"===typeof i?new Uint8Array(a.lW.from(i,"base64")):i,this.extraProgramPages=o,this.foreignApps=s,this.foreignAssets=c,this.globalStateSchema=u,this.localStateSchema=l,this.onCompletion=d,this.attribute_map={applicationId:"application-id",accounts:"accounts",applicationArgs:"application-args",approvalProgram:"approval-program",clearStateProgram:"clear-state-program",extraProgramPages:"extra-program-pages",foreignApps:"foreign-apps",foreignAssets:"foreign-assets",globalStateSchema:"global-state-schema",localStateSchema:"local-state-schema",onCompletion:"on-completion"}}static from_obj_for_encoding(e){if("undefined"===typeof e["application-id"])throw new Error(`Response is missing required field 'application-id': ${e}`);return new Er({applicationId:e["application-id"],accounts:e.accounts,applicationArgs:e["application-args"],approvalProgram:e["approval-program"],clearStateProgram:e["clear-state-program"],extraProgramPages:e["extra-program-pages"],foreignApps:e["foreign-apps"],foreignAssets:e["foreign-assets"],globalStateSchema:"undefined"!==typeof e["global-state-schema"]?wr.from_obj_for_encoding(e["global-state-schema"]):void 0,localStateSchema:"undefined"!==typeof e["local-state-schema"]?wr.from_obj_for_encoding(e["local-state-schema"]):void 0,onCompletion:e["on-completion"]})}}class _r extends fe{constructor({assetId:e,params:t}){super(),this.assetId=e,this.params=t,this.attribute_map={assetId:"asset-id",params:"params"}}static from_obj_for_encoding(e){return new _r({assetId:e["asset-id"],params:"undefined"!==typeof e.params?Kn.from_obj_for_encoding(e.params):void 0})}}class Cr extends fe{constructor({address:e,assetId:t,newFreezeStatus:n}){super(),this.address=e,this.assetId=t,this.newFreezeStatus=n,this.attribute_map={address:"address",assetId:"asset-id",newFreezeStatus:"new-freeze-status"}}static from_obj_for_encoding(e){if("undefined"===typeof e.address)throw new Error(`Response is missing required field 'address': ${e}`);if("undefined"===typeof e["asset-id"])throw new Error(`Response is missing required field 'asset-id': ${e}`);if("undefined"===typeof e["new-freeze-status"])throw new Error(`Response is missing required field 'new-freeze-status': ${e}`);return new Cr({address:e.address,assetId:e["asset-id"],newFreezeStatus:e["new-freeze-status"]})}}class Ir extends fe{constructor({amount:e,assetId:t,receiver:n,closeAmount:r,closeTo:i,sender:o}){super(),this.amount=e,this.assetId=t,this.receiver=n,this.closeAmount=r,this.closeTo=i,this.sender=o,this.attribute_map={amount:"amount",assetId:"asset-id",receiver:"receiver",closeAmount:"close-amount",closeTo:"close-to",sender:"sender"}}static from_obj_for_encoding(e){if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e["asset-id"])throw new Error(`Response is missing required field 'asset-id': ${e}`);if("undefined"===typeof e.receiver)throw new Error(`Response is missing required field 'receiver': ${e}`);return new Ir({amount:e.amount,assetId:e["asset-id"],receiver:e.receiver,closeAmount:e["close-amount"],closeTo:e["close-to"],sender:e.sender})}}class kr extends fe{constructor({nonParticipation:e,selectionParticipationKey:t,stateProofKey:n,voteFirstValid:r,voteKeyDilution:i,voteLastValid:o,voteParticipationKey:s}){super(),this.nonParticipation=e,this.selectionParticipationKey="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.stateProofKey="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.voteFirstValid=r,this.voteKeyDilution=i,this.voteLastValid=o,this.voteParticipationKey="string"===typeof s?new Uint8Array(a.lW.from(s,"base64")):s,this.attribute_map={nonParticipation:"non-participation",selectionParticipationKey:"selection-participation-key",stateProofKey:"state-proof-key",voteFirstValid:"vote-first-valid",voteKeyDilution:"vote-key-dilution",voteLastValid:"vote-last-valid",voteParticipationKey:"vote-participation-key"}}static from_obj_for_encoding(e){return new kr({nonParticipation:e["non-participation"],selectionParticipationKey:e["selection-participation-key"],stateProofKey:e["state-proof-key"],voteFirstValid:e["vote-first-valid"],voteKeyDilution:e["vote-key-dilution"],voteLastValid:e["vote-last-valid"],voteParticipationKey:e["vote-participation-key"]})}}class Tr extends fe{constructor({amount:e,receiver:t,closeAmount:n,closeRemainderTo:r}){super(),this.amount=e,this.receiver=t,this.closeAmount=n,this.closeRemainderTo=r,this.attribute_map={amount:"amount",receiver:"receiver",closeAmount:"close-amount",closeRemainderTo:"close-remainder-to"}}static from_obj_for_encoding(e){if("undefined"===typeof e.amount)throw new Error(`Response is missing required field 'amount': ${e}`);if("undefined"===typeof e.receiver)throw new Error(`Response is missing required field 'receiver': ${e}`);return new Tr({amount:e.amount,receiver:e.receiver,closeAmount:e["close-amount"],closeRemainderTo:e["close-remainder-to"]})}}class Mr extends fe{constructor({currentRound:e,transaction:t}){super(),this.currentRound=e,this.transaction=t,this.attribute_map={currentRound:"current-round",transaction:"transaction"}}static from_obj_for_encoding(e){if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);if("undefined"===typeof e.transaction)throw new Error(`Response is missing required field 'transaction': ${e}`);return new Mr({currentRound:e["current-round"],transaction:Ar.from_obj_for_encoding(e.transaction)})}}class Pr extends fe{constructor({logicsig:e,multisig:t,sig:n}){super(),this.logicsig=e,this.multisig=t,this.sig="string"===typeof n?new Uint8Array(a.lW.from(n,"base64")):n,this.attribute_map={logicsig:"logicsig",multisig:"multisig",sig:"sig"}}static from_obj_for_encoding(e){return new Pr({logicsig:"undefined"!==typeof e.logicsig?Or.from_obj_for_encoding(e.logicsig):void 0,multisig:"undefined"!==typeof e.multisig?Rr.from_obj_for_encoding(e.multisig):void 0,sig:e.sig})}}class Or extends fe{constructor({logic:e,args:t,multisigSignature:n,signature:r}){super(),this.logic="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.args=t,this.multisigSignature=n,this.signature="string"===typeof r?new Uint8Array(a.lW.from(r,"base64")):r,this.attribute_map={logic:"logic",args:"args",multisigSignature:"multisig-signature",signature:"signature"}}static from_obj_for_encoding(e){if("undefined"===typeof e.logic)throw new Error(`Response is missing required field 'logic': ${e}`);return new Or({logic:e.logic,args:e.args,multisigSignature:"undefined"!==typeof e["multisig-signature"]?Rr.from_obj_for_encoding(e["multisig-signature"]):void 0,signature:e.signature})}}class Rr extends fe{constructor({subsignature:e,threshold:t,version:n}){super(),this.subsignature=e,this.threshold=t,this.version=n,this.attribute_map={subsignature:"subsignature",threshold:"threshold",version:"version"}}static from_obj_for_encoding(e){return new Rr({subsignature:"undefined"!==typeof e.subsignature?e.subsignature.map(Nr.from_obj_for_encoding):void 0,threshold:e.threshold,version:e.version})}}class Nr extends fe{constructor({publicKey:e,signature:t}){super(),this.publicKey="string"===typeof e?new Uint8Array(a.lW.from(e,"base64")):e,this.signature="string"===typeof t?new Uint8Array(a.lW.from(t,"base64")):t,this.attribute_map={publicKey:"public-key",signature:"signature"}}static from_obj_for_encoding(e){return new Nr({publicKey:e["public-key"],signature:e.signature})}}class Br extends fe{constructor({message:e,stateProof:t,stateProofType:n}){super(),this.message=e,this.stateProof=t,this.stateProofType=n,this.attribute_map={message:"message",stateProof:"state-proof",stateProofType:"state-proof-type"}}static from_obj_for_encoding(e){return new Br({message:"undefined"!==typeof e.message?ur.from_obj_for_encoding(e.message):void 0,stateProof:"undefined"!==typeof e["state-proof"]?hr.from_obj_for_encoding(e["state-proof"]):void 0,stateProofType:e["state-proof-type"]})}}class Lr extends fe{constructor({currentRound:e,transactions:t,nextToken:n}){super(),this.currentRound=e,this.transactions=t,this.nextToken=n,this.attribute_map={currentRound:"current-round",transactions:"transactions",nextToken:"next-token"}}static from_obj_for_encoding(e){if("undefined"===typeof e["current-round"])throw new Error(`Response is missing required field 'current-round': ${e}`);if(!Array.isArray(e.transactions))throw new Error(`Response is missing required array field 'transactions': ${e}`);return new Lr({currentRound:e["current-round"],transactions:e.transactions.map(Ar.from_obj_for_encoding),nextToken:e["next-token"]})}}class Dr extends Ct{constructor(e,t,n,r){super(e,t),this.index=n,this.index=n;const i=a.lW.from(r).toString("base64");this.query.name=encodeURI(`b64:${i}`)}path(){return`/v2/applications/${this.index}/box`}prepare(e){return tr.from_obj_for_encoding(e)}}class Ur extends Ct{path(){return"/v2/accounts"}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}limit(e){return this.query.limit=e,this}assetID(e){return this.query["asset-id"]=e,this}nextToken(e){return this.query.next=e,this}round(e){return this.query.round=e,this}authAddr(e){return this.query["auth-addr"]=e,this}applicationID(e){return this.query["application-id"]=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}exclude(e){return this.query.exclude=e,this}}class jr extends Ct{path(){return"/v2/transactions"}notePrefix(e){return this.query["note-prefix"]=bn(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}assetID(e){return this.query["asset-id"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e,this}afterTime(e){return this.query["after-time"]=e,this}addressRole(e){return this.query["address-role"]=e,this}address(e){return this.query.address=e,this}excludeCloseTo(e){return this.query["exclude-close-to"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}applicationID(e){return this.query["application-id"]=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}}class Fr extends Ct{path(){return"/v2/assets"}limit(e){return this.query.limit=e,this}creator(e){return this.query.creator=e,this}name(e){return this.query.name=e,this}unit(e){return this.query.unit=e,this}index(e){return this.query["asset-id"]=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}}class Vr extends Ct{path(){return"/v2/applications"}index(e){return this.query["application-id"]=e,this}creator(e){return this.query.creator=e,this}nextToken(e){return this.query.next=e,this}limit(e){return this.query.limit=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}}class qr extends Ct{constructor(e,t,n){super(e,t),this.index=n,this.index=n}path(){return`/v2/applications/${this.index}/boxes`}nextToken(e){return this.query.next=e,this}limit(e){return this.query.limit=e,this}prepare(e){return rr.from_obj_for_encoding(e)}}class zr extends le{constructor(e,t="http://127.0.0.1",n=8080,r={}){super("X-Indexer-API-Token",e,t,n,r)}makeHealthCheck(){return new gn(this.c,this.intDecoding)}lookupAssetBalances(e){return new mn(this.c,this.intDecoding,e)}lookupAssetTransactions(e){return new vn(this.c,this.intDecoding,e)}lookupAccountTransactions(e){return new yn(this.c,this.intDecoding,e)}lookupBlock(e){return new wn(this.c,this.intDecoding,e)}lookupTransactionByID(e){return new xn(this.c,this.intDecoding,e)}lookupAccountByID(e){return new Sn(this.c,this.intDecoding,e)}lookupAccountAssets(e){return new An(this.c,this.intDecoding,e)}lookupAccountCreatedAssets(e){return new En(this.c,this.intDecoding,e)}lookupAccountAppLocalStates(e){return new _n(this.c,this.intDecoding,e)}lookupAccountCreatedApplications(e){return new Cn(this.c,this.intDecoding,e)}lookupAssetByID(e){return new In(this.c,this.intDecoding,e)}lookupApplications(e){return new kn(this.c,this.intDecoding,e)}lookupApplicationLogs(e){return new Tn(this.c,this.intDecoding,e)}searchAccounts(){return new Ur(this.c,this.intDecoding)}searchForTransactions(){return new jr(this.c,this.intDecoding)}searchForAssets(){return new Fr(this.c,this.intDecoding)}searchForApplications(){return new Vr(this.c,this.intDecoding)}searchForApplicationBoxes(e){return new qr(this.c,this.intDecoding,e)}lookupApplicationBoxByIDandName(e,t){return new Dr(this.c,this.intDecoding,e,t)}}async function Hr(e,t,n){const r=await e.status().do();if("undefined"===typeof r)throw new Error("Unable to get node status");const i=r["last-round"]+1;let o=i;for(;o=11&&(t.push(2047&n),n>>=11,r-=11)})),r&&t.push(n),t}function Jr(e){return e.map((e=>Kr[e]))}function Qr(e){return Jr(Yr(y(e)))[0]}function $r(e){if(32!==e.length)throw new RangeError("Seed length must be 32");const t=Jr(Yr(e)),n=Qr(e);return`${t.join(" ")} ${n}`}function ei(e){const t=e.split(" "),n=t.slice(0,24);for(const o of n)if(-1===Kr.indexOf(o))throw new Error("the mnemonic contains a word that is not in the wordlist");const r=t[t.length-1];let i=function(e){const t=[];let n=0,r=0;return e.forEach((function(e){for(n|=e<=8;)t.push(255&n),n>>=8,r-=8})),r&&t.push(n),new Uint8Array(t)}(n.map((e=>Kr.indexOf(e))));if(33!==i.length)throw new Error(Xr);if(0!==i[i.length-1])throw new Error(Xr);i=i.slice(0,i.length-1);if(Qr(i)===r)return i;throw new Error(Xr)}function ti(e){const t=w(ei(e));return{addr:L(t.publicKey),sk:t.secretKey}}function ni(e){return $r(e.slice(0,32))}function ri(e){return ei(e)}function ii(e){return $r(e)}class oi{constructor(e){if(this.name="Transaction group",this.tag=a.lW.from("TG"),e.length>16){const t=`${e.length.toString()} transactions grouped together but max group size is ${16..toString()}`;throw Error(t)}this.txGroupHashes=e}get_obj_for_encoding(){return{txlist:this.txGroupHashes}}static from_obj_for_encoding(e){const t=Object.create(this.prototype);t.name="Transaction group",t.tag=a.lW.from("TG"),t.txGroupHashes=[];for(const n of e.txlist)t.txGroupHashes.push(a.lW.from(n));return t}toByte(){return q(this.get_obj_for_encoding())}}function si(e){const t=[];for(const o of e){const e=ee(o);t.push(e.rawTxID())}const n=new oi(t),r=n.toByte(),i=y(a.lW.from(b(n.tag,r)));return a.lW.from(i)}function ai(e,t){const n=si(e),r=[];for(const i of e){const e=ee(i);t&&L(e.from.publicKey)!==t||(e.group=n,r.push(e))}return r}const ci="Cannot merge txs. Multisig preimages differ",ui="Cannot mutate a multisig field as it would invalidate all existing signatures.";function li(e,{version:t,threshold:n,addrs:r}){const i=r.map((e=>N(e).publicKey)),o={v:t,thr:n,subsig:i.map((e=>({pk:a.lW.from(e)})))},s=e.get_obj_for_encoding(),c={msig:o,txn:s},u=D({version:t,threshold:n,pks:i});return L(s.snd)!==L(u)&&(c.sgnr=a.lW.from(u)),new Uint8Array(q(c))}function di(e,{rawSig:t,myPk:n},{version:r,threshold:i,pks:o}){const s=z(li(e,{version:r,threshold:i,addrs:o.map((e=>L(e)))}));let c=!1;if(s.msig.subsig.forEach(((e,r)=>{E(e.pk,n)&&(c=!0,s.msig.subsig[r].s=t)})),!1===c)throw new Error("Key does not exist");const u=D({version:r,threshold:i,pks:o});return L(s.txn.snd)!==L(u)&&(s.sgnr=a.lW.from(u)),new Uint8Array(q(s))}class fi extends X{addLease(){throw new Error(ui)}addRekey(){throw new Error(ui)}signTxn(e){throw new Error("Cannot sign a multisig transaction using `signTxn`. Use `partialSignTxn` instead.")}partialSignTxn({version:e,threshold:t,pks:n},r){const i=S(r).publicKey;return di(this,{rawSig:this.rawSignTxn(r),myPk:i},{version:e,threshold:t,pks:n})}partialSignWithMultisigSignature(e,t,n){if(!x(n.length))throw new Error("Cannot add multisig signature. Signature is not of the correct length.");return di(this,{rawSig:n,myPk:N(t).publicKey},e)}static from_obj_for_encoding(e){return super.from_obj_for_encoding(e)}}function hi(e){if(e.length<2)throw new Error("Not enough multisig transactions to merge. Need at least two");const t=z(e[0]),n=fi.from_obj_for_encoding(t.txn).txID(),r=t.sgnr?L(t.sgnr):void 0,i=L(D({version:t.msig.v,threshold:t.msig.thr,pks:t.msig.subsig.map((e=>e.pk))})),o=t.msig.subsig.map((e=>({...e})));for(let c=1;ce.pk))})))throw new Error(ci);s.msig.subsig.forEach(((e,t)=>{if(!e.s)return;const n=o[t];if(n.s&&0!==a.lW.compare(a.lW.from(e.s),a.lW.from(n.s)))throw new Error("Cannot merge txs. subsigs are mismatched.");n.s=e.s}))}const s={msig:{v:t.msig.v,thr:t.msig.thr,subsig:o},txn:t.txn};return"undefined"!==typeof r&&(s.sgnr=a.lW.from(N(r).publicKey)),new Uint8Array(q(s))}function pi(e,t,n){const r=t.v,i=t.thr,o=t.subsig,s=o.map((e=>e.pk));if(t.subsig.lengthN(e).publicKey));let a,c;return e instanceof X?(a=e,c=fi.prototype.partialSignTxn.call(a,{version:t,threshold:n,pks:s},i)):(a=new fi(e),c=a.partialSignTxn({version:t,threshold:n,pks:s},i)),{txID:a.txID().toString(),blob:c}}function mi(e,{version:t,threshold:n,addrs:r},i){const o=r.map((e=>N(e).publicKey)),s=z(e),a=fi.from_obj_for_encoding(s.txn),c=a.partialSignTxn({version:t,threshold:n,pks:o},i);return{txID:a.txID().toString(),blob:hi([e,c])}}function bi(e,{version:t,threshold:n,addrs:r},i,o){const s=r.map((e=>N(e).publicKey)),a=z(e),c=fi.from_obj_for_encoding(a.txn),u=c.partialSignWithMultisigSignature({version:t,threshold:n,pks:s},i,o);return{txID:c.txID().toString(),blob:hi([e,u])}}function yi({version:e,threshold:t,addrs:n}){return U({version:e,threshold:t,addrs:n})}function vi(e){if(!e||0===e.length)throw new Error("empty program");const t="\n".charCodeAt(0),n=" ".charCodeAt(0),r="~".charCodeAt(0);if(e.every((e=>e===t||(e=>n<=e&&e<=r)(e)))){const t=a.lW.from(e).toString();if(B(t))throw new Error("requesting program bytes, get Algorand address");if(a.lW.from(t,"base64").toString("base64")===t)throw new Error("program should not be b64 encoded");throw new Error("program bytes are all ASCII printable characters, not looking like Teal byte code")}}class wi{constructor(e,t){if(this.tag=a.lW.from("Program"),t&&(!Array.isArray(t)||!t.every((e=>e.constructor===Uint8Array||a.lW.isBuffer(e)))))throw new TypeError("Invalid arguments");let n;null!=t&&(n=t.map((e=>new Uint8Array(e)))),vi(e),this.logic=e,this.args=n,this.sig=void 0,this.msig=void 0}get_obj_for_encoding(){const e={l:this.logic};return this.args&&(e.arg=this.args),this.sig?e.sig=this.sig:this.msig&&(e.msig=this.msig),e}static from_obj_for_encoding(e){const t=new wi(e.l,e.arg);return t.sig=e.sig,t.msig=e.msig,t}verify(e){if(this.sig&&this.msig)return!1;try{vi(this.logic)}catch(n){return!1}const t=b(this.tag,this.logic);if(!this.sig&&!this.msig){return m(y(t),e)}return this.sig?_(t,this.sig,e):pi(t,this.msig,e)}address(){const e=y(b(this.tag,this.logic));return L(new Uint8Array(e))}sign(e,t){if(null==t)this.sig=this.signProgram(e);else{const n=t.addrs.map((e=>({pk:N(e).publicKey})));this.msig={v:t.version,thr:t.threshold,subsig:n};const[r,i]=this.singleSignMultisig(e,this.msig);this.msig.subsig[i].s=r}}appendToMultisig(e){if(void 0===this.msig)throw new Error("no multisig present");const[t,n]=this.singleSignMultisig(e,this.msig);this.msig.subsig[n].s=t}signProgram(e){return A(b(this.tag,this.logic),e)}singleSignMultisig(e,t){let n=-1;const r=S(e).publicKey;for(let i=0;ie.pk))}))}return this.lsig.address()}signMultisig(e,t){this.lsig.sign(t,e)}appendToMultisig(e){this.lsig.appendToMultisig(e)}sign(e){this.lsig.sign(e),this.sigkey=S(e).publicKey}}function Si(e,t){let n,r;if(t instanceof xi)n=t.lsig,r=N(t.address()).publicKey;else if(n=t,n.sig)r=e.from.publicKey;else if(n.msig){r=D({version:n.msig.v,threshold:n.msig.thr,pks:n.msig.subsig.map((e=>e.pk))})}else r=N(n.address()).publicKey;return function(e,t,n){if(!t.verify(n))throw new Error("Logic signature verification failed. Ensure the program and signature are valid.");const r={lsig:t.get_obj_for_encoding(),txn:e.get_obj_for_encoding()};return E(n,e.from.publicKey)||(r.sgnr=a.lW.from(n)),{txID:e.txID().toString(),blob:q(r)}}(e,n,r)}function Ai(e,t){return Si(ee(e),t)}function Ei(e){return wi.fromByte(e)}const _i=a.lW.from("ProgData");function Ci(e,t,n){const r=b(N(n).publicKey,t);return A(a.lW.from(b(_i,r)),e)}function Ii(e,t,n,r){const i=b(N(t).publicKey,e);return _(a.lW.from(b(_i,i)),n,r)}function ki(e,t,n){return Ci(e,t,new wi(n).address())}let Ti={},Mi={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").forEach((function(e,t){Ti[e]=t,Mi[t]=e}));class Pi{constructor({version:e,sources:t,names:n,mappings:r}){if(this.version=e,this.sources=t,this.names=n,this.mappings=r,3!==this.version)throw new Error(`Only version 3 is supported, got ${this.version}`);if(void 0===this.mappings)throw new Error("mapping undefined, cannot build source map without `mapping`");const i=this.mappings.split(";").map((e=>{const t=function(e){let t=[],n=0,r=0;for(let i=0;i>>=1,e?t.push(0===r?-2147483648:-r):t.push(r),r=n=0}}return t}(e);if(t.length>2)return t[2]}));this.pcToLine={},this.lineToPc={};let o=0;for(const[s,a]of i.entries())void 0!==a&&(o+=a),o in this.lineToPc||(this.lineToPc[o]=[]),this.lineToPc[o].push(s),this.pcToLine[s]=o}getLineForPc(e){return this.pcToLine[e]}getPcsForLine(e){return this.lineToPc[e]}}function Oi(e){return e.params["approval-program"]=a.lW.from(e.params["approval-program"].toString(),"base64"),e.params["clear-state-program"]=a.lW.from(e.params["clear-state-program"].toString(),"base64"),e}async function Ri({client:e,txns:t,protocolVersion:n,latestTimestamp:r,round:i,sources:o}){const s=[],a=[],c=[],u=[],l=[];for(const p of t)p.txn.type===W.appl&&(l.push(L(p.txn.from.publicKey)),p.txn.appAccounts&&l.push(...p.txn.appAccounts.map((e=>L(e.publicKey)))),p.txn.appForeignApps&&(c.push(...p.txn.appForeignApps),l.push(...p.txn.appForeignApps.map((e=>j(e))))),p.txn.appForeignAssets&&u.push(...p.txn.appForeignAssets),void 0===p.txn.appIndex||0===p.txn.appIndex?s.push(new ye({id:1380011588,params:new Ae({creator:L(p.txn.from.publicKey),approvalProgram:p.txn.appApprovalProgram,clearStateProgram:p.txn.appClearProgram,localStateSchema:new _e({numUint:p.txn.appLocalInts,numByteSlice:p.txn.appLocalByteSlices}),globalStateSchema:new _e({numUint:p.txn.appGlobalInts,numByteSlice:p.txn.appGlobalByteSlices})})})):(c.push(p.txn.appIndex),l.push(j(p.txn.appIndex))));const d=[];for(const p of[...new Set(u)])d.push(e.getAssetByID(p).do().then((e=>{l.push(e.params.creator)})));await Promise.all(d);const f=[];for(const p of[...new Set(c)])f.push(e.getApplicationByID(p).do().then((e=>{const t=Oi(e);s.push(t),l.push(t.params.creator)})));await Promise.all(f);const h=[];for(const p of[...new Set(l)])h.push(e.accountInformation(p).do().then((e=>{"created-apps"in e&&(e["created-apps"]=e["created-apps"].map((e=>Oi(e)))),a.push(e)})));return await Promise.all(h),new qe({txns:t.map((e=>({...e,txn:e.txn.get_obj_for_encoding()}))),accounts:a,apps:s,latestTimestamp:r,round:i,protocolVersion:n,sources:o})}class Ni{constructor(e){this.type=0,this.bytes="",this.uint=0,this.type=e.type,this.bytes=e.bytes,this.uint=e.uint}toString(){return 1===this.type?`0x${a.lW.from(this.bytes,"base64").toString("hex")}`:this.uint.toString()}}class Bi{constructor(e){this.error="",this.line=0,this.pc=0,this.scratch=[],this.stack=[],this.error=void 0===e.error?"":e.error,this.line=e.line,this.pc=e.pc,this.scratch=e.scratch,this.stack=e.stack.map((e=>new Ni(e)))}}class Li{constructor(e){this.trace=[],null!=e&&(this.trace=e.map((e=>new Bi(e))))}}function Di(e,t){return e.length>t&&t>0?`${e.slice(0,t)}...`:e}function Ui(e,t){if(0===t.length)return"";let n=null;for(let i=0;ie.length||JSON.stringify(e[i])!==JSON.stringify(t[i]))&&(n=i);if(null==n)return"";const r=t[n];return r.bytes.length>0?`${n} = 0x${a.lW.from(r.bytes,"base64").toString("hex")}`:`${n} = ${r.uint.toString()}`}function ji(e,t){return`[${(t?e.reverse():e).map((e=>{switch(e.type){case 1:return`0x${a.lW.from(e.bytes,"base64").toString("hex")}`;case 2:return`${e.uint.toString()}`;default:return""}})).join(", ")}]`}class Fi{constructor(e){this.disassembly=[],this.appCallMessages=[],this.localDeltas=[],this.globalDelta=[],this.cost=0,this.logicSigMessages=[],this.logicSigDisassembly=[],this.logs=[],this.appCallTrace=void 0,this.logicSigTrace=void 0,this.required=["disassembly"],this.optionals=["app-call-messages","local-deltas","global-delta","cost","logic-sig-messages","logic-sig-disassembly","logs"],this.traces=["app-call-trace","logic-sig-trace"],this.disassembly=e.disassembly,this.appCallMessages=e["app-call-messages"],this.localDeltas=e["local-deltas"],this.globalDelta=e["global-delta"],this.cost=e.cost,this.logicSigMessages=e["logic-sig-messages"],this.logicSigDisassembly=e["logic-sig-disassembly"],this.logs=e.logs,this.appCallTrace=new Li(e["app-call-trace"]),this.logicSigTrace=new Li(e["logic-sig-trace"])}appCallRejected(){return void 0!==this.appCallMessages&&this.appCallMessages.includes("REJECT")}logicSigRejected(){return void 0!==this.logicSigMessages&&this.logicSigMessages.includes("REJECT")}static trace(e,t,n){const r=n.maxValueWidth||30,i=[["pc#","ln#","source","scratch","stack"]];for(let s=0;s0&&void 0!==e.trace[s-1].scratch?e.trace[s-1].scratch:[],h=""===a?t[o]:`!! ${a} !!`;i.push([c.toString().padEnd(3," "),o.toString().padEnd(3," "),Di(h,r),Di(Ui(f,d),r),Di(ji(l,n.topOfStackFirst),r)])}const o=i.reduce(((e,t)=>{const n=new Array(i[0].length).fill(0);for(let r=0;re[r]?t[r].length:e[r];return n}),new Array(i[0].length).fill(0));return`${i.map((e=>e.map(((e,t)=>e.padEnd(o[t]+1," "))).join("|").trim())).join("\n")}\n`}appTrace(e){if(void 0===this.appCallTrace||!this.disassembly)return"";let t=e;return void 0===e&&(t={maxValueWidth:30,topOfStackFirst:!1}),Fi.trace(this.appCallTrace,this.disassembly,t)}lsigTrace(e){if(void 0===this.logicSigTrace||void 0===this.logicSigDisassembly)return"";let t=e;return void 0===e&&(t={maxValueWidth:30,topOfStackFirst:!0}),Fi.trace(this.logicSigTrace,this.logicSigDisassembly,t)}}class Vi{constructor(e){this.error="",this.protocolVersion="",this.txns=[],this.error=e.error,this.protocolVersion=e["protocol-version"],this.txns=e.txns.map((e=>new Fi(e)))}}function qi(e,t,n,r,i,o,s){const a={from:e,to:t,amount:n,closeRemainderTo:r,note:i,suggestedParams:o,type:W.pay,reKeyTo:s};return new X(a)}function zi(e){return qi(e.from,e.to,e.amount,e.closeRemainderTo,e.note,e.suggestedParams,e.rekeyTo)}function Hi(e,t,n,r,i,o,s,a,c,u=!1,l){const d={from:e,note:t,voteKey:n,selectionKey:r,voteFirst:i,voteLast:o,voteKeyDilution:s,suggestedParams:a,type:W.keyreg,reKeyTo:c,nonParticipation:u,stateProofKey:l};return new X(d)}function Wi(e){return Hi(e.from,e.note,e.voteKey,e.selectionKey,e.voteFirst,e.voteLast,e.voteKeyDilution,e.suggestedParams,e.rekeyTo,e.nonParticipation,e.stateProofKey)}function Gi(e,t,n,r,i,o,s,a,c,u,l,d,f,h,p){const g={from:e,note:t,suggestedParams:h,assetTotal:n,assetDecimals:r,assetDefaultFrozen:i,assetUnitName:u,assetName:l,assetURL:d,assetMetadataHash:f,assetManager:o,assetReserve:s,assetFreeze:a,assetClawback:c,type:W.acfg,reKeyTo:p};return new X(g)}function Zi(e){return Gi(e.from,e.note,e.total,e.decimals,e.defaultFrozen,e.manager,e.reserve,e.freeze,e.clawback,e.unitName,e.assetName,e.assetURL,e.assetMetadataHash,e.suggestedParams,e.rekeyTo)}function Ki(e,t,n,r,i,o,s,a,c=!0,u){if(c&&(void 0===r||void 0===i||void 0===o||void 0===s))throw Error("strict empty address checking was turned on, but at least one empty address was provided");const l={from:e,suggestedParams:a,assetIndex:n,assetManager:r,assetReserve:i,assetFreeze:o,assetClawback:s,type:W.acfg,note:t,reKeyTo:u};return new X(l)}function Xi(e){return Ki(e.from,e.note,e.assetIndex,e.manager,e.reserve,e.freeze,e.clawback,e.suggestedParams,e.strictEmptyAddressChecking,e.rekeyTo)}function Yi(e,t,n,r,i){const o={from:e,suggestedParams:r,assetIndex:n,type:W.acfg,note:t,reKeyTo:i};return new X(o)}function Ji(e){return Yi(e.from,e.note,e.assetIndex,e.suggestedParams,e.rekeyTo)}function Qi(e,t,n,r,i,o,s){const a={from:e,type:W.afrz,freezeAccount:r,assetIndex:n,freezeState:i,note:t,suggestedParams:o,reKeyTo:s};return new X(a)}function $i(e){return Qi(e.from,e.note,e.assetIndex,e.freezeTarget,e.freezeState,e.suggestedParams,e.rekeyTo)}function eo(e,t,n,r,i,o,s,a,c){const u={type:W.axfer,from:e,to:t,amount:i,suggestedParams:a,assetIndex:s,note:o,assetRevocationTarget:r,closeRemainderTo:n,reKeyTo:c};return new X(u)}function to(e){return eo(e.from,e.to,e.closeRemainderTo,e.revocationTarget,e.amount,e.note,e.assetIndex,e.suggestedParams,e.rekeyTo)}function no(e,t,n,r,i,o,s,a,c,u,l,d,f,h,p,g,m,b){const y={type:W.appl,from:e,suggestedParams:t,appIndex:0,appOnComplete:n,appLocalInts:o,appLocalByteSlices:s,appGlobalInts:a,appGlobalByteSlices:c,appApprovalProgram:r,appClearProgram:i,appArgs:u,appAccounts:l,appForeignApps:d,appForeignAssets:f,boxes:b,note:h,lease:p,reKeyTo:g,extraPages:m};return new X(y)}function ro(e){return no(e.from,e.suggestedParams,e.onComplete,e.approvalProgram,e.clearProgram,e.numLocalInts,e.numLocalByteSlices,e.numGlobalInts,e.numGlobalByteSlices,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.extraPages,e.boxes)}function io(e,t,n,r,i,o,s,a,c,u,l,d,f){const h={type:W.appl,from:e,suggestedParams:t,appIndex:n,appApprovalProgram:r,appOnComplete:G.UpdateApplicationOC,appClearProgram:i,appArgs:o,appAccounts:s,appForeignApps:a,appForeignAssets:c,boxes:f,note:u,lease:l,reKeyTo:d};return new X(h)}function oo(e){return io(e.from,e.suggestedParams,e.appIndex,e.approvalProgram,e.clearProgram,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function so(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.DeleteApplicationOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function ao(e){return so(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function co(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.OptInOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function uo(e){return co(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function lo(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.CloseOutOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function fo(e){return lo(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function ho(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.ClearStateOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function po(e){return ho(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function go(e,t,n,r,i,o,s,a,c,u,l){const d={type:W.appl,from:e,suggestedParams:t,appIndex:n,appOnComplete:G.NoOpOC,appArgs:r,appAccounts:i,appForeignApps:o,appForeignAssets:s,boxes:l,note:a,lease:c,reKeyTo:u};return new X(d)}function mo(e){return go(e.from,e.suggestedParams,e.appIndex,e.appArgs,e.accounts,e.foreignApps,e.foreignAssets,e.note,e.lease,e.rekeyTo,e.boxes)}function bo(e){const t={type:W.appl,from:e.from,suggestedParams:e.suggestedParams,appIndex:e.appIndex,appOnComplete:e.onComplete,appLocalInts:e.numLocalInts,appLocalByteSlices:e.numLocalByteSlices,appGlobalInts:e.numGlobalInts,appGlobalByteSlices:e.numGlobalByteSlices,appApprovalProgram:e.approvalProgram,appClearProgram:e.clearProgram,appArgs:e.appArgs,appAccounts:e.accounts,appForeignApps:e.foreignApps,appForeignAssets:e.foreignAssets,boxes:e.boxes,note:e.note,lease:e.lease,reKeyTo:e.rekeyTo,extraPages:e.extraPages};return new X(t)}function yo(e){return(t,n)=>{const r=[];for(const i of n)r.push(t[i].signTxn(e.sk));return Promise.resolve(r)}}function vo(e){return(t,n)=>{const r=[];for(const i of n){const{blob:n}=Si(t[i],e);r.push(n)}return Promise.resolve(r)}}function wo(e,t){return(n,r)=>{const i=[];for(const o of r){const r=n[o],s=[];for(const n of t){const{blob:t}=gi(r,e,n);s.push(t)}s.length>1?i.push(hi(s)):i.push(s[0])}return Promise.resolve(i)}}function xo(){return(e,t)=>{const n=[];for(const r of t)n.push(Y(e[r]));return Promise.resolve(n)}}function So(e){return"object"===typeof e&&2===Object.keys(e).length&&"object"===typeof e.txn&&"function"===typeof e.signer}const Ao=65535,Eo=32,_o=1,Co=1,Io=2,ko=/^([a-z\d[\](),]+)\[(0|[1-9][\d]*)]$/,To=/^ufixed([1-9][\d]*)x([1-9][\d]*)$/;class Mo{static from(e){if(e.endsWith("[]")){const t=Mo.from(e.slice(0,e.length-2));return new Uo(t)}if(e.endsWith("]")){const t=e.match(ko);if(3!==t.length)throw new Error(`malformed static array string: ${e}`);const n=t[2],r=parseInt(n,10);if(r>Ao)throw new Error(`array length exceeds limit ${Ao}`);const i=Mo.from(t[1]);return new Do(i,r)}if(e.startsWith("uint")){const t=e=>[...e].every((e=>"0123456789".includes(e))),n=e.slice(4,e.length);if(!t(n))throw new Error(`malformed uint string: ${n}`);const r=parseInt(n,10);if(r>Ao)throw new Error(`malformed uint string: ${r}`);return new Po(r)}if("byte"===e)return new Bo;if(e.startsWith("ufixed")){const t=e.match(To);if(3!==t.length)throw new Error(`malformed ufixed type: ${e}`);const n=parseInt(t[1],10),r=parseInt(t[2],10);return new Oo(n,r)}if("bool"===e)return new No;if("address"===e)return new Ro;if("string"===e)return new Lo;if(e.length>=2&&"("===e[0]&&")"===e[e.length-1]){const t=jo.parseTupleContent(e.slice(1,e.length-1)),n=[];for(let e=0;e512)throw new Error(`unsupported uint type bitSize: ${e}`);this.bitSize=e}toString(){return`uint${this.bitSize}`}equals(e){return e instanceof Po&&this.bitSize===e.bitSize}isDynamic(){return!1}byteLen(){return this.bitSize/8}encode(e){if("bigint"!==typeof e&&"number"!==typeof e)throw new Error(`Cannot encode value as uint${this.bitSize}: ${e}`);if(e>=BigInt(2**this.bitSize)||e512)throw new Error(`unsupported ufixed type bitSize: ${e}`);if(t>160||t<1)throw new Error(`unsupported ufixed type precision: ${t}`);this.bitSize=e,this.precision=t}toString(){return`ufixed${this.bitSize}x${this.precision}`}equals(e){return e instanceof Oo&&this.bitSize===e.bitSize&&this.precision===e.precision}isDynamic(){return!1}byteLen(){return this.bitSize/8}encode(e){if("bigint"!==typeof e&&"number"!==typeof e)throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);if(e>=BigInt(2**this.bitSize)||e255)throw new Error(`${e} cannot be encoded into a byte`);return new Uint8Array([e])}decode(e){if(1!==e.byteLength)throw new Error("byte string must be 1 byte long");return e[0]}}class Lo extends Mo{toString(){return"string"}equals(e){return e instanceof Lo}isDynamic(){return!0}byteLen(){throw new Error(`${this.toString()} is a dynamic type`)}encode(e){if("string"!==typeof e&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as string: ${e}`);const t=a.lW.from(e),n=Wr(t.length,Io),r=new Uint8Array(t.length+Io);return r.set(n),r.set(t,Io),r}decode(e){if(e.length=Ao)throw new Error("tuple type child type number larger than maximum uint16 error");this.childTypes=e}toString(){const e=[];for(let t=0;tt.equals(e.childTypes[n])))}isDynamic(){return this.childTypes.some((e=>e.isDynamic()))}byteLen(){let e=0;for(let t=0;tAo)throw new Error("length of tuple array should not exceed a uint16");const n=this.childTypes,r=[],i=[],o=new Map;let s=0;for(;sAo)throw new Error(`byte length of ${e} should not exceed a uint16`);r[u]=Wr(e,Io)}c+=i[u].length}return b(...r,...i)}decode(e){const t=this.childTypes,n=[],r=[];let i=0,o=0;const s=a.lW.from(e);for(;i0&&(n[n.length-1].right=t,t>i;(e[o]&t)>0?r.push(new Uint8Array([128])):r.push(new Uint8Array([0]))}i+=n,o+=1}else{const t=a.byteLen();r.push(e.slice(o,o+t)),o+=t}if(i!==t.length-1&&o>=e.length)throw new Error("input byte not enough to decode");i+=1}if(n.length>0&&(n[n.length-1].right=e.length,o=e.length),oe.right)throw new Error("dynamic segment should display a [l, r] space with l <= r");if(a!==n.length-1&&e.right!==n[a+1].left)throw new Error("dynamic segment should be consecutive")}let c=0;for(let a=0;a8)throw new Error("value list passed in should be no greater than length 8");for(let n=0;n0&&-1===n))break;r+=1}}return r}var qo,zo;function Ho(e){return e===qo.any||e===qo.pay||e===qo.keyreg||e===qo.acfg||e===qo.axfer||e===qo.afrz||e===qo.appl}function Wo(e,t){return e===qo.any||t.type&&t.type.toString()===e.toString()}function Go(e){return e===zo.account||e===zo.application||e===zo.asset}!function(e){e.any="txn",e.pay="pay",e.keyreg="keyreg",e.acfg="acfg",e.axfer="axfer",e.afrz="afrz",e.appl="appl"}(qo||(qo={})),function(e){e.account="account",e.application="application",e.asset="asset"}(zo||(zo={}));class Zo{constructor(e){if("string"!==typeof e.name||"object"!==typeof e.returns||!Array.isArray(e.args))throw new Error("Invalid ABIMethod parameters");this.name=e.name,this.description=e.desc,this.args=e.args.map((({type:e,name:t,desc:n})=>Ho(e)||Go(e)?{type:e,name:t,description:n}:{type:Mo.from(e),name:t,description:n})),this.returns={type:"void"===e.returns.type?e.returns.type:Mo.from(e.returns.type),description:e.returns.desc}}getSignature(){const e=this.args.map((e=>e.type.toString())).join(","),t=this.returns.type.toString();return`${this.name}(${e})${t}`}getSelector(){const e=y(this.getSignature());return new Uint8Array(e.slice(0,4))}txnCount(){let e=1;for(const t of this.args)"string"===typeof t.type&&Ho(t.type)&&(e+=1);return e}toJSON(){return{name:this.name,desc:this.description,args:this.args.map((({type:e,name:t,description:n})=>({type:e.toString(),name:t,desc:n}))),returns:{type:this.returns.type.toString(),desc:this.returns.description}}}static fromSignature(e){const{name:t,args:n,returns:r}=function(e){const t=e.indexOf("(");if(-1===t)throw new Error(`Invalid method signature: ${e}`);let n=-1,r=0;for(let i=t;i({type:e}))),returns:{type:r}})}}function Ko(e,t){if(null===e||!Array.isArray(e)||!e.every((e=>e instanceof Zo)))throw new Error("Methods list provided is null or not the correct type");const n=e.filter((e=>e.name===t));if(n.length>1)throw new Error(`found ${n.length} methods with the same name ${n.map((e=>e.getSignature())).join(",")}`);if(0===n.length)throw new Error(`found 0 methods with the name ${t}`);return n[0]}class Xo{constructor(e){if("string"!==typeof e.name||!Array.isArray(e.methods)||e.networks&&"object"!==typeof e.networks)throw new Error("Invalid ABIContract parameters");this.name=e.name,this.description=e.desc,this.networks=e.networks?{...e.networks}:{},this.methods=e.methods.map((e=>new Zo(e)))}toJSON(){return{name:this.name,desc:this.description,networks:this.networks,methods:this.methods.map((e=>e.toJSON()))}}getMethodByName(e){return Ko(this.methods,e)}}class Yo{constructor(e){if("string"!==typeof e.name||!Array.isArray(e.methods))throw new Error("Invalid ABIInterface parameters");this.name=e.name,this.description=e.desc,this.methods=e.methods.map((e=>new Zo(e)))}toJSON(){return{name:this.name,desc:this.description,methods:this.methods.map((e=>e.toJSON()))}}getMethodByName(e){return Ko(this.methods,e)}}const Jo=a.lW.from([21,31,124,117]);var Qo;function $o(e,t,n){if(null!=n&&e===n)return 0;const r=null==n?0:1;for(let i=0;i({txn:X.from_obj_for_encoding({...e.get_obj_for_encoding(),grp:void 0}),signer:t}))),e.methodCalls=new Map(this.methodCalls),e}addTransaction(e){if(this.status!==Qo.BUILDING)throw new Error("Cannot add transactions when composer status is not BUILDING");if(this.transactions.length===es.MAX_GROUP_SIZE)throw new Error(`Adding an additional transaction exceeds the maximum atomic group size of ${es.MAX_GROUP_SIZE}`);if(e.txn.group&&e.txn.group.some((e=>0!==e)))throw new Error("Cannot add a transaction with nonzero group ID");this.transactions.push(e)}addMethodCall({appID:e,method:t,methodArgs:n,sender:r,suggestedParams:i,onComplete:o,approvalProgram:s,clearProgram:a,numGlobalInts:c,numGlobalByteSlices:u,numLocalInts:l,numLocalByteSlices:d,extraPages:f,appAccounts:h,appForeignApps:p,appForeignAssets:g,boxes:m,note:b,lease:y,rekeyTo:v,signer:w}){if(this.status!==Qo.BUILDING)throw new Error("Cannot add transactions when composer status is not BUILDING");if(this.transactions.length+t.txnCount()>es.MAX_GROUP_SIZE)throw new Error(`Adding additional transactions exceeds the maximum atomic group size of ${es.MAX_GROUP_SIZE}`);if(0===e){if(null==s||null==a||null==c||null==u||null==l||null==d)throw new Error("One of the following required parameters for application creation is missing: approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices")}else if(o===G.UpdateApplicationOC){if(null==s||null==a)throw new Error("One of the following required parameters for OnApplicationComplete.UpdateApplicationOC is missing: approvalProgram, clearProgram");if(null!=c||null!=u||null!=l||null!=d||null!=f)throw new Error("One of the following application creation parameters were set on a non-creation call: numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages")}else if(null!=s||null!=a||null!=c||null!=u||null!=l||null!=d||null!=f)throw new Error("One of the following application creation parameters were set on a non-creation call: approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages");if(null==n&&(n=[]),n.length!==t.args.length)throw new Error(`Incorrect number of method arguments. Expected ${t.args.length}, got ${n.length}`);let x=[],S=[];const A=[],E=[],_=[],C=new Map,I=m||[];for(let N=0;N0!==e)))throw new Error("Cannot add a transaction with nonzero group ID");A.push(r)}else{if(So(r))throw new Error(`Expected non-transaction value for argument at index ${N}`);if(Go(e)&&(C.set(E.length,x.length),E.push(e),_.push(r),e=new Po(8)),"string"===typeof e)throw new Error(`Unknown ABI type: ${e}`);x.push(e),S.push(r)}}const k=[],T=null==h?[]:h.slice(),M=null==p?[]:p.slice(),P=null==g?[]:g.slice();for(let N=0;NNumber.MAX_SAFE_INTEGER)throw new Error(`Expected safe integer for application value, got ${r}`);i=$o(Number(r),M,e);break}case zo.asset:{const e=new Po(64),t=e.decode(e.encode(n));if(t>Number.MAX_SAFE_INTEGER)throw new Error(`Expected safe integer for asset value, got ${t}`);i=$o(Number(t),P);break}default:throw new Error(`Unknown reference type: ${t}`)}k.push(i)}for(let N=0;N15){const e=x.slice(14),t=S.slice(14);x=x.slice(0,14),S=S.slice(0,14),x.push(new jo(e)),S.push(t)}const O=[t.getSelector()];for(let N=0;N1&&ai(this.transactions.map((e=>e.txn))),this.status=Qo.BUILT}return this.transactions}async gatherSignatures(){if(this.status>=Qo.SIGNED)return this.signedTxns;const e=this.buildGroup(),t=e.map((e=>e.txn)),n=new Map;for(let a=0;ae(t,n)))),o=e.map((()=>null));for(let a=0;anull!=e)))throw new Error(`Missing signatures. Got ${o}`);const s=o.map(((e,t)=>{try{return $(e).txn.txID()}catch(n){throw new Error(`Cannot decode signed transaction at index ${t}. ${n}`)}}));return this.signedTxns=o,this.txIDs=s,this.status=Qo.SIGNED,o}async submit(e){if(this.status>Qo.SUBMITTED)throw new Error("Transaction group cannot be resubmitted");const t=await this.gatherSignatures();return await e.sendRawTransaction(t).do(),this.status=Qo.SUBMITTED,this.txIDs}async simulate(e,t){if(this.status>Qo.SUBMITTED)throw new Error("Simulated Transaction group has already been submitted to the network");const n=(await this.gatherSignatures()).map((e=>z(e))),r=null==t?new at({txnGroups:[]}):t;r.txnGroups=[new ct({txns:n})];const i=await e.simulateTransactions(r).do(),o=[];for(const[s,a]of this.methodCalls){const e=this.txIDs[s],t=i.txnGroups[0].txnResults[s].txnResult,n={txID:e,rawReturnValue:new Uint8Array,method:a};o.push(es.parseMethodResponse(a,n,t.get_obj_for_encoding()))}return{methodResults:o,simulateResponse:i}}async execute(e,t){if(this.status===Qo.COMMITTED)throw new Error("Transaction group has already been executed successfully");const n=await this.submit(e);this.status=Qo.SUBMITTED;const r=this.transactions.findIndex(((e,t)=>this.methodCalls.has(t))),i=-1===r?0:r,o=await Hr(e,n[i],t);this.status=Qo.COMMITTED;const s=o["confirmed-round"],a=[];for(const[u,l]of this.methodCalls){const t=n[u];let i={txID:t,rawReturnValue:new Uint8Array,method:l};try{const n=u===r?o:await e.pendingTransactionInformation(t).do();i=es.parseMethodResponse(l,i,n)}catch(c){i.decodeError=c}a.push(i)}return{confirmedRound:s,txIDs:n,methodResults:a}}static parseMethodResponse(e,t,n){const r=t;try{if(r.txInfo=n,"void"!==e.returns.type){const i=n.logs||[];if(0===i.length)throw new Error("App call transaction did not log a return value");const o=a.lW.from(i[i.length-1],"base64");if(o.byteLength<4||!o.slice(0,4).equals(Jo))throw new Error("App call transaction did not log a return value");r.rawReturnValue=new Uint8Array(o.slice(4)),r.returnValue=e.returns.type.decode(t.rawReturnValue)}}catch(i){r.decodeError=i}return r}}es.MAX_GROUP_SIZE=16;const ts=a.lW.from([77,88]),ns="The transaction sender address and multisig preimage do not match.";function rs(e,t){if("undefined"===typeof e.from){const n=S(t);e.from=L(n.publicKey)}const n=ee(e);return{txID:n.txID().toString(),blob:n.signTxn(t)}}function is(e,t){return new te(e).signBid(t)}function os(e,t){return A(a.lW.from(b(ts,e)),t)}function ss(e,t,n){return _(a.lW.from(b(ts,e)),t,N(n).publicKey)}function as(e){return new Uint8Array(q(e))}function cs(e){return z(e)}const us=new Error(ns),ls=new Error(re);var ds=o},78688:function(e,t,n){"use strict";const r=n(79742),i=n(80645),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},9669:function(e,t,n){e.exports=n(51609)},55448:function(e,t,n){"use strict";var r=n(64867),i=n(36026),o=n(4372),s=n(15327),a=n(94097),c=n(84109),u=n(67985),l=n(77874),d=n(82648),f=n(60644),h=n(90205);e.exports=function(e){return new Promise((function(t,n){var p,g=e.data,m=e.headers,b=e.responseType;function y(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}r.isFormData(g)&&r.isStandardBrowserEnv()&&delete m["Content-Type"];var v=new XMLHttpRequest;if(e.auth){var w=e.auth.username||"",x=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";m.Authorization="Basic "+btoa(w+":"+x)}var S=a(e.baseURL,e.url);function A(){if(v){var r="getAllResponseHeaders"in v?c(v.getAllResponseHeaders()):null,o={data:b&&"text"!==b&&"json"!==b?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:r,config:e,request:v};i((function(e){t(e),y()}),(function(e){n(e),y()}),o),v=null}}if(v.open(e.method.toUpperCase(),s(S,e.params,e.paramsSerializer),!0),v.timeout=e.timeout,"onloadend"in v?v.onloadend=A:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(A)},v.onabort=function(){v&&(n(new d("Request aborted",d.ECONNABORTED,e,v)),v=null)},v.onerror=function(){n(new d("Network Error",d.ERR_NETWORK,e,v,v)),v=null},v.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new d(t,r.clarifyTimeoutError?d.ETIMEDOUT:d.ECONNABORTED,e,v)),v=null},r.isStandardBrowserEnv()){var E=(e.withCredentials||u(S))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;E&&(m[e.xsrfHeaderName]=E)}"setRequestHeader"in v&&r.forEach(m,(function(e,t){"undefined"===typeof g&&"content-type"===t.toLowerCase()?delete m[t]:v.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(v.withCredentials=!!e.withCredentials),b&&"json"!==b&&(v.responseType=e.responseType),"function"===typeof e.onDownloadProgress&&v.addEventListener("progress",e.onDownloadProgress),"function"===typeof e.onUploadProgress&&v.upload&&v.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(p=function(e){v&&(n(!e||e&&e.type?new f:e),v.abort(),v=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p))),g||(g=null);var _=h(S);_&&-1===["http","https","file"].indexOf(_)?n(new d("Unsupported protocol "+_+":",d.ERR_BAD_REQUEST,e)):v.send(g)}))}},51609:function(e,t,n){"use strict";var r=n(64867),i=n(91849),o=n(30321),s=n(47185);var a=function e(t){var n=new o(t),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(45546));a.Axios=o,a.CanceledError=n(60644),a.CancelToken=n(14972),a.isCancel=n(26502),a.VERSION=n(97288).version,a.toFormData=n(47675),a.AxiosError=n(82648),a.Cancel=a.CanceledError,a.all=function(e){return Promise.all(e)},a.spread=n(8713),a.isAxiosError=n(16268),e.exports=a,e.exports.default=a},14972:function(e,t,n){"use strict";var r=n(60644);function i(e){if("function"!==typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(e){d.headers[e]={}})),i.forEach(["post","put","patch"],(function(e){d.headers[e]=i.merge(u)})),e.exports=d},77874:function(e){"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},97288:function(e){e.exports={version:"0.27.2"}},91849:function(e){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},90205:function(e){"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},8713:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},47675:function(e,t,n){"use strict";var r=n(48764).Buffer,i=n(64867);e.exports=function(e,t){t=t||new FormData;var n=[];function o(e){return null===e?"":i.isDate(e)?e.toISOString():i.isArrayBuffer(e)||i.isTypedArray(e)?"function"===typeof Blob?new Blob([e]):r.from(e):e}return function e(r,s){if(i.isPlainObject(r)||i.isArray(r)){if(-1!==n.indexOf(r))throw Error("Circular reference detected in "+s);n.push(r),i.forEach(r,(function(n,r){if(!i.isUndefined(n)){var a,c=s?s+"."+r:r;if(n&&!s&&"object"===typeof n)if(i.endsWith(r,"{}"))n=JSON.stringify(n);else if(i.endsWith(r,"[]")&&(a=i.toArray(n)))return void a.forEach((function(e){!i.isUndefined(e)&&t.append(c,o(e))}));e(n,c)}})),n.pop()}else t.append(s,o(r))}(e),t}},54875:function(e,t,n){"use strict";var r=n(97288).version,i=n(82648),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var s={};o.transitional=function(e,t,n){function o(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new i(o(r," has been removed"+(t?" in "+t:"")),i.ERR_DEPRECATED);return t&&!s[r]&&(s[r]=!0,console.warn(o(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={assertOptions:function(e,t,n){if("object"!==typeof e)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),o=r.length;o-- >0;){var s=r[o],a=t[s];if(a){var c=e[s],u=void 0===c||a(c,s,e);if(!0!==u)throw new i("option "+s+" must be "+u,i.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new i("Unknown option "+s,i.ERR_BAD_OPTION)}},validators:o}},64867:function(e,t,n){"use strict";var r,i=n(91849),o=Object.prototype.toString,s=(r=Object.create(null),function(e){var t=o.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return s(t)===e}}function c(e){return Array.isArray(e)}function u(e){return"undefined"===typeof e}var l=a("ArrayBuffer");function d(e){return null!==e&&"object"===typeof e}function f(e){if("object"!==s(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var h=a("Date"),p=a("File"),g=a("Blob"),m=a("FileList");function b(e){return"[object Function]"===o.call(e)}var y=a("URLSearchParams");function v(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==typeof e&&(e=[e]),c(e))for(var n=0,r=e.length;n0;)s[o=r[i]]||(t[o]=e[o],s[o]=!0);e=Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:a,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;var t=e.length;if(u(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},isTypedArray:x,isFileList:m}},79742:function(e,t){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,o=c(e),s=o[0],a=o[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,d=a>0?s-4:s;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=16383,a=0,c=r-i;ac?c:a+s));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,r){for(var i,o,s=[],a=t;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},92882:function(e){"use strict";for(var t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={},r=0;r>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function s(e){for(var t=1,n=0;n126)return"Invalid prefix ("+e+")";t=o(t)^r>>5}for(t=o(t),n=0;nt)return"Exceeds length limit";var r=e.toLowerCase(),i=e.toUpperCase();if(e!==r&&e!==i)return"Mixed-case string "+e;var a=(e=r).lastIndexOf("1");if(-1===a)return"No separator character for "+e;if(0===a)return"Missing prefix for "+e;var c=e.slice(0,a),u=e.slice(a+1);if(u.length<6)return"Data too short";var l=s(c);if("string"===typeof l)return l;for(var d=[],f=0;f=u.length||d.push(p)}return 1!==l?"Invalid checksum for "+e:{prefix:c,words:d}}function c(e,t,n,r){for(var i=0,o=0,s=(1<=n;)o-=n,a.push(i>>o&s);if(r)o>0&&a.push(i<=t)return"Excess padding";if(i<r)throw new TypeError("Exceeds length limit");var i=s(e=e.toLowerCase());if("string"===typeof i)throw new Error(i);for(var a=e+"1",c=0;c>5!==0)throw new Error("Non 5-bit word");i=o(i)^u,a+=t.charAt(u)}for(c=0;c<6;++c)i=o(i);for(i^=1,c=0;c<6;++c){a+=t.charAt(i>>5*(5-c)&31)}return a},toWordsUnsafe:function(e){var t=c(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=c(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=c(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=c(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}}},44431:function(e,t,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",d=1e14,f=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,m=1e9;function b(e){var t=0|e;return e>0||e===t?t:t-1}function y(e){for(var t,n,r=1,i=e.length,o=e[0]+"";ru^n?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^n?1:-1;return c==u?0:c>u^n?1:-1}function w(e,t,n,r){if(en||e!==c(e))throw Error(u+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function x(e){var t=e.c.length-1;return b(e.e/f)==t&&e.c[t]%2!=0}function S(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function A(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else tM?b.c=b.e=null:e.e=10;d/=10,u++);return void(u>M?b.c=b.e=null:(b.e=u,b.c=[e]))}m=String(e)}else{if(!s.test(m=String(e)))return i(b,m,p);b.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(d=m.search(/e/i))>0?(u<0&&(u=d),u+=+m.slice(d+1),m=m.substring(0,d)):u<0&&(u=m.length)}else{if(w(t,2,B.length,"Base"),10==t&&L)return V(b=new D(e),_+b.e+1,C);if(m=String(e),p="number"==typeof e){if(0*e!=0)return i(b,m,p,t);if(b.s=1/e<0?(m=m.slice(1),-1):1,D.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else b.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(n=B.slice(0,t),u=d=0,g=m.length;du){u=g;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,d=-1,u=0;continue}return i(b,String(e),p,t)}p=!1,(u=(m=r(m,t,10,b.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(d=0;48===m.charCodeAt(d);d++);for(g=m.length;48===m.charCodeAt(--g););if(m=m.slice(d,++g)){if(g-=d,p&&D.DEBUG&&g>15&&(e>h||e!==c(e)))throw Error(l+b.s*e);if((u=u-d-1)>M)b.c=b.e=null;else if(u=k)?S(c,s):A(c,s,"0");else if(o=(e=V(new D(e),t,n)).e,a=(c=y(e.c)).length,1==r||2==r&&(t<=o||o<=I)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function j(e,t){for(var n,r=1,i=new D(e[0]);r=10;i/=10,r++);return(n=r+n*f-1)>M?e.c=e.e=null:n=10;u/=10,i++);if((o=t-i)<0)o+=f,s=t,g=(l=m[h=0])/b[i-s-1]%10|0;else if((h=a((o+1)/f))>=m.length){if(!r)break e;for(;m.length<=h;m.push(0));l=g=0,i=1,s=(o%=f)-f+1}else{for(l=u=m[h],i=1;u>=10;u/=10,i++);g=(s=(o%=f)-f+i)<0?0:l/b[i-s-1]%10|0}if(r=r||t<0||null!=m[h+1]||(s<0?l:l%b[i-s-1]),r=n<4?(g||r)&&(0==n||n==(e.s<0?3:2)):g>5||5==g&&(4==n||r||6==n&&(o>0?s>0?l/b[i-s]:0:m[h-1])%10&1||n==(e.s<0?8:7)),t<1||!m[0])return m.length=0,r?(t-=e.e+1,m[0]=b[(f-t%f)%f],e.e=-t||0):m[0]=e.e=0,e;if(0==o?(m.length=h,u=1,h--):(m.length=h+1,u=b[f-o],m[h]=s>0?c(l/b[i-s]%b[s])*u:0),r)for(;;){if(0==h){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,m[0]==d&&(m[0]=1));break}if(m[h]+=u,m[h]!=d)break;m[h--]=0,u=1}for(o=m.length;0===m[--o];m.pop());}e.e>M?e.c=e.e=null:e.e=k?S(t,n):A(t,n,"0"),e.s<0?"-"+t:t)}return D.clone=e,D.ROUND_UP=0,D.ROUND_DOWN=1,D.ROUND_CEIL=2,D.ROUND_FLOOR=3,D.ROUND_HALF_UP=4,D.ROUND_HALF_DOWN=5,D.ROUND_HALF_EVEN=6,D.ROUND_HALF_CEIL=7,D.ROUND_HALF_FLOOR=8,D.EUCLID=9,D.config=D.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(w(n=e[t],0,m,t),_=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(n=e[t],0,8,t),C=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(w(n[0],-m,0,t),w(n[1],0,m,t),I=n[0],k=n[1]):(w(n,-m,m,t),I=-(k=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)w(n[0],-m,-1,t),w(n[1],1,m,t),T=n[0],M=n[1];else{if(w(n,-m,m,t),!n)throw Error(u+t+" cannot be zero: "+n);T=-(M=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(u+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!n,Error(u+"crypto unavailable");P=n}else P=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(w(n=e[t],0,9,t),O=n),e.hasOwnProperty(t="POW_PRECISION")&&(w(n=e[t],0,m,t),R=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(u+t+" not an object: "+n);N=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(u+t+" invalid: "+n);L="0123456789"==n.slice(0,10),B=n}}return{DECIMAL_PLACES:_,ROUNDING_MODE:C,EXPONENTIAL_AT:[I,k],RANGE:[T,M],CRYPTO:P,MODULO_MODE:O,POW_PRECISION:R,FORMAT:N,ALPHABET:B}},D.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!D.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-m&&i<=m&&i===c(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%f)<1&&(t+=f),String(r[0]).length==t){for(t=0;t=d||n!==c(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+e)},D.maximum=D.max=function(){return j(arguments,o.lt)},D.minimum=D.min=function(){return j(arguments,o.gt)},D.random=function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return c(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var n,r,i,o,s,l=0,d=[],h=new D(E);if(null==e?e=_:w(e,0,m),o=a(e/f),P)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(o*=2));l>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(d.push(s%1e14),l+=2);l=o/2}else{if(!crypto.randomBytes)throw P=!1,Error(u+"crypto unavailable");for(n=crypto.randomBytes(o*=7);l=9e15?crypto.randomBytes(7).copy(n,l):(d.push(s%1e14),l+=7);l=o/7}if(!P)for(;l=10;s/=10,l++);ln-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var c,u,l,d,f,h,p,g,m=r.indexOf("."),b=_,v=C;for(m>=0&&(d=R,R=0,r=r.replace(".",""),h=(g=new D(i)).pow(r.length-m),R=d,g.c=t(A(y(h.c),h.e,"0"),10,o,e),g.e=g.c.length),l=d=(p=t(r,i,o,a?(c=B,e):(c=e,B))).length;0==p[--d];p.pop());if(!p[0])return c.charAt(0);if(m<0?--l:(h.c=p,h.e=l,h.s=s,p=(h=n(h,g,b,v,o)).c,f=h.r,l=h.e),m=p[u=l+b+1],d=o/2,f=f||u<0||null!=p[u+1],f=v<4?(null!=m||f)&&(0==v||v==(h.s<0?3:2)):m>d||m==d&&(4==v||f||6==v&&1&p[u-1]||v==(h.s<0?8:7)),u<1||!p[0])r=f?A(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(p.length=u,f)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(d=p.length;!p[--d];);for(m=0,r="";m<=d;r+=c.charAt(p[m++]));r=A(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,i,o,s,a=0,c=e.length,u=t%g,l=t/g|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%g)+(r=l*o+(s=e[c]/g|0)*u)%g*g+a)/n|0)+(r/g|0)+l*s,e[c]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,o,s,a){var u,l,h,p,g,m,y,v,w,x,S,A,E,_,C,I,k,T=r.s==i.s?1:-1,M=r.c,P=i.c;if(!M||!M[0]||!P||!P[0])return new D(r.s&&i.s&&(M?!P||M[0]!=P[0]:P)?M&&0==M[0]||!P?0*T:T/0:NaN);for(w=(v=new D(T)).c=[],T=o+(l=r.e-i.e)+1,a||(a=d,l=b(r.e/f)-b(i.e/f),T=T/f|0),h=0;P[h]==(M[h]||0);h++);if(P[h]>(M[h]||0)&&l--,T<0)w.push(1),p=!0;else{for(_=M.length,I=P.length,h=0,T+=2,(g=c(a/(P[0]+1)))>1&&(P=e(P,g,a),M=e(M,g,a),I=P.length,_=M.length),E=I,S=(x=M.slice(0,I)).length;S=a/2&&C++;do{if(g=0,(u=t(P,x,I,S))<0){if(A=x[0],I!=S&&(A=A*a+(x[1]||0)),(g=c(A/C))>1)for(g>=a&&(g=a-1),y=(m=e(P,g,a)).length,S=x.length;1==t(m,x,y,S);)g--,n(m,I=10;T/=10,h++);V(v,o+(v.e=h+l*f-1)+1,s,p)}else v.e=l,v.r=+p;return v}}(),i=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,a,c){var l,d=a?s:s.replace(i,"");if(r.test(d))o.s=isNaN(d)?null:d<0?-1:1;else{if(!a&&(d=d.replace(e,(function(e,t,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=l?e:t})),c&&(l=c,d=d.replace(t,"$1").replace(n,"0.$1")),s!=d))return new D(d,l);if(D.DEBUG)throw Error(u+"Not a"+(c?" base "+c:"")+" number: "+s);o.s=null}o.c=o.e=null}}(),o.absoluteValue=o.abs=function(){var e=new D(this);return e.s<0&&(e.s=1),e},o.comparedTo=function(e,t){return v(this,new D(e,t))},o.decimalPlaces=o.dp=function(e,t){var n,r,i,o=this;if(null!=e)return w(e,0,m),null==t?t=C:w(t,0,8),V(new D(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-b(this.e/f))*f,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},o.dividedBy=o.div=function(e,t){return n(this,new D(e,t),_,C)},o.dividedToIntegerBy=o.idiv=function(e,t){return n(this,new D(e,t),0,1)},o.exponentiatedBy=o.pow=function(e,t){var n,r,i,o,s,l,d,h,p=this;if((e=new D(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+q(e));if(null!=t&&(t=new D(t)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new D(Math.pow(+q(p),s?2-x(e):+q(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new D(NaN);(r=!l&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&x(e)?-0:0,p.e>-1&&(o=1/o),new D(l?1/o:o);R&&(o=a(R/f+2))}for(s?(n=new D(.5),l&&(e.s=1),d=x(e)):d=(i=Math.abs(+q(e)))%2,h=new D(E);;){if(d){if(!(h=h.times(p)).c)break;o?h.c.length>o&&(h.c.length=o):r&&(h=h.mod(t))}if(i){if(0===(i=c(i/2)))break;d=i%2}else if(V(e=e.times(n),e.e+1,1),e.e>14)d=x(e);else{if(0===(i=+q(e)))break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?h:(l&&(h=E.div(h)),t?h.mod(t):o?V(h,R,C,undefined):h)},o.integerValue=function(e){var t=new D(this);return null==e?e=C:w(e,0,8),V(t,t.e+1,e)},o.isEqualTo=o.eq=function(e,t){return 0===v(this,new D(e,t))},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(e,t){return v(this,new D(e,t))>0},o.isGreaterThanOrEqualTo=o.gte=function(e,t){return 1===(t=v(this,new D(e,t)))||0===t},o.isInteger=function(){return!!this.c&&b(this.e/f)>this.c.length-2},o.isLessThan=o.lt=function(e,t){return v(this,new D(e,t))<0},o.isLessThanOrEqualTo=o.lte=function(e,t){return-1===(t=v(this,new D(e,t)))||0===t},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&&0==this.c[0]},o.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(t=(e=new D(e,t)).s,!a||!t)return new D(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/f,u=e.e/f,l=s.c,h=e.c;if(!c||!u){if(!l||!h)return l?(e.s=-t,e):new D(h?s:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new D(l[0]?s:3==C?-0:0)}if(c=b(c),u=b(u),l=l.slice(),a=c-u){for((o=a<0)?(a=-a,i=l):(u=c,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=l.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;l[n++]=0);for(t=d-1;r>a;){if(l[--r]=0;){for(n=0,p=A[i]%w,m=A[i]/w|0,o=i+(s=c);o>i;)n=((u=p*(u=S[--s]%w)+(a=m*u+(l=S[s]/w|0)*p)%w*w+y[o]+n)/v|0)+(a/w|0)+m*l,y[o--]=u%v;y[o]=n}return n?++r:y.splice(0,1),F(e,y,r)},o.negated=function(){var e=new D(this);return e.s=-e.s||null,e},o.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new D(e,t)).s,!i||!t)return new D(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/f,s=e.e/f,a=r.c,c=e.c;if(!o||!s){if(!a||!c)return new D(i/0);if(!a[0]||!c[0])return c[0]?e:new D(a[0]?r:0*i)}if(o=b(o),s=b(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=c):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(t=c.length)<0&&(n=c,c=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/d|0,a[t]=d===a[t]?0:a[t]%d;return i&&(a=[i].concat(a),++s),F(e,a,s)},o.precision=o.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return w(e,1,m),null==t?t=C:w(t,0,8),V(new D(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*f+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},o.shiftedBy=function(e){return w(e,-9007199254740991,h),this.times("1e"+e)},o.squareRoot=o.sqrt=function(){var e,t,r,i,o,s=this,a=s.c,c=s.s,u=s.e,l=_+4,d=new D("0.5");if(1!==c||!a||!a[0])return new D(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+q(s)))||c==1/0?(((t=y(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=b((u+1)/2)-(u<0||u%2),r=new D(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new D(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(o=r,r=d.times(o.plus(n(s,o,l,1))),y(o.c).slice(0,c)===(t=y(r.c)).slice(0,c)){if(r.e0&&g>0){for(o=g%a||a,d=p.substr(0,o);o0&&(d+=l+p.slice(o)),h&&(d="-"+d)}r=f?d+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):d}return(n.prefix||"")+r+(n.suffix||"")},o.toFraction=function(e){var t,r,i,o,s,a,c,l,d,h,g,m,b=this,v=b.c;if(null!=e&&(!(c=new D(e)).isInteger()&&(c.c||1!==c.s)||c.lt(E)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+q(c));if(!v)return new D(b);for(t=new D(E),d=r=new D(E),i=l=new D(E),m=y(v),s=t.e=m.length-b.e-1,t.c[0]=p[(a=s%f)<0?f+a:a],e=!e||c.comparedTo(t)>0?s>0?t:d:c,a=M,M=1/0,c=new D(m),l.c[0]=0;h=n(c,t,0,1),1!=(o=r.plus(h.times(i))).comparedTo(e);)r=i,i=o,d=l.plus(h.times(o=d)),l=o,t=c.minus(h.times(o=t)),c=o;return o=n(e.minus(r),i,0,1),l=l.plus(o.times(d)),r=r.plus(o.times(i)),l.s=d.s=b.s,g=n(d,i,s*=2,C).minus(b).abs().comparedTo(n(l,r,s,C).minus(b).abs())<1?[d,i]:[l,r],M=a,g},o.toNumber=function(){return+q(this)},o.toPrecision=function(e,t){return null!=e&&w(e,1,m),U(this,e,t,2)},o.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=I||o>=k?S(y(n.c),o):A(y(n.c),o,"0"):10===e&&L?t=A(y((n=V(new D(n),_+o+1,C)).c),n.e,"0"):(w(e,2,B.length,"Base"),t=r(A(y(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},o.valueOf=o.toJSON=function(){return q(this)},o._isBigNumber=!0,null!=t&&D.set(t),D}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(t,n,t,e))||(e.exports=r)}()},66053:function(e,t,n){function r(e){if(!r.supported)return null;var t,o=e&&e.imports,s=(t="AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL","function"===typeof atob?new Uint8Array(atob(t).split("").map(i)):new(n(48764).Buffer)(t,"base64")),a=null,c={buffer:s,memory:null,exports:null,realloc:function(e){c.exports.memory.grow(Math.ceil(Math.abs(e-c.memory.length)/65536)),c.memory=new Uint8Array(c.exports.memory.buffer)},onload:u};return u((function(){})),c;function u(t){if(c.exports)return t();if(a)a.then(t.bind(null,null)).catch(t);else{try{if(e&&e.async)throw new Error("async");l({instance:new WebAssembly.Instance(new WebAssembly.Module(s),o)})}catch(n){a=WebAssembly.instantiate(s,o).then(l)}u(t)}}function l(e){c.exports=e.instance.exports,c.memory=c.exports.memory&&c.exports.memory.buffer&&new Uint8Array(c.exports.memory.buffer)}}function i(e){return e.charCodeAt(0)}e.exports=r,r.supported="undefined"!==typeof WebAssembly},67060:function(e,t,n){var r=n(29204),i=n(66053)(),o=64,s=[];e.exports=h;var a=e.exports.BYTES_MIN=16,c=e.exports.BYTES_MAX=64,u=(e.exports.BYTES=32,e.exports.KEYBYTES_MIN=16),l=e.exports.KEYBYTES_MAX=64,d=(e.exports.KEYBYTES=32,e.exports.SALTBYTES=16),f=e.exports.PERSONALBYTES=16;function h(e,t,n,p,g){if(!(this instanceof h))return new h(e,t,n,p,g);if(!i||!i.exports)throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");e||(e=32),!0!==g&&(r(e>=a,"digestLength must be at least "+a+", was given "+e),r(e<=c,"digestLength must be at most "+c+", was given "+e),null!=t&&r(t.length>=u,"key must be at least "+u+", was given "+t.length),null!=t&&r(t.length<=l,"key must be at least "+l+", was given "+t.length),null!=n&&r(n.length===d,"salt must be exactly "+d+", was given "+n.length),null!=p&&r(p.length===f,"personal must be exactly "+f+", was given "+p.length)),s.length||(s.push(o),o+=216),this.digestLength=e,this.finalized=!1,this.pointer=s.pop(),i.memory.fill(0,0,64),i.memory[0]=this.digestLength,i.memory[1]=t?t.length:0,i.memory[2]=1,i.memory[3]=1,n&&i.memory.set(n,32),p&&i.memory.set(p,48),this.pointer+216>i.memory.length&&i.realloc(this.pointer+216),i.exports.blake2b_init(this.pointer,this.digestLength),t&&(this.update(t),i.memory.fill(0,o,o+t.length),i.memory[this.pointer+200]=128)}function p(){}function g(e){return e<16?"0"+e.toString(16):e.toString(16)}h.prototype.update=function(e){return r(!1===this.finalized,"Hash instance finalized"),r(e,"input must be TypedArray or Buffer"),o+e.length>i.memory.length&&i.realloc(o+e.length),i.memory.set(e,o),i.exports.blake2b_update(this.pointer,o,o+e.length),this},h.prototype.digest=function(e){if(r(!1===this.finalized,"Hash instance finalized"),this.finalized=!0,s.push(this.pointer),i.exports.blake2b_final(this.pointer),!e||"binary"===e)return i.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if("hex"===e)return function(e,t,n){for(var r="",i=0;i=this.digestLength,"input must be TypedArray or Buffer");for(var t=0;t=4294967296&&i++,e[t]=r,e[t+1]=i}function s(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function a(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function c(e,t,n,r,i,a){var c=f[i],u=f[i+1],l=f[a],h=f[a+1];o(d,e,t),s(d,e,c,u);var p=d[r]^d[e],g=d[r+1]^d[e+1];d[r]=g,d[r+1]=p,o(d,n,r),p=d[t]^d[n],g=d[t+1]^d[n+1],d[t]=p>>>24^g<<8,d[t+1]=g>>>24^p<<8,o(d,e,t),s(d,e,l,h),p=d[r]^d[e],g=d[r+1]^d[e+1],d[r]=p>>>16^g<<16,d[r+1]=g>>>16^p<<16,o(d,n,r),p=d[t]^d[n],g=d[t+1]^d[n+1],d[t]=g>>>31^p<<1,d[t+1]=p>>>31^g<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),l=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),d=new Uint32Array(32),f=new Uint32Array(32);function h(e,t){var n=0;for(n=0;n<16;n++)d[n]=e.h[n],d[n+16]=u[n];for(d[24]=d[24]^e.t,d[25]=d[25]^e.t/4294967296,t&&(d[28]=~d[28],d[29]=~d[29]),n=0;n<32;n++)f[n]=a(e.b,4*n);for(n=0;n<12;n++)c(0,8,16,24,l[16*n+0],l[16*n+1]),c(2,10,18,26,l[16*n+2],l[16*n+3]),c(4,12,20,28,l[16*n+4],l[16*n+5]),c(6,14,22,30,l[16*n+6],l[16*n+7]),c(0,10,20,30,l[16*n+8],l[16*n+9]),c(2,12,22,24,l[16*n+10],l[16*n+11]),c(4,14,16,26,l[16*n+12],l[16*n+13]),c(6,8,18,28,l[16*n+14],l[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^d[n]^d[n+16]}var p=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function g(e,t,n,r){p.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=e,p[0]=e,t&&(p[1]=t.length),p[2]=1,p[3]=1,n&&p.set(n,32),r&&p.set(r,48);for(var i=0;i<16;i++)this.h[i]=u[i]^a(p,4*i);t&&(m(this,t),this.c=128)}function m(e,t){for(var n=0;n=this.outlen,"out must have at least outlen bytes of space"),function(e,t){e.t+=e.c;for(;e.c<128;)e.b[e.c++]=0;h(e,!0);for(var n=0;n>2]>>8*(3&n)}(this,t),"hex"===e?function(e){for(var t="",n=0;n=v,"outlen must be at least "+v+", was given "+e),r(e<=w,"outlen must be at most "+w+", was given "+e),null!=t&&r(t.length>=x,"key must be at least "+x+", was given "+t.length),null!=t&&r(t.length<=S,"key must be at most "+S+", was given "+t.length),null!=n&&r(n.length===A,"salt must be exactly "+A+", was given "+n.length),null!=i&&r(i.length===E,"personal must be exactly "+E+", was given "+i.length)),new y(e,t,n,i)},e.exports.ready=function(e){i.ready((function(){e()}))},e.exports.WASM_SUPPORTED=i.SUPPORTED,e.exports.WASM_LOADED=!1;var v=e.exports.BYTES_MIN=16,w=e.exports.BYTES_MAX=64,x=(e.exports.BYTES=32,e.exports.KEYBYTES_MIN=16),S=e.exports.KEYBYTES_MAX=64,A=(e.exports.KEYBYTES=32,e.exports.SALTBYTES=16),E=e.exports.PERSONALBYTES=16;i.ready((function(t){t||(e.exports.WASM_LOADED=!0,y=i)}))},13550:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:n(46601).Buffer}catch(_){}function a(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"===typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,c=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?l[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=d[e],h=f[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?g+n:l[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r("undefined"!==typeof s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,u=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function g(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(p=h),o.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?p(this,e,t):r<63?h(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):g(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new A(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(v,y),v.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return b[e]=t,t},A.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},A.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new E(e)},i(E,A),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},51206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,c=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]1?i-1:0),s=1;s0){var s=Object.keys(n),c=a.default.find(s,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var d=this.satisfies(n[l]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=a.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},29931:function(e,t,n){var r;function i(e){this.rand=e}if(e.exports=function(e){return r||(r=new i(null)),r.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;ns)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|g(e,t),r=a(n),i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){var t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);var i=function(e){if(c.isBuffer(e)){var t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||q(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){for(var t=e.length<0?0:0|p(e.length),n=a(t),r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(i)return r?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){for(var d=!0,f=0;fi&&(r=i):r=i;var o=t.length;r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(l=u);break;case 2:128===(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128===(192&o)&&128===(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128===(192&o)&&128===(192&s)&&128===(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,d=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=d}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rr.length?c.from(o).copy(r,i):Uint8Array.prototype.set.call(r,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i)}i+=o.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(V(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n),d=0;d>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function k(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,o){return t=+t,n>>>=0,o||N(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,o){return t=+t,n>>>=0,o||N(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e],i=1,o=0;++o>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function j(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function F(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!==e}var z=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},21924:function(e,t,n){"use strict";var r=n(40210),i=n(55559),o=i(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"===typeof n&&o(e,".prototype.")>-1?i(n):n}},55559:function(e,t,n){"use strict";var r=n(58612),i=n(40210),o=i("%Function.prototype.apply%"),s=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||r.call(s,o),c=i("%Object.getOwnPropertyDescriptor%",!0),u=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(u)try{u({},"a",{value:1})}catch(f){u=null}e.exports=function(e){var t=a(r,s,arguments);if(c&&u){var n=c(t,"length");n.configurable&&u(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var d=function(){return a(r,o,arguments)};u?u(e.exports,"apply",{value:d}):e.exports.apply=d},94184:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t-1};function u(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function x(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];S.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(_){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:x(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new S(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=v,e.Response=S),t.Headers=f,t.Request=v,t.Response=S,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},44020:function(e){"use strict";var t="%[a-f0-9]{2}",n=new RegExp(t,"gi"),r=new RegExp("("+t+")+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(o){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n),r=1;r0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"===typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"===typeof c)r(c,this,t);else{var u=c.length,l=p(c,u);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return f(this,e,!0)},o.prototype.rawListeners=function(e){return f(this,e,!1)},o.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},58875:function(e,t,n){var r;!function(){"use strict";var i=!("undefined"===typeof window||!window.document||!window.document.createElement),o={canUseDOM:i,canUseWorkers:"undefined"!==typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen};void 0===(r=function(){return o}.call(t,n,t,e))||(e.exports=r)}()},92806:function(e){"use strict";e.exports=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o1&&"boolean"!==typeof t)throw new s('"allowMissing" argument must be a boolean');var n=C(e),r=n.length>0?n[0]:"",o=I("%"+r+"%",t),a=o.name,u=o.value,l=!1,d=o.alias;d&&(r=d[0],x(n,w([0,1],d)));for(var f=1,h=!0;f=n.length){var y=c(u,p);u=(h=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:u[p]}else h=v(u,p),u=u[p];h&&!l&&(g[a]=u)}}return u}},41405:function(e,t,n){"use strict";var r="undefined"!==typeof Symbol&&Symbol,i=n(55419);e.exports=function(){return"function"===typeof r&&("function"===typeof Symbol&&("symbol"===typeof r("foo")&&("symbol"===typeof Symbol("bar")&&i())))}},55419:function(e){"use strict";e.exports=function(){if("function"!==typeof Symbol||"function"!==typeof Object.getOwnPropertySymbols)return!1;if("symbol"===typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"===typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"===typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"===typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"===typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},96410:function(e,t,n){"use strict";var r=n(55419);e.exports=function(){return r()&&!!Symbol.toStringTag}},17642:function(e,t,n){"use strict";var r=n(58612);e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},33715:function(e,t,n){var r=t;r.utils=n(26436),r.common=n(95772),r.sha=n(89041),r.ripemd=n(12949),r.hmac=n(52344),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},95772:function(e,t,n){"use strict";var r=n(26436),i=n(79746);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=r.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=r.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},t.g1_256=function(e){return r(e,17)^r(e,19)^e>>>10}},26436:function(e,t,n){"use strict";var r=n(79746),i=n(35717);function o(e,t){return 55296===(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320===(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"===typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(e="0"+e),i=0;i>6|192,n[r++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},t.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},t.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},t.sum64_lo=function(e,t,n,r){return t+r>>>0},t.sum64_4_hi=function(e,t,n,r,i,o,s,a){var c=0,u=t;return c+=(u=u+r>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,n,r,i,o,s,a){return t+r+o+a>>>0},t.sum64_5_hi=function(e,t,n,r,i,o,s,a,c,u){var l=0,d=t;return l+=(d=d+r>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,n,r,i,o,s,a,c,u){return t+r+o+a+u>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},89090:function(e,t,n){var r,i=n(34155);!function(){"use strict";var t="object"===typeof window?window:{};!t.HI_BASE32_NO_NODE_JS&&"object"===typeof i&&i.versions&&i.versions.node&&(t=n.g);var o=!t.HI_BASE32_NO_COMMON_JS&&e.exports,s=n.amdO,a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),c={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},u=[0,0,0,0,0,0,0,0],l=function(e,t){t.length>10&&(t="..."+t.substr(-10));var n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},d=function(e){if(""===e)return[];if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,n,r,i,o,s,a,u,l=[],d=0,f=(e=e.replace(/=/g,"")).length,h=0,p=f>>3<<3;h>>2),l[d++]=255&(n<<6|r<<1|i>>>4),l[d++]=255&(i<<4|o>>>1),l[d++]=255&(o<<7|s<<2|a>>>3),l[d++]=255&(a<<5|u);var g=f-p;return 2===g?(t=c[e.charAt(h++)],n=c[e.charAt(h++)],l[d++]=255&(t<<3|n>>>2)):4===g?(t=c[e.charAt(h++)],n=c[e.charAt(h++)],r=c[e.charAt(h++)],i=c[e.charAt(h++)],l[d++]=255&(t<<3|n>>>2),l[d++]=255&(n<<6|r<<1|i>>>4)):5===g?(t=c[e.charAt(h++)],n=c[e.charAt(h++)],r=c[e.charAt(h++)],i=c[e.charAt(h++)],o=c[e.charAt(h++)],l[d++]=255&(t<<3|n>>>2),l[d++]=255&(n<<6|r<<1|i>>>4),l[d++]=255&(i<<4|o>>>1)):7===g&&(t=c[e.charAt(h++)],n=c[e.charAt(h++)],r=c[e.charAt(h++)],i=c[e.charAt(h++)],o=c[e.charAt(h++)],s=c[e.charAt(h++)],a=c[e.charAt(h++)],l[d++]=255&(t<<3|n>>>2),l[d++]=255&(n<<6|r<<1|i>>>4),l[d++]=255&(i<<4|o>>>1),l[d++]=255&(o<<7|s<<2|a>>>3)),l},f=function(e,t){if(!t)return function(e){for(var t,n,r="",i=e.length,o=0,s=0;o191&&t<=223?(n=31&t,s=1):t<=239?(n=15&t,s=2):t<=247?(n=7&t,s=3):l(o,r);for(var a=0;a191)&&l(o,r),n<<=6,n+=63&t;n>=55296&&n<=57343&&l(o,r),n>1114111&&l(o,r),n<=65535?r+=String.fromCharCode(n):(n-=65536,r+=String.fromCharCode(55296+(n>>10)),r+=String.fromCharCode(56320+(1023&n)))}return r}(d(e));if(""===e)return"";if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,i,o,s,a,u,f,h="",p=e.indexOf("=");-1===p&&(p=e.length);for(var g=0,m=p>>3<<3;g>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|u>>>3))+String.fromCharCode(255&(u<<5|f));var b=p-m;return 2===b?(n=c[e.charAt(g++)],r=c[e.charAt(g++)],h+=String.fromCharCode(255&(n<<3|r>>>2))):4===b?(n=c[e.charAt(g++)],r=c[e.charAt(g++)],i=c[e.charAt(g++)],o=c[e.charAt(g++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))):5===b?(n=c[e.charAt(g++)],r=c[e.charAt(g++)],i=c[e.charAt(g++)],o=c[e.charAt(g++)],s=c[e.charAt(g++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===b&&(n=c[e.charAt(g++)],r=c[e.charAt(g++)],i=c[e.charAt(g++)],o=c[e.charAt(g++)],s=c[e.charAt(g++)],a=c[e.charAt(g++)],u=c[e.charAt(g++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|u>>>3))),h},h={encode:function(e,t){var n="string"!==typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?function(e){for(var t,n,r,i,o,s="",c=e.length,u=0,l=5*parseInt(c/5);u>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|o>>>5)]+a[31&o];var d=c-l;return 1===d?(t=e[u],s+=a[t>>>3]+a[t<<2&31]+"======"):2===d?(t=e[u++],n=e[u],s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[n<<4&31]+"===="):3===d?(t=e[u++],n=e[u++],r=e[u],s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[r<<1&31]+"==="):4===d&&(t=e[u++],n=e[u++],r=e[u++],i=e[u],s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"="),s}(e):t?function(e){for(var t,n,r,i,o,s="",c=e.length,u=0,l=5*parseInt(c/5);u>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|o>>>5)]+a[31&o];var d=c-l;return 1===d?(t=e.charCodeAt(u),s+=a[t>>>3]+a[t<<2&31]+"======"):2===d?(t=e.charCodeAt(u++),n=e.charCodeAt(u),s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[n<<4&31]+"===="):3===d?(t=e.charCodeAt(u++),n=e.charCodeAt(u++),r=e.charCodeAt(u),s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[r<<1&31]+"==="):4===d&&(t=e.charCodeAt(u++),n=e.charCodeAt(u++),r=e.charCodeAt(u++),i=e.charCodeAt(u),s+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"="),s}(e):function(e){var t,n,r,i,o,s,c,l=!1,d="",f=0,h=0,p=e.length;if(""===e)return d;do{for(u[0]=u[5],u[1]=u[6],u[2]=u[7],c=h;f>6,u[c++]=128|63&s):s<55296||s>=57344?(u[c++]=224|s>>12,u[c++]=128|s>>6&63,u[c++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++f)),u[c++]=240|s>>18,u[c++]=128|s>>12&63,u[c++]=128|s>>6&63,u[c++]=128|63&s);h=c-5,f===p&&++f,f>p&&c<6&&(l=!0),t=u[0],c>4?(n=u[1],r=u[2],i=u[3],o=u[4],d+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|o>>>5)]+a[31&o]):1===c?d+=a[t>>>3]+a[t<<2&31]+"======":2===c?(n=u[1],d+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[n<<4&31]+"===="):3===c?(n=u[1],r=u[2],d+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[r<<1&31]+"==="):(n=u[1],r=u[2],i=u[3],d+=a[t>>>3]+a[31&(t<<2|n>>>6)]+a[n>>>1&31]+a[31&(n<<4|r>>>4)]+a[31&(r<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"=")}while(!l);return d}(e)},decode:f};f.asBytes=d,o?e.exports=h:(t.base32=h,s&&(void 0===(r=function(){return h}.call(h,n,h,e))||(e.exports=r)))}()},2156:function(e,t,n){"use strict";var r=n(33715),i=n(34504),o=n(79746);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),n=i.toArray(e.nonce,e.nonceEnc||"hex"),r=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}e.exports=s,s.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},s.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(r=n,n=t,t=null),n&&(n=i.toArray(n,r||"hex"),this._update(n));for(var o=[];o.length-1};function u(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function x(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];S.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(_){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:x(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new S(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=v,e.Response=S),t.Headers=f,t.Request=v,t.Response=S,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},80645:function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<>1,l=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=u}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<0;e[n+h]=255&s,h+=p,s/=256,u-=8);e[n+h-p]|=128*g}},35717:function(e){"function"===typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},82584:function(e,t,n){"use strict";var r=n(96410)(),i=n(21924)("Object.prototype.toString"),o=function(e){return!(r&&e&&"object"===typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},s=function(e){return!!o(e)||null!==e&&"object"===typeof e&&"number"===typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,e.exports=a?o:s},48662:function(e,t,n){"use strict";var r,i=Object.prototype.toString,o=Function.prototype.toString,s=/^\s*(?:function)?\*/,a=n(96410)(),c=Object.getPrototypeOf;e.exports=function(e){if("function"!==typeof e)return!1;if(s.test(o.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===i.call(e);if(!c)return!1;if("undefined"===typeof r){var t=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}}();r=!!t&&c(t)}return c(e)===r}},85692:function(e,t,n){"use strict";var r=n(49804),i=n(63083),o=n(21924),s=o("Object.prototype.toString"),a=n(96410)(),c="undefined"===typeof globalThis?n.g:globalThis,u=i(),l=o("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n-1}return!!h&&function(e){var t=!1;return r(f,(function(n,r){if(!t)try{t=n.call(e)===r}catch(i){}})),t}(e)}},4501:function(e){e.exports=r,r.strict=i,r.loose=o;var t=Object.prototype.toString,n={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function r(e){return i(e)||o(e)}function i(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return n[t.call(e)]}},91094:function(e,t,n){var r,i=n(34155);!function(){"use strict";var o="input is invalid type",s="object"===typeof window,a=s?window:{};a.JS_SHA3_NO_WINDOW&&(s=!1);var c=!s&&"object"===typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"===typeof i&&i.versions&&i.versions.node?a=n.g:c&&(a=self);var u=!a.JS_SHA3_NO_COMMON_JS&&e.exports,l=n.amdO,d=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,f="0123456789abcdef".split(""),h=[4,1024,262144,67108864],p=[0,8,16,24],g=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=[224,256,384,512],b=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!a.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!d||!a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var w=function(e,t,n){return function(r){return new B(e,t,e).update(r)[n]()}},x=function(e,t,n){return function(r,i){return new B(e,t,i).update(r)[n]()}},S=function(e,t,n){return function(t,r,i,o){return I["cshake"+e].update(t,r,i,o)[n]()}},A=function(e,t,n){return function(t,r,i,o){return I["kmac"+e].update(t,r,i,o)[n]()}},E=function(e,t,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function L(e,t,n){B.call(this,e,t,n)}B.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(o);if(null===e)throw new Error(o);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!d||!ArrayBuffer.isView(e)))throw new Error(o);t=!0}for(var r,i,s=this.blocks,a=this.byteCount,c=e.length,u=this.blockCount,l=0,f=this.s;l>2]|=e[l]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(s[r>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=a){for(this.start=r-a,this.block=s[u],r=0;r>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},B.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(o);if(null===e)throw new Error(o);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!d||!ArrayBuffer.isView(e)))throw new Error(o);t=!0}var r=0,i=e.length;if(t)r=i;else for(var s=0;s=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),r+=4)}return r+=this.encode(8*r),this.update(e),r},B.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+f[15&e]+f[e>>12&15]+f[e>>8&15]+f[e>>20&15]+f[e>>16&15]+f[e>>28&15]+f[e>>24&15];s%t===0&&(D(n),o=0)}return i&&(e=n[o],a+=f[e>>4&15]+f[15&e],i>1&&(a+=f[e>>12&15]+f[e>>8&15]),i>2&&(a+=f[e>>20&15]+f[e>>16&15])),a},B.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%n===0&&D(r)}return o&&(e=a<<2,t=r[s],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},L.prototype=new B,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),B.prototype.finalize.call(this)};var D=function(e){var t,n,r,i,o,s,a,c,u,l,d,f,h,p,m,b,y,v,w,x,S,A,E,_,C,I,k,T,M,P,O,R,N,B,L,D,U,j,F,V,q,z,H,W,G,Z,K,X,Y,J,Q,$,ee,te,ne,re,ie,oe,se,ae,ce,ue,le;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),n=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(c<<1|u>>>31),n=o^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=s^(l<<1|d>>>31),n=a^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(f<<1|h>>>31),n=u^(h<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(i<<1|o>>>31),n=d^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],m=e[1],Z=e[11]<<4|e[10]>>>28,K=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,M=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,b=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,X=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,O=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,R=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,_=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,j=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,x=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,W=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,I=e[18]<<20|e[19]>>>12,k=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,V=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~b&v,e[1]=m^~y&w,e[10]=_^~I&T,e[11]=C^~k&M,e[20]=B^~D&j,e[21]=L^~U&F,e[30]=W^~Z&X,e[31]=G^~K&Y,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=b^~v&x,e[3]=y^~w&S,e[12]=I^~T&P,e[13]=k^~M&O,e[22]=D^~j&V,e[23]=U^~F&q,e[32]=Z^~X&J,e[33]=K^~Y&Q,e[42]=re^~oe&ae,e[43]=ie^~se&ce,e[4]=v^~x&A,e[5]=w^~S&E,e[14]=T^~P&R,e[15]=M^~O&N,e[24]=j^~V&z,e[25]=F^~q&H,e[34]=X^~J&$,e[35]=Y^~Q&ee,e[44]=oe^~ae&ue,e[45]=se^~ce&le,e[6]=x^~A&p,e[7]=S^~E&m,e[16]=P^~R&_,e[17]=O^~N&C,e[26]=V^~z&B,e[27]=q^~H&L,e[36]=J^~$&W,e[37]=Q^~ee&G,e[46]=ae^~ue&te,e[47]=ce^~le&ne,e[8]=A^~p&b,e[9]=E^~m&y,e[18]=R^~_&I,e[19]=N^~C&k,e[28]=z^~B&D,e[29]=H^~L&U,e[38]=$^~W&Z,e[39]=ee^~G&K,e[48]=ue^~te&re,e[49]=le^~ne&ie,e[0]^=g[r],e[1]^=g[r+1]};if(u)e.exports=I;else{for(T=0;T>6,c[u++]=128|63&a):a<55296||a>=57344?(c[u++]=224|a>>12,c[u++]=128|a>>6&63,c[u++]=128|63&a):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++d)),c[u++]=240|a>>18,c[u++]=128|a>>12&63,c[u++]=128|a>>6&63,c[u++]=128|63&a);e=c}e.length>128&&(e=new x(n,!0).update(e).array());var f=[],h=[];for(d=0;d<128;++d){var p=e[d]||0;f[d]=92^p,h[d]=54^p}x.call(this,n,r),this.update(h),this.oKeyPad=f,this.inner=!0,this.sharedMemory=r}x.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!l||!ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var i,o,s=0,a=e.length,c=this.blocks;s>2]|=e[s]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(c[o>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=128?(this.block=c[32],this.start=o-128,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[32]=this.block,e[t>>2]|=f[3&t],this.block=e[32],t>=112&&(this.hashed||this.hash(),e[0]=this.block,e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=e[16]=e[17]=e[18]=e[19]=e[20]=e[21]=e[22]=e[23]=e[24]=e[25]=e[26]=e[27]=e[28]=e[29]=e[30]=e[31]=e[32]=0),e[30]=this.hBytes<<3|this.bytes>>>29,e[31]=this.bytes<<3,this.hash()}},x.prototype.hash=function(){var e,t,n,r,i,o,s,a,c,u,l,d,f,h,g,m,b,y,v,w,x,S,A,E,_,C=this.h0h,I=this.h0l,k=this.h1h,T=this.h1l,M=this.h2h,P=this.h2l,O=this.h3h,R=this.h3l,N=this.h4h,B=this.h4l,L=this.h5h,D=this.h5l,U=this.h6h,j=this.h6l,F=this.h7h,V=this.h7l,q=this.blocks;for(e=32;e<160;e+=2)t=((w=q[e-30])>>>1|(x=q[e-29])<<31)^(w>>>8|x<<24)^w>>>7,n=(x>>>1|w<<31)^(x>>>8|w<<24)^(x>>>7|w<<25),r=((w=q[e-4])>>>19|(x=q[e-3])<<13)^(x>>>29|w<<3)^w>>>6,i=(x>>>19|w<<13)^(w>>>29|x<<3)^(x>>>6|w<<26),w=q[e-32],x=q[e-31],c=((S=q[e-14])>>>16)+(w>>>16)+(t>>>16)+(r>>>16)+((a=(65535&S)+(65535&w)+(65535&t)+(65535&r)+((s=((A=q[e-13])>>>16)+(x>>>16)+(n>>>16)+(i>>>16)+((o=(65535&A)+(65535&x)+(65535&n)+(65535&i))>>>16))>>>16))>>>16),q[e]=c<<16|65535&a,q[e+1]=s<<16|65535&o;var z=C,H=I,W=k,G=T,Z=M,K=P,X=O,Y=R,J=N,Q=B,$=L,ee=D,te=U,ne=j,re=F,ie=V;for(m=W&Z,b=G&K,e=0;e<160;e+=8)t=(z>>>28|H<<4)^(H>>>2|z<<30)^(H>>>7|z<<25),n=(H>>>28|z<<4)^(z>>>2|H<<30)^(z>>>7|H<<25),r=(J>>>14|Q<<18)^(J>>>18|Q<<14)^(Q>>>9|J<<23),i=(Q>>>14|J<<18)^(Q>>>18|J<<14)^(J>>>9|Q<<23),y=(u=z&W)^z&Z^m,v=(l=H&G)^H&K^b,E=J&$^~J&te,_=Q&ee^~Q&ne,w=q[e],x=q[e+1],w=(c=((S=p[e])>>>16)+(w>>>16)+(E>>>16)+(r>>>16)+(re>>>16)+((a=(65535&S)+(65535&w)+(65535&E)+(65535&r)+(65535&re)+((s=((A=p[e+1])>>>16)+(x>>>16)+(_>>>16)+(i>>>16)+(ie>>>16)+((o=(65535&A)+(65535&x)+(65535&_)+(65535&i)+(65535&ie))>>>16))>>>16))>>>16))<<16|65535&a,x=s<<16|65535&o,S=(c=(y>>>16)+(t>>>16)+((a=(65535&y)+(65535&t)+((s=(v>>>16)+(n>>>16)+((o=(65535&v)+(65535&n))>>>16))>>>16))>>>16))<<16|65535&a,A=s<<16|65535&o,re=(c=(X>>>16)+(w>>>16)+((a=(65535&X)+(65535&w)+((s=(Y>>>16)+(x>>>16)+((o=(65535&Y)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,ie=s<<16|65535&o,t=((X=(c=(S>>>16)+(w>>>16)+((a=(65535&S)+(65535&w)+((s=(A>>>16)+(x>>>16)+((o=(65535&A)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(Y=s<<16|65535&o)<<4)^(Y>>>2|X<<30)^(Y>>>7|X<<25),n=(Y>>>28|X<<4)^(X>>>2|Y<<30)^(X>>>7|Y<<25),r=(re>>>14|ie<<18)^(re>>>18|ie<<14)^(ie>>>9|re<<23),i=(ie>>>14|re<<18)^(ie>>>18|re<<14)^(re>>>9|ie<<23),y=(d=X&z)^X&W^u,v=(f=Y&H)^Y&G^l,E=re&J^~re&$,_=ie&Q^~ie&ee,w=q[e+2],x=q[e+3],w=(c=((S=p[e+2])>>>16)+(w>>>16)+(E>>>16)+(r>>>16)+(te>>>16)+((a=(65535&S)+(65535&w)+(65535&E)+(65535&r)+(65535&te)+((s=((A=p[e+3])>>>16)+(x>>>16)+(_>>>16)+(i>>>16)+(ne>>>16)+((o=(65535&A)+(65535&x)+(65535&_)+(65535&i)+(65535&ne))>>>16))>>>16))>>>16))<<16|65535&a,x=s<<16|65535&o,S=(c=(y>>>16)+(t>>>16)+((a=(65535&y)+(65535&t)+((s=(v>>>16)+(n>>>16)+((o=(65535&v)+(65535&n))>>>16))>>>16))>>>16))<<16|65535&a,A=s<<16|65535&o,te=(c=(Z>>>16)+(w>>>16)+((a=(65535&Z)+(65535&w)+((s=(K>>>16)+(x>>>16)+((o=(65535&K)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,ne=s<<16|65535&o,t=((Z=(c=(S>>>16)+(w>>>16)+((a=(65535&S)+(65535&w)+((s=(A>>>16)+(x>>>16)+((o=(65535&A)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(K=s<<16|65535&o)<<4)^(K>>>2|Z<<30)^(K>>>7|Z<<25),n=(K>>>28|Z<<4)^(Z>>>2|K<<30)^(Z>>>7|K<<25),r=(te>>>14|ne<<18)^(te>>>18|ne<<14)^(ne>>>9|te<<23),i=(ne>>>14|te<<18)^(ne>>>18|te<<14)^(te>>>9|ne<<23),y=(h=Z&X)^Z&z^d,v=(g=K&Y)^K&H^f,E=te&re^~te&J,_=ne&ie^~ne&Q,w=q[e+4],x=q[e+5],w=(c=((S=p[e+4])>>>16)+(w>>>16)+(E>>>16)+(r>>>16)+($>>>16)+((a=(65535&S)+(65535&w)+(65535&E)+(65535&r)+(65535&$)+((s=((A=p[e+5])>>>16)+(x>>>16)+(_>>>16)+(i>>>16)+(ee>>>16)+((o=(65535&A)+(65535&x)+(65535&_)+(65535&i)+(65535&ee))>>>16))>>>16))>>>16))<<16|65535&a,x=s<<16|65535&o,S=(c=(y>>>16)+(t>>>16)+((a=(65535&y)+(65535&t)+((s=(v>>>16)+(n>>>16)+((o=(65535&v)+(65535&n))>>>16))>>>16))>>>16))<<16|65535&a,A=s<<16|65535&o,$=(c=(W>>>16)+(w>>>16)+((a=(65535&W)+(65535&w)+((s=(G>>>16)+(x>>>16)+((o=(65535&G)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,ee=s<<16|65535&o,t=((W=(c=(S>>>16)+(w>>>16)+((a=(65535&S)+(65535&w)+((s=(A>>>16)+(x>>>16)+((o=(65535&A)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(G=s<<16|65535&o)<<4)^(G>>>2|W<<30)^(G>>>7|W<<25),n=(G>>>28|W<<4)^(W>>>2|G<<30)^(W>>>7|G<<25),r=($>>>14|ee<<18)^($>>>18|ee<<14)^(ee>>>9|$<<23),i=(ee>>>14|$<<18)^(ee>>>18|$<<14)^($>>>9|ee<<23),y=(m=W&Z)^W&X^h,v=(b=G&K)^G&Y^g,E=$&te^~$&re,_=ee&ne^~ee&ie,w=q[e+6],x=q[e+7],w=(c=((S=p[e+6])>>>16)+(w>>>16)+(E>>>16)+(r>>>16)+(J>>>16)+((a=(65535&S)+(65535&w)+(65535&E)+(65535&r)+(65535&J)+((s=((A=p[e+7])>>>16)+(x>>>16)+(_>>>16)+(i>>>16)+(Q>>>16)+((o=(65535&A)+(65535&x)+(65535&_)+(65535&i)+(65535&Q))>>>16))>>>16))>>>16))<<16|65535&a,x=s<<16|65535&o,S=(c=(y>>>16)+(t>>>16)+((a=(65535&y)+(65535&t)+((s=(v>>>16)+(n>>>16)+((o=(65535&v)+(65535&n))>>>16))>>>16))>>>16))<<16|65535&a,A=s<<16|65535&o,J=(c=(z>>>16)+(w>>>16)+((a=(65535&z)+(65535&w)+((s=(H>>>16)+(x>>>16)+((o=(65535&H)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,Q=s<<16|65535&o,z=(c=(S>>>16)+(w>>>16)+((a=(65535&S)+(65535&w)+((s=(A>>>16)+(x>>>16)+((o=(65535&A)+(65535&x))>>>16))>>>16))>>>16))<<16|65535&a,H=s<<16|65535&o;c=(C>>>16)+(z>>>16)+((a=(65535&C)+(65535&z)+((s=(I>>>16)+(H>>>16)+((o=(65535&I)+(65535&H))>>>16))>>>16))>>>16),this.h0h=c<<16|65535&a,this.h0l=s<<16|65535&o,c=(k>>>16)+(W>>>16)+((a=(65535&k)+(65535&W)+((s=(T>>>16)+(G>>>16)+((o=(65535&T)+(65535&G))>>>16))>>>16))>>>16),this.h1h=c<<16|65535&a,this.h1l=s<<16|65535&o,c=(M>>>16)+(Z>>>16)+((a=(65535&M)+(65535&Z)+((s=(P>>>16)+(K>>>16)+((o=(65535&P)+(65535&K))>>>16))>>>16))>>>16),this.h2h=c<<16|65535&a,this.h2l=s<<16|65535&o,c=(O>>>16)+(X>>>16)+((a=(65535&O)+(65535&X)+((s=(R>>>16)+(Y>>>16)+((o=(65535&R)+(65535&Y))>>>16))>>>16))>>>16),this.h3h=c<<16|65535&a,this.h3l=s<<16|65535&o,c=(N>>>16)+(J>>>16)+((a=(65535&N)+(65535&J)+((s=(B>>>16)+(Q>>>16)+((o=(65535&B)+(65535&Q))>>>16))>>>16))>>>16),this.h4h=c<<16|65535&a,this.h4l=s<<16|65535&o,c=(L>>>16)+($>>>16)+((a=(65535&L)+(65535&$)+((s=(D>>>16)+(ee>>>16)+((o=(65535&D)+(65535&ee))>>>16))>>>16))>>>16),this.h5h=c<<16|65535&a,this.h5l=s<<16|65535&o,c=(U>>>16)+(te>>>16)+((a=(65535&U)+(65535&te)+((s=(j>>>16)+(ne>>>16)+((o=(65535&j)+(65535&ne))>>>16))>>>16))>>>16),this.h6h=c<<16|65535&a,this.h6l=s<<16|65535&o,c=(F>>>16)+(re>>>16)+((a=(65535&F)+(65535&re)+((s=(V>>>16)+(ie>>>16)+((o=(65535&V)+(65535&ie))>>>16))>>>16))>>>16),this.h7h=c<<16|65535&a,this.h7l=s<<16|65535&o},x.prototype.hex=function(){this.finalize();var e=this.h0h,t=this.h0l,n=this.h1h,r=this.h1l,i=this.h2h,o=this.h2l,s=this.h3h,a=this.h3l,c=this.h4h,u=this.h4l,l=this.h5h,f=this.h5l,h=this.h6h,p=this.h6l,g=this.h7h,m=this.h7l,b=this.bits,y=d[e>>28&15]+d[e>>24&15]+d[e>>20&15]+d[e>>16&15]+d[e>>12&15]+d[e>>8&15]+d[e>>4&15]+d[15&e]+d[t>>28&15]+d[t>>24&15]+d[t>>20&15]+d[t>>16&15]+d[t>>12&15]+d[t>>8&15]+d[t>>4&15]+d[15&t]+d[n>>28&15]+d[n>>24&15]+d[n>>20&15]+d[n>>16&15]+d[n>>12&15]+d[n>>8&15]+d[n>>4&15]+d[15&n]+d[r>>28&15]+d[r>>24&15]+d[r>>20&15]+d[r>>16&15]+d[r>>12&15]+d[r>>8&15]+d[r>>4&15]+d[15&r]+d[i>>28&15]+d[i>>24&15]+d[i>>20&15]+d[i>>16&15]+d[i>>12&15]+d[i>>8&15]+d[i>>4&15]+d[15&i]+d[o>>28&15]+d[o>>24&15]+d[o>>20&15]+d[o>>16&15]+d[o>>12&15]+d[o>>8&15]+d[o>>4&15]+d[15&o]+d[s>>28&15]+d[s>>24&15]+d[s>>20&15]+d[s>>16&15]+d[s>>12&15]+d[s>>8&15]+d[s>>4&15]+d[15&s];return b>=256&&(y+=d[a>>28&15]+d[a>>24&15]+d[a>>20&15]+d[a>>16&15]+d[a>>12&15]+d[a>>8&15]+d[a>>4&15]+d[15&a]),b>=384&&(y+=d[c>>28&15]+d[c>>24&15]+d[c>>20&15]+d[c>>16&15]+d[c>>12&15]+d[c>>8&15]+d[c>>4&15]+d[15&c]+d[u>>28&15]+d[u>>24&15]+d[u>>20&15]+d[u>>16&15]+d[u>>12&15]+d[u>>8&15]+d[u>>4&15]+d[15&u]+d[l>>28&15]+d[l>>24&15]+d[l>>20&15]+d[l>>16&15]+d[l>>12&15]+d[l>>8&15]+d[l>>4&15]+d[15&l]+d[f>>28&15]+d[f>>24&15]+d[f>>20&15]+d[f>>16&15]+d[f>>12&15]+d[f>>8&15]+d[f>>4&15]+d[15&f]),512==b&&(y+=d[h>>28&15]+d[h>>24&15]+d[h>>20&15]+d[h>>16&15]+d[h>>12&15]+d[h>>8&15]+d[h>>4&15]+d[15&h]+d[p>>28&15]+d[p>>24&15]+d[p>>20&15]+d[p>>16&15]+d[p>>12&15]+d[p>>8&15]+d[p>>4&15]+d[15&p]+d[g>>28&15]+d[g>>24&15]+d[g>>20&15]+d[g>>16&15]+d[g>>12&15]+d[g>>8&15]+d[g>>4&15]+d[15&g]+d[m>>28&15]+d[m>>24&15]+d[m>>20&15]+d[m>>16&15]+d[m>>12&15]+d[m>>8&15]+d[m>>4&15]+d[15&m]),y},x.prototype.toString=x.prototype.hex,x.prototype.digest=function(){this.finalize();var e=this.h0h,t=this.h0l,n=this.h1h,r=this.h1l,i=this.h2h,o=this.h2l,s=this.h3h,a=this.h3l,c=this.h4h,u=this.h4l,l=this.h5h,d=this.h5l,f=this.h6h,h=this.h6l,p=this.h7h,g=this.h7l,m=this.bits,b=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,s>>24&255,s>>16&255,s>>8&255,255&s];return m>=256&&b.push(a>>24&255,a>>16&255,a>>8&255,255&a),m>=384&&b.push(c>>24&255,c>>16&255,c>>8&255,255&c,u>>24&255,u>>16&255,u>>8&255,255&u,l>>24&255,l>>16&255,l>>8&255,255&l,d>>24&255,d>>16&255,d>>8&255,255&d),512==m&&b.push(f>>24&255,f>>16&255,f>>8&255,255&f,h>>24&255,h>>16&255,h>>8&255,255&h,p>>24&255,p>>16&255,p>>8&255,255&p,g>>24&255,g>>16&255,g>>8&255,255&g),b},x.prototype.array=x.prototype.digest,x.prototype.arrayBuffer=function(){this.finalize();var e=this.bits,t=new ArrayBuffer(e/8),n=new DataView(t);return n.setUint32(0,this.h0h),n.setUint32(4,this.h0l),n.setUint32(8,this.h1h),n.setUint32(12,this.h1l),n.setUint32(16,this.h2h),n.setUint32(20,this.h2l),n.setUint32(24,this.h3h),e>=256&&n.setUint32(28,this.h3l),e>=384&&(n.setUint32(32,this.h4h),n.setUint32(36,this.h4l),n.setUint32(40,this.h5h),n.setUint32(44,this.h5l)),512==e&&(n.setUint32(48,this.h6h),n.setUint32(52,this.h6l),n.setUint32(56,this.h7h),n.setUint32(60,this.h7l)),t},x.prototype.clone=function(){var e=new x(this.bits,!1);return this.copyTo(e),e},x.prototype.copyTo=function(e){var t=0,n=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(t=0;t="0"&&a<="9";)i+=a,f();if("."===a)for(i+=".";f()&&a>="0"&&a<="9";)i+=a;if("e"===a||"E"===a)for(i+=a,f(),"-"!==a&&"+"!==a||(i+=a,f());a>="0"&&a<="9";)i+=a,f();if(e=+i,isFinite(e))return null==r&&(r=n(44431)),i.length>15?t.storeAsString?i:t.useNativeBigInt?BigInt(i):new r(i):t.alwaysParseAsBig?t.useNativeBigInt?BigInt(e):new r(e):e;d("Bad number")},p=function(){var e,t,n,r="";if('"'===a)for(var i=s;f();){if('"'===a)return s-1>i&&(r+=c.substring(i,s-1)),f(),r;if("\\"===a){if(s-1>i&&(r+=c.substring(i,s-1)),f(),"u"===a){for(n=0,t=0;t<4&&(e=parseInt(f(),16),isFinite(e));t+=1)n=16*n+e;r+=String.fromCharCode(n)}else{if("string"!==typeof l[a])break;r+=l[a]}i=s}}d("Bad string")},g=function(){for(;a&&a<=" ";)f()};return u=function(){switch(g(),a){case"{":return function(){var e,n=Object.create(null);if("{"===a){if(f("{"),g(),"}"===a)return f("}"),n;for(;a;){if(e=p(),g(),f(":"),!0===t.strict&&Object.hasOwnProperty.call(n,e)&&d('Duplicate key "'+e+'"'),!0===i.test(e)?"error"===t.protoAction?d("Object contains forbidden prototype property"):"ignore"===t.protoAction?u():n[e]=u():!0===o.test(e)?"error"===t.constructorAction?d("Object contains forbidden constructor property"):"ignore"===t.constructorAction?u():n[e]=u():n[e]=u(),g(),"}"===a)return f("}"),n;f(","),g()}}d("Bad object")}();case"[":return function(){var e=[];if("["===a){if(f("["),g(),"]"===a)return f("]"),e;for(;a;){if(e.push(u()),g(),"]"===a)return f("]"),e;f(","),g()}}d("Bad array")}();case'"':return p();case"-":return h();default:return a>="0"&&a<="9"?h():function(){switch(a){case"t":return f("t"),f("r"),f("u"),f("e"),!0;case"f":return f("f"),f("a"),f("l"),f("s"),f("e"),!1;case"n":return f("n"),f("u"),f("l"),f("l"),null}d("Unexpected '"+a+"'")}()}},function(e,t){var n;return c=e+"",s=0,a=" ",n=u(),g(),a&&d("Syntax error"),"function"===typeof t?function e(n,r){var i,o=n[r];return o&&"object"===typeof o&&Object.keys(o).forEach((function(t){void 0!==(i=e(o,t))?o[t]=i:delete o[t]})),t.call(n,r,o)}({"":n},""):n}}},54123:function(e,t,n){var r=n(44431),i=e.exports;!function(){"use strict";var e,t,n,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function a(e){return o.lastIndex=0,o.test(e)?'"'+e.replace(o,(function(e){var t=s[e];return"string"===typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function c(i,o){var s,u,l,d,f,h=e,p=o[i],g=null!=p&&(p instanceof r||r.isBigNumber(p));switch(p&&"object"===typeof p&&"function"===typeof p.toJSON&&(p=p.toJSON(i)),"function"===typeof n&&(p=n.call(o,i,p)),typeof p){case"string":return g?p:a(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":case"bigint":return String(p);case"object":if(!p)return"null";if(e+=t,f=[],"[object Array]"===Object.prototype.toString.apply(p)){for(d=p.length,s=0;sclass t extends i{constructor(t,n,r,i,o){super(o),this._rate=t,this._capacity=n,this._delimitedSuffix=r,this._hashBitLength=i,this._options=o,this._state=new e,this._state.initialize(t,n),this._finalized=!1}_transform(e,t,n){let r=null;try{this.update(e,t)}catch(i){r=i}n(r)}_flush(e){let t=null;try{this.push(this.digest())}catch(n){t=n}e(t)}update(e,t){if(!r.isBuffer(e)&&"string"!==typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return r.isBuffer(e)||(e=r.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}},5675:function(e,t,n){var r=n(48764).Buffer;const{Transform:i}=n(88473);e.exports=e=>class t extends i{constructor(t,n,r,i){super(i),this._rate=t,this._capacity=n,this._delimitedSuffix=r,this._options=i,this._state=new e,this._state.initialize(t,n),this._finalized=!1}_transform(e,t,n){let r=null;try{this.update(e,t)}catch(i){r=i}n(r)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!r.isBuffer(e)&&"string"!==typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return r.isBuffer(e)||(e=r.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let n=this._state.squeeze(e);return void 0!==t&&(n=n.toString(t)),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}},34040:function(e,t){const n=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];t.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],d=e[8]^e[18]^e[28]^e[38]^e[48],f=e[9]^e[19]^e[29]^e[39]^e[49];let h=d^(o<<1|s>>>31),p=f^(s<<1|o>>>31);const g=e[0]^h,m=e[1]^p,b=e[10]^h,y=e[11]^p,v=e[20]^h,w=e[21]^p,x=e[30]^h,S=e[31]^p,A=e[40]^h,E=e[41]^p;h=r^(a<<1|c>>>31),p=i^(c<<1|a>>>31);const _=e[2]^h,C=e[3]^p,I=e[12]^h,k=e[13]^p,T=e[22]^h,M=e[23]^p,P=e[32]^h,O=e[33]^p,R=e[42]^h,N=e[43]^p;h=o^(u<<1|l>>>31),p=s^(l<<1|u>>>31);const B=e[4]^h,L=e[5]^p,D=e[14]^h,U=e[15]^p,j=e[24]^h,F=e[25]^p,V=e[34]^h,q=e[35]^p,z=e[44]^h,H=e[45]^p;h=a^(d<<1|f>>>31),p=c^(f<<1|d>>>31);const W=e[6]^h,G=e[7]^p,Z=e[16]^h,K=e[17]^p,X=e[26]^h,Y=e[27]^p,J=e[36]^h,Q=e[37]^p,$=e[46]^h,ee=e[47]^p;h=u^(r<<1|i>>>31),p=l^(i<<1|r>>>31);const te=e[8]^h,ne=e[9]^p,re=e[18]^h,ie=e[19]^p,oe=e[28]^h,se=e[29]^p,ae=e[38]^h,ce=e[39]^p,ue=e[48]^h,le=e[49]^p,de=g,fe=m,he=y<<4|b>>>28,pe=b<<4|y>>>28,ge=v<<3|w>>>29,me=w<<3|v>>>29,be=S<<9|x>>>23,ye=x<<9|S>>>23,ve=A<<18|E>>>14,we=E<<18|A>>>14,xe=_<<1|C>>>31,Se=C<<1|_>>>31,Ae=k<<12|I>>>20,Ee=I<<12|k>>>20,_e=T<<10|M>>>22,Ce=M<<10|T>>>22,Ie=O<<13|P>>>19,ke=P<<13|O>>>19,Te=R<<2|N>>>30,Me=N<<2|R>>>30,Pe=L<<30|B>>>2,Oe=B<<30|L>>>2,Re=D<<6|U>>>26,Ne=U<<6|D>>>26,Be=F<<11|j>>>21,Le=j<<11|F>>>21,De=V<<15|q>>>17,Ue=q<<15|V>>>17,je=H<<29|z>>>3,Fe=z<<29|H>>>3,Ve=W<<28|G>>>4,qe=G<<28|W>>>4,ze=K<<23|Z>>>9,He=Z<<23|K>>>9,We=X<<25|Y>>>7,Ge=Y<<25|X>>>7,Ze=J<<21|Q>>>11,Ke=Q<<21|J>>>11,Xe=ee<<24|$>>>8,Ye=$<<24|ee>>>8,Je=te<<27|ne>>>5,Qe=ne<<27|te>>>5,$e=re<<20|ie>>>12,et=ie<<20|re>>>12,tt=se<<7|oe>>>25,nt=oe<<7|se>>>25,rt=ae<<8|ce>>>24,it=ce<<8|ae>>>24,ot=ue<<14|le>>>18,st=le<<14|ue>>>18;e[0]=de^~Ae&Be,e[1]=fe^~Ee&Le,e[10]=Ve^~$e&ge,e[11]=qe^~et&me,e[20]=xe^~Re&We,e[21]=Se^~Ne&Ge,e[30]=Je^~he&_e,e[31]=Qe^~pe&Ce,e[40]=Pe^~ze&tt,e[41]=Oe^~He&nt,e[2]=Ae^~Be&Ze,e[3]=Ee^~Le&Ke,e[12]=$e^~ge&Ie,e[13]=et^~me&ke,e[22]=Re^~We&rt,e[23]=Ne^~Ge&it,e[32]=he^~_e&De,e[33]=pe^~Ce&Ue,e[42]=ze^~tt&be,e[43]=He^~nt&ye,e[4]=Be^~Ze&ot,e[5]=Le^~Ke&st,e[14]=ge^~Ie&je,e[15]=me^~ke&Fe,e[24]=We^~rt&ve,e[25]=Ge^~it&we,e[34]=_e^~De&Xe,e[35]=Ce^~Ue&Ye,e[44]=tt^~be&Te,e[45]=nt^~ye&Me,e[6]=Ze^~ot&de,e[7]=Ke^~st&fe,e[16]=Ie^~je&Ve,e[17]=ke^~Fe&qe,e[26]=rt^~ve&xe,e[27]=it^~we&Se,e[36]=De^~Xe&Je,e[37]=Ue^~Ye&Qe,e[46]=be^~Te&Pe,e[47]=ye^~Me&Oe,e[8]=ot^~de&Ae,e[9]=st^~fe&Ee,e[18]=je^~Ve&$e,e[19]=Fe^~qe&et,e[28]=ve^~xe&Re,e[29]=we^~Se&Ne,e[38]=Xe^~Je&he,e[39]=Ye^~Qe&pe,e[48]=Te^~Pe&ze,e[49]=Me^~Oe&He,e[0]^=n[2*t],e[1]^=n[2*t+1]}}},79653:function(e,t,n){var r=n(48764).Buffer;const i=n(34040);function o(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}o.prototype.initialize=function(e,t){for(let n=0;n<50;++n)this.state[n]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},o.prototype.absorb=function(e){for(let t=0;t>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(i.p1600(this.state),this.count=0);return t},o.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},e.exports=o},47630:function(e){"use strict";for(var t=function(e){return null!==e&&!Array.isArray(e)&&"object"===typeof e},n={3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",28:"Convert",29:"NonConvert",30:"Accept",31:"ModeChange",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"},r=0;r<24;r+=1)n[112+r]="F"+(r+1);for(var i=0;i<26;i+=1){var o=i+65;n[o]=[String.fromCharCode(o+32),String.fromCharCode(o)]}var s={codes:n,getCode:function(e){return t(e)?e.keyCode||e.which||this[e.key]:this[e]},getKey:function(e){var r=t(e);if(r&&e.key)return e.key;var i=n[r?e.keyCode||e.which:e];return Array.isArray(i)&&(i=r?i[e.shiftKey?1:0]:i[0]),i},Cancel:3,Help:6,Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Convert:28,NonConvert:29,Accept:30,ModeChange:31," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Select:41,Print:42,Execute:43,PrintScreen:44,Insert:45,Delete:46,0:48,")":48,1:49,"!":49,2:50,"@":50,3:51,"#":51,4:52,$:52,5:53,"%":53,6:54,"^":54,7:55,"&":55,8:56,"*":56,9:57,"(":57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,OS:91,ContextMenu:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,NumLock:144,ScrollLock:145,VolumeMute:181,VolumeDown:182,VolumeUp:183,";":186,":":186,"=":187,"+":187,",":188,"<":188,"-":189,_:189,".":190,">":190,"/":191,"?":191,"`":192,"~":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"'":222,'"':222,Meta:224,AltGraph:225,Attn:246,CrSel:247,ExSel:248,EraseEof:249,Play:250,ZoomOut:251};s.Spacebar=s[" "],s.Digit0=s[0],s.Digit1=s[1],s.Digit2=s[2],s.Digit3=s[3],s.Digit4=s[4],s.Digit5=s[5],s.Digit6=s[6],s.Digit7=s[7],s.Digit8=s[8],s.Digit9=s[9],s.Tilde=s["~"],s.GraveAccent=s["`"],s.ExclamationPoint=s["!"],s.AtSign=s["@"],s.PoundSign=s["#"],s.PercentSign=s["%"],s.Caret=s["^"],s.Ampersand=s["&"],s.PlusSign=s["+"],s.MinusSign=s["-"],s.EqualsSign=s["="],s.DivisionSign=s["/"],s.MultiplicationSign=s["*"],s.Comma=s[","],s.Decimal=s["."],s.Colon=s[":"],s.Semicolon=s[";"],s.Pipe=s["|"],s.BackSlash=s["\\"],s.QuestionMark=s["?"],s.SingleQuote=s["'"],s.DoubleQuote=s['"'],s.LeftCurlyBrace=s["{"],s.RightCurlyBrace=s["}"],s.LeftParenthesis=s["("],s.RightParenthesis=s[")"],s.LeftAngleBracket=s["<"],s.RightAngleBracket=s[">"],s.LeftSquareBracket=s["["],s.RightSquareBracket=s["]"],e.exports=s},72307:function(e,t,n){e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Array]",a="[object Boolean]",c="[object Date]",u="[object Error]",l="[object Function]",d="[object Map]",f="[object Number]",h="[object Object]",p="[object Promise]",g="[object RegExp]",m="[object Set]",b="[object String]",y="[object Symbol]",v="[object WeakMap]",w="[object ArrayBuffer]",x="[object DataView]",S=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[o]=E[s]=E[w]=E[a]=E[x]=E[c]=E[u]=E[l]=E[d]=E[f]=E[h]=E[g]=E[m]=E[b]=E[v]=!1;var _="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,C="object"==typeof self&&self&&self.Object===Object&&self,I=_||C||Function("return this")(),k=t&&!t.nodeType&&t,T=k&&e&&!e.nodeType&&e,M=T&&T.exports===k,P=M&&_.process,O=function(){try{return P&&P.binding&&P.binding("util")}catch(e){}}(),R=O&&O.isTypedArray;function N(e,t){for(var n=-1,r=null==e?0:e.length;++na))return!1;var u=o.get(e);if(u&&o.get(t))return u==t;var l=-1,d=!0,f=2&n?new ve:void 0;for(o.set(e,t),o.set(t,e);++l-1},be.prototype.set=function(e,t){var n=this.__data__,r=Se(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ye.prototype.clear=function(){this.size=0,this.__data__={hash:new me,map:new(ie||be),string:new me}},ye.prototype.delete=function(e){var t=Me(this,e).delete(e);return this.size-=t?1:0,t},ye.prototype.get=function(e){return Me(this,e).get(e)},ye.prototype.has=function(e){return Me(this,e).has(e)},ye.prototype.set=function(e,t){var n=Me(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,r),this},ve.prototype.has=function(e){return this.__data__.has(e)},we.prototype.clear=function(){this.__data__=new be,this.size=0},we.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var n=this.__data__;if(n instanceof be){var r=n.__data__;if(!ie||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ye(r)}return n.set(e,t),this.size=n.size,this};var Oe=ee?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n-1&&e%1==0&&e-1&&e%1==0&&e<=i}function qe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ze(e){return null!=e&&"object"==typeof e}var He=R?function(e){return function(t){return e(t)}}(R):function(e){return ze(e)&&Ve(e.length)&&!!E[Ae(e)]};function We(e){return null!=(t=e)&&Ve(t.length)&&!Fe(t)?xe(e):Ie(e);var t}e.exports=function(e,t){return _e(e,t)}},72378:function(e,t,n){e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Function]",a="[object Object]",c=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[o]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[s]=l["[object Map]"]=l["[object Number]"]=l[a]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var d="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,f="object"==typeof self&&self&&self.Object===Object&&self,h=d||f||Function("return this")(),p=t&&!t.nodeType&&t,g=p&&e&&!e.nodeType&&e,m=g&&g.exports===p,b=m&&d.process,y=function(){try{var e=g&&g.require&&g.require("util").types;return e||b&&b.binding&&b.binding("util")}catch(t){}}(),v=y&&y.isTypedArray;function w(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var x,S,A=Array.prototype,E=Function.prototype,_=Object.prototype,C=h["__core-js_shared__"],I=E.toString,k=_.hasOwnProperty,T=function(){var e=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),M=_.toString,P=I.call(Object),O=RegExp("^"+I.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=m?h.Buffer:void 0,N=h.Symbol,B=h.Uint8Array,L=R?R.allocUnsafe:void 0,D=(x=Object.getPrototypeOf,S=Object,function(e){return x(S(e))}),U=Object.create,j=_.propertyIsEnumerable,F=A.splice,V=N?N.toStringTag:void 0,q=function(){try{var e=pe(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),z=R?R.isBuffer:void 0,H=Math.max,W=Date.now,G=pe(h,"Map"),Z=pe(Object,"create"),K=function(){function e(){}return function(t){if(!Ce(t))return{};if(U)return U(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function X(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Y.prototype.set=function(e,t){var n=this.__data__,r=ne(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new X,map:new(G||Y),string:new X}},J.prototype.delete=function(e){var t=he(this,e).delete(e);return this.size-=t?1:0,t},J.prototype.get=function(e){return he(this,e).get(e)},J.prototype.has=function(e){return he(this,e).has(e)},J.prototype.set=function(e,t){var n=he(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Q.prototype.clear=function(){this.__data__=new Y,this.size=0},Q.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Q.prototype.get=function(e){return this.__data__.get(e)},Q.prototype.has=function(e){return this.__data__.has(e)},Q.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Y){var r=n.__data__;if(!G||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new J(r)}return n.set(e,t),this.size=n.size,this};var ie,oe=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),s=o.length;s--;){var a=o[ie?s:++r];if(!1===t(i[a],a,i))break}return e};function se(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":V&&V in Object(e)?function(e){var t=k.call(e,V),n=e[V];try{e[V]=void 0;var r=!0}catch(o){}var i=M.call(e);r&&(t?e[V]=n:delete e[V]);return i}(e):function(e){return M.call(e)}(e)}function ae(e){return Ie(e)&&se(e)==o}function ce(e){return!(!Ce(e)||function(e){return!!T&&T in e}(e))&&(Ee(e)?O:c).test(function(e){if(null!=e){try{return I.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e))}function ue(e){if(!Ce(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=me(e),n=[];for(var r in e)("constructor"!=r||!t&&k.call(e,r))&&n.push(r);return n}function le(e,t,n,r,i){e!==t&&oe(t,(function(o,s){if(i||(i=new Q),Ce(o))!function(e,t,n,r,i,o,s){var c=be(e,n),u=be(t,n),l=s.get(u);if(l)return void ee(e,n,l);var d=o?o(c,u,n+"",e,t,s):void 0,f=void 0===d;if(f){var h=xe(u),p=!h&&Ae(u),g=!h&&!p&&ke(u);d=u,h||p||g?xe(c)?d=c:Ie(m=c)&&Se(m)?d=function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n-1&&e%1==0&&e0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(fe);function ve(e,t){return e===t||e!==e&&t!==t}var we=ae(function(){return arguments}())?ae:function(e){return Ie(e)&&k.call(e,"callee")&&!j.call(e,"callee")},xe=Array.isArray;function Se(e){return null!=e&&_e(e.length)&&!Ee(e)}var Ae=z||function(){return!1};function Ee(e){if(!Ce(e))return!1;var t=se(e);return t==s||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function _e(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function Ce(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ie(e){return null!=e&&"object"==typeof e}var ke=v?function(e){return function(t){return e(t)}}(v):function(e){return Ie(e)&&_e(e.length)&&!!l[se(e)]};function Te(e){return Se(e)?$(e,!0):ue(e)}var Me,Pe=(Me=function(e,t,n){le(e,t,n)},de((function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=Me.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!Ce(n))return!1;var r=typeof t;return!!("number"==r?Se(n)&&ge(t,n.length):"string"==r&&t in n)&&ve(n[t],e)}(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n"']/g,Y=RegExp(K.source),J=RegExp(X.source),Q=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ie=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(ie.source),se=/^\s+/,ae=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,le=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ge=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,ye=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,we=/^(?:0|[1-9]\d*)$/,xe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Se=/($^)/,Ae=/['\n\r\u2028\u2029\\]/g,Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="\\u2700-\\u27bf",Ce="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",ke="\\ufe0e\\ufe0f",Te="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Me="['\u2019]",Pe="[\\ud800-\\udfff]",Oe="["+Te+"]",Re="["+Ee+"]",Ne="\\d+",Be="[\\u2700-\\u27bf]",Le="["+Ce+"]",De="[^\\ud800-\\udfff"+Te+Ne+_e+Ce+Ie+"]",Ue="\\ud83c[\\udffb-\\udfff]",je="[^\\ud800-\\udfff]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",Ve="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Ie+"]",ze="(?:"+Le+"|"+De+")",He="(?:"+qe+"|"+De+")",We="(?:['\u2019](?:d|ll|m|re|s|t|ve))?",Ge="(?:['\u2019](?:D|LL|M|RE|S|T|VE))?",Ze="(?:"+Re+"|"+Ue+")"+"?",Ke="[\\ufe0e\\ufe0f]?",Xe=Ke+Ze+("(?:\\u200d(?:"+[je,Fe,Ve].join("|")+")"+Ke+Ze+")*"),Ye="(?:"+[Be,Fe,Ve].join("|")+")"+Xe,Je="(?:"+[je+Re+"?",Re,Fe,Ve,Pe].join("|")+")",Qe=RegExp(Me,"g"),$e=RegExp(Re,"g"),et=RegExp(Ue+"(?="+Ue+")|"+Je+Xe,"g"),tt=RegExp([qe+"?"+Le+"+"+We+"(?="+[Oe,qe,"$"].join("|")+")",He+"+"+Ge+"(?="+[Oe,qe+ze,"$"].join("|")+")",qe+"?"+ze+"+"+We,qe+"+"+Ge,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ne,Ye].join("|"),"g"),nt=RegExp("[\\u200d\\ud800-\\udfff"+Ee+ke+"]"),rt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,st={};st[L]=st[D]=st[U]=st[j]=st[F]=st[V]=st[q]=st[z]=st[H]=!0,st[y]=st[v]=st[N]=st[w]=st[B]=st[x]=st[S]=st[A]=st[_]=st[C]=st[I]=st[T]=st[M]=st[P]=st[R]=!1;var at={};at[y]=at[v]=at[N]=at[B]=at[w]=at[x]=at[L]=at[D]=at[U]=at[j]=at[F]=at[_]=at[C]=at[I]=at[T]=at[M]=at[P]=at[O]=at[V]=at[q]=at[z]=at[H]=!0,at[S]=at[A]=at[R]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,dt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ft="object"==typeof self&&self&&self.Object===Object&&self,ht=dt||ft||Function("return this")(),pt=t&&!t.nodeType&&t,gt=pt&&e&&!e.nodeType&&e,mt=gt&>.exports===pt,bt=mt&&dt.process,yt=function(){try{var e=gt&>.require&>.require("util").types;return e||bt&&bt.binding&&bt.binding("util")}catch(t){}}(),vt=yt&&yt.isArrayBuffer,wt=yt&&yt.isDate,xt=yt&&yt.isMap,St=yt&&yt.isRegExp,At=yt&&yt.isSet,Et=yt&&yt.isTypedArray;function _t(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Ct(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ot(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function tn(e,t){for(var n=e.length;n--&&Vt(t,e[n],0)>-1;);return n}function nn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var rn=Gt({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),on=Gt({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+ct[e]}function an(e){return nt.test(e)}function cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function un(e,t){return function(n){return e(t(n))}}function ln(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"});var bn=function e(t){var n=(t=null==t?ht:bn.defaults(ht.Object(),t,bn.pick(ht,it))).Array,r=t.Date,ae=t.Error,Ee=t.Function,_e=t.Math,Ce=t.Object,Ie=t.RegExp,ke=t.String,Te=t.TypeError,Me=n.prototype,Pe=Ee.prototype,Oe=Ce.prototype,Re=t["__core-js_shared__"],Ne=Pe.toString,Be=Oe.hasOwnProperty,Le=0,De=function(){var e=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ue=Oe.toString,je=Ne.call(Ce),Fe=ht._,Ve=Ie("^"+Ne.call(Be).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=mt?t.Buffer:i,ze=t.Symbol,He=t.Uint8Array,We=qe?qe.allocUnsafe:i,Ge=un(Ce.getPrototypeOf,Ce),Ze=Ce.create,Ke=Oe.propertyIsEnumerable,Xe=Me.splice,Ye=ze?ze.isConcatSpreadable:i,Je=ze?ze.iterator:i,et=ze?ze.toStringTag:i,nt=function(){try{var e=ho(Ce,"defineProperty");return e({},"",{}),e}catch(t){}}(),ct=t.clearTimeout!==ht.clearTimeout&&t.clearTimeout,dt=r&&r.now!==ht.Date.now&&r.now,ft=t.setTimeout!==ht.setTimeout&&t.setTimeout,pt=_e.ceil,gt=_e.floor,bt=Ce.getOwnPropertySymbols,yt=qe?qe.isBuffer:i,Ut=t.isFinite,Gt=Me.join,yn=un(Ce.keys,Ce),vn=_e.max,wn=_e.min,xn=r.now,Sn=t.parseInt,An=_e.random,En=Me.reverse,_n=ho(t,"DataView"),Cn=ho(t,"Map"),In=ho(t,"Promise"),kn=ho(t,"Set"),Tn=ho(t,"WeakMap"),Mn=ho(Ce,"create"),Pn=Tn&&new Tn,On={},Rn=Fo(_n),Nn=Fo(Cn),Bn=Fo(In),Ln=Fo(kn),Dn=Fo(Tn),Un=ze?ze.prototype:i,jn=Un?Un.valueOf:i,Fn=Un?Un.toString:i;function Vn(e){if(ra(e)&&!Gs(e)&&!(e instanceof Wn)){if(e instanceof Hn)return e;if(Be.call(e,"__wrapped__"))return Vo(e)}return new Hn(e)}var qn=function(){function e(){}return function(t){if(!na(t))return{};if(Ze)return Ze(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function zn(){}function Hn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Wn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ur(e,t,n,r,o,s){var a,c=1&t,u=2&t,l=4&t;if(n&&(a=o?n(e,r,o,s):n(e)),a!==i)return a;if(!na(e))return e;var d=Gs(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Be.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Mi(e,a)}else{var f=mo(e),h=f==A||f==E;if(Ys(e))return Ei(e,c);if(f==I||f==y||h&&!o){if(a=u||h?{}:yo(e),!c)return u?function(e,t){return Pi(e,go(e),t)}(e,function(e,t){return e&&Pi(t,Na(t),e)}(a,e)):function(e,t){return Pi(e,po(e),t)}(e,or(a,e))}else{if(!at[f])return o?e:{};a=function(e,t,n){var r=e.constructor;switch(t){case N:return _i(e);case w:case x:return new r(+e);case B:return function(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case L:case D:case U:case j:case F:case V:case q:case z:case H:return Ci(e,n);case _:return new r;case C:case P:return new r(e);case T:return function(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case M:return new r;case O:return i=e,jn?Ce(jn.call(i)):{}}var i}(e,f,c)}}s||(s=new Yn);var p=s.get(e);if(p)return p;s.set(e,a),ca(e)?e.forEach((function(r){a.add(ur(r,t,n,r,e,s))})):ia(e)&&e.forEach((function(r,i){a.set(i,ur(r,t,n,i,e,s))}));var g=d?i:(l?u?oo:io:u?Na:Ra)(e);return It(g||e,(function(r,i){g&&(r=e[i=r]),nr(a,i,ur(r,t,n,i,e,s))})),a}function lr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Ce(e);r--;){var o=n[r],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function dr(e,t,n){if("function"!=typeof e)throw new Te(o);return Ro((function(){e.apply(i,n)}),t)}function fr(e,t,n,r){var i=-1,o=Pt,s=!0,a=e.length,c=[],u=t.length;if(!a)return c;n&&(t=Rt(t,Jt(n))),r?(o=Ot,s=!1):t.length>=200&&(o=$t,s=!1,t=new Xn(t));e:for(;++i-1},Zn.prototype.set=function(e,t){var n=this.__data__,r=rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Kn.prototype.clear=function(){this.size=0,this.__data__={hash:new Gn,map:new(Cn||Zn),string:new Gn}},Kn.prototype.delete=function(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t},Kn.prototype.get=function(e){return lo(this,e).get(e)},Kn.prototype.has=function(e){return lo(this,e).has(e)},Kn.prototype.set=function(e,t){var n=lo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(e){return this.__data__.set(e,s),this},Xn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Zn,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Zn){var r=n.__data__;if(!Cn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Kn(r)}return n.set(e,t),this.size=n.size,this};var hr=Ni(xr),pr=Ni(Sr,!0);function gr(e,t){var n=!0;return hr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function mr(e,t,n){for(var r=-1,o=e.length;++r0&&n(a)?t>1?yr(a,t-1,n,r,i):Nt(i,a):r||(i[i.length]=a)}return i}var vr=Bi(),wr=Bi(!0);function xr(e,t){return e&&vr(e,t,Ra)}function Sr(e,t){return e&&wr(e,t,Ra)}function Ar(e,t){return Mt(t,(function(t){return $s(e[t])}))}function Er(e,t){for(var n=0,r=(t=wi(t,e)).length;null!=e&&nt}function kr(e,t){return null!=e&&Be.call(e,t)}function Tr(e,t){return null!=e&&t in Ce(e)}function Mr(e,t,r){for(var o=r?Ot:Pt,s=e[0].length,a=e.length,c=a,u=n(a),l=1/0,d=[];c--;){var f=e[c];c&&t&&(f=Rt(f,Jt(t))),l=wn(f.length,l),u[c]=!r&&(t||s>=120&&f.length>=120)?new Xn(c&&f):i}f=e[0];var h=-1,p=u[0];e:for(;++h=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Gr(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)a!==e&&Xe.call(a,c,1),Xe.call(e,c,1);return e}function Kr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;wo(i)?Xe.call(e,i,1):fi(e,i)}}return e}function Xr(e,t){return e+gt(An()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>p)return n;do{t%2&&(n+=e),(t=gt(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return No(ko(e,t,oc),e+"")}function Qr(e){return Qn(qa(e))}function $r(e,t){var n=qa(e);return Do(n,cr(t,0,n.length))}function ei(e,t,n,r){if(!na(e))return e;for(var o=-1,s=(t=wi(t,e)).length,a=s-1,c=e;null!=c&&++oo?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var s=n(o);++i>>1,s=e[o];null!==s&&!la(s)&&(n?s<=t:s=200){var u=t?null:Yi(e);if(u)return dn(u);s=!1,i=$t,c=new Xn}else c=t?[]:a;e:for(;++r=r?e:ii(e,t,n)}var Ai=ct||function(e){return ht.clearTimeout(e)};function Ei(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function _i(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function Ci(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ii(e,t){if(e!==t){var n=e!==i,r=null===e,o=e===e,s=la(e),a=t!==i,c=null===t,u=t===t,l=la(t);if(!c&&!l&&!s&&e>t||s&&a&&u&&!c&&!l||r&&a&&u||!n&&u||!o)return 1;if(!r&&!s&&!l&&e1?n[o-1]:i,a=o>2?n[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&xo(n[0],n[1],a)&&(s=o<3?i:s,o=1),t=Ce(t);++r-1?o[s?t[a]:a]:i}}function Fi(e){return ro((function(t){var n=t.length,r=n,s=Hn.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new Te(o);if(s&&!c&&"wrapper"==ao(a))var c=new Hn([],!0)}for(r=c?r:n;++r1&&v.reverse(),h&&lc))return!1;var l=s.get(e),d=s.get(t);if(l&&d)return l==t&&d==e;var f=-1,h=!0,p=2&n?new Xn:i;for(s.set(e,t),s.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return It(b,(function(n){var r="_."+n[0];t&n[1]&&!Pt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(le):[]}(r),n)))}function Lo(e){var t=0,n=0;return function(){var r=xn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Do(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,as(e,n)}));function ps(e){var t=Vn(e);return t.__chain__=!0,t}function gs(e,t){return t(e)}var ms=ro((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ar(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Wn&&wo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:gs,args:[o],thisArg:i}),new Hn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)}));var bs=Oi((function(e,t,n){Be.call(e,n)?++e[n]:sr(e,n,1)}));var ys=ji(Wo),vs=ji(Go);function ws(e,t){return(Gs(e)?It:hr)(e,uo(t,3))}function xs(e,t){return(Gs(e)?kt:pr)(e,uo(t,3))}var Ss=Oi((function(e,t,n){Be.call(e,n)?e[n].push(t):sr(e,n,[t])}));var As=Jr((function(e,t,r){var i=-1,o="function"==typeof t,s=Ks(e)?n(e.length):[];return hr(e,(function(e){s[++i]=o?_t(t,e,r):Pr(e,t,r)})),s})),Es=Oi((function(e,t,n){sr(e,n,t)}));function _s(e,t){return(Gs(e)?Rt:Fr)(e,uo(t,3))}var Cs=Oi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Is=Jr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&xo(e,t[0],t[1])?t=[]:n>2&&xo(t[0],t[1],t[2])&&(t=[t[0]]),Wr(e,yr(t,1),[])})),ks=dt||function(){return ht.Date.now()};function Ts(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Qi(e,d,i,i,i,i,t)}function Ms(e,t){var n;if("function"!=typeof t)throw new Te(o);return e=ma(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ps=Jr((function(e,t,n){var r=1;if(n.length){var i=ln(n,co(Ps));r|=u}return Qi(e,r,t,n,i)})),Os=Jr((function(e,t,n){var r=3;if(n.length){var i=ln(n,co(Os));r|=u}return Qi(t,r,e,n,i)}));function Rs(e,t,n){var r,s,a,c,u,l,d=0,f=!1,h=!1,p=!0;if("function"!=typeof e)throw new Te(o);function g(t){var n=r,o=s;return r=s=i,d=t,c=e.apply(o,n)}function m(e){return d=e,u=Ro(y,t),f?g(e):c}function b(e){var n=e-l;return l===i||n>=t||n<0||h&&e-d>=a}function y(){var e=ks();if(b(e))return v(e);u=Ro(y,function(e){var n=t-(e-l);return h?wn(n,a-(e-d)):n}(e))}function v(e){return u=i,p&&r?g(e):(r=s=i,c)}function w(){var e=ks(),n=b(e);if(r=arguments,s=this,l=e,n){if(u===i)return m(l);if(h)return Ai(u),u=Ro(y,t),g(l)}return u===i&&(u=Ro(y,t)),c}return t=ya(t)||0,na(n)&&(f=!!n.leading,a=(h="maxWait"in n)?vn(ya(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p),w.cancel=function(){u!==i&&Ai(u),d=0,r=l=s=u=i},w.flush=function(){return u===i?c:v(ks())},w}var Ns=Jr((function(e,t){return dr(e,1,t)})),Bs=Jr((function(e,t,n){return dr(e,ya(t)||0,n)}));function Ls(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Te(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ls.Cache||Kn),n}function Ds(e){if("function"!=typeof e)throw new Te(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ls.Cache=Kn;var Us=xi((function(e,t){var n=(t=1==t.length&&Gs(t[0])?Rt(t[0],Jt(uo())):Rt(yr(t,1),Jt(uo()))).length;return Jr((function(r){for(var i=-1,o=wn(r.length,n);++i=t})),Ws=Or(function(){return arguments}())?Or:function(e){return ra(e)&&Be.call(e,"callee")&&!Ke.call(e,"callee")},Gs=n.isArray,Zs=vt?Jt(vt):function(e){return ra(e)&&Cr(e)==N};function Ks(e){return null!=e&&ta(e.length)&&!$s(e)}function Xs(e){return ra(e)&&Ks(e)}var Ys=yt||yc,Js=wt?Jt(wt):function(e){return ra(e)&&Cr(e)==x};function Qs(e){if(!ra(e))return!1;var t=Cr(e);return t==S||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!sa(e)}function $s(e){if(!na(e))return!1;var t=Cr(e);return t==A||t==E||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ea(e){return"number"==typeof e&&e==ma(e)}function ta(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function na(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ra(e){return null!=e&&"object"==typeof e}var ia=xt?Jt(xt):function(e){return ra(e)&&mo(e)==_};function oa(e){return"number"==typeof e||ra(e)&&Cr(e)==C}function sa(e){if(!ra(e)||Cr(e)!=I)return!1;var t=Ge(e);if(null===t)return!0;var n=Be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ne.call(n)==je}var aa=St?Jt(St):function(e){return ra(e)&&Cr(e)==T};var ca=At?Jt(At):function(e){return ra(e)&&mo(e)==M};function ua(e){return"string"==typeof e||!Gs(e)&&ra(e)&&Cr(e)==P}function la(e){return"symbol"==typeof e||ra(e)&&Cr(e)==O}var da=Et?Jt(Et):function(e){return ra(e)&&ta(e.length)&&!!st[Cr(e)]};var fa=Zi(jr),ha=Zi((function(e,t){return e<=t}));function pa(e){if(!e)return[];if(Ks(e))return ua(e)?pn(e):Mi(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());var t=mo(e);return(t==_?cn:t==M?dn:qa)(e)}function ga(e){return e?(e=ya(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e===e?e:0:0===e?e:0}function ma(e){var t=ga(e),n=t%1;return t===t?n?t-n:t:0}function ba(e){return e?cr(ma(e),0,m):0}function ya(e){if("number"==typeof e)return e;if(la(e))return g;if(na(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=na(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):me.test(e)?g:+e}function va(e){return Pi(e,Na(e))}function wa(e){return null==e?"":li(e)}var xa=Ri((function(e,t){if(_o(t)||Ks(t))Pi(t,Ra(t),e);else for(var n in t)Be.call(t,n)&&nr(e,n,t[n])})),Sa=Ri((function(e,t){Pi(t,Na(t),e)})),Aa=Ri((function(e,t,n,r){Pi(t,Na(t),e,r)})),Ea=Ri((function(e,t,n,r){Pi(t,Ra(t),e,r)})),_a=ro(ar);var Ca=Jr((function(e,t){e=Ce(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&xo(t[0],t[1],o)&&(r=1);++n1),t})),Pi(e,oo(e),n),r&&(n=ur(n,7,to));for(var i=t.length;i--;)fi(n,t[i]);return n}));var Ua=ro((function(e,t){return null==e?{}:function(e,t){return Gr(e,t,(function(t,n){return Ta(e,n)}))}(e,t)}));function ja(e,t){if(null==e)return{};var n=Rt(oo(e),(function(e){return[e]}));return t=uo(t),Gr(e,n,(function(e,n){return t(e,n[0])}))}var Fa=Ji(Ra),Va=Ji(Na);function qa(e){return null==e?[]:Qt(e,Ra(e))}var za=Di((function(e,t,n){return t=t.toLowerCase(),e+(n?Ha(t):t)}));function Ha(e){return Qa(wa(e).toLowerCase())}function Wa(e){return(e=wa(e))&&e.replace(xe,rn).replace($e,"")}var Ga=Di((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Za=Di((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ka=Li("toLowerCase");var Xa=Di((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Ya=Di((function(e,t,n){return e+(n?" ":"")+Qa(t)}));var Ja=Di((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Qa=Li("toUpperCase");function $a(e,t,n){return e=wa(e),(t=n?i:t)===i?function(e){return rt.test(e)}(e)?function(e){return e.match(tt)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var ec=Jr((function(e,t){try{return _t(e,i,t)}catch(n){return Qs(n)?n:new ae(n)}})),tc=ro((function(e,t){return It(t,(function(t){t=jo(t),sr(e,t,Ps(e[t],e))})),e}));function nc(e){return function(){return e}}var rc=Fi(),ic=Fi(!0);function oc(e){return e}function sc(e){return Lr("function"==typeof e?e:ur(e,1))}var ac=Jr((function(e,t){return function(n){return Pr(n,e,t)}})),cc=Jr((function(e,t){return function(n){return Pr(e,n,t)}}));function uc(e,t,n){var r=Ra(t),i=Ar(t,r);null!=n||na(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Ar(t,Ra(t)));var o=!(na(n)&&"chain"in n)||!!n.chain,s=$s(e);return It(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=Mi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Nt([this.value()],arguments))})})),e}function lc(){}var dc=Hi(Rt),fc=Hi(Tt),hc=Hi(Dt);function pc(e){return So(e)?Wt(jo(e)):function(e){return function(t){return Er(t,e)}}(e)}var gc=Gi(),mc=Gi(!0);function bc(){return[]}function yc(){return!1}var vc=zi((function(e,t){return e+t}),0),wc=Xi("ceil"),xc=zi((function(e,t){return e/t}),1),Sc=Xi("floor");var Ac=zi((function(e,t){return e*t}),1),Ec=Xi("round"),_c=zi((function(e,t){return e-t}),0);return Vn.after=function(e,t){if("function"!=typeof t)throw new Te(o);return e=ma(e),function(){if(--e<1)return t.apply(this,arguments)}},Vn.ary=Ts,Vn.assign=xa,Vn.assignIn=Sa,Vn.assignInWith=Aa,Vn.assignWith=Ea,Vn.at=_a,Vn.before=Ms,Vn.bind=Ps,Vn.bindAll=tc,Vn.bindKey=Os,Vn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Gs(e)?e:[e]},Vn.chain=ps,Vn.chunk=function(e,t,r){t=(r?xo(e,t,r):t===i)?1:vn(ma(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,c=n(pt(o/t));so?0:o+n),(r=r===i||r>o?o:ma(r))<0&&(r+=o),r=n>r?0:ba(r);n>>0)?(e=wa(e))&&("string"==typeof t||null!=t&&!aa(t))&&!(t=li(t))&&an(e)?Si(pn(e),0,n):e.split(t,n):[]},Vn.spread=function(e,t){if("function"!=typeof e)throw new Te(o);return t=null==t?0:vn(ma(t),0),Jr((function(n){var r=n[t],i=Si(n,0,t);return r&&Nt(i,r),_t(e,this,i)}))},Vn.tail=function(e){var t=null==e?0:e.length;return t?ii(e,1,t):[]},Vn.take=function(e,t,n){return e&&e.length?ii(e,0,(t=n||t===i?1:ma(t))<0?0:t):[]},Vn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ii(e,(t=r-(t=n||t===i?1:ma(t)))<0?0:t,r):[]},Vn.takeRightWhile=function(e,t){return e&&e.length?pi(e,uo(t,3),!1,!0):[]},Vn.takeWhile=function(e,t){return e&&e.length?pi(e,uo(t,3)):[]},Vn.tap=function(e,t){return t(e),e},Vn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Te(o);return na(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Rs(e,t,{leading:r,maxWait:t,trailing:i})},Vn.thru=gs,Vn.toArray=pa,Vn.toPairs=Fa,Vn.toPairsIn=Va,Vn.toPath=function(e){return Gs(e)?Rt(e,jo):la(e)?[e]:Mi(Uo(wa(e)))},Vn.toPlainObject=va,Vn.transform=function(e,t,n){var r=Gs(e),i=r||Ys(e)||da(e);if(t=uo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:na(e)&&$s(o)?qn(Ge(e)):{}}return(i?It:xr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Vn.unary=function(e){return Ts(e,1)},Vn.union=rs,Vn.unionBy=is,Vn.unionWith=os,Vn.uniq=function(e){return e&&e.length?di(e):[]},Vn.uniqBy=function(e,t){return e&&e.length?di(e,uo(t,2)):[]},Vn.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?di(e,i,t):[]},Vn.unset=function(e,t){return null==e||fi(e,t)},Vn.unzip=ss,Vn.unzipWith=as,Vn.update=function(e,t,n){return null==e?e:hi(e,t,vi(n))},Vn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:hi(e,t,vi(n),r)},Vn.values=qa,Vn.valuesIn=function(e){return null==e?[]:Qt(e,Na(e))},Vn.without=cs,Vn.words=$a,Vn.wrap=function(e,t){return js(vi(t),e)},Vn.xor=us,Vn.xorBy=ls,Vn.xorWith=ds,Vn.zip=fs,Vn.zipObject=function(e,t){return bi(e||[],t||[],nr)},Vn.zipObjectDeep=function(e,t){return bi(e||[],t||[],ei)},Vn.zipWith=hs,Vn.entries=Fa,Vn.entriesIn=Va,Vn.extend=Sa,Vn.extendWith=Aa,uc(Vn,Vn),Vn.add=vc,Vn.attempt=ec,Vn.camelCase=za,Vn.capitalize=Ha,Vn.ceil=wc,Vn.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ya(n))===n?n:0),t!==i&&(t=(t=ya(t))===t?t:0),cr(ya(e),t,n)},Vn.clone=function(e){return ur(e,4)},Vn.cloneDeep=function(e){return ur(e,5)},Vn.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:i)},Vn.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:i)},Vn.conformsTo=function(e,t){return null==t||lr(e,t,Ra(t))},Vn.deburr=Wa,Vn.defaultTo=function(e,t){return null==e||e!==e?t:e},Vn.divide=xc,Vn.endsWith=function(e,t,n){e=wa(e),t=li(t);var r=e.length,o=n=n===i?r:cr(ma(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Vn.eq=qs,Vn.escape=function(e){return(e=wa(e))&&J.test(e)?e.replace(X,on):e},Vn.escapeRegExp=function(e){return(e=wa(e))&&oe.test(e)?e.replace(ie,"\\$&"):e},Vn.every=function(e,t,n){var r=Gs(e)?Tt:gr;return n&&xo(e,t,n)&&(t=i),r(e,uo(t,3))},Vn.find=ys,Vn.findIndex=Wo,Vn.findKey=function(e,t){return jt(e,uo(t,3),xr)},Vn.findLast=vs,Vn.findLastIndex=Go,Vn.findLastKey=function(e,t){return jt(e,uo(t,3),Sr)},Vn.floor=Sc,Vn.forEach=ws,Vn.forEachRight=xs,Vn.forIn=function(e,t){return null==e?e:vr(e,uo(t,3),Na)},Vn.forInRight=function(e,t){return null==e?e:wr(e,uo(t,3),Na)},Vn.forOwn=function(e,t){return e&&xr(e,uo(t,3))},Vn.forOwnRight=function(e,t){return e&&Sr(e,uo(t,3))},Vn.get=ka,Vn.gt=zs,Vn.gte=Hs,Vn.has=function(e,t){return null!=e&&bo(e,t,kr)},Vn.hasIn=Ta,Vn.head=Ko,Vn.identity=oc,Vn.includes=function(e,t,n,r){e=Ks(e)?e:qa(e),n=n&&!r?ma(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),ua(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Vt(e,t,n)>-1},Vn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Vt(e,t,i)},Vn.inRange=function(e,t,n){return t=ga(t),n===i?(n=t,t=0):n=ga(n),function(e,t,n){return e>=wn(t,n)&&e=-9007199254740991&&e<=p},Vn.isSet=ca,Vn.isString=ua,Vn.isSymbol=la,Vn.isTypedArray=da,Vn.isUndefined=function(e){return e===i},Vn.isWeakMap=function(e){return ra(e)&&mo(e)==R},Vn.isWeakSet=function(e){return ra(e)&&"[object WeakSet]"==Cr(e)},Vn.join=function(e,t){return null==e?"":Gt.call(e,t)},Vn.kebabCase=Ga,Vn.last=Qo,Vn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ma(n))<0?vn(r+o,0):wn(o,r-1)),t===t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Ft(e,zt,o,!0)},Vn.lowerCase=Za,Vn.lowerFirst=Ka,Vn.lt=fa,Vn.lte=ha,Vn.max=function(e){return e&&e.length?mr(e,oc,Ir):i},Vn.maxBy=function(e,t){return e&&e.length?mr(e,uo(t,2),Ir):i},Vn.mean=function(e){return Ht(e,oc)},Vn.meanBy=function(e,t){return Ht(e,uo(t,2))},Vn.min=function(e){return e&&e.length?mr(e,oc,jr):i},Vn.minBy=function(e,t){return e&&e.length?mr(e,uo(t,2),jr):i},Vn.stubArray=bc,Vn.stubFalse=yc,Vn.stubObject=function(){return{}},Vn.stubString=function(){return""},Vn.stubTrue=function(){return!0},Vn.multiply=Ac,Vn.nth=function(e,t){return e&&e.length?Hr(e,ma(t)):i},Vn.noConflict=function(){return ht._===this&&(ht._=Fe),this},Vn.noop=lc,Vn.now=ks,Vn.pad=function(e,t,n){e=wa(e);var r=(t=ma(t))?hn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Wi(gt(i),n)+e+Wi(pt(i),n)},Vn.padEnd=function(e,t,n){e=wa(e);var r=(t=ma(t))?hn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=An();return wn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Xr(e,t)},Vn.reduce=function(e,t,n){var r=Gs(e)?Bt:Zt,i=arguments.length<3;return r(e,uo(t,4),n,i,hr)},Vn.reduceRight=function(e,t,n){var r=Gs(e)?Lt:Zt,i=arguments.length<3;return r(e,uo(t,4),n,i,pr)},Vn.repeat=function(e,t,n){return t=(n?xo(e,t,n):t===i)?1:ma(t),Yr(wa(e),t)},Vn.replace=function(){var e=arguments,t=wa(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Vn.result=function(e,t,n){var r=-1,o=(t=wi(t,e)).length;for(o||(o=1,e=i);++rp)return[];var n=m,r=wn(e,m);t=uo(t),e-=m;for(var i=Xt(r,t);++n=s)return e;var c=n-hn(r);if(c<1)return r;var u=a?Si(a,0,c).join(""):e.slice(0,c);if(o===i)return u+r;if(a&&(c+=u.length-c),aa(o)){if(e.slice(c).search(o)){var l,d=u;for(o.global||(o=Ie(o.source,wa(ge.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var f=l.index;u=u.slice(0,f===i?c:f)}}else if(e.indexOf(li(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+r},Vn.unescape=function(e){return(e=wa(e))&&Y.test(e)?e.replace(K,mn):e},Vn.uniqueId=function(e){var t=++Le;return wa(e)+t},Vn.upperCase=Ja,Vn.upperFirst=Qa,Vn.each=ws,Vn.eachRight=xs,Vn.first=Ko,uc(Vn,function(){var e={};return xr(Vn,(function(t,n){Be.call(Vn.prototype,n)||(e[n]=t)})),e}(),{chain:!1}),Vn.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Vn[e].placeholder=Vn})),It(["drop","take"],(function(e,t){Wn.prototype[e]=function(n){n=n===i?1:vn(ma(n),0);var r=this.__filtered__&&!t?new Wn(this):this.clone();return r.__filtered__?r.__takeCount__=wn(n,r.__takeCount__):r.__views__.push({size:wn(n,m),type:e+(r.__dir__<0?"Right":"")}),r},Wn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),It(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Wn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:uo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),It(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Wn.prototype[e]=function(){return this[n](1).value()[0]}})),It(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Wn.prototype[e]=function(){return this.__filtered__?new Wn(this):this[n](1)}})),Wn.prototype.compact=function(){return this.filter(oc)},Wn.prototype.find=function(e){return this.filter(e).head()},Wn.prototype.findLast=function(e){return this.reverse().find(e)},Wn.prototype.invokeMap=Jr((function(e,t){return"function"==typeof e?new Wn(this):this.map((function(n){return Pr(n,e,t)}))})),Wn.prototype.reject=function(e){return this.filter(Ds(uo(e)))},Wn.prototype.slice=function(e,t){e=ma(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Wn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=ma(t))<0?n.dropRight(-t):n.take(t-e)),n)},Wn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Wn.prototype.toArray=function(){return this.take(m)},xr(Wn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Vn[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);o&&(Vn.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,c=t instanceof Wn,u=a[0],l=c||Gs(t),d=function(e){var t=o.apply(Vn,Nt([e],a));return r&&f?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,h=!!this.__actions__.length,p=s&&!f,g=c&&!h;if(!s&&l){t=g?t:new Wn(this);var m=e.apply(t,a);return m.__actions__.push({func:gs,args:[d],thisArg:i}),new Hn(m,f)}return p&&g?e.apply(this,a):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})})),It(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Me[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Vn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Gs(i)?i:[],e)}return this[n]((function(n){return t.apply(Gs(n)?n:[],e)}))}})),xr(Wn.prototype,(function(e,t){var n=Vn[t];if(n){var r=n.name+"";Be.call(On,r)||(On[r]=[]),On[r].push({name:t,func:n})}})),On[Vi(i,2).name]=[{name:"wrapper",func:i}],Wn.prototype.clone=function(){var e=new Wn(this.__wrapped__);return e.__actions__=Mi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Mi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Mi(this.__views__),e},Wn.prototype.reverse=function(){if(this.__filtered__){var e=new Wn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Wn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Gs(e),r=t<0,i=n?e.length:0,o=function(e,t,n){var r=-1,i=n.length;for(;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Vn.prototype.plant=function(e){for(var t,n=this;n instanceof zn;){var r=Vo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Vn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Wn){var t=e;return this.__actions__.length&&(t=new Wn(this)),(t=t.reverse()).__actions__.push({func:gs,args:[ns],thisArg:i}),new Hn(t,this.__chain__)}return this.thru(ns)},Vn.prototype.toJSON=Vn.prototype.valueOf=Vn.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},Vn.prototype.first=Vn.prototype.head,Je&&(Vn.prototype[Je]=function(){return this}),Vn}();ht._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},79746:function(e){function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},34504:function(e,t){"use strict";var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}},29204:function(e){function t(e,t){if(!e)throw new Error(t||"AssertionError")}t.notEqual=function(e,n,r){t(e!=n,r)},t.notOk=function(e,n){t(!e,n)},t.equal=function(e,n,r){t(e==n,r)},t.ok=t,e.exports=t},98255:function(e,t,n){"use strict";var r=n(59499),i=n(67294),o=n(80967),s=n(54335),a=n(85893);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}t.Z=i.memo((0,s.ZP)((function(e){return(0,a.jsx)(o.Z,function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=e.className,n=e.children,r=e.style,o=void 0===r?{}:r,s=(0,i.Z)(e,u);return(0,c.jsxs)("div",d(d({className:t,style:d({display:"flex"},o)},s),{},{children:[(0,c.jsx)("div",{style:{flex:1,height:1,width:1}}),n,(0,c.jsx)("div",{style:{flex:1,height:1,width:1}})]}))}var h=a.ZP.div.withConfig({displayName:"layout__RowFlex",componentId:"sc-11ag14j-0"})(["display:flex;flex-direction:row;"]),p=a.ZP.div.withConfig({displayName:"layout__ColFlex",componentId:"sc-11ag14j-1"})(["display:flex;flex-direction:column;"]),g="Crust Files";t.ZP=(0,a.ZP)((function(e){var t=e.children,n=e.className;return(0,c.jsxs)("div",{className:n,children:[(0,c.jsxs)(s(),{children:[(0,c.jsx)("link",{rel:"icon",href:"/favicon.ico"}),(0,c.jsx)("meta",{name:"description",content:"Crust Files, the Web3.0 file storage application"}),(0,c.jsx)("meta",{name:"og:title",content:g})]}),t]})})).withConfig({displayName:"layout",componentId:"sc-11ag14j-2"})(["width:100%;height:100%;max-height:100%;overflow:auto;"])},90356:function(e,t,n){"use strict";n.d(t,{Il:function(){return i},qD:function(){return s},wI:function(){return o}});var r=n(67294),i=r.createContext(null),o=i.Provider;function s(){return(0,r.useContext)(i)}},10720:function(e,t,n){"use strict";n.d(t,{Dl:function(){return o},OF:function(){return c},g6:function(){return u},ok:function(){return d},qi:function(){return s},rs:function(){return l},up:function(){return a}});var r=n(39374),i=n(22134);function o(e){return[{location:e("\ufe0fShanghai"),text:e("\ufe0f\u26a1 Thunder Gateway"),value:"https://gw.crustfiles.net"},{location:e("Singapore"),text:e("DCF"),value:"https://crustipfs.xyz"},{location:e("United States"),text:e("Crust Network"),value:"https://ipfs-gw.decloud.foundation"},{location:e("Henan"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.w3ipfs.cn:10443"},{location:e("Los Angeles"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.smallwolf.me"},{location:e("Henan"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.w3ipfs.com:7443"},{location:e("Henan Unicom"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.w3ipfs.net:7443"},{location:e("Helsinki"),text:e("\ufe0fcrust-fans"),value:"https://crust.fans"},{location:e("Phoenix"),text:e("\ufe0fcrustgateway"),value:"https://crustgateway.com"},{location:e("Germany"),text:e("\ufe0fcrustgateway-de"),value:"https://crustgateway.online"},{location:e("Los Angeles"),text:e("\ufe0fCrust IPFS GW"),value:"https://gw.w3ipfs.org.cn"},{location:e("Shanghai"),text:e("Area51-GW"),value:"https://223.111.148.195"},{location:e("Shanghai"),text:e("Crato-GW"),value:"https://223.111.148.196"}]}function s(e){return[{text:e("Crust Pinner"),value:"https://pin.crustcode.com"}]}var a="https://chrome.google.com/webstore/detail/crust-wallet/jccapkebeeiajkkdemacblkjhhhboiek",c="https://swap.crust.network",u=r.T?"beta":"prod",l=function(){return r.T?"https://files-api.decoo.io":"https://api.".concat(i.Kh.value)},d=r.T?"f8bd392f-2ff5-4dc7-bedd-1be9f175885b":"09ef6613-21f0-4fb6-ab1f-ded9bedb291e"},39374:function(e,t,n){"use strict";n.d(t,{T:function(){return r}});var r=!1},22134:function(e,t,n){"use strict";n.d(t,{Kh:function(){return i},Vi:function(){return s}});var r=n(67294),i={value:"crustfiles.io"},o=["crustfiles.io","crustfiles.com","crustfiles.xyz"];function s(){(0,r.useEffect)((function(){i.value=function(){var e;if("localhost"==location.hostname)return o[0];if(1==(null===(e=location.hostname.match(/^\d+\.\d+\.\d+\.\d+$/))||void 0===e?void 0:e.length))return o[0];var t=location.hostname.split("."),n=t.slice(-2).join(".");return"ipns"==t[1]&&(n=t[0].replaceAll("-",".")),o.includes(n)?location.hostname:o[0]}()}),[])}},61509:function(e,t,n){"use strict";n.d(t,{$7:function(){return x},Cn:function(){return P},KL:function(){return E},PF:function(){return S},Pk:function(){return b},Pw:function(){return w},Y1:function(){return y},a6:function(){return h},fV:function(){return d},fb:function(){return g},ie:function(){return I},lK:function(){return f},on:function(){return M},tO:function(){return O},uJ:function(){return c},w2:function(){return m},w8:function(){return k},wJ:function(){return C},we:function(){return p},y7:function(){return A},yS:function(){return _},zo:function(){return v},zv:function(){return T}});var r=n(59499),i=n(9669),o=n.n(i);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var a=n(10720).rs,c=function(e){return"".concat(a()).concat(e)};function u(e){if(200===e.data.code)return e.data.data;throw function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"";return o().post(c("/common/rewardsHistory"),{address:e}).then(u)}function k(e){return o().post(c("/common/external/address"),{address:e}).then(u)}function T(e){return o().post(c("/common/members"),{address:e}).then(u)}function M(e){return o().get(c("/common/grandDraw/".concat(e,"/winners"))).then(u)}function P(e,t){return o().post(c("/common/calculateShortLinkHash"),{cid:e,options:t}).then(u)}function O(e){return o().get(c("/common/shortLinkInfo/".concat(e))).then(u)}},5320:function(e,t,n){"use strict";n.d(t,{g:function(){return h},o:function(){return d}});var r=n(50029),i=n(87794),o=n.n(i),s=n(67294),a=n(39468),c=n(61027),u=n(27774),l=["wss://rpc.crust.network","wss://rpc-crust-mainnet.decoo.io"];function d(e){return f.apply(this,arguments)}function f(){return(f=(0,r.Z)(o().mark((function e(t){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=null!==t&&void 0!==t?t:new a.U(l,5e3)).on("error",console.error),e.next=4,new c.G({provider:n,typesBundle:u.typesBundleForPolkadot}).isReady;case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(){var e=(0,s.useState)(null),t=e[0],n=e[1];return(0,s.useEffect)((function(){var e=new a.U(l,5e3);e.on("error",console.error),new c.G({provider:e,typesBundle:u.typesBundleForPolkadot}).isReady.then(n).catch(console.error)}),[]),t}},69168:function(e,t,n){"use strict";n.d(t,{Zn:function(){return u},ms:function(){return l}});var r=n(59499),i=n(67294),o=n(90356),s=n(39374);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t",e,t),c(c({},t),{},(0,r.Z)({},e.key,e.value))}))}}}function l(e){var t=(0,o.qD)().store,n=t.store,r=t.update;return(0,i.useEffect)((function(){return e.value&&r(e)}),[e.value]),n}},62020:function(e,t,n){"use strict";n.d(t,{AR:function(){return v},GY:function(){return p},K3:function(){return w},Or:function(){return y},Sk:function(){return h},Sq:function(){return b},az:function(){return x},lS:function(){return l},vr:function(){return d},yn:function(){return m},zw:function(){return f}});var r=n(49495),i=n(89048),o=n(35226),s=n(96486),a=n.n(s),c=n(94316),u=n.n(c),l=(n(48764).Buffer,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;return e.length>2*t?"".concat(e.substring(0,t),"...").concat(e.substring(e.length-t)):e}),d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n="".concat(e.trim()),r=n.indexOf(".");for(r>=0&&n.length-r-1>t&&(n=n.substring(0,r+t+1));"0"!==n&&n.endsWith("0");)n=n.substring(0,n.length-1);return n.endsWith(".")?n.substring(0,n.length-1):n},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!e)return"-";var n=(0,o.a)(e,{decimals:12,forceUnit:"Unit",withSi:!1});return d(n,t)},h=function(e){window.open("".concat(window.location.origin).concat(e),"_blank")},p=function(e){return"".concat(window.location.origin).concat(e)};function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";if(e!==t&&null!==e&&void 0!==e){var n=a().toNumber(e),r=n<0?0:n;return u()(r).format({thousandSeparated:!0})}return t}function m(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"-";return g(a().get(e,t,n),n)}var b=function(e,t){return e.events.find((function(e){return"".concat(e.event.section.toString(),"(").concat(e.event.method.toString(),")")===t}))},y=function(e){return(0,r.m)((0,i.m)(e),66)},v=function(e,t){return y(e)===y(t)},w=function(e,t){return e.length<=t?e:e.substring(0,e.length-t)},x=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Network Error",n=t;"string"==typeof e?n=e:"string"==typeof(null===e||void 0===e?void 0:e.msg)?n=null===e||void 0===e?void 0:e.msg:"string"==typeof(null===e||void 0===e?void 0:e.message)&&(n=null===e||void 0===e?void 0:e.message);var r=n.toLowerCase();return r.includes("denied")||r.includes("rejected")||r.includes("declined")?"You declined the action in your wallet.":n.includes("transaction failed")?"Transaction failed":n}},44232:function(e,t,n){"use strict";n.d(t,{p$:function(){return zt},aB:function(){return Vt},gE:function(){return Ht},XH:function(){return qt},s3:function(){return jt}});var r=n(59499);function i(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const o=i({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});var s=n(95946);function a(e,t){return({exclude:n,format:r})=>({exclude:n,format:e=>{const i=t(e);if(n)for(const t of n)delete i[t];return{...i,...r(e)}},type:e})}const c={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function u(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?(0,s.ly)(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?(0,s.ly)(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?c[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(t.authorizationList=e.authorizationList.map((e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)})))),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"===typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),"eip1559"===t.type&&delete t.maxFeePerBlobGas,t}const l=a("transaction",u);function d(e){const t=(e.transactions??[]).map((e=>"string"===typeof e?e:u(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const f=a("block",d);function h(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const p={"0x0":"reverted","0x1":"success"};function g(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>h(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?(0,s.ly)(e.transactionIndex):null,status:e.status?p[e.status]:null,type:e.type?c[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const m=a("transactionReceipt",g),b={block:f({format(e){const t=e.transactions?.map((e=>{if("string"===typeof e)return e;const t=u(e);return"0x7e"===t.typeHex&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?(0,s.y_)(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}));return{transactions:t,stateRoot:e.stateRoot}}}),transaction:l({format(e){const t={};return"0x7e"===e.type&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?(0,s.y_)(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:m({format:e=>({l1GasPrice:e.l1GasPrice?(0,s.y_)(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?(0,s.y_)(e.l1GasUsed):null,l1Fee:e.l1Fee?(0,s.y_)(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null})})};var y=n(36117);class v extends y.G{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class w extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}var x=n(11187);function S(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function A(e,...t){if(!((n=e)instanceof Uint8Array||null!=n&&"object"===typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Uint8Array expected");var n;if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function E(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function _(e,t){A(e);const n=t.outputLen;if(e.length>I&C)}:{h:0|Number(e>>I&C),l:0|Number(e&C)}}function T(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;ie<>>32-n,P=(e,t,n)=>t<>>32-n,O=(e,t,n)=>t<>>64-n,R=(e,t,n)=>e<>>64-n;const N=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),B=(e,t)=>e<<32-t|e>>>t,L=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],D=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;function U(e){for(let t=0;te().update(j(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const q=[],z=[],H=[],W=BigInt(0),G=BigInt(1),Z=BigInt(2),K=BigInt(7),X=BigInt(256),Y=BigInt(113);for(let Wt=0,Gt=G,Zt=1,Kt=0;Wt<24;Wt++){[Zt,Kt]=[Kt,(2*Zt+3*Kt)%5],q.push(2*(5*Kt+Zt)),z.push((Wt+1)*(Wt+2)/2%64);let e=W;for(let t=0;t<7;t++)Gt=(Gt<>K)*Y)%X,Gt&Z&&(e^=G<<(G<n>32?O(e,t,n):M(e,t,n),ee=(e,t,n)=>n>32?R(e,t,n):P(e,t,n);class te extends F{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,S(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){L||U(this.state32),function(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const t=(r+8)%10,i=(r+2)%10,o=n[i],s=n[i+1],a=$(o,s,1)^n[t],c=ee(o,s,1)^n[t+1];for(let n=0;n<50;n+=10)e[r+n]^=a,e[r+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=z[n],o=$(t,i,r),s=ee(t,i,r),a=q[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let r=0;r<50;r+=10){for(let t=0;t<10;t++)n[t]=e[r+t];for(let t=0;t<10;t++)e[r+t]^=~n[(t+2)%10]&n[(t+4)%10]}e[0]^=J[r],e[1]^=Q[r]}n.fill(0)}(this.state32,this.rounds),L||U(this.state32),this.posOut=0,this.pos=0}update(e){E(this);const{blockLen:t,state:n}=this,r=(e=j(e)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return S(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(_(e,this),this.finished)throw new 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(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new te(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const ne=(e,t,n)=>V((()=>new te(t,e,n))),re=ne(1,136,32);var ie=n(15102),oe=n(92106);const se=new w(8192);function ae(e,t){if(se.has(`${e}.${t}`))return se.get(`${e}.${t}`);const n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=function(e,t){const n=t||"hex",r=re((0,ie.v)(e,{strict:!1})?(0,x.O0)(e):e);return"bytes"===n?r:(0,oe.NC)(r)}((0,x.qX)(n),"bytes"),i=(t?n.substring(`${t}0x`.length):n).split("");for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&i[s]&&(i[s]=i[s].toUpperCase()),(15&r[s>>1])>=8&&i[s+1]&&(i[s+1]=i[s+1].toUpperCase());const o=`0x${i.join("")}`;return se.set(`${e}.${t}`,o),o}const ce=/^0x[a-fA-F0-9]{40}$/,ue=new w(8192);function le(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(ue.has(r))return ue.get(r);const i=!!ce.test(e)&&(e.toLowerCase()===e||!n||ae(e)===e);return ue.set(r,i),i}function de(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}class fe extends y.G{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class he extends y.G{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class pe extends y.G{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ge={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new pe({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new he({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new fe({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new fe({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function me(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ge);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function be(e,t="hex"){const n=ye(e),r=me(new Uint8Array(n.length));return n.encode(r),"hex"===t?(0,oe.ci)(r.bytes):r.bytes}function ye(e){return Array.isArray(e)?function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=ve(t);return{length:t<=55?1+t:1+n+t,encode(r){t<=55?r.pushByte(192+t):(r.pushByte(247+n),1===n?r.pushUint8(t):2===n?r.pushUint16(t):3===n?r.pushUint24(t):r.pushUint32(t));for(const{encode:t}of e)t(r)}}}(e.map((e=>ye(e)))):function(e){const t="string"===typeof e?(0,x.nr)(e):e,n=ve(t.length);return{length:1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+n),1===n?e.pushUint8(t.length):2===n?e.pushUint16(t.length):3===n?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function ve(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new y.G("Length is too large.")}function we(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),n=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(n+1)} ${t}`)).join("\n")}class xe extends y.G{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class Se extends y.G{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",we(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class Ae extends y.G{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}function Ee(e){const{kzg:t}=e,n=e.to??("string"===typeof e.blobs[0]?"hex":"bytes"),r="string"===typeof e.blobs[0]?e.blobs.map((e=>(0,x.nr)(e))):e.blobs,i=[];for(const o of r)i.push(Uint8Array.from(t.blobToKzgCommitment(o)));return"bytes"===n?i:i.map((e=>(0,oe.ci)(e)))}function _e(e){const{kzg:t}=e,n=e.to??("string"===typeof e.blobs[0]?"hex":"bytes"),r="string"===typeof e.blobs[0]?e.blobs.map((e=>(0,x.nr)(e))):e.blobs,i="string"===typeof e.commitments[0]?e.commitments.map((e=>(0,x.nr)(e))):e.commitments,o=[];for(let s=0;s(0,oe.ci)(e)))}const Ce=(e,t,n)=>e&t^~e&n,Ie=(e,t,n)=>e&t^e&n^t&n;class ke extends F{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=N(this.buffer)}update(e){E(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=j(e)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let l=o;l>i&o),a=Number(n&o),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=N(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l>>3,r=B(t,17)^B(t,19)^t>>>10;Pe[l]=r+Pe[l-7]+n+Pe[l-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let l=0;l<64;l++){const e=u+(B(s,6)^B(s,11)^B(s,25))+Ce(s,a,c)+Te[l]+Pe[l]|0,t=(B(n,2)^B(n,13)^B(n,22))+Ie(n,r,i)|0;u=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,i,o,s,a,c,u)}roundClean(){Pe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Re=V((()=>new Oe));function Ne(e,t){const n=t||"hex",r=Re((0,ie.v)(e,{strict:!1})?(0,x.O0)(e):e);return"bytes"===n?r:(0,oe.NC)(r)}function Be(e){const{commitment:t,version:n=1}=e,r=e.to??("string"===typeof t?"hex":"bytes"),i=Ne(t,"bytes");return i.set([n],0),"bytes"===r?i:(0,oe.ci)(i)}const Le=4096,De=131072,Ue=761855;class je extends y.G{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`],name:"BlobSizeTooLargeError"})}}class Fe extends y.G{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class Ve extends y.G{constructor({hash:e,size:t}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${t}`],name:"InvalidVersionedHashSizeError"})}}class qe extends y.G{constructor({hash:e,version:t}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:["Expected: 1",`Received: ${t}`],name:"InvalidVersionedHashVersionError"})}}var ze=n(39135);function He(e){const{data:t,kzg:n,to:r}=e,i=e.blobs??function(e){const t=e.to??("string"===typeof e.data?"hex":"bytes"),n="string"===typeof e.data?(0,x.nr)(e.data):e.data,r=(0,ze.d)(n);if(!r)throw new Fe;if(r>Ue)throw new je({maxSize:Ue,size:r});const i=[];let o=!0,s=0;for(;o;){const e=me(new Uint8Array(De));let t=0;for(;te.bytes)):i.map((e=>(0,oe.ci)(e.bytes)))}({data:t,to:r}),o=e.commitments??Ee({blobs:i,kzg:n,to:r}),s=e.proofs??_e({blobs:i,commitments:o,kzg:n,to:r}),a=[];for(let c=0;c0&&t>(0,ze.d)(e)-1)throw new at.mV({offset:t,position:"start",size:(0,ze.d)(e)})}function lt(e,t,n){if("number"===typeof t&&"number"===typeof n&&(0,ze.d)(e)!==n-t)throw new at.mV({offset:n,position:"end",size:(0,ze.d)(e)})}function dt(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:i}=e;if(t<=0)throw new Ze({chainId:t});if(i&&!le(i))throw new v({address:i});if(r&&r>Ge)throw new Je({maxFeePerGas:r});if(n&&r&&n>r)throw new st({maxFeePerGas:r,maxPriorityFeePerGas:n})}function ft(e){if(!e||0===e.length)return[];const t=[];for(let n=0;nGe)throw new Je({maxFeePerGas:r})}(e);const l=ft(c);return de(["0x01",be([(0,oe.NC)(n),o?(0,oe.NC)(o):"0x",u?(0,oe.NC)(u):"0x",r?(0,oe.NC)(r):"0x",s??"0x",a?(0,oe.NC)(a):"0x",i??"0x",l,...pt(e,t)])])}(e,t):"eip4844"===n?function(e,t){const{chainId:n,gas:r,nonce:i,to:o,value:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:l,accessList:d,data:f}=e;!function(e){const{blobVersionedHashes:t}=e;if(t){if(0===t.length)throw new Fe;for(const e of t){const t=(0,ze.d)(e),n=(0,s.ly)(ct(e,0,1));if(32!==t)throw new Ve({hash:e,size:t});if(1!==n)throw new qe({hash:e,version:n})}}dt(e)}(e);let h=e.blobVersionedHashes,p=e.sidecars;if(e.blobs&&("undefined"===typeof h||"undefined"===typeof p)){const t="string"===typeof e.blobs[0]?e.blobs:e.blobs.map((e=>(0,oe.ci)(e))),n=e.kzg,r=Ee({blobs:t,kzg:n});if("undefined"===typeof h&&(h=function(e){const{commitments:t,version:n}=e,r=e.to??("string"===typeof t[0]?"hex":"bytes"),i=[];for(const o of t)i.push(Be({commitment:o,to:r,version:n}));return i}({commitments:r})),"undefined"===typeof p){p=He({blobs:t,commitments:r,proofs:_e({blobs:t,commitments:r,kzg:n})})}}const g=ft(d),m=[(0,oe.NC)(n),i?(0,oe.NC)(i):"0x",l?(0,oe.NC)(l):"0x",u?(0,oe.NC)(u):"0x",r?(0,oe.NC)(r):"0x",o??"0x",a?(0,oe.NC)(a):"0x",f??"0x",g,c?(0,oe.NC)(c):"0x",h??[],...pt(e,t)],b=[],y=[],v=[];if(p)for(let s=0;sGe)throw new Je({maxFeePerGas:r})}(e);let u=[o?(0,oe.NC)(o):"0x",c?(0,oe.NC)(c):"0x",r?(0,oe.NC)(r):"0x",s??"0x",a?(0,oe.NC)(a):"0x",i??"0x"];if(t){const e=(()=>{if(t.v>=35n){return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n)}if(n>0)return BigInt(2*n)+BigInt(35n+t.v-27n);const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new xe({v:t.v});return e})(),r=We(t.r),i=We(t.s);u=[...u,(0,oe.NC)(e),"0x00"===r?"0x":r,"0x00"===i?"0x":i]}else n>0&&(u=[...u,(0,oe.NC)(n),"0x","0x"]);return be(u)}(e,t)}function pt(e,t){const n=t??e,{v:r,yParity:i}=n;if("undefined"===typeof n.r)return[];if("undefined"===typeof n.s)return[];if("undefined"===typeof r&&"undefined"===typeof i)return[];const o=We(n.r),s=We(n.s);return["number"===typeof i?i?(0,oe.NC)(1):"0x":0n===r?"0x":1n===r?(0,oe.NC)(1):27n===r?"0x":(0,oe.NC)(1),"0x00"===o?"0x":o,"0x00"===s?"0x":s]}const gt={transaction:function(e,t){return function(e){return"deposit"===e.type||"undefined"!==typeof e.sourceHash}(e)?function(e){!function(e){const{from:t,to:n}=e;if(t&&!le(t))throw new v({address:t});if(n&&!le(n))throw new v({address:n})}(e);const{sourceHash:t,data:n,from:r,gas:i,isSystemTx:o,mint:s,to:a,value:c}=e;return de(["0x7e",be([t,r,a??"0x",s?(0,oe.NC)(s):"0x",c?(0,oe.NC)(c):"0x",i?(0,oe.NC)(i):"0x",o?"0x1":"0x",n??"0x"])])}(e):ht(e,t)}};const mt={contracts:{gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters:b,serializers:gt},bt=i({...mt,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...mt.contracts,disputeGameFactory:{1:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{1:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{1:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{1:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:1}),yt=i({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),vt={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function wt(e){const t={};return"undefined"!==typeof e.authorizationList&&(t.authorizationList=e.authorizationList.map((e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:(0,oe.eC)(e.chainId),nonce:(0,oe.eC)(e.nonce),..."undefined"!==typeof e.yParity?{yParity:(0,oe.eC)(e.yParity)}:{},..."undefined"!==typeof e.v&&"undefined"===typeof e.yParity?{v:(0,oe.eC)(e.v)}:{}})))),"undefined"!==typeof e.accessList&&(t.accessList=e.accessList),"undefined"!==typeof e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),"undefined"!==typeof e.blobs&&("string"!==typeof e.blobs[0]?t.blobs=e.blobs.map((e=>(0,oe.ci)(e))):t.blobs=e.blobs),"undefined"!==typeof e.data&&(t.data=e.data),"undefined"!==typeof e.from&&(t.from=e.from),"undefined"!==typeof e.gas&&(t.gas=(0,oe.eC)(e.gas)),"undefined"!==typeof e.gasPrice&&(t.gasPrice=(0,oe.eC)(e.gasPrice)),"undefined"!==typeof e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=(0,oe.eC)(e.maxFeePerBlobGas)),"undefined"!==typeof e.maxFeePerGas&&(t.maxFeePerGas=(0,oe.eC)(e.maxFeePerGas)),"undefined"!==typeof e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=(0,oe.eC)(e.maxPriorityFeePerGas)),"undefined"!==typeof e.nonce&&(t.nonce=(0,oe.eC)(e.nonce)),"undefined"!==typeof e.to&&(t.to=e.to),"undefined"!==typeof e.type&&(t.type=vt[e.type]),"undefined"!==typeof e.value&&(t.value=(0,oe.eC)(e.value)),t}const xt=a("transactionRequest",wt);const St=50000n,At=32n*(2n**16n-1n),Et={block:f({format(e){const t=e.transactions?.map((e=>{if("string"===typeof e)return e;const t=Et.transaction?.format(e);return"0x71"===t.typeHex?t.type="eip712":"0xff"===t.typeHex&&(t.type="priority"),t}));return{l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,l1BatchTimestamp:e.l1BatchTimestamp?(0,s.y_)(e.l1BatchTimestamp):null,transactions:t}}}),transaction:l({format(e){const t={};return"0x71"===e.type?t.type="eip712":"0xff"===e.type&&(t.type="priority"),{...t,l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?(0,s.y_)(e.l1BatchTxIndex):null}}}),transactionReceipt:m({format:e=>({l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?(0,s.y_)(e.l1BatchTxIndex):null,logs:e.logs.map((e=>({...h(e),l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,transactionLogIndex:(0,s.ly)(e.transactionLogIndex),logType:e.logType}))),l2ToL1Logs:e.l2ToL1Logs.map((e=>({blockNumber:(0,s.y_)(e.blockHash),blockHash:e.blockHash,l1BatchNumber:e.l1BatchNumber?(0,s.y_)(e.l1BatchNumber):null,transactionIndex:(0,s.y_)(e.transactionIndex),shardId:(0,s.y_)(e.shardId),isService:e.isService,sender:e.sender,key:e.key,value:e.value,transactionHash:e.transactionHash,logIndex:(0,s.y_)(e.logIndex)})))})}),transactionRequest:xt({exclude:["customSignature","factoryDeps","gasPerPubdata","paymaster","paymasterInput"],format:e=>e.gasPerPubdata||e.paymaster&&e.paymasterInput||e.factoryDeps||e.customSignature?{eip712Meta:{...e.gasPerPubdata?{gasPerPubdata:(0,oe.NC)(e.gasPerPubdata)}:{gasPerPubdata:(0,oe.NC)(St)},...e.paymaster&&e.paymasterInput?{paymasterParams:{paymaster:e.paymaster,paymasterInput:Array.from((0,x.nr)(e.paymasterInput))}}:{},...e.factoryDeps?{factoryDeps:e.factoryDeps.map((e=>Array.from((0,x.nr)(e))))}:{},...e.customSignature?{customSignature:Array.from((0,x.nr)(e.customSignature))}:{}},type:"0x71"}:{}})};class _t extends y.G{constructor(){super(["Transaction is not an EIP712 transaction.","","Transaction must:",' - include `type: "eip712"`'," - include one of the following: `customSignature`, `paymaster`, `paymasterInput`, `gasPerPubdata`, `factoryDeps`"].join("\n"),{name:"InvalidEip712TransactionError"})}}function Ct(e){return"eip712"===e.type||!!("customSignature"in e&&e.customSignature||"paymaster"in e&&e.paymaster||"paymasterInput"in e&&e.paymasterInput||"gasPerPubdata"in e&&"bigint"===typeof e.gasPerPubdata||"factoryDeps"in e&&e.factoryDeps)}function It(e){const{chainId:t,to:n,from:r,paymaster:i,paymasterInput:o}=e;if(!Ct(e))throw new _t;if(!t||t<=0)throw new Ze({chainId:t});if(n&&!le(n))throw new v({address:n});if(r&&!le(r))throw new v({address:r});if(i&&!le(i))throw new v({address:i});if(i&&!o)throw new y.G("`paymasterInput` must be provided when `paymaster` is defined");if(!i&&o)throw new y.G("`paymaster` must be provided when `paymasterInput` is defined")}const kt={transaction:function(e,t){return Ct(e)?function(e){const{chainId:t,gas:n,nonce:r,to:i,from:o,value:s,maxFeePerGas:a,maxPriorityFeePerGas:c,customSignature:u,factoryDeps:l,paymaster:d,paymasterInput:f,gasPerPubdata:h,data:p}=e;It(e);return de(["0x71",be([r?(0,oe.NC)(r):"0x",c?(0,oe.NC)(c):"0x",a?(0,oe.NC)(a):"0x",n?(0,oe.NC)(n):"0x",i??"0x",s?(0,oe.NC)(s):"0x",p??"0x0",(0,oe.NC)(t),(0,oe.NC)(""),(0,oe.NC)(""),(0,oe.NC)(t),o??"0x",h?(0,oe.NC)(h):(0,oe.NC)(St),l??[],u??"0x",d&&f?[d,f]:[]])])}(e):ht(e,t)}};var Tt=n(61769);class Mt extends y.G{constructor({givenLength:e,maxBytecodeSize:t}){super(`Bytecode cannot be longer than ${t} bytes. Given length: ${e}`,{name:"BytecodeLengthExceedsMaxSizeError"})}}class Pt extends y.G{constructor({givenLengthInWords:e}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${e}`,{name:"BytecodeLengthInWordsMustBeOddError"})}}class Ot extends y.G{constructor({givenLength:e}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${e}`,{name:"BytecodeLengthMustBeDivisibleBy32Error"})}}const Rt={formatters:Et,serializers:kt,custom:{getEip712Domain:e=>{It(e);const t=function(e){const{gas:t,nonce:n,to:r,from:i,value:o,maxFeePerGas:s,maxPriorityFeePerGas:a,factoryDeps:c,paymaster:u,paymasterInput:l,gasPerPubdata:d,data:f}=e;return{txType:113n,from:BigInt(i),to:r?BigInt(r):0n,gasLimit:t??0n,gasPerPubdataByteLimit:d??St,maxFeePerGas:s??0n,maxPriorityFeePerGas:a??0n,paymaster:u?BigInt(u):0n,nonce:n?BigInt(n):0n,value:o??0n,data:f||"0x0",factoryDeps:c?.map((e=>(0,oe.NC)(function(e){const t=(0,x.O0)(e);if(t.length%32!==0)throw new Ot({givenLength:t.length});if(t.length>At)throw new Mt({givenLength:t.length,maxBytecodeSize:At});const n=Ne(t),r=(0,x.O0)(n),i=t.length/32;if(i%2===0)throw new Pt({givenLengthInWords:i});const o=(0,x.O0)(i),s=(0,Tt.vk)(o,{size:2}),a=new Uint8Array([1,0]);return r.set(a,0),r.set(s,2),r}(e))))??[],paymasterInput:l||"0x"}}(e);return{domain:{name:"zkSync",version:"2",chainId:e.chainId},types:{Transaction:[{name:"txType",type:"uint256"},{name:"from",type:"uint256"},{name:"to",type:"uint256"},{name:"gasLimit",type:"uint256"},{name:"gasPerPubdataByteLimit",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymaster",type:"uint256"},{name:"nonce",type:"uint256"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"factoryDeps",type:"bytes32[]"},{name:"paymasterInput",type:"bytes"}]},primaryType:"Transaction",message:t}}}},Nt=i({...Rt,id:324,name:"ZKsync Era",network:"zksync-era",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]}},blockExplorers:{default:{name:"Etherscan",url:"https://era.zksync.network/",apiUrl:"https://api-era.zksync.network/api"},native:{name:"ZKsync Explorer",url:"https://explorer.zksync.io/",apiUrl:"https://block-explorer-api.mainnet.zksync.io/api"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:45659388}}}),Bt=i({id:81457,name:"Blast",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.blast.io"]}},blockExplorers:{default:{name:"Blastscan",url:"https://blastscan.io",apiUrl:"https://api.blastscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:212929}},sourceId:1}),Lt=i({...mt,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...mt.contracts,disputeGameFactory:{1:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{1:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{1:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{1:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:1});var Dt,Ut,jt={token:"a".repeat(64),chainId:416001,applicationId:1275319623,applicationAddress:"SLNGOJJFB3ERUUZUAAOVW6DWH3NKKQMGZWH26IBIU34EHM3AU24Y5VIH3E",algodUrl:"https://mainnet-api.algonode.cloud"},Ft=i({testnet:!0,id:366666,name:"Crust EVM Parachain Test",nativeCurrency:{name:"CRU",symbol:"CRU",decimals:18},blockExplorers:{default:{name:"Crust EVM Parachain Test",url:" https://evmexplorer.tanssi-chains.network"}},rpcUrls:{default:{http:["https://fraa-flashbox-2952-rpc.a.stagenet.tanssi.network"]}}}),Vt={mainnet:o,optimism:bt,arbitrum:yt,zkSync:Nt,blast:Bt,base:Lt,crustEvmParachainTest:Ft,u2uMainnet:i({testnet:!1,id:39,name:"U2U Solaris Mainnet",nativeCurrency:{name:"U2U",symbol:"U2U",decimals:18},blockExplorers:{default:{name:"U2U Mainnet Scan",url:"https://u2uscan.xyz"}},rpcUrls:{default:{http:["https://rpc-mainnet.u2u.xyz"]}}})},qt=(Dt={},(0,r.Z)(Dt,o.id,"0xf063A29f03d0A02FD96f270EE4F59158EF3d4860"),(0,r.Z)(Dt,5,"0xDE52b55C3Ee0765d17564631570ec8E7fD3D499a"),(0,r.Z)(Dt,bt.id,"0xf063A29f03d0A02FD96f270EE4F59158EF3d4860"),(0,r.Z)(Dt,420,"0x06Ae21caEEA438Aa3AA4D353332a7C124f8dF3c7"),(0,r.Z)(Dt,yt.id,"0xf063A29f03d0A02FD96f270EE4F59158EF3d4860"),(0,r.Z)(Dt,421613,"0x9AE6C9d00Fde0e0F774693Ca6099d06dfe2001C6"),(0,r.Z)(Dt,Nt.id,"0x61ecfA2C8dF06A4f941A8529E4B707488B74e3bE"),(0,r.Z)(Dt,280,"0x6C0445ec09d49214Cbc21E3DC032d3dEA25ce2Ae"),(0,r.Z)(Dt,137,""),(0,r.Z)(Dt,42220,""),(0,r.Z)(Dt,56,""),(0,r.Z)(Dt,Bt.id,"0xf063A29f03d0A02FD96f270EE4F59158EF3d4860"),(0,r.Z)(Dt,Lt.id,"0xf063a29f03d0a02fd96f270ee4f59158ef3d4860"),(0,r.Z)(Dt,Ft.id,"0xA40179e57280585D88899b2032E7eCF13B3B6c72"),(0,r.Z)(Dt,39,"0xA40179e57280585D88899b2032E7eCF13B3B6c72"),Dt),zt=(Ut={416001:"ALGO",137:"Matic",56:"BNB"},(0,r.Z)(Ut,Ft.id,"CRU"),(0,r.Z)(Ut,39,"U2U"),Ut),Ht=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"customer",type:"address"},{indexed:!1,internalType:"address",name:"merchant",type:"address"},{indexed:!1,internalType:"string",name:"cid",type:"string"},{indexed:!1,internalType:"uint256",name:"size",type:"uint256"},{indexed:!1,internalType:"uint256",name:"price",type:"uint256"},{indexed:!1,internalType:"bool",name:"isPermanent",type:"bool"}],name:"Order",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[{internalType:"address",name:"nodeAddress",type:"address"}],name:"addOrderNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getNodesNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"size",type:"uint256"},{internalType:"bool",name:"isPermanent",type:"bool"}],name:"getPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"nodeArray",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nodes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"cid",type:"string"},{internalType:"uint256",name:"size",type:"uint256"},{internalType:"bool",name:"isPermanent",type:"bool"}],name:"placeOrder",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"string",name:"cid",type:"string"},{internalType:"uint256",name:"size",type:"uint256"},{internalType:"address",name:"nodeAddress",type:"address"},{internalType:"bool",name:"isPermanent",type:"bool"}],name:"placeOrderWithNode",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"priceOracle",outputs:[{internalType:"contract IPriceOracle",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"nodeAddress",type:"address"}],name:"removeOrderNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"priceOracleAddress",type:"address"}],name:"setPriceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"}]},98936:function(e,t,n){"use strict";n.d(t,{it:function(){return QU},kb:function(){return YU},WY:function(){return $U},Yg:function(){return ZU},xX:function(){return JU}});var r={};n.r(r),n.d(r,{Address:function(){return Bs},Array:function(){return js},Bool:function(){return Ns},Character:function(){return Rs},Dictionary:function(){return Fs},Enum:function(){return Hs},Event:function(){return Vs},Fix64:function(){return Ps},Identity:function(){return cs},InclusiveRange:function(){return Gs},Int:function(){return ls},Int128:function(){return ws},Int16:function(){return ps},Int256:function(){return Ss},Int32:function(){return ms},Int64:function(){return ys},Int8:function(){return fs},Optional:function(){return Ds},Path:function(){return Ws},Reference:function(){return Us},Resource:function(){return qs},String:function(){return Os},Struct:function(){return zs},UFix64:function(){return Ms},UInt:function(){return us},UInt128:function(){return vs},UInt16:function(){return hs},UInt256:function(){return xs},UInt32:function(){return gs},UInt64:function(){return bs},UInt8:function(){return ds},Void:function(){return Ls},Word128:function(){return Is},Word16:function(){return Es},Word256:function(){return ks},Word32:function(){return _s},Word64:function(){return Cs},Word8:function(){return As},_Array:function(){return js}});var i={};n.r(i),n.d(i,{identity:function(){return Ad}});var o={};n.r(o),n.d(o,{base2:function(){return Ed}});var s={};n.r(s),n.d(s,{base8:function(){return _d}});var a={};n.r(a),n.d(a,{base10:function(){return Cd}});var c={};n.r(c),n.d(c,{base16:function(){return Id},base16upper:function(){return kd}});var u={};n.r(u),n.d(u,{base32:function(){return Td},base32hex:function(){return Rd},base32hexpad:function(){return Bd},base32hexpadupper:function(){return Ld},base32hexupper:function(){return Nd},base32pad:function(){return Pd},base32padupper:function(){return Od},base32upper:function(){return Md},base32z:function(){return Dd}});var l={};n.r(l),n.d(l,{base36:function(){return Ud},base36upper:function(){return jd}});var d={};n.r(d),n.d(d,{base58btc:function(){return Fd},base58flickr:function(){return Vd}});var f={};n.r(f),n.d(f,{base64:function(){return qd},base64pad:function(){return zd},base64url:function(){return Hd},base64urlpad:function(){return Wd}});var h={};n.r(h),n.d(h,{base256emoji:function(){return Xd}});var p={};n.r(p),n.d(p,{sha256:function(){return yf},sha512:function(){return vf}});var g={};n.r(g),n.d(g,{identity:function(){return xf}});var m={};n.r(m),n.d(m,{code:function(){return Af},decode:function(){return _f},encode:function(){return Ef},name:function(){return Sf}});var b={};n.r(b),n.d(b,{code:function(){return Tf},decode:function(){return Pf},encode:function(){return Mf},name:function(){return kf}});var y={};n.r(y),n.d(y,{AppUtils:function(){return Ga},InteractionTemplateUtils:function(){return qc},TestUtils:function(){return Xo},VERSION:function(){return ea},WalletUtils:function(){return Fa},account:function(){return bo},arg:function(){return Ro},args:function(){return Oo},atBlockHeight:function(){return go},atBlockId:function(){return mo},authenticate:function(){return qx},authorization:function(){return So},authorizations:function(){return xo},authz:function(){return Zx},block:function(){return yo},build:function(){return jr},cadence:function(){return Rn},cdc:function(){return Rn},config:function(){return xt},createSignableVoucher:function(){return Hi},currentUser:function(){return Vx},decode:function(){return fo},discovery:function(){return Oc},display:function(){return Rt},events:function(){return hc},getAccount:function(){return zr},getBlock:function(){return qr},getBlockHeader:function(){return Co},getChainId:function(){return ga},getCollection:function(){return Io},getEvents:function(){return Ao},getEventsAtBlockHeightRange:function(){return Eo},getEventsAtBlockIds:function(){return _o},getNetworkParameters:function(){return Mo},getNodeVersionInfo:function(){return vo},getTransaction:function(){return To},getTransactionStatus:function(){return ko},invariant:function(){return uo},isBad:function(){return Tr},isOk:function(){return kr},limit:function(){return Po},logIn:function(){return Gx},mutate:function(){return Fx},nodeVersionInfo:function(){return wo},param:function(){return Jo},params:function(){return Yo},payer:function(){return Bo},ping:function(){return Lo},pipe:function(){return Rr},pluginRegistry:function(){return Ac},proposer:function(){return No},query:function(){return Sa},reauthenticate:function(){return Hx},ref:function(){return Do},sansPrefix:function(){return Pt},script:function(){return Uo},send:function(){return lo},serialize:function(){return Ka},signUp:function(){return Wx},subscribeEvents:function(){return qo},t:function(){return r},transaction:function(){return Fo},tx:function(){return ac},unauthenticate:function(){return zx},validator:function(){return po},verifyUserSignatures:function(){return Za},voucherIntercept:function(){return Vo},voucherToTxId:function(){return Wi},why:function(){return Mr},withPrefix:function(){return Ot}});var v=n(16835),w=n(50029),x=n(59499),S=n(87794),A=n.n(S),E=n(96486),_=n.n(E),C=n(11163),I=n(67294),k=n(58971),T=n.n(k),M=n(92777),P=n(82262);function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}function N(e,t,n){return N="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=R(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}},N(e,t,n||e)}function B(e,t){return B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},B(e,t)}function L(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}var D=n(14027);function U(e,t){if(t&&("object"===D(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}var j=n(44232),F=n(39275),V=n(92339),q=n(62020),z=n(42103),H=n(48764).Buffer;function W(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var G=function(e){L(n,e);var t=W(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o{const{title:t,message:n,level:r,always:i}=e,o=await(ue?.()?.get("logger.level"))??le.warn;if(!i&&o{const{title:t,message:n}=e;return[`\n %c${t}\n ============================\n\n ${n}\n\n ============================\n `.replace(/\n[^\S\r\n]+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"]})({title:t,message:n});switch(r){case le.debug:console.debug(...s);break;case le.info:console.info(...s);break;case le.warn:console.warn(...s);break;case le.error:console.error(...s);break;default:console.log(...s)}};function fe(e,t){if(!e){const e=new Error(`INVARIANT ${t}`);e.stack=e.stack?.split("\n")?.filter((e=>!/at invariant/.test(e)))?.join("\n");for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i{const{pkg:t,subject:n,transition:r,level:i=le.warn,message:o="",callback:s=null}=e,a=()=>{return de({title:(t?t+" ":"")+"Deprecation Notice",message:`\n ${n?`${e=n,e.charAt(0).toUpperCase()+e.slice(1)} is deprecated and will cease to work in future releases${t?" of "+t:""}.`:""}${o?"\n"+o:""}${r?`\nYou can learn more (including a guide on common transition paths) here: ${r}`:""}\n `.trim(),level:i});var e};return"function"===typeof s?async function(){return await a(),await s(...arguments)}:a()};var he={randomUUID:"undefined"!==typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let pe;const ge=new Uint8Array(16);function me(){if(!pe&&(pe="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pe(ge)}const be=[];for(let tj=0;tj<256;++tj)be.push((tj+256).toString(16).slice(1));function ye(e,t=0){return be[e[t+0]]+be[e[t+1]]+be[e[t+2]]+be[e[t+3]]+"-"+be[e[t+4]]+be[e[t+5]]+"-"+be[e[t+6]]+be[e[t+7]]+"-"+be[e[t+8]]+be[e[t+9]]+"-"+be[e[t+10]]+be[e[t+11]]+be[e[t+12]]+be[e[t+13]]+be[e[t+14]]+be[e[t+15]]}var ve=function(e,t,n){if(he.randomUUID&&!t&&!e)return he.randomUUID();const r=(e=e||{}).random||(e.rng||me)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return ye(r)},we=function(e){return e.UNKNOWN="UNKNOWN",e.SCRIPT="SCRIPT",e.TRANSACTION="TRANSACTION",e.GET_TRANSACTION_STATUS="GET_TRANSACTION_STATUS",e.GET_ACCOUNT="GET_ACCOUNT",e.GET_EVENTS="GET_EVENTS",e.PING="PING",e.GET_TRANSACTION="GET_TRANSACTION",e.GET_BLOCK="GET_BLOCK",e.GET_BLOCK_HEADER="GET_BLOCK_HEADER",e.GET_COLLECTION="GET_COLLECTION",e.GET_NETWORK_PARAMETERS="GET_NETWORK_PARAMETERS",e.SUBSCRIBE_EVENTS="SUBSCRIBE_EVENTS",e.GET_NODE_VERSION_INFO="GET_NODE_VERSION_INFO",e}({}),xe=function(e){return e.BAD="BAD",e.OK="OK",e}({}),Se=function(e){return e.AUTHORIZER="authorizer",e.PAYER="payer",e.PROPOSER="proposer",e}({}),Ae=function(e){return e.ARGUMENT="ARGUMENT",e.ACCOUNT="ACCOUNT",e}({});const Ee=()=>{const e=[];let t;return{async deliver(n){e.push(n),t&&(t(e.shift()),t=void 0)},receive:()=>new Promise((function(n){const r=e.shift();if(r)return n(r);t=n}))}};let _e;const Ce=e=>(_e||(_e=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0))),Ie="INIT",ke="SUBSCRIBE",Te="UNSUBSCRIBE",Me="UPDATED",Pe="SNAPSHOT",Oe="EXIT",Re="object"===typeof self&&self.self===self&&self||"object"===typeof n.g&&n.g.global===n.g&&n.g||"object"===typeof window&&window.window===window&&window||{FCL_REGISTRY:null};Re.FCL_REGISTRY=null==Re.FCL_REGISTRY?{}:Re.FCL_REGISTRY;const Ne=Re.FCL_REGISTRY;let Be=0;function Le(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{expectReply:!1};return new Promise(((i,o)=>{const s=r.expectReply||!1,a=null!=r.timeout?r.timeout:5e3;s&&a&&setTimeout((()=>o(new Error(`Timeout: ${a}ms passed without a response.`))),a);const c={to:e,from:r.from,tag:t,data:n,timeout:a,reply:i,reject:o};try{Ne[e]&&Ne[e].mailbox.deliver(c),s||i(!0)}catch(u){console.error("FCL.Actor -- Could Not Deliver Message",c,Ne[e],u),o(u)}}))}const De=e=>{delete Ne[e]},Ue=e=>async t=>{"function"===typeof e.INIT&&await e.INIT(t);e:for(;;){const r=await t.receive();try{if(r.tag===Oe){"function"===typeof e.TERMINATE&&await e.TERMINATE(t,r,r.data||{});break e}await(e[r.tag]?.(t,r,r.data||{}))}catch(n){console.error(`${t.self()} Error`,r,n)}finally{continue e}}},je=e=>{if(null==e){for(;Ne[String(Be)];)Be++;return String(Be)}return String(e)},Fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=je(t);if(null!=Ne[n])return n;Ne[n]={addr:n,mailbox:Ee(),subs:new Set,kvs:{},error:null};const r=Ve(n);let i;return i="object"===typeof e?Ue(e):e,Ce((async()=>{await i(r),De(n)})),n},Ve=e=>({self:()=>e,receive:()=>Ne[e].mailbox.receive(),send:function(t,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(null!=t)return i.from=e,Le(t,n,r,i)},sendSelf:function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne[e]&&Le(e,t,n,r)},broadcast:function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.from=e;for(const i of Ne[e].subs)Le(i,t,n,r)},subscribe:t=>null!=t&&Ne[e].subs.add(t),unsubscribe:t=>null!=t&&Ne[e].subs.delete(t),subscriberCount:()=>Ne[e].subs.size,hasSubs:()=>!!Ne[e].subs.size,put:(t,n)=>{null!=t&&(Ne[e].kvs[t]=n)},get:function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;const r=Ne[e].kvs[t];return null==r?n:r},delete:t=>{delete Ne[e].kvs[t]},update:(t,n)=>{null!=t&&(Ne[e].kvs[t]=n(Ne[e].kvs[t]))},keys:()=>Object.keys(Ne[e].kvs),all:()=>Ne[e].kvs,where:t=>Object.keys(Ne[e].kvs).reduce(((n,r)=>t.test(r)?{...n,[r]:Ne[e].kvs[r]}:n),{}),merge:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(t).forEach((n=>Ne[e].kvs[n]=t[n]))},fatalError:t=>{Ne[e].error=t;for(const n of Ne[e].subs)Le(n,Me)}});function qe(e,t,n){t(e);const r=Fe((async t=>{for(t.send(e,ke);;){const r=await t.receive(),i=Ne[e].error;if(r.tag===Oe)return void t.send(e,Te);if(i)return n(null,i),void t.send(e,Te);n(r.data,null)}}));return()=>Le(r,Oe)}function ze(e,t){return t(e),Le(e,Pe,null,{expectReply:!0,timeout:0})}const He=function(){for(var e=arguments.length,t=new Array(e),n=0;nt.reduce(((e,t)=>t(e)),e)},We=e=>e&&"object"===typeof e&&!Array.isArray(e),Ge=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rArray.isArray(e)?Ge({},...e):e,Ke=e=>e.contracts?e.contracts:{},Xe=e=>e.dependencies?e.dependencies:{},Ye=(e,t)=>He(Ze,function(){for(var e=arguments.length,t=new Array(e),n=0;nt.reduce(((t,n)=>({...t,...n(e)})),{})}((e=>t=>{let{deployments:n={},accounts:r={}}=t;const i=n?.[e];return i?Object.entries(i).reduce(((e,t)=>{let[n,i]=t;const o=r[n]?.address;return o?i.reduce(((e,t)=>({...e,[t]:o})),{}):e}),{}):{}})(t),He(Ke,(e=>t=>Object.entries(t).reduce(((t,n)=>{let[r,i]=n;const o=i?.aliases?.[e];return o&&(t[r]=o),t}),{}))(t)),He(Xe,(e=>t=>Object.entries(t).reduce(((t,n)=>{let[r,i]=n;const o=i?.aliases?.[e];return o&&(t[r]=o),t}),{}))(t))))(e),Je=e=>Object.entries(e?.accounts??[]).reduce(((e,t)=>{let[,n]=t;return!!e||n&&Object.prototype.hasOwnProperty.call(n,"key")&&(r=n?.key,"string"===typeof r&&/^[0-9A-Fa-f]+$/.test(r));var r}),!1),Qe=e=>Array.isArray(e)?e.some(Je):Je(e),$e=e=>{const t="local"===e?.toLowerCase()?"emulator":e?.toLowerCase();if("emulator"===t||"testnet"===t||"mainnet"===t||"previewnet"===t)return t;throw new Error(`Invalid network "${e}". Must be one of "emulator", "local", "testnet", or "mainnet"`)};ue=xt;const et="config",tt="PUT_CONFIG",nt="GET_CONFIG",rt="GET_ALL_CONFIG",it="UPDATE_CONFIG",ot="DELETE_CONFIG",st="CLEAR_CONFIG",at="WHERE_CONFIG",ct="CONFIG/UPDATED",ut=e=>e,lt={[tt]:(e,t,n)=>{let{key:r,value:i}=n;if(null==r)throw new Error("Missing 'key' for config/put.");e.put(r,i),e.broadcast(ct,{...e.all()})},[nt]:(e,t,n)=>{let{key:r,fallback:i}=n;if(null==r)throw new Error("Missing 'key' for config/get");t.reply(e.get(r,i))},[rt]:(e,t)=>{t.reply({...e.all()})},[it]:(e,t,n)=>{let{key:r,fn:i}=n;if(null==r)throw new Error("Missing 'key' for config/update");e.update(r,i||ut),e.broadcast(ct,{...e.all()})},[ot]:(e,t,n)=>{let{key:r}=n;if(null==r)throw new Error("Missing 'key' for config/delete");e.delete(r),e.broadcast(ct,{...e.all()})},[st]:e=>{const t=Object.keys(e.all());for(const n of t)e.delete(n);e.broadcast(ct,{...e.all()})},[at]:(e,t,n)=>{let{pattern:r}=n;if(null==r)throw new Error("Missing 'pattern' for config/where");t.reply(e.where(r))},[ke]:(e,t)=>{e.subscribe(t.from),e.send(t.from,ct,{...e.all()})},[Te]:(e,t)=>{e.unsubscribe(t.from)}};function dt(e,t){return Le(et,tt,{key:e,value:t}),xt()}function ft(e,t){return Le(et,nt,{key:e,fallback:t},{expectReply:!0,timeout:10})}async function ht(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if(!e.length)return t;const[n,...r]=e,i=await ft(n);return null==i?ht(r,t):i}function pt(){return Le(et,rt,null,{expectReply:!0,timeout:10})}function gt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut;return Le(et,it,{key:e,fn:t}),xt()}function mt(e){return Le(et,ot,{key:e}),xt()}function bt(e){return Le(et,at,{pattern:e},{expectReply:!0,timeout:10})}function yt(e){return qe(et,(()=>Fe(lt,et)),e)}async function vt(e){return async function(){await Le(et,st)}().then((()=>xt(e)))}async function wt(e){let{ignoreConflicts:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await ft("flow.network"),r=$e(n),{flowJSON:i}=e;if(fe(Boolean(i),"config.load -- 'flowJSON' must be defined"),fe(!!r,'Flow Network Required -- In order for FCL to load your contracts please define "flow.network" to "emulator", "local", "testnet", or "mainnet" in your config. See more here: https://developers.flow.com/tools/fcl-js/reference/configure-fcl'),Qe(i)){const e="emulator"===r;de({title:"Private Keys Detected",message:"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security",level:e?le.warn:le.error}),fe(e,"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security")}for(const[o,s]of Object.entries(Ye(i,r))){const e=`0x${o}`,n=await ft(e);n&&n!==s&&!t?de({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:le.warn}):dt(e,s);const r=`system.contracts.${o}`,i=await ft(r);i&&i!==s&&!t?de({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:le.warn}):dt(r,s)}}function xt(e){return null!=e&&"object"===typeof e&&Object.keys(e).map((t=>dt(t,e[t]))),{put:dt,get:ft,all:pt,first:ht,update:gt,delete:mt,where:bt,subscribe:yt,overload:St,load:wt}}async function St(e,t){const n=await pt();try{xt(e);return await t(await pt())}finally{await vt(n)}}Fe(lt,et),xt.put=dt,xt.get=ft,xt.all=pt,xt.first=ht,xt.update=gt,xt.delete=mt,xt.where=bt,xt.subscribe=yt,xt.overload=St,xt.load=wt;var At=n(5586);function Et(e){if(Array.isArray(e)){const t=[];for(let r=0;r{e.abort()}),c);return Mt()((s=t,a=n,a?s.replace(/\/+$/,"")+"/"+a.replace(/^\/+/,""):s).toString(),{method:r,body:l,headers:o,signal:e.signal}).then((async e=>{if(e.ok)return e.json();const i=await e.text().catch((()=>null)),o=Ut(i);throw new Ft({error:o?.message,hostname:t,path:n,method:r,requestBody:l,responseBody:i,responseStatusText:e.statusText,statusCode:e.status})})).catch((async e=>{if(e instanceof Ft)throw e;if("AbortError"===e.name)throw e;throw u&&await de({title:"Access Node Error",message:`The provided access node ${t} does not appear to be a valid REST/HTTP access node.\n Please verify that you are not unintentionally using a GRPC access node.\n See more here: https://docs.onflow.org/fcl/reference/sdk-guidelines/#connect`,level:le.error}),new Ft({error:e?.message,hostname:t,path:n,method:r,requestBody:l})})).finally((()=>{clearTimeout(i)}));var s,a}return await async function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{return await d()}catch(n){const r=[408,429,500,502,503,504];if("AbortError"===n.name||r.includes(n.statusCode))return await new Promise(((r,i)=>{t{r(e(t+1))}),a)):i(n)}));throw n}}()}async function qt(e,t,n){const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:`/v1/scripts?block_id=${e.block.id}`,method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return Wt(e,t,i)}async function zt(e,t,n){const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:`/v1/scripts?block_height=${e.block.height}`,method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return Wt(e,t,i)}async function Ht(e,t,n){const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:"/v1/scripts?block_height=sealed",method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return Wt(e,t,i)}function Wt(e,t,n){let r=t.response();return r.tag=e.tag,r.encodedData=JSON.parse(t.Buffer.from(n,"base64").toString()),r}async function Gt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fe(n.node,"SDK Send Execute Script Error: opts.node must be defined."),fe(t.response,"SDK Send Execute Script Error: context.response must be defined."),fe(t.Buffer,"SDK Send Execute Script Error: context.Buffer must be defined."),(e=await e).block.id?await qt(e,t,n):e.block.height?await zt(e,t,n):await Ht(e,t,n)}const Zt={SHA2_256:1,SHA2_384:2,SHA3_256:3,SHA3_384:4,KMAC128_BLS_BLS12_381:5},Kt={ECDSA_P256:1,ECDSA_secp256k1:2,BLS_BLS12_381:3};async function Xt(e,t,n){const r=n.httpRequest||Vt;return Jt(e,t,await r({hostname:n.node,path:`/v1/accounts/${e.account.addr}?block_height=${e.block.height}&expand=contracts,keys`,method:"GET",body:null}))}async function Yt(e,t,n){const r=n.httpRequest||Vt;return Jt(e,t,await r({hostname:n.node,path:`/v1/accounts/${e.account.addr}?block_height=sealed&expand=contracts,keys`,method:"GET",body:null}))}function Jt(e,t,n){let r=t.response();r.tag=e.tag;return r.account={address:n.address,balance:Number(n.balance),code:"",contracts:(e=>{const n={};if(!e)return n;for(let r of Object.keys(e))n[r]=t.Buffer.from(e[r],"base64").toString();return n})(n.contracts),keys:n.keys?.map((e=>({index:Number(e.index),publicKey:e.public_key.replace(/^0x/,""),signAlgo:Kt[e.signing_algorithm],signAlgoString:e.signing_algorithm,hashAlgo:Zt[e.hashing_algorithm],hashAlgoString:e.hashing_algorithm,sequenceNumber:Number(e.sequence_number),weight:Number(e.weight),revoked:e.revoked})))??[]},r}async function Qt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fe(n.node,"SDK Send Get Account Error: opts.node must be defined."),fe(t.response,"SDK Send Get Account Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Account Error: context.Buffer must be defined."),null!==(e=await e).block.height?await Xt(e,t,n):await Yt(e,t,n)}async function $t(e,t,n){const r=n.httpRequest||Vt;return nn(e,t,await r({hostname:n.node,path:`/v1/blocks/${e.block.id}`,method:"GET",body:null}))}async function en(e,t,n){const r=n.httpRequest||Vt;return nn(e,t,await r({hostname:n.node,path:`/v1/blocks?height=${e.block.height}`,method:"GET",body:null}))}async function tn(e,t,n){const r=n.httpRequest||Vt,i=e.block?.isSealed?"sealed":"final";return nn(e,t,await r({hostname:n.node,path:`/v1/blocks?height=${i}`,method:"GET",body:null}))}function nn(e,t,n){const r=n.length?n[0]:null,i=t.response();return i.tag=e.tag,i.blockHeader={id:r.header.id,parentId:r.header.parent_id,height:Number(r.header.height),timestamp:r.header.timestamp},i}async function rn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Block Header Error: opts.node must be defined."),fe(t.response,"SDK Send Get Block Header Error: context.response must be defined.");const r=null!==(e=await e).block.id,i=null!==e.block.height;return r?await $t(e,t,n):i?await en(e,t,n):await tn(e,t,n)}async function on(e,t,n){const r=n.httpRequest||Vt;return cn(e,t,await r({hostname:n.node,path:`/v1/blocks/${e.block.id}?expand=payload`,method:"GET",body:null}))}async function sn(e,t,n){const r=n.httpRequest||Vt;return cn(e,t,await r({hostname:n.node,path:`/v1/blocks?height=${e.block.height}&expand=payload`,method:"GET",body:null}))}async function an(e,t,n){const r=n.httpRequest||Vt,i=e.block?.isSealed?"sealed":"final";return cn(e,t,await r({hostname:n.node,path:`/v1/blocks?height=${i}&expand=payload`,method:"GET",body:null}))}function cn(e,t,n){const r=n.length?n[0]:null,i=t.response();return i.tag=e.tag,i.block={id:r.header.id,parentId:r.header.parent_id,height:Number(r.header.height),timestamp:r.header.timestamp,collectionGuarantees:r.payload.collection_guarantees.map((e=>({collectionId:e.collection_id,signerIds:e.signer_ids}))),blockSeals:r.payload.block_seals.map((e=>({blockId:e.block_id,executionReceiptId:e.result_id})))},i}async function un(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Block Error: opts.node must be defined."),fe(t.response,"SDK Send Get Block Error: context.response must be defined.");const r=null!==(e=await e).block.id,i=null!==e.block.height;return r?await on(e,t,n):i?await sn(e,t,n):await an(e,t,n)}async function ln(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Collection Error: opts.node must be defined."),fe(t.response,"SDK Send Get Collection Error: context.response must be defined.");const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:`/v1/collections/${e.collection.id}?expand=transactions`,method:"GET",body:null}),o=t.response();return o.tag=e.tag,o.collection={id:i.id,transactionIds:i.transactions.map((e=>e.id))},o}async function dn(e,t,n){const r=n.httpRequest||Vt;return hn(e,t,await r({hostname:n.node,path:`/v1/events?type=${e.events.eventType}&start_height=${e.events.start}&end_height=${e.events.end}`,method:"GET",body:null}))}async function fn(e,t,n){const r=n.httpRequest||Vt,i=await r({hostname:n.node,path:`/v1/events?type=${e.events.eventType}&block_ids=${e.events.blockIds.join(",")}`,method:"GET",body:null});return hn(e,t,i)}function hn(e,t,n){let r=t.response();return r.tag=e.tag,r.events=[],n.forEach((e=>e.events?e.events.forEach((n=>r.events.push({blockId:e.block_id,blockHeight:Number(e.block_height),blockTimestamp:e.block_timestamp,type:n.type,transactionId:n.transaction_id,transactionIndex:Number(n.transaction_index),eventIndex:Number(n.event_index),payload:JSON.parse(t.Buffer.from(n.payload,"base64").toString())}))):null)),r}async function pn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Events Error: opts.node must be defined."),fe(t.response,"SDK Send Get Events Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Events Error: context.Buffer must be defined.");const r=null!==(e=await e).events.start,i=Array.isArray(e.events.blockIds)&&e.events.blockIds.length>0;return fe(r||i,"SendGetEventsError: Unable to determine which get events request to send. Either a block height range, or block IDs must be specified."),r?await dn(e,t,n):await fn(e,t,n)}async function gn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Transaction Error: opts.node must be defined."),fe(t.response,"SDK Send Get Transaction Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Transaction Error: context.Buffer must be defined.");const r=n.httpRequest||Vt;e=await e;const i=await r({hostname:n.node,path:`/v1/transactions/${e.transaction.id}`,method:"GET",body:null}),o=e=>({address:e.address,keyId:Number(e.key_id),sequenceNumber:Number(e.sequence_number)}),s=e=>({address:e.address,keyId:Number(e.key_index),signature:e.signature}),a=e=>JSON.parse(t.Buffer.from(e,"base64").toString());let c=t.response();return c.tag=e.tag,c.transaction={script:t.Buffer.from(i.script,"base64").toString(),args:[...i.arguments.map(a)],referenceBlockId:i.reference_block_id,gasLimit:Number(i.gas_limit),payer:i.payer,proposalKey:i.proposal_key?o(i.proposal_key):i.proposal_key,authorizers:i.authorizers,payloadSignatures:[...i.payload_signatures.map(s)],envelopeSignatures:[...i.envelope_signatures.map(s)]},c}const mn={UNKNOWN:0,PENDING:1,FINALIZED:2,EXECUTED:3,SEALED:4,EXPIRED:5};async function bn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Transaction Status Error: opts.node must be defined."),fe(t.response,"SDK Send Get Transaction Status Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Transaction Status Error: context.Buffer must be defined.");const r=n.httpRequest||Vt;e=await e;const i=await r({hostname:n.node,path:`/v1/transaction_results/${e.transaction.id}`,method:"GET",body:null});let o=t.response();return o.tag=e.tag,o.transactionStatus={blockId:i.block_id,status:mn[i.status.toUpperCase()]||"",statusString:i.status.toUpperCase(),statusCode:i.status_code,errorMessage:i.error_message,events:i.events.map((e=>({type:e.type,transactionId:e.transaction_id,transactionIndex:Number(e.transaction_index),eventIndex:Number(e.event_index),payload:JSON.parse(t.Buffer.from(e.payload,"base64").toString())})))},o}async function yn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(Boolean(n.node),"SDK Send Ping Error: opts.node must be defined."),fe(Boolean(t.response),"SDK Send Ping Error: context.response must be defined.");const r=n.httpRequest||Vt;await r({hostname:n.node,path:"/v1/blocks?height=sealed",method:"GET",body:null});let i="function"===typeof t?.response?t.response():{};return i.tag=e.tag,i}const vn=e=>`${withPrefix(e.addr)}-${e.keyId}`;async function wn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Transaction Error: opts.node must be defined."),fe(t.response,"SDK Send Transaction Error: context.response must be defined."),fe(t.Buffer,"SDK Send Transaction Error: context.Buffer must be defined.");const r=n.httpRequest||Vt;e=await e;let i=[];for(let d of Object.values(e.accounts))try{if(!d.role.payer&&null!=d.signature){const e={address:Pt(d.addr),key_index:String(d.keyId),signature:t.Buffer.from(d.signature,"hex").toString("base64")};i.find((t=>t.address===e.address&&t.key_index===e.key_index&&t.signature===e.signature))||i.push(e)}}catch(l){throw console.error("SDK HTTP Send Error: Trouble applying payload signature",{acct:d,ix:e}),l}let o={};for(let d of Object.values(e.accounts))try{if(d.role.payer&&null!=d.signature){let e=d.tempId||vn(d);o[e]=o[e]||{address:Pt(d.addr),key_index:String(d.keyId),signature:t.Buffer.from(d.signature,"hex").toString("base64")}}}catch(l){throw console.error("SDK HTTP Send Error: Trouble applying envelope signature",{acct:d,ix:e}),l}o=Object.values(o);var s=Date.now();const a=await r({hostname:n.node,path:"/v1/transactions",method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:[...e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))],reference_block_id:e.message.refBlock?e.message.refBlock:null,gas_limit:String(e.message.computeLimit),payer:Pt(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),proposal_key:{address:Pt(e.accounts[e.proposer].addr),key_index:String(e.accounts[e.proposer].keyId),sequence_number:String(e.accounts[e.proposer].sequenceNum)},authorizers:e.authorizations.map((t=>e.accounts[t].addr)).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[]).map(Pt),payload_signatures:i,envelope_signatures:o}});var c=Date.now();let u=t.response();return u.tag=e.tag,u.transactionId=a.id,"undefined"!==typeof window&&"undefined"!==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("FLOW::TX",{detail:{txId:u.transactionId,delta:c-s}})),u}async function xn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Network Parameters Error: opts.node must be defined."),fe(t.response,"SDK Send Get Network Parameters Error: context.response must be defined.");const r=n.httpRequest||Vt;e=await e;const i=await r({hostname:n.node,path:"/v1/network/parameters",method:"GET",body:null,enableRequestLogging:n.enableRequestLogging??!0});let o=t.response();return o.tag=e.tag,o.networkParameters={chainId:i.chain_id},o}async function Sn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Node Version Info Error: opts.node must be defined."),fe(t.response,"SDK Send Get Node Verison Info Error: context.response must be defined.");const r=n.httpRequest||Vt;e=await e;const i=await r({hostname:n.node,path:"/v1/node_version_info",method:"GET"});let o=t.response();return o.tag=e.tag,o.nodeVersionInfo={semver:i.semver,commit:i.commit,sporkId:i.spork_id,protocolVersion:parseInt(i.protocol_version),sporkRootBlockHeight:parseInt(i.spork_root_block_height),nodeRootBlockHeight:parseInt(i.node_root_block_height)},o}const An=Dt;class En extends Error{constructor(e){let{code:t,reason:n,message:r,wasClean:i}=e;super(`\n connectWs: connection closed with error${r?`: ${r}`:""}\n ${t?`code: ${t}`:""}\n ${n?`reason: ${n}`:""}\n ${i?`wasClean: ${i}`:""}\n `),this.name="WebsocketError",this.code=t,this.reason=n,this.wasClean=!1}}function _n(e){let{hostname:t,path:n,params:r,getParams:i,retryLimit:o=5,retryIntervalMs:s=1e3}=e;if(i&&r)throw new Error("connectWs: cannot specify both params and getParams");let a=new Nt.EventEmitter,c=0;const u=i||(()=>r);let l=()=>{};return function e(){let r=!1,i=!1;const d=function(e,t,n){const r=new URL(t||"",e);"https:"===r.protocol?r.protocol="wss:":"http:"===r.protocol&&(r.protocol="ws:");return Object.entries(n||{}).forEach((e=>{let[t,n]=e;if(n){let e;e=Array.isArray(n)?n.join(","):n.toString(),r.searchParams.append(t,e)}})),r.toString()}(t,n,u()),f=new An(d);f.onmessage=function(e){const t=Ut(e.data);t?a.emit("data",t):(a.emit("error",new En({message:"invalid JSON data"})),this.close())},f.onclose=function(t){if(r)return a.emit("close"),void a.removeAllListeners();i?setTimeout(e,s):c{a.emit("close"),a.removeAllListeners()})))},f.onopen=function(){i=!0,c=0},l=()=>{r=!0,f.close()}}(),{on(e,t){return a.on(e,t),this},off(e,t){return a.off(e,t),this},close(){l()}}}function Cn(e,t,n){const r=t.response();return r.tag=e.tag,r.events=n.Events?.length>0?n.Events.map((e=>({blockId:n.BlockID,blockHeight:Number(n.Height),blockTimestamp:n.Timestamp,type:e.Type,transactionId:e.TransactionID,transactionIndex:Number(e.TransactionIndex),eventIndex:Number(e.EventIndex),payload:JSON.parse(t.Buffer.from(e.Payload,"base64").toString())}))):null,r.heartbeat={blockId:n.BlockID,blockHeight:Number(n.Height),blockTimestamp:n.Timestamp},r}function In(e,t,n){const r=t.response();return r.tag=e.tag,r.streamConnection=n,r}async function kn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fe(n.node,"SDK Send Get Events Error: opts.node must be defined."),fe(t.response,"SDK Send Get Events Error: context.response must be defined."),fe(t.Buffer,"SDK Send Get Events Error: context.Buffer must be defined.");const r=await e,i=n.connectWs||_n,o=new Nt.EventEmitter;let s=null;const a=i({hostname:n.node,path:"/v1/subscribe_events",getParams:()=>{const e={event_types:r.subscribeEvents?.eventTypes,addresses:r.subscribeEvents?.addresses,contracts:r.subscribeEvents?.contracts,heartbeat_interval:r.subscribeEvents?.heartbeatInterval};return s?e.start_height=s+1:(e.start_block_id=r.subscribeEvents?.startBlockId,e.start_height=r.subscribeEvents?.startHeight),e}});a.on("data",(e=>{const n=Cn(r,t,e);s=n.heartbeat.blockHeight,o.emit("data",n)})),a.on("error",(e=>{o.emit("error",e)})),a.on("close",(()=>{o.emit("close")}));const c={on(e,t){return o.on(e,t),this},off(e,t){return o.off(e,t),this},close(){a.close()}};return In(r,t,c)}const Tn=async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(fe(Boolean(n?.node),'SDK Send Error: Either opts.node or "accessNode.api" in config must be defined.'),fe(Boolean(t.ix),"SDK Send Error: context.ix must be defined."),e=await e,!0){case t.ix.isTransaction(e):return n.sendTransaction?n.sendTransaction(e,t,n):wn(e,t,n);case t.ix.isGetTransactionStatus(e):return n.sendGetTransactionStatus?n.sendGetTransactionStatus(e,t,n):bn(e,t,n);case t.ix.isGetTransaction(e):return n.sendGetTransaction?n.sendGetTransaction(e,t,n):gn(e,t,n);case t.ix.isScript(e):return n.sendExecuteScript?n.sendExecuteScript(e,t,n):Gt(e,t,n);case t.ix.isGetAccount(e):return n.sendGetAccount?n.sendGetAccount(e,t,n):Qt(e,t,n);case t.ix.isGetEvents(e):return n.sendGetEvents?n.sendGetEvents(e,t,n):pn(e,t,n);case t.ix.isSubscribeEvents?.(e):return n.connectSubscribeEvents?n.connectSubscribeEvents(e,t,n):kn(e,t,n);case t.ix.isGetBlock(e):return n.sendGetBlock?n.sendGetBlock(e,t,n):un(e,t,n);case t.ix.isGetBlockHeader(e):return n.sendGetBlockHeader?n.sendGetBlockHeader(e,t,n):rn(e,t,n);case t.ix.isGetCollection(e):return n.sendGetCollection?n.sendGetCollection(e,t,n):ln(e,t,n);case t.ix.isPing(e):return n.sendPing?n.sendPing(e,t,n):yn(e,t,n);case t.ix.isGetNetworkParameters(e):return n.sendGetNetworkParameters?n.sendGetNetworkParameters(e,t,n):xn(e,t,n);case t.ix.isGetNodeVersionInfo?.(e):return n.sendGetNodeVersionInfo?n.sendGetNodeVersionInfo(e,t,n):Sn(e,t,n);default:return e}};var Mn=n(35682);function Pn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!e.length&&!t.length)return n;if(!e.length)return n;if(!t.length)return n.push(...e),n;const[r,...i]=e,[o,...s]=t;return void 0!==r&&n.push(r),void 0!==o&&n.push(o),Pn(i,s,n)}function On(e){return function(t){return"function"===typeof t?(de.deprecate({pkg:"FCL/SDK",subject:"Interopolation of functions into template literals",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"}),On(e)(t(e))):String(t)}}function Rn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re:"function"===typeof e?e:t=>Pn([...e],n.map(On(t))).join("").trim()}const Nn=`{\n "kind":"${Ae.ACCOUNT}",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}`,Bn=`{\n "kind":"${Ae.ARGUMENT}",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}`,Ln=`{\n "tag":"${we.UNKNOWN}",\n "assigns":{},\n "status":"${xe.OK}",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":[],\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "subscribeEvents": {\n "startBlockId":null,\n "startHeight":null,\n "eventTypes":null,\n "addresses":null,\n "contracts":null,\n "heartbeatInterval":null\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}`,Dn=new Set(Object.keys(JSON.parse(Ln))),Un=()=>JSON.parse(Ln),jn=()=>(de.deprecate({pkg:"FCL/SDK",message:"The interaction been deprecated from the Flow JS-SDK/FCL. use initInteraction instead",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0010-deprecate-interaction",level:le.warn}),Un()),Fn=e=>"number"===typeof e,Vn=e=>Array.isArray(e),qn=e=>null!==e&&"object"===typeof e,zn=e=>null==e,Hn=e=>"function"===typeof e,Wn=e=>{if(!qn(e)||zn(e)||Fn(e))return!1;for(let t of Dn)if(!e.hasOwnProperty(t))return!1;return!0},Gn=e=>(e.status=xe.OK,e),Zn=(e,t)=>(e.status=xe.BAD,e.reason=t,e),Kn=e=>t=>(t.tag=e,Gn(t)),Xn=e=>null==e.keyId?e:(fe(!isNaN(parseInt(e.keyId.toString())),"account.keyId must be an integer"),{...e,keyId:parseInt(e.keyId.toString())}),Yn=()=>JSON.parse(Nn),Jn=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{fe("function"===typeof e||"object"===typeof e,"prepAccount must be passed an authorization function or an account object"),fe(null!=t.role,"Account must have a role");const r=Yn(),i=t.role,o=ve();let s={...e};e.authorization&&Hn(e.authorization)&&(s={resolve:e.authorization}),!e.authorization&&Hn(e)&&(s={resolve:e});const a=s.resolve;return a&&(s.resolve=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rt(await e,...n)),e)}),s=Xn(s),n.accounts[o]={...r,tempId:o,...s,role:{...r.role,..."object"===typeof e.role?e.role:{},...i?{[i]:!0}:{}}},i===Se.AUTHORIZER?n.authorizations.push(o):i===Se.PAYER?n.payer.push(o):i&&(n[i]=o),n}},Qn=e=>t=>{let n=ve();return t.message.arguments.push(n),t.arguments[n]=JSON.parse(Bn),t.arguments[n].tempId=n,t.arguments[n].value=e.value,t.arguments[n].asArgument=e.asArgument,t.arguments[n].xform=e.xform,t.arguments[n].resolve=e.resolve,t.arguments[n].resolveArgument=Hn(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,Gn(t)},$n=Kn(we.UNKNOWN),er=Kn(we.SCRIPT),tr=Kn(we.TRANSACTION),nr=Kn(we.GET_TRANSACTION_STATUS),rr=Kn(we.GET_TRANSACTION),ir=Kn(we.GET_ACCOUNT),or=Kn(we.GET_EVENTS),sr=Kn(we.PING),ar=Kn(we.GET_BLOCK),cr=Kn(we.GET_BLOCK_HEADER),ur=Kn(we.GET_COLLECTION),lr=Kn(we.GET_NETWORK_PARAMETERS),dr=Kn(we.SUBSCRIBE_EVENTS),fr=Kn(we.GET_NODE_VERSION_INFO),hr=e=>t=>t.tag===e,pr=hr(we.UNKNOWN),gr=hr(we.SCRIPT),mr=hr(we.TRANSACTION),br=hr(we.GET_TRANSACTION_STATUS),yr=hr(we.GET_TRANSACTION),vr=hr(we.GET_ACCOUNT),wr=hr(we.GET_EVENTS),xr=hr(we.PING),Sr=hr(we.GET_BLOCK),Ar=hr(we.GET_BLOCK_HEADER),Er=hr(we.GET_COLLECTION),_r=hr(we.GET_NETWORK_PARAMETERS),Cr=hr(we.GET_NODE_VERSION_INFO),Ir=hr(we.SUBSCRIBE_EVENTS),kr=e=>e.status===xe.OK,Tr=e=>e.status===xe.BAD,Mr=e=>e.reason,Pr=e=>{for(let t of Object.keys(e))if(!Dn.has(t))throw new Error(`"${t}" is an invalid root level Interaction property.`);return e},Or=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];try{if(e=Pr(await e),Tr(e))throw new Error(`Interaction Error: ${e.reason}`);if(!t.length)return e;const[n,...r]=t,i=await n;if(Hn(i))return Or(i(e),r);if(zn(i)||!i)return Or(e,r);if(Wn(i))return Or(i,r);throw new Error("Invalid Interaction Composition")}catch(n){throw n}};function Rr(){for(var e=arguments.length,t=new Array(e),n=0;nRr(e,r);const o=r,s=i;return Or(o,s)}const Nr=function(e){return e},Br=(e,t,n)=>null==e.assigns[t]?n:e.assigns[t],Lr=(e,t)=>n=>(n.assigns[e]=t,Gn(n)),Dr=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nr;return n=>(n.assigns[e]=t(n.assigns[e],n),Gn(n))};var Ur=Object.freeze({__proto__:null,initInteraction:Un,interaction:jn,isNumber:Fn,isArray:Vn,isObj:qn,isNull:zn,isFn:Hn,isInteraction:Wn,Ok:Gn,Bad:Zn,initAccount:Yn,prepAccount:Jn,makeArgument:Qn,makeUnknown:$n,makeScript:er,makeTransaction:tr,makeGetTransactionStatus:nr,makeGetTransaction:rr,makeGetAccount:ir,makeGetEvents:or,makePing:sr,makeGetBlock:ar,makeGetBlockHeader:cr,makeGetCollection:ur,makeGetNetworkParameters:lr,makeSubscribeEvents:dr,makeGetNodeVerionInfo:fr,isUnknown:pr,isScript:gr,isTransaction:mr,isGetTransactionStatus:br,isGetTransaction:yr,isGetAccount:vr,isGetEvents:wr,isPing:xr,isGetBlock:Sr,isGetBlockHeader:Ar,isGetCollection:Er,isGetNetworkParameters:_r,isGetNodeVersionInfo:Cr,isSubscribeEvents:Ir,isOk:kr,isBad:Tr,why:Mr,isAccount:e=>e.kind===Ae.ACCOUNT,isArgument:e=>e.kind===Ae.ARGUMENT,pipe:Rr,get:Br,put:Lr,update:Dr,destroy:e=>t=>(delete t.assigns[e],Gn(t))});function jr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Rr(Un(),e)}const Fr={tag:null,transaction:null,transactionStatus:null,transactionId:null,encodedData:null,events:null,account:null,block:null,blockHeader:null,latestBlock:null,collection:null,networkParameters:null,streamConnection:null,heartbeat:null,nodeVersionInfo:null},Vr=()=>({...Fr});function qr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Rr([ar,t=>(t.block.isSealed=e,Gn(t))])}function zr(e){return Rr([ir,t=>(t.account.addr=Pt(e),Gn(t))])}const Hr=(e,t,n)=>{const r=new(Bt());let i=function(){let e=[],t=!1;async function n(){if(!t){for(t=!0;e.length>0;){const t=e.shift();await(t?.())}t=!1}}return{push:t=>{e.push(t),n()}}}();function o(t){e.on(t,(e=>{i.push((async()=>{r.emit(t,e)}))}))}return e.on("data",(async e=>{const o=Object.keys(e).filter((t=>null!=e[t]&&"tag"!==t));let s=Promise.all(o.map((async r=>{const i={[r]:e[r]};return{channel:r,message:await t(i,n)}})));i.push((async()=>{(await s).forEach((e=>{let{channel:t,message:n}=e;r.emit(t,n)}))}))})),o("close"),o("error"),{on(e,t){return r.on(e,t),this},off(e,t){return r.off(e,t),this},close:()=>{e.close()}}};const Wr=()=>{de.deprecate({pkg:"@onflow/decode",subject:"Operating upon data of the latestBlock field of the response object",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field"})},Gr=async e=>e,Zr=async(e,t,n)=>{const r=await e.fields.reduce((async(e,r)=>((e=await e)[r.name]=await Yr(r.value,t,[...n,r.name]),e)),Promise.resolve({})),i=e.id&&Xr(t,e.id);return i?await i(r):r},Kr={UInt:Gr,Int:Gr,UInt8:Gr,Int8:Gr,UInt16:Gr,Int16:Gr,UInt32:Gr,Int32:Gr,UInt64:Gr,Int64:Gr,UInt128:Gr,Int128:Gr,UInt256:Gr,Int256:Gr,Word8:Gr,Word16:Gr,Word32:Gr,Word64:Gr,Word128:Gr,Word256:Gr,UFix64:Gr,Fix64:Gr,String:Gr,Character:Gr,Bool:Gr,Address:Gr,Void:async()=>null,Optional:async(e,t,n)=>e?await Yr(e,t,n):null,Reference:Gr,Array:async(e,t,n)=>await Promise.all(e.map((e=>new Promise((async r=>r(await Yr(e,t,[...n,e.type]))))))),Dictionary:async(e,t,n)=>await e.reduce((async(e,r)=>((e=await e)[await Yr(r.key,t,[...n,r.key])]=await Yr(r.value,t,[...n,r.key]),e)),Promise.resolve({})),Event:Zr,Resource:Zr,Struct:Zr,Enum:Zr,Type:async e=>e.staticType,Path:Gr,Capability:Gr,InclusiveRange:async(e,t,n)=>{const r=["start","end","step"];return await Object.keys(e).reduce((async(i,o)=>(i=await i,r.includes(o)&&(i[o]=await Yr(e[o],t,[...n,o])),i)),Promise.resolve({}))}},Xr=(e,t)=>{const n=Object.keys(e).find((e=>{if(/^\/.*\/$/.test(e)){return new RegExp(e.substring(1,e.length-1)).test(t)}return e===t}));return t&&n&&e[n]},Yr=async(e,t,n)=>{let r=Xr(t,e.type);if(!r)throw new Error(`Undefined Decoder Error: ${e.type}@${n.join(".")}`);return await r(e.value,t,n)},Jr=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=Object.keys(Kr).filter((e=>!Object.keys(t).find((t=>new RegExp(t).test(e))))).reduce(((e,t)=>(e[t]=Kr[t],e)),t),i={...r,...t};return Yr(e,i,n)},Qr=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.encodedData)return Jr(e.encodedData,t);if(e.transactionStatus)return{...e.transactionStatus,events:await Promise.all(e.transactionStatus.events.map((async function(e){return{type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await Jr(e.payload,t)}})))};if(e.transaction)return e.transaction;if(e.events)return await Promise.all(e.events.map((async function(e){return{blockId:e.blockId,blockHeight:e.blockHeight,blockTimestamp:e.blockTimestamp,type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await Jr(e.payload,t)}})));if(e.account)return e.account;if(e.block)return e.block;if(e.blockHeader)return e.blockHeader;if(e.latestBlock)return Wr(),e.latestBlock;if(e.transactionId)return e.transactionId;if(e.collection)return e.collection;if(e.networkParameters){const t=/^flow-/,n=e.networkParameters.chainId;let r;return r="flow-emulator"===n?"local":t.test(n)?n.replace(t,""):n,{chainId:r}}return e.streamConnection?Hr(e.streamConnection,Qr,t):e.heartbeat?e.heartbeat:e.nodeVersionInfo?e.nodeVersionInfo:null},$r=e=>"function"===typeof e,ei=e=>"string"===typeof e;function ti(e){return/\b(0x\w+)\b/g.test(e)}function ni(e){return/import\s+"(\w+)"/g.test(e)}const ri=e=>"function"===typeof e;function ii(e){return fe(null!=typeof e.xform,`No type specified for argument: ${e.value}`),ri(e.xform)?e.xform(e.value):ri(e.xform.asArgument)?e.xform.asArgument(e.value):void fe(!1,"Invalid Argument",e)}async function oi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(fe(t>0,`Argument Resolve Recursion Limit Exceeded for Arg: ${e.tempId}`),ri(e.resolveArgument)){return oi(await e.resolveArgument(),t-1)}return e}const si=e=>fi(yi(wi(e))),ai=e=>fi(yi(xi(e))),ci=(e,t)=>At.lW.from(e.padStart(2*t,"0"),"hex"),ui=(li=At.lW.from("FLOW-V0.0-transaction").toString("hex"),di=32,At.lW.from(li.padEnd(2*di,"0"),"hex")).toString("hex");var li,di;const fi=e=>ui+e,hi=e=>ci(e,8),pi=e=>ci(e,32),gi=e=>At.lW.from(JSON.stringify(e),"utf8"),mi=e=>At.lW.from(e,"utf8"),bi=e=>At.lW.from(e,"hex"),yi=e=>Et(e).toString("hex"),vi=e=>{const t=new Mn.Aj(256);return t.update(At.lW.from(e,"hex")),t.digest().toString("hex")},wi=e=>(_i(e),[mi(e.cadence||""),e.arguments.map(gi),pi(e.refBlock||""),e.computeLimit,hi(Pt(e.proposalKey.address||"")),e.proposalKey.keyId,e.proposalKey.sequenceNum,hi(Pt(e.payer)),e.authorizers.map((e=>hi(Pt(e))))]),xi=e=>(Ci(e),[wi(e),Si(e)]),Si=e=>{const t=Ai(e);return e.payloadSigs?.map((e=>({signerIndex:t.get(e.address)||"",keyId:e.keyId,sig:e.sig}))).sort(((e,t)=>e.signerIndex>t.signerIndex?1:e.signerIndext.keyId?1:e.keyId[e.signerIndex,e.keyId,bi(e.sig)]))},Ai=e=>{const t=new Map;let n=0;const r=e=>{t.has(e)||(t.set(e,n),n++)};return e.proposalKey.address&&r(e.proposalKey.address),r(e.payer),e.authorizers.forEach(r),t},Ei=e=>{Ii(e);const t=Ai(e),n=e=>e.map((e=>{let{address:n,keyId:r,sig:i}=e;return{signerIndex:t.get(n)||"",keyId:r,sig:i}})).sort(((e,t)=>e.signerIndex>t.signerIndex?1:e.signerIndext.keyId?1:e.keyId[e.signerIndex,e.keyId,bi(e.sig)]));return[[mi(e.cadence),e.arguments.map(gi),pi(e.refBlock),e.computeLimit,hi(Pt(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,hi(Pt(e.payer)),e.authorizers.map((e=>hi(Pt(e))))],n(e.payloadSigs),n(e.envelopeSigs)]},_i=e=>{Oi.forEach((t=>Ui(e,t))),Ri.forEach((t=>Ui(e.proposalKey,t,"proposalKey")))},Ci=e=>{Ni.forEach((t=>Ui(e,t))),e.payloadSigs?.forEach(((e,t)=>{Bi.forEach((n=>Ui(e,n,"payloadSigs",t)))}))},Ii=e=>{Oi.forEach((t=>Ui(e,t))),Ri.forEach((t=>Ui(e.proposalKey,t,"proposalKey"))),Ni.forEach((t=>Ui(e,t))),e.payloadSigs.forEach(((e,t)=>{Bi.forEach((n=>Ui(e,n,"payloadSigs",t)))})),Li.forEach((t=>Ui(e,t))),e.envelopeSigs.forEach(((e,t)=>{Di.forEach((n=>Ui(e,n,"envelopeSigs",t)))}))},ki=e=>"number"===typeof e,Ti=e=>"string"===typeof e,Mi=e=>null!==e&&"object"===typeof e,Pi=e=>Mi(e)&&e instanceof Array,Oi=[{name:"cadence",check:Ti},{name:"arguments",check:Pi},{name:"refBlock",check:Ti,defaultVal:"0"},{name:"computeLimit",check:ki},{name:"proposalKey",check:Mi},{name:"payer",check:Ti},{name:"authorizers",check:Pi}],Ri=[{name:"address",check:Ti},{name:"keyId",check:ki},{name:"sequenceNum",check:ki}],Ni=[{name:"payloadSigs",check:Pi}],Bi=[{name:"address",check:Ti},{name:"keyId",check:ki},{name:"sig",check:Ti}],Li=[{name:"envelopeSigs",check:Pi}],Di=[{name:"address",check:Ti},{name:"keyId",check:ki},{name:"sig",check:Ti}],Ui=(e,t,n,r)=>{const{name:i,check:o,defaultVal:s}=t;if(null==e[i]&&null!=s&&(e[i]=s),null==e[i])throw Fi(i,n,r);if(!o(e[i]))throw Vi(i,n,r)},ji=(e,t,n)=>t?null==n?`${t}.${e}`:`${t}.${n}.${e}`:e,Fi=(e,t,n)=>new Error(`Missing field ${ji(e,t,n)}`),Vi=(e,t,n)=>new Error(`Invalid field ${ji(e,t,n)}`);function qi(e){let t=new Set(e.authorizations);return e.proposer&&t.add(e.proposer),Array.isArray(e.payer)?e.payer.forEach((e=>t.delete(e))):t.delete(e.payer),Array.from(t)}function zi(e){let t=new Set(Array.isArray(e.payer)?e.payer:[e.payer]);return Array.from(t)}const Hi=e=>{const t=e.proposer?{address:Ot(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum}:{};return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map((t=>e.arguments[t].asArgument)),proposalKey:t,payer:Ot(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),authorizers:e.authorizations.map((t=>Ot(e.accounts[t].addr))).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[]),payloadSigs:qi(e).map((t=>({address:Ot(e.accounts[t].addr),keyId:e.accounts[t].keyId,sig:e.accounts[t].signature}))),envelopeSigs:zi(e).map((t=>({address:Ot(e.accounts[t].addr),keyId:e.accounts[t].keyId,sig:e.accounts[t].signature})))}},Wi=e=>(e=>vi(yi(Ei(e))))(e),Gi=e=>e&&("[object Function]"===Object.prototype.toString.call(e)||"function"===typeof e||e instanceof Function);var Zi=function(e){return e.PAYER="payer",e.PROPOSER="proposer",e.AUTHORIZATIONS="authorizations",e}(Zi||{});function Ki(){const e=[];return[function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e.push(Array(4*n).fill(" ").join("-")+t)},function(){return e.reduce(((e,t)=>e+"\n"+t))}]}function Xi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return t<=0?e:Array.isArray(e)?Xi(e.flatMap((e=>e)),t-1):e}function Yi(e,t){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:t.message.cadence,args:t.message.arguments.map((e=>t.arguments[e].asArgument)),data:{},interaction:t,voucher:Hi(t)}}catch(n){throw console.error("buildPreSignable",n),n}}async function Ji(e,t){const n=Array.isArray(e.payer)?e.payer:[e.payer],r=Array.isArray(e.authorizations)?e.authorizations:[e.authorizations],i=null===e.proposer?[]:Array.isArray(e.proposer)?e.proposer:[e.proposer],o=Object.keys(e.accounts),s=[...new Set(n.concat(r,i))];for(const a of o)s.find((e=>e===a))||delete e.accounts[a]}function Qi(e,t){var n;"string"!==typeof t.addr||"number"!==typeof t.keyId&&"string"!==typeof t.keyId?t.tempId=t.tempId||ve():t.tempId=`${Ot((n=t).addr)}-${n.keyId}`;const r=e.accounts[t.tempId]||t;return e.accounts[t.tempId]||(e.accounts[t.tempId]=t),e.accounts[t.tempId].role.proposer=r.role.proposer||t.role.proposer,e.accounts[t.tempId].role.payer=r.role.payer||t.role.payer,e.accounts[t.tempId].role.authorizer=r.role.authorizer||t.role.authorizer,e.accounts[t.tempId]}function $i(e){const t=Xi(e),n=new Set,r=t.map((e=>{const t=function(){for(var e=arguments.length,t=new Array(e),n=0;nnull!==e));return r}async function eo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,{debugLogger:r}=arguments.length>3?arguments[3]:void 0;if(n<=0)throw new Error("recurseResolveAccount Error: Depth limit (5) reached. Ensure your authorization functions resolve to an account after 5 resolves.");let i=e.accounts[t];if(!i)return[[],!1];if(r(`account: ${i.tempId}`,Math.max(5-n,0)),i?.resolve){if(Gi(i?.resolve)){r(`account: ${i.tempId} -- cache MISS`,Math.max(5-n,0));const{resolve:t,...o}=i;let s=await t(o,Yi(o,e));s=Array.isArray(s)?s:[s];let a=Xi(s);return a=a.map((t=>Qi(e,t))),i.resolve=a.map((e=>e.tempId)),i=Qi(e,i),[a.map((e=>e.tempId)),!0]}return r(`account: ${i.tempId} -- cache HIT`,Math.max(5-n,0)),[i.resolve,!1]}return[i.tempId?[i.tempId]:[],!1]}const to=e=>null===e?[]:Array.isArray(e)?e:[e];async function no(e,t,n){for(let r of Object.values(Zi))if(r===Zi.AUTHORIZATIONS||r===Zi.PAYER)e[r]=to(e[r]).reduce(((e,i)=>i===t?e.concat(...n.filter((e=>r===Zi.PAYER&&e.role.payer||r===Zi.AUTHORIZATIONS&&e.role.authorizer)).map((e=>e.tempId))):e.concat(i)),[]);else if(r===Zi.PROPOSER){const t=n.filter((e=>e.role.proposer));if(t.length>1)throw new Error("replaceRoles Error: Multiple proposer keys were resolved, but only one is allowed");e[r]=t[0]?.tempId??e[r]}}async function ro(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,{debugLogger:r}=arguments.length>3?arguments[3]:void 0;fe(e&&"object"===typeof e,"resolveAccountType Error: ix not defined");let i,o=new Set;for(let s of t){let t=e.accounts[s];fe(Boolean(t),"resolveAccountType Error: account not found");const[i,a]=await eo(e,s,n,{debugLogger:r});if(a){const t=$i(i.map((t=>e.accounts[t])));t.forEach((e=>o.add(e.tempId))),no(e,s,t)}}for(const s of e[Zi.PAYER]){let t=e.accounts[s];if(i){if(i!==t.addr)throw new Error("resolveAccountType Error: payers from different accounts detected")}else i=t.addr}return o}function io(e,t){return async function(n){const r=e.accounts[n];if(null!=r.signature&&void 0!==r.signature)return;const{signature:i}=await r.signingFunction(function(e,t,n){try{return{f_type:"Signable",f_vsn:"1.0.1",message:t,addr:Pt(e.addr),keyId:e.keyId,roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map((e=>n.arguments[e].asArgument)),data:{},interaction:n,voucher:Hi(n)}}catch(r){throw console.error("buildSignable",r),r}}(r,t,e));e.accounts[n].signature=i}}function oo(e){const t=Pt((Array.isArray(e.payer)?e.accounts[e.payer[0]]:e.accounts[e.payer]).addr||""),n=e.proposer?{address:Pt(e.accounts[e.proposer].addr)||"",keyId:e.accounts[e.proposer].keyId||0,sequenceNum:e.accounts[e.proposer].sequenceNum||0}:{};return{cadence:e.message.cadence,refBlock:e.message.refBlock,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map((t=>e.arguments[t].asArgument)),proposalKey:n,payer:t,authorizers:e.authorizations.map((t=>Pt(e.accounts[t].addr)||"")).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[])}}const so=e=>e,ao=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:so;return async n=>(await xt.get(`debug.${e}`)&&await t(n,(function(){for(var t=arguments.length,n=new Array(t),r=0;r["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean))),n)},co=Rr([async function(e){if(!mr(e)&&!gr(e))return e;var t=Br(e,"ix.cadence");if(fe($r(t)||ei(t),"Cadence needs to be a function or a string."),$r(t)&&(t=await t({})),fe(ei(t),"Cadence needs to be a string at this point."),fe(!ti(t)||!ni(t),"Both account identifier and contract identifier syntax not simultaneously supported."),ti(t)&&(t=await xt().where(/^0x/).then((e=>Object.entries(e).reduce(((e,t)=>{let[n,r]=t;const i=new RegExp("(\\b"+n+"\\b)","g");return e.replace(i,r)}),t)))),ni(t))for(const[n,r]of function(e){return e.matchAll(/import\s+"(\w+)"/g)}(t)){const e=await xt().get(`system.contracts.${r}`);e?t=t.replace(n,`import ${r} from ${Ot(e)}`):de({title:"Contract Placeholder not found",message:`Cannot find a value for contract placeholder ${r}. Please add to your flow.json or explicitly add it to the config 'contracts.*' namespace.`,level:le.warn})}return e.message.cadence=t,e},ao("cadence",((e,t)=>t(e.message.cadence))),async function(e){return mr(e)&&(e.message.computeLimit=e.message.computeLimit||await xt.get("fcl.limit"),e.message.computeLimit||(de.deprecate({pkg:"FCL/SDK",subject:"The built-in default compute limit (DEFAULT_COMPUTE_LIMIT=10)",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0009-deprecate-default-compute-limit"}),e.message.computeLimit=100)),e},ao("compute limit",((e,t)=>t(e.message.computeLimit))),async function(e){if(mr(e)||gr(e))for(let[t,n]of Object.entries(e.arguments)){const r=await oi(n);e.arguments[t].asArgument=ii(r)}return e},ao("arguments",((e,t)=>t(e.message.arguments,e.message))),async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(mr(e)){Array.isArray(e.payer)||de.deprecate({pkg:"FCL",subject:'"ix.payer" must be an array. Support for ix.payer as a singular',message:"See changelog for more info."});let[r,i]=Ki();try{let n=5,o=new Set([...to(e[Zi.PAYER]),...to(e[Zi.PROPOSER]),...to(e[Zi.AUTHORIZATIONS])]);for(;o.size>0;){if(n<=0)throw new Error("resolveAccounts Error: Depth limit (5) reached. Ensure your authorization functions resolve to an account after 5 resolves.");o=await ro(e,o,n,{debugLogger:r}),n--}await Ji(e);for(const t of Object.values(Zi))fe(to(e[t]).length>0||t===Zi.AUTHORIZATIONS,`resolveAccountType Error: no accounts for role "${t}" found`);t.enableDebug&&console.debug(i())}catch(n){throw console.error("=== SAD PANDA ===\n\n",n,"\n\n=== SAD PANDA ==="),n}}return e},ao("accounts",((e,t,n)=>t(...n(e)))),async function(e){if(mr(e)&&null==e.message.refBlock){const t=await xt().get("accessNode.api"),n=await xt.first(["sdk.transport","sdk.send"],Tn);fe(n,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),e.message.refBlock=(await n(jr([qr()]),{config:xt,response:Vr,Buffer:At.lW,ix:Ur},{node:t}).then(Qr)).id}return e},async function(e){if(mr(e)){var t=Object.values(e.accounts).find((e=>e.role.proposer));if(fe(t,"Transactions require a proposer"),null==t.sequenceNum){const n=await xt().get("accessNode.api"),r=await xt.first(["sdk.transport","sdk.send"],Tn);fe(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),e.accounts[t.tempId].sequenceNum=await r(await jr([zr(t.addr)]),{config:xt,response:Vr,Buffer:At.lW,ix:Ur},{node:n}).then(Qr).then((e=>e.keys)).then((e=>e.find((e=>e.index===t.keyId)))).then((e=>e.sequenceNumber))}}return e},async function(e){if(mr(e))try{let t=qi(e);const n=si(oo(e));await Promise.all(t.map(io(e,n)));let r=zi(e);const i=ai({...oo(e),payloadSigs:t.map((t=>({address:e.accounts[t].addr||"",keyId:e.accounts[t].keyId||0,sig:e.accounts[t].signature||""})))});await Promise.all(r.map(io(e,i)))}catch(t){throw console.error("Signatures",t,{ix:e}),t}return e},ao("signatures",((e,t,n)=>t(...n(e)))),async function(e){for(let t of Object.keys(e.accounts))e.accounts[t].addr=Pt(e.accounts[t].addr);return e},async function(e){return Rr(e,Br(e,"ix.validators",[]).map((e=>t=>e(t,{Ok:Gn,Bad:Zn}))))},async function(e){const t=Br(e,"ix.voucher-intercept");return Hn(t)&&await t(Hi(e)),e},ao("resolved",((e,t)=>t(e)))]);function uo(){for(var e=arguments.length,t=new Array(e),n=0;n1){const[e,n]=t;return uo(((t,r)=>{let{Ok:i,Bad:o}=r;return e?i(t):o(t,n)}))}const[r]=t;return e=>r(e,{Ok:Gn,Bad:Zn})}const lo=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await xt.first(["sdk.transport","sdk.send"],t.send||Tn);uo(n,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21");const r=await xt.first(["sdk.resolve"],t.resolve||co);return t.node=t.node||await xt().get("accessNode.api"),Array.isArray(e)&&(e=Rr(Un(),e)),n(await r(e),{config:xt,response:Vr,ix:Ur,Buffer:At.lW},t)};async function fo(e){const t=await xt().where(/^decoder\./),n=Object.entries(t).map((e=>{let[t,n]=e;return t=`/${t.replace(/^decoder\./,"")}$/`,[t,n]}));return Qr(e,Object.fromEntries(n))}class ho extends Error{constructor(e){super(`\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: ${e}. \n Please ensure the address: ${e} is intended to sign the given transaction as specified by the transaction signable.\n `.trim()),this.name="Unable To Determine Message Encoding For Signer Addresss"}}function po(e){return Dr("ix.validators",(t=>Array.isArray(t)?t.push(e):[e]))}function go(e){return Rr([t=>(t.block.height=e,t),po((e=>{if("boolean"===typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e}))])}function mo(e){return Rr([t=>(t.block.id=e,Gn(t)),po(((e,t)=>{let{Ok:n,Bad:r}=t;return vr(e)?r(e,"Unable to specify a block id with a Get Account interaction."):"boolean"===typeof e.block.isSealed?r(e,"Unable to specify both block id and isSealed."):e.block.height?r(e,"Unable to specify both block id and block height."):n(e)}))])}function bo(e){let{height:t,id:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return fe(!(n&&t),'Method: account -- Cannot pass "id" and "height" simultaneously'),n?lo([zr(e),mo(n)],r).then(Qr):t?lo([zr(e),go(t)],r).then(Qr):lo([zr(e)],r).then(Qr)}function yo(){let{sealed:e=!1,id:t,height:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fe(!(e&&t||e&&n),'Method: block -- Cannot pass "sealed" with "id" or "height"'),fe(!(t&&n),'Method: block -- Cannot pass "id" and "height" simultaneously'),t?lo([qr(),mo(t)],r).then(Qr):n?lo([qr(),go(n)],r).then(Qr):lo([qr(e)],r).then(Qr)}function vo(){return Rr([fr,e=>Gn(e)])}async function wo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return lo([vo()],e).then(Qr)}function xo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Rr(e.map((e=>Jn(e,{role:Se.AUTHORIZER}))))}function So(e,t,n,r){return{addr:e,signingFunction:t,keyId:n,sequenceNum:r}}function Ao(e,t,n){return"undefined"===typeof t&&"undefined"===typeof n||de.deprecate({pkg:"FCL/SDK",subject:"Passing a start and end into getEvents",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder"}),Rr([or,r=>(r.events.eventType=e,r.events.start=t,r.events.end=n,Gn(r))])}function Eo(e,t,n){return Rr([or,r=>(r.events.eventType=e,r.events.start=t,r.events.end=n,Gn(r))])}function _o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Rr([or,n=>(n.events.eventType=e,n.events.blockIds=t,Gn(n))])}function Co(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Rr([cr,t=>(t.block.isSealed=e,Gn(t))])}function Io(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Rr([ur,t=>(t.collection.id=e,t)])}function ko(e){return Rr([nr,t=>(t.transaction.id=e,Gn(t))])}function To(e){return Rr([rr,t=>(t.transaction.id=e,Gn(t))])}function Mo(){return Rr([lr,e=>Gn(e)])}function Po(e){return t=>(t.message.computeLimit=e,t)}function Oo(e){return Rr(e.map(Qn))}function Ro(e,t){return{value:e,xform:t}}function No(e){return Jn(e,{role:Se.PROPOSER})}function Bo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)||(e=[e]),Rr(e.map((e=>Jn(e,{role:Se.PAYER}))))}function Lo(){return sr}function Do(e){return Rr([t=>(t.message.refBlock=e,Gn(t))])}function Uo(){return Rr([er,Lr("ix.cadence",Rn(...arguments))])}const jo=[];function Fo(){return Rr([tr,Lr("ix.cadence",Rn(...arguments)),e=>(e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||jo,Gn(e))])}function Vo(e){return Lr("ix.voucher-intercept",e)}function qo(e){let{startBlockId:t,startHeight:n,eventTypes:r,addresses:i,contracts:o,heartbeatInterval:s}=e;return fe(!(t&&n),"SDK Subscribe Events Error: Cannot set both startBlockId and startHeight."),Rr([dr,e=>(e.subscribeEvents.startBlockId=t??null,e.subscribeEvents.startHeight=n??null,e.subscribeEvents.eventTypes=r??null,e.subscribeEvents.addresses=i??null,e.subscribeEvents.contracts=o??null,e.subscribeEvents.heartbeatInterval=s??null,Gn(e))])}function zo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;fe(e.account,"mockAccountResponse(ix) -- ix.account is missing",e),fe(e.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",e);const n=e.account.addr;return{account:{addr:n,keys:Array.from({length:t},((e,t)=>({index:t,sequenceNumber:42})))}}}const Ho=e=>e;function Wo(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Go(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){const n={...t,...e,resolve:null,signingFunction:e.signingFunction||t.signingFunction||function(e){return{addr:n.addr,keyId:n.keyId,signature:Wo(n)}}};return n}}const Zo={proposer:!1,authorizer:!1,payer:!1};function Ko(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{authorizations:[]};return function(t){return{...t,tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:()=>[e.proposer&&Go(e.proposer)({role:{...Zo,proposer:!0}}),...e.authorizations.map(Go).map((e=>e({role:{...Zo,authorizer:!0}}))),e.payer&&Go(e.payer)({role:{...Zo,payer:!0}})].filter(Boolean)}}}var Xo=Object.freeze({__proto__:null,mockSend:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ho;return async function(t){switch(t=await t,!0){case vr(t):return zo(t);case Sr(t):return{tag:"GET_BLOCK",block:{id:"32"}};default:return e(t)}}},authzFn:Go,authzResolve:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){const{tempId:n,...r}=e;return{...t,tempId:n||"WITH_RESOLVE",resolve:Go(r)}}},authzResolveMany:Ko,authzDeepResolveMany:function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{authorizations:[]},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return function(r){const i=t.tempId||"AUTHZ_DEEP_RESOLVE_MANY";return{...r,tempId:i,resolve:n>0?e(t,n-1)(r).resolve:Ko(t)(r).resolve}}},sig:Wo,idof:e=>`${Ot(e.addr)}-${e.keyId}`,run:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return jr([Do("123"),...e]).then(co)}});const Yo=e=>de.deprecate({pkg:"FCL/SDK",message:"The params builder has been removed from the Flow JS-SDK/FCL.",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params",level:le.error}),Jo=e=>de.deprecate({pkg:"FCL/SDK",message:"The param builder has been removed from the Flow JS-SDK/FCL.",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params",level:le.error}),Qo=(e,t,n)=>({label:e,asArgument:t,asInjection:t=>(de.deprecate({pkg:"@onflow/types",subject:`Passing in ${e} as value for ${e}`,message:`Going forward, use ${e} as value for ${e}.`}),n(t))}),$o=e=>Array.isArray(e),es=e=>"object"===typeof e,ts=e=>null==e,ns=e=>"number"===typeof e,rs=e=>Number.isInteger(e),is=e=>"string"===typeof e,os=e=>{throw new Error("Type Error: "+e)},ss=e=>{de.deprecate({pkg:"@onflow/types",subject:`Passing in Number as value for ${e}`,message:`Going forward, use String as value for ${e}.`,transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0002-[U]Int*-and-Word*-as-Number"})};let as=!1;const cs={label:"Identity",asArgument:e=>(as||(de.deprecate({pkg:"@onflow/types",subject:"Identity",message:"Identity type is deprecated and will be removed in v2.0.0. Please remove it from your code."}),as=!0),e),asInjection:e=>e},us=Qo("UInt",(e=>ns(e)&&rs(e)?(ss("UInt"),{type:"UInt",value:e.toString()}):is(e)?{type:"UInt",value:e}:os("Expected Positive Integer for type Unsigned Int")),(e=>e)),ls=Qo("Int",(e=>ns(e)&&rs(e)?(ss("Int"),{type:"Int",value:e.toString()}):is(e)?{type:"Int",value:e}:os("Expected Integer for type Int")),(e=>e)),ds=Qo("UInt8",(e=>ns(e)&&rs(e)?(ss("UInt8"),{type:"UInt8",value:e.toString()}):is(e)?{type:"UInt8",value:e}:os("Expected integer for UInt8")),(e=>e)),fs=Qo("Int8",(e=>ns(e)&&rs(e)?(ss("Int8"),{type:"Int8",value:e.toString()}):is(e)?{type:"Int8",value:e}:os("Expected positive integer for Int8")),(e=>e)),hs=Qo("UInt16",(e=>ns(e)&&rs(e)?(ss("UInt16"),{type:"UInt16",value:e.toString()}):is(e)?{type:"UInt16",value:e}:os("Expected integer for UInt16")),(e=>e)),ps=Qo("Int16",(e=>ns(e)&&rs(e)?(ss("Int16"),{type:"Int16",value:e.toString()}):is(e)?{type:"Int16",value:e}:os("Expected positive integer for Int16")),(e=>e)),gs=Qo("UInt32",(e=>ns(e)&&rs(e)?(ss("UInt32"),{type:"UInt32",value:e.toString()}):is(e)?{type:"UInt32",value:e}:os("Expected integer for UInt32")),(e=>e)),ms=Qo("Int32",(e=>ns(e)&&rs(e)?(ss("Int32"),{type:"Int32",value:e.toString()}):is(e)?{type:"Int32",value:e}:os("Expected positive integer for Int32")),(e=>e)),bs=Qo("UInt64",(e=>ns(e)&&rs(e)?(ss("UInt64"),{type:"UInt64",value:e.toString()}):is(e)?{type:"UInt64",value:e}:os("Expected integer for UInt64")),(e=>e)),ys=Qo("Int64",(e=>ns(e)&&rs(e)?(ss("Int64"),{type:"Int64",value:e.toString()}):is(e)?{type:"Int64",value:e}:os("Expected positive integer for Int64")),(e=>e)),vs=Qo("UInt128",(e=>ns(e)&&rs(e)?(ss("UInt128"),{type:"UInt128",value:e.toString()}):is(e)?{type:"UInt128",value:e}:os("Expected integer for UInt128")),(e=>e)),ws=Qo("Int128",(e=>ns(e)&&rs(e)?(ss("Int128"),{type:"Int128",value:e.toString()}):is(e)?{type:"Int128",value:e}:os("Expected positive integer for Int128")),(e=>e)),xs=Qo("UInt256",(e=>ns(e)&&rs(e)?(ss("UInt256"),{type:"UInt256",value:e.toString()}):is(e)?{type:"UInt256",value:e}:os("Expected integer for UInt256")),(e=>e)),Ss=Qo("Int256",(e=>ns(e)&&rs(e)?(ss("Int256"),{type:"Int256",value:e.toString()}):is(e)?{type:"Int256",value:e}:os("Expected integer for Int256")),(e=>e)),As=Qo("Word8",(e=>ns(e)&&rs(e)?(ss("Word8"),{type:"Word8",value:e.toString()}):is(e)?{type:"Word8",value:e}:os("Expected positive number for Word8")),(e=>e)),Es=Qo("Word16",(e=>ns(e)&&rs(e)?(ss("Word16"),{type:"Word16",value:e.toString()}):is(e)?{type:"Word16",value:e}:os("Expected positive number for Word16")),(e=>e)),_s=Qo("Word32",(e=>ns(e)&&rs(e)?(ss("Word32"),{type:"Word32",value:e.toString()}):is(e)?{type:"Word32",value:e}:os("Expected positive number for Word32")),(e=>e)),Cs=Qo("Word64",(e=>ns(e)&&rs(e)?(ss("Word64"),{type:"Word64",value:e.toString()}):is(e)?{type:"Word64",value:e}:os("Expected positive number for Word64")),(e=>e)),Is=Qo("Word128",(e=>ns(e)&&rs(e)?(ss("Word128"),{type:"Word128",value:e.toString()}):is(e)?{type:"Word128",value:e}:os("Expected positive number for Word128")),(e=>e)),ks=Qo("Word256",(e=>ns(e)&&rs(e)?(ss("Word256"),{type:"Word256",value:e.toString()}):is(e)?{type:"Word256",value:e}:os("Expected positive number for Word256")),(e=>e)),Ts=()=>{de.deprecate({subject:"Passing in Numbers as values for Fix64 and UFix64 types",pkg:"@onflow/types",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0001-[U]Fix64-as-Number"})},Ms=Qo("UFix64",(e=>{if(is(e)){const t=e.split(".");return 2!==t.length?os(`Expected one decimal but found ${t.length} in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):0==t[1].length||t[1].length>8?os(`Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ${t[1].length} digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):(t[1]=t[1].padEnd(8,"0"),{type:"UFix64",value:e=t.join(".")})}return ns(e)?(Ts(),{type:"UFix64",value:e.toString()}):os("Expected String for UFix64")}),(e=>e)),Ps=Qo("Fix64",(e=>{if(is(e)){const t=e.split(".");return 2!==t.length?os(`Expected one decimal but found ${t.length} in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):0==t[1].length||t[1].length>8?os(`Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ${t[1].length} digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):(t[1]=t[1].padEnd(8,"0"),{type:"Fix64",value:e=t.join(".")})}return ns(e)?(Ts(),{type:"Fix64",value:e.toString()}):os("Expected String for Fix64")}),(e=>e)),Os=Qo("String",(e=>is(e)?{type:"String",value:e}:os("Expected String for type String")),(e=>e)),Rs=Qo("Character",(e=>is(e)?{type:"Character",value:e}:os("Expected Character for type Character")),(e=>e)),Ns=Qo("Bool",(e=>(e=>"boolean"===typeof e)(e)?{type:"Bool",value:e}:os("Expected Boolean for type Bool")),(e=>e)),Bs=Qo("Address",(e=>is(e)?{type:"Address",value:e}:os("Expected Address for type Address")),(e=>e)),Ls=Qo("Void",(e=>!e||ts(e)?{type:"Void",value:null}:os("Expected Void for type Void")),(e=>e)),Ds=e=>Qo("Optional",(t=>({type:"Optional",value:ts(t)?null:e.asArgument(t)})),(e=>e)),Us=Qo("Reference",(e=>es(e)?{type:"Reference",value:e}:os("Expected Object for type Reference")),(e=>e)),js=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Qo("Array",(t=>({type:"Array",value:$o(e)?e.map(((e,n)=>e.asArgument(t[n]))):t.map((t=>e.asArgument(t)))})),(e=>e))},Fs=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Qo("Dictionary",(t=>{const n=$o(t),r=$o(e);return es(t)?{type:"Dictionary",value:r&&n?e.map(((e,n)=>({key:e.key.asArgument(t[n].key),value:e.value.asArgument(t[n].value)}))):n&&!r?t.map((t=>({key:e.key.asArgument(t.key),value:e.value.asArgument(t.value)}))):n||r?os("Invalid arguments for Dictionary."):[{key:e.key.asArgument(t.key),value:e.value.asArgument(t.value)}]}:os("Expected Object for type Dictionary")}),(e=>e))},Vs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qo("Event",(n=>es(n)?{type:"Event",value:{id:e,fields:$o(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:os("Expected Object for type Event")),(e=>e))},qs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qo("Resource",(n=>es(n)?{type:"Resource",value:{id:e,fields:$o(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:os("Expected Object for type Resource")),(e=>e))},zs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qo("Struct",(n=>es(n)?{type:"Struct",value:{id:e,fields:$o(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:os("Expected Object for type Struct")),(e=>e))},Hs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qo("Enum",(n=>es(n)?{type:"Enum",value:{id:e,fields:$o(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:os("Expected Object for type Enum")),(e=>e))},Ws=Qo("Path",(e=>es(e)?is(e.domain)?"storage"!==e.domain&&"private"!==e.domain&&"public"!==e.domain?os(`Expected either "storage", "private" or "public" as the Path domain but found ${e.domain}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):is(e.identifier)?{type:"Path",value:{domain:e.domain,identifier:e.identifier}}:os(`Expected a string for the Path identifier but found ${e.identifier}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):os(`Expected a string for the Path domain but found ${e.domain}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):os("Expected Object for type Path")),(e=>e)),Gs=e=>Qo("InclusiveRange",(t=>{if(es(t)){const{start:n,end:r,step:i}=t;return{type:"InclusiveRange",value:{start:e.asArgument(n),end:e.asArgument(r),step:e.asArgument(i)}}}return os("Expected Object for type InclusiveRange")}),(e=>e));var Zs=n(58368),Ks=n.n(Zs),Xs=n(33037),Ys=/^[0-9]+$/,Js=function(e,t){var n=Ys.test(e),r=Ys.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:eparseInt(r[i]))return 1;if(parseInt(n[i])t=>typeof t===e,na=e=>null!=e,ra=ta("object"),ia=ta("string"),oa=ta("function"),sa=ta("number");function aa(e){return oa(e)?e(Ro,r):[]}async function ca(e){let t,{url:n}=e;fe("undefined"!==typeof n,"retrieve({ url }) -- url must be defined");try{t=await Ks()(n)}catch(r){throw new Error("httpDocumentResolver Error: Failed to retrieve document.")}return t.ok?await t.json():null}const ua=new Map([["http",ca],["https",ca]]);async function la(e){let{network:t,template:n}=e;fe("1.1.0"===n.f_version,"deriveCadenceByNetwork110({ template }) -- template must be version 1.0.0");const r={};return n?.data?.dependencies.forEach((e=>{e.contracts.forEach((e=>{const n=e.contract;e.networks.forEach((e=>{e.network===t&&(r[n]=e.address)})),fe(void 0!==r[n],`deriveCadenceByNetwork110 -- Could not find contracts Network Address: ${t} ${n}`)}))})),fe(Object.keys(r).length===n?.data?.dependencies.length,`deriveCadenceByNetwork110 -- Could not find contracts for import dependencies: ${r}`),fe(Object.keys(r).length===Object.values(r).length,`deriveCadenceByNetwork110 -- Could not find all addresses for network ${t} dependencies: ${r}`),fe(n?.data?.cadence?.body,`no cadence found -- Could not replace import dependencies: ${r}`),function(e){let{cadence:t,networkDependencies:n}=e;return Object.keys(n).reduce(((e,t)=>{const r=n[t],i=new RegExp(`import "\\b${t}\\b"`,"g");return e.replace(i,`import ${t} from ${r}`)}),t)}({cadence:n?.data?.cadence?.body,networkDependencies:r})}async function da(e){let{network:t,template:n}=e;switch(fe(void 0!=t,"deriveCadenceByNetwork({ network }) -- network must be defined"),fe("string"===typeof t,"deriveCadenceByNetwork({ network }) -- network must be a string"),fe(void 0!=n,"deriveCadenceByNetwork({ template }) -- template must be defined"),fe("object"===typeof n,"deriveCadenceByNetwork({ template }) -- template must be an object"),fe("InteractionTemplate"===n.f_type,"deriveCadenceByNetwork({ template }) -- template must be an InteractionTemplate"),n.f_version){case"1.1.0":return await la({network:t,template:n});case"1.0.0":return await async function(e){let{network:t,template:n}=e;return fe("1.0.0"===n.f_version,"deriveCadenceByNetwork100({ template }) -- template must be version 1.0.0"),Object.keys(n?.data?.dependencies).map((e=>{const r=Object.values(n?.data?.dependencies?.[e]);fe(void 0!==r,`deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ${e}`),fe(r.length>0,`deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ${e}`);const i=r[0]?.[t];return fe(i,`deriveCadenceByNetwork100 -- Could not find ${t} network information for dependency: ${e}`),[e,i?.address]})).reduce(((e,t)=>{let[n,r]=t;const i=new RegExp("(\\b"+n+"\\b)","g");return e.replace(i,r)}),n.data.cadence)}({network:t,template:n});default:throw new Error("deriveCadenceByNetwork Error: Unsupported template version")}}async function fa(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=await lo([Mo()],e).then(fo);return t.chainId}let ha={},pa=!1;async function ga(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=await xt.get("flow.network"),n=await xt.get("env");n&&!pa&&(de.deprecate({pkg:"FCL",subject:'Using the "env" configuration key for specifying the flow network',message:"Configuring to specify flow network is no longer required",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/TRANSITIONS.md#0001-deprecate-env-config-key"}),pa=!0);const r=e.node||await xt.get("accessNode.api");if(!r){if(t)return t;if(n)return n;throw new Error('Either the "accessNode.api" config key or opts.node must be set')}if(ha[r])try{return await ha[r]}catch{}ha[r]||(ha[r]=fa(e).catch((e=>{throw ha[r]=null,e})));try{return await ha[r]}catch(i){if(t)return t;if(n)return n;throw new Error(`Error getting chainId from access node - are you using the correct access node endpoint. If running locally, is your emulator up-to-date? ${i.message}`)}}function ma(){return"undefined"!==typeof navigator&&/iPhone|iPod/.test(navigator.userAgent)||"undefined"!==typeof navigator&&/iPad/.test(navigator.userAgent)}function ba(){return"undefined"!==typeof navigator&&/android/i.test(navigator.userAgent)||ma()}async function ya(e){ia(e?.template)&&(e.template=await async function(e){let{url:t}=e;fe("undefined"!==typeof t,"retrieve({ url }) -- url must be defined"),fe("string"===typeof t,"retrieve({ url }) -- url must be a string");const n=await xt().where(/^document\.resolver\./);Object.keys(n).map((e=>{const t=n[e],r=e.replace(/^document\.resolver\./,"");ua.set(r,t)}));const r=/^(.*):\/\/([A-Za-z0-9\-\.]+)(:[0-9]+)?(.*)$/.exec(t);fe(r,"Failed to parse URL");const i=r[1];fe(r,"Failed to parse URL protocol");const o=ua.get(i);return fe(o,`No resolver found for protcol=${i}`),await o({url:t})}({url:e?.template}));const t=e.cadence||await da({template:e.template,network:await ga(e)});return e.cadence=t,e}async function va(e,t){fe(na(t),`${e}(opts) -- opts is required`),fe(ra(t),`${e}(opts) -- opts must be an object`),fe(!(t.cadence&&t.template),`${e}({ template, cadence }) -- cannot pass both cadence and template`),fe(na(t.cadence||t?.template),`${e}({ cadence }) -- cadence is required`),fe(ia(t.cadence)||t?.template,`${e}({ cadence }) -- cadence must be a string`),fe(await xt().get("accessNode.api"),`${e}(opts) -- Required value for "accessNode.api" not defined in config. See: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/src/exec/query.md#configuration`)}async function wa(e){return va("mutate",e)}async function xa(e){return va("query",e)}async function Sa(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return await xa(e),e=await ya(e),lo([Uo(e.cadence),Oo(aa(e.args||[])),e.limit&&"number"===typeof e.limit&&Po(e.limit)]).then(fo)}const Aa="fcl_redirect_url",Ea="fclResponseJson",_a={"HTTP/RPC":"HTTP/RPC","HTTP/POST":"HTTP/POST","IFRAME/RPC":"IFRAME/RPC","POP/RPC":"POP/RPC","TAB/RPC":"TAB/RPC","EXT/RPC":"EXT/RPC","DEEPLINK/RPC":"DEEPLINK/RPC"},Ca=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};const n=e=>(e.deprecated&&console.warn("DEPRECATION NOTICE",e.deprecated.message),delete e?.body?.interaction,e),r=r=>{const{data:i}=r;"object"===typeof i&&null!=typeof i&&i.type===e&&t(n(i))};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)};let Ia=!1;const ka=globalThis.URL;class Ta extends ka{constructor(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i1&&void 0!==arguments[1]?arguments[1]:{};const n={...t,type:e},r=new URLSearchParams(window.location.search),i=r.get(Aa);if(i){const e=new Ta(i);e.searchParams.append(Ea,JSON.stringify(n)),window.location.href=e.href}else if(window.location!==window.parent.location)window.parent.postMessage({...t,type:e},"*");else{if(!window.opener)throw new Error("Unable to communicate with parent FCL instance");window.opener.postMessage({...t,type:e},"*")}},Pa={f_type:"Service",f_vsn:"1.0.0"},Oa={f_type:"Identity",f_vsn:"1.0.0"},Ra={f_type:"USER",f_vsn:"1.0.0"},Na={f_type:"PollingResponse",f_vsn:"1.0.0"},Ba={f_type:"CompositeSignature",f_vsn:"1.0.0"};const La=(e,t)=>At.lW.from(e.padEnd(2*t,"0"),"hex"),Da=e=>((e,t)=>At.lW.from(e.padStart(2*t,"0"),"hex"))(e,8),Ua=e=>At.lW.from(e,"hex"),ja=function(e){let{address:t,nonce:n,appIdentifier:r}=e,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];fe(t,"Encode Message For Provable Authn Error: address must be defined"),fe(n,"Encode Message For Provable Authn Error: nonce must be defined"),fe(r,"Encode Message For Provable Authn Error: appIdentifier must be defined"),fe(n.length>=64,"Encode Message For Provable Authn Error: nonce must be minimum of 32 bytes");const o=La(At.lW.from("FCL-ACCOUNT-PROOF-V0.0").toString("hex"),32);return i?At.lW.concat([o,Et([r,Da(Pt(t)),Ua(n)])]).toString("hex"):Et([r,Da(Pt(t)),Ua(n)]).toString("hex")};var Fa=Object.freeze({__proto__:null,sendMsgToFCL:Ma,ready:function(e){Ca("FCL:VIEW:READY:RESPONSE",e),Ma("FCL:VIEW:READY")},close:()=>{Ma("FCL:VIEW:CLOSE")},approve:e=>{Ma("FCL:VIEW:RESPONSE",{f_type:"PollingResponse",f_vsn:"1.0.0",status:"APPROVED",reason:null,data:e})},decline:e=>{Ma("FCL:VIEW:RESPONSE",{f_type:"PollingResponse",f_vsn:"1.0.0",status:"DECLINED",reason:e,data:null})},redirect:e=>{Ma("FCL:VIEW:RESPONSE",{f_type:"PollingResponse",f_vsn:"1.0.0",status:"REDIRECT",reason:null,data:e})},onMessageFromFCL:Ca,encodeMessageFromSignable:(e,t)=>{let n=(e=>{let t=new Set(e.authorizers);return t.add(e.proposalKey.address),t.delete(e.payer),Array.from(t).map(Ot)})(e.voucher),r=(e=>{let t=new Set([e.payer]);return Array.from(t).map(Ot)})(e.voucher);const i=n.includes(Ot(t)),o=r.includes(Ot(t));if(!i&&!o)throw new ho(t);const s={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:{...e.voucher.proposalKey,address:Pt(e.voucher.proposalKey.address)},payer:Pt(e.voucher.payer),authorizers:e.voucher.authorizers.map(Pt),payloadSigs:e.voucher.payloadSigs.map((e=>({...e,address:Pt(e.address)})))};return i?si(s):ai(s)},CompositeSignature:function(e,t,n){this.f_type=Ba.f_type,this.f_vsn=Ba.f_vsn,this.addr=Ot(e),this.keyId=Number(t),this.signature=n},encodeAccountProof:ja,injectExtService:function(e){"authn"===e.type&&null!=e.endpoint?(Array.isArray(window.fcl_extensions)||(window.fcl_extensions=[]),window.fcl_extensions.push(e)):console.warn("Authn service is required")}});const Va="ACCOUNT_PROOF",qa="USER_SIGNATURE",za=e=>{if(e.appIdentifier){const{appIdentifier:t,address:n,nonce:r,signatures:i}=e;return fe(ia(t),"verifyAccountProof({ appIdentifier }) -- appIdentifier must be a string"),fe(ia(n)&&16===Pt(n).length,"verifyAccountProof({ address }) -- address must be a valid address"),fe(/^[0-9a-f]+$/i.test(r),"nonce must be a hex string"),fe(Array.isArray(i)&&i.every(((e,t,n)=>"CompositeSignature"===e.f_type)),"Must include an Array of CompositeSignatures to verify"),fe(i.map((e=>e.addr)).every(((e,t,n)=>e===n[0])),"User signatures to be verified must be from a single account address"),!0}{const{message:t,address:n,compSigs:r}=e;return fe(/^[0-9a-f]+$/i.test(t),"Signed message must be a hex string"),fe(ia(n)&&16===Pt(n).length,"verifyUserSignatures({ address }) -- address must be a valid address"),fe(Array.isArray(r)&&r.every(((e,t,n)=>"CompositeSignature"===e.f_type)),"Must include an Array of CompositeSignatures to verify"),fe(r.map((e=>e.addr)).every(((e,t,n)=>e===n[0])),"User signatures to be verified must be from a single account address"),!0}},Ha=async(e,t)=>{const n="ACCOUNT_PROOF"===e?"verifyAccountProofSignatures":"verifyUserSignatures";let r=await ga(t);const i=t.fclCryptoContract||{testnet:"0x74daa6f9c7ef24b1",mainnet:"0xb4b82a1c9d21d284",previewnet:"0x40b5b8b2ce81ea4a"}[r];return fe(i,`${n}({ fclCryptoContract }) -- FCLCrypto contract address is unknown for network: ${r}. Please manually specify the FCLCrypto contract address.`),`\n import FCLCrypto from ${i}\n\n access(all) fun main(\n address: Address, \n message: String, \n keyIndices: [Int], \n signatures: [String]\n ): Bool {\n return FCLCrypto.${n}(address: address, message: message, keyIndices: keyIndices, signatures: signatures)\n }\n `};async function Wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Ot(t[0].addr);za({message:e,address:r,compSigs:t});let i=[],o=[];for(const s of t)i.push(s.signature),o.push(s.keyId.toString());return Sa({cadence:await Ha(qa,n),args:(t,n)=>[t(r,n.Address),t(e,n.String),t(o,n.Array(n.Int)),t(i,n.Array(n.String))]})}var Ga=Object.freeze({__proto__:null,verifyAccountProof:async function(e,t){let{address:n,nonce:r,signatures:i}=t,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};za({appIdentifier:e,address:n,nonce:r,signatures:i});const s=ja({address:n,nonce:r,appIdentifier:e},!1);let a=[],c=[];for(const u of i)a.push(u.signature),c.push(u.keyId.toString());return Sa({cadence:await Ha(Va,o),args:(e,t)=>[e(Ot(n),t.Address),e(s,t.String),e(c,t.Array(t.Int)),e(a,t.Array(t.String))]})},verifyUserSignatures:Wa});const Za=de.deprecate({pkg:"FCL",subject:"fcl.verifyUserSignatures()",message:"Please use fcl.AppUtils.verifyUserSignatures()",callback:function(e,t){return Wa(e,t)}}),Ka=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await xt.first(["sdk.resolve"],t.resolve||co);return Array.isArray(e)&&(e=await Rr(jn(),e)),JSON.stringify(Hi(await n(e)),null,2)};async function Xa(e){return Object.fromEntries(Object.entries(await xt().where(e)).map((t=>{let[n,r]=t;return[n.replace(e,""),r]})))}const Ya=/^[0-9a-fA-F]{64}$/,Ja="POLL",Qa="TIMEOUT",$a=async e=>lo([ko(e)]).then(fo),ec=e=>e.status>=4,tc=e=>e.status>=3,nc=e=>e.status>=2,rc=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),ic=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{[Ie]:async t=>{setTimeout((()=>t.sendSelf(Qa)),e.txNotFoundTimeout),t.sendSelf(Ja)},[ke]:(e,t)=>{e.subscribe(t.from),e.send(t.from,Me,e.all())},[Te]:(e,t)=>{e.unsubscribe(t.from)},[Pe]:async(e,t)=>{t.reply(e.all())},[Qa]:async t=>{0===Object.keys(t.all()).length&&t.fatalError(new Error(`TX status polling failed: no transaction was found within timeout interval (${e.txNotFoundTimeout}ms)`))},[Ja]:async t=>{const n=()=>setTimeout((()=>t.sendSelf(Ja)),e.pollRate);let r;const i=t.all();try{r=await $a(t.self())}catch(o){const e=o instanceof Ft&&404===o.statusCode,r=o.code===Xs.grpc.Code.NotFound;return e||r?n():t.fatalError(o)}ec(r)||n(),rc(i,r)&&t.broadcast(Me,r),t.merge(r)}}},oc=e=>{if("object"===typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},sc=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>Fe(ic(e),oc(t))};function ac(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{txNotFoundTimeout:12500,pollRate:2500};if(!Ya.test(oc(e)))throw new Error("Invalid transactionId");function n(){return ze(e,sc(t))}function r(n){return qe(oc(e),sc(t),n)}function i(e){return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=t.suppress||!1;return new Promise(((t,i)=>{const o=r(((r,s)=>{!s&&!r.statusCode||n?e(r)&&(t(r),o()):(i(s||r.errorMessage),o())}))}))}}return{snapshot:n,subscribe:r,onceFinalized:i(nc),onceExecuted:i(tc),onceSealed:i(ec)}}ac.isUnknown=e=>e.status>=0,ac.isPending=e=>e.status>=1,ac.isFinalized=nc,ac.isExecuted=tc,ac.isSealed=ec,ac.isExpired=e=>5===e.status;const cc="TICK",uc="hwm",lc=async e=>setTimeout((()=>e.sendSelf(cc)),await xt().get("fcl.eventPollRate",1e4)),dc={[cc]:async e=>{if(!e.hasSubs())return;let t=e.get(uc);if(null==t)e.put(uc,await yo()),e.put(cc,await lc(e));else{let n=await yo();if(e.put(uc,n),t.height{e.hasSubs()||e.put(cc,await lc(e)),e.subscribe(t.from)},[Te]:(e,t)=>{e.unsubscribe(t.from),e.hasSubs()||(clearTimeout(e.get(cc)),e.delete(cc),e.delete(uc))}},fc=e=>Fe(dc,e);function hc(e){let t;return t="string"===typeof e?{eventTypes:[e]}:e||{},{subscribe:n=>{const r=lo([qo(t)]).then(fo),i=r.then((()=>null)).catch((t=>{if("SDK Send Error: subscribeEvents is not supported by this transport."!==t.message)throw t;if("string"!==typeof e)throw new Error("GRPC fcl.events fallback only supports string (type) filters");return(r=e,{subscribe:e=>qe(r,fc,e)}).subscribe(n);var r}));function o(e){e.forEach((e=>n(e,null)))}function s(e){n(null,e)}return i.then((e=>{e||r.then((e=>e.on("events",o).on("error",s))).catch((e=>{r.then((e=>e.close())),s(e)}))})),()=>{i.then((e=>{e?e():r.then((e=>e.close()))}))}}}}const pc=()=>{throw new Error("Platform specific Core Strategies are not initialized")},gc={[_a["EXT/RPC"]]:pc,[_a["HTTP/POST"]]:pc,[_a["IFRAME/RPC"]]:pc,[_a["POP/RPC"]]:pc,[_a["TAB/RPC"]]:pc,[_a["EXT/RPC"]]:pc},mc=["ServicePlugin"],bc=["discovery-service"],yc=e=>{let{coreStrategies:t}=e,n=new Set,r=new Map(Object.entries(t));const i=e=>n=new Set([...e]);return Object.freeze({add:e=>{if(fe(bc.includes(e.type),`Service Plugin type ${e.type} is not supported`),"discovery-service"===e.type){const{discoveryServices:t,serviceStrategy:n}=(e=>{const{services:t=[],serviceStrategy:n}=e;fe(Array.isArray(t),"Services must be an array");for(const r of t)fe(na(r.f_type)&&"Service"===r.f_type,"Service is required"),fe(na(r.type)&&"authn"===r.type,`Service must be type authn. Received ${r.type}`),fe(r.method in _a||n.method===r.method,`Service method ${r.method} is not supported`);return fe(na(n),"Service strategy is required"),fe(na(n.method)&&ia(n.method),"Service strategy method is required"),fe(na(n.exec)&&oa(n.exec),"Service strategy exec function is required"),{discoveryServices:t,serviceStrategy:n}})(e);i(t),r.has(n.method)?de({title:"Add Service Plugin",message:`Service strategy for ${n.method} already exists`,level:le.warn}):r.set(n.method,n.exec)}},getServices:()=>[...n],getStrategy:e=>r.get(e),getStrategies:()=>[...r.keys()]})};let vc;const wc=()=>"undefined"!==typeof vc,xc=e=>{let{coreStrategies:t}=e;if(wc())return vc;const n=yc({coreStrategies:t});return vc=n,n},Sc=()=>wc()?vc:(console.warn("Registry is not initalized, it will be initialized with stub core strategies"),xc({coreStrategies:gc})),Ac=(()=>{const e=new Map;return Object.freeze({add:t=>{const n=(e=>{let t;fe(!!e,"No plugins supplied"),t=Array.isArray(e)?[...e]:[e];for(const n of t)fe(na(n.name),"Plugin name is required"),fe(na(n.f_type),"Plugin f_type is required"),fe(mc.includes(n.f_type),`Plugin type ${n.f_type} is not supported`);return t})(t);for(const r of n)e.set(r.name,r),"ServicePlugin"===r.f_type&&vc.add(r)},getPlugins:()=>e})})(),Ec=async()=>[...window?.fcl_extensions||[],...Sc().getServices()];async function _c(e){const t=await xt.get("discovery.authn.include",[]),n=await xt.get("discovery.features.suggested",[]),r=await xt.first(["discovery.wallet.method","discovery.wallet.method.default"]),i=e?.method?e.method:r,o=e?.endpoint??await xt.first(["discovery.wallet","challenge.handshake"]);return fe(o,'\n If no service is passed to "authenticate," then "discovery.wallet" must be defined in fcl config.\n See: "https://docs.onflow.org/fcl/reference/api/#setting-configuration-values"\n '),{...e,type:"authn",endpoint:o,method:i,discoveryAuthnInclude:t,discoveryFeaturesSuggested:n}}const Cc="authn",Ic="UPDATED",kc="UPDATE_RESULTS",Tc=async()=>{try{const e=await async function(e){let{types:t}=e;const n=await xt.get("discovery.authn.endpoint");fe(Boolean(n),'"discovery.authn.endpoint" in config must be defined.');const r=await xt.get("discovery.authn.include",[]),i=new Ta(n);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,fclVersion:ea,include:r,features:{suggested:await xt.get("discovery.features.suggested",[])},clientServices:await Ec(),supportedStrategies:Sc().getStrategies(),userAgent:window?.navigator?.userAgent,network:await ga()})}).then((e=>e.json()))}({types:[Cc]});Le(Cc,kc,{results:e})}catch(e){de({title:`${e.name} Error fetching Discovery API services.`,message:e.message,level:le.error})}},Mc={[Ie]:async e=>{var t,n;t="undefined"===typeof window,n='"fcl.discovery" is only available in the browser.',t&&console.warn(`\n %cFCL Warning\n ============================\n ${n}\n For more info, please see the docs: https://docs.onflow.org/fcl/\n ============================\n `,"font-weight:bold;font-family:monospace;"),"complete"===document.readyState?Tc():window.addEventListener("load",(()=>{Tc()}))},[kc]:(e,t,n)=>{e.merge(n),e.broadcast(Ic,{...e.all()})},[ke]:(e,t)=>{e.subscribe(t.from),e.send(t.from,Ic,{...e.all()})},[Te]:(e,t)=>e.unsubscribe(t.from),["SNAPSHOT"]:async(e,t)=>t.reply({...e.all()})},Pc=()=>Fe(Mc,Cc),Oc={authn:{subscribe:e=>qe(Cc,Pc,e),snapshot:()=>ze(Cc,Pc),update:()=>{"complete"===document.readyState&&Tc()}}};function Rc(e){const t=new Mn.Aj(256);return t.update(At.lW.from(e,"utf8")),t.digest("hex")}function Nc(e){let{contractName:t,address:n}=e;return{contractName:t,address:n,contract:""}}function Bc(e){const t=[],n=e.match(/import ((\w|,| )+)* from 0x\w+/g)||[];for(const r of n){const e=/import ((\w+|, |)*) from (0x\w+)/g.exec(r),n=/((?:\w+)+),?/g,i=e[1].match(n)||[];for(const r of i)t.push(Nc({address:e[3],contractName:r.replace(/,/g,"")}))}return t}async function Lc(e){let{address:t,contractName:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};uo(void 0!=t,"generateDependencyPin({ address }) -- address must be defined"),uo(void 0!=n,"generateDependencyPin({ contractName }) -- contractName must be defined"),uo("string"===typeof t,"generateDependencyPin({ address }) -- address must be a string"),uo("string"===typeof n,"generateDependencyPin({ contractName }) -- contractName must be a string");const i=[Nc({contractName:n,address:t})];for(const c of i){const e=await lo([zr(await xt().get(c.address,c.address))],r).then(fo);if(c.contract=e.contracts?.[c.contractName],!c.contract)throw console.error("Did not find expected contract",c,e),new Error("Did not find expected contract");const t=Bc(c.contract);i.push(...t)}const o=i.map((e=>Rc(e.contract))),s=await Promise.all(o),a=s.join("");return Rc(a)}async function Dc(e,t){const n=[];for(const r of t){const t=[Rc(r.network)],{address:i,dependency_pin_block_height:o}=r;if(r.dependency_pin){const n=await Lc({address:i,contractName:e,blockHeight:o});t.push(Rc(n))}n.push(t)}return n}async function Uc(e){const t=[];for(let n=0;n[Rc(e.key),await Promise.all(e.i18n.map((async e=>[Rc(e.tag),Rc(e.translation)])))]))),i=await Promise.all(n?.parameters.sort(((e,t)=>e.index-t.index)).map((async e=>[Rc(e.label),[Rc(String(e.index)),Rc(e.type),await Promise.all(e.messages.map((async e=>[Rc(e.key),await Promise.all(e.i18n.map((async e=>[Rc(e.tag),Rc(e.translation)])))])))]]))),o=[await Uc(n?.dependencies)],s=Et([Rc(t?.f_type),Rc(t?.f_version),Rc(n?.type),Rc(n?.interface),r,Rc(n?.cadence?.body),[o],i]).toString("hex");return Rc(s)}({template:t});case"1.0.0":return await async function(e){let{template:t}=e;uo(void 0!=t,"generateTemplateId({ template }) -- template must be defined"),uo("object"===typeof t,"generateTemplateId({ template }) -- template must be an object"),uo("InteractionTemplate"===t.f_type,"generateTemplateId({ template }) -- template object must be an InteractionTemplate"),uo("1.0.0"===t.f_version,"generateTemplateId({ template }) -- template object must be an version 1.0.0");const n=t.data,r=await Promise.all(Object.keys(n.messages).map((async e=>[Rc(e),await Promise.all(Object.keys(n.messages?.[e]?.i18n).map((async t=>[Rc(t),Rc(n.messages?.[e]?.i18n?.[t])])))]))),i=await Promise.all(Object.keys(n?.dependencies).map((async e=>[Rc(e),await Promise.all(Object.keys(n?.dependencies?.[e]).map((async t=>[Rc(t),await Promise.all(Object.keys(n?.dependencies?.[e]?.[t]).map((async r=>[Rc(r),[Rc(n?.dependencies?.[e]?.[t]?.[r].address),Rc(n?.dependencies?.[e]?.[t]?.[r].contract),Rc(n?.dependencies?.[e]?.[t]?.[r].fq_address),Rc(n?.dependencies?.[e]?.[t]?.[r].pin),Rc(String(n?.dependencies?.[e]?.[t]?.[r].pin_block_height))]])))])))]))),o=await Promise.all(Object.keys(n?.arguments).map((async e=>[Rc(e),[Rc(String(n?.arguments?.[e].index)),Rc(n?.arguments?.[e].type),Rc(n?.arguments?.[e].balance||""),await Promise.all(Object.keys(n?.arguments?.[e].messages).map((async t=>[Rc(t),await Promise.all(Object.keys(n?.arguments?.[e].messages?.[t].i18n).map((async r=>[Rc(r),Rc(n?.arguments?.[e].messages?.[t].i18n?.[r])])))])))]]))),s=Et([Rc("InteractionTemplate"),Rc("1.0.0"),Rc(n?.type),Rc(n?.interface),r,Rc(n?.cadence),i,o]).toString("hex");return Rc(s)}({template:t});default:throw new Error("generateTemplateId Error: Unsupported template version")}}async function Fc(e){let{version:t,address:n,contractName:r}=e;switch(uo(void 0!=n,"generateDependencyPin({ address }) -- address must be defined"),uo(void 0!=r,"generateDependencyPin({ contractName }) -- contractName must be defined"),uo("string"===typeof n,"generateDependencyPin({ address }) -- address must be a string"),uo("string"===typeof r,"generateDependencyPin({ contractName }) -- contractName must be a string"),t){case"1.1.0":return await Lc({address:n,contractName:r});case"1.0.0":return await async function(e){let{address:t,contractName:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};uo(void 0!=t,"generateDependencyPin({ address }) -- address must be defined"),uo(void 0!=n,"generateDependencyPin({ contractName }) -- contractName must be defined"),uo("string"===typeof t,"generateDependencyPin({ address }) -- address must be a string"),uo("string"===typeof n,"generateDependencyPin({ contractName }) -- contractName must be a string");const i=[Nc({contractName:n,address:t})];for(const s of i){const e=await lo([zr(await xt().get(s.address,s.address))],r).then(fo);if(s.contract=e.contracts?.[s.contractName],!s.contract)throw console.error("Did not find expected contract",s,e),new Error("Did not find expected contract");const t=Bc(s.contract);i.push(...t)}const o=i.map((e=>Rc(e.contract)));return Rc(o.join(""))}({address:n,contractName:r});default:throw new Error("deriveCadenceByNetwork Error: Unsupported template version")}}async function Vc(e){let{template:t,blockHeight:n,network:r}=e;switch(uo(void 0!=t,"generateDependencyPin({ template }) -- template must be defined"),uo("object"===typeof t,"generateDependencyPin({ template }) -- template must be an object"),uo("InteractionTemplate"===t.f_type,"generateDependencyPin({ template }) -- template must be an InteractionTemplate"),uo(void 0!=r,"generateDependencyPin({ network }) network must be defined"),uo(void 0!=n,"generateDependencyPin({ blockHeight }) blockHeight must be defined"),uo("number"===typeof n,"generateDependencyPin({ blockHeight }) blockHeight must be a number"),t.f_version){case"1.0.0":const e=Object.keys(t.data.dependencies);for(let o of e){const e=t.data.dependencies[o],i=Object.keys(e);for(let s of i){const e=t.data.dependencies[o][s][r];if("undefined"===typeof e)continue;const i=await Fc({address:e.address,contractName:e.contract,blockHeight:n});if(i!==e.pin)return de({title:"verifyDependencyPinsSame Debug Error",message:`Could not recompute and match dependency pin.\n address: ${e.address} | contract: ${e.contract}\n computed: ${i}\n template: ${e.pin}\n `,level:le.debug}),!1}}return!0;case"1.1.0":let i=!1;for(let o=0;o1&&void 0!==arguments[1]?arguments[1]:{};uo(void 0!=t,"getInteractionTemplateAudits({ template }) -- template must be defined"),uo("InteractionTemplate"===t.f_type,"getInteractionTemplateAudits({ template }) -- template must be an InteractionTemplate");let i=await jc({template:t});if(i!==t.id)throw de({title:"getInteractionTemplateAudits Debug Error",message:`Could not recompute and match template ID\n computed: ${i}\n template: ${t.id}\n `,level:le.debug}),new Error("getInteractionTemplateAudits Error: Could not recompute and match template ID");switch(t.f_version){case"1.1.0":case"1.0.0":const e=n||await xt().get("flow.auditors");uo(e,"getInteractionTemplateAudits Error: Required configuration for 'fcl.auditors' is not set"),uo(Array.isArray(e),"getInteractionTemplateAudits Error: Required configuration for 'fcl.auditors' is not an array");let t=r.flowInteractionAuditContract;if(!t){const e=await ga(r);uo("mainnet"===e||"testnet"===e,"getInteractionTemplateAudits Error: Unable to determine address for FlowInteractionTemplateAudit contract. Set configuration for 'fcl.network' to 'mainnet' or 'testnet'"),t="mainnet"===e?"0xfd100e39d50a13e6":"0xf78bfc12d0a786dc"}const o=await Sa({cadence:`\n import FlowInteractionTemplateAudit from ${t}\n access(all) fun main(templateId: String, auditors: [Address]): {Address:Bool} {\n return FlowInteractionTemplateAudit.getHasTemplateBeenAuditedByAuditors(templateId: templateId, auditors: auditors)\n }\n `,args:(t,n)=>[t(i,n.String),t(e,n.Array(n.Address))]});return o;default:throw new Error("getInteractionTemplateAudits Error: Unsupported template version")}},generateDependencyPin:Fc,generateDependencyPinAtLatestSealedBlock:async function(e){let{version:t,address:n,contractName:r}=e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=await yo({sealed:!0},i),s=o?.height;return Fc({version:t,address:n,contractName:r,blockHeight:s})},generateTemplateId:jc,verifyGeneratedTemplateId:async function(e){let{template:t}=e;return t.id===await jc({template:t})},verifyDependencyPinsSame:Vc,verifyDependencyPinsSameAtLatestSealedBlock:async function(e){let{template:t,network:n}=e;const r=(await yo({sealed:!0}))?.height;return Vc({template:t,network:n,blockHeight:r})},deriveCadenceByNetwork:da,getTemplateMessage:function(e){let{localization:t="en-US",messageKey:n,template:r}=e;switch(uo(n,"getTemplateMessage({ messageKey }) -- messageKey must be defined"),uo("string"===typeof n,"getTemplateMessage({ messageKey }) -- messageKey must be a string"),uo(t,"getTemplateMessage({ localization }) -- localization must be defined"),uo("string"===typeof t,"getTemplateMessage({ localization }) -- localization must be a string"),uo(void 0!=r,"getTemplateMessage({ template }) -- template must be defined"),uo("object"===typeof r,"getTemplateMessage({ template }) -- template must be an object"),uo("InteractionTemplate"===typeof r.f_type,"getTemplateMessage({ template }) -- template object must be an InteractionTemplate"),r.f_version){case"1.1.0":const e=r?.data?.messages?.find((e=>e.key===n));if(!e)return;const i=e?.i18n?.find((e=>e.tag===t));if(!i)return;return i.translation;case"1.0.0":return r?.data?.messages?.[n]?.i18n?.[t];default:throw new Error("getTemplateArgumentMessage Error: Unsupported template version")}},getTemplateArgumentMessage:function(e){let{localization:t="en-US",argumentLabel:n,messageKey:r,template:i}=e;switch(uo(r,"getTemplateArgumentMessage({ messageKey }) -- messageKey must be defined"),uo("string"===typeof r,"getTemplateArgumentMessage({ messageKey }) -- messageKey must be a string"),uo(n,"getTemplateArgumentMessage({ argumentLabel }) -- argumentLabel must be defined"),uo("string"===typeof r,"getTemplateArgumentMessage({ argumentLabel }) -- argumentLabel must be a string"),uo(t,"getTemplateArgumentMessage({ localization }) -- localization must be defined"),uo("string"===typeof t,"getTemplateArgumentMessage({ localization }) -- localization must be a string"),uo(void 0!=i,"getTemplateArgumentMessage({ template }) -- template must be defined"),uo("object"===typeof i,"getTemplateArgumentMessage({ template }) -- template must be an object"),uo("InteractionTemplate"===typeof i.f_type,"getTemplateArgumentMessage({ template }) -- template object must be an InteractionTemplate"),i.f_version){case"1.1.0":const e=i?.data?.parameters?.find((e=>e.label===n));if(!e)return;const o=e?.messages?.find((e=>e.key===r));if(!o)return;const s=o?.i18n?.find((e=>e.tag===t));if(!s)return;return s.translation;case"1.0.0":return i?.data?.arguments?.[n]?.messages?.[r]?.i18n?.[t];default:throw new Error("getTemplateArgumentMessage Error: Unsupported template version")}}});function zc(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{old:e,...Pa,type:"frame",endpoint:e.endpoint,params:e.params||{},data:e.data||{}}}function Hc(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:"back-channel-rpc",endpoint:e.endpoint,method:e.method,params:e.params||{},data:e.data||{}}}function Wc(e){return null==e?null:(null==e.method&&(e={...e,type:"local-view",method:"VIEW/IFRAME"}),e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:e.type||"local-view",method:e.method,endpoint:e.endpoint,data:e.data||{},params:e.params||{}})}function Gc(e,t){return e.map((e=>function(e,t){try{return Zc[e.type](e,t)}catch(n){return console.error(`Unrecognized FCL Service Type [${e.type}]`,e,n),e}}(e,t))).filter(Boolean)}const Zc={"back-channel-rpc":Hc,"pre-authz":function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:e.type,uid:e.id,endpoint:e.endpoint,method:e.method,identity:{...Oa,address:Ot(e.addr),keyId:e.keyId},params:e.params,data:e.data}},authz:function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:e.type,uid:e.id,endpoint:e.endpoint,method:e.method,identity:{...Oa,address:Ot(e.addr),keyId:e.keyId},params:e.params,data:e.data}},authn:function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Pa,type:e.type,uid:e.id,endpoint:e.authn,id:e.pid,provider:{address:Ot(e.addr),name:e.name,icon:e.icon}}},frame:zc,"open-id":function(e){return null==e?null:"1.0.0"===e.f_vsn?e:null},"user-signature":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("Invalid user-signature service");return"1.0.0"===e.f_vsn?e:null},"local-view":Wc,"account-proof":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("FCL Normalizer Error: Invalid account-proof service");return"1.0.0"===e.f_vsn?e:null},"authn-refresh":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("Invalid authn-refresh service");return"1.0.0"===e.f_vsn?e:null}};function Kc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return e.reduce(((e,n)=>n.type===t&&(!e||$s(n.f_vsn,e.f_vsn)>0)?n:e),null)}function Xc(e){return Et([e.provider?.address||e.provider?.name||"UNSPECIFIED",e.id]).toString("hex")}async function Yc(e){var t=Gc(function(){return[...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],...arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]]}((e=function(e){return e.addr=e.addr?Ot(e.addr):null,e.paddr=e.paddr?Ot(e.paddr):null,e}(e)).services||[],await async function(e,t){if(null==e||null==t)return[];const n=new Ta(e);n.searchParams.append("code",t);const r=await fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>e.json()));if(Array.isArray(r))return r;const i=[];if(Array.isArray(r.authorizations))for(let o of r.authorizations)i.push({type:"authz",keyId:r.keyId,...o});return null!=r.provider&&i.push({type:"authn",id:"wallet-provider#authn",...r.provider}),i}(e.hks,e.code)));const n=Kc(t,"authn");return{...Ra,addr:Ot(e.addr),cid:Xc(n),loggedIn:!0,services:t,expiresAt:e.expires}}const Jc="undefined"===typeof window;const Qc=globalThis.AbortController||n(28599),$c=async e=>{let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return Sc().getStrategy(t.method)({service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s})};async function eu(e){let{service:t,msg:n={},config:r={},opts:i={},platform:o,abortSignal:s=(new Qc).signal,execStrategy:a}=e;!function(){if(Jc)return;Sc().getStrategies().includes("WC/RPC")||de({title:"FCL WalletConnect Service Plugin",level:le.error,message:"All dApps are expected to register for a WalletConnect projectId & add this to their FCL configuration. If you do not do so, users will be unable to use certain wallets to interact with your dApp. See https://developers.flow.com/tools/clients/fcl-js/configure-fcl for more information."})}(),n.data=t.data;const c={services:await Xa(/^service\./),app:await Xa(/^app\.detail\./),client:{...r.client,platform:o,fclVersion:ea,fclLibrary:"https://github.com/onflow/fcl-js",hostname:window?.location?.hostname??null,network:await ga(i)}};try{const e=await(a||$c)({service:t,body:n,config:c,opts:i,abortSignal:s});return"REDIRECT"===e.status?(fe(t.type===e.data.type,"Cannot shift recursive service type in execService"),await eu({service:e.data,msg:n,config:c,opts:i,abortSignal:s})):e}catch(u){throw de({title:`Error on execService ${t?.type}`,message:u,level:le.error}),u}}function tu(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Ba,addr:Pt(e.addr||e.address),signature:e.signature||e.sig,keyId:e.keyId}}const nu="CURRENT_USER",ru="CURRENT_USER/UPDATED",iu="SNAPSHOT",ou="SET_CURRENT_USER",su="DEL_CURRENT_USER",au='{\n "f_type": "User",\n "f_vsn": "1.0.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "expiresAt":null,\n "services":[]\n}',cu={[Ie]:async e=>{"undefined"===typeof window&&console.warn('\n %cFCL Warning\n ============================\n "currentUser" is only available in the browser.\n For more info, please see the docs: https://docs.onflow.org/fcl/\n ============================\n ',"font-weight:bold;font-family:monospace;"),e.merge(JSON.parse(au));const t=await xt.first(["fcl.storage","fcl.storage.default"]);if(t.can){const n=await(async e=>{const t=JSON.parse(au),n=await e.get(nu);return null!=n&&t.f_vsn!==n.f_vsn?(e.removeItem(nu),t):n||t})(t);(function(e){return null==e.expiresAt||0===e.expiresAt||e.expiresAt>Date.now()})(n)&&e.merge(n)}},[ke]:(e,t)=>{e.subscribe(t.from),e.send(t.from,ru,{...e.all()})},[Te]:(e,t)=>{e.unsubscribe(t.from)},[iu]:async(e,t)=>{t.reply({...e.all()})},[ou]:async(e,t,n)=>{e.merge(n);const r=await xt.first(["fcl.storage","fcl.storage.default"]);r.can&&r.put(nu,e.all()),e.broadcast(ru,{...e.all()})},[su]:async(e,t)=>{e.merge(JSON.parse(au));const n=await xt.first(["fcl.storage","fcl.storage.default"]);n.can&&n.put(nu,e.all()),e.broadcast(ru,{...e.all()})}},uu=()=>Fe(cu,nu);async function lu(){let e=await xt.get("fcl.accountProof.resolver");if(null==e)return;if(!(e=>"function"===typeof e)(e))return void de({title:"Account Proof Data Resolver must be a function",message:`Check fcl.accountProof.resolver configuration.\n Expected: fcl.accountProof.resolver: async () => { ... }\n Received: fcl.accountProof.resolver: ${typeof e}\n `,level:le.warn});const t=await e();return null!=t?(fe("string"===typeof t.appIdentifier,"appIdentifier must be a string"),fe(/^[0-9a-f]+$/i.test(t.nonce),"Nonce must be a hex string"),t):void 0}const du=async e=>{let{discoveryAuthnInclude:t,discoveryFeaturesSuggested:n}=e;return{client:{discoveryAuthnInclude:t,discoveryFeaturesSuggested:n,clientServices:await Ec(),supportedStrategies:Sc().getStrategies()}}},fu=e=>{let{platform:t,discovery:n}=e;return async function(){let{service:e,redir:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e||e?.provider?.is_installed||!e?.provider?.requires_install)return new Promise((async(i,o)=>{uu();const s={redir:r},a=await mu(),c=await _c(e),u=Kc(a.services,"authn-refresh");let l;if(a.loggedIn){if(!u)return i(a);try{const e=await eu({service:u,msg:l,opts:s,platform:t});Le(nu,ou,await Yc(e))}catch(d){de({title:`${d.name} Could not refresh wallet authentication.`,message:d.message,level:le.error})}finally{return i(await mu())}}try{l=await lu()}catch(d){return de({title:`${d.name} On Authentication: Could not resolve account proof data.`,message:d.message,level:le.error}),o(d)}try{const e=await eu({service:c,msg:l,config:await du(c),opts:s,platform:t,execStrategy:n?.execStrategy});Le(nu,ou,await Yc(e))}catch(d){de({title:`${d} On Authentication`,message:d,level:le.error})}finally{i(await mu())}}));window.location.href=e?.provider?.install_link}};function hu(){uu(),Le(nu,su)}const pu=e=>{let{platform:t,discovery:n}=e;return async e=>(uu(),{...e,tempId:"CURRENT_USER",async resolve(e,r){const i=await fu({platform:t,discovery:n})({redir:!0}),o=Kc(i.services,"authz"),s=Kc(i.services,"pre-authz");if(s)return(e=>{let{platform:t}=e;return e=>{const n=(e=>({f_type:"PreAuthzResponse",f_vsn:"1.0.0",proposer:(e||{}).proposer,payer:(e||{}).payer||[],authorization:(e||{}).authorization||[]}))(e),r=[];null!=n.proposer&&r.push(["PROPOSER",n.proposer]);for(let t of n.payer||[])r.push(["PAYER",t]);for(let t of n.authorization||[])r.push(["AUTHORIZER",t]);return r.map((e=>{let[n,r]=e;return{tempId:[r.identity.address,r.identity.keyId].join("|"),addr:r.identity.address,keyId:r.identity.keyId,signingFunction:e=>eu({service:r,msg:e,platform:t}),role:{proposer:"PROPOSER"===n,payer:"PAYER"===n,authorizer:"AUTHORIZER"===n}}}))}})({platform:t,discovery:n})(await eu({service:s,msg:r,platform:t}));if(o){let n;return ba()&&"WC/RPC"===o.method&&(n=window.open("","_blank")),{...e,tempId:"CURRENT_USER",resolve:null,addr:Pt(o.identity.address),keyId:o.identity.keyId,sequenceNum:null,signature:null,signingFunction:async e=>tu(await eu({service:o,msg:e,opts:{includeOlderJsonRpcCall:!0,windowRef:n},platform:t}))}}throw new Error("No Authz or PreAuthz Service configured for CURRENT_USER")}})};function gu(e){uu();const t="@EXIT",n=Fe((async n=>{for(n.send(nu,ke);;){const r=await n.receive();if(r.tag===t)return void n.send(nu,Te);e(r.data)}}));return()=>Le(n,t)}function mu(){return uu(),Le(nu,iu,null,{expectReply:!0,timeout:0})}const bu=e=>{let{platform:t,discovery:n}=e;return async()=>{const{addr:e}=await fu({platform:t,discovery:n})();return Ro(Ot(e),Bs)}},yu=e=>(fe(/^[0-9a-f]+$/i.test(e),"Message must be a hex string"),{message:e}),vu=e=>{let{platform:t,discovery:n}=e;return async e=>{uu();const r=Kc((await fu({platform:t,discovery:n})({redir:!0})).services,"user-signature");fe(r,"Current user must have authorized a signing service.");try{const n=await eu({service:r,msg:yu(e),platform:t});return Array.isArray(n)?n.map((e=>tu(e))):[tu(n)]}catch(i){return i}}},wu=e=>{let{platform:t,discovery:n}=e,r=()=>({authenticate:fu({platform:t,discovery:n}),unauthenticate:hu,authorization:pu({platform:t,discovery:n}),signUserMessage:vu({platform:t,discovery:n}),subscribe:gu,snapshot:mu,resolveArgument:bu({platform:t,discovery:n})});return r.authenticate=fu({platform:t,discovery:n}),r.unauthenticate=hu,r.authorization=pu({platform:t,discovery:n}),r.signUserMessage=vu({platform:t,discovery:n}),r.subscribe=gu,r.snapshot=mu,r.resolveArgument=bu({platform:t,discovery:n}),r};function xu(e){const t=new Ta(e.endpoint);if(window?.location?.origin&&t.searchParams.append("l6n",window.location.origin),null!=e.params)for(let[n,r]of Object.entries(e.params||{}))t.searchParams.append(n,r);return t}function Su(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t.method||"POST",r="GET"===n?void 0:JSON.stringify(t.data||e.data||{});return fetch(xu(e),{method:n,headers:{...e.headers||{},...t.headers||{},"Content-Type":"application/json"},body:r}).then((e=>e.json()))}function Au(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Na,status:e.status??"APPROVED",reason:e.reason??null,data:e.compositeSignature||e.data||{...e}||{},updates:Hc(e.authorizationUpdates),local:zc((e.local||[])[0])}}const Eu={"HTTP/GET":"GET","HTTP/POST":"POST"},_u=e=>(fe(Eu[e.method],"Invalid Service Method for type back-channel-rpc",{service:e}),Eu[e.method]);async function Cu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;fe(e,"Missing Polling Service",{service:e});const n=t();if(!n)throw new Error("Externally Halted");let r;try{if("undefined"!==typeof document&&"hidden"===document.visibilityState)return await new Promise((e=>setTimeout(e,500))),Cu(e,t);r=await Su(e,{method:_u(e)}).then(Au)}catch(i){throw i}switch(r.status){case"APPROVED":return r.data;case"DECLINED":throw new Error(`Declined: ${r.reason||"No reason supplied."}`);default:return await new Promise((e=>setTimeout(e,500))),Cu(r.updates,t)}}const Iu=e=>async t=>{let{service:n,body:r,config:i,opts:o}=t;const s=await Su(n,{data:{fclVersion:ea,service:{params:n.params,data:n.data,type:n.type},config:i,...r}}).then(Au);if("APPROVED"===s.status)return s.data;if("DECLINED"===s.status)throw new Error(`Declined: ${s.reason||"No reason supplied."}`);if("REDIRECT"===s.status)return s;if("PENDING"===s.status){var a=!0,c=!0;const[t,n]=await e(Wc(s.local),{serviceEndpoint:xu,onClose:()=>c=!1}),r=()=>{try{n(),c=!1}catch(e){console.error("Frame Close Error",e)}},i=()=>{const e=a;return a=c,e};return Cu(s.updates,i).then((e=>(r(),e))).catch((e=>{throw console.error(e),r(),e}))}throw console.error("Auto Decline: Invalid Response",{service:n,resp:s}),new Error("Auto Decline: Invalid Response")},ku="FCL:VIEW:CLOSE",Tu="FCL:VIEW:READY",Mu="FCL:VIEW:RESPONSE",Pu=e=>"string"===typeof e&&e.toLowerCase(),Ou=new Set(["monetizationstart","monetizationpending","monetizationprogress","monetizationstop"]),Ru=(e,t)=>console.warn("DEPRECATION NOTICE",`Received ${e}, please use ${t} for this and future versions of FCL`),Nu=e=>{let t,{close:n,send:r,onReady:i,onResponse:o,onMessage:s,onCustomRpc:a,getSource:c}=e;return e=>{try{t=c?.()||t}catch(Pu){t=null}try{if("object"!==typeof e.data)return;if(Ou.has(e.data.type))return;if(null!=t&&e.source!==t)return;Pu(e.data.type)===Pu(ku)&&n(),Pu(e.data.type)===Pu(Tu)&&(i(e,{send:r,close:n}),t||=e.source),Pu(e.data.type)===Pu(Mu)&&o(e,{send:r,close:n}),Pu(e.data.type)===Pu("FCL:VIEW:CUSTOM_RPC")&&a(e.data.payload,{send:r,close:n}),s(e,{send:r,close:n}),Pu(e.data.type)===Pu("FCL:FRAME:READY")&&(Ru(e.data.type,Tu),i(e,{send:r,close:n}),t||=e.source),Pu(e.data.type)===Pu("FCL:FRAME:RESPONSE")&&(Ru(e.data.type,Mu),o(e,{send:r,close:n})),Pu(e.data.type)===Pu("FCL:FRAME:CLOSE")&&(Ru(e.data.type,ku),n()),Pu(e.data.type)===Pu("FCL::CHALLENGE::RESPONSE")&&(Ru(e.data.type,Mu),o(e,{send:r,close:n})),Pu(e.data.type)===Pu("FCL::AUTHZ_READY")&&(Ru(e.data.type,Tu),i(e,{send:r,close:n}),t||=e.source),Pu(e.data.type)===Pu("FCL::CHALLENGE::CANCEL")&&(Ru(e.data.type,ku),n()),Pu(e.data.type)===Pu("FCL::CANCEL")&&(Ru(e.data.type,ku),n())}catch(u){console.error("Frame Callback Error",u),n()}}};function Bu(e){return Bu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bu(e)}function Lu(e){var t=function(e,t){if("object"!=Bu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Bu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Bu(t)?t:t+""}function Du(e,t,n){return(t=Lu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}xt.subscribe((()=>{ga({enableRequestLogging:!1}).catch((()=>{}))}));let Uu=function(e){return e[e.INVALID_REQUEST=-32600]="INVALID_REQUEST",e[e.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",e[e.INVALID_PARAMS=-32602]="INVALID_PARAMS",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e[e.PARSE_ERROR=-32700]="PARSE_ERROR",e}({});class ju extends Error{constructor(e,t,n){super(t),this.code=e,this.message=t,this.data=n}}var Fu=function(e){return e.HELLO="rpc_hello",e}(Fu||{});class Vu{constructor(e){let{notifications:t}=e;Du(this,"id",0),Du(this,"setSend",(()=>{})),Du(this,"_send",new Promise((e=>{this.setSend=e}))),Du(this,"peerInfo",new Promise(((e,t)=>{this.resolvePeerInfo=e,this.rejectPeerInfo=t}))),Du(this,"enabledNotifications",[]),Du(this,"requestHandlers",{}),Du(this,"subscriptions",{}),Du(this,"messageListeners",[]),this.enabledNotifications=t||[],this.on(Fu.HELLO,(e=>(this.resolvePeerInfo(e),this.ownInfo())))}connect(e){let{send:t}=e;this.setSend(t),this.requestWithoutConnection(Fu.HELLO,this.ownInfo()).then((e=>{this.resolvePeerInfo(e)})).catch(this.rejectPeerInfo)}ownInfo(){return{requests:Object.keys(this.requestHandlers),notifications:this.enabledNotifications}}async send(e){return(await this._send)(e)}receive(e){"2.0"===e?.jsonrpc&&("method"in e&&("id"in e?this.handleRequest(e):this.handleNotification(e)),this.messageListeners.forEach((t=>t(e))))}async handleRequest(e){const t=this.requestHandlers[e.method];if(t)try{const n=await t(e.params);this.send({jsonrpc:"2.0",id:e.id,result:n})}catch(n){n instanceof ju?this.send({jsonrpc:"2.0",id:e.id,error:{code:n.code,message:n.message,data:n.data}}):this.send({jsonrpc:"2.0",id:e.id,error:{code:Uu.INTERNAL_ERROR,message:n?.message}})}else this.send({jsonrpc:"2.0",id:e.id,error:{code:Uu.METHOD_NOT_FOUND,message:`Method not found: ${e.method}`}})}handleNotification(e){this.subscriptions[e.method]&&this.subscriptions[e.method].forEach((t=>t(e.params)))}onMessage(e){return this.messageListeners.push(e),()=>{this.messageListeners=this.messageListeners.filter((t=>t!==e))}}async notify(e,t){await this.onceConnected(),this.send({jsonrpc:"2.0",method:e,params:t})}async request(e,t){return await this.onceConnected(),this.requestWithoutConnection(e,t)}async requestWithoutConnection(e,t){const n=this.id++;let r=()=>{};const i=new Promise(((e,t)=>{r=this.onMessage((r=>{if(r.id===n&&("result"in r||"error"in r)){if(r.error){const e=new ju(r.error.code,r.error.message,r.error.data);t(e)}e(r.result)}}))})).finally(r);return this.send({jsonrpc:"2.0",method:e,params:t,id:n}),i}on(e,t){this.requestHandlers[e]=t}subscribe(e,t){this.subscriptions[e]=this.subscriptions[e]||new Set,this.subscriptions[e].add(t)}unsubscribe(e,t){this.subscriptions[e]?.delete(t)}async onceConnected(){return this.peerInfo.then((()=>{}))}async getAvailableRequests(){return this.peerInfo.then((e=>e.requests))}async getAvailableNotifications(){return this.peerInfo.then((e=>e.notifications))}}var qu=n(66736);class zu{}class Hu extends zu{constructor(e){super()}}const Wu=qu.FIVE_SECONDS,Gu="heartbeat_pulse";class Zu extends Hu{constructor(e){super(e),this.events=new Nt.EventEmitter,this.interval=Wu,this.interval=e?.interval||Wu}static async init(e){const t=new Zu(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval((()=>this.pulse()),(0,qu.toMiliseconds)(this.interval))}pulse(){this.events.emit(Gu)}}const Ku=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Xu=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Yu=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Ju(e,t){if(!("__proto__"===e||"constructor"===e&&t&&"object"===typeof t&&"prototype"in t))return t;!function(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}(e)}function Qu(e,t={}){if("string"!==typeof e)return e;const n=e.trim();if('"'===e[0]&&e.endsWith('"')&&!e.includes("\\"))return n.slice(1,-1);if(n.length<=9){const e=n.toLowerCase();if("true"===e)return!0;if("false"===e)return!1;if("undefined"===e)return;if("null"===e)return null;if("nan"===e)return Number.NaN;if("infinity"===e)return Number.POSITIVE_INFINITY;if("-infinity"===e)return Number.NEGATIVE_INFINITY}if(!Yu.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(Ku.test(e)||Xu.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,Ju)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}var $u=n(48764).Buffer;function el(e,...t){try{return function(e){return e&&"function"===typeof e.then?e:Promise.resolve(e)}(e(...t))}catch(n){return Promise.reject(n)}}function tl(e){if(function(e){const t=typeof e;return null===e||"object"!==t&&"function"!==t}(e))return String(e);if(function(e){const t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}(e)||Array.isArray(e))return JSON.stringify(e);if("function"===typeof e.toJSON)return tl(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function nl(){if(void 0===typeof $u)throw new TypeError("[unstorage] Buffer is not supported!")}const rl="base64:";function il(e){return e?e.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function ol(...e){return il(e.join(":"))}function sl(e){return(e=il(e))?e+":":""}const al=()=>{const e=new Map;return{name:"memory",options:{},hasItem:t=>e.has(t),getItem:t=>e.get(t)??null,getItemRaw:t=>e.get(t)??null,setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys:()=>Array.from(e.keys()),clear(){e.clear()},dispose(){e.clear()}}};function cl(e={}){const t={mounts:{"":e.driver||al()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=e=>{for(const n of t.mountpoints)if(e.startsWith(n))return{base:n,relativeKey:e.slice(n.length),driver:t.mounts[n]};return{base:"",relativeKey:e,driver:t.mounts[""]}},r=(e,n)=>t.mountpoints.filter((t=>t.startsWith(e)||n&&e.startsWith(t))).map((n=>({relativeBase:e.length>n.length?e.slice(n.length):void 0,mountpoint:n,driver:t.mounts[n]}))),i=(e,n)=>{if(t.watching){n=il(n);for(const r of t.watchListeners)r(e,n)}},o=async()=>{if(t.watching){for(const e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},s=(e,t,r)=>{const i=new Map,o=e=>{let t=i.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},i.set(e.base,t)),t};for(const s of e){const e="string"===typeof s,r=il(e?s:s.key),i=e?void 0:s.value,a=e||!s.options?t:{...t,...s.options},c=n(r);o(c).items.push({key:r,value:i,relativeKey:c.relativeKey,options:a})}return Promise.all([...i.values()].map((e=>r(e)))).then((e=>e.flat()))},a={hasItem(e,t={}){e=il(e);const{relativeKey:r,driver:i}=n(e);return el(i.hasItem,r,t)},getItem(e,t={}){e=il(e);const{relativeKey:r,driver:i}=n(e);return el(i.getItem,r,t).then((e=>Qu(e)))},getItems:(e,t)=>s(e,t,(e=>e.driver.getItems?el(e.driver.getItems,e.items.map((e=>({key:e.relativeKey,options:e.options}))),t).then((t=>t.map((t=>({key:ol(e.base,t.key),value:Qu(t.value)}))))):Promise.all(e.items.map((t=>el(e.driver.getItem,t.relativeKey,t.options).then((e=>({key:t.key,value:Qu(e)})))))))),getItemRaw(e,t={}){e=il(e);const{relativeKey:r,driver:i}=n(e);return i.getItemRaw?el(i.getItemRaw,r,t):el(i.getItem,r,t).then((e=>function(e){return"string"!==typeof e?e:e.startsWith(rl)?(nl(),$u.from(e.slice(rl.length),"base64")):e}(e)))},async setItem(e,t,r={}){if(void 0===t)return a.removeItem(e);e=il(e);const{relativeKey:o,driver:s}=n(e);s.setItem&&(await el(s.setItem,o,tl(t),r),s.watch||i("update",e))},async setItems(e,t){await s(e,t,(async e=>{if(e.driver.setItems)return el(e.driver.setItems,e.items.map((e=>({key:e.relativeKey,value:tl(e.value),options:e.options}))),t);e.driver.setItem&&await Promise.all(e.items.map((t=>el(e.driver.setItem,t.relativeKey,tl(t.value),t.options))))}))},async setItemRaw(e,t,r={}){if(void 0===t)return a.removeItem(e,r);e=il(e);const{relativeKey:o,driver:s}=n(e);if(s.setItemRaw)await el(s.setItemRaw,o,t,r);else{if(!s.setItem)return;await el(s.setItem,o,function(e){if("string"===typeof e)return e;nl();const t=$u.from(e).toString("base64");return rl+t}(t),r)}s.watch||i("update",e)},async removeItem(e,t={}){"boolean"===typeof t&&(t={removeMeta:t}),e=il(e);const{relativeKey:r,driver:o}=n(e);o.removeItem&&(await el(o.removeItem,r,t),(t.removeMeta||t.removeMata)&&await el(o.removeItem,r+"$",t),o.watch||i("remove",e))},async getMeta(e,t={}){"boolean"===typeof t&&(t={nativeOnly:t}),e=il(e);const{relativeKey:r,driver:i}=n(e),o=Object.create(null);if(i.getMeta&&Object.assign(o,await el(i.getMeta,r,t)),!t.nativeOnly){const e=await el(i.getItem,r+"$",t).then((e=>Qu(e)));e&&"object"===typeof e&&("string"===typeof e.atime&&(e.atime=new Date(e.atime)),"string"===typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(o,e))}return o},setMeta(e,t,n={}){return this.setItem(e+"$",t,n)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){e=sl(e);const n=r(e,!0);let i=[];const o=[];for(const r of n){const e=(await el(r.driver.getKeys,r.relativeBase,t)).map((e=>r.mountpoint+il(e))).filter((e=>!i.some((t=>e.startsWith(t)))));o.push(...e),i=[r.mountpoint,...i.filter((e=>!e.startsWith(r.mountpoint)))]}return e?o.filter((t=>t.startsWith(e)&&!t.endsWith("$"))):o.filter((e=>!e.endsWith("$")))},async clear(e,t={}){e=sl(e),await Promise.all(r(e,!1).map((async e=>{if(e.driver.clear)return el(e.driver.clear,e.relativeBase,t);if(e.driver.removeItem){const n=await e.driver.getKeys(e.relativeBase||"",t);return Promise.all(n.map((n=>e.driver.removeItem(n,t))))}})))},async dispose(){await Promise.all(Object.values(t.mounts).map((e=>ll(e))))},watch:async e=>(await(async()=>{if(!t.watching){t.watching=!0;for(const e in t.mounts)t.unwatch[e]=await ul(t.mounts[e],i,e)}})(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter((t=>t!==e)),0===t.watchListeners.length&&await o()}),async unwatch(){t.watchListeners=[],await o()},mount(e,n){if((e=sl(e))&&t.mounts[e])throw new Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort(((e,t)=>t.length-e.length))),t.mounts[e]=n,t.watching&&Promise.resolve(ul(n,i,e)).then((n=>{t.unwatch[e]=n})).catch(console.error),a},async unmount(e,n=!0){(e=sl(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(t.unwatch[e](),delete t.unwatch[e]),n&&await ll(t.mounts[e]),t.mountpoints=t.mountpoints.filter((t=>t!==e)),delete t.mounts[e])},getMount(e=""){e=il(e)+":";const t=n(e);return{driver:t.driver,base:t.base}},getMounts(e="",t={}){e=il(e);return r(e,t.parents).map((e=>({driver:e.driver,base:e.mountpoint})))}};return a}function ul(e,t,n){return e.watch?e.watch(((e,r)=>t(e,n+r))):()=>{}}async function ll(e){"function"===typeof e.dispose&&await el(e.dispose)}function dl(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}function fl(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=dl(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}let hl;function pl(){return hl||(hl=fl("keyval-store","keyval")),hl}function gl(e,t=pl()){return t("readonly",(t=>dl(t.get(e))))}function ml(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},dl(e.transaction)}function bl(e){if("string"!==typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return(e=>{const t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,((e,t)=>"string"===typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t))})(e)}catch(lk){return e}}function yl(e){return"string"===typeof e?e:(t=e,JSON.stringify(t,((e,t)=>"bigint"===typeof t?t.toString()+"n":t))||"");var t}var vl=(e={})=>{const t=e.base&&e.base.length>0?`${e.base}:`:"",n=e=>t+e;let r;return e.dbName&&e.storeName&&(r=fl(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof(await gl(n(e),r))>"u"),getItem:async e=>await gl(n(e),r)??null,setItem:(e,t)=>function(e,t,n=pl()){return n("readwrite",(n=>(n.put(t,e),dl(n.transaction))))}(n(e),t,r),removeItem:e=>function(e,t=pl()){return t("readwrite",(t=>(t.delete(e),dl(t.transaction))))}(n(e),r),getKeys:()=>function(e=pl()){return e("readonly",(e=>{if(e.getAllKeys)return dl(e.getAllKeys());const t=[];return ml(e,(e=>t.push(e.key))).then((()=>t))}))}(r),clear:()=>function(e=pl()){return e("readwrite",(e=>(e.clear(),dl(e.transaction))))}(r)}};class wl{constructor(){this.indexedDb=cl({driver:vl({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((e=>[e.key,e.value]))}async getItem(e){const t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,yl(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var xl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof n.g<"u"?n.g:typeof self<"u"?self:{},Sl={exports:{}};function Al(e){var t;return[e[0],bl(null!=(t=e[1])?t:"")]}!function(){let e;function t(){}e=t,e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){const e=this;Object.keys(e).forEach((function(t){e[t]=void 0,delete e[t]}))},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",(function(){return Object.keys(this).length})),typeof xl<"u"&&xl.localStorage?Sl.exports=xl.localStorage:typeof window<"u"&&window.localStorage?Sl.exports=window.localStorage:Sl.exports=new t}();class El{constructor(){this.localStorage=Sl.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Al)}async getItem(e){const t=this.localStorage.getItem(e);if(null!==t)return bl(t)}async setItem(e,t){this.localStorage.setItem(e,yl(t))}async removeItem(e){this.localStorage.removeItem(e)}}const _l=async(e,t)=>{t.length&&t.forEach((async t=>{await e.removeItem(t)}))};class Cl{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const e=new El;this.storage=e;try{(async(e,t,n)=>{const r="wc_storage_version",i=await t.getItem(r);if(i&&i>=1)return void n(t);const o=await e.getKeys();if(!o.length)return void n(t);const s=[];for(;o.length;){const n=o.shift();if(!n)continue;const r=n.toLowerCase();if(r.includes("wc@")||r.includes("walletconnect")||r.includes("wc_")||r.includes("wallet_connect")){const r=await e.getItem(n);await t.setItem(n,r),s.push(n)}}await t.setItem(r,1),n(t),_l(e,s)})(e,new wl,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise((e=>{const t=setInterval((()=>{this.initialized&&(clearInterval(t),e())}),20)}))}}var Il=n(36559),kl=n.n(Il);const Tl="info",Ml="custom_context";class Pl{constructor(e){this.nodeValue=e,this.sizeInBytes=(new TextEncoder).encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Ol{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new Pl(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class Rl{constructor(e,t=1024e3){this.level=e??"error",this.levelValue=Il.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Ol(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Il.levels.values.error?console.error(e):t===Il.levels.values.warn?console.warn(e):t===Il.levels.values.debug?console.debug(e):t===Il.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(yl({timestamp:(new Date).toISOString(),log:e}));const t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Ol(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(yl({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class Nl{constructor(e,t=1024e3){this.baseChunkLogger=new Rl(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=t,n.download=`walletconnect-logs-${(new Date).toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}}class Bl{constructor(e,t=1024e3){this.baseChunkLogger=new Rl(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var Ll=Object.defineProperty,Dl=Object.defineProperties,Ul=Object.getOwnPropertyDescriptors,jl=Object.getOwnPropertySymbols,Fl=Object.prototype.hasOwnProperty,Vl=Object.prototype.propertyIsEnumerable,ql=(e,t,n)=>t in e?Ll(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zl=(e,t)=>{for(var n in t||(t={}))Fl.call(t,n)&&ql(e,n,t[n]);if(jl)for(var n of jl(t))Vl.call(t,n)&&ql(e,n,t[n]);return e},Hl=(e,t)=>Dl(e,Ul(t));function Wl(e){return Hl(zl({},e),{level:e?.level||Tl})}function Gl(e,t=Ml){let n="";return n=typeof e.bindings>"u"?function(e,t=Ml){return e[t]||""}(e,t):e.bindings().context||"",n}function Zl(e,t,n=Ml){const r=function(e,t,n=Ml){const r=Gl(e,n);return r.trim()?`${r}/${t}`:t}(e,t,n);return function(e,t,n=Ml){return e[n]=t,e}(e.child({context:r}),r,n)}function Kl(e){return typeof e.loggerOverride<"u"&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?function(e){var t,n;const r=new Nl(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:kl()(Hl(zl({},e.opts),{level:"trace",browser:Hl(zl({},null==(n=e.opts)?void 0:n.browser),{write:e=>r.write(e)})})),chunkLoggerController:r}}(e):function(e){var t;const n=new Bl(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:kl()(Hl(zl({},e.opts),{level:"trace"}),n),chunkLoggerController:n}}(e)}class Xl extends zu{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Yl extends zu{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class Jl extends zu{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Ql extends zu{constructor(e){super()}}class $l extends zu{constructor(e,t){super(),this.relayer=e,this.logger=t}}class ed extends zu{constructor(e,t){super(),this.core=e,this.logger=t}}var td=n(31050),nd=n(31416);const rd=".",id="base64url",od="utf8",sd="utf8",ad="did",cd="key",ud="base58btc";function ld(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function dd(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?ld(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}var fd=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=o-1;(0!==l||d>>0,s[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===s[h];)h++;for(var p=new Uint8Array(r+(o-h)),g=r;h!==o;)p[g++]=s[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,u=new Uint8Array(s);i!==o;){for(var d=t[i],f=0,h=s-1;(0!==d||f>>0,u[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=s-r;p!==s&&0===u[p];)p++;for(var g=c.repeat(n);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class gd{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class md{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return yd(this,e)}}class bd{constructor(e){this.decoders=e}or(e){return yd(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const yd=(e,t)=>new bd({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class vd{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new gd(e,t,n),this.decoder=new md(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const wd=({name:e,prefix:t,encode:n,decode:r})=>new vd(e,t,n,r),xd=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=hd(n,t);return wd({prefix:e,name:t,encode:r,decode:e=>pd(i(e))})},Sd=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>wd({prefix:t,name:e,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<((e,t,n,r)=>{const i={};for(let l=0;l=8&&(a-=8,s[u++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(t,r,n,e)}),Ad=wd({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)}),Ed=Sd({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),_d=Sd({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Cd=xd({prefix:"9",name:"base10",alphabet:"0123456789"}),Id=Sd({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),kd=Sd({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Td=Sd({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Md=Sd({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Pd=Sd({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Od=Sd({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Rd=Sd({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Nd=Sd({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Bd=Sd({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ld=Sd({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Dd=Sd({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ud=xd({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),jd=xd({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Fd=xd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Vd=xd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),qd=Sd({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zd=Sd({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hd=Sd({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wd=Sd({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Gd=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),Zd=Gd.reduce(((e,t,n)=>(e[n]=t,e)),[]),Kd=Gd.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const Xd=wd({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Zd[t]),"")},decode:function(e){const t=[];for(const n of e){const e=Kd[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}});var Yd=function e(t,n,r){n=n||[];var i=r=r||0;for(;t>=Jd;)n[r++]=255&t|128,t/=128;for(;-128&t;)n[r++]=255&t|128,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Jd=Math.pow(2,31);var Qd=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(127&r)<=128);return e.bytes=s-n,i};var $d=Math.pow(2,7),ef=Math.pow(2,14),tf=Math.pow(2,21),nf=Math.pow(2,28),rf=Math.pow(2,35),of=Math.pow(2,42),sf=Math.pow(2,49),af=Math.pow(2,56),cf=Math.pow(2,63),uf={encode:Yd,decode:Qd,encodingLength:function(e){return e<$d?1:e(lf.encode(e,t,n),t),ff=e=>lf.encodingLength(e),hf=(e,t)=>{const n=t.byteLength,r=ff(e),i=r+ff(n),o=new Uint8Array(i+n);return df(e,o,0),df(n,o,r),o.set(t,i),new pf(e,n,t,o)};class pf{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const gf=({name:e,code:t,encode:n})=>new mf(e,t,n);class mf{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?hf(this.code,t):t.then((e=>hf(this.code,e)))}throw Error("Unknown type, must be binary type")}}const bf=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),yf=gf({name:"sha2-256",code:18,encode:bf("SHA-256")}),vf=gf({name:"sha2-512",code:19,encode:bf("SHA-512")}),wf=pd,xf={code:0,name:"identity",encode:wf,digest:e=>hf(0,wf(e))},Sf="raw",Af=85,Ef=e=>pd(e),_f=e=>pd(e),Cf=new TextEncoder,If=new TextDecoder,kf="json",Tf=512,Mf=e=>Cf.encode(JSON.stringify(e)),Pf=e=>JSON.parse(If.decode(e));Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom");Symbol.for("@ipld/js-cid/CID");const Of={...i,...o,...s,...a,...c,...u,...l,...d,...f,...h};function Rf(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const Nf=Rf("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Bf=Rf("ascii","a",(e=>{let t="a";for(let n=0;n{const t=dd((e=e.substring(1)).length);for(let n=0;ne+t.length),0));const n=dd(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return ld(n)}([Uf("K36",ud),e]),ud);return[ad,cd,t].join(":")}function qf(e){const t=e.split(rd);return{header:jf(t[0]),payload:jf(t[1]),signature:Uf(t[2],id),data:Uf(t.slice(0,2).join(rd),sd)}}function zf(e=(0,nd.randomBytes)(32)){return td._w(e)}async function Hf(e,t,n,r,i=(0,qu.fromMiliseconds)(Date.now())){const o={alg:"EdDSA",typ:"JWT"},s={iss:Vf(r.publicKey),sub:e,aud:t,iat:i,exp:i+n},a=function(e){return Uf([Ff(e.header),Ff(e.payload)].join(rd),sd)}({header:o,payload:s});return function(e){return[Ff(e.header),Ff(e.payload),(t=e.signature,Df(t,id))].join(rd);var t}({header:o,payload:s,signature:td.Xx(r.secretKey,a)})}n(43014);var Wf=n(34155),Gf=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;ie+t.length),0));const n=hh(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}function gh(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const mh=gh("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),bh=gh("ascii","a",(e=>{let t="a";for(let n=0;n{const t=hh((e=e.substring(1)).length);for(let n=0;nt in e?kh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rh=(e,t)=>{for(var n in t||(t={}))Mh.call(t,n)&&Oh(e,n,t[n]);if(Th)for(var n of Th(t))Ph.call(t,n)&&Oh(e,n,t[n]);return e};const Nh="react-native",Bh="node",Lh="browser",Dh="unknown",Uh="js";function jh(){return typeof Ah<"u"&&typeof Ah.versions<"u"&&typeof Ah.versions.node<"u"}function Fh(){return!(0,ih.getDocument)()&&!!(0,ih.getNavigator)()&&"ReactNative"===navigator.product}function Vh(){return!jh()&&!!(0,ih.getNavigator)()&&!!(0,ih.getDocument)()}function qh(){return Fh()?Nh:jh()?Bh:Vh()?Lh:Dh}function zh(){return(0,oh.D)()||{name:"",description:"",url:"",icons:[""]}}function Hh(e,t,r){const i=function(){if(qh()===Nh&&typeof n.g<"u"&&typeof(null==n.g?void 0:n.g.Platform)<"u"){const{OS:e,Version:t}=n.g.Platform;return[e,t].join("-")}const e=th();if(null===e)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}(),o=function(){var e;const t=qh();return t===Lh?[t,(null==(e=(0,ih.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),[Uh,r].join("-"),i,o].join("/")}function Wh({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:i,projectId:o,useOnCloseEvent:s,bundleId:a}){const c=n.split("?"),u={auth:i,ua:Hh(e,t,r),projectId:o,useOnCloseEvent:s||void 0,origin:a||void 0},l=function(e,t){let n=sh.parse(e);return n=Rh(Rh({},n),t),sh.stringify(n)}(c[1]||"",u);return c[0]+"?"+l}function Gh(e,t){return e.filter((e=>t.includes(e))).length===e.length}function Zh(e){return Object.fromEntries(e.entries())}function Kh(e){return new Map(Object.entries(e))}function Xh(e=qu.FIVE_MINUTES,t){const n=(0,qu.toMiliseconds)(e||qu.FIVE_MINUTES);let r,i,o;return{resolve:e=>{o&&r&&(clearTimeout(o),r(e))},reject:e=>{o&&i&&(clearTimeout(o),i(e))},done:()=>new Promise(((e,s)=>{o=setTimeout((()=>{s(new Error(t))}),n),r=e,i=s}))}}function Yh(e,t,n){return new Promise((async(r,i)=>{const o=setTimeout((()=>i(new Error(n))),t);try{r(await e)}catch(s){i(s)}clearTimeout(o)}))}function Jh(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Qh(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof n)r.topic=n;else{if("id"!==t||!Number.isInteger(Number(n)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);r.id=Number(n)}return r}function $h(e,t){return(0,qu.fromMiliseconds)((t||Date.now())+(0,qu.toMiliseconds)(e))}function ep(e){return Date.now()>=(0,qu.toMiliseconds)(e)}function tp(e,t){return`${e}${t?`:${t}`:""}`}function np(e=[],t=[]){return[...new Set([...e,...t])]}async function rp({id:e,topic:t,wcDeepLink:r}){var i;try{if(!r)return;const o=("string"==typeof r?JSON.parse(r):r)?.href;if("string"!=typeof o)return;const s=function(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let i=`${e}`;if(e.startsWith("https://t.me")){i=`${i}${e.includes("?")?"&startapp=":"?startapp="}${function(e,t=!1){const n=Eh.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}(r,!0)}`}else i=`${i}/wc?${r}`;return i}(o,e,t),a=qh();if(a===Lh){if(null==(i=(0,ih.getDocument)())||!i.hasFocus())return void console.warn("Document does not have focus, skipping deeplink.");s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,typeof window<"u"&&(window.TelegramWebviewProxy||window.Telegram||window.TelegramWebviewProxyProto)?"_blank":"_self","noreferrer noopener")}else a===Nh&&typeof(null==n.g?void 0:n.g.Linking)<"u"&&await n.g.Linking.openURL(s)}catch(o){console.error(o)}}function ip(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function op(){return typeof crypto<"u"&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function sp(){return typeof Ah<"u"&&"true"===Ah.env.IS_VITEST}function ap(e){return Eh.from(e,"base64").toString("utf-8")}const cp="https://rpc.walletconnect.org/v1";async function up(e,t,n,r,i,o){switch(n.t){case"eip191":return function(e,t,n){return(0,ch.recoverAddress)((0,ah.r)(t),n).toLowerCase()===e.toLowerCase()}(e,t,n.s);case"eip1271":return await async function(e,t,n,r,i,o){const s=Ch(r);if(!s.namespace||!s.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const s="0x1626ba7e",a="0000000000000000000000000000000000000000000000000000000000000040",c="0000000000000000000000000000000000000000000000000000000000000041",u=n.substring(2),l=s+(0,ah.r)(t).substring(2)+a+c+u,d=await fetch(`${o||cp}/?chainId=${r}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:lp(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})}),{result:f}=await d.json();return!!f&&f.slice(0,s.length).toLowerCase()===s.toLowerCase()}catch(Ql){return console.error("isValidEip1271Signature: ",Ql),!1}}(e,t,n.s,r,i,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function lp(){return Date.now()+Math.floor(1e3*Math.random())}var dp=Object.defineProperty,fp=Object.defineProperties,hp=Object.getOwnPropertyDescriptors,pp=Object.getOwnPropertySymbols,gp=Object.prototype.hasOwnProperty,mp=Object.prototype.propertyIsEnumerable,bp=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yp=(e,t)=>{for(var n in t||(t={}))gp.call(t,n)&&bp(e,n,t[n]);if(pp)for(var n of pp(t))mp.call(t,n)&&bp(e,n,t[n]);return e},vp=(e,t)=>fp(e,hp(t));const wp=e=>e?.split(":"),xp=e=>{const t=e&&wp(e);if(t)return t[2]+":"+t[3]},Sp=e=>{const t=e&&wp(e);if(t)return t.pop()};async function Ap(e){const{cacao:t,projectId:n}=e,{s:r,p:i}=t,o=Ep(i,i.iss),s=Sp(i.iss);return await up(s,o,r,xp(i.iss),n)}const Ep=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=Sp(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=e.statement||void 0;const o=`URI: ${e.aud||e.uri}`,s=`Version: ${e.version}`,a=`Chain ID: ${(e=>{const t=e&&wp(e);if(t)return e.includes("did:pkh:")?t[3]:t[1]})(t)}`,c=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,f=e.requestId?`Request ID: ${e.requestId}`:void 0,h=e.resources?`Resources:${e.resources.map((e=>`\n- ${e}`)).join("")}`:void 0,p=Bp(e.resources);if(p){i=Op(i,kp(p))}return[n,r,"",i,"",o,s,a,c,u,l,d,f,h].filter((e=>null!=e)).join("\n")};function _p(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(null==t||!t.length)throw new Error("No resources found in `att` property");t.forEach((t=>{const n=e.att[t];if(Array.isArray(n))throw new Error(`Resource must be an object: ${t}`);if("object"!=typeof n)throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(n).forEach((e=>{const t=n[e];if(!Array.isArray(t))throw new Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw new Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach((t=>{if("object"!=typeof t)throw new Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)}))}))}))}function Cp(e,t,n={}){t=t?.sort(((e,t)=>e.localeCompare(t)));const r=t.map((t=>({[`${e}/${t}`]:[n]})));return Object.assign({},...r)}function Ip(e){return _p(e),`urn:recap:${function(e){return Eh.from(JSON.stringify(e)).toString("base64")}(e).replace(/=/g,"")}`}function kp(e){const t=function(e){return JSON.parse(Eh.from(e,"base64").toString("utf-8"))}(e.replace("urn:recap:",""));return _p(t),t}function Tp(e,t,n){const r=function(e,t,n,r={}){return n?.sort(((e,t)=>e.localeCompare(t))),{att:{[e]:Cp(t,n,r)}}}(e,t,n);return Ip(r)}function Mp(e){return e&&e.includes("urn:recap:")}function Pp(e,t){const n=function(e,t){_p(e),_p(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort(((e,t)=>e.localeCompare(t))),r={att:{}};return n.forEach((n=>{var i,o;Object.keys((null==(i=e.att)?void 0:i[n])||{}).concat(Object.keys((null==(o=t.att)?void 0:o[n])||{})).sort(((e,t)=>e.localeCompare(t))).forEach((i=>{var o,s;r.att[n]=vp(yp({},r.att[n]),{[i]:(null==(o=e.att[n])?void 0:o[i])||(null==(s=t.att[n])?void 0:s[i])})}))})),r}(kp(e),kp(t));return Ip(n)}function Op(e="",t){_p(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let i=0;Object.keys(t.att).forEach((e=>{const n=Object.keys(t.att[e]).map((e=>({ability:e.split("/")[0],action:e.split("/")[1]})));n.sort(((e,t)=>e.action.localeCompare(t.action)));const o={};n.forEach((e=>{o[e.ability]||(o[e.ability]=[]),o[e.ability].push(e.action)}));const s=Object.keys(o).map((t=>(i++,`(${i}) '${t}': '${o[t].join("', '")}' for '${e}'.`)));r.push(s.join(", ").replace(".,","."))}));return`${e?e+" ":""}${`${n}${r.join(" ")}`}`}function Rp(e){var t;const n=kp(e);_p(n);const r=null==(t=n.att)?void 0:t.eip155;return r?Object.keys(r).map((e=>e.split("/")[1])):[]}function Np(e){const t=kp(e);_p(t);const n=[];return Object.values(t.att).forEach((e=>{Object.values(e).forEach((e=>{var t;null!=(t=e?.[0])&&t.chains&&n.push(e[0].chains)}))})),[...new Set(n.flat())]}function Bp(e){if(!e)return;const t=e?.[e.length-1];return Mp(t)?t:void 0}const Lp="base10",Dp="base16",Up="base64pad",jp="base64url",Fp="utf8";function Vp(){return wh((0,nd.randomBytes)(32),Dp)}function qp(e){return wh((0,dh.vp)(vh(e,Dp)),Dp)}function zp(e){return wh((0,dh.vp)(vh(e,Fp)),Dp)}function Hp(e){return vh(`${e}`,Lp)}function Wp(e){return Number(wh(e,Lp))}function Gp(e){const{encoding:t=Up}=e;if(2===Wp(e.type))return wh(ph([e.type,e.sealed]),t);if(1===Wp(e.type)){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return wh(ph([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return wh(ph([e.type,e.iv,e.sealed]),t)}function Zp(e){const{encoded:t,encoding:n=Up}=e,r=vh(t,n),i=r.slice(0,1);if(1===Wp(i)){const e=33,t=e+12,n=r.slice(1,e),o=r.slice(e,t);return{type:i,sealed:r.slice(t),iv:o,senderPublicKey:n}}if(2===Wp(i)){return{type:i,sealed:r.slice(1),iv:(0,nd.randomBytes)(12)}}const o=r.slice(1,13);return{type:i,sealed:r.slice(13),iv:o}}function Kp(e){const t=e?.type||0;if(1===t){if(typeof e?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function Xp(e){return 1===e.type&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function Yp(e){return 2===e.type}function Jp(e,t){const[n,r,i]=e.split("."),o=function(e){return Eh.from(function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=t.length%4;return n>0&&(t+="=".repeat(4-n)),t}(e),"base64")}(i);if(64!==o.length)throw new Error("Invalid signature length");const s=o.slice(0,32).toString("hex"),a=o.slice(32,64).toString("hex"),c=`${n}.${r}`,u=(new dh.mE).update(Eh.from(c)).digest(),l=function(e){return new xh.ec("p256").keyFromPublic({x:Eh.from(e.x,"base64").toString("hex"),y:Eh.from(e.y,"base64").toString("hex")},"hex")}(t),d=Eh.from(u).toString("hex");if(!l.verify(d,{r:s,s:a}))throw new Error("Invalid signature");return qf(e).payload}function Qp(e){return e?.relay||{protocol:"irn"}}function $p(e){const t=Sh[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var eg=Object.defineProperty,tg=Object.defineProperties,ng=Object.getOwnPropertyDescriptors,rg=Object.getOwnPropertySymbols,ig=Object.prototype.hasOwnProperty,og=Object.prototype.propertyIsEnumerable,sg=(e,t,n)=>t in e?eg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ag=(e,t)=>{for(var n in t||(t={}))ig.call(t,n)&&sg(e,n,t[n]);if(rg)for(var n of rg(t))og.call(t,n)&&sg(e,n,t[n]);return e};function cg(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach((t=>{if(t.startsWith(r)){const i=t.replace(r,""),o=e[t];n[i]=o}})),n}function ug(e){if(!e.includes("wc:")){const t=ap(e);null!=t&&t.includes("wc:")&&(e=t)}const t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=e.substring(t+1,n).split("@"),o=typeof n<"u"?e.substring(n):"",s=sh.parse(o),a="string"==typeof s.methods?s.methods.split(","):void 0;return{protocol:r,topic:lg(i[0]),version:parseInt(i[1],10),symKey:s.symKey,relay:cg(s),methods:a,expiryTimestamp:s.expiryTimestamp?parseInt(s.expiryTimestamp,10):void 0}}function lg(e){return e.startsWith("//")?e.substring(2):e}function dg(e){return`${e.protocol}:${e.topic}@${e.version}?`+sh.stringify(ag(((e,t)=>tg(e,ng(t)))(ag({symKey:e.symKey},function(e,t="-"){const n={};return Object.keys(e).forEach((r=>{const i="relay"+t+r;e[r]&&(n[i]=e[r])})),n}(e.relay)),{expiryTimestamp:e.expiryTimestamp}),e.methods?{methods:e.methods.join(",")}:{}))}function fg(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function hg(e){const t=[];return e.forEach((e=>{const[n,r]=e.split(":");t.push(`${n}:${r}`)})),t}function pg(e,t){t=t.map((e=>e.replace("did:pkh:","")));const n=function(e){const t={};return e?.forEach((e=>{const[n,r]=e.split(":");t[n]||(t[n]={accounts:[],chains:[],events:[]}),t[n].accounts.push(e),t[n].chains.push(`${n}:${r}`)})),t}(t);for(const[r,i]of Object.entries(n))i.methods?i.methods=np(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return n}const gg={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},mg={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function bg(e,t){const{message:n,code:r}=mg[e];return{message:t?`${n} ${t}`:n,code:r}}function yg(e,t){const{message:n,code:r}=gg[e];return{message:t?`${n} ${t}`:n,code:r}}function vg(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function wg(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function xg(e){return typeof e>"u"}function Sg(e,t){return!(!t||!xg(e))||"string"==typeof e&&!!e.trim().length}function Ag(e,t){return!(!t||!xg(e))||"number"==typeof e&&!isNaN(e)}function Eg(e){return!(!Sg(e,!1)||!e.includes(":"))&&2===e.split(":").length}function _g(e){let t=!0;return vg(e)?e.length&&(t=e.every((e=>Sg(e,!1)))):t=!1,t}function Cg(e,t,n){let r=null;return Object.entries(e).forEach((([e,i])=>{if(r)return;const o=function(e,t,n){let r=null;return vg(t)&&t.length?t.forEach((e=>{r||Eg(e)||(r=yg("UNSUPPORTED_CHAINS",`${n}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):Eg(e)||(r=yg("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}(e,Ih(e,i),`${t} ${n}`);o&&(r=o)})),r}function Ig(e,t){let n=null;return vg(e)?e.forEach((e=>{n||function(e){if(Sg(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&Eg(e)}}return!1}(e)||(n=yg("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):n=yg("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function kg(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=function(e,t){let n=null;return _g(e?.methods)?_g(e?.events)||(n=yg("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=yg("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}(e,`${t}, namespace`);r&&(n=r)})),n}function Tg(e,t){let n=null;if(e&&wg(e)){const r=kg(e,t);r&&(n=r);const i=function(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=Ig(e?.accounts,`${t} namespace`);r&&(n=r)})),n}(e,t);i&&(n=i)}else n=bg("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function Mg(e){return Sg(e.protocol,!0)}function Pg(e){return typeof e<"u"&&null!==typeof e}function Og(e,t){return!(!Eg(t)||!function(e){const t=[];return Object.values(e).forEach((e=>{t.push(...hg(e.accounts))})),t}(e).includes(t))}function Rg(e,t,n){return!!Sg(n,!1)&&function(e,t){const n=[];return Object.values(e).forEach((e=>{hg(e.accounts).includes(t)&&n.push(...e.methods)})),n}(e,t).includes(n)}function Ng(e,t,n){return!!Sg(n,!1)&&function(e,t){const n=[];return Object.values(e).forEach((e=>{hg(e.accounts).includes(t)&&n.push(...e.events)})),n}(e,t).includes(n)}function Bg(e,t,n){let r=null;const i=function(e){const t={};return Object.keys(e).forEach((n=>{var r;n.includes(":")?t[n]=e[n]:null==(r=e[n].chains)||r.forEach((r=>{t[r]={methods:e[n].methods,events:e[n].events}}))})),t}(e),o=function(e){const t={};return Object.keys(e).forEach((n=>{if(n.includes(":"))t[n]=e[n];else{hg(e[n].accounts)?.forEach((r=>{t[r]={accounts:e[n].accounts.filter((e=>e.includes(`${r}:`))),methods:e[n].methods,events:e[n].events}}))}})),t}(t),s=Object.keys(i),a=Object.keys(o),c=Lg(Object.keys(e)),u=Lg(Object.keys(t)),l=c.filter((e=>!u.includes(e)));return l.length&&(r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces.\n Required: ${l.toString()}\n Received: ${Object.keys(t).toString()}`)),Gh(s,a)||(r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces.\n Required: ${s.toString()}\n Approved: ${a.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||r)return;const i=hg(t[e].accounts);i.includes(e)||(r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${i.toString()}`))})),s.forEach((e=>{r||(Gh(i[e].methods,o[e].methods)?Gh(i[e].events,o[e].events)||(r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${e}`)):r=bg("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${e}`))})),r}function Lg(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function Dg(){const e=qh();return new Promise((t=>{switch(e){case Lh:t(Vh()&&navigator?.onLine);break;case Nh:t(async function(){if(Fh()&&typeof n.g<"u"&&null!=n.g&&n.g.NetInfo){return(await(null==n.g?void 0:n.g.NetInfo.fetch()))?.isConnected}return!0}());break;default:t(!0)}}))}function Ug(e){switch(qh()){case Lh:!function(e){!Fh()&&Vh()&&(window.addEventListener("online",(()=>e(!0))),window.addEventListener("offline",(()=>e(!1))))}(e);break;case Nh:!function(e){Fh()&&typeof n.g<"u"&&null!=n.g&&n.g.NetInfo&&n.g?.NetInfo.addEventListener((t=>e(t?.isConnected)))}(e)}}const jg={};class Fg{static get(e){return jg[e]}static set(e,t){jg[e]=t}static delete(e){delete jg[e]}}const Vg="INTERNAL_ERROR",qg="SERVER_ERROR",zg=[-32700,-32600,-32601,-32602,-32603],Hg={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[Vg]:{code:-32603,message:"Internal error"},[qg]:{code:-32e3,message:"Server error"}};function Wg(e){return zg.includes(e)}function Gg(e){return Object.keys(Hg).includes(e)?Hg[e]:Hg.SERVER_ERROR}function Zg(e){const t=Object.values(Hg).find((t=>t.code===e));return t||Hg.SERVER_ERROR}function Kg(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${t}`):e}var Xg=n(93109);function Yg(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function Jg(e=6){return BigInt(Yg(e))}function Qg(e,t,n){return{id:n||Yg(),jsonrpc:"2.0",method:e,params:t}}function $g(e,t){return{id:e,jsonrpc:"2.0",result:t}}function em(e,t,n){return{id:e,jsonrpc:"2.0",error:tm(t,n)}}function tm(e,t){return"undefined"===typeof e?Gg(Vg):("string"===typeof e&&(e=Object.assign(Object.assign({},Gg(qg)),{message:e})),"undefined"!==typeof t&&(e.data=t),Wg(e.code)&&(e=Zg(e.code)),e)}class nm extends class extends class{}{constructor(){super()}}{constructor(e){super()}}function rm(e,t){const n=function(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return"undefined"!==typeof n&&new RegExp(t).test(n)}function im(e){return rm(e,"^https?:")}function om(e){return rm(e,"^wss?:")}function sm(e){return"object"===typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function am(e){return sm(e)&&"method"in e}function cm(e){return sm(e)&&(um(e)||lm(e))}function um(e){return"result"in e}function lm(e){return"error"in e}class dm extends nm{constructor(e){super(e),this.events=new Nt.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Qg(e.method,e.params||[],e.id||Jg().toString()),t)}async requestStrict(e,t){return new Promise((async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(Hu){r(Hu)}this.events.on(`${e.id}`,(e=>{lm(e)?r(e.error):n(e.result)}));try{await this.connection.send(e,t)}catch(Hu){r(Hu)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),cm(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",(e=>this.onPayload(e))),this.connection.on("close",(e=>this.onClose(e))),this.connection.on("error",(e=>this.events.emit("error",e))),this.connection.on("register_error",(e=>this.onClose())),this.hasRegisteredEventListeners=!0)}}const fm=e=>e.split("?")[0],hm=typeof WebSocket<"u"?WebSocket:typeof n.g<"u"&&typeof n.g.WebSocket<"u"?n.g.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:n(72030);class pm{constructor(e){if(this.url=e,this.events=new Nt.EventEmitter,this.registering=!1,!om(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise(((e,t)=>{typeof this.socket>"u"?t(new Error("Connection already closed")):(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close())}))}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(yl(e))}catch(aM){this.onError(e.id,aM)}}register(e=this.url){if(!om(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,r)=>{const i=new URLSearchParams(e).get("origin"),o=(0,Xg.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:(a=e,!new RegExp("wss?://localhost(:d{2,5})?").test(a))},s=new hm(e,[],o);var a;typeof WebSocket<"u"||typeof n.g<"u"&&typeof n.g.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u"?s.onerror=e=>{const t=e;r(this.emitError(t.error))}:s.on("error",(e=>{r(this.emitError(e))})),s.onopen=()=>{this.onOpen(s),t(s)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?bl(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=em(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e,t=this.url){return Kg(e,fm(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${fm(this.url)}`));return this.events.emit("register_error",t),t}}var gm=n(72307),mm=n.n(gm);const bm="core",ym="wc@2:core:",vm="error",wm={database:":memory:"},xm="client_ed25519_seed",Sm=qu.ONE_DAY,Am=qu.SIX_HOURS,Em="wss://relay.walletconnect.org",_m="relayer_message",Cm="relayer_message_ack",Im="relayer_connect",km="relayer_disconnect",Tm="relayer_error",Mm="relayer_connection_stalled",Pm="relayer_publish",Om="payload",Rm="connect",Nm="disconnect",Bm="error",Lm="2.17.1",Dm={link_mode:"link_mode",relay:"relay"},Um="WALLETCONNECT_LINK_MODE_APPS",jm="subscription_created",Fm="subscription_deleted",Vm="subscription_sync",qm="subscription_resubscribed",zm=1e3*qu.FIVE_SECONDS,Hm={wc_pairingDelete:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:qu.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:qu.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:0},res:{ttl:qu.ONE_DAY,prompt:!1,tag:0}}},Wm="pairing_create",Gm="pairing_expire",Zm="pairing_delete",Km="pairing_ping",Xm="history_created",Ym="history_updated",Jm="history_deleted",Qm="history_sync",$m="expirer_created",eb="expirer_deleted",tb="expirer_expired",nb="expirer_sync",rb="https://verify.walletconnect.org",ib=rb,ob=`${ib}/v3`,sb=["https://verify.walletconnect.com",rb],ab="pairing_started",cb="pairing_uri_validation_success",ub="pairing_uri_not_expired",lb="store_new_pairing",db="subscribing_pairing_topic",fb="subscribe_pairing_topic_success",hb="existing_pairing",pb="pairing_not_expired",gb="emit_inactive_pairing",mb="emit_session_proposal",bb="no_internet_connection",yb="malformed_pairing_uri",vb="active_pairing_already_exists",wb="subscribe_pairing_topic_failure",xb="pairing_expired",Sb="proposal_listener_not_found",Ab="session_approve_started",Eb="session_namespaces_validation_success",_b="subscribing_session_topic",Cb="subscribe_session_topic_success",Ib="publishing_session_approve",kb="session_approve_publish_success",Tb="store_session",Mb="publishing_session_settle",Pb="session_settle_publish_success",Ob="no_internet_connection",Rb="proposal_expired",Nb="subscribe_session_topic_failure",Bb="session_approve_publish_failure",Lb="session_settle_publish_failure",Db="session_approve_namespace_validation_failure",Ub="proposal_not_found",jb="authenticated_session_approve_started",Fb="create_authenticated_session_topic",Vb="cacaos_verified",qb="store_authenticated_session",zb="subscribing_authenticated_session_topic",Hb="subscribe_authenticated_session_topic_success",Wb="publishing_authenticated_session_approve",Gb="no_internet_connection",Zb="invalid_cacao",Kb="subscribe_authenticated_session_topic_failure",Xb="authenticated_session_approve_publish_failure",Yb="authenticated_session_pending_request_not_found";var Jb=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=o-1;(0!==l||d>>0,s[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===s[h];)h++;for(var p=new Uint8Array(r+(o-h)),g=r;h!==o;)p[g++]=s[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,u=new Uint8Array(s);i!==o;){for(var d=t[i],f=0,h=s-1;(0!==d||f>>0,u[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=s-r;p!==s&&0===u[p];)p++;for(var g=c.repeat(n);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class ey{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class ty{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return ry(this,e)}}class ny{constructor(e){this.decoders=e}or(e){return ry(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ry=(e,t)=>new ny({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class iy{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new ey(e,t,n),this.decoder=new ty(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const oy=({name:e,prefix:t,encode:n,decode:r})=>new iy(e,t,n,r),sy=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=Qb(n,t);return oy({prefix:e,name:t,encode:r,decode:e=>$b(i(e))})},ay=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>oy({prefix:t,name:e,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<((e,t,n,r)=>{const i={};for(let l=0;l=8&&(a-=8,s[u++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(t,r,n,e)}),cy=oy({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});var uy=Object.freeze({__proto__:null,identity:cy});const ly=ay({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var dy=Object.freeze({__proto__:null,base2:ly});const fy=ay({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var hy=Object.freeze({__proto__:null,base8:fy});const py=sy({prefix:"9",name:"base10",alphabet:"0123456789"});var gy=Object.freeze({__proto__:null,base10:py});const my=ay({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),by=ay({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var yy=Object.freeze({__proto__:null,base16:my,base16upper:by});const vy=ay({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),wy=ay({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),xy=ay({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Sy=ay({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ay=ay({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ey=ay({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),_y=ay({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Cy=ay({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Iy=ay({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ky=Object.freeze({__proto__:null,base32:vy,base32upper:wy,base32pad:xy,base32padupper:Sy,base32hex:Ay,base32hexupper:Ey,base32hexpad:_y,base32hexpadupper:Cy,base32z:Iy});const Ty=sy({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),My=sy({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Py=Object.freeze({__proto__:null,base36:Ty,base36upper:My});const Oy=sy({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ry=sy({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ny=Object.freeze({__proto__:null,base58btc:Oy,base58flickr:Ry});const By=ay({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ly=ay({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Dy=ay({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Uy=ay({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var jy=Object.freeze({__proto__:null,base64:By,base64pad:Ly,base64url:Dy,base64urlpad:Uy});const Fy=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),Vy=Fy.reduce(((e,t,n)=>(e[n]=t,e)),[]),qy=Fy.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const zy=oy({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Vy[t]),"")},decode:function(e){const t=[];for(const n of e){const e=qy[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}});var Hy=Object.freeze({__proto__:null,base256emoji:zy}),Wy=function e(t,n,r){n=n||[];for(var i=r=r||0;t>=Gy;)n[r++]=255&t|128,t/=128;for(;-128&t;)n[r++]=255&t|128,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Gy=Math.pow(2,31);var Zy=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(127&r)<=128);return e.bytes=s-n,i};var Ky=Math.pow(2,7),Xy=Math.pow(2,14),Yy=Math.pow(2,21),Jy=Math.pow(2,28),Qy=Math.pow(2,35),$y=Math.pow(2,42),ev=Math.pow(2,49),tv=Math.pow(2,56),nv=Math.pow(2,63),rv={encode:Wy,decode:Zy,encodingLength:function(e){return e(iv.encode(e,t,n),t),sv=e=>iv.encodingLength(e),av=(e,t)=>{const n=t.byteLength,r=sv(e),i=r+sv(n),o=new Uint8Array(i+n);return ov(e,o,0),ov(n,o,r),o.set(t,i),new cv(e,n,t,o)};class cv{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const uv=({name:e,code:t,encode:n})=>new lv(e,t,n);class lv{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?av(this.code,t):t.then((e=>av(this.code,e)))}throw Error("Unknown type, must be binary type")}}const dv=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),fv=uv({name:"sha2-256",code:18,encode:dv("SHA-256")}),hv=uv({name:"sha2-512",code:19,encode:dv("SHA-512")});Object.freeze({__proto__:null,sha256:fv,sha512:hv});const pv=$b,gv={code:0,name:"identity",encode:pv,digest:e=>av(0,pv(e))};Object.freeze({__proto__:null,identity:gv});new TextEncoder,new TextDecoder;const mv={...uy,...dy,...hy,...gy,...yy,...ky,...Py,...Ny,...jy,...Hy};function bv(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const yv=bv("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),vv=bv("ascii","a",(e=>{let t="a";for(let n=0;n{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let n=0;n{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=Zl(t,this.name)}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Zh(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Kh(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Sv{constructor(e,t,n){this.core=e,this.logger=t,this.name="crypto",this.randomSessionIdentifier=Vp(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>{this.isInitialized();return Vf(zf(await this.getClientSeed()).publicKey)},this.generateKeyPair=()=>{this.isInitialized();const e=function(){const e=fh.Au();return{privateKey:wh(e.secretKey,Dp),publicKey:wh(e.publicKey,Dp)}}();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();const t=zf(await this.getClientSeed()),n=this.randomSessionIdentifier,r=Sm;return await Hf(n,e,r,t)},this.generateSharedKey=(e,t,n)=>{this.isInitialized();const r=function(e,t){const n=fh.gi(vh(e,Dp),vh(t,Dp),!0);return wh(new lh.t(dh.mE,n).expand(32),Dp)}(this.getPrivateKey(e),t);return this.setSymKey(r,n)},this.setSymKey=async(e,t)=>{this.isInitialized();const n=t||qp(e);return await this.keychain.set(n,e),n},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,n)=>{this.isInitialized();const r=Kp(n),i=yl(t);if(Yp(r))return function(e,t){const n=Hp(2),r=(0,nd.randomBytes)(12);return Gp({type:n,sealed:vh(e,Fp),iv:r,encoding:t})}(i,n?.encoding);if(Xp(r)){const t=r.senderPublicKey,n=r.receiverPublicKey;e=await this.generateSharedKey(t,n)}const o=this.getSymKey(e),{type:s,senderPublicKey:a}=r;return function(e){const t=Hp(typeof e.type<"u"?e.type:0);if(1===Wp(t)&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?vh(e.senderPublicKey,Dp):void 0,r=typeof e.iv<"u"?vh(e.iv,Dp):(0,nd.randomBytes)(12);return Gp({type:t,sealed:new uh.OK(vh(e.symKey,Dp)).seal(r,vh(e.message,Fp)),iv:r,senderPublicKey:n,encoding:e.encoding})}({type:s,symKey:o,message:i,senderPublicKey:a,encoding:n?.encoding})},this.decode=async(e,t,n)=>{this.isInitialized();const r=function(e,t){const n=Zp({encoded:e,encoding:t?.encoding});return Kp({type:Wp(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?wh(n.senderPublicKey,Dp):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,n);if(Yp(r)){const e=function(e,t){const{sealed:n}=Zp({encoded:e,encoding:t});return wh(n,Fp)}(t,n?.encoding);return bl(e)}if(Xp(r)){const t=r.receiverPublicKey,n=r.senderPublicKey;e=await this.generateSharedKey(t,n)}try{const r=function(e){const t=new uh.OK(vh(e.symKey,Dp)),{sealed:n,iv:r}=Zp({encoded:e.encoded,encoding:e?.encoding}),i=t.open(r,n);if(null===i)throw new Error("Failed to decrypt");return wh(i,Fp)}({symKey:this.getSymKey(e),encoded:t,encoding:n?.encoding});return bl(r)}catch(Cl){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(Cl)}},this.getPayloadType=(e,t=Up)=>Wp(Zp({encoded:e,encoding:t}).type),this.getPayloadSenderPublicKey=(e,t=Up)=>{const n=Zp({encoded:e,encoding:t});return n.senderPublicKey?wh(n.senderPublicKey,Dp):void 0},this.core=e,this.logger=Zl(t,this.name),this.keychain=n||new xv(this.core,this.logger)}get context(){return Gl(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(xm)}catch{e=Vp(),await this.keychain.set(xm,e)}return function(e,t="utf8"){const n=wv[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${e}`):globalThis.Buffer.from(e,"utf8")}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Av extends class{constructor(e,t){this.logger=e,this.core=t}}{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name="messages",this.version="0.3",this.initialized=!1,this.storagePrefix=ym,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(Wu){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(Wu)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();const n=zp(t);let r=this.messages.get(e);return typeof r>"u"&&(r={}),typeof r[n]<"u"||(r[n]=t,this.messages.set(e,r),await this.persist()),n},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>{this.isInitialized();return typeof this.get(e)[zp(t)]<"u"},this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=Zl(e,this.name),this.core=t}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Zh(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Kh(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ev extends Jl{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new Nt.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=(0,qu.toMiliseconds)(qu.ONE_MINUTE),this.failedPublishTimeout=(0,qu.toMiliseconds)(qu.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(e,t,n)=>{var r;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:n}});const i=n?.ttl||Am,o=Qp(n),s=n?.prompt||!1,a=n?.tag||0,c=n?.id||Jg().toString(),u={topic:e,message:t,opts:{ttl:i,relay:o,prompt:s,tag:a,id:c,attestation:n?.attestation}},l=`Failed to publish payload, please try again. id:${c} tag:${a}`,d=Date.now();let f,h=1;try{for(;void 0===f;){if(Date.now()-d>this.publishTimeout)throw new Error(l);this.logger.trace({id:c,attempts:h},`publisher.publish - attempt ${h}`),f=await await Yh(this.rpcPublish(e,t,i,o,s,a,c,n?.attestation).catch((e=>this.logger.warn(e))),this.publishTimeout,l),h++,f||await new Promise((e=>setTimeout(e,this.failedPublishTimeout)))}this.relayer.events.emit(Pm,u),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:n}})}catch(p){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(p),null!=(r=n?.internal)&&r.throwOnFailedPublish)throw p;this.queue.set(c,u)}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=Zl(t,this.name),this.registerEventListeners()}get context(){return Gl(this.logger)}rpcPublish(e,t,n,r,i,o,s,a){var c,u,l,d;const f={method:$p(r.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:i,tag:o,attestation:a},id:s};return xg(null==(c=f.params)?void 0:c.prompt)&&(null==(u=f.params)||delete u.prompt),xg(null==(l=f.params)?void 0:l.tag)&&(null==(d=f.params)||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f}),this.relayer.request(f)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async e=>{const{topic:t,message:n,opts:r}=e;await this.publish(t,n,r)}))}registerEventListeners(){this.relayer.core.heartbeat.on(Gu,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(Mm);this.checkQueue()})),this.relayer.on(Cm,(e=>{this.removeRequestFromQueue(e.id.toString())}))}}class _v{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const r=n.filter((e=>e!==t));r.length?this.map.set(e,r):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Cv=Object.defineProperty,Iv=Object.defineProperties,kv=Object.getOwnPropertyDescriptors,Tv=Object.getOwnPropertySymbols,Mv=Object.prototype.hasOwnProperty,Pv=Object.prototype.propertyIsEnumerable,Ov=(e,t,n)=>t in e?Cv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rv=(e,t)=>{for(var n in t||(t={}))Mv.call(t,n)&&Ov(e,n,t[n]);if(Tv)for(var n of Tv(t))Pv.call(t,n)&&Ov(e,n,t[n]);return e},Nv=(e,t)=>Iv(e,kv(t));class Bv extends $l{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new _v,this.events=new Nt.EventEmitter,this.name="subscription",this.version="0.3",this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ym,this.subscribeTimeout=(0,qu.toMiliseconds)(qu.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const n=Qp(t),r={topic:e,relay:n,transportType:t?.transportType};this.pending.set(e,r);const i=await this.rpcSubscribe(e,n,t);return"string"==typeof i&&(this.onSubscribe(i,r),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),i}catch(n){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(n),n}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),typeof t?.id<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>{if(this.topics.includes(e))return!0;const t=`${this.pendingSubscriptionWatchLabel}_${e}`;return await new Promise(((n,r)=>{const i=new qu.Watch;i.start(t);const o=setInterval((()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(o),i.stop(t),n(!0)),i.elapsed(t)>=zm&&(clearInterval(o),i.stop(t),r(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1))},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Zl(t,this.name),this.clientId=""}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map((async n=>await this.unsubscribeById(e,n,t))))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const r=Qp(n);await this.rpcUnsubscribe(e,t,r);const i=yg("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(r){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r),r}}async rpcSubscribe(e,t,n){var r;n?.transportType===Dm.relay&&await this.restartToComplete();const i={method:$p(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});const o=null==(r=n?.internal)?void 0:r.throwOnFailedPublish;try{const t=zp(e+this.clientId);if(n?.transportType===Dm.link_mode)return setTimeout((()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch((e=>this.logger.warn(e)))}),(0,qu.toMiliseconds)(qu.ONE_SECOND)),t;const r=await Yh(this.relayer.request(i).catch((e=>this.logger.warn(e))),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!r&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return r?t:null}catch(s){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Mm),o)throw s}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:$p(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{return await await Yh(this.relayer.request(t).catch((e=>this.logger.warn(e))),this.subscribeTimeout)}catch{this.relayer.events.emit(Mm)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t={method:$p(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map((e=>e.topic))}};let n;this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{n=await await Yh(this.relayer.request(t).catch((e=>this.logger.warn(e))),this.subscribeTimeout)}catch{this.relayer.events.emit(Mm)}return n}rpcUnsubscribe(e,t,n){const r={method:$p(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}onSubscribe(e,t){this.setSubscription(e,Nv(Rv({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,Rv({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,Rv({},t)),this.topicMap.set(t.topic,e),this.events.emit(jm,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Fm,Nv(Rv({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vm)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=bg("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);vg(t)&&this.onBatchSubscribe(t.map(((t,n)=>Nv(Rv({},e[n]),{id:t}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(Gu,(async()=>{await this.checkPending()})),this.events.on(jm,(async e=>{const t=jm;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(Fm,(async e=>{const t=Fm;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.restartInProgress||(clearInterval(t),e())}),this.pollingInterval)}))}}var Lv=Object.defineProperty,Dv=Object.getOwnPropertySymbols,Uv=Object.prototype.hasOwnProperty,jv=Object.prototype.propertyIsEnumerable,Fv=(e,t,n)=>t in e?Lv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vv=(e,t)=>{for(var n in t||(t={}))Uv.call(t,n)&&Fv(e,n,t[n]);if(Dv)for(var n of Dv(t))jv.call(t,n)&&Fv(e,n,t[n]);return e};class qv extends Ql{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Nt.EventEmitter,this.name="relayer",this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=(0,qu.toMiliseconds)(qu.THIRTY_SECONDS+qu.ONE_SECOND),this.request=async e=>{var t,n;this.logger.debug("Publishing Request Payload");const r=e.id||Jg().toString();await this.toEstablishConnection();try{const i=this.provider.request(e);this.requestsInFlight.set(r,{promise:i,request:e}),this.logger.trace({id:r,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - attempt to publish...");const o=await new Promise((async(e,t)=>{const n=()=>{t(new Error(`relayer.request - publish interrupted, id: ${r}`))};this.provider.on(Nm,n);const o=await i;this.provider.off(Nm,n),e(o)}));return this.logger.trace({id:r,method:e.method,topic:null==(n=e.params)?void 0:n.topic},"relayer.request - published"),o}catch(Hu){throw this.logger.debug(`Failed to Publish Request: ${r}`),Hu}finally{this.requestsInFlight.delete(r)}},this.resetPingTimeout=()=>{if(jh())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout((()=>{var e,t,n;null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)||n.terminate()}),this.heartBeatTimeout)}catch(aM){this.logger.warn(aM)}},this.onPayloadHandler=e=>{this.onProviderPayload(e),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Im)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(Tm,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Om,this.onPayloadHandler),this.provider.on(Rm,this.onConnectHandler),this.provider.on(Nm,this.onDisconnectHandler),this.provider.on(Bm,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?Zl(e.logger,this.name):kl()(Wl({level:e.logger||"error"})),this.messages=new Av(this.logger,e.core),this.subscriber=new Bv(this,this.logger),this.publisher=new Ev(this,this.logger),this.relayUrl=e?.relayUrl||Em,this.projectId=e.projectId,this.bundleId=function(){var e;try{return Fh()&&typeof n.g<"u"&&typeof(null==n.g?void 0:n.g.Application)<"u"?null==(e=n.g.Application)?void 0:e.applicationId:void 0}catch{return}}(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Gl(this.logger)}get connected(){var e,t,n;return 1===(null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.readyState)}get connecting(){var e,t,n;return 0===(null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.readyState)}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:Dm.relay})}async subscribe(e,t){var n,r,i;this.isInitialized(),"relay"===t?.transportType&&await this.toEstablishConnection();const o=typeof(null==(n=t?.internal)?void 0:n.throwOnFailedPublish)>"u"||(null==(r=t?.internal)?void 0:r.throwOnFailedPublish);let s,a=(null==(i=this.subscriber.topicMap.get(e))?void 0:i[0])||"";const c=t=>{t.topic===e&&(this.subscriber.off(jm,c),s())};return await Promise.all([new Promise((e=>{s=e,this.subscriber.on(jm,c)})),new Promise((async(n,r)=>{a=await this.subscriber.subscribe(e,Vv({internal:{throwOnFailedPublish:o}},t)).catch((e=>{o&&r(e)}))||a,n()}))]),a}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map((e=>e.promise)))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await Yh(this.provider.disconnect(),2e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise((async(e,t)=>{const n=()=>{this.provider.off(Nm,n),t(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Nm,n),await Yh(this.provider.connect(),(0,qu.toMiliseconds)(qu.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch((e=>{t(e)})).finally((()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0})),this.subscriber.start().catch((e=>{this.logger.error(e),this.onDisconnectHandler()})),this.hasExperiencedNetworkDisruption=!1,e()}))}catch(aM){this.logger.error(aM);const t=aM;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(t.message))throw aM}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!(await Dg()))throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(0===e?.length)return void this.logger.trace("Batch message events is empty. Ignoring...");const t=e.sort(((e,t)=>e.publishedAt-t.publishedAt));this.logger.trace(`Batch of ${t.length} message events sorted`);for(const r of t)try{await this.onMessageEvent(r)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:n}=e;if(!t.sessionExists){const e={topic:n,expiry:$h(qu.FIVE_MINUTES),relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,e)}this.events.emit(_m,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,n,r,i;if(jh())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(i=null==(r=null==(n=this.provider)?void 0:n.connection)?void 0:r.socket)||i.once("ping",(()=>{this.resetPingTimeout()}))),this.resetPingTimeout()}catch(Hu){this.logger.warn(Hu)}}isConnectionStalled(e){return this.staleConnectionErrors.some((t=>e.includes(t)))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new dm(new pm(Wh({sdkVersion:Lm,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||0===n.length)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!(await this.subscriber.isSubscribed(t)))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const r=this.messages.has(t,n);return r&&this.logger.debug(`Ignoring duplicate message: ${n}`),r}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),am(e)){if(!e.method.endsWith("_subscription"))return;const t=e.params,{topic:n,message:r,publishedAt:i,attestation:o}=t.data,s={topic:n,message:r,publishedAt:i,transportType:Dm.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Vv({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}else cm(e)&&this.events.emit(Cm,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(_m,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=$g(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Om,this.onPayloadHandler),this.provider.off(Rm,this.onConnectHandler),this.provider.off(Nm,this.onDisconnectHandler),this.provider.off(Bm,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Dg();Ug((async t=>{e!==t&&(e=t,t?await this.restartTransport().catch((e=>this.logger.error(e))):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}))}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(km),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout((async()=>{await this.transportOpen().catch((e=>this.logger.error(e)))}),(0,qu.toMiliseconds)(.1))))}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.connected&&(clearInterval(t),e())}),this.connectionStatusPollingInterval)})),await this.transportOpen())}}var zv=Object.defineProperty,Hv=Object.getOwnPropertySymbols,Wv=Object.prototype.hasOwnProperty,Gv=Object.prototype.propertyIsEnumerable,Zv=(e,t,n)=>t in e?zv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kv=(e,t)=>{for(var n in t||(t={}))Wv.call(t,n)&&Zv(e,n,t[n]);if(Hv)for(var n of Hv(t))Gv.call(t,n)&&Zv(e,n,t[n]);return e};class Xv extends class{constructor(e,t,n,r){this.core=e,this.logger=t,this.name=n}}{constructor(e,t,n,r="wc@2:core:",i){super(e,t,n,r),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ym,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!xg(e)?this.map.set(this.getKey(e),e):function(e){var t;return null==(t=e?.proposer)?void 0:t.publicKey}(e)?this.map.set(e.id,e):function(e){return e?.topic}(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((n=>mm()(t[n],e[n]))))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const n=Kv(Kv({},this.getData(e)),t);this.map.set(e,n),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())},this.logger=Zl(t,this.name),this.storagePrefix=r,this.getKey=i}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:t}=bg("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=bg("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Yv{constructor(e,t){this.core=e,this.logger=t,this.name="pairing",this.version="0.3",this.events=new(Bt()),this.initialized=!1,this.storagePrefix=ym,this.ignoredPayloadTypes=[1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async e=>{this.isInitialized();const t=Vp(),n=await this.core.crypto.setSymKey(t),r=$h(qu.FIVE_MINUTES),i={protocol:"irn"},o={topic:n,expiry:r,relay:i,active:!1,methods:e?.methods},s=dg({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:t,relay:i,expiryTimestamp:r,methods:e?.methods});return this.events.emit(Wm,o),this.core.expirer.set(n,r),await this.pairings.set(n,o),await this.core.relayer.subscribe(n,{transportType:e?.transportType}),{topic:n,uri:s}},this.pair=async e=>{this.isInitialized();const t=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:[ab]}});this.isValidPair(e,t);const{topic:n,symKey:r,relay:i,expiryTimestamp:o,methods:s}=ug(e.uri);let a;if(t.props.properties.topic=n,t.addTrace(cb),t.addTrace(ub),this.pairings.keys.includes(n)){if(a=this.pairings.get(n),t.addTrace(hb),a.active)throw t.setError(vb),new Error(`Pairing already exists: ${n}. Please try again with a new connection URI.`);t.addTrace(pb)}const c=o||$h(qu.FIVE_MINUTES),u={topic:n,relay:i,expiry:c,active:!1,methods:s};this.core.expirer.set(n,c),await this.pairings.set(n,u),t.addTrace(lb),e.activatePairing&&await this.activate({topic:n}),this.events.emit(Wm,u),t.addTrace(gb),this.core.crypto.keychain.has(n)||await this.core.crypto.setSymKey(r,n),t.addTrace(db);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{t.setError(bb)}try{await this.core.relayer.subscribe(n,{relay:i})}catch(Nl){throw t.setError(wb),Nl}return t.addTrace(fb),u},this.activate=async({topic:e})=>{this.isInitialized();const t=$h(qu.THIRTY_DAYS);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:n,resolve:r,reject:i}=Xh();this.events.once(tp("pairing_ping",e),(({error:e})=>{e?i(e):r()})),await n()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",yg("USER_DISCONNECTED")),await this.deletePairing(t))},this.formatUriFromPairing=e=>{this.isInitialized();const{topic:t,relay:n,expiry:r,methods:i}=e,o=this.core.crypto.keychain.get(t);return dg({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:o,relay:n,expiryTimestamp:r,methods:i})},this.sendRequest=async(e,t,n)=>{const r=Qg(t,n),i=await this.core.crypto.encode(e,r),o=Hm[t].req;return this.core.history.set(e,r),this.core.relayer.publish(e,i,o),r.id},this.sendResult=async(e,t,n)=>{const r=$g(e,n),i=await this.core.crypto.encode(t,r),o=await this.core.history.get(t,e),s=Hm[o.request.method].res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)},this.sendError=async(e,t,n)=>{const r=em(e,n),i=await this.core.crypto.encode(t,r),o=await this.core.history.get(t,e),s=Hm[o.request.method]?Hm[o.request.method].res:Hm.unregistered_method.res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,yg("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{const e=this.pairings.getAll().filter((e=>ep(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))},this.onRelayEventRequest=e=>{const{topic:t,payload:n}=e;switch(n.method){case"wc_pairingPing":return this.onPairingPingRequest(t,n);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,n);default:return this.onUnknownRpcMethodRequest(t,n)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:n}=e,r=(await this.core.history.get(t,n.id)).request.method;return"wc_pairingPing"===r?this.onPairingPingResponse(t,n):this.onUnknownRpcMethodResponse(r)},this.onPairingPingRequest=async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult(n,e,!0),this.events.emit(Km,{id:n,topic:e})}catch(Hu){await this.sendError(n,e,Hu),this.logger.error(Hu)}},this.onPairingPingResponse=(e,t)=>{const{id:n}=t;setTimeout((()=>{um(t)?this.events.emit(tp("pairing_ping",n),{}):lm(t)&&this.events.emit(tp("pairing_ping",n),{error:t.error})}),500)},this.onPairingDeleteRequest=async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(Zm,{id:n,topic:e})}catch(Hu){await this.sendError(n,e,Hu),this.logger.error(Hu)}},this.onUnknownRpcMethodRequest=async(e,t)=>{const{id:n,method:r}=t;try{if(this.registeredMethods.includes(r))return;const t=yg("WC_METHOD_UNSUPPORTED",r);await this.sendError(n,e,t),this.logger.error(t)}catch(i){await this.sendError(n,e,i),this.logger.error(i)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(yg("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=(e,t)=>{var n;if(!Pg(e)){const{message:n}=bg("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError(yb),new Error(n)}if(!function(e){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(Sg(e,!1))return!!t(e)||t(ap(e))}catch{}return!1}(e.uri)){const{message:n}=bg("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError(yb),new Error(n)}const r=ug(e?.uri);if(null==(n=r?.relay)||!n.protocol){const{message:e}=bg("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(yb),new Error(e)}if(null==r||!r.symKey){const{message:e}=bg("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(yb),new Error(e)}if(null!=r&&r.expiryTimestamp&&(0,qu.toMiliseconds)(r?.expiryTimestamp){if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!Sg(e,!1)){const{message:t}=bg("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=bg("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(ep(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=bg("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}},this.core=e,this.logger=Zl(t,this.name),this.pairings=new Xv(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Gl(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(_m,(async e=>{const{topic:t,message:n,transportType:r}=e;if(!this.pairings.keys.includes(t)||r===Dm.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(t,n);try{am(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):cm(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.core.history.delete(t,i.id))}catch(Hu){this.logger.error(Hu)}}))}registerExpirerEvents(){this.core.expirer.on(tb,(async e=>{const{topic:t}=Qh(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Gm,{topic:t}))}))}}class Jv extends Yl{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new Nt.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ym,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,n)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:n}),this.records.has(t.id))return;const r={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:n,expiry:$h(qu.THIRTY_DAYS)};this.records.set(r.id,r),this.persist(),this.events.emit(Xm,r)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=lm(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(Ym,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((n=>{if(n.topic===e){if(typeof t<"u"&&n.id!==t)return;this.records.delete(n.id),this.events.emit(Jm,n)}})),this.persist()},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=Zl(t,this.name)}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:Qg(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)})),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Qm)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=bg("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Xm,(e=>{const t=Xm;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(Ym,(e=>{const t=Ym;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(Jm,(e=>{const t=Jm;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.core.heartbeat.on(Gu,(()=>{this.cleanup()}))}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach((t=>{(0,qu.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(Jm,t,!1),e=!0)})),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Qv extends ed{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new Nt.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ym,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}},this.set=(e,t)=>{this.isInitialized();const n=this.formatTarget(e),r={target:n,expiry:t};this.expirations.set(n,r),this.checkExpiry(n,r),this.events.emit($m,{target:n,expiration:r})},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),n=this.getExpiration(t);this.expirations.delete(t),this.events.emit(eb,{target:t,expiration:n})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=Zl(t,this.name)}get context(){return Gl(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return function(e){return Jh("topic",e)}(e);if("number"==typeof e)return function(e){return Jh("id",e)}(e);const{message:t}=bg("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(nb)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=bg("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=bg("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:n}=t;(0,qu.toMiliseconds)(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(tb,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(Gu,(()=>this.checkExpirations())),this.events.on($m,(e=>{const t=$m;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(tb,(e=>{const t=tb;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(eb,(e=>{const t=eb;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}}class $v extends class{constructor(e,t,n){this.core=e,this.logger=t,this.store=n}}{constructor(e,t,n){super(e,t,n),this.core=e,this.logger=t,this.store=n,this.name="verify-api",this.verifyUrlV3=ob,this.storagePrefix=ym,this.version=2,this.init=async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,qu.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt){if(!Vh()||this.isDevEnv)return;const t=window.location.origin,{id:n,decryptedId:r}=e,i=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${n}&decryptedId=${r}`;try{const e=(0,ih.getDocument)(),t=this.startAbortTimer(5*qu.ONE_SECOND),r=await new Promise(((r,o)=>{const s=()=>{window.removeEventListener("message",c),e.body.removeChild(a),o("attestation aborted")};this.abortController.signal.addEventListener("abort",s);const a=e.createElement("iframe");a.src=i,a.style.display="none",a.addEventListener("error",s,{signal:this.abortController.signal});const c=i=>{if(i.data&&"string"==typeof i.data)try{const o=JSON.parse(i.data);if("verify_attestation"===o.type){if(qf(o.attestation).payload.id!==n)return;clearInterval(t),e.body.removeChild(a),this.abortController.signal.removeEventListener("abort",s),window.removeEventListener("message",c),r(null===o.attestation?"":o.attestation)}}catch(o){this.logger.warn(o)}};e.body.appendChild(a),window.addEventListener("message",c,{signal:this.abortController.signal})}));return this.logger.debug("jwt attestation",r),r}catch(o){this.logger.warn(o)}return""},this.resolve=async e=>{if(this.isDevEnv)return"";const{attestationId:t,hash:n,encryptedId:r}=e;if(""===t)return void this.logger.debug("resolve: attestationId is empty, skipping");if(t){if(qf(t).payload.id!==r)return;const e=await this.isValidJwtAttestation(t);if(e)return e.isVerified?e:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!n)return;const i=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(n,i)},this.fetchAttestation=async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);const n=this.startAbortTimer(5*qu.ONE_SECOND),r=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(n),200===r.status?await r.json():void 0},this.getVerifyUrl=e=>{let t=e||ib;return sb.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${ib}`),t=ib),t},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const e=this.startAbortTimer(qu.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}},this.persistPublicKey=async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async e=>{const t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(r){this.logger.error(r),this.logger.warn("error validating attestation")}const n=await this.fetchAndPersistPublicKey();try{if(n)return this.validateAttestation(e,n)}catch(r){this.logger.error(r),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise((async e=>{const t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))}));const e=await this.fetchPromise;return this.fetchPromise=void 0,e},this.validateAttestation=(e,t)=>{const n=Jp(e,t.publicKey),r={hasExpired:(0,qu.toMiliseconds)(n.exp)this.abortController.abort()),(0,qu.toMiliseconds)(e))}}class ew extends class{constructor(e,t){this.projectId=e,this.logger=t}}{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context="echo",this.registerDeviceToken=async e=>{const{clientId:t,token:n,notificationType:r,enableEncrypted:i=!1}=e,o=`https://echo.walletconnect.com/${this.projectId}/clients`;await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:r,token:n,always_raw:i})})},this.logger=Zl(t,this.context)}}var tw=Object.defineProperty,nw=Object.getOwnPropertySymbols,rw=Object.prototype.hasOwnProperty,iw=Object.prototype.propertyIsEnumerable,ow=(e,t,n)=>t in e?tw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sw=(e,t)=>{for(var n in t||(t={}))rw.call(t,n)&&ow(e,n,t[n]);if(nw)for(var n of nw(t))iw.call(t,n)&&ow(e,n,t[n]);return e};class aw extends class{constructor(e,t,n){this.core=e,this.logger=t,this.telemetryEnabled=n}}{constructor(e,t,n=!0){super(e,t,n),this.core=e,this.logger=t,this.context="event-client",this.storagePrefix=ym,this.storageVersion=.1,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!sp())try{const e={eventId:op(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Hh(this.core.relayer.protocol,this.core.relayer.version,Lm)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}},this.createEvent=e=>{const{event:t="ERROR",type:n="",properties:{topic:r,trace:i}}=e,o=op(),s=this.core.projectId||"",a=Date.now(),c=sw({eventId:o,timestamp:a,props:{event:t,type:n,properties:{topic:r,trace:i}},bundleId:s,domain:this.getAppDomain()},this.setMethods(o));return this.telemetryEnabled&&(this.events.set(o,c),this.shouldPersist=!0),c},this.getEvent=e=>{const{eventId:t,topic:n}=e;if(t)return this.events.get(t);const r=Array.from(this.events.values()).find((e=>e.props.properties.topic===n));return r?sw(sw({},r),this.setMethods(r.eventId)):void 0},this.deleteEvent=e=>{const{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Gu,(async()=>{this.shouldPersist&&await this.persist(),this.events.forEach((e=>{(0,qu.fromMiliseconds)(Date.now())-(0,qu.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)}))}))},this.setMethods=e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)}),this.addTrace=(e,t)=>{const n=this.events.get(e);n&&(n.props.properties.trace.push(t),this.events.set(e,n),this.shouldPersist=!0)},this.setError=(e,t)=>{const n=this.events.get(e);n&&(n.props.type=t,n.timestamp=Date.now(),this.events.set(e,n),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach((e=>{this.events.set(e.eventId,sw(sw({},e),this.setMethods(e.eventId)))}))}catch(e){this.logger.warn(e)}},this.submit=async()=>{if(!this.telemetryEnabled||0===this.events.size)return;const e=[];for(const[n,r]of this.events)r.props.type&&e.push(r);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(const t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(t){this.logger.warn(t)}},this.sendEvent=async e=>{const t=this.getAppDomain()?"":"&sp=desktop";return await fetch(`https://pulse.walletconnect.org/batch?projectId=${this.core.projectId}&st=events_sdk&sv=js-2.17.1${t}`,{method:"POST",body:JSON.stringify(e)})},this.getAppDomain=()=>zh().url,this.logger=Zl(t,this.context),this.telemetryEnabled=n,n?this.restore().then((async()=>{await this.submit(),this.setEventListeners()})):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var cw=Object.defineProperty,uw=Object.getOwnPropertySymbols,lw=Object.prototype.hasOwnProperty,dw=Object.prototype.propertyIsEnumerable,fw=(e,t,n)=>t in e?cw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hw=(e,t)=>{for(var n in t||(t={}))lw.call(t,n)&&fw(e,n,t[n]);if(uw)for(var n of uw(t))dw.call(t,n)&&fw(e,n,t[n]);return e};class pw extends Xl{constructor(e){var t;super(e),this.protocol="wc",this.version=2,this.name=bm,this.events=new Nt.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.dispatchEnvelope=({topic:e,message:t,sessionExists:n})=>{if(!e||!t)return;const r={topic:e,message:t,publishedAt:Date.now(),transportType:Dm.link_mode};this.relayer.onLinkMessageEvent(r,{sessionExists:n})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Em,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=Wl({level:"string"==typeof e?.logger&&e.logger?e.logger:vm}),{logger:r,chunkLoggerController:i}=Kl({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=i,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Zl(r,this.name),this.heartbeat=new Zu,this.crypto=new Sv(this,this.logger,e?.keychain),this.history=new Jv(this,this.logger),this.expirer=new Qv(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new Cl(hw(hw({},wm),e?.storageOptions)),this.relayer=new qv({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Yv(this,this.logger),this.verify=new $v(this,this.logger,this.storage),this.echoClient=new ew(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new aw(this,this.logger,e?.telemetryEnabled)}static async init(e){const t=new pw(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",n),t}get context(){return Gl(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Um,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Um)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const gw=pw,mw="client",bw="wc@2:client:",yw=mw,vw="error",ww="WALLETCONNECT_DEEPLINK_CHOICE",xw="Proposal expired",Sw=qu.SEVEN_DAYS,Aw={wc_sessionPropose:{req:{ttl:qu.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1104},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1106},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:qu.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:qu.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1112},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:qu.ONE_DAY,prompt:!1,tag:1114},res:{ttl:qu.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:qu.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:qu.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:qu.FIVE_MINUTES,prompt:!1,tag:1119}}},Ew={min:qu.FIVE_MINUTES,max:qu.SEVEN_DAYS},_w="IDLE",Cw="ACTIVE",Iw=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],kw="wc@1.5:auth:",Tw="wc@1.5:auth::PUB_KEY";var Mw=Object.defineProperty,Pw=Object.defineProperties,Ow=Object.getOwnPropertyDescriptors,Rw=Object.getOwnPropertySymbols,Nw=Object.prototype.hasOwnProperty,Bw=Object.prototype.propertyIsEnumerable,Lw=(e,t,n)=>t in e?Mw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dw=(e,t)=>{for(var n in t||(t={}))Nw.call(t,n)&&Lw(e,n,t[n]);if(Rw)for(var n of Rw(t))Bw.call(t,n)&&Lw(e,n,t[n]);return e},Uw=(e,t)=>Pw(e,Ow(t));class jw extends class{constructor(e){this.client=e}}{constructor(e){super(e),this.name="engine",this.events=new(Bt()),this.initialized=!1,this.requestQueue={state:_w,queue:[]},this.sessionRequestQueue={state:_w,queue:[]},this.requestQueueDelay=qu.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Aw)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),(0,qu.toMiliseconds)(this.requestQueueDelay)))},this.connect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const t=Uw(Dw({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:n,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:o,relays:s}=t;let a,c=n,u=!1;try{c&&(u=this.client.core.pairing.pairings.get(c).active)}catch(y){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),y}if(!c||!u){const{topic:e,uri:t}=await this.client.core.pairing.create();c=e,a=t}if(!c){const{message:e}=bg("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(e)}const l=await this.client.core.crypto.generateKeyPair(),d=Aw.wc_sessionPropose.req.ttl||qu.FIVE_MINUTES,f=$h(d),h=Dw({requiredNamespaces:r,optionalNamespaces:i,relays:s??[{protocol:"irn"}],proposer:{publicKey:l,metadata:this.client.metadata},expiryTimestamp:f,pairingTopic:c},o&&{sessionProperties:o}),{reject:p,resolve:g,done:m}=Xh(d,xw);this.events.once(tp("session_connect"),(async({error:e,session:t})=>{if(e)p(e);else if(t){t.self.publicKey=l;const e=Uw(Dw({},t),{pairingTopic:h.pairingTopic,requiredNamespaces:h.requiredNamespaces,optionalNamespaces:h.optionalNamespaces,transportType:Dm.relay});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:t.peer.metadata}),this.cleanupDuplicatePairings(e),g(e)}}));const b=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:h,throwOnFailedPublish:!0});return await this.setProposal(b,Dw({id:b},h)),{uri:a,approval:m}},this.pair=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(aM){throw this.client.logger.error("pair() failed"),aM}},this.approve=async e=>{var t,n,r;const i=this.client.core.eventClient.createEvent({properties:{topic:null==(t=e?.id)?void 0:t.toString(),trace:[Ab]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(S){throw i.setError(Ob),S}try{await this.isValidProposalId(e?.id)}catch(S){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),i.setError(Ub),S}try{await this.isValidApprove(e)}catch(S){throw this.client.logger.error("approve() -> isValidApprove() failed"),i.setError(Db),S}const{id:o,relayProtocol:s,namespaces:a,sessionProperties:c,sessionConfig:u}=e,l=this.client.proposal.get(o);this.client.core.eventClient.deleteEvent({eventId:i.eventId});const{pairingTopic:d,proposer:f,requiredNamespaces:h,optionalNamespaces:p}=l;let g=null==(n=this.client.core.eventClient)?void 0:n.getEvent({topic:d});g||(g=null==(r=this.client.core.eventClient)?void 0:r.createEvent({type:Ab,properties:{topic:d,trace:[Ab,Eb]}}));const m=await this.client.core.crypto.generateKeyPair(),b=f.publicKey,y=await this.client.core.crypto.generateSharedKey(m,b),v=Dw(Dw({relay:{protocol:s??"irn"},namespaces:a,controller:{publicKey:m,metadata:this.client.metadata},expiry:$h(Sw)},c&&{sessionProperties:c}),u&&{sessionConfig:u}),w=Dm.relay;g.addTrace(_b);try{await this.client.core.relayer.subscribe(y,{transportType:w})}catch(S){throw g.setError(Nb),S}g.addTrace(Cb);const x=Uw(Dw({},v),{topic:y,requiredNamespaces:h,optionalNamespaces:p,pairingTopic:d,acknowledged:!1,self:v.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:m,transportType:Dm.relay});await this.client.session.set(y,x),g.addTrace(Tb);try{g.addTrace(Mb),await this.sendRequest({topic:y,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch((e=>{throw g?.setError(Lb),e})),g.addTrace(Pb),g.addTrace(Ib),await this.sendResult({id:o,topic:d,result:{relay:{protocol:s??"irn"},responderPublicKey:m},throwOnFailedPublish:!0}).catch((e=>{throw g?.setError(Bb),e})),g.addTrace(kb)}catch(S){throw this.client.logger.error(S),this.client.session.delete(y,yg("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(y),S}return this.client.core.eventClient.deleteEvent({eventId:g.eventId}),await this.client.core.pairing.updateMetadata({topic:d,metadata:f.metadata}),await this.client.proposal.delete(o,yg("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:d}),await this.setExpiry(y,$h(Sw)),{topic:y,acknowledged:()=>Promise.resolve(this.client.session.get(y))}},this.reject=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(i){throw this.client.logger.error("reject() -> isValidReject() failed"),i}const{id:t,reason:n}=e;let r;try{r=this.client.proposal.get(t).pairingTopic}catch(i){throw this.client.logger.error(`reject() -> proposal.get(${t}) failed`),i}r&&(await this.sendError({id:t,topic:r,error:n,rpcOpts:Aw.wc_sessionPropose.reject}),await this.client.proposal.delete(t,yg("USER_DISCONNECTED")))},this.update=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(jl){throw this.client.logger.error("update() -> isValidUpdate() failed"),jl}const{topic:t,namespaces:n}=e,{done:r,resolve:i,reject:o}=Xh(),s=Yg(),a=Jg().toString(),c=this.client.session.get(t).namespaces;return this.events.once(tp("session_update",s),(({error:e})=>{e?o(e):i()})),await this.client.session.update(t,{namespaces:n}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:a}).catch((e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),o(e)})),{acknowledged:r}},this.extend=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(s){throw this.client.logger.error("extend() -> isValidExtend() failed"),s}const{topic:t}=e,n=Yg(),{done:r,resolve:i,reject:o}=Xh();return this.events.once(tp("session_extend",n),(({error:e})=>{e?o(e):i()})),await this.setExpiry(t,$h(Sw)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch((e=>{o(e)})),{acknowledged:r}},this.request=async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(f){throw this.client.logger.error("request() -> isValidRequest() failed"),f}const{chainId:t,request:n,topic:r,expiry:i=Aw.wc_sessionRequest.req.ttl}=e,o=this.client.session.get(r);o?.transportType===Dm.relay&&await this.confirmOnlineStateOrThrow();const s=Yg(),a=Jg().toString(),{done:c,resolve:u,reject:l}=Xh(i,"Request expired. Please try again.");this.events.once(tp("session_request",s),(({error:e,result:t})=>{e?l(e):u(t)}));const d=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);return d?(await this.sendRequest({clientRpcId:s,relayRpcId:a,topic:r,method:"wc_sessionRequest",params:{request:Uw(Dw({},n),{expiryTimestamp:$h(i)}),chainId:t},expiry:i,throwOnFailedPublish:!0,appLink:d}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:r,request:n,chainId:t,id:s}),await c()):await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:s,relayRpcId:a,topic:r,method:"wc_sessionRequest",params:{request:Uw(Dw({},n),{expiryTimestamp:$h(i)}),chainId:t},expiry:i,throwOnFailedPublish:!0}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:r,request:n,chainId:t,id:s}),e()})),new Promise((async e=>{var t;if(null==(t=o.sessionConfig)||!t.disableDeepLink){const e=await async function(e,t){let n="";try{if(Vh()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(i){console.error(i)}return n}(this.client.core.storage,ww);await rp({id:s,topic:r,wcDeepLink:e})}e()})),c()]).then((e=>e[2]))},this.respond=async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:n}=e,{id:r}=n,i=this.client.session.get(t);i.transportType===Dm.relay&&await this.confirmOnlineStateOrThrow();const o=this.getAppLinkIfEnabled(i.peer.metadata,i.transportType);um(n)?await this.sendResult({id:r,topic:t,result:n.result,throwOnFailedPublish:!0,appLink:o}):lm(n)&&await this.sendError({id:r,topic:t,error:n.error,appLink:o}),this.cleanupAfterResponse(e)},this.ping=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(Wu){throw this.client.logger.error("ping() -> isValidPing() failed"),Wu}const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=Yg(),n=Jg().toString(),{done:r,resolve:i,reject:o}=Xh();this.events.once(tp("session_ping",e),(({error:e})=>{e?o(e):i()})),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:n}),r()])}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:t,event:n,chainId:r}=e,i=Jg().toString();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:n,chainId:r},throwOnFailedPublish:!0,relayRpcId:i})},this.disconnect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:yg("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else{if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=bg("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw new Error(e)}await this.client.core.pairing.disconnect({topic:t})}},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>function(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),i=Object.keys(n);let o=!0;return!!Gh(i,r)&&(r.forEach((t=>{const{accounts:r,methods:i,events:s}=e.namespaces[t],a=hg(r),c=n[t];(!Gh(Ih(t,c),a)||!Gh(c.methods,i)||!Gh(c.events,s))&&(o=!1)})),o)}(t,e)))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(e,t)=>{var n;this.isInitialized(),this.isValidAuthenticate(e);const r=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(n=this.client.metadata.redirect)?void 0:n.linkMode),i=r?Dm.link_mode:Dm.relay;i===Dm.relay&&await this.confirmOnlineStateOrThrow();const{chains:o,statement:s="",uri:a,domain:c,nonce:u,type:l,exp:d,nbf:f,methods:h=[],expiry:p}=e,g=[...e.resources||[]],{topic:m,uri:b}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:i});this.client.logger.info({message:"Generated new pairing",pairing:{topic:m,uri:b}});const y=await this.client.core.crypto.generateKeyPair(),v=qp(y);if(await Promise.all([this.client.auth.authKeys.set(Tw,{responseTopic:v,publicKey:y}),this.client.auth.pairingTopics.set(v,{topic:v,pairingTopic:m})]),await this.client.core.relayer.subscribe(v,{transportType:i}),this.client.logger.info(`sending request to new pairing topic: ${m}`),h.length>0){const{namespace:e}=Ch(o[0]);let t=Tp(e,"request",h);Bp(g)&&(t=Pp(t,g.pop())),g.push(t)}const w=p&&p>Aw.wc_sessionAuthenticate.req.ttl?p:Aw.wc_sessionAuthenticate.req.ttl,x={authPayload:{type:l??"caip122",chains:o,statement:s,aud:a,domain:c,version:"1",nonce:u,iat:(new Date).toISOString(),exp:d,nbf:f,resources:g},requester:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:$h(w)},S={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:o,methods:[...new Set(["personal_sign",...h])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:m,proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:$h(Aw.wc_sessionPropose.req.ttl)},{done:A,resolve:E,reject:_}=Xh(w,"Request expired"),C=async({error:e,session:t})=>{if(this.events.off(tp("session_request",k),I),e)_(e);else if(t){t.self.publicKey=y,await this.client.session.set(t.topic,t),await this.setExpiry(t.topic,t.expiry),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:t.peer.metadata});const e=this.client.session.get(t.topic);await this.deleteProposal(T),E({session:e})}},I=async e=>{var n,r,o;if(await this.deletePendingAuthRequest(k,{message:"fulfilled",code:0}),e.error){const t=yg("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(tp("session_connect"),C),_(e.error.message))}await this.deleteProposal(T),this.events.off(tp("session_connect"),C);const{cacaos:s,responder:a}=e.result,c=[],u=[];for(const t of s){await Ap({cacao:t,projectId:this.client.core.projectId})||(this.client.logger.error(t,"Signature verification failed"),_(yg("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:e}=t,n=Bp(e.resources),r=[xp(e.iss)],i=Sp(e.iss);if(n){const e=Rp(n),t=Np(n);c.push(...e),r.push(...t)}for(const t of r)u.push(`${t}:${i}`)}const l=await this.client.core.crypto.generateSharedKey(y,a.publicKey);let d;c.length>0&&(d={topic:l,acknowledged:!0,self:{publicKey:y,metadata:this.client.metadata},peer:a,controller:a.publicKey,expiry:$h(Sw),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:m,namespaces:pg([...new Set(c)],[...new Set(u)]),transportType:i},await this.client.core.relayer.subscribe(l,{transportType:i}),await this.client.session.set(l,d),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:a.metadata}),d=this.client.session.get(l)),null!=(n=this.client.metadata.redirect)&&n.linkMode&&null!=(r=a.metadata.redirect)&&r.linkMode&&null!=(o=a.metadata.redirect)&&o.universal&&t&&(this.client.core.addLinkModeSupportedApp(a.metadata.redirect.universal),this.client.session.update(l,{transportType:Dm.link_mode})),E({auths:s,session:d})},k=Yg(),T=Yg();let M;this.events.once(tp("session_connect"),C),this.events.once(tp("session_request",k),I);try{if(r){const e=Qg("wc_sessionAuthenticate",x,k);this.client.core.history.set(m,e);const n=await this.client.core.crypto.encode("",e,{type:2,encoding:jp});M=fg(t,m,n)}else await Promise.all([this.sendRequest({topic:m,method:"wc_sessionAuthenticate",params:x,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:k}),this.sendRequest({topic:m,method:"wc_sessionPropose",params:S,expiry:Aw.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:T})])}catch(P){throw this.events.off(tp("session_connect"),C),this.events.off(tp("session_request",k),I),P}return await this.setProposal(T,Dw({id:T},S)),await this.setAuthRequest(k,{request:Uw(Dw({},x),{verifyContext:{}}),pairingTopic:m,transportType:i}),{uri:M??b,response:A}},this.approveSessionAuthenticate=async e=>{const{id:t,auths:n}=e,r=this.client.core.eventClient.createEvent({properties:{topic:t.toString(),trace:[jb]}});try{this.isInitialized()}catch(p){throw r.setError(Gb),p}const i=this.getPendingAuthRequest(t);if(!i)throw r.setError(Yb),new Error(`Could not find pending auth request with id ${t}`);const o=i.transportType||Dm.relay;o===Dm.relay&&await this.confirmOnlineStateOrThrow();const s=i.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=qp(s),u={type:1,receiverPublicKey:s,senderPublicKey:a},l=[],d=[];for(const g of n){if(!(await Ap({cacao:g,projectId:this.client.core.projectId}))){r.setError(Zb);const e=yg("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:t,topic:c,error:e,encodeOpts:u}),new Error(e.message)}r.addTrace(Vb);const{p:e}=g,n=Bp(e.resources),i=[xp(e.iss)],o=Sp(e.iss);if(n){const e=Rp(n),t=Np(n);l.push(...e),i.push(...t)}for(const t of i)d.push(`${t}:${o}`)}const f=await this.client.core.crypto.generateSharedKey(a,s);let h;if(r.addTrace(Fb),l?.length>0){h={topic:f,acknowledged:!0,self:{publicKey:a,metadata:this.client.metadata},peer:{publicKey:s,metadata:i.requester.metadata},controller:s,expiry:$h(Sw),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:i.pairingTopic,namespaces:pg([...new Set(l)],[...new Set(d)]),transportType:o},r.addTrace(zb);try{await this.client.core.relayer.subscribe(f,{transportType:o})}catch(p){throw r.setError(Kb),p}r.addTrace(Hb),await this.client.session.set(f,h),r.addTrace(qb),await this.client.core.pairing.updateMetadata({topic:i.pairingTopic,metadata:i.requester.metadata})}r.addTrace(Wb);try{await this.sendResult({topic:c,id:t,result:{cacaos:n,responder:{publicKey:a,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(i.requester.metadata,o)})}catch(p){throw r.setError(Xb),p}return await this.client.auth.requests.delete(t,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:i.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:r.eventId}),{session:h}},this.rejectSessionAuthenticate=async e=>{this.isInitialized();const{id:t,reason:n}=e,r=this.getPendingAuthRequest(t);if(!r)throw new Error(`Could not find pending auth request with id ${t}`);r.transportType===Dm.relay&&await this.confirmOnlineStateOrThrow();const i=r.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),s=qp(i),a={type:1,receiverPublicKey:i,senderPublicKey:o};await this.sendError({id:t,topic:s,error:n,encodeOpts:a,rpcOpts:Aw.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(r.requester.metadata,r.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,yg("USER_DISCONNECTED"))},this.formatAuthMessage=e=>{this.isInitialized();const{request:t,iss:n}=e;return Ep(t,n)},this.processRelayMessageCache=()=>{setTimeout((async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}}),50)},this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter((n=>{var r,i;return(null==(r=n.peerMetadata)?void 0:r.url)&&(null==(i=n.peerMetadata)?void 0:i.url)===e.peer.metadata.url&&n.topic&&n.topic!==t.topic}));if(0===n.length)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(aM){this.client.logger.error(aM)}},this.deleteSession=async e=>{var t;const{topic:n,expirerHasDeleted:r=!1,emitEvent:i=!0,id:o=0}=e,{self:s}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,yg("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(s.publicKey)&&await this.client.core.crypto.deleteKeyPair(s.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),r||this.client.core.expirer.del(n),this.client.core.storage.removeItem(ww).catch((e=>this.client.logger.warn(e))),this.getPendingSessionRequests().forEach((e=>{e.topic===n&&this.deletePendingSessionRequest(e.id,yg("USER_DISCONNECTED"))})),n===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=_w),i&&this.client.events.emit("session_delete",{id:o,topic:n})},this.deleteProposal=async(e,t)=>{if(t)try{const t=this.client.proposal.get(e);this.client.core.eventClient.getEvent({topic:t.pairingTopic})?.setError(Rb)}catch{}await Promise.all([this.client.proposal.delete(e,yg("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")},this.deletePendingSessionRequest=async(e,t,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),n&&(this.sessionRequestQueue.state=_w,this.client.events.emit("session_request_expire",{id:e}))},this.deletePendingAuthRequest=async(e,t,n=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),n?Promise.resolve():this.client.core.expirer.del(e)])},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))},this.setProposal=async(e,t)=>{this.client.core.expirer.set(e,$h(Aw.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)},this.setAuthRequest=async(e,t)=>{const{request:n,pairingTopic:r,transportType:i=Dm.relay}=t;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:r,verifyContext:n.verifyContext,transportType:i})},this.setPendingSessionRequest=async e=>{const{id:t,topic:n,params:r,verifyContext:i}=e,o=r.request.expiryTimestamp||$h(Aw.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,o),await this.client.pendingRequest.set(t,{id:t,topic:n,params:r,verifyContext:i})},this.sendRequest=async e=>{const{topic:t,method:r,params:i,expiry:o,relayRpcId:s,clientRpcId:a,throwOnFailedPublish:c,appLink:u}=e,l=Qg(r,i,a);let d;const f=!!u;try{const e=f?jp:Up;d=await this.client.core.crypto.encode(t,l,{encoding:e})}catch(g){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t} failed`),g}let h;if(Iw.includes(r)){const e=zp(JSON.stringify(l)),t=zp(d);h=await this.client.core.verify.register({id:t,decryptedId:e})}const p=Aw[r].req;if(p.attestation=h,o&&(p.ttl=o),s&&(p.id=s),this.client.core.history.set(t,l),f){const e=fg(u,t,d);await n.g.Linking.openURL(e,this.client.name)}else{const e=Aw[r].req;o&&(e.ttl=o),s&&(e.id=s),c?(e.internal=Uw(Dw({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,d,e)):this.client.core.relayer.publish(t,d,e).catch((e=>this.client.logger.error(e)))}return l.id},this.sendResult=async e=>{const{id:t,topic:r,result:i,throwOnFailedPublish:o,encodeOpts:s,appLink:a}=e,c=$g(t,i);let u;const l=a&&typeof(null==n.g?void 0:n.g.Linking)<"u";try{const e=l?jp:Up;u=await this.client.core.crypto.encode(r,c,Uw(Dw({},s||{}),{encoding:e}))}catch(xl){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),xl}let d;try{d=await this.client.core.history.get(r,t)}catch(xl){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${t}) failed`),xl}if(l){const e=fg(a,r,u);await n.g.Linking.openURL(e,this.client.name)}else{const e=Aw[d.request.method].res;o?(e.internal=Uw(Dw({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,u,e)):this.client.core.relayer.publish(r,u,e).catch((e=>this.client.logger.error(e)))}await this.client.core.history.resolve(c)},this.sendError=async e=>{const{id:t,topic:r,error:i,encodeOpts:o,rpcOpts:s,appLink:a}=e,c=em(t,i);let u;const l=a&&typeof(null==n.g?void 0:n.g.Linking)<"u";try{const e=l?jp:Up;u=await this.client.core.crypto.encode(r,c,Uw(Dw({},o||{}),{encoding:e}))}catch(xl){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),xl}let d;try{d=await this.client.core.history.get(r,t)}catch(xl){throw this.client.logger.error(`sendError() -> history.get(${r}, ${t}) failed`),xl}if(l){const e=fg(a,r,u);await n.g.Linking.openURL(e,this.client.name)}else{const e=s||Aw[d.request.method].res;this.client.core.relayer.publish(r,u,e)}await this.client.core.history.resolve(c)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{let n=!1;ep(t.expiry)&&(n=!0),this.client.core.crypto.keychain.has(t.topic)||(n=!0),n&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{ep(e.expiryTimestamp)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession({topic:e}))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==Cw){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Cw;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(aM){this.client.logger.warn(aM)}}this.requestQueue.state=_w}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=async e=>{const{topic:t,payload:n,attestation:r,transportType:i,encryptedId:o}=e,s=n.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:s}))switch(s){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:t,payload:n,attestation:r,encryptedId:o});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,n);case"wc_sessionPing":return await this.onSessionPingRequest(t,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:n,attestation:r,encryptedId:o,transportType:i});case"wc_sessionEvent":return await this.onSessionEventRequest(t,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:n,attestation:r,encryptedId:o,transportType:i});default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:n,transportType:r}=e,i=(await this.client.core.history.get(t,n.id)).request.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeResponse(t,n,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,n);case"wc_sessionExtend":return this.onSessionExtendResponse(t,n);case"wc_sessionPing":return this.onSessionPingResponse(t,n);case"wc_sessionRequest":return this.onSessionRequestResponse(t,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,n);default:return this.client.logger.info(`Unsupported response method ${i}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:n}=bg("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=e=>{const{topic:t,requestMethod:n}=e,r=this.expectedPairingMethodMap.get(t);return!(!r||r.includes(n))&&!!(r.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async e=>{const{topic:t,payload:n,attestation:r,encryptedId:i}=e,{params:o,id:s}=n;try{const e=this.client.core.eventClient.getEvent({topic:t});this.isValidConnect(Dw({},n.params));const a=o.expiryTimestamp||$h(Aw.wc_sessionPropose.req.ttl),c=Dw({id:s,pairingTopic:t,expiryTimestamp:a},o);await this.setProposal(s,c);const u=await this.getVerifyContext({attestationId:r,hash:zp(JSON.stringify(n)),encryptedId:i,metadata:c.proposer.metadata});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),e?.setError(Sb)),e?.addTrace(mb),this.client.events.emit("session_proposal",{id:s,params:c,verifyContext:u})}catch(a){await this.sendError({id:s,topic:t,error:a,rpcOpts:Aw.wc_sessionPropose.autoReject}),this.client.logger.error(a)}},this.onSessionProposeResponse=async(e,t,n)=>{const{id:r}=t;if(um(t)){const{result:i}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:i});const o=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const s=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:s});const a=i.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});const c=await this.client.core.crypto.generateSharedKey(s,a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});const u=await this.client.core.relayer.subscribe(c,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:e})}else if(lm(t)){await this.client.proposal.delete(r,yg("USER_DISCONNECTED"));const e=tp("session_connect");if(0===this.events.listenerCount(e))throw new Error(`emitting ${e} without any listeners, 954`);this.events.emit(tp("session_connect"),{error:t.error})}},this.onSessionSettleRequest=async(e,t)=>{const{id:n,params:r}=t;try{this.isValidSessionSettleRequest(r);const{relay:n,controller:i,expiry:o,namespaces:s,sessionProperties:a,sessionConfig:c}=t.params,u=Uw(Dw(Dw({topic:e,relay:n,expiry:o,namespaces:s,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:i.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:i.publicKey,metadata:i.metadata}},a&&{sessionProperties:a}),c&&{sessionConfig:c}),{transportType:Dm.relay}),l=tp("session_connect");if(0===this.events.listenerCount(l))throw new Error(`emitting ${l} without any listeners 997`);this.events.emit(tp("session_connect"),{session:u}),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.onSessionSettleResponse=async(e,t)=>{const{id:n}=t;um(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(tp("session_approve",n),{})):lm(t)&&(await this.client.session.delete(e,yg("USER_DISCONNECTED")),this.events.emit(tp("session_approve",n),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:n,id:r}=t;try{const t=`${e}_session_update`,o=Fg.get(t);if(o&&this.isRequestOutOfSync(o,r))return this.client.logger.info(`Discarding out of sync request - ${r}`),void this.sendError({id:r,topic:e,error:yg("INVALID_UPDATE_REQUEST")});this.isValidUpdate(Dw({topic:e},n));try{Fg.set(t,r),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0})}catch(i){throw Fg.delete(t),i}this.client.events.emit("session_update",{id:r,topic:e,params:n})}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:n}=t,r=tp("session_update",n);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);um(t)?this.events.emit(tp("session_update",n),{}):lm(t)&&this.events.emit(tp("session_update",n),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:n}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,$h(Sw)),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(r){await this.sendError({id:n,topic:e,error:r}),this.client.logger.error(r)}},this.onSessionExtendResponse=(e,t)=>{const{id:n}=t,r=tp("session_extend",n);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);um(t)?this.events.emit(tp("session_extend",n),{}):lm(t)&&this.events.emit(tp("session_extend",n),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(r){await this.sendError({id:n,topic:e,error:r}),this.client.logger.error(r)}},this.onSessionPingResponse=(e,t)=>{const{id:n}=t,r=tp("session_ping",n);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);setTimeout((()=>{um(t)?this.events.emit(tp("session_ping",n),{}):lm(t)&&this.events.emit(tp("session_ping",n),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise((t=>{this.client.core.relayer.once(Pm,(async()=>{t(await this.deleteSession({topic:e,id:n}))}))})),this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:yg("USER_DISCONNECTED")})]).catch((e=>this.client.logger.error(e)))}catch(r){this.client.logger.error(r)}},this.onSessionRequest=async e=>{var t,n,r;const{topic:i,payload:o,attestation:s,encryptedId:a,transportType:c}=e,{id:u,params:l}=o;try{await this.isValidRequest(Dw({topic:i},l));const e=this.client.session.get(i),o={id:u,topic:i,params:l,verifyContext:await this.getVerifyContext({attestationId:s,hash:zp(JSON.stringify(Qg("wc_sessionRequest",l,u))),encryptedId:a,metadata:e.peer.metadata,transportType:c})};await this.setPendingSessionRequest(o),c===Dm.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(n=e.peer.metadata.redirect)?void 0:n.universal),null!=(r=this.client.signConfig)&&r.disableRequestQueue?this.emitSessionRequest(o):(this.addSessionRequestToSessionRequestQueue(o),this.processSessionRequestQueue())}catch(xl){await this.sendError({id:u,topic:i,error:xl}),this.client.logger.error(xl)}},this.onSessionRequestResponse=(e,t)=>{const{id:n}=t,r=tp("session_request",n);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);um(t)?this.events.emit(tp("session_request",n),{result:t.result}):lm(t)&&this.events.emit(tp("session_request",n),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:n,params:r}=t;try{const t=`${e}_session_event_${r.event.name}`,i=Fg.get(t);if(i&&this.isRequestOutOfSync(i,n))return void this.client.logger.info(`Discarding out of sync request - ${n}`);this.isValidEmit(Dw({topic:e},r)),this.client.events.emit("session_event",{id:n,topic:e,params:r}),Fg.set(t,n)}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.onSessionAuthenticateResponse=(e,t)=>{const{id:n}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),um(t)?this.events.emit(tp("session_request",n),{result:t.result}):lm(t)&&this.events.emit(tp("session_request",n),{error:t.error})},this.onSessionAuthenticateRequest=async e=>{var t;const{topic:n,payload:r,attestation:i,encryptedId:o,transportType:s}=e;try{const{requester:e,authPayload:a,expiryTimestamp:c}=r.params,u=await this.getVerifyContext({attestationId:i,hash:zp(JSON.stringify(r)),encryptedId:o,metadata:e.metadata,transportType:s}),l={requester:e,pairingTopic:n,id:r.id,authPayload:a,verifyContext:u,expiryTimestamp:c};await this.setAuthRequest(r.id,{request:l,pairingTopic:n,transportType:s}),s===Dm.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:r.params,id:r.id,verifyContext:u})}catch(a){this.client.logger.error(a);const e=r.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),i=this.getAppLinkIfEnabled(r.params.requester.metadata,s),o={type:1,receiverPublicKey:e,senderPublicKey:t};await this.sendError({id:r.id,topic:n,error:a,encodeOpts:o,rpcOpts:Aw.wc_sessionAuthenticate.autoReject,appLink:i})}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=_w,this.processSessionRequestQueue()}),(0,qu.toMiliseconds)(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:e,error:t})=>{const n=this.client.core.history.pending;n.length>0&&n.filter((t=>t.topic===e&&"wc_sessionRequest"===t.request.method)).forEach((e=>{const n=tp("session_request",e.request.id);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);this.events.emit(tp("session_request",e.request.id),{error:t})}))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Cw)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=Cw,this.emitSessionRequest(e)}catch(aM){this.client.logger.error(aM)}else this.client.logger.info("session request queue is empty.")},this.emitSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onPairingCreated=e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest({topic:e.topic,payload:Qg("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id)})},this.isValidConnect=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:n,optionalNamespaces:r,sessionProperties:i,relays:o}=e;if(xg(t)||await this.isValidPairingTopic(t),!function(e,t){let n=!1;return t&&!e?n=!0:e&&vg(e)&&e.length&&e.forEach((e=>{n=Mg(e)})),n}(o,!0)){const{message:e}=bg("MISSING_OR_INVALID",`connect() relays: ${o}`);throw new Error(e)}!xg(n)&&0!==wg(n)&&this.validateNamespaces(n,"requiredNamespaces"),!xg(r)&&0!==wg(r)&&this.validateNamespaces(r,"optionalNamespaces"),xg(i)||this.validateSessionProps(i,"sessionProperties")},this.validateNamespaces=(e,t)=>{const n=function(e,t,n){let r=null;if(e&&wg(e)){const i=kg(e,t);i&&(r=i);const o=Cg(e,t,n);o&&(r=o)}else r=bg("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}(e,"connect()",t);if(n)throw new Error(n.message)},this.isValidApprove=async e=>{if(!Pg(e))throw new Error(bg("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:n,relayProtocol:r,sessionProperties:i}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);const o=this.client.proposal.get(t),s=Tg(n,"approve()");if(s)throw new Error(s.message);const a=Bg(o.requiredNamespaces,n,"approve()");if(a)throw new Error(a.message);if(!Sg(r,!0)){const{message:e}=bg("MISSING_OR_INVALID",`approve() relayProtocol: ${r}`);throw new Error(e)}xg(i)||this.validateSessionProps(i,"sessionProperties")},this.isValidReject=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:n}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!function(e){return!(!e||"object"!=typeof e||!e.code||!Ag(e.code,!1)||!e.message||!Sg(e.message,!1))}(n)){const{message:e}=bg("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:n,namespaces:r,expiry:i}=e;if(!Mg(t)){const{message:e}=bg("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const o=function(e,t){let n=null;return Sg(e?.publicKey,!1)||(n=bg("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}(n,"onSessionSettleRequest()");if(o)throw new Error(o.message);const s=Tg(r,"onSessionSettleRequest()");if(s)throw new Error(s.message);if(ep(i)){const{message:e}=bg("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:n}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const r=this.client.session.get(t),i=Tg(n,"update()");if(i)throw new Error(i.message);const o=Bg(r.requiredNamespaces,n,"update()");if(o)throw new Error(o.message)},this.isValidExtend=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:n,chainId:r,expiry:i}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!Og(o,r)){const{message:e}=bg("MISSING_OR_INVALID",`request() chainId: ${r}`);throw new Error(e)}if(!function(e){return!(xg(e)||!Sg(e.method,!1))}(n)){const{message:e}=bg("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(e)}if(!Rg(o,r,n.method)){const{message:e}=bg("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(e)}if(i&&!function(e,t){return Ag(e,!1)&&e<=t.max&&e>=t.min}(i,Ew)){const{message:e}=bg("MISSING_OR_INVALID",`request() expiry: ${i}. Expiry must be a number (in seconds) between ${Ew.min} and ${Ew.max}`);throw new Error(e)}},this.isValidRespond=async e=>{var t;if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:n,response:r}=e;try{await this.isValidSessionTopic(n)}catch(i){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),i}if(!function(e){return!(xg(e)||xg(e.result)&&xg(e.error)||!Ag(e.id,!1)||!Sg(e.jsonrpc,!1))}(r)){const{message:e}=bg("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:n,chainId:r}=e;await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!Og(i,r)){const{message:e}=bg("MISSING_OR_INVALID",`emit() chainId: ${r}`);throw new Error(e)}if(!function(e){return!(xg(e)||!Sg(e.name,!1))}(n)){const{message:e}=bg("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(e)}if(!Ng(i,r,n.name)){const{message:e}=bg("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!Pg(e)){const{message:t}=bg("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidAuthenticate=e=>{const{chains:t,uri:n,domain:r,nonce:i}=e;if(!Array.isArray(t)||0===t.length)throw new Error("chains is required and must be a non-empty array");if(!Sg(n,!1))throw new Error("uri is required parameter");if(!Sg(r,!1))throw new Error("domain is required parameter");if(!Sg(i,!1))throw new Error("nonce is required parameter");if([...new Set(t.map((e=>Ch(e).namespace)))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:o}=Ch(t[0]);if("eip155"!==o)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async e=>{const{attestationId:t,hash:n,encryptedId:r,metadata:i,transportType:o}=e,s={verified:{verifyUrl:i.verifyUrl||ib,validation:"UNKNOWN",origin:i.url||""}};try{if(o===Dm.link_mode){const e=this.getAppLinkIfEnabled(i,o);return s.verified.validation=e&&new URL(e).origin===new URL(i.url).origin?"VALID":"INVALID",s}const e=await this.client.core.verify.resolve({attestationId:t,hash:n,encryptedId:r,verifyUrl:i.verifyUrl});e&&(s.verified.origin=e.origin,s.verified.isScam=e.isScam,s.verified.validation=e.origin===new URL(i.url).origin?"VALID":"INVALID")}catch(a){this.client.logger.warn(a)}return this.client.logger.debug(`Verify context: ${JSON.stringify(s)}`),s},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!Sg(e,!1)){const{message:n}=bg("MISSING_OR_INVALID",`${t} must be in Record format. Received: ${JSON.stringify(e)}`);throw new Error(n)}}))},this.getPendingAuthRequest=e=>{const t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0},this.addToRecentlyDeleted=(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0;const t=this.recentlyDeletedLimit/2;for(const n of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(n)}}},this.checkRecentlyDeleted=e=>{const t=this.recentlyDeletedMap.get(e);if(t){const{message:n}=bg("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw new Error(n)}},this.isLinkModeEnabled=(e,t)=>{var r,i,o,s,a,c,u,l,d;return!(!e||t!==Dm.link_mode)&&(!0===(null==(i=null==(r=this.client.metadata)?void 0:r.redirect)?void 0:i.linkMode)&&void 0!==(null==(s=null==(o=this.client.metadata)?void 0:o.redirect)?void 0:s.universal)&&""!==(null==(c=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:c.universal)&&void 0!==(null==(u=e?.redirect)?void 0:u.universal)&&""!==(null==(l=e?.redirect)?void 0:l.universal)&&!0===(null==(d=e?.redirect)?void 0:d.linkMode)&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(null==n.g?void 0:n.g.Linking)<"u")},this.getAppLinkIfEnabled=(e,t)=>{var n;return this.isLinkModeEnabled(e,t)?null==(n=e?.redirect)?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const t=ip(e,"topic")||"",n=decodeURIComponent(ip(e,"wc_ev")||""),r=this.client.session.keys.includes(t);r&&this.client.session.update(t,{transportType:Dm.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:n,sessionExists:r})},this.registerLinkModeListeners=async()=>{var e;if(sp()||Fh()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){const e=null==n.g?void 0:n.g.Linking;if(typeof e<"u"){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);const t=await e.getInitialURL();t&&setTimeout((()=>{this.handleLinkModeMessage({url:t})}),50)}}}}isInitialized(){if(!this.initialized){const{message:e}=bg("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(_m,(e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)}))}async onRelayMessage(e){const{topic:t,message:n,attestation:r,transportType:i}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Tw)?this.client.auth.authKeys.get(Tw):{responseTopic:void 0,publicKey:void 0},s=await this.client.core.crypto.decode(t,n,{receiverPublicKey:o,encoding:i===Dm.link_mode?jp:Up});try{am(s)?(this.client.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s,attestation:r,transportType:i,encryptedId:zp(n)})):cm(s)?(await this.client.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s,transportType:i}),this.client.core.history.delete(t,s.id)):this.onRelayEventUnknownPayload({topic:t,payload:s,transportType:i})}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(tb,(async e=>{const{topic:t,id:n}=Qh(e.target);return n&&this.client.pendingRequest.keys.includes(n)?await this.deletePendingSessionRequest(n,bg("EXPIRED"),!0):n&&this.client.auth.requests.keys.includes(n)?await this.deletePendingAuthRequest(n,bg("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n})))}))}registerPairingEvents(){this.client.core.pairing.events.on(Wm,(e=>this.onPairingCreated(e))),this.client.core.pairing.events.on(Zm,(e=>{this.addToRecentlyDeleted(e.topic,"pairing")}))}isValidPairingTopic(e){if(!Sg(e,!1)){const{message:t}=bg("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=bg("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(ep(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=bg("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!Sg(e,!1)){const{message:t}=bg("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=bg("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(ep(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=bg("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=bg("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(Sg(e,!1)){const{message:t}=bg("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=bg("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!function(e){return"number"==typeof e}(e)){const{message:t}=bg("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=bg("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(ep(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=bg("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Fw extends Xv{constructor(e,t){super(e,t,"proposal",bw),this.core=e,this.logger=t}}class Vw extends Xv{constructor(e,t){super(e,t,"session",bw),this.core=e,this.logger=t}}class qw extends Xv{constructor(e,t){super(e,t,"request",bw,(e=>e.id)),this.core=e,this.logger=t}}class zw extends Xv{constructor(e,t){super(e,t,"authKeys",kw,(()=>Tw)),this.core=e,this.logger=t}}class Hw extends Xv{constructor(e,t){super(e,t,"pairingTopics",kw),this.core=e,this.logger=t}}class Ww extends Xv{constructor(e,t){super(e,t,"requests",kw,(e=>e.id)),this.core=e,this.logger=t}}class Gw{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new zw(this.core,this.logger),this.pairingTopics=new Hw(this.core,this.logger),this.requests=new Ww(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class Zw extends class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=yw,this.events=new Nt.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.update=async e=>{try{return await this.engine.update(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.request=async e=>{try{return await this.engine.request(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.find=e=>{try{return this.engine.find(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(aM){throw this.logger.error(aM.message),aM}},this.authenticate=async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(n){throw this.logger.error(n.message),n}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.approveSessionAuthenticate=async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.rejectSessionAuthenticate=async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(Wu){throw this.logger.error(Wu.message),Wu}},this.name=e?.name||yw,this.metadata=e?.metadata||zh(),this.signConfig=e?.signConfig;const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:kl()(Wl({level:e?.logger||vw}));this.core=e?.core||new gw(e),this.logger=Zl(t,this.name),this.session=new Vw(this.core,this.logger),this.proposal=new Fw(this.core,this.logger),this.pendingRequest=new qw(this.core,this.logger),this.engine=new jw(this),this.auth=new Gw(this.core,this.logger)}static async init(e){const t=new Zw(e);return await t.initialize(),t}get context(){return Gl(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}function Kw(){return"undefined"!==typeof navigator&&/iPhone|iPod/.test(navigator.userAgent)||"undefined"!==typeof navigator&&/iPad/.test(navigator.userAgent)}function Xw(){return"undefined"!==typeof navigator&&/android/i.test(navigator.userAgent)||Kw()}let Yw=function(e){return e.FLOW_AUTHN="flow_authn",e.FLOW_PRE_AUTHZ="flow_pre_authz",e.FLOW_AUTHZ="flow_authz",e.FLOW_USER_SIGN="flow_user_sign",e}({}),Jw=function(e){return e.SESSION_REQUEST="session_proposal",e.SIGNING_REQUEST="signing_request",e}({});async function Qw(e){let{client:t,existingPairing:n}=e;const r=await ga(),i={flow:{methods:[Yw.FLOW_AUTHN,Yw.FLOW_PRE_AUTHZ,Yw.FLOW_AUTHZ,Yw.FLOW_USER_SIGN],chains:[`flow:${r}`],events:["chainChanged","accountsChanged"]}},{uri:o,approval:s}=await t.connect({pairingTopic:n?.topic,requiredNamespaces:i});if(!o)throw new Error("FCL-WC: Error creating session proposal. Could not create a proposal URI.");return{uri:o,approval:s}}const $w=async e=>{let{method:t,body:n,session:r,client:i,abortSignal:o}=e;const[s,a,c]=function(e){const[t,n,r]=Object.values(e.namespaces).map((e=>e.accounts)).flat().filter((e=>e.startsWith("flow:")))[0].split(":");return[`${t}:${n}`,r,r]}(r),u=JSON.stringify({...n,addr:a,address:c}),l=await Promise.race([i.request({topic:r.topic,chainId:s,request:{method:t,params:[u]}}),new Promise(((e,t)=>{o?.aborted&&t(new Error("WalletConnect Request aborted")),o?.addEventListener("abort",(()=>{t(new Error("WalletConnect Request aborted"))}))}))]);if("object"===typeof l&&null!=l)switch(l.status){case"APPROVED":case"REDIRECT":return l.data;case"DECLINED":throw new Error(`Declined: ${l.reason||"No reason supplied"}`);default:throw new Error("Declined: No reason supplied")}};const ex="fcl-plugin-service-walletconnect",tx="WC/RPC",nx=(e,t,n)=>{let{wcRequestHook:r,pairingModalOverride:i}=t;return async t=>{let{service:o,body:s,opts:a,abortSignal:c}=t;const u=await e;let l,d,f;fe(!!u,"WalletConnect is not initialized");const h=o.endpoint,p=function(e){let{uid:t}=e;t&&/^(ftp|http|https):\/\/[^ "]+$/.test(t)||de({title:"WalletConnect Service Warning",message:`service.uid should be a valid universal link url. Found: ${t}`,level:le.warn});return t}(o),g=u.pairing.getAll({active:!0});if(g.length>0&&(d=g?.find((e=>e.peerMetadata?.url===o.uid))),u.session.length>0){const e=u.session.keys.length-1;l=u.session.get(u.session.keys.at(e))}return Xw()&&(f=a.windowRef?a.windowRef:window.open("","_blank")),null==l&&(l=await new Promise(((e,t)=>{(function(e){return async t=>{let{service:n,onClose:r,appLink:i,windowRef:o,client:s,method:a,pairing:c,wcRequestHook:u,pairingModalOverride:l,abortSignal:d}=t;const f=s.opts?.projectId;fe(!!f,"Cannot establish connection, WalletConnect projectId is undefined");let h,p=null;try{const{uri:t,approval:g}=await Qw({client:s,existingPairing:c});if(p=t,u&&u instanceof Function&&u({type:Jw.SESSION_REQUEST,method:a,service:n,session:null,pairing:c??null,uri:t??null}),Xw()){const e=new URLSearchParams({uri:t}).toString();let n=null==c?i+"?"+e:i;o.location.href=n}else c||(l?l(t,r):(h=new(await e)({projectId:f,walletConnectVersion:2}),h.openModal({uri:t,onClose:r})));const m=await Promise.race([g(),new Promise(((e,t)=>{d?.aborted&&t(new Error("Session request aborted")),d?.addEventListener("abort",(()=>{t(new Error("Session request aborted"))}))}))]);return m}catch(g){throw g instanceof Error&&de({title:`${g.name} Error establishing WalletConnect session`,message:`\n ${g.message}\n uri: ${p}\n `,level:le.error}),r(),g}finally{o&&!o.closed&&o.close(),h?.closeModal()}}})(n)({service:o,onClose:function(){t("Declined: Externally Halted")},appLink:p,windowRef:f,client:u,method:h,pairing:d,wcRequestHook:r,pairingModalOverride:i,abortSignal:c}).then(e,t)}))),r&&r instanceof Function&&r({type:Jw.SIGNING_REQUEST,method:h,service:o,session:l??null,pairing:d??null,uri:null}),Xw()&&h!==Yw.FLOW_AUTHN&&function(){if(f)if(p.startsWith("http")&&!Kw()){const e=document.createElement("a");e.href=p,e.target="_blank",e.rel="noreferrer noopener",e.click()}else f.location.href=p;else de({title:"Problem opening deep link in new window",message:"Window failed to open (was it blocked by the browser?)",level:le.warn})}(),await $w({method:h,body:s,session:l,client:u,abortSignal:c}).finally((()=>{f&&!f.closed&&f.close()}))}};let rx=Promise.resolve(null);const ix=e=>{const{FclWcServicePlugin:t,clientPromise:n}=ox(e);return Oc.authn.update(),{FclWcServicePlugin:t,clientPromise:n}},ox=e=>{let{projectId:t,metadata:r,includeBaseWC:i=!1,wcRequestHook:o=null,pairingModalOverride:s=null,wallets:a=[]}=e;if("undefined"===typeof window)throw new Error("FCL Wallet Connect Plugin can only be initialized in the browser");rx=Promise.resolve(rx).catch((()=>null)).then((e=>e||(async e=>{let{projectId:t,metadata:n}=e;fe(null!=t,"FCL Wallet Connect Error: WalletConnect projectId is required");try{return Zw.init({logger:"debug",relayUrl:"wss://relay.walletconnect.com",projectId:t,metadata:n})}catch(r){throw r instanceof Error&&de({title:`${r.name} fcl-wc Init Client`,message:r.message,level:le.error}),r}})({projectId:t,metadata:r}))).catch((e=>{throw de({title:"WalletConnect Client Initialization Error",message:e.message?e.message:e,level:le.error}),e}));const c=function(e){return{name:ex,f_type:"ServicePlugin",type:"discovery-service",serviceStrategy:{method:tx,exec:nx(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{projectId:"",includeBaseWC:!1,wallets:[],wcRequestHook:null,pairingModalOverride:null},n.e(343).then(n.bind(n,59343)).then((e=>e.WalletConnectModal)))},services:[]}}(rx,{projectId:t,includeBaseWC:i,wcRequestHook:o,pairingModalOverride:s,wallets:a});return{FclWcServicePlugin:c,clientPromise:rx}};async function sx(){return rx.then((e=>{if(!e)throw new Error("WalletConnect client not initialized");return e}))}const ax="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",cx=ax.length;function ux(){let e="",t=32;for(;t--;)e+=ax[Math.random()*cx|0];return e}const lx=globalThis.AbortController||n(28599);function dx(e){const t=new lx;return e?.aborted&&t.abort(),e?.addEventListener("abort",(()=>t.abort())),t}let fx=function(e){return e.NOTIFY_QRCODE_CONNECTING="notifyQrCodeConnecting",e.NOTIFY_QRCODE_CONNECTED="notifyQrCodeConnected",e.NOTIFY_QRCODE_ERROR="notifyQrCodeError",e}({}),hx=function(e){return e.REQUEST_WALLETCONNECT_QRCODE="requestWalletConnectQrCode",e.EXEC_SERVICE="execService",e}({});const px="APPROVED",gx=e=>{let{rpc:t,onExecResult:n,authnBody:r,abortSignal:i}=e;const o=function(e){let{rpc:t,authnBody:n}=e;return e=>{let{uri:r,approval:i,onExecResult:o}=e;setTimeout((async()=>{try{const e=await sx(),s=await i();t.notify(fx.NOTIFY_QRCODE_CONNECTING,{uri:r});const a=await $w({method:Yw.FLOW_AUTHN,body:n,session:s,client:e});t.notify(fx.NOTIFY_QRCODE_CONNECTED,{uri:r}),o(a)}catch(e){t.notify(fx.NOTIFY_QRCODE_ERROR,{uri:r,error:e?.message})}}),0)}}({rpc:t,authnBody:r});return async e=>{if(i.aborted)throw new Error("Handler has been terminated");const t=await sx(),{uri:r,approval:s}=await Qw({client:t});return o({uri:r,approval:s,onExecResult:n}),{uri:r}}};function mx(e){let{onExecResult:t,body:n,opts:r,args:i,abortSignal:o}=e;const s=new Vu({notifications:[]});return s.on(hx.REQUEST_WALLETCONNECT_QRCODE,gx({rpc:s,onExecResult:t,authnBody:n,abortSignal:o})),s.on(hx.EXEC_SERVICE,(e=>{let{onExecResult:t,execStrategyOpts:n,execStrategyArgs:r,abortSignal:i}=e;return async e=>{let{service:o}=e;try{const e=await $c({...n,service:o,config:n.config,abortSignal:i},...r.slice(1));if((Au(e)?.status||px)===px)return t(e),null;throw new Error(e?.reason||"Service was declined")}catch(s){throw new Error(s?.message||"Service execution failed")}}})({onExecResult:t,execStrategyOpts:r,execStrategyArgs:i,abortSignal:o})),{connect:s.connect.bind(s),receive:s.receive.bind(s)}}async function bx(e){let{customRpc:t,opts:n,args:r,abortSignal:i}=e;const o={...n.config,client:{...n.config.client,discoveryRpcEnabled:!0}};return $c({...n,config:o,customRpc:t,abortSignal:i},...r.slice(1))}const yx="authn";const vx="FCL_IFRAME";function wx(e){fe(!document.getElementById(vx),"Attempt at triggering multiple Frames",{src:e});const t=document.createElement("iframe");t.src=e,t.id=vx,t.allow="usb *; hid *; clipboard-write",t.frameBorder="0",t.style.cssText="\n position:fixed;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n height: 100%;\n width: 100vw;\n display:block;\n background:rgba(0,0,0,0.25);\n z-index: 2147483647;\n box-sizing: border-box;\n color-scheme: light;\n",document.body.append(t);return[t.contentWindow,()=>{document.getElementById(vx)&&document.getElementById(vx).remove()}]}let xx=null,Sx=null;function Ax(e){null==xx||xx?.closed?xx=function(e,t,n,r,i){const o=n.top.outerHeight/2+n.top.screenY-i/2,s=n.top.outerWidth/2+n.top.screenX-r/2,a=n.open(e,t,`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${r}, height=${i}, top=${o}, left=${s}`);if(!a)throw new Error("Popup failed to open (was it blocked by a popup blocker?)");return a}(e,"FCL_POP",window,640,770):Sx!==e?(xx.location.replace(e),xx.focus()):xx.focus(),Sx=e;return[xx,()=>{xx&&!xx.closed&&xx.close(),xx=null}]}let Ex=null,_x=null;function Cx(e){if(null==Ex||Ex?.closed){if(Ex=window.open(e,"_blank"),!Ex)throw new Error("Tab failed to open (was it blocked by the browser?)")}else _x!==e?(Ex.location.replace(e),Ex.focus()):Ex.focus();_x=e;return[Ex,()=>{Ex&&!Ex.closed&&Ex.close(),Ex=null}]}const Ix=()=>{try{const e={can:!("undefined"===typeof window),get:async e=>JSON.parse(sessionStorage.getItem(e)),put:async(e,t)=>sessionStorage.setItem(e,JSON.stringify(t))};return e}catch(e){return null}},kx=()=>{};const Tx="1.12.1";const Mx=()=>{};const Px=()=>{};const Ox=()=>{};const Rx=()=>{throw new Error("Strategy util has not been implemented on this platform")},Nx={"VIEW/IFRAME":wx,"VIEW/POP":Ax,"VIEW/TAB":Cx,"VIEW/MOBILE_BROWSER":Rx,"VIEW/DEEPLINK":Rx};async function Bx(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{serviceEndpoint:()=>{}};const{serviceEndpoint:n}=t;try{return Nx[e.method](n(e),t)}catch(r){throw console.error("execLocal({service, opts = {}})",r,{service:e,opts:t}),r}}const Lx={[_a["HTTP/RPC"]]:Iu(Bx),[_a["HTTP/POST"]]:Iu(Bx),[_a["IFRAME/RPC"]]:function(e){let{service:t,body:n,config:r,customRpc:i,abortSignal:o,opts:s}=e;return new Promise(((e,a)=>{const c=ux(),u=s.includeOlderJsonRpcCall,{close:l}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:kx,close:kx};const n=t.onClose||kx,r=t.onMessage||kx,i=t.onReady||kx,o=t.onResponse||kx,s=t.onCustomRpc||kx;let a,c;const u=Nu({close:l,send:d,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});return window.addEventListener("message",u),[a,c]=wx(xu(e)),{send:d,close:l};function l(){try{window.removeEventListener("message",u),c(),n()}catch(e){console.error("Frame Close Error",e)}}function d(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Frame Send Error",e,t)}}}(t,{async onReady(e,o){let{send:s}=o;try{s({type:"FCL:VIEW:READY:RESPONSE",fclVersion:Tx,body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:Tx,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),u&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params],deprecated:{message:"jsonrpc is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),i?.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Au(t.data);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execIframeRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Au(t.data.result);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execIframeRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){i?.receive(e)}});o&&(o.aborted&&(a("Declined: Aborted"),l()),o.addEventListener("abort",(()=>{a("Declined: Aborted"),l()})))}))},[_a["POP/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,a)=>{const c=ux(),{redir:u,includeOlderJsonRpcCall:l}=s,{close:d}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:Mx,close:Mx};const n=t.onClose||Mx,r=t.onMessage||Mx,i=t.onReady||Mx,o=t.onResponse||Mx,s=t.onCustomRpc||Mx;let a,c;const u=Nu({close:d,send:f,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});window.addEventListener("message",u),[a,c]=Ax(xu(e));const l=setInterval((function(){a&&a.closed&&d()}),500);return{send:f,close:d};function d(){try{window.removeEventListener("message",u),clearInterval(l),c(),n()}catch(e){console.error("Popup Close Error",e)}}function f(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Popup Send Error",e,t)}}}(t,{customRpc:o,async onReady(e,i){let{send:s}=i;try{s({fclVersion:Tx,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:Tx,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),l&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params]}),o?.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Au(t.data);switch(n.status){case"APPROVED":e(n.data),!u&&r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Au(t.data.result);switch(n.status){case"APPROVED":e(n.data),!u&&r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){o?.receive(e)}});i&&(i.aborted&&(a("Declined: Aborted"),d()),i.addEventListener("abort",(()=>{a("Declined: Aborted"),d()})))}))},[_a["TAB/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,a)=>{const c=ux(),{redir:u,includeOlderJsonRpcCall:l}=s,{close:d}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:Px,close:Px};const n=t.onClose||Px,r=t.onMessage||Px,i=t.onReady||Px,o=t.onResponse||Px,s=t.onCustomRpc||Px;let a,c;const u=Nu({close:d,send:f,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});window.addEventListener("message",u),[a,c]=Cx(xu(e));const l=setInterval((function(){a&&a.closed&&d()}),500);return{send:f,close:d};function d(){try{window.removeEventListener("message",u),clearInterval(l),c(),n()}catch(e){console.error("Tab Close Error",e)}}function f(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Tab Send Error",e,t)}}}(t,{customRpc:o,async onReady(e,i){let{send:s}=i;try{s({fclVersion:Tx,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:Tx,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),l&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params]}),o?.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Au(t.data);switch(n.status){case"APPROVED":e(n.data),!u&&r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Au(t.data.result);switch(n.status){case"APPROVED":e(n.data),!u&&r();break;case"DECLINED":a(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){o?.receive(e)}});i&&(i.aborted&&(d(),a("Declined: Aborted")),i.addEventListener("abort",(()=>{d(),a("Declined: Aborted")})))}))},[_a["EXT/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,s)=>{const{close:a}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:Ox,close:Ox};const n=t.onClose||Ox,r=t.onMessage||Ox,i=t.onReady||Ox,o=t.onResponse||Ox,s=t.onCustomRpc||Ox,a=Nu({close:c,send:u,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s});return window.addEventListener("message",a),u({service:e}),{send:u,close:c};function c(){try{window.removeEventListener("message",a),n()}catch(e){console.error("Ext Close Error",e)}}function u(e){try{window&&window.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Ext Send Error",e,t)}}}(t,{async onReady(e,i){let{send:s}=i;try{s({fclVersion:Tx,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),o?.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",body:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Au(t.data);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":s(`Declined: ${n.reason||"No reason supplied"}`),r();break;case"REDIRECT":e(n),r();break;default:s("Declined: No reason supplied"),r()}}catch(i){throw console.error("execExtRPC onResponse error",i),i}},onClose(){s("Declined: Externally Halted")},onCustomRpc(e){o?.receive(e)}});i&&(i.aborted&&(a(),s("Declined: Aborted")),i.addEventListener("abort",(()=>{a(),s("Declined: Aborted")})))}))}},Dx="undefined"===typeof window,Ux=e=>{const t=e["app.detail.title"],n=e["app.detail.icon"],r=e["app.detail.description"],i=e["app.detail.url"];return{name:t??document.title,description:r??"",url:i??window.location.origin,icons:n?[n]:[]}};const jx={execStrategy:async function(){for(var e=arguments.length,t=new Array(e),n=0;n{const o=mx({onExecResult:e,body:i,opts:r,args:t,abortSignal:a.signal});c=bx({customRpc:o,opts:r,args:t,abortSignal:a.signal}).then(e,n)}));return await u.catch((()=>{})),await Promise.race([new Promise((e=>setTimeout(e,1e3))),c]).catch((()=>{})),a.abort(),u}},Fx=(e=>{let{platform:t,discovery:n}=e;return async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r;try{await wa(e),e=await ya(e);const i=wu({platform:t,discovery:n}),o=await xt().get("fcl.authz",i().authorization);return r=lo([Fo(e.cadence),Oo(aa(e.args||[])),e.limit&&sa(e.limit)&&Po(e.limit),No(e.proposer||e.authz||o),Bo(e.payer||e.authz||o),xo(e.authorizations||[e.authz||o])]).then(fo),r}catch(i){throw i}}})({platform:"web",discovery:jx}),Vx=wu({platform:"web",discovery:jx}),qx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vx().authenticate(e)},zx=()=>Vx().unauthenticate(),Hx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vx().unauthenticate(),Vx().authenticate(e)},Wx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vx().authenticate(e)},Gx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vx().authenticate(e)},Zx=Vx().authorization;xt({"discovery.wallet.method.default":"IFRAME/RPC","fcl.storage.default":Ix()}),xc({coreStrategies:Lx}),function(){if(Dx)return;let e=null,t=!1;xt.subscribe((async n=>{const r={"walletconnect.projectId":n["walletconnect.projectId"],"app.detail.title":n["app.detail.title"],"app.detail.icon":n["app.detail.icon"],"app.detail.description":n["app.detail.description"],"app.detail.url":n["app.detail.url"]},i=r["walletconnect.projectId"],o=e;if(e=JSON.stringify(r,null,2),t)return void(o!==e&&console.warn(`FCL WalletConnect Plugin has been already loaded with different configuration. It is not possible to change the configuration after the plugin has been loaded.\n\nPrevious configuration:\n${o}\n\nCurrent configuration:\n${e}`));if(!!!i)return;if(fe(!!i,"FCL Configuration value for 'walletconnect.projectId' is required"),Ac.getPlugins().has(ex))return t||console.warn("It seems like the FCL WalletConnect plugins has been already loaded manually. This is no longer necessary, please see the documentation for more information."),void(t=!0);t=!0;const{clientPromise:s,FclWcServicePlugin:a}=ix({projectId:i,metadata:Ux(r)});Ac.add([a])}))}();var Kx=n(48764).Buffer;function Xx(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var Yx=function(e){L(n,e);var t=Xx(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),$x=Jx("ascii","a",(e=>{let t="a";for(let n=0;n{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let n=0;n{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...i.accounts)})),n}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const tS={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function nS(e,t){const{message:n,code:r}=tS[e];return{message:t?`${n} ${t}`:n,code:r}}function rS(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function iS(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const oS=iS("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),sS=iS("ascii","a",(e=>{let t="a";for(let n=0;n{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let n=0;nt in e?yS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_S=(e,t)=>{for(var n in t||(t={}))SS.call(t,n)&&ES(e,n,t[n]);if(xS)for(var n of xS(t))AS.call(t,n)&&ES(e,n,t[n]);return e},CS=(e,t)=>vS(e,wS(t));const IS={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class kS{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new Nt.EventEmitter,this.isAvailable=!1,this.registering=!1,!im(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=yl(e),n=await(await bS()(this.url,CS(_S({},IS),{body:t}))).json();this.onPayload({data:n})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!im(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(new Error("HTTP connection is missing or invalid"));e()}))}))}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=yl({id:1,jsonrpc:"2.0",method:"test",params:[]});await bS()(e,CS(_S({},IS),{body:t}))}this.onOpen()}catch(t){const e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?bl(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=em(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e,t=this.url){return Kg(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}class TS extends nm{constructor(e){super(e),this.events=new Nt.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Qg(e.method,e.params||[],e.id||Jg().toString()),t)}async requestStrict(e,t){return new Promise((async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(Hu){r(Hu)}this.events.on(`${e.id}`,(e=>{lm(e)?r(e.error):n(e.result)}));try{await this.connection.send(e,t)}catch(Hu){r(Hu)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),cm(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",(e=>this.onPayload(e))),this.connection.on("close",(e=>this.onClose(e))),this.connection.on("error",(e=>this.events.emit("error",e))),this.connection.on("register_error",(e=>this.onClose())),this.hasRegisteredEventListeners=!0)}}const MS="error",PS="generic",OS="default_chain_changed";var RS=Object.defineProperty,NS=Object.defineProperties,BS=Object.getOwnPropertyDescriptors,LS=Object.getOwnPropertySymbols,DS=Object.prototype.hasOwnProperty,US=Object.prototype.propertyIsEnumerable,jS=(e,t,n)=>t in e?RS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FS=(e,t)=>{for(var n in t||(t={}))DS.call(t,n)&&jS(e,n,t[n]);if(LS)for(var n of LS(t))US.call(t,n)&&jS(e,n,t[n]);return e},VS=(e,t)=>NS(e,BS(t));function qS(e,t,n){var r;const i=cS(e);return(null==(r=t.rpcMap)?void 0:r[i.reference])||`https://rpc.walletconnect.org/v1/?chainId=${i.namespace}:${i.reference}&projectId=${n}`}function zS(e){return e.includes(":")?e.split(":")[1]:e}function HS(e){return e.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))}function WS(e={},t={}){const n=GS(e),r=GS(t);return(0,E.merge)(n,r)}function GS(e){var t,n,r,i;const o={};if(!gS(e))return o;for(const[s,a]of Object.entries(e)){const e=lS(s)?[s]:a.chains,c=a.methods||[],u=a.events||[],l=a.rpcMap||{},d=dS(s);o[d]=VS(FS(FS({},o[d]),a),{chains:uS(e,null==(t=o[d])?void 0:t.chains),methods:uS(c,null==(n=o[d])?void 0:n.methods),events:uS(u,null==(r=o[d])?void 0:r.events),rpcMap:FS(FS({},l),null==(i=o[d])?void 0:i.rpcMap)})}return o}function ZS(e){return e.includes(":")?e.split(":")[2]:e}function KS(e){const t={};for(const[n,r]of Object.entries(e)){const e=r.methods||[],i=r.events||[],o=r.accounts||[],s=lS(n)?[n]:r.chains?r.chains:HS(r.accounts);t[n]={chains:s,methods:e,events:i,accounts:o}}return t}function XS(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}const YS={},JS=e=>YS[e],QS=(e,t)=>{YS[e]=t};class $S{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}var eA=Object.defineProperty,tA=Object.defineProperties,nA=Object.getOwnPropertyDescriptors,rA=Object.getOwnPropertySymbols,iA=Object.prototype.hasOwnProperty,oA=Object.prototype.propertyIsEnumerable,sA=(e,t,n)=>t in e?eA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aA=(e,t)=>{for(var n in t||(t={}))iA.call(t,n)&&sA(e,n,t[n]);if(rA)for(var n of rA(t))oA.call(t,n)&&sA(e,n,t[n]);return e},cA=(e,t)=>tA(e,nA(t));class uA{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(OS,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||qS(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=parseInt(zS(t));e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,n;let r=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0";r=r.startsWith("0x")?r:`0x${r}`;const i=parseInt(r,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:r}]},chainId:null==(n=this.namespace.chains)?void 0:n[0]}),this.setDefaultChain(`${i}`)}return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,n,r;const i=null==(n=null==(t=e.request)?void 0:t.params)?void 0:n[0];if(!i)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),s=(null==(r=o?.sessionProperties)?void 0:r.capabilities)||{};if(null!=s&&s[i])return s?.[i];const a=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:cA(aA({},o.sessionProperties||{}),{capabilities:cA(aA({},s||{}),{[i]:a})})})}catch(c){console.warn("Failed to update session with capabilities",c)}return a}async getCallStatus(e){var t,n;const r=this.client.session.get(e.topic),i=null==(t=r.sessionProperties)?void 0:t.bundler_name;if(i){const t=this.getBundlerUrl(e.chainId,i);try{return await this.getUserOperationReceipt(t,e)}catch(Nl){console.warn("Failed to fetch call status from bundler",Nl,t)}}const o=null==(n=r.sessionProperties)?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(s){console.warn("Failed to fetch call status from custom bundler",s,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var n;const r=new URL(e),i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qg("eth_getUserOperationReceipt",[null==(n=t.request.params)?void 0:n[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}getBundlerUrl(e,t){return`https://rpc.walletconnect.org/v1/bundler?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class lA{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class dA{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class fA{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const n=t||qS(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(OS,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;e[t]=this.createHttpProvider(t,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new TS(new kS(n,JS("disableProviderPing")))}}class hA{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{const n=this.getCardanoRPCUrl(t),r=zS(t);e[r]=this.createHttpProvider(r,n)})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class pA{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class gA{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=zS(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}class mA{constructor(e){this.name="near",this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||qS(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(OS,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;e[t]=this.createHttpProvider(t,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace);return typeof n>"u"?void 0:new TS(new kS(n,JS("disableProviderPing")))}}class bA{constructor(e){this.name=PS,this.namespace=e.namespace,this.events=JS("events"),this.client=JS("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(OS,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){var e,t;const n={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach((e=>{const t=cS(e);n[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)})),n}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||qS(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new TS(new kS(n,JS("disableProviderPing")))}}var yA=Object.defineProperty,vA=Object.defineProperties,wA=Object.getOwnPropertyDescriptors,xA=Object.getOwnPropertySymbols,SA=Object.prototype.hasOwnProperty,AA=Object.prototype.propertyIsEnumerable,EA=(e,t,n)=>t in e?yA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_A=(e,t)=>{for(var n in t||(t={}))SA.call(t,n)&&EA(e,n,t[n]);if(xA)for(var n of xA(t))AA.call(t,n)&&EA(e,n,t[n]);return e},CA=(e,t)=>vA(e,wA(t));class IA{constructor(e){this.events=new(Bt()),this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:kl()(Wl({level:e?.logger||MS})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new IA(e);return await t.initialize(),t}async request(e,t,n){const[r,i]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(r).request({request:_A({},e),chainId:`${r}:${i}`,topic:this.session.topic,expiry:n})}sendAsync(e,t,n,r){const i=(new Date).getTime();this.request(e,n,r).then((e=>t(null,$g(i,e)))).catch((e=>t(e,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:hS("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:r}=await this.client.authenticate(e,t);n&&(this.uri=n,this.events.emit("display_uri",n));const i=await r();if(this.session=i.session,this.session){const e=KS(this.session.namespaces);this.namespaces=WS(this.namespaces,e),this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await r().then((e=>{this.session=e;const t=KS(e.namespaces);this.namespaces=WS(this.namespaces,t),this.persist("namespaces",this.namespaces)})).catch((e=>{if(e.message!==xw)throw e;t++}))}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,r]=this.validateChain(e),i=this.getProvider(n);i.name===PS?i.setDefaultChain(`${n}:${r}`,t):i.setDefaultChain(r,t)}catch(Wu){if(!/Please call connect/.test(Wu.message))throw Wu}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(pS(t)){for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Zw.init({core:this.providerOpts.core,logger:this.providerOpts.logger||MS,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map((e=>dS(e))))];QS("client",this.client),QS("events",this.events),QS("disableProviderPing",this.disableProviderPing),e.forEach((e=>{if(!this.session)return;const t=function(e,t){const n=Object.keys(t.namespaces).filter((t=>t.includes(e)));if(!n.length)return[];const r=[];return n.forEach((e=>{const n=t.namespaces[e].accounts;r.push(...n)})),r}(e,this.session),n=HS(t),r=WS(this.namespaces,this.optionalNamespaces),i=CA(_A({},r[e]),{accounts:t,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new uA({namespace:i});break;case"algorand":this.rpcProviders[e]=new fA({namespace:i});break;case"solana":this.rpcProviders[e]=new lA({namespace:i});break;case"cosmos":this.rpcProviders[e]=new dA({namespace:i});break;case"polkadot":this.rpcProviders[e]=new $S({namespace:i});break;case"cip34":this.rpcProviders[e]=new hA({namespace:i});break;case"elrond":this.rpcProviders[e]=new pA({namespace:i});break;case"multiversx":this.rpcProviders[e]=new gA({namespace:i});break;case"near":this.rpcProviders[e]=new mA({namespace:i});break;default:this.rpcProviders.generic?this.rpcProviders.generic.updateNamespace(i):this.rpcProviders.generic=new bA({namespace:i})}}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(e=>{this.events.emit("session_ping",e)})),this.client.on("session_event",(e=>{const{params:t}=e,{event:n}=t;if("accountsChanged"===n.name){const e=n.data;e&&pS(e)&&this.events.emit("accountsChanged",e.map(ZS))}else if("chainChanged"===n.name){const e=t.chainId,n=t.event.data,r=dS(e),i=XS(e)!==XS(n)?`${r}:${XS(n)}`:e;this.onChainChanged(i)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)})),this.client.on("session_update",(({topic:e,params:t})=>{var n;const{namespaces:r}=t,i=null==(n=this.client)?void 0:n.session.get(e);this.session=CA(_A({},i),{namespaces:r}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})})),this.client.on("session_delete",(async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",CA(_A({},hS("USER_DISCONNECTED")),{data:e.topic}))})),this.on(OS,(e=>{this.onChainChanged(e,!0)}))}getProvider(e){return this.rpcProviders[e]||this.rpcProviders.generic}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])}))}setNamespaces(e){const{namespaces:t,optionalNamespaces:n,sessionProperties:r}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=r,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map((e=>dS(e))).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const r=dS(Object.keys(this.namespaces)[0]);return[r,this.rpcProviders[r].getDefaultChain()]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[n,r]=this.validateChain(e);r&&(t||this.getProvider(n).setDefaultChain(r),this.namespaces[n]?this.namespaces[n].defaultChain=r:this.namespaces[`${n}:${r}`]?this.namespaces[`${n}:${r}`].defaultChain=r:this.namespaces[`${n}:${r}`]={defaultChain:r},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",r))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`wc@2:universal_provider:/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`wc@2:universal_provider:/${e}`)}}const kA=IA,TA=["eth_sendTransaction","personal_sign"],MA=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],PA=["chainChanged","accountsChanged"],OA=["chainChanged","accountsChanged","message","disconnect","connect"];var RA=Object.defineProperty,NA=Object.defineProperties,BA=Object.getOwnPropertyDescriptors,LA=Object.getOwnPropertySymbols,DA=Object.prototype.hasOwnProperty,UA=Object.prototype.propertyIsEnumerable,jA=(e,t,n)=>t in e?RA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FA=(e,t)=>{for(var n in t||(t={}))DA.call(t,n)&&jA(e,n,t[n]);if(LA)for(var n of LA(t))UA.call(t,n)&&jA(e,n,t[n]);return e},VA=(e,t)=>NA(e,BA(t));function qA(e){return Number(e[0].split(":")[1])}function zA(e){return`0x${e.toString(16)}`}class HA{constructor(){this.events=new Nt.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new HA;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,n){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),n)}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:n}=function(e){const{chains:t,optionalChains:n,methods:r,optionalMethods:i,events:o,optionalEvents:s,rpcMap:a}=e;if(!rS(t))throw new Error("Invalid chains");const c={chains:t,methods:r||TA,events:o||PA,rpcMap:FA({},t.length?{[qA(t)]:a[qA(t)]}:{})},u=o?.filter((e=>!PA.includes(e))),l=r?.filter((e=>!TA.includes(e)));if(!n&&!s&&!i&&(null==u||!u.length)&&(null==l||!l.length))return{required:t.length?c:void 0};const d={chains:[...new Set(u?.length&&l?.length||!n?c.chains.concat(n||[]):n)],methods:[...new Set(c.methods.concat(null!=i&&i.length?i:MA))],events:[...new Set(c.events.concat(null!=s&&s.length?s:OA))],rpcMap:a};return{required:t.length?c:void 0,optional:n.length?d:void 0}}(this.rpc);try{const r=await new Promise((async(r,i)=>{var o;this.rpc.showQrModal&&(null==(o=this.modal)||o.subscribeModal((e=>{!e.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),i(new Error("Connection request reset. Please try again.")))}))),await this.signer.connect(VA(FA({namespaces:FA({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e?.pairingTopic})).then((e=>{r(e)})).catch((e=>{i(new Error(e.message))}))}));if(!r)return;const i=eS(r.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:i),this.setAccounts(i),this.events.emit("connect",{chainId:zA(this.chainId)})}catch(r){throw this.signer.logger.error(r),r}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const n=await new Promise((async(n,r)=>{var i;this.rpc.showQrModal&&(null==(i=this.modal)||i.subscribeModal((e=>{!e.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),r(new Error("Connection request reset. Please try again.")))}))),await this.signer.authenticate(VA(FA({},e),{chains:this.rpc.chains}),t).then((e=>{n(e)})).catch((e=>{r(new Error(e.message))}))})),r=n.session;if(r){const e=eS(r.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:e),this.setAccounts(e),this.events.emit("connect",{chainId:zA(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",(e=>{const{params:t}=e,{event:n}=t;"accountsChanged"===n.name?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===n.name?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)})),this.signer.on("chainChanged",(e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",zA(this.chainId)),this.persist()})),this.signer.on("session_update",(e=>{this.events.emit("session_update",e)})),this.signer.on("session_delete",(e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",VA(FA({},nS("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))})),this.signer.on("display_uri",(e=>{var t,n;this.rpc.showQrModal&&(null==(t=this.modal)||t.closeModal(),null==(n=this.modal)||n.openModal({uri:e})),this.events.emit("display_uri",e)}))}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return"string"==typeof e&&e.startsWith(`${this.namespace}:`)}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter((e=>this.isCompatibleChainId(e))).map((e=>this.parseChainId(e)));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",zA(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,n,r]=e.split(":");return{chainId:`${t}:${n}`,address:r}}setAccounts(e){this.accounts=e.filter((e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId)).map((e=>this.parseAccountId(e).address)),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,n;const r=null!=(t=e?.chains)?t:[],i=null!=(n=e?.optionalChains)?n:[],o=r.concat(i);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const s=r.length?e?.methods||TA:[],a=r.length?e?.events||PA:[],c=e?.optionalMethods||[],u=e?.optionalEvents||[],l=e?.rpcMap||this.buildRpcMap(o,e.projectId),d=e?.qrModalOptions||void 0;return{chains:r?.map((e=>this.formatChainId(e))),optionalChains:i.map((e=>this.formatChainId(e))),methods:s,events:a,optionalMethods:c,optionalEvents:u,rpcMap:l,showQrModal:!(null==e||!e.showQrModal),qrModalOptions:d,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach((e=>{n[e]=this.getRpcUrl(e,t)})),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?qA(this.rpc.chains):qA(this.rpc.optionalChains),this.signer=await kA.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:t}=await n.e(343).then(n.bind(n,59343));e=t}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(FA({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(t){throw this.signer.logger.error(t),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:n,rpcMap:r}=e;t&&rS(t)&&(this.rpc.chains=t.map((e=>this.formatChainId(e))),t.forEach((e=>{this.rpc.rpcMap[e]=r?.[e]||this.getRpcUrl(e)}))),n&&rS(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n?.map((e=>this.formatChainId(e))),n.forEach((e=>{this.rpc.rpcMap[e]=r?.[e]||this.getRpcUrl(e)})))}getRpcUrl(e,t){var n;return(null==(n=this.rpc.rpcMap)?void 0:n[e])||`https://rpc.walletconnect.org/v1/?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}catch(aM){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(aM),await this.disconnect().catch((e=>this.signer.logger.warn(e)))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return"string"==typeof e||e instanceof String?[this.parseAccount(e)]:e.map((e=>this.parseAccount(e)))}}const WA=HA;function GA(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var ZA=function(e){L(n,e);var t=GA(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;othis.data(e,!0))),type:AE.allowNull(a),accessList:AE.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:t,topics:AE.arrayOf(o),data:i,logIndex:a,blockHash:o},e.receipt={to:AE.allowNull(this.address,null),from:AE.allowNull(this.address,null),contractAddress:AE.allowNull(t,null),transactionIndex:a,root:AE.allowNull(s),gasUsed:n,logsBloom:AE.allowNull(i),blockHash:o,transactionHash:o,logs:AE.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:AE.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:AE.allowNull(n),status:AE.allowNull(a),type:c},e.block={hash:AE.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:AE.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:AE.allowNull(t),extraData:i,transactions:AE.allowNull(AE.arrayOf(o)),baseFeePerGas:AE.allowNull(n)},e.blockWithTransactions=(0,JA.shallowCopy)(e.block),e.blockWithTransactions.transactions=AE.allowNull(AE.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:AE.allowNull(r,void 0),toBlock:AE.allowNull(r,void 0),blockHash:AE.allowNull(o,void 0),address:AE.allowNull(t,void 0),topics:AE.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:AE.allowNull(a),blockHash:AE.allowNull(o),transactionIndex:a,removed:AE.allowNull(this.boolean.bind(this)),address:t,data:AE.allowFalsish(i,"0x"),topics:AE.arrayOf(o),transactionHash:o,logIndex:a},e}accessList(e){return(0,ch.accessListify)(e||[])}number(e){return"0x"===e?0:tE.O$.from(e).toNumber()}type(e){return"0x"===e||null==e?0:tE.O$.from(e).toNumber()}bigNumber(e){return tE.O$.from(e)}boolean(e){if("boolean"===typeof e)return e;if("string"===typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"===typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),(0,nE.isHexString)(e))?e.toLowerCase():SE.throwArgumentError("invalid hash","value",e)}data(e,t){const n=this.hex(e,t);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return(0,xE.getAddress)(e)}callAddress(e){if(!(0,nE.isHexString)(e,32))return null;const t=(0,xE.getAddress)((0,nE.hexDataSlice)(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return(0,xE.getContractAddress)(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"===typeof e||(0,nE.isHexString)(e))return(0,nE.hexValue)(e);throw new Error("invalid blockTag")}hash(e,t){const n=this.hex(e,t);return 32!==(0,nE.hexDataLength)(n)?SE.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(null==e)return null;const t=tE.O$.from(e);try{return t.toNumber()}catch(n){}return null}uint256(e){if(!(0,nE.isHexString)(e))throw new Error("invalid uint256");return(0,nE.hexZeroPad)(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const n=null!=e._difficulty?e._difficulty:e.difficulty,r=AE.check(t,e);return r._difficulty=null==n?null:tE.O$.from(n),r}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return AE.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&tE.O$.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=AE.check(this.formats.transaction,e);if(null!=e.chainId){let n=e.chainId;(0,nE.isHexString)(n)&&(n=tE.O$.from(n).toNumber()),t.chainId=n}else{let n=e.networkId;null==n&&null==t.v&&(n=e.chainId),(0,nE.isHexString)(n)&&(n=tE.O$.from(n).toNumber()),"number"!==typeof n&&null!=t.v&&(n=(t.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!==typeof n&&(n=0),t.chainId=n}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return(0,ch.parse)(e)}receiptLog(e){return AE.check(this.formats.receiptLog,e)}receipt(e){const t=AE.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=tE.O$.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&SE.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):SE.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&SE.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return AE.check(this.formats.filter,e)}filterLog(e){return AE.check(this.formats.filterLog,e)}static check(e,t){const n={};for(const i in e)try{const r=e[i](t[i]);void 0!==r&&(n[i]=r)}catch(r){throw r.checkKey=i,r.checkValue=t[i],r}return n}static allowNull(e,t){return function(n){return null==n?t:e(n)}}static allowFalsish(e,t){return function(n){return n?e(n):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const n=[];return t.forEach((function(t){n.push(e(t))})),n}}}var EE=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const _E=new QA.Logger($A);function CE(e){return null==e?"null":(32!==(0,nE.hexDataLength)(e)&&_E.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function IE(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[CE(e)]=!0}));const n=Object.keys(t);return n.sort(),n.join("|")}return CE(e)})).join("&")}function kE(e){if("string"===typeof e){if(e=e.toLowerCase(),32===(0,nE.hexDataLength)(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+IE(e);if(sE.Sg.isForkEvent(e))throw _E.warn("not implemented"),new Error("not implemented");if(e&&"object"===typeof e)return"filter:"+(e.address||"*")+":"+IE(e.topics||[])}throw new Error("invalid event - "+e)}function TE(){return(new Date).getTime()}function ME(e){return new Promise((t=>{setTimeout(t,e)}))}const PE=["block","network","pending","poll"];class OE{constructor(e,t,n){(0,JA.defineReadOnly)(this,"tag",e),(0,JA.defineReadOnly)(this,"listener",t),(0,JA.defineReadOnly)(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],n=""===(r=e[2])?[]:r.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var r;const i={};return n.length>0&&(i.topics=n),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||PE.indexOf(this.tag)>=0}}const RE={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function NE(e){return(0,nE.hexZeroPad)(tE.O$.from(e).toHexString(),32)}function BE(e){return cE.Base58.encode((0,nE.concat)([e,(0,nE.hexDataSlice)((0,yE.JQ)((0,yE.JQ)(e)),0,4)]))}const LE=new RegExp("^(ipfs)://(.*)$","i"),DE=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),LE,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function UE(e,t){try{return(0,iE.ZN)(jE(e,t))}catch(n){}return null}function jE(e,t){if("0x"===e)return null;const n=tE.O$.from((0,nE.hexDataSlice)(e,t,t+32)).toNumber(),r=tE.O$.from((0,nE.hexDataSlice)(e,n,n+32)).toNumber();return(0,nE.hexDataSlice)(e,n+32,n+32+r)}function FE(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):_E.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function VE(e){const t=(0,nE.arrayify)(e);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function qE(e){if(e.length%32===0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function zE(e){const t=[];let n=0;for(let r=0;rtE.O$.from(e).eq(1))).catch((e=>{if(e.code===QA.Logger.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return EE(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:(0,nE.hexConcat)([e,(0,lE.VM)(this.name),t||"0x"])};let r=!1;(yield this.supportsWildcard())&&(r=!0,n.data=(0,nE.hexConcat)(["0x9061b923",zE([(0,lE.Kn)(this.name),n.data])]));try{let e=yield this.provider.call(n);return(0,nE.arrayify)(e).length%32===4&&_E.throwError("resolver threw error",QA.Logger.errors.CALL_EXCEPTION,{transaction:n,data:e}),r&&(e=jE(e,0)),e}catch(i){if(i.code===QA.Logger.errors.CALL_EXCEPTION)return null;throw i}}))}_fetchBytes(e,t){return EE(this,void 0,void 0,(function*(){const n=yield this._fetch(e,t);return null!=n?jE(n,0):null}))}_getAddress(e,t){const n=RE[String(e)];if(null==n&&_E.throwError(`unsupported coin type: ${e}`,QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===n.ilk)return this.provider.formatter.address(t);const r=(0,nE.arrayify)(t);if(null!=n.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return BE((0,nE.concat)([[n.p2pkh],"0x"+e[2]]))}}if(null!=n.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return BE((0,nE.concat)([[n.p2sh],"0x"+e[2]]))}}if(null!=n.prefix){const e=r[1];let t=r[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&r.length===2+e&&e>=1&&e<=75){const e=wE().toWords(r.slice(2));return e.unshift(t),wE().encode(n.prefix,e)}}return null}getAddress(e){return EE(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||e===uE.R?null:this.provider.formatter.callAddress(e)}catch(r){if(r.code===QA.Logger.errors.CALL_EXCEPTION)return null;throw r}const t=yield this._fetchBytes("0xf1cb7e06",NE(e));if(null==t||"0x"===t)return null;const n=this._getAddress(e,t);return null==n&&_E.throwError("invalid or unsupported coin data",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),n}))}getAvatar(){return EE(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let n=0;ne[t]));return"sia://"+t}return _E.throwError("invalid or unsupported content hash data",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return EE(this,void 0,void 0,(function*(){let t=(0,iE.Y0)(e);t=(0,nE.concat)([NE(64),NE(t.length),t]),t.length%32!==0&&(t=(0,nE.concat)([t,(0,nE.hexZeroPad)("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",(0,nE.hexlify)(t));return null==n||"0x"===n?null:(0,iE.ZN)(n)}))}}let WE=null,GE=1;class ZE extends sE.zt{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),(0,JA.defineReadOnly)(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=(0,JA.getStatic)(new.target,"getNetwork")(e);t?((0,JA.defineReadOnly)(this,"_network",t),this.emit("network",t,null)):_E.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return EE(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(e){}null==t&&(t=yield this.detectNetwork()),t||_E.throwError("no network detected",QA.Logger.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:(0,JA.defineReadOnly)(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return(0,oE.poll)((()=>this._ready().then((e=>e),(e=>{if(e.code!==QA.Logger.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==WE&&(WE=new AE),WE}static getNetwork(e){return function(e){if(null==e)return null;if("number"===typeof e){for(const t in bE){const n=bE[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"===typeof e){const t=bE[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=bE[e.name];if(!t)return"number"!==typeof e.chainId&&dE.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&dE.throwArgumentError("network chainId mismatch","network",e);let n=e._defaultProvider||null;return null==n&&t._defaultProvider&&(n=function(e){return e&&"function"===typeof e.renetwork}(t._defaultProvider)?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:n}}(null==e?"homestead":e)}ccipReadFetch(e,t,n){return EE(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let e=0;e=0?null:JSON.stringify({data:i,sender:r}),c=yield(0,oE.fetchJson)({url:s,errorPassThrough:!0},a,((e,t)=>(e.status=t.statusCode,e)));if(c.data)return c.data;const u=c.message||"unknown error";if(c.status>=400&&c.status<500)return _E.throwError(`response not found during CCIP fetch: ${u}`,QA.Logger.errors.SERVER_ERROR,{url:t,errorMessage:u});o.push(u)}return _E.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,QA.Logger.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(e){return EE(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const n=yield t;if(TE()-n.respTime<=e)return n.blockNumber;break}catch(r){if(this._internalBlockNumber===t)break}}const t=TE(),n=(0,JA.resolveProperties)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=TE();return(e=tE.O$.from(e).toNumber()){this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return EE(this,void 0,void 0,(function*(){const e=GE++,t=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(r){return void this.emit("error",r)}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)_E.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",_E.makeError("network block skew detected",QA.Logger.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let e=this._emitted.block+1;e<=n;e++)this.emit("block",e);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&n-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((e=>{switch(e.type){case"tx":{const n=e.hash;let r=this.getTransactionReceipt(n).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+n]=e.blockNumber,this.emit(n,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(r);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);const r=e.filter;r.fromBlock=e._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const o=this.getLogs(r).then((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(r,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(o)}}})),this._lastBlockNumber=n,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return EE(this,void 0,void 0,(function*(){return _E.throwError("provider does not support network detection",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return EE(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield ME(0),this._network;const n=_E.makeError("underlying network changed",QA.Logger.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",n),n}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!==typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=TE();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,n){return EE(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,n||0,null)}))}_waitForTransaction(e,t,n,r){return EE(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,o)=>{const s=[];let a=!1;const c=function(){return!!a||(a=!0,s.forEach((e=>{e()})),!1)},u=e=>{e.confirmations{this.removeListener(e,u)})),r){let n=r.startBlock,i=null;const u=s=>EE(this,void 0,void 0,(function*(){a||(yield ME(1e3),this.getTransactionCount(r.from).then((l=>EE(this,void 0,void 0,(function*(){if(!a){if(l<=r.nonce)n=s;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=n-3,i{a||this.once("block",u)})))}));if(a)return;this.once("block",u),s.push((()=>{this.removeListener("block",u)}))}if("number"===typeof n&&n>0){const e=setTimeout((()=>{c()||o(_E.makeError("timeout exceeded",QA.Logger.errors.TIMEOUT,{timeout:n}))}),n);e.unref&&e.unref(),s.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return EE(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return tE.O$.from(e)}catch(t){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,JA.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getBalance",n);try{return tE.O$.from(r)}catch(i){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:i})}}))}getTransactionCount(e,t){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,JA.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getTransactionCount",n);try{return tE.O$.from(r).toNumber()}catch(i){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:i})}}))}getCode(e,t){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,JA.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getCode",n);try{return(0,nE.hexlify)(r)}catch(i){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:i})}}))}getStorageAt(e,t,n){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,JA.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(t).then((e=>(0,nE.hexValue)(e)))}),i=yield this.perform("getStorageAt",r);try{return(0,nE.hexlify)(i)}catch(o){return _E.throwError("bad result from backend",QA.Logger.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:o})}}))}_wrapTransaction(e,t,n){if(null!=t&&32!==(0,nE.hexDataLength)(t))throw new Error("invalid response - sendTransaction");const r=e;return null!=t&&e.hash!==t&&_E.throwError("Transaction hash mismatch from Provider.sendTransaction.",QA.Logger.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),r.wait=(t,r)=>EE(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==r&&(r=0),0!==t&&null!=n&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const o=yield this._waitForTransaction(e.hash,t,r,i);return null==o&&0===t?null:(this._emitted["t:"+e.hash]=o.blockNumber,0===o.status&&_E.throwError("transaction failed",QA.Logger.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),r}sendTransaction(e){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>(0,nE.hexlify)(e))),n=this.formatter.transaction(e);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(n,e,r)}catch(i){throw i.transaction=n,i.transactionHash=n.hash,i}}))}_getTransactionRequest(e){return EE(this,void 0,void 0,(function*(){const t=yield e,n={};return["from","to"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?tE.O$.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(n.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?(0,nE.hexlify)(e):null)))})),this.formatter.transactionRequest(yield(0,JA.resolveProperties)(n))}))}_getFilter(e){return EE(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((n=>{null!=e[n]&&(t[n]=e[n])})),["fromBlock","toBlock"].forEach((n=>{null!=e[n]&&(t[n]=this._getBlockTag(e[n]))})),this.formatter.filter(yield(0,JA.resolveProperties)(t))}))}_call(e,t,n){return EE(this,void 0,void 0,(function*(){n>=10&&_E.throwError("CCIP read exceeded maximum redirections",QA.Logger.errors.SERVER_ERROR,{redirects:n,transaction:e});const r=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(n>=0&&"latest"===t&&null!=r&&"0x556f1830"===i.substring(0,10)&&(0,nE.hexDataLength)(i)%32===4)try{const o=(0,nE.hexDataSlice)(i,4),s=(0,nE.hexDataSlice)(o,0,32);tE.O$.from(s).eq(r)||_E.throwError("CCIP Read sender did not match",QA.Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],c=tE.O$.from((0,nE.hexDataSlice)(o,32,64)).toNumber(),u=tE.O$.from((0,nE.hexDataSlice)(o,c,c+32)).toNumber(),l=(0,nE.hexDataSlice)(o,c+32);for(let t=0;tEE(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",r);if(null==e)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(t){let t=null;for(let r=0;rthis._wrapTransaction(e))),n}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return EE(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return(0,oE.poll)((()=>EE(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(e){return EE(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return(0,oE.poll)((()=>EE(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return r}))),{oncePoll:this})}))}getLogs(e){return EE(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield(0,JA.resolveProperties)({filter:this._getFilter(e)}),n=yield this.perform("getLogs",t);return n.forEach((e=>{null==e.removed&&(e.removed=!1)})),AE.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return EE(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return EE(this,void 0,void 0,(function*(){if("number"===typeof(e=yield e)&&e<0){e%1&&_E.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return EE(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const n=yield this._getResolver(t,"getResolver");if(null!=n){const r=new HE(this,n,e);return t===e||(yield r.supportsWildcard())?r:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return EE(this,void 0,void 0,(function*(){null==t&&(t="ENS");const n=yield this.getNetwork();n.ensAddress||_E.throwError("network does not support ENS",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:t,network:n.name});try{const t=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+(0,lE.VM)(e).substring(2)});return this.formatter.callAddress(t)}catch(r){}return null}))}resolveName(e){return EE(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if((0,nE.isHexString)(e))throw n}"string"!==typeof e&&_E.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return EE(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(t,"lookupAddress");if(null==n)return null;const r=UE(yield this.call({to:n,data:"0x691f3431"+(0,lE.VM)(t).substring(2)}),0);return(yield this.resolveName(r))!=e?null:r}))}getAvatar(e){return EE(this,void 0,void 0,(function*(){let t=null;if((0,nE.isHexString)(e)){const n=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(n,"getAvatar");if(!i)return null;t=new HE(this,i,n);try{const e=yield t.getAvatar();if(e)return e.url}catch(r){if(r.code!==QA.Logger.errors.CALL_EXCEPTION)throw r}try{const e=UE(yield this.call({to:i,data:"0x691f3431"+(0,lE.VM)(n).substring(2)}),0);t=yield this.getResolver(e)}catch(r){if(r.code!==QA.Logger.errors.CALL_EXCEPTION)throw r;return null}}else if(t=yield this.getResolver(e),!t)return null;const n=yield t.getAvatar();return null==n?null:n.url}))}perform(e,t){return _E.throwError(e+" not implemented",QA.Logger.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,n){const r=new OE(kE(e),t,n);return this._events.push(r),this._startEvent(r),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let n=!1,r=[],i=kE(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),n=!0,!e.once||(r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),n}listenerCount(e){if(!e)return this._events.length;let t=kE(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=kE(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const n=[];let r=!1,i=kE(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!r||(r=!0,n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const n=kE(e);this._events=this._events.filter((e=>e.tag!==n||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var KE=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const XE=new QA.Logger($A),YE=["call","estimateGas"];function JE(e,t){if(null==e)return null;if("string"===typeof e.message&&e.message.match("reverted")){const n=(0,nE.isHexString)(e.data)?e.data:null;if(!t||n)return{message:e.message,data:n}}if("object"===typeof e){for(const n in e){const r=JE(e[n],t);if(r)return r}return null}if("string"===typeof e)try{return JE(JSON.parse(e),t)}catch(n){}return null}function QE(e,t,n){const r=n.transaction||n.signedTransaction;if("call"===e){const e=JE(t,!0);if(e)return e.data;XE.throwError("missing revert data in call exception; Transaction reverted without a reason string",QA.Logger.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:t})}if("estimateGas"===e){let n=JE(t.body,!1);null==n&&(n=JE(t,!1)),n&&XE.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",QA.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:e,transaction:r,error:t})}let i=t.message;throw t.code===QA.Logger.errors.SERVER_ERROR&&t.error&&"string"===typeof t.error.message?i=t.error.message:"string"===typeof t.body?i=t.body:"string"===typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&XE.throwError("insufficient funds for intrinsic transaction cost",QA.Logger.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/nonce (is )?too low/i)&&XE.throwError("nonce has already been used",QA.Logger.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&XE.throwError("replacement fee too low",QA.Logger.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/only replay-protected/i)&&XE.throwError("legacy pre-eip-155 transactions not supported",QA.Logger.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:r}),YE.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&XE.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",QA.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}function $E(e){return new Promise((function(t){setTimeout(t,e)}))}function e_(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function t_(e){return e?e.toLowerCase():e}const n_={};class r_ extends eE.E{constructor(e,t,n){if(super(),e!==n_)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,JA.defineReadOnly)(this,"provider",t),null==n&&(n=0),"string"===typeof n?((0,JA.defineReadOnly)(this,"_address",this.provider.formatter.address(n)),(0,JA.defineReadOnly)(this,"_index",null)):"number"===typeof n?((0,JA.defineReadOnly)(this,"_index",n),(0,JA.defineReadOnly)(this,"_address",null)):XE.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return XE.throwError("cannot alter JSON-RPC Signer connection",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new i_(n_,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&XE.throwError("unknown account #"+this._index,QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=(0,JA.shallowCopy)(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const n=(0,JA.shallowCopy)(e);n.from=t,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>KE(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&XE.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),(0,JA.resolveProperties)({tx:(0,JA.resolveProperties)(e),sender:t}).then((({tx:t,sender:n})=>{null!=t.from?t.from.toLowerCase()!==n&&XE.throwArgumentError("from address mismatch","transaction",e):t.from=n;const r=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((e=>e),(e=>("string"===typeof e.message&&e.message.match(/user denied/i)&&XE.throwError("user rejected transaction",QA.Logger.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),QE("sendTransaction",e,r))))}))}signTransaction(e){return XE.throwError("signing transactions is unsupported",QA.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return KE(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield(0,oE.poll)((()=>KE(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(n);if(null!==e)return this.provider._wrapTransaction(e,n,t)}))),{oncePoll:this.provider})}catch(r){throw r.transactionHash=n,r}}))}signMessage(e){return KE(this,void 0,void 0,(function*(){const t="string"===typeof e?(0,iE.Y0)(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[(0,nE.hexlify)(t),n.toLowerCase()])}catch(r){throw"string"===typeof r.message&&r.message.match(/user denied/i)&&XE.throwError("user rejected signing",QA.Logger.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),r}}))}_legacySignMessage(e){return KE(this,void 0,void 0,(function*(){const t="string"===typeof e?(0,iE.Y0)(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),(0,nE.hexlify)(t)])}catch(r){throw"string"===typeof r.message&&r.message.match(/user denied/i)&&XE.throwError("user rejected signing",QA.Logger.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),r}}))}_signTypedData(e,t,n){return KE(this,void 0,void 0,(function*(){const r=yield rE.E.resolveNames(e,t,n,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(rE.E.getPayload(r.domain,t,r.value))])}catch(o){throw"string"===typeof o.message&&o.message.match(/user denied/i)&&XE.throwError("user rejected signing",QA.Logger.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:t,value:r.value}}),o}}))}unlock(e){return KE(this,void 0,void 0,(function*(){const t=this.provider,n=yield this.getAddress();return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])}))}}class i_ extends r_{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const o_={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class s_ extends ZE{constructor(e,t){let n=t;null==n&&(n=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(n),e||(e=(0,JA.getStatic)(this.constructor,"defaultUrl")()),"string"===typeof e?(0,JA.defineReadOnly)(this,"connection",Object.freeze({url:e})):(0,JA.defineReadOnly)(this,"connection",Object.freeze((0,JA.shallowCopy)(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return KE(this,void 0,void 0,(function*(){yield $E(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(t){}}if(null!=e){const n=(0,JA.getStatic)(this.constructor,"getNetwork");try{return n(tE.O$.from(e).toNumber())}catch(t){return XE.throwError("could not detect network",QA.Logger.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return XE.throwError("could not detect network",QA.Logger.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new r_(n_,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,JA.deepCopy)(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const i=(0,oE.fetchJson)(this.connection,JSON.stringify(n),e_).then((e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e}));return r&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[t_(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[t_(t.address),t.blockTag]];case"getCode":return["eth_getCode",[t_(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[t_(t.address),(0,nE.hexZeroPad)(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[(0,JA.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,JA.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=t_(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return KE(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&tE.O$.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((t=(0,JA.shallowCopy)(t)).transaction=(0,JA.shallowCopy)(e),delete t.transaction.type)}}const n=this.prepareRequest(e,t);null==n&&XE.throwError(e+" not implemented",QA.Logger.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(r){return QE(e,r,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function r(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;let r=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",r=r.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),r.then((function(){return $E(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){r()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((e=>{}))}(),n})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const n=(0,JA.shallowCopy)(o_);if(t)for(const i in t)t[i]&&(n[i]=!0);(0,JA.checkProperties)(e,n);const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const n=(0,nE.hexValue)(tE.O$.from(e[t]));"gasLimit"===t&&(t="gas"),r[t]=n})),["from","to","data"].forEach((function(t){null!=e[t]&&(r[t]=(0,nE.hexlify)(e[t]))})),e.accessList&&(r.accessList=(0,ch.accessListify)(e.accessList)),r}}const a_=new QA.Logger($A);let c_=1;function u_(e,t){const n="Web3LegacyFetcher";return function(e,r){const i={method:e,params:r,id:c_++,jsonrpc:"2.0"};return new Promise(((e,r)=>{this.emit("debug",{action:"request",fetcher:n,request:(0,JA.deepCopy)(i),provider:this}),t(i,((t,o)=>{if(t)return this.emit("debug",{action:"response",fetcher:n,error:t,request:i,provider:this}),r(t);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const e=new Error(o.error.message);return e.code=o.error.code,e.data=o.error.data,r(e)}e(o.result)}))}))}}class l_ extends s_{constructor(e,t){null==e&&a_.throwArgumentError("missing provider","provider",e);let n=null,r=null,i=null;"function"===typeof e?(n="unknown:",r=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),i=e,e.request?(""===n&&(n="eip-1193:"),r=function(e){return function(t,n){null==n&&(n=[]);const r={method:t,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,JA.deepCopy)(r),provider:this}),e.request(r).then((e=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:e,provider:this}),e}))}}(e)):e.sendAsync?r=u_(0,e.sendAsync.bind(e)):e.send?r=u_(0,e.send.bind(e)):a_.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,t),(0,JA.defineReadOnly)(this,"jsonRpcFetchFunc",r),(0,JA.defineReadOnly)(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}function d_(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var f_=function(e){L(n,e);var t=d_(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o{t=e})).catch(console.error),()=>{t&&h_("pub(accounts.unsubscribe)",{id:t}).catch(console.error)}}}class m_{constructor(e){p_=e}get(){return p_("pub(metadata.list)")}provide(e){return p_("pub(metadata.provide)",e)}}var b_=n(64992),y_=n(98278),v_=n(26729);const w_=(0,b_.k)("PostMessageProvider");let x_,S_;class A_{#e;#t=!1;#n={};constructor(e){this.#e=new v_,x_=e}get isClonable(){return!0}clone(){return new A_(x_)}async connect(){console.error("PostMessageProvider.disconnect() is not implemented.")}async disconnect(){console.error("PostMessageProvider.disconnect() is not implemented.")}get hasSubscriptions(){return!0}get isConnected(){return this.#t}listProviders(){return x_("pub(rpc.listProviders)",void 0)}on(e,t){return this.#e.on(e,t),()=>{this.#e.removeListener(e,t)}}async send(e,t,n,r){if(r){const{callback:n,type:i}=r,o=await x_("pub(rpc.subscribe)",{method:e,params:t,type:i},(e=>{r.callback(null,e)}));return this.#n[`${i}::${o}`]=n,o}return x_("pub(rpc.send)",{method:e,params:t})}async startProvider(e){this.#t=!1,this.#e.emit("disconnected");const t=await x_("pub(rpc.startProvider)",e);return x_("pub(rpc.subscribeConnected)",null,(e=>(this.#t=e,e?this.#e.emit("connected"):this.#e.emit("disconnected"),!0))),t}subscribe(e,t,n,r){return this.send(t,n,!1,{callback:r,type:e})}async unsubscribe(e,t,n){const r=`${e}::${n}`;return(0,y_.o)(this.#n[r])?(w_.debug((()=>`Unable to find active subscription=${r}`)),!1):(delete this.#n[r],this.send(t,[n]))}}let E_=0;class __{constructor(e){S_=e}async signPayload(e){const t=++E_;return{...await S_("pub(extrinsic.sign)",e),id:t}}async signRaw(e){const t=++E_;return{...await S_("pub(bytes.sign)",e),id:t}}}let C_=0;const I_={};function k_(e,t,n){if(self===parent)throw new Error("Please open on mimir wallet");return new Promise(((r,i)=>{const o=`mimir-wallet.${Date.now()}.${++C_}`;I_[o]={reject:i,resolve:r,subscriber:n};const s={id:o,message:e,origin:"mimir-walletdapp",request:t||null};parent.postMessage(s,"*")}))}async function T_(e){return await k_("pub(authorize.tab)",{origin:e}),new class{constructor(e){this.accounts=new g_(e),this.metadata=new m_(e),this.provider=new A_(e),this.signer=new __(e),setInterval((()=>{e("pub(ping)",null).catch((()=>{console.error("Extension unavailable, ping failed")}))}),1e4+Math.floor(1e4*Math.random()))}}(k_)}function M_({data:e,source:t},n=null){const r=!e,i=t===parent;let o=!0;return Array.isArray(n)&&(o=void 0!==n.find((e=>e.test(origin)))),!r&&i&&o&&"mimir-walletwallet"===e.origin}const P_="0.2.1";function O_(){self!==parent&&(window.addEventListener("message",(e=>{if(M_(e)){const{data:t}=e;t.id?function(e){const t=I_[e.id];t?(t.subscriber||delete I_[e.id],e.subscription?t.subscriber(e.subscription):e.error?t.reject(new Error(e.error)):t.resolve(e.response)):console.error(`Unknown response: ${JSON.stringify(e)}`)}(t):console.error("Missing id for response.")}})),function(e,{name:t,version:n}){const r=window;r.injectedWeb3=r.injectedWeb3||{},r.injectedWeb3[t]={enable:t=>e(t),version:n}}(T_,{name:"mimir",version:P_}))}const R_=/^https:\/\/.*\.mimir\.global.*$/;var N_=n(51787);function B_(e){return e&&function(e){return!!e&&(0,N_.vq)(e,-1)}(e)?e:`0x${e&&e.length%2===1?"0":""}${e||""}`}var L_=n(39411);function D_(e,t=-1){const n=(!e||Number.isNaN(e)?0:e).toString(16);return function(e,t=-1,n=!1){const r=Math.ceil(t/4),i=r+2;return B_(-1===t||e.length===i||!n&&e.lengthi?(0,L_.V)(e).slice(-1*r):`${"0".repeat(r)}${(0,L_.V)(e)}`.slice(-1*r))}(n.length%2?`0${n}`:n,t,!0)}var U_=n(249),j_=n(65716),F_=n(53836),V_=n(5442);const q_=(0,j_.Y)("\x19Ethereum Signed Message:\n"),z_=(0,j_.Y)(""),H_=(0,j_.Y)(""),W_=z_.length+H_.length;function G_(e,t){return e.length>=W_&&(0,V_.S)(e.subarray(0,z_.length),z_)&&(0,V_.S)(e.slice(-H_.length),H_)||t&&e.length>=q_.length&&(0,V_.S)(e.subarray(0,q_.length),q_)}var Z_=n(89048),K_=n(50780),X_=n(87286);function Y_(e,t,n,r){const i=(0,j_.Y)(e),o=(0,j_.Y)(n),s=(0,j_.Y)(t);if(32!==o.length)throw new Error(`Invalid publicKey, received ${o.length}, expected 32`);if(64!==s.length)throw new Error(`Invalid signature, received ${s.length} bytes, expected 64`);return!r&&(0,X_.DK)()?(0,X_.B8)(s,i,o):K_.sign.detached.verify(i,s,o)}var J_=n(63848),Q_=n(20086);function $_(e,t,n){return"keccak"===e?(0,Q_.ij)(t,void 0,n):(0,J_.b)(t,void 0,void 0,n)}var eC=n(27760),tC=n(98657);var nC=n(94019);function rC(e,t,n,r="blake2",i){const o=(0,j_.Y)(t).subarray(0,64),s=(0,j_.Y)(e),a=!tC.vc||!i&&(0,X_.DK)()?(0,X_.WH)(s,o,n):(0,eC.LO)(s,eC.Pc.fromCompact(o).toRawBytes(),n);if(!a)throw new Error("Unable to recover publicKey from signature");return"keccak"===r?(0,nC.o)(a,i):function(e,t){if(33===e.length)return e;if(65!==e.length)throw new Error("Invalid publicKey provided");return!tC.vc||!t&&(0,X_.DK)()?(0,X_.RI)(e):eC.E9.fromHex(e).toRawBytes(!0)}(a,i)}function iC(e,t,n){const r=(0,j_.Y)(n),i=(0,j_.Y)(t);if(32!==r.length)throw new Error(`Invalid publicKey, received ${r.length} bytes, expected 32`);if(64!==i.length)throw new Error(`Invalid signature, received ${i.length} bytes, expected 64`);return(0,X_.QK)(i,(0,j_.Y)(e),r)}const oC=e=>(t,n,r)=>function(e,t,n,r="blake2",i){const o=(0,j_.Y)(t);if(65!==o.length)throw new Error(`Expected signature with 65 bytes, ${o.length} found instead`);const s=rC($_(r,e),o,o[64],r,i),a=$_(r,s,i),c=(0,j_.Y)(n);return(0,V_.S)(s,c)||("keccak"===r?(0,V_.S)(a.slice(-20),c.slice(-20)):(0,V_.S)(a,c))}(t,n,r,e),sC=[["ecdsa",oC("blake2")],["ethereum",oC("keccak")]],aC=[["ed25519",Y_],["sr25519",iC],...sC],cC=["ed25519","sr25519","ecdsa"];function uC(e,{message:t,publicKey:n,signature:r},i=aC){return e.isValid=i.some((([i,o])=>{try{if(o(t,r,n))return e.crypto=i,!0}catch(s){}return!1})),e}function lC(e,{message:t,publicKey:n,signature:r}){if(![0,1,2].includes(r[0]))throw new Error(`Unknown crypto type, expected signature prefix [0..2], found ${r[0]}`);const i=cC[r[0]]||"none";e.crypto=i;try{e.isValid={ecdsa:()=>uC(e,{message:t,publicKey:n,signature:r.subarray(1)},sC).isValid,ed25519:()=>Y_(t,r.subarray(1),n),none:()=>{throw Error("no verify for `none` crypto type")},sr25519:()=>iC(t,r.subarray(1),n)}[i]()}catch(o){}return e}function dC(e,t,n){const r=(0,j_.Y)(t);if(![64,65,66].includes(r.length))throw new Error(`Invalid signature length, expected [64..66] bytes, found ${r.length}`);const i=(0,Z_.m)(n),o={message:(0,j_.Y)(e),publicKey:i,signature:r},s={crypto:"none",isValid:!1,isWrapped:G_(o.message,!0),publicKey:i},a=G_(o.message,!1),c=function(e){return[0,1,2].includes(e[0])&&[65,66].includes(e.length)?lC:uC}(r);return c(s,o),"none"!==s.crypto||s.isWrapped&&!a?s:(o.message=a?function(e){const t=(0,j_.Y)(e);return G_(t,!1)?t.subarray(z_.length,t.length-H_.length):t}(o.message):function(e){const t=(0,j_.Y)(e);return G_(t,!0)?t:(0,F_.d)([z_,t,H_])}(o.message),c(s,o))}var fC=n(5320);function hC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pC(e){for(var t=1;t{if(self===parent)return void e(null);const t=n=>{M_(n)&&(e(n.origin),window.removeEventListener("message",t))};window.addEventListener("message",t),k_("pub(ping)",null)})),new Promise((e=>setTimeout((()=>e(null)),300)))]);case 7:i=e.sent,console.info("initMimir:origin",i),i&&R_.test(i)&&(O_(),this.provider=window.injectedWeb3.mimir,console.info("inject:",window.injectedWeb3));case 10:return this.isInit=!0,e.next=13,N(R(n.prototype),"init",this).call(this,t);case 13:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"fetchAccounts",value:function(){var e=(0,w.Z)(A().mark((function e(){var t;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.enable();case 3:return e.next=5,this.wallet.accounts.get(!0);case 5:return t=e.sent,e.abrupt("return",t.map((function(e){return e.address})));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",[]);case 12:case"end":return e.stop()}}),e,this,[[0,9]])})));return function(){return e.apply(this,arguments)}}()},{key:"connect",value:function(){var e=(0,w.Z)(A().mark((function e(){var t;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isConnected){e.next=10;break}if(this.provider){e.next=5;break}window.open("https://app.mimir.global","_blank"),e.next=10;break;case 5:return e.next=7,this.fetchAccounts();case 7:t=e.sent,this.account=t[0],this.isConnected=!0;case 10:return e.abrupt("return",{account:this.account,wallet:"mimir"});case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"enable",value:function(){var e=(0,w.Z)(A().mark((function e(){var t;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.provider.enable("crust files");case 3:if(t=e.sent,console.info("mimir:enable",t),t){e.next=7;break}return e.abrupt("return",!1);case 7:return this.wallet=pC(pC({},t),{},{name:"mimir",version:this.provider.version}),e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(0),console.error("mimir:",e.t0),e.abrupt("return",!1);case 15:case"end":return e.stop()}}),e,this,[[0,11]])})));return function(){return e.apply(this,arguments)}}()},{key:"sign",value:function(){var e=(0,w.Z)(A().mark((function e(t,n){var r,i,o,s,a,c,u,l,d,f,h,p,g;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.provider){e.next=2;break}throw"Error: no wallet";case 2:if(this.wallet.signer){e.next=4;break}throw"Error: wallet error no signer";case 4:return e.next=6,(0,fC.o)();case 6:return r=e.sent,e.next=9,this.fetchAccounts();case 9:return i=e.sent,o=n||i[0],s=r.tx.system.remark("Signature for CrustFiles"),e.next=14,mC(r,o);case 14:return a=e.sent,c=a.signOptions,e.next=18,this.wallet.signer.signPayload({address:o,blockHash:c.blockHash,genesisHash:c.genesisHash,blockNumber:"0x0",era:c.era.toHex(),method:s.inner.method.toHex(),nonce:c.nonce.toHex(),tip:D_(c.tip),specVersion:c.runtimeVersion.toHex(),transactionVersion:c.runtimeVersion.toHex(),signedExtensions:c.signedExtensions,version:4});case 18:return u=e.sent,console.info("mimir:res:",u),l=u.payload,d=r.registry.createType("ExtrinsicEra",l.era),f=r.registry.createType("GenericCall",l.method),console.info("method:",f.toHex()==l.method,f.toHex(),l.method,s.inner.method.toHex()),console.info("era:",d.toHex(),l.era),h=s.inner.signature.createPayload(f,{era:d,blockHash:l.blockHash,genesisHash:l.genesisHash,nonce:l.nonce,runtimeVersion:c.runtimeVersion}),p=h.toU8a({method:!0}),g=(0,U_.c)(p.length>256?r.registry.hash(p):p),e.abrupt("return",g+":"+u.signature);case 29:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"login",value:function(){var e=(0,w.Z)(A().mark((function e(t){var n,r,i,o,s,a,c,u,l,d,f,h,p,g,m,b,y,v,w,x,S,E;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetchAccounts();case 2:if(0!=(n=e.sent).length){e.next=5;break}throw"Error: no account";case 5:if(console.info("mimir:accounts",n),!(t&&t.account&&"mimir"==t.wallet&&n.includes(t.account))){e.next=10;break}return e.abrupt("return",[n,t]);case 10:if(!n.length){e.next=43;break}return e.next=13,(0,fC.o)();case 13:return r=e.sent,i=n[0],o=r.tx.system.remark("Signature for CrustFiles"),e.next=18,mC(r,i);case 18:return s=e.sent,a=s.signOptions,e.next=22,this.wallet.signer.signPayload({address:i,blockHash:a.blockHash,genesisHash:a.genesisHash,blockNumber:"0x0",era:a.era.toHex(),method:o.inner.method.toHex(),nonce:a.nonce.toHex(),tip:D_(a.tip),specVersion:a.runtimeVersion.toHex(),transactionVersion:a.runtimeVersion.toHex(),signedExtensions:a.signedExtensions,version:4});case 22:return c=e.sent,console.info("mimir:res:",c),u=c.payload,l=r.registry.createType("ExtrinsicEra",u.era),d=r.registry.createType("GenericCall",u.method),f=u.address,console.info("method:",d.toHex()==u.method,d.toHex(),u.method,o.inner.method.toHex()),console.info("era:",l.toHex(),u.era),h=o.inner.signature.createPayload(d,{era:l,blockHash:u.blockHash,genesisHash:u.genesisHash,nonce:u.nonce,runtimeVersion:a.runtimeVersion}),p=h.toU8a({method:!0}),g=(0,U_.c)(p.length>256?r.registry.hash(p):p),m=c.signature,b=(0,z.WJ)({wallet:"mimir",account:i}),y="".concat(b,"-").concat(f,"-").concat(g,":").concat(m),v=window.btoa(y),w="".concat(v),x="".concat(v),S={wallet:"mimir",account:i,authBasic:w,authBearer:x,signature:m},E=dC(g,m,f),console.info("mimir:valid",E.isValid),e.abrupt("return",[n,S]);case 43:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),n}(F.cC);function vC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wC(e){for(var t=1;te.message.includes("pending authorization request")?new OC(e.message,this):e,this.enable=e=>MC(this,void 0,void 0,(function*(){if(!e)throw new Error("MissingParamsError: Dapp name is required.");if(!this.installed)throw new RC(`Refresh the browser if ${this.title} is already installed.`,this);try{const t=this.rawExtension,n=yield null===t||void 0===t?void 0:t.enable(e);if(!n)throw new RC(`${this.title} is installed but is not returned by the 'Wallet.enable(dappname)' function`,this);const r=Object.assign(Object.assign({},n),{name:this.extensionName,version:t.version});this._extension=r,this._signer=null===r||void 0===r?void 0:r.signer}catch(t){throw this.transformError(t)}})),this.getAccounts=e=>MC(this,void 0,void 0,(function*(){if(!this._extension)throw new RC("The 'Wallet.enable(dappname)' function should be called first.",this);const t=(yield this._extension.accounts.get(e)).map((e=>{var t,n;return Object.assign(Object.assign({},e),{source:null===(t=this._extension)||void 0===t?void 0:t.name,wallet:this,signer:null===(n=this._extension)||void 0===n?void 0:n.signer})}));return t})),this.subscribeAccounts=e=>MC(this,void 0,void 0,(function*(){if(!this._extension)throw new RC("The 'Wallet.enable(dappname)' function should be called first.",this);const t=this._extension.accounts.subscribe((t=>{const n=t.map((e=>{var t,n;return Object.assign(Object.assign({},e),{source:null===(t=this._extension)||void 0===t?void 0:t.name,wallet:this,signer:null===(n=this._extension)||void 0===n?void 0:n.signer})}));e(n)}));return t}))}get extension(){return this._extension}get signer(){return this._signer}get installed(){var e;const t=window;return!!(null===(e=null===t||void 0===t?void 0:t.injectedWeb3)||void 0===e?void 0:e[this.extensionName])}get rawExtension(){var e;const t=window;return null===(e=null===t||void 0===t?void 0:t.injectedWeb3)||void 0===e?void 0:e[this.extensionName]}}const BC=[new class extends NC{constructor(){super(...arguments),this.extensionName="talisman",this.title="Talisman",this.installUrl="https://talisman.xyz/download",this.noExtensionMessage="You can use any Polkadot compatible wallet but we recommend using Talisman",this.logo={src:"data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22%23D5FF5C%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M16.5349%2012.9159C16.6871%2013.2472%2017.135%2013.3643%2017.3929%2013.1065L17.8651%2012.6345C18.3535%2012.1464%2019.1453%2012.1464%2019.6337%2012.6345C20.1221%2013.1227%2020.1221%2013.9141%2019.6337%2014.4023L15.8097%2018.2246C14.8921%2019.3104%2013.5198%2020%2011.9865%2020C10.3851%2020%208.95942%2019.2478%208.04385%2018.0777L4.36629%2014.4018C3.87791%2013.9136%203.87791%2013.1222%204.36629%2012.634C4.85467%2012.1459%205.64649%2012.1459%206.13487%2012.634L6.60044%2013.0994C6.85253%2013.3514%207.29002%2013.238%207.43894%2012.9141V12.9141C7.46838%2012.8501%207.48439%2012.7814%207.48439%2012.711L7.48438%207.00059C7.48438%206.30991%208.04428%205.75001%208.73496%205.75001C9.42563%205.75001%209.98553%206.30991%209.98553%207.00058L9.98553%209.88892C9.98553%2010.1376%2010.2403%2010.3065%2010.4774%2010.2315V10.2315C10.6276%2010.1841%2010.736%2010.0474%2010.736%209.89001L10.736%205.25041C10.736%204.55974%2011.2959%203.99984%2011.9866%203.99984C12.6773%203.99984%2013.2372%204.55974%2013.2372%205.25041L13.2372%209.89018C13.2372%2010.0476%2013.3456%2010.1842%2013.4957%2010.2316V10.2316C13.7327%2010.3065%2013.9874%2010.1377%2013.9874%209.88909L13.9874%207.00059C13.9874%206.30991%2014.5473%205.75001%2015.2379%205.75001C15.9286%205.75001%2016.4885%206.30991%2016.4885%207.00058L16.4885%2012.7086C16.4885%2012.7805%2016.5049%2012.8506%2016.5349%2012.9159V12.9159Z%22%20fill%3D%22%23FD4848%22%2F%3E%3Cpath%20d%3D%22M15.9885%2015.5C15.9885%2015.5%2014.1969%2018%2011.9867%2018C9.77655%2018%207.98486%2015.5%207.98486%2015.5C7.98486%2015.5%209.77655%2013%2011.9867%2013C14.1969%2013%2015.9885%2015.5%2015.9885%2015.5Z%22%20fill%3D%22%23D5FF5C%22%2F%3E%3Cpath%20d%3D%22M13.8543%2015.5C13.8543%2016.5311%2013.018%2017.3671%2011.9863%2017.3671C10.9545%2017.3671%2010.1183%2016.5311%2010.1183%2015.5C10.1183%2014.4689%2010.9545%2013.6329%2011.9863%2013.6329C13.018%2013.6329%2013.8543%2014.4689%2013.8543%2015.5Z%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cpath%20d%3D%22M13.1041%2015.5C13.1041%2016.1169%2012.6037%2016.6171%2011.9864%2016.6171C11.3691%2016.6171%2010.8688%2016.1169%2010.8688%2015.5C10.8688%2014.8831%2011.3691%2014.3829%2011.9864%2014.3829C12.6037%2014.3829%2013.1041%2014.8831%2013.1041%2015.5Z%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cpath%20d%3D%22M14.605%2015.5C14.605%2016.9453%2013.4327%2018.1171%2011.9866%2018.1171C10.5405%2018.1171%209.36827%2016.9453%209.36827%2015.5C9.36827%2014.0547%2010.5405%2012.8829%2011.9866%2012.8829C13.4327%2012.8829%2014.605%2014.0547%2014.605%2015.5Z%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cpath%20d%3D%22M15.3552%2015.5C15.3552%2017.3595%2013.847%2018.8671%2011.9865%2018.8671C10.1259%2018.8671%208.61778%2017.3595%208.61778%2015.5C8.61778%2013.6405%2010.1259%2012.1329%2011.9865%2012.1329C13.847%2012.1329%2015.3552%2013.6405%2015.3552%2015.5Z%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cpath%20d%3D%22M12.3534%2015.5C12.3534%2015.7027%2012.1891%2015.8671%2011.9863%2015.8671C11.7836%2015.8671%2011.6192%2015.7027%2011.6192%2015.5C11.6192%2015.2973%2011.7836%2015.1329%2011.9863%2015.1329C12.1891%2015.1329%2012.3534%2015.2973%2012.3534%2015.5Z%22%20fill%3D%22%23162BEB%22%20stroke%3D%22%23FD4848%22%20stroke-width%3D%220.265831%22%2F%3E%3Cellipse%20cx%3D%2211.9863%22%20cy%3D%2215.5%22%20rx%3D%220.5%22%20ry%3D%220.5%22%20fill%3D%22%23FD4848%22%2F%3E%3Cmask%20id%3D%22path-10-inside-1_4684_17034%22%20fill%3D%22white%22%3E%3Cpath%20d%3D%22M15.9885%2015.5C15.9885%2015.5%2014.1969%2018%2011.9867%2018C9.77655%2018%207.98486%2015.5%207.98486%2015.5C7.98486%2015.5%209.77655%2013%2011.9867%2013C14.1969%2013%2015.9885%2015.5%2015.9885%2015.5Z%22%2F%3E%3C%2Fmask%3E%3Cpath%20d%3D%22M15.9885%2015.5C15.9885%2015.5%2014.1969%2018%2011.9867%2018C9.77655%2018%207.98486%2015.5%207.98486%2015.5C7.98486%2015.5%209.77655%2013%2011.9867%2013C14.1969%2013%2015.9885%2015.5%2015.9885%2015.5Z%22%20stroke%3D%22%23D5FF5C%22%20stroke-width%3D%220.531663%22%20mask%3D%22url%28%23path-10-inside-1_4684_17034%29%22%2F%3E%3C%2Fsvg%3E",alt:"Talisman Logo"}}},new class extends NC{constructor(){super(...arguments),this.extensionName="subwallet-js",this.title="SubWallet",this.installUrl="https://chrome.google.com/webstore/detail/subwallet/onhogfjeacnfoofkfgppdlbmlmnplgbn?hl=en&authuser=0",this.noExtensionMessage="You can use any Polkadot compatible wallet but we recommend using Talisman",this.logo={src:"data:image/svg+xml,%3Csvg%20width%3D%22134%22%20height%3D%22134%22%20viewBox%3D%220%200%20134%20134%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cmask%20id%3D%22mask0_699_5101%22%20style%3D%22mask-type%3Aalpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%22134%22%20height%3D%22134%22%3E%3Crect%20width%3D%22134%22%20height%3D%22134%22%20fill%3D%22%23C4C4C4%22%2F%3E%3C%2Fmask%3E%3Cg%20mask%3D%22url%28%23mask0_699_5101%29%22%3E%3Cpath%20d%3D%22M87.9615%2064.3201L87.9456%2047.7455L27.1191%2016.2236V64.3041L66.0589%2085.106L80.2884%2078.8367L37.4403%2056.1046L37.4722%2037.887L87.9615%2064.3201Z%22%20fill%3D%22url%28%23paint0_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M50.7607%2044.8421V50.5052L37.3926%2056.2321L37.4883%2037.6636L50.7607%2044.8421Z%22%20fill%3D%22url%28%23paint1_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M50.8095%2091.822L80.2895%2078.8368L37.4414%2056.2163L50.6819%2050.5054L105.765%2079.2835L50.9212%20103.212L50.8095%2091.822Z%22%20fill%3D%22url%28%23paint2_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M37.4886%2087.9773L50.6493%2082.2982L50.9365%20103.196L105.765%2079.2832V97.118L37.377%20127.077L37.4886%2087.9773Z%22%20fill%3D%22url%28%23paint3_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M27.1191%2082.5857L37.4403%2087.9776L37.3765%20127.013L27.1191%20121.86V82.5857Z%22%20fill%3D%22url%28%23paint4_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M40.1522%2076.7791L50.6489%2082.2986L37.4403%2087.9776L27.1191%2082.5857L40.1522%2076.7791Z%22%20fill%3D%22url%28%23paint5_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M105.765%2056.5993L105.702%2039.9131L87.9785%2047.7457V64.3362L105.765%2056.5993Z%22%20fill%3D%22url%28%23paint6_linear_699_5101%29%22%2F%3E%3Cpath%20d%3D%22M27.1191%2016.2237L45.0337%207.97632L105.732%2039.8811L87.9775%2047.7456L27.1191%2016.2237Z%22%20fill%3D%22url%28%23paint7_linear_699_5101%29%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22paint0_linear_699_5101%22%20x1%3D%2211.9006%22%20y1%3D%2250.6648%22%20x2%3D%22119.372%22%20y2%3D%2250.6648%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23FFD4B2%22%2F%3E%3Cstop%20offset%3D%220.36%22%20stop-color%3D%22%239ACEB7%22%2F%3E%3Cstop%20offset%3D%220.67%22%20stop-color%3D%22%2347C8BB%22%2F%3E%3Cstop%20offset%3D%220.89%22%20stop-color%3D%22%2314C5BE%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%2300C4BF%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear_699_5101%22%20x1%3D%2244.0766%22%20y1%3D%2262.8524%22%20x2%3D%2244.0766%22%20y2%3D%2221.2167%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%2300FECF%22%2F%3E%3Cstop%20offset%3D%220.08%22%20stop-color%3D%22%2300E5D0%22%2F%3E%3Cstop%20offset%3D%220.24%22%20stop-color%3D%22%2300A5D1%22%2F%3E%3Cstop%20offset%3D%220.48%22%20stop-color%3D%22%230040D4%22%2F%3E%3Cstop%20offset%3D%220.54%22%20stop-color%3D%22%230025D5%22%2F%3E%3Cstop%20offset%3D%221%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear_699_5101%22%20x1%3D%2237.4414%22%20y1%3D%2276.8587%22%20x2%3D%22146.891%22%20y2%3D%2276.8587%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23FDEC9F%22%2F%3E%3Cstop%20offset%3D%220.08%22%20stop-color%3D%22%23E4D8A4%22%2F%3E%3Cstop%20offset%3D%220.24%22%20stop-color%3D%22%23A4A6B2%22%2F%3E%3Cstop%20offset%3D%220.47%22%20stop-color%3D%22%233F57C8%22%2F%3E%3Cstop%20offset%3D%220.61%22%20stop-color%3D%22%230025D5%22%2F%3E%3Cstop%20offset%3D%221%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear_699_5101%22%20x1%3D%2215.0596%22%20y1%3D%22103.18%22%20x2%3D%22155.01%22%20y2%3D%22103.18%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20offset%3D%220.05%22%20stop-color%3D%22%2362A5FF%22%2F%3E%3Cstop%20offset%3D%220.45%22%20stop-color%3D%22%231032D1%22%2F%3E%3Cstop%20offset%3D%221%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint4_linear_699_5101%22%20x1%3D%22628.741%22%20y1%3D%223244.93%22%20x2%3D%22797.782%22%20y2%3D%223247.12%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23FFD4B2%22%2F%3E%3Cstop%20offset%3D%220.36%22%20stop-color%3D%22%239ACEB7%22%2F%3E%3Cstop%20offset%3D%220.67%22%20stop-color%3D%22%2347C8BB%22%2F%3E%3Cstop%20offset%3D%220.89%22%20stop-color%3D%22%2314C5BE%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%2300C4BF%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint5_linear_699_5101%22%20x1%3D%2224.5987%22%20y1%3D%2282.3783%22%20x2%3D%2272.5834%22%20y2%3D%2282.3783%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%2300FECF%22%2F%3E%3Cstop%20offset%3D%220.08%22%20stop-color%3D%22%2300E5D0%22%2F%3E%3Cstop%20offset%3D%220.25%22%20stop-color%3D%22%2300A5D1%22%2F%3E%3Cstop%20offset%3D%220.49%22%20stop-color%3D%22%230040D4%22%2F%3E%3Cstop%20offset%3D%220.56%22%20stop-color%3D%22%230025D5%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint6_linear_699_5101%22%20x1%3D%2270.9573%22%20y1%3D%2252.5952%22%20x2%3D%22189.069%22%20y2%3D%2250.4576%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%2300FECF%22%2F%3E%3Cstop%20offset%3D%220.05%22%20stop-color%3D%22%2300E5D0%22%2F%3E%3Cstop%20offset%3D%220.15%22%20stop-color%3D%22%2300A5D1%22%2F%3E%3Cstop%20offset%3D%220.29%22%20stop-color%3D%22%230040D4%22%2F%3E%3Cstop%20offset%3D%220.33%22%20stop-color%3D%22%230025D5%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint7_linear_699_5101%22%20x1%3D%2227.1191%22%20y1%3D%2227.8689%22%20x2%3D%22173.642%22%20y2%3D%2227.8689%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23FFD4AF%22%2F%3E%3Cstop%20offset%3D%220.1%22%20stop-color%3D%22%23E6D5BA%22%2F%3E%3Cstop%20offset%3D%220.31%22%20stop-color%3D%22%23A7D6D5%22%2F%3E%3Cstop%20offset%3D%220.61%22%20stop-color%3D%22%2343D9FF%22%2F%3E%3Cstop%20offset%3D%220.63%22%20stop-color%3D%22%2337B1D0%22%2F%3E%3Cstop%20offset%3D%220.65%22%20stop-color%3D%22%232B8CA5%22%2F%3E%3Cstop%20offset%3D%220.67%22%20stop-color%3D%22%23216B7D%22%2F%3E%3Cstop%20offset%3D%220.7%22%20stop-color%3D%22%23184E5B%22%2F%3E%3Cstop%20offset%3D%220.72%22%20stop-color%3D%22%2310353F%22%2F%3E%3Cstop%20offset%3D%220.75%22%20stop-color%3D%22%230A2228%22%2F%3E%3Cstop%20offset%3D%220.78%22%20stop-color%3D%22%23061316%22%2F%3E%3Cstop%20offset%3D%220.82%22%20stop-color%3D%22%23020809%22%2F%3E%3Cstop%20offset%3D%220.88%22%20stop-color%3D%22%23010202%22%2F%3E%3Cstop%20offset%3D%221%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E",alt:"Subwallet Logo"}}},new class extends NC{constructor(){super(...arguments),this.extensionName="polkadot-js",this.title="Polkadot.js",this.noExtensionMessage="You can use any Polkadot compatible wallet but we recommend using Talisman",this.installUrl="https://polkadot.js.org/extension/",this.logo={src:"data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%20standalone%3D%22yes%22%3F%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20id%3D%22Layer_1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%2215%2015%20140%20140%22%20style%3D%22enable-background%3Anew%200%200%20170%20170%3Bzoom%3A%201%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E.bg0%7Bfill%3A%23FF8C00%7D%20.st0%7Bfill%3A%23FFFFFF%7D%3C%2Fstyle%3E%3Cg%3E%3Ccircle%20class%3D%22bg0%22%20cx%3D%2285%22%20cy%3D%2285%22%20r%3D%2270%22%3E%3C%2Fcircle%3E%3Cg%3E%3Cpath%20class%3D%22st0%22%20d%3D%22M85%2C34.7c-20.8%2C0-37.8%2C16.9-37.8%2C37.8c0%2C4.2%2C0.7%2C8.3%2C2%2C12.3c0.9%2C2.7%2C3.9%2C4.2%2C6.7%2C3.3c2.7-0.9%2C4.2-3.9%2C3.3-6.7%20c-1.1-3.1-1.6-6.4-1.5-9.7C58.1%2C57.6%2C69.5%2C46%2C83.6%2C45.3c15.7-0.8%2C28.7%2C11.7%2C28.7%2C27.2c0%2C14.5-11.4%2C26.4-25.7%2C27.2%20c0%2C0-5.3%2C0.3-7.9%2C0.7c-1.3%2C0.2-2.3%2C0.4-3%2C0.5c-0.3%2C0.1-0.6-0.2-0.5-0.5l0.9-4.4L81%2C73.4c0.6-2.8-1.2-5.6-4-6.2%20c-2.8-0.6-5.6%2C1.2-6.2%2C4c0%2C0-11.8%2C55-11.9%2C55.6c-0.6%2C2.8%2C1.2%2C5.6%2C4%2C6.2c2.8%2C0.6%2C5.6-1.2%2C6.2-4c0.1-0.6%2C1.7-7.9%2C1.7-7.9%20c1.2-5.6%2C5.8-9.7%2C11.2-10.4c1.2-0.2%2C5.9-0.5%2C5.9-0.5c19.5-1.5%2C34.9-17.8%2C34.9-37.7C122.8%2C51.6%2C105.8%2C34.7%2C85%2C34.7z%20M87.7%2C121.7%20c-3.4-0.7-6.8%2C1.4-7.5%2C4.9c-0.7%2C3.4%2C1.4%2C6.8%2C4.9%2C7.5c3.4%2C0.7%2C6.8-1.4%2C7.5-4.9C93.3%2C125.7%2C91.2%2C122.4%2C87.7%2C121.7z%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E",alt:"Polkadotjs Logo"}}},new class extends NC{constructor(){super(...arguments),this.extensionName="enkrypt",this.title="Enkrypt",this.installUrl="https://www.enkrypt.com/#overview",this.noExtensionMessage="You can use any Polkadot compatible wallet but we recommend using Talisman",this.logo={src:"data:image/svg+xml,%3Csvg%20id%3D%22Layer_1%22%20data-name%3D%22Layer%201%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20viewBox%3D%220%200%20120%20120%22%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill-rule%3Aevenodd%3Bfill%3Aurl%28%23radial-gradient%29%3B%7D%3C%2Fstyle%3E%3CradialGradient%20id%3D%22radial-gradient%22%20cx%3D%22-164.98%22%20cy%3D%22566.58%22%20r%3D%221%22%20gradientTransform%3D%22matrix%28-15%2C%20136.5%2C%20135.36%2C%2014.88%2C%20-79032.62%2C%2014076.16%29%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%23704bff%22%2F%3E%3Cstop%20offset%3D%220.21%22%20stop-color%3D%22%23c549ff%22%2F%3E%3C%2FradialGradient%3E%3C%2Fdefs%3E%3Ctitle%3Eenkrypt-logo-color%3C%2Ftitle%3E%3Cpath%20class%3D%22cls-1%22%20d%3D%22M0%2C23.09A23.09%2C23.09%2C0%2C0%2C1%2C23.09%2C0H120V17.72a16.6%2C16.6%2C0%2C0%2C1-16.6%2C16.6H57.84A23.09%2C23.09%2C0%2C0%2C0%2C34.75%2C57.41v5.87a23.1%2C23.1%2C0%2C0%2C0%2C23.09%2C23.1H103.4A16.6%2C16.6%2C0%2C0%2C1%2C120%2C103v17H23.09A23.09%2C23.09%2C0%2C0%2C1%2C0%2C96.91ZM58.84%2C44h46.73A14.43%2C14.43%2C0%2C0%2C1%2C120%2C58.4v3.89a14.43%2C14.43%2C0%2C0%2C1-14.43%2C14.43H58.84A14.44%2C14.44%2C0%2C0%2C1%2C44.4%2C62.29V58.4A14.44%2C14.44%2C0%2C0%2C1%2C58.84%2C44Z%22%2F%3E%3C%2Fsvg%3E",alt:"Enkrypt Logo"}}}];function LC(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var DC,UC,jC,FC,VC,qC,zC=function(e){L(n,e);var t=LC(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;oHC.encodeUTF8(n),toObject(){try{return JSON.parse(HC.encodeUTF8(n))}catch(e){return null}},toUint8Array:()=>n}}};function GC(e){let t="";return e.forEach((e=>{t+=("0"+(255&e).toString(16)).slice(-2)})),t}function ZC(e){if(e.length%2!==0)throw new Error(`Cannot convert ${e} to bytesArray`);const t=new Uint8Array(e.length/2);for(let n=0;n=e.length)throw new Error("Index is out of buffer");return[e.slice(0,t),e.slice(t)]}(e,this.nonceLength),i=K_.box.open(r,n,t,this.keyPair.secretKey);if(!i)throw new Error(`Decryption error: \n message: ${e.toString()} \n sender pubkey: ${t.toString()} \n keypair pubkey: ${this.keyPair.publicKey.toString()} \n keypair secretkey: ${this.keyPair.secretKey.toString()}`);return(new TextDecoder).decode(i)}stringifyKeypair(){return{publicKey:GC(this.keyPair.publicKey),secretKey:GC(this.keyPair.secretKey)}}}var XC=n(34155);function YC(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}c((r=r.apply(e,t||[])).next())}))}class JC extends Error{constructor(e,t){super(e,t),this.message=`${JC.prefix} ${this.constructor.name}${this.info?": "+this.info:""}${e?"\n"+e:""}`,Object.setPrototypeOf(this,JC.prototype)}get info(){return""}}JC.prefix="[TON_CONNECT_SDK_ERROR]";class QC extends JC{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,QC.prototype)}}class $C extends JC{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,$C.prototype)}}class eI extends JC{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,eI.prototype)}}class tI extends JC{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,tI.prototype)}}class nI extends JC{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,nI.prototype)}}class rI extends JC{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,rI.prototype)}}class iI extends JC{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,iI.prototype)}}class oI extends JC{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,oI.prototype)}}class sI extends JC{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,sI.prototype)}}class aI extends JC{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,aI.prototype)}}class cI extends JC{get info(){return"Passed address is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,cI.prototype)}}class uI extends JC{get info(){return"Passed hex is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,uI.prototype)}}class lI extends JC{constructor(...e){super(...e),Object.setPrototypeOf(this,lI.prototype)}}const dI={[DC.UNKNOWN_ERROR]:lI,[DC.USER_REJECTS_ERROR]:rI,[DC.BAD_REQUEST_ERROR]:iI,[DC.UNKNOWN_APP_ERROR]:oI,[DC.MANIFEST_NOT_FOUND_ERROR]:eI,[DC.MANIFEST_CONTENT_ERROR]:$C};const fI=new class{parseError(e){let t=lI;return e.code in dI&&(t=dI[e.code]||lI),new t(e.message)}};const hI={[jC.UNKNOWN_ERROR]:lI,[jC.USER_REJECTS_ERROR]:rI,[jC.BAD_REQUEST_ERROR]:iI,[jC.UNKNOWN_APP_ERROR]:oI};const pI=new class extends class{isError(e){return"error"in e}}{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let t=lI;throw e.error.code in hI&&(t=hI[e.error.code]||lI),new t(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}};class gI{constructor(e,t){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+t}storeLastEventId(e){return YC(this,void 0,void 0,(function*(){return this.storage.setItem(this.storeKey,e)}))}removeLastEventId(){return YC(this,void 0,void 0,(function*(){return this.storage.removeItem(this.storeKey)}))}getLastEventId(){return YC(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);return e||null}))}}function mI(e,t){return function(e){return"/"===e.slice(-1)?e.slice(0,-1):e}(e)+"/"+t}function bI(e){if(!e)return!1;const t=new URL(e);return"tg:"===t.protocol||"t.me"===t.hostname}function yI(e){return e.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}function vI(e,t){return YC(this,void 0,void 0,(function*(){return new Promise(((n,r)=>{var i,o;if(null===(i=null===t||void 0===t?void 0:t.signal)||void 0===i?void 0:i.aborted)return void r(new JC("Delay aborted"));const s=setTimeout((()=>n()),e);null===(o=null===t||void 0===t?void 0:t.signal)||void 0===o||o.addEventListener("abort",(()=>{clearTimeout(s),r(new JC("Delay aborted"))}))}))}))}function wI(e){const t=new AbortController;return(null===e||void 0===e?void 0:e.aborted)?t.abort():null===e||void 0===e||e.addEventListener("abort",(()=>t.abort()),{once:!0}),t}function xI(e,t){var n,r;return YC(this,void 0,void 0,(function*(){const i=null!==(n=null===t||void 0===t?void 0:t.attempts)&&void 0!==n?n:10,o=null!==(r=null===t||void 0===t?void 0:t.delayMs)&&void 0!==r?r:200,s=wI(null===t||void 0===t?void 0:t.signal);if("function"!==typeof e)throw new JC("Expected a function, got "+typeof e);let a,c=0;for(;cYC(this,void 0,void 0,(function*(){if(o=null!==a&&void 0!==a?a:null,null===s||void 0===s||s.abort(),s=wI(a),s.signal.aborted)throw new JC("Resource creation was aborted");r=null!==c&&void 0!==c?c:null;const u=e(s.signal,...c);i=u;const l=yield u;if(i!==u&&l!==n)throw yield t(l),new JC("Resource creation was aborted by a new resource creation");return n=l,n}));return{create:a,current:()=>null!==n&&void 0!==n?n:null,dispose:()=>YC(this,void 0,void 0,(function*(){try{const r=n;n=null;const o=i;i=null;try{null===s||void 0===s||s.abort()}catch(e){}yield Promise.allSettled([r?t(r):Promise.resolve(),o?t(yield o):Promise.resolve()])}catch(e){}})),recreate:e=>YC(this,void 0,void 0,(function*(){const t=n,s=i,c=r,u=o;if(yield vI(e),t===n&&s===i&&c===r&&u===o)return yield a(o,...null!==c&&void 0!==c?c:[]);throw new JC("Resource recreation was aborted by a new resource creation")}))}}(((e,t)=>YC(this,void 0,void 0,(function*(){const n={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:e,openingDeadlineMS:t};return yield function(e){return YC(this,void 0,void 0,(function*(){return yield function(e,t){const n=null===t||void 0===t?void 0:t.timeout,r=wI(null===t||void 0===t?void 0:t.signal);return new Promise(((t,i)=>{if(r.signal.aborted)return void i(new JC("Operation aborted"));let o;"undefined"!==typeof n&&(o=setTimeout((()=>{r.abort(),i(new JC(`Timeout after ${n}ms`))}),n)),r.signal.addEventListener("abort",(()=>{clearTimeout(o),i(new JC("Operation aborted"))}),{once:!0});const s={timeout:n,abort:r.signal};e(t,i,s).finally((()=>clearTimeout(o)))}))}(((t,n,r)=>YC(this,void 0,void 0,(function*(){var i;const o=wI(r.signal).signal;if(o.aborted)return void n(new JC("Bridge connection aborted"));const s=new URL(mI(e.bridgeUrl,e.ssePath));s.searchParams.append("client_id",e.sessionId);const a=yield e.bridgeGatewayStorage.getLastEventId();if(a&&s.searchParams.append("last_event_id",a),o.aborted)return void n(new JC("Bridge connection aborted"));const c=new EventSource(s.toString());c.onerror=r=>YC(this,void 0,void 0,(function*(){if(o.aborted)return c.close(),void n(new JC("Bridge connection aborted"));try{const n=yield e.errorHandler(c,r);n!==c&&c.close(),n&&n!==c&&t(n)}catch(i){c.close(),n(i)}})),c.onopen=()=>{if(o.aborted)return c.close(),void n(new JC("Bridge connection aborted"));t(c)},c.onmessage=t=>{if(o.aborted)return c.close(),void n(new JC("Bridge connection aborted"));e.messageHandler(t)},null===(i=e.signal)||void 0===i||i.addEventListener("abort",(()=>{c.close(),n(new JC("Bridge connection aborted"))}))}))),{timeout:e.openingDeadlineMS,signal:e.signal})}))}(n)}))),(e=>YC(this,void 0,void 0,(function*(){e.close()})))),this.bridgeGatewayStorage=new gI(e,t)}get isReady(){const e=this.eventSource.current();return(null===e||void 0===e?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(null===e||void 0===e?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(null===e||void 0===e?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return YC(this,void 0,void 0,(function*(){yield this.eventSource.create(null===e||void 0===e?void 0:e.signal,null===e||void 0===e?void 0:e.openingDeadlineMS)}))}send(e,t,n,r){var i;return YC(this,void 0,void 0,(function*(){const o={};"number"===typeof r?o.ttl=r:(o.ttl=null===r||void 0===r?void 0:r.ttl,o.signal=null===r||void 0===r?void 0:r.signal,o.attempts=null===r||void 0===r?void 0:r.attempts);const s=new URL(mI(this.bridgeUrl,this.postPath));s.searchParams.append("client_id",this.sessionId),s.searchParams.append("to",t),s.searchParams.append("ttl",((null===o||void 0===o?void 0:o.ttl)||this.defaultTtl).toString()),s.searchParams.append("topic",n);const a=WC.encode(e);yield xI((e=>YC(this,void 0,void 0,(function*(){const t=yield this.post(s,a,e.signal);if(!t.ok)throw new JC(`Bridge send failed, status ${t.status}`)}))),{attempts:null!==(i=null===o||void 0===o?void 0:o.attempts)&&void 0!==i?i:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:null===o||void 0===o?void 0:o.signal})}))}pause(){this.eventSource.dispose().catch((e=>AI(`Bridge pause failed, ${e}`)))}unPause(){return YC(this,void 0,void 0,(function*(){yield this.eventSource.recreate(0)}))}close(){return YC(this,void 0,void 0,(function*(){yield this.eventSource.dispose().catch((e=>AI(`Bridge close failed, ${e}`)))}))}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,t,n){return YC(this,void 0,void 0,(function*(){const r=yield fetch(e,{method:"post",body:t,signal:n});if(!r.ok)throw new JC(`Bridge send failed, status ${r.status}`);return r}))}errorsHandler(e,t){return YC(this,void 0,void 0,(function*(){if(this.isConnecting)AI("Bridge error",JSON.stringify(t));else{if(!this.isReady){if(this.isClosed)return e.close(),SI(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new JC("Bridge error, unknown state")}try{this.errorsListener(t)}catch(t){}}}))}messagesHandler(e){return YC(this,void 0,void 0,(function*(){if(e.data===this.heartbeatMessage)return;if(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed)return;let t;try{t=JSON.parse(e.data)}catch(e){throw new JC(`Bridge message parse failed, message ${e.data}`)}this.listener(t)}))}}function _I(e){return!("connectEvent"in e)}class CI{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return YC(this,void 0,void 0,(function*(){if("injected"===e.type)return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!_I(e)){const t={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},n={type:"http",connectEvent:e.connectEvent,session:t,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(n))}const t={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(t))}))}removeConnection(){return YC(this,void 0,void 0,(function*(){return this.storage.removeItem(this.storeKey)}))}getConnection(){return YC(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const t=JSON.parse(e);if("injected"===t.type)return t;if("connectEvent"in t){const e=new KC(t.session.sessionKeyPair);return{type:"http",connectEvent:t.connectEvent,lastWalletEventId:t.lastWalletEventId,nextRpcRequestId:t.nextRpcRequestId,session:{sessionCrypto:e,bridgeUrl:t.session.bridgeUrl,walletPublicKey:t.session.walletPublicKey}}}return{type:"http",sessionCrypto:new KC(t.sessionCrypto),connectionSource:t.connectionSource}}))}getHttpConnection(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new JC("Trying to read HTTP connection source while nothing is stored");if("injected"===e.type)throw new JC("Trying to read HTTP connection source while injected connection is stored");return e}))}getHttpPendingConnection(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new JC("Trying to read HTTP connection source while nothing is stored");if("injected"===e.type)throw new JC("Trying to read HTTP connection source while injected connection is stored");if(!_I(e))throw new JC("Trying to read HTTP-pending connection while http connection is stored");return e}))}getInjectedConnection(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new JC("Trying to read Injected bridge connection source while nothing is stored");if("http"===(null===e||void 0===e?void 0:e.type))throw new JC("Trying to read Injected bridge connection source while HTTP connection is stored");return e}))}storedConnectionType(){return YC(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;return JSON.parse(e).type}))}storeLastWalletEventId(e){return YC(this,void 0,void 0,(function*(){const t=yield this.getConnection();if(t&&"http"===t.type&&!_I(t))return t.lastWalletEventId=e,this.storeConnection(t)}))}getLastWalletEventId(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId}))}increaseNextRpcRequestId(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const t=e.nextRpcRequestId||0;return e.nextRpcRequestId=t+1,this.storeConnection(e)}}))}getNextRpcRequestId(){return YC(this,void 0,void 0,(function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0}))}}class II{constructor(e,t){this.storage=e,this.walletConnectionSource=t,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=5e3,this.connectionStorage=new CI(e)}static fromStorage(e){return YC(this,void 0,void 0,(function*(){const t=new CI(e),n=yield t.getHttpConnection();return _I(n)?new II(e,n.connectionSource):new II(e,{bridgeUrl:n.session.bridgeUrl})}))}connect(e,t){var n;const r=wI(null===t||void 0===t?void 0:t.signal);null===(n=this.abortController)||void 0===n||n.abort(),this.abortController=r,this.closeGateways();const i=new KC;this.session={sessionCrypto:i,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:i}).then((()=>YC(this,void 0,void 0,(function*(){r.signal.aborted||(yield xI((e=>this.openGateways(i,{openingDeadlineMS:null===t||void 0===t?void 0:t.openingDeadlineMS,signal:null===e||void 0===e?void 0:e.signal})),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:r.signal}))}))));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var t,n;return YC(this,void 0,void 0,(function*(){const r=wI(null===e||void 0===e?void 0:e.signal);if(null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=r,r.signal.aborted)return;this.closeGateways();const i=yield this.connectionStorage.getHttpConnection();if(!i)return;if(r.signal.aborted)return;const o=null!==(n=null===e||void 0===e?void 0:e.openingDeadlineMS)&&void 0!==n?n:this.defaultOpeningDeadlineMS;if(_I(i))return this.session={sessionCrypto:i.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(i.sessionCrypto,{openingDeadlineMS:o,signal:null===r||void 0===r?void 0:r.signal});if(Array.isArray(this.walletConnectionSource))throw new JC("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=i.session,this.gateway&&(SI("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new EI(this.storage,this.walletConnectionSource.bridgeUrl,i.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!r.signal.aborted){this.listeners.forEach((e=>e(i.connectEvent)));try{yield xI((e=>this.gateway.registerSession({openingDeadlineMS:o,signal:e.signal})),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:r.signal})}catch(s){return void(yield this.disconnect({signal:r.signal}))}}}))}sendRequest(e,t){const n={};return"function"===typeof t?n.onRequestSent=t:(n.onRequestSent=null===t||void 0===t?void 0:t.onRequestSent,n.signal=null===t||void 0===t?void 0:t.signal,n.attempts=null===t||void 0===t?void 0:t.attempts),new Promise(((t,r)=>YC(this,void 0,void 0,(function*(){var i;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new JC("Trying to send bridge request without session");const o=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),SI("Send http-bridge request:",Object.assign(Object.assign({},e),{id:o}));const s=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:o})),ZC(this.session.walletPublicKey));try{yield this.gateway.send(s,this.session.walletPublicKey,e.method,{attempts:null===n||void 0===n?void 0:n.attempts,signal:null===n||void 0===n?void 0:n.signal}),null===(i=null===n||void 0===n?void 0:n.onRequestSent)||void 0===i||i.call(n),this.pendingRequests.set(o.toString(),t)}catch(a){r(a)}}))))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return YC(this,void 0,void 0,(function*(){return new Promise((t=>YC(this,void 0,void 0,(function*(){let n=!1,r=null;const i=()=>{n||(n=!0,this.removeBridgeAndSession().then(t))};try{this.closeGateways();const t=wI(null===e||void 0===e?void 0:e.signal);r=setTimeout((()=>{t.abort()}),this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:i,signal:t.signal,attempts:1})}catch(o){SI("Disconnect error:",o),n||this.removeBridgeAndSession().then(t)}finally{r&&clearTimeout(r),i()}}))))}))}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e))}pause(){var e;null===(e=this.gateway)||void 0===e||e.pause(),this.pendingGateways.forEach((e=>e.pause()))}unPause(){return YC(this,void 0,void 0,(function*(){const e=this.pendingGateways.map((e=>e.unPause()));this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)}))}pendingGatewaysListener(e,t,n){return YC(this,void 0,void 0,(function*(){if(this.pendingGateways.includes(e))return this.closeGateways({except:e}),this.gateway&&(SI("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=t,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n);yield e.close()}))}gatewayListener(e){return YC(this,void 0,void 0,(function*(){const t=JSON.parse(this.session.sessionCrypto.decrypt(WC.decode(e.message).toUint8Array(),ZC(e.from)));if(SI("Wallet message received:",t),!("event"in t)){const e=t.id.toString(),n=this.pendingRequests.get(e);return n?(n(t),void this.pendingRequests.delete(e)):void SI(`Response id ${e} doesn't match any request's id`)}if(void 0!==t.id){const e=yield this.connectionStorage.getLastWalletEventId();if(void 0!==e&&t.id<=e)return void AI(`Received event id (=${t.id}) must be greater than stored last wallet event id (=${e}) `);"connect"!==t.event&&(yield this.connectionStorage.storeLastWalletEventId(t.id))}const n=this.listeners;"connect"===t.event&&(yield this.updateSession(t,e.from)),"disconnect"===t.event&&(SI("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach((e=>e(t)))}))}gatewayErrorsListener(e){return YC(this,void 0,void 0,(function*(){throw new JC(`Bridge error ${JSON.stringify(e)}`)}))}updateSession(e,t){return YC(this,void 0,void 0,(function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:t});const n=e.payload.items.find((e=>"ton_addr"===e.name)),r=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:r,nextRpcRequestId:0})}))}removeBridgeAndSession(){return YC(this,void 0,void 0,(function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()}))}generateUniversalLink(e,t){return bI(e)?this.generateTGUniversalLink(e,t):this.generateRegularUniversalLink(e,t)}generateRegularUniversalLink(e,t){const n=new URL(e);return n.searchParams.append("v",2..toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(t)),n.toString()}generateTGUniversalLink(e,t){const n="tonconnect-"+yI(this.generateRegularUniversalLink("about:blank",t).split("?")[1]),r=this.convertToDirectLink(e),i=new URL(r);return i.searchParams.append("startapp",n),i.toString()}convertToDirectLink(e){const t=new URL(e);return t.searchParams.has("attach")&&(t.searchParams.delete("attach"),t.pathname+="/start"),t.toString()}openGateways(e,t){return YC(this,void 0,void 0,(function*(){return Array.isArray(this.walletConnectionSource)?(this.pendingGateways.map((e=>e.close().catch())),this.pendingGateways=this.walletConnectionSource.map((t=>{const n=new EI(this.storage,t.bridgeUrl,e.sessionId,(()=>{}),(()=>{}));return n.setListener((e=>this.pendingGatewaysListener(n,t.bridgeUrl,e))),n})),void(yield Promise.allSettled(this.pendingGateways.map((e=>xI((n=>this.pendingGateways.some((t=>t===e))?e.registerSession({openingDeadlineMS:null===t||void 0===t?void 0:t.openingDeadlineMS,signal:n.signal}):e.close()),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:null===t||void 0===t?void 0:t.signal})))))):(this.gateway&&(SI("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new EI(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:null===t||void 0===t?void 0:t.openingDeadlineMS,signal:null===t||void 0===t?void 0:t.signal}))}))}closeGateways(e){var t;null===(t=this.gateway)||void 0===t||t.close(),this.pendingGateways.filter((t=>t!==(null===e||void 0===e?void 0:e.except))).forEach((e=>e.close())),this.pendingGateways=[]}}function kI(e,t){return TI(e,[t])}function TI(e,t){return!(!e||"object"!==typeof e)&&t.every((t=>t in e))}class MI{constructor(){this.storage={}}static getInstance(){return MI.instance||(MI.instance=new MI),MI.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var t;return null!==(t=this.storage[e])&&void 0!==t?t:null}key(e){var t;const n=Object.keys(this.storage);return e<0||e>=n.length?null:null!==(t=n[e])&&void 0!==t?t:null}removeItem(e){delete this.storage[e]}setItem(e,t){this.storage[e]=t}}function PI(){if("undefined"!==typeof window)return window}function OI(){if("undefined"!==typeof document)return document}function RI(){var e;const t=null===(e=PI())||void 0===e?void 0:e.location.origin;return t?t+"/tonconnect-manifest.json":""}function NI(){if(function(){try{return"undefined"!==typeof localStorage}catch(lk){return!1}}())return localStorage;if("undefined"!==typeof XC&&null!=XC.versions&&null!=XC.versions.node)throw new JC("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return MI.getInstance()}class BI{constructor(e,t){this.injectedWalletKey=t,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=BI.window;if(!BI.isWindowContainsWallet(n,t))throw new sI;this.connectionStorage=new CI(e),this.injectedWallet=n[t].tonconnect}static fromStorage(e){return YC(this,void 0,void 0,(function*(){const t=new CI(e),n=yield t.getInjectedConnection();return new BI(e,n.jsBridgeKey)}))}static isWalletInjected(e){return BI.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return!!BI.isWindowContainsWallet(this.window,e)&&this.window[e].tonconnect.isWalletBrowser}static getCurrentlyInjectedWallets(){if(!this.window)return[];const e=function(){const e=PI();if(!e)return[];try{return Object.keys(e)}catch(lk){return[]}}().filter((([e,t])=>function(e){try{return!(!kI(e,"tonconnect")||!kI(e.tonconnect,"walletInfo"))&&TI(e.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch(lk){return!1}}(t)));return e.map((([e,t])=>({name:t.tonconnect.walletInfo.name,appName:t.tonconnect.walletInfo.app_name,aboutUrl:t.tonconnect.walletInfo.about_url,imageUrl:t.tonconnect.walletInfo.image,tondns:t.tonconnect.walletInfo.tondns,jsBridgeKey:e,injected:!0,embedded:t.tonconnect.isWalletBrowser,platforms:t.tonconnect.walletInfo.platforms})))}static isWindowContainsWallet(e,t){return!!e&&t in e&&"object"===typeof e[t]&&"tonconnect"in e[t]}connect(e){this._connect(2,e)}restoreConnection(){return YC(this,void 0,void 0,(function*(){try{SI("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();SI("Injected Provider restoring connection response",e),"connect"===e.event?(this.makeSubscriptions(),this.listeners.forEach((t=>t(e)))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}}))}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return YC(this,void 0,void 0,(function*(){return new Promise((e=>{const t=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),t()}catch(n){SI(n),this.sendRequest({method:"disconnect",params:[]},t)}}))}))}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],null===(e=this.unsubscribeCallback)||void 0===e||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e))}sendRequest(e,t){var n;return YC(this,void 0,void 0,(function*(){const r={};"function"===typeof t?r.onRequestSent=t:(r.onRequestSent=null===t||void 0===t?void 0:t.onRequestSent,r.signal=null===t||void 0===t?void 0:t.signal);const i=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),SI("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:i}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:i}));return o.then((e=>SI("Wallet message received:",e))),null===(n=null===r||void 0===r?void 0:r.onRequestSent)||void 0===n||n.call(r),o}))}_connect(e,t){return YC(this,void 0,void 0,(function*(){try{SI(`Injected Provider connect request: protocolVersion: ${e}, message:`,t);const n=yield this.injectedWallet.connect(e,t);SI("Injected Provider connect response:",n),"connect"===n.event&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach((e=>e(n)))}catch(n){SI("Injected Provider connect error:",n);const e={event:"connect_error",payload:{code:0,message:null===n||void 0===n?void 0:n.toString()}};this.listeners.forEach((t=>t(e)))}}))}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen((e=>{SI("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach((t=>t(e))),"disconnect"===e.event&&this.disconnect()}))}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}BI.window=PI();class LI{constructor(){this.localStorage=NI()}getItem(e){return YC(this,void 0,void 0,(function*(){return this.localStorage.getItem(e)}))}removeItem(e){return YC(this,void 0,void 0,(function*(){this.localStorage.removeItem(e)}))}setItem(e,t){return YC(this,void 0,void 0,(function*(){this.localStorage.setItem(e,t)}))}}function DI(e){return function(e){return"jsBridgeKey"in e}(e)&&e.injected}function UI(e){return DI(e)&&e.embedded}function jI(e){return"bridgeUrl"in e}const FI=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://app.delabwallet.com/logo_black.png",about_url:"https://delabwallet.com",bridge:[{type:"js",key:"dewallet"}],platforms:["chrome"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]}];class VI{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",(null===e||void 0===e?void 0:e.walletsListSource)&&(this.walletsListSource=e.walletsListSource),(null===e||void 0===e?void 0:e.cacheTTLMs)&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return YC(this,void 0,void 0,(function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then((()=>{this.walletsListCacheCreationTimestamp=Date.now()})).catch((()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null}))),this.walletsListCache}))}getEmbeddedWallet(){return YC(this,void 0,void 0,(function*(){const e=(yield this.getWallets()).filter(UI);return 1!==e.length?null:e[0]}))}fetchWalletsList(){return YC(this,void 0,void 0,(function*(){let e=[];try{const t=yield fetch(this.walletsListSource);if(e=yield t.json(),!Array.isArray(e))throw new aI("Wrong wallets list format, wallets list must be an array.");const n=e.filter((e=>!this.isCorrectWalletConfigDTO(e)));n.length&&(AI(`Wallet(s) ${n.map((e=>e.name)).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter((e=>this.isCorrectWalletConfigDTO(e))))}catch(n){AI(n),e=FI}let t=[];try{t=BI.getCurrentlyInjectedWallets()}catch(n){AI(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),t)}))}walletConfigDTOListToWalletConfigList(e){return e.map((e=>{const t={name:e.name,appName:e.app_name,imageUrl:e.image,aboutUrl:e.about_url,tondns:e.tondns,platforms:e.platforms};return e.bridge.forEach((n=>{if("sse"===n.type&&(t.bridgeUrl=n.url,t.universalLink=e.universal_url,t.deepLink=e.deepLink),"js"===n.type){const e=n.key;t.jsBridgeKey=e,t.injected=BI.isWalletInjected(e),t.embedded=BI.isInsideWalletBrowser(e)}})),t}))}mergeWalletsLists(e,t){return[...new Set(e.concat(t).map((e=>e.name))).values()].map((n=>{const r=e.find((e=>e.name===n)),i=t.find((e=>e.name===n));return Object.assign(Object.assign({},r&&Object.assign({},r)),i&&Object.assign({},i))}))}isCorrectWalletConfigDTO(e){if(!e||"object"!==typeof e)return!1;if(!("name"in e)||!("image"in e)||!("about_url"in e)||!("platforms"in e)||!("app_name"in e))return!1;if(!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length)return!1;if(!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const t=e.bridge;if(t.some((e=>!e||"object"!==typeof e||!("type"in e))))return!1;const n=t.find((e=>"sse"===e.type));if(n&&(!("url"in n)||!n.url||!e.universal_url))return!1;const r=t.find((e=>"js"===e.type));return!!(!r||"key"in r&&r.key)}}class qI extends JC{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,qI.prototype)}}function zI(e,t){const n=e.includes("SendTransaction"),r=e.find((e=>e&&"object"===typeof e&&"SendTransaction"===e.name));if(!n&&!r)throw new qI("Wallet doesn't support SendTransaction feature.");if(r&&void 0!==r.maxMessages){if(r.maxMessages{var t,n;return{address:null!==(t=e.address)&&void 0!==t?t:null,amount:null!==(n=e.amount)&&void 0!==n?n:null}}))}}function ek(e,t,n){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},GI(e,t)),$I(t,n))}function tk(e,t,n,r){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:r.boc},GI(e,t)),$I(t,n))}function nk(e,t,n,r,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:r,error_code:null!==i&&void 0!==i?i:null},GI(e,t)),$I(t,n))}function rk(e,t,n){return Object.assign({type:"disconnection",scope:n},GI(e,t))}class ik{constructor(){this.window=PI()}dispatchEvent(e,t){var n;return YC(this,void 0,void 0,(function*(){const r=new CustomEvent(e,{detail:t});null===(n=this.window)||void 0===n||n.dispatchEvent(r)}))}addEventListener(e,t,n){var r;return YC(this,void 0,void 0,(function*(){return null===(r=this.window)||void 0===r||r.addEventListener(e,t,n),()=>{var n;return null===(n=this.window)||void 0===n?void 0:n.removeEventListener(e,t)}}))}}class ok{constructor(e){var t;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=null!==(t=null===e||void 0===e?void 0:e.eventDispatcher)&&void 0!==t?t:new ik,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return WI({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return YC(this,void 0,void 0,(function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch(e){}}))}setRequestVersionHandler(){return YC(this,void 0,void 0,(function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",(()=>YC(this,void 0,void 0,(function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",HI(this.tonConnectSdkVersion))}))))}))}requestTonConnectUiVersion(){return YC(this,void 0,void 0,(function*(){return new Promise(((e,t)=>YC(this,void 0,void 0,(function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",(t=>{e(t.detail.version)}),{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",{type:"request-version"})}catch(n){t(n)}}))))}))}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch(t){}}trackConnectionStarted(...e){try{const t=ZI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionCompleted(...e){try{const t=KI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionError(...e){try{const t=XI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionRestoringStarted(...e){try{const t=YI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionRestoringCompleted(...e){try{const t=JI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackConnectionRestoringError(...e){try{const t=QI(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackDisconnection(...e){try{const t=rk(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackTransactionSentForSignature(...e){try{const t=ek(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackTransactionSigned(...e){try{const t=tk(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}trackTransactionSigningFailed(...e){try{const t=nk(this.version,...e);this.dispatchUserActionEvent(t)}catch(t){}}}class sk{constructor(e){if(this.walletsList=new VI,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(null===e||void 0===e?void 0:e.manifestUrl)||RI(),storage:(null===e||void 0===e?void 0:e.storage)||new LI},this.walletsList=new VI({walletsListSource:null===e||void 0===e?void 0:e.walletsListSource,cacheTTLMs:null===e||void 0===e?void 0:e.walletsListCacheTTLMs}),this.tracker=new ok({eventDispatcher:null===e||void 0===e?void 0:e.eventDispatcher,tonConnectSdkVersion:"3.0.3"}),!this.dappSettings.manifestUrl)throw new QC("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new CI(this.dappSettings.storage),(null===e||void 0===e?void 0:e.disableAutoPauseConnection)||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return null!==this._wallet}get account(){var e;return(null===(e=this._wallet)||void 0===e?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach((e=>e(this._wallet)))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,t){return this.statusChangeSubscriptions.push(e),t&&this.statusChangeErrorSubscriptions.push(t),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter((t=>t!==e)),t&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter((e=>e!==t)))}}connect(e,t){var n,r;const i={};if("object"===typeof t&&"tonProof"in t&&(i.request=t),"object"===typeof t&&("openingDeadlineMS"in t||"signal"in t||"request"in t)&&(i.request=null===t||void 0===t?void 0:t.request,i.openingDeadlineMS=null===t||void 0===t?void 0:t.openingDeadlineMS,i.signal=null===t||void 0===t?void 0:t.signal),this.connected)throw new tI;const o=wI(null===i||void 0===i?void 0:i.signal);if(null===(n=this.abortController)||void 0===n||n.abort(),this.abortController=o,o.signal.aborted)throw new JC("Connection was aborted");return null===(r=this.provider)||void 0===r||r.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",(()=>{var e;null===(e=this.provider)||void 0===e||e.closeConnection(),this.provider=null})),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(null===i||void 0===i?void 0:i.request),{openingDeadlineMS:null===i||void 0===i?void 0:i.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var t,n;return YC(this,void 0,void 0,(function*(){this.tracker.trackConnectionRestoringStarted();const r=wI(null===e||void 0===e?void 0:e.signal);if(null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=r,r.signal.aborted)return void this.tracker.trackConnectionRestoringError("Connection restoring was aborted");const[i,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(r.signal.aborted)return void this.tracker.trackConnectionRestoringError("Connection restoring was aborted");let s=null;try{switch(i){case"http":s=yield II.fromStorage(this.dappSettings.storage);break;case"injected":s=yield BI.fromStorage(this.dappSettings.storage);break;default:if(!o)return;s=this.createProvider(o)}}catch(fk){return this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),null===s||void 0===s||s.closeConnection(),void(s=null)}if(r.signal.aborted)return null===s||void 0===s||s.closeConnection(),void this.tracker.trackConnectionRestoringError("Connection restoring was aborted");if(!s)return AI("Provider is not restored"),void this.tracker.trackConnectionRestoringError("Provider is not restored");null===(n=this.provider)||void 0===n||n.closeConnection(),this.provider=s,s.listen(this.walletEventsListener.bind(this));const a=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),null===s||void 0===s||s.closeConnection(),s=null};return r.signal.addEventListener("abort",a),yield xI((t=>YC(this,void 0,void 0,(function*(){yield null===s||void 0===s?void 0:s.restoreConnection({openingDeadlineMS:null===e||void 0===e?void 0:e.openingDeadlineMS,signal:t.signal}),r.signal.removeEventListener("abort",a),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}))),{attempts:Number.MAX_SAFE_INTEGER,delayMs:5e3,signal:null===e||void 0===e?void 0:e.signal})}))}sendTransaction(e,t){return YC(this,void 0,void 0,(function*(){const n={};"function"===typeof t?n.onRequestSent=t:(n.onRequestSent=null===t||void 0===t?void 0:t.onRequestSent,n.signal=null===t||void 0===t?void 0:t.signal);const r=wI(null===n||void 0===n?void 0:n.signal);if(r.signal.aborted)throw new JC("Transaction sending was aborted");this.checkConnection(),zI(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:i}=e,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i{e.hidden?this.pauseConnection():this.unPauseConnection().catch()}))}catch(t){AI("Cannot subscribe to the document.visibilitychange: ",t)}}createProvider(e){let t;return t=!Array.isArray(e)&&function(e){return"jsBridgeKey"in e}(e)?new BI(this.dappSettings.storage,e.jsBridgeKey):new II(this.dappSettings.storage,e),t.listen(this.walletEventsListener.bind(this)),t}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const t=e.items.find((e=>"ton_addr"===e.name)),n=e.items.find((e=>"ton_proof"===e.name));if(!t)throw new JC("ton_addr connection item was not found");const r={device:e.device,provider:this.provider.type,account:{address:t.address,chain:t.network,walletStateInit:t.walletStateInit,publicKey:t.publicKey}};n&&(r.connectItems={tonProof:n}),this.wallet=r,this.tracker.trackConnectionCompleted(r)}onWalletConnectError(e){const t=fI.parseError(e);if(this.statusChangeErrorSubscriptions.forEach((e=>e(t))),SI(t),this.tracker.trackConnectionError(e.message,e.code),t instanceof eI||t instanceof $C)throw AI(t),t}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new nI}createConnectRequest(e){const t=[{name:"ton_addr"}];return(null===e||void 0===e?void 0:e.tonProof)&&t.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:t}}}sk.walletsList=new VI,sk.isWalletInjected=e=>BI.isWalletInjected(e),sk.isInsideWalletBrowser=e=>BI.isInsideWalletBrowser(e);function ak(e,t=!1){const{wc:n,hex:r}=function(e){if(!e.includes(":"))throw new cI(`Wrong address ${e}. Address must include ":".`);const t=e.split(":");if(2!==t.length)throw new cI(`Wrong address ${e}. Address must include ":" only once.`);const n=parseInt(t[0]);if(0!==n&&-1!==n)throw new cI(`Wrong address ${e}. WC must be eq 0 or -1, but ${n} received.`);const r=t[1];if(64!==(null===r||void 0===r?void 0:r.length))throw new cI(`Wrong address ${e}. Hex part must be 64bytes length, but ${null===r||void 0===r?void 0:r.length} received.`);return{wc:n,hex:uk(r)}}(e);let i=81;t&&(i|=128);const o=new Int8Array(34);o[0]=i,o[1]=n,o.set(r,2);const s=new Uint8Array(36);return s.set(o),s.set(function(e){const t=4129;let n=0;const r=new Uint8Array(e.length+2);r.set(e);for(let i of r){let e=128;for(;e>0;)n<<=1,i&e&&(n+=1),e>>=1,n>65535&&(n&=65535,n^=t)}return new Uint8Array([Math.floor(n/256),n%256])}(o),34),WC.encode(s).replace(/\+/g,"-").replace(/\//g,"_")}const ck={};for(let tj=0;tj<=255;tj++){let e=tj.toString(16);e.length<2&&(e="0"+e),ck[e]=tj}function uk(e){const t=(e=e.toLowerCase()).length;if(t%2!==0)throw new uI("Hex string must have length a multiple of 2: "+e);const n=t/2,r=new Uint8Array(n);for(let i=0;it in e?Sk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tk=(e,t)=>{for(var n in t||(t={}))Ck.call(t,n)&&kk(e,n,t[n]);if(_k)for(var n of _k(t))Ik.call(t,n)&&kk(e,n,t[n]);return e},Mk=(e,t)=>Ak(e,Ek(t)),Pk=(e,t,n)=>(kk(e,"symbol"!==typeof t?t+"":t,n),n),Ok=(e,t,n)=>new Promise(((r,i)=>{var o=e=>{try{a(n.next(e))}catch(t){i(t)}},s=e=>{try{a(n.throw(e))}catch(t){i(t)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);a((n=n.apply(e,t)).next())}));const Rk={};const Nk=Symbol("solid-proxy"),Bk=Symbol("solid-track"),Lk={equals:(e,t)=>e===t};let Dk=fT;const Uk={owned:null,cleanups:null,context:null,owner:null},jk={};var Fk=null;let Vk,qk=null,zk=null,Hk=null,Wk=null,Gk=0;function Zk(e,t){const n=zk,r=Fk,i=0===e.length,o=i?Uk:{owned:null,cleanups:null,context:null,owner:void 0===t?r:t},s=i?e:()=>e((()=>eT((()=>mT(o)))));Fk=o,zk=null;try{return dT(s,!0)}finally{zk=n,Fk=r}}function Kk(e,t){const n={value:e,observers:null,observerSlots:null,comparator:(t=t?Object.assign({},Lk,t):Lk).equals||void 0};return[sT.bind(n),e=>("function"===typeof e&&(e=e(n.value)),aT(n,e))]}function Xk(e,t,n){cT(uT(e,t,!0,1))}function Yk(e,t,n){cT(uT(e,t,!1,1))}function Jk(e,t,n){Dk=hT;const r=uT(e,t,!1,1);r.user=!0,Wk?Wk.push(r):cT(r)}function Qk(e,t,n){n=n?Object.assign({},Lk,n):Lk;const r=uT(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,cT(r),sT.bind(r)}function $k(e){return dT(e,!1)}function eT(e){if(null===zk)return e();const t=zk;zk=null;try{return e()}finally{zk=t}}function tT(e){return null===Fk||(null===Fk.cleanups?Fk.cleanups=[e]:Fk.cleanups.push(e)),e}function nT(){return zk}function rT(e,t){const n=Symbol("context");return{id:n,Provider:xT(n),defaultValue:e}}function iT(e){let t;return void 0!==(t=vT(Fk,e.id))?t:e.defaultValue}function oT(e){const t=Qk(e),n=Qk((()=>wT(t())));return n.toArray=()=>{const e=n();return Array.isArray(e)?e:null!=e?[e]:[]},n}function sT(){if(this.sources&&this.state)if(1===this.state)cT(this);else{const e=Hk;Hk=null,dT((()=>pT(this)),!1),Hk=e}if(zk){const e=this.observers?this.observers.length:0;zk.sources?(zk.sources.push(this),zk.sourceSlots.push(e)):(zk.sources=[this],zk.sourceSlots=[e]),this.observers?(this.observers.push(zk),this.observerSlots.push(zk.sources.length-1)):(this.observers=[zk],this.observerSlots=[zk.sources.length-1])}return this.value}function aT(e,t,n){let r=e.value;return e.comparator&&e.comparator(r,t)||(e.value=t,e.observers&&e.observers.length&&dT((()=>{for(let t=0;t1e6)throw Hk=[],new Error}),!1)),t}function cT(e){if(!e.fn)return;mT(e);const t=Fk,n=zk,r=Gk;zk=Fk=e,function(e,t,n){let r;try{r=e.fn(t)}catch(i){e.pure&&(e.state=1,e.owned&&e.owned.forEach(mT),e.owned=null),yT(i)}(!e.updatedAt||e.updatedAt<=n)&&(null!=e.updatedAt&&"observers"in e?aT(e,r):e.value=r,e.updatedAt=n)}(e,e.value,r),zk=n,Fk=t}function uT(e,t,n,r=1,i){const o={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Fk,context:null,pure:n};return null===Fk||Fk!==Uk&&(Fk.owned?Fk.owned.push(o):Fk.owned=[o]),o}function lT(e){if(0===e.state)return;if(2===e.state)return pT(e);if(e.suspense&&eT(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt=0;n--)if(1===(e=t[n]).state)cT(e);else if(2===e.state){const n=Hk;Hk=null,dT((()=>pT(e,t[0])),!1),Hk=n}}function dT(e,t){if(Hk)return e();let n=!1;t||(Hk=[]),Wk?n=!0:Wk=[],Gk++;try{const t=e();return function(e){Hk&&(fT(Hk),Hk=null);if(e)return;const t=Wk;Wk=null,t.length&&dT((()=>Dk(t)),!1)}(n),t}catch(r){n||(Wk=null),Hk=null,yT(r)}}function fT(e){for(let t=0;tn=eT((()=>(Fk.context={[e]:t.value},oT((()=>t.children)))))),void 0),n}}const ST=Symbol("fallback");function AT(e){for(let t=0;te(t||{})))}function _T(){return!0}const CT={get:(e,t,n)=>t===Nk?n:e.get(t),has:(e,t)=>t===Nk||e.has(t),set:_T,deleteProperty:_T,getOwnPropertyDescriptor:(e,t)=>({configurable:!0,enumerable:!0,get:()=>e.get(t),set:_T,deleteProperty:_T}),ownKeys:e=>e.keys()};function IT(e){return(e="function"===typeof e?e():e)?e:{}}function kT(...e){let t=!1;for(let r=0;r=0;n--){const r=IT(e[n])[t];if(void 0!==r)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in IT(e[n]))return!0;return!1},keys(){const t=[];for(let n=0;n=0;r--)if(e[r]){const t=Object.getOwnPropertyDescriptors(e[r]);for(const r in t)r in n||Object.defineProperty(n,r,{enumerable:!0,get(){for(let t=e.length-1;t>=0;t--){const n=(e[t]||{})[r];if(void 0!==n)return n}}})}return n}function TT(e,...t){const n=new Set(t.flat());if(Nk in e){const r=t.map((t=>new Proxy({get:n=>t.includes(n)?e[n]:void 0,has:n=>t.includes(n)&&n in e,keys:()=>t.filter((t=>t in e))},CT)));return r.push(new Proxy({get:t=>n.has(t)?void 0:e[t],has:t=>!n.has(t)&&t in e,keys:()=>Object.keys(e).filter((e=>!n.has(e)))},CT)),r}const r=Object.getOwnPropertyDescriptors(e);return t.push(Object.keys(r).filter((e=>!n.has(e)))),t.map((t=>{const n={};for(let i=0;ie[o],set:()=>!0,enumerable:!0})}return n}))}function MT(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Qk(function(e,t,n={}){let r=[],i=[],o=[],s=0,a=t.length>1?[]:null;return tT((()=>AT(o))),()=>{let c,u,l=e()||[];return l[Bk],eT((()=>{let e,t,f,h,p,g,m,b,y,v=l.length;if(0===v)0!==s&&(AT(o),o=[],r=[],i=[],s=0,a&&(a=[])),n.fallback&&(r=[ST],i[0]=Zk((e=>(o[0]=e,n.fallback()))),s=1);else if(0===s){for(i=new Array(v),u=0;u=g&&b>=g&&r[m]===l[b];m--,b--)f[b]=i[m],h[b]=o[m],a&&(p[b]=a[m]);for(e=new Map,t=new Array(b+1),u=b;u>=g;u--)y=l[u],c=e.get(y),t[u]=void 0===c?-1:c,e.set(y,u);for(c=g;c<=m;c++)y=r[c],u=e.get(y),void 0!==u&&-1!==u?(f[u]=i[c],h[u]=o[c],a&&(p[u]=a[c]),u=t[u],e.set(y,u)):o[c]();for(u=g;ue.each),e.children,t||void 0))}function PT(e){let t=!1;const n=e.keyed,r=Qk((()=>e.when),void 0,{equals:(e,n)=>t?e===n:!e===!n});return Qk((()=>{const i=r();if(i){const r=e.children,o="function"===typeof r&&r.length>0;return t=n||o,o?eT((()=>r(i))):r}return e.fallback}),void 0,void 0)}function OT(e){let t=!1,n=!1;const r=oT((()=>e.children)),i=Qk((()=>{let e=r();Array.isArray(e)||(e=[e]);for(let t=0;te[0]===n[0]&&(t?e[1]===n[1]:!e[1]===!n[1])&&e[2]===n[2]});return Qk((()=>{const[r,o,s]=i();if(r<0)return e.fallback;const a=s.children,c="function"===typeof a&&a.length>0;return t=n||c,c?eT((()=>a(o))):a}),void 0,void 0)}function RT(e){return e}const NT=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline","allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"]),BT=new Set(["innerHTML","textContent","innerText","children"]),LT=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),DT=Object.assign(Object.create(null),{class:"className",formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"}),UT=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),jT=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),FT={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};const VT="_$DX_DELEGATE";function qT(e,t,n){if("undefined"===typeof window)return null;const r=document.createElement("template");r.innerHTML=e;let i=r.content.firstChild;return n&&(i=i.firstChild),i}function zT(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function HT(e,t){null==t?e.removeAttribute("class"):e.className=t}function WT(e,t={},n,r){const i={};return r||Yk((()=>i.children=QT(e,t.children,i.children))),Yk((()=>t.ref&&t.ref(e))),Yk((()=>function(e,t,n,r,i={},o=!1){t||(t={});for(const s in i)if(!(s in t)){if("children"===s)continue;i[s]=YT(e,s,null,i[s],n,o)}for(const s in t){if("children"===s){r||QT(e,t.children);continue}const a=t[s];i[s]=YT(e,s,a,i[s],n,o)}}(e,t,n,!0,i,!0))),i}function GT(e,t,n){return eT((()=>e(t,n)))}function ZT(e,t,n,r){if(void 0===n||r||(r=[]),"function"!==typeof t)return QT(e,t,r,n);Yk((r=>QT(e,t(),r,n)),r)}function KT(e){let t,n;return Rk.context&&(t=Rk.registry.get(n=function(){const e=Rk.context;return`${e.id}${e.count++}`}()))?(Rk.completed&&Rk.completed.add(t),Rk.registry.delete(n),t):e.cloneNode(!0)}function XT(e,t,n){const r=t.trim().split(/\s+/);for(let i=0,o=r.length;ir.call(e,n[1],t))}else e.addEventListener(t,n)}(e,i,n,o),o&&function(e,t=window.document){const n=t[VT]||(t[VT]=new Set);for(let r=0,i=e.length;rt.toUpperCase())))]=n;else{const r=i&&t.indexOf(":")>-1&&FT[t.split(":")[0]];r?function(e,t,n,r){null==r?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r)}(e,r,t,n):zT(e,LT[t]||t,n)}var u;return n}function JT(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>n||document}),Rk.registry&&!Rk.done&&(Rk.done=!0,document.querySelectorAll("[id^=pl-]").forEach((t=>{for(;t&&8!==t.nodeType&&t.nodeValue!=="pl-"+e;){let e=t.nextSibling;t.remove(),t=e}t&&t.remove()})));n;){const r=n[t];if(r&&!n.disabled){const i=n[`${t}Data`];if(void 0!==i?r.call(n,i,e):r.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function QT(e,t,n,r,i){for(Rk.context&&!n&&(n=[...e.childNodes]);"function"===typeof n;)n=n();if(t===n)return n;const o=typeof t,s=void 0!==r;if(e=s&&n[0]&&n[0].parentNode||e,"string"===o||"number"===o){if(Rk.context)return n;if("number"===o&&(t=t.toString()),s){let i=n[0];i&&3===i.nodeType?i.data=t:i=document.createTextNode(t),n=tM(e,n,r,i)}else n=""!==n&&"string"===typeof n?e.firstChild.data=t:e.textContent=t}else if(null==t||"boolean"===o){if(Rk.context)return n;n=tM(e,n,r)}else{if("function"===o)return Yk((()=>{let i=t();for(;"function"===typeof i;)i=i();n=QT(e,i,n,r)})),()=>n;if(Array.isArray(t)){const o=[],a=n&&Array.isArray(n);if($T(o,t,n,i))return Yk((()=>n=QT(e,o,n,r,!0))),()=>n;if(Rk.context){if(!o.length)return n;for(let e=0;er-a){const i=t[s];for(;a=0;o--){const s=t[o];if(i!==s){const t=s.parentNode===e;r||o?t&&s.remove():t?e.replaceChild(i,s):e.insertBefore(i,n)}else r=!0}}else e.insertBefore(i,n);return[i]}function nM(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function rM(e){const{useShadow:t}=e,n=document.createTextNode(""),r=e.mount||document.body;function i(){if(Rk.context){const[t,n]=Kk(!1);return queueMicrotask((()=>n(!0))),()=>t()&&e.children}return()=>e.children}if(r instanceof HTMLHeadElement){const[e,t]=Kk(!1),n=()=>t(!0);Zk((t=>ZT(r,(()=>e()?t():i()()),null))),tT((()=>{Rk.context?queueMicrotask(n):n()}))}else{const o=nM(e.isSVG?"g":"div",e.isSVG),s=t&&o.attachShadow?o.attachShadow({mode:"open"}):o;Object.defineProperty(o,"_$host",{get:()=>n.parentNode,configurable:!0}),ZT(s,i()),r.appendChild(o),e.ref&&e.ref(o),tT((()=>r.removeChild(o)))}return n}function iM(e){const[t,n]=TT(e,["component"]),r=Qk((()=>t.component));return Qk((()=>{const e=r();switch(typeof e){case"function":return eT((()=>e(n)));case"string":const t=jT.has(e),r=Rk.context?KT():nM(e,t);return WT(r,n,t),r}}))}var oM=(e=>(e.DARK="DARK",e.LIGHT="LIGHT",e))(oM||{});let sM={data:""},aM=e=>"object"==typeof window?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||sM,cM=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,uM=/\/\*[^]*?\*\/| +/g,lM=/\n+/g,dM=(e,t)=>{let n="",r="",i="";for(let o in e){let s=e[o];"@"==o[0]?"i"==o[1]?n=o+" "+s+";":r+="f"==o[1]?dM(s,o):o+"{"+dM(s,"k"==o[1]?"":t)+"}":"object"==typeof s?r+=dM(s,t?t.replace(/([^,])+/g,(e=>o.replace(/(^:.*)|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)))):o):null!=s&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=dM.p?dM.p(o,s):o+":"+s+";")}return n+(t&&i?t+"{"+i+"}":i)+r},fM={},hM=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+hM(e[n]);return t}return e},pM=(e,t,n,r,i)=>{let o=hM(e),s=fM[o]||(fM[o]=(e=>{let t=0,n=11;for(;t>>0;return"go"+n})(o));if(!fM[s]){let t=o!==e?e:(e=>{let t,n,r=[{}];for(;t=cM.exec(e.replace(uM,""));)t[4]?r.shift():t[3]?(n=t[3].replace(lM," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(lM," ").trim();return r[0]})(e);fM[s]=dM(i?{["@keyframes "+s]:t}:t,n?"":"."+s)}let a=n&&fM.g?fM.g:null;return n&&(fM.g=fM[s]),c=fM[s],u=t,l=r,(d=a)?u.data=u.data.replace(d,c):-1===u.data.indexOf(c)&&(u.data=l?c+u.data:u.data+c),s;var c,u,l,d},gM=(e,t,n)=>e.reduce(((e,r,i)=>{let o=t[i];if(o&&o.call){let e=o(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":dM(e,""):!1===e?"":e}return e+r+(null==o?"":o)}),"");function mM(e){let t=this||{},n=e.call?e(t.p):e;return pM(n.unshift?n.raw?gM(n,[].slice.call(arguments,1),t.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(t.p):n)),{}):n,aM(t.target),t.g,t.o,t.k)}mM.bind({g:1});let bM=mM.bind({k:1});const yM=rT();function vM(e){return ET(yM.Provider,{value:e.theme,get children(){return e.children}})}function wM(){return iT(yM)}function xM(e){let t=this||{};return(...n)=>{const r=r=>{const i=kT(r,{theme:iT(yM)}),o=kT(i,{get class(){const e=i.class,r="class"in i&&/^go[0-9]+/.test(e);return[e,mM.apply({target:t.target,o:r,p:i,g:t.g},n)].filter(Boolean).join(" ")}}),[s,a]=TT(o,["as","theme"]),c=a,u=s.as||e;let l;return"function"===typeof u?l=u(c):1==t.g?(l=document.createElement(u),WT(l,c)):l=iM(kT({component:u},c)),l};return r.class=e=>eT((()=>mM.apply({target:t.target,p:e,g:t.g},n))),r}}const SM=new Proxy(xM,{get:(e,t)=>e(t)});function AM(){const e=xM.call({g:1},"div").apply(null,arguments);return function(t){return e(t),null}}const EM="tc-root",_M="tc-disable-scroll",CM="tc-using-mouse",IM=()=>{document.body.addEventListener("mousedown",(()=>document.body.classList.add(CM))),document.body.addEventListener("keydown",(e=>{"Tab"===e.key&&document.body.classList.remove(CM)}));return ET(AM` ${EM} * { margin: 0; padding: 0; @@ -1020,4 +1020,4 @@ width: 16px; `,WD=SM(rO)` margin-top: 32px; -`,GD=e=>{const t=nO(e),n=iT(ON),[r,i]=Kk(!0),[o,s]=Kk(!1);let a,c;Jk((()=>{const e=oP();s(!!e&&"sent"in e&&e.sent)})),(null==n?void 0:n.wallet)&&"universalLink"in n.wallet&&("universal-link"===n.wallet.openMethod||bI(n.wallet.universalLink)&&VP())&&(a=n.wallet.universalLink),(null==n?void 0:n.wallet)&&"deepLink"in n.wallet&&("custom-deeplink"===n.wallet.openMethod||bI(n.wallet.deepLink)&&VP())&&(c=n.wallet.deepLink);const u=()=>{const e=oP(),t="returnStrategy"in e?e.returnStrategy:tL.returnStrategy,n=!r();i(!1),bI(a)?NL(a,{returnStrategy:t,twaReturnUrl:"twaReturnUrl"in e?e.twaReturnUrl:tL.twaReturnUrl,forceRedirect:n}):BL(a,c,{returnStrategy:t,forceRedirect:n},(()=>{}))};return ET(FD,kT(t,{get children(){return[Qk((()=>e.icon)),ET(VD,{get translationKey(){return e.headerTranslationKey},get translationValues(){return e.headerTranslationValues}}),ET(qD,{get translationKey(){return e.textTranslationKey},get translationValues(){return e.textTranslationValues}}),ET(PT,{get when(){return!o()&&("open-wallet"===e.showButton&&a||"open-wallet"!==e.showButton)},get children(){return ET(zD,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return ET(HD,{})}})}}),ET(PT,{get when(){return o()},get children(){return[ET(PT,{get when(){return"open-wallet"!==e.showButton},get children(){return ET(WD,{onClick:()=>e.onClose(),get children(){return ET(OL,{translationKey:"common.close",children:"Close"})}})}}),ET(PT,{get when(){return"open-wallet"===e.showButton&&a},get children(){return ET(WD,{onClick:u,get children(){return ET(OL,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},ZD=e=>{const t=iT(ON),[n]=tR();return ET(GD,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:t.wallet&&"name"in t.wallet?t.wallet.name:n("common.yourWallet",{},"Your wallet")}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return ET(LR,{size:"m"})},onClose:()=>e.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},KD=e=>ET(GD,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return ET(OR,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-canceled-modal":"true"}),XD=e=>ET(GD,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return ET(kR,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-sent-modal":"true"}),YD=()=>ET(OO,{get opened(){var e;return Qk((()=>null!==oP()))()&&!0===(null==(e=oP())?void 0:e.openModal)},get enableAndroidBackHandler(){return tL.enableAndroidBackHandler},onClose:()=>sP(null),"data-tc-actions-modal-container":"true",get children(){return ET(OT,{get children(){return[ET(RT,{get when(){return"transaction-sent"===oP().name},get children(){return ET(XD,{onClose:()=>sP(null)})}}),ET(RT,{get when(){return"transaction-canceled"===oP().name},get children(){return ET(KD,{onClose:()=>sP(null)})}}),ET(RT,{get when(){return"confirm-transaction"===oP().name},get children(){return ET(ZD,{onClose:()=>sP(null)})}})]}})}}),JD=()=>{const{locale:e}=tR()[1];Jk((()=>e(tL.language))),Jk((()=>{$M()&&kN()}));const t=iT(lP),n=iT(ON),[r,i]=Kk(!1),o=()=>{var e;return"loading"===(null==(e=tL.connectRequestParameters)?void 0:e.state)},s=Qk((()=>{var e;if(!o())return null==(e=tL.connectRequestParameters)?void 0:e.value})),a=e=>{n.closeSingleWalletModal(e)};return tT(t.onStatusChange((e=>{e&&a("wallet-selected")}))),tT((()=>{i(!1)})),ET(QB,{get opened(){return $M()},get enableAndroidBackHandler(){return tL.enableAndroidBackHandler},onClose:()=>a("action-cancelled"),onClickQuestion:()=>i((e=>!e)),"data-tc-wallets-modal-container":"true",get children(){return[ET(PT,{get when(){return r()},get children(){return ET(ZL,{onBackClick:()=>i(!1)})}}),ET(PT,{get when(){return!r()},get children(){return[ET(PT,{get when(){return o()},get children(){return[ET($B,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),ET(eL,{get children(){return ET(LR,{size:"m"})}})]}}),ET(PT,{get when(){return!o()},get children(){return ET(iM,{get component(){return CN()?uD:DL},get wallet(){return eP()},get additionalRequest(){return s()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},QD=e=>{const t=$O(cP,tL.language);return customElements.define(EM,class extends HTMLElement{}),document.body.hasAttribute("ontouchstart")||document.body.setAttribute("ontouchstart",""),ET(eR.Provider,{value:t,get children(){return ET(ON.Provider,{get value(){return e.tonConnectUI},get children(){return ET(lP.Provider,{get value(){return tL.connector},get children(){return[ET(IM,{}),ET(vM,{theme:MP,get children(){return[ET(PT,{get when(){return tL.buttonRootId},get children(){return ET(rM,{get mount(){return document.getElementById(tL.buttonRootId)},get children(){return ET(JB,{})}})}}),ET(iM,{component:EM,get children(){return[ET(jD,{}),ET(JD,{}),ET(YD,{})]}})]}})]}})}})}})},$D=()=>{setTimeout((()=>XM({status:"opened",closeReason:null})))},eU=e=>{setTimeout((()=>XM({status:"closed",closeReason:e})))},tU=e=>{setTimeout((()=>QM({status:"opened",closeReason:null,walletInfo:e})))},nU=e=>{setTimeout((()=>QM({status:"closed",closeReason:e})))},rU=e=>{setTimeout((()=>sP(e)))},iU=()=>{setTimeout((()=>sP(null)))},oU=()=>nP(),sU=()=>iP(null),aU=(e,t)=>function(e,t,n,r={}){let i;return Zk((r=>{i=r,t===document?e():ZT(t,e(),t.firstChild?null:void 0,n)}),r.owner),()=>{i(),t.textContent=""}}((()=>ET(QD,{tonConnectUI:t})),document.getElementById(e));class cU{constructor(e){Pk(this,"connector"),Pk(this,"setConnectRequestParametersCallback"),Pk(this,"consumers",[]),Pk(this,"tracker"),Pk(this,"state",KM()),this.connector=e.connector,this.tracker=e.tracker,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,Jk((()=>{const e=KM();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(){return Ok(this,null,(function*(){this.tracker.trackConnectionStarted();const e=(yield this.connector.getWallets()).find(UI);return e?this.connectEmbeddedWallet(e):this.openWalletsModal()}))}close(e="action-cancelled"){"action-cancelled"===e&&this.tracker.trackConnectionError("Connection was cancelled"),eU(e)}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{iP(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=tL.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openWalletsModal(){return Ok(this,null,(function*(){return VP()&&qP(),$D(),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}class uU{constructor(e){Pk(this,"connector"),Pk(this,"consumers",[]),this.connector=e.connector,Jk((()=>{const e=oP();this.consumers.forEach((t=>t(e)))}))}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}}class lU{constructor(e){Pk(this,"connector"),Pk(this,"setConnectRequestParametersCallback"),Pk(this,"consumers",[]),Pk(this,"tracker"),Pk(this,"state",JM()),this.connector=e.connector,this.tracker=e.tracker,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,Jk((()=>{const e=JM();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(e){return Ok(this,null,(function*(){this.tracker.trackConnectionStarted();const t=iL(yield this.connector.getWallets(),tL.walletsListConfiguration),n=t.find(UI);if(!!n)return this.connectEmbeddedWallet(n);const r=t.filter(jI).find((t=>cL(t,e)));if(!!r)return this.openSingleWalletModal(r);const i=`Trying to open modal window with unknown wallet "${e}".`;throw this.tracker.trackConnectionError(i),new OM(i)}))}close(e="action-cancelled"){"action-cancelled"===e&&this.tracker.trackConnectionError("Connection was cancelled"),nU("action-cancelled")}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{iP(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=tL.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openSingleWalletModal(e){return Ok(this,null,(function*(){return VP()&&qP(),tU(e),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}class dU{constructor(e){var t;Pk(this,"eventPrefix","ton-connect-ui-"),Pk(this,"tonConnectUiVersion"),Pk(this,"tonConnectSdkVersion",null),Pk(this,"eventDispatcher"),this.eventDispatcher=null!=(t=null==e?void 0:e.eventDispatcher)?t:new ik,this.tonConnectUiVersion=e.tonConnectUiVersion,this.init().catch()}get version(){return WI({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Ok(this,null,(function*(){try{yield this.setRequestVersionHandler(),this.tonConnectSdkVersion=yield this.requestTonConnectSdkVersion()}catch(ej){}}))}setRequestVersionHandler(){return Ok(this,null,(function*(){yield this.eventDispatcher.addEventListener("ton-connect-ui-request-version",(()=>Ok(this,null,(function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-ui-response-version",HI(this.tonConnectUiVersion))}))))}))}requestTonConnectSdkVersion(){return Ok(this,null,(function*(){return new Promise(((e,t)=>Ok(this,null,(function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-response-version",(t=>{e(t.detail.version)}),{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-request-version",{type:"request-version"})}catch(ej){t(ej)}}))))}))}dispatchUserActionEvent(e){var t;try{null==(t=this.eventDispatcher)||t.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch(ej){}}trackConnectionStarted(...e){try{const t=ZI(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackConnectionCompleted(...e){try{const t=KI(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackConnectionError(...e){try{const t=XI(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackConnectionRestoringStarted(...e){try{const t=YI(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackConnectionRestoringCompleted(...e){try{const t=JI(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackConnectionRestoringError(...e){try{const t=QI(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackDisconnection(...e){try{const t=rk(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackTransactionSentForSignature(...e){try{const t=ek(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackTransactionSigned(...e){try{const t=tk(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}trackTransactionSigningFailed(...e){try{const t=nk(this.version,...e);this.dispatchUserActionEvent(t)}catch(ej){}}}class fU{constructor(e){if(Pk(this,"walletInfoStorage",new WM),Pk(this,"preferredWalletStorage",new GM),Pk(this,"tracker"),Pk(this,"walletInfo",null),Pk(this,"systemThemeChangeUnsubscribe",null),Pk(this,"actionsConfiguration"),Pk(this,"walletsList"),Pk(this,"connectRequestParametersCallback"),Pk(this,"connector"),Pk(this,"modal"),Pk(this,"singleWalletModal"),Pk(this,"transactionModal"),Pk(this,"connectionRestored",Promise.resolve(!1)),e&&"connector"in e&&e.connector)this.connector=e.connector;else{if(!(e&&"manifestUrl"in e&&e.manifestUrl))throw new OM("You have to specify a `manifestUrl` or a `connector` in the options.");this.connector=new sk({manifestUrl:e.manifestUrl,eventDispatcher:null==e?void 0:e.eventDispatcher})}this.tracker=new dU({eventDispatcher:null==e?void 0:e.eventDispatcher,tonConnectUiVersion:"2.0.5"}),this.modal=new cU({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.singleWalletModal=new lU({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.transactionModal=new uU({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then((e=>{return UM((t=e.map((e=>e.imageUrl)),[...new Set(t)]));var t}));const t=this.normalizeWidgetRoot(null==e?void 0:e.widgetRootId);this.subscribeToWalletChange(),!1!==(null==e?void 0:e.restoreConnection)&&(this.connectionRestored=function(e){return Ok(this,null,(function*(){return yield new Promise((e=>requestAnimationFrame(e))),e()}))}((()=>Ok(this,null,(function*(){return this.tracker.trackConnectionRestoringStarted(),yield this.connector.restoreConnection(),this.connector.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):(this.tracker.trackConnectionRestoringError("Connection was not restored"),this.walletInfoStorage.removeWalletInfo()),this.connector.connected}))))),this.uiOptions=TP(e,{uiPreferences:{theme:"SYSTEM"}});const n=this.preferredWalletStorage.getPreferredWalletAppName();nL({connector:this.connector,preferredWalletAppName:n}),aU(t,this)}static getWallets(){return sk.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?Tk(Tk({},this.connector.wallet),this.walletInfo):null}set uiOptions(e){var t,n,r,i,o,s,a;this.checkButtonRootExist(e.buttonRootId),this.actionsConfiguration=e.actionsConfiguration,(null==(t=e.uiPreferences)?void 0:t.theme)?"SYSTEM"!==(null==(n=e.uiPreferences)?void 0:n.theme)?(null==(r=this.systemThemeChangeUnsubscribe)||r.call(this),NP(e.uiPreferences.theme,e.uiPreferences.colorsSet)):(NP(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?oM.LIGHT:oM.DARK,e.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=function(e){const t=t=>e(t.matches?oM.DARK:oM.LIGHT);return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t),()=>window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}(NP))):(null==(i=e.uiPreferences)?void 0:i.colorsSet)&&(s=e.uiPreferences.colorsSet,RP[oM.DARK]=TP(s[oM.DARK],RP[oM.DARK]),RP[oM.LIGHT]=TP(s[oM.LIGHT],RP[oM.LIGHT]),PP((e=>({colors:TP(RP[e.theme],OP[e.theme])})))),(null==(o=e.uiPreferences)?void 0:o.borderRadius)&&(a=e.uiPreferences.borderRadius,PP({borderRadius:a})),nL((t=>{var n,r;const i=TP(Tk(Tk(Tk(Tk({},e.language&&{language:e.language}),!!(null==(n=e.actionsConfiguration)?void 0:n.returnStrategy)&&{returnStrategy:e.actionsConfiguration.returnStrategy}),!!(null==(r=e.actionsConfiguration)?void 0:r.twaReturnUrl)&&{twaReturnUrl:e.actionsConfiguration.twaReturnUrl}),!!e.walletsListConfiguration&&{walletsListConfiguration:e.walletsListConfiguration}),mP(t));return void 0!==e.buttonRootId&&(i.buttonRootId=e.buttonRootId),void 0!==e.enableAndroidBackHandler&&(i.enableAndroidBackHandler=e.enableAndroidBackHandler),i}))}setConnectRequestParameters(e){var t;nL({connectRequestParameters:e}),"ready"!==(null==e?void 0:e.state)&&e||null==(t=this.connectRequestParametersCallback)||t.call(this,null==e?void 0:e.value)}getWallets(){return Ok(this,null,(function*(){return this.connector.getWallets()}))}onStatusChange(e,t){return this.connector.onStatusChange((t=>Ok(this,null,(function*(){if(t){const n=yield this.getSelectedWalletInfo(t);e(Tk(Tk({},t),n||this.walletInfoStorage.getWalletInfo()))}else e(t)}))),t)}openModal(){return Ok(this,null,(function*(){return this.modal.open()}))}closeModal(e){this.modal.close(e)}onModalStateChange(e){return this.modal.onStateChange(e)}get modalState(){return this.modal.state}openSingleWalletModal(e){return Ok(this,null,(function*(){return this.singleWalletModal.open(e)}))}closeSingleWalletModal(e){this.singleWalletModal.close(e)}onSingleWalletModalStateChange(e){return this.singleWalletModal.onStateChange(e)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return Ok(this,null,(function*(){const e=(yield this.getWallets()).find(UI);return e?yield this.connectEmbeddedWallet(e):yield this.connectExternalWallet()}))}disconnect(){return this.tracker.trackDisconnection(this.wallet,"dapp"),iU(),sU(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(e,t){return Ok(this,null,(function*(){if(this.tracker.trackTransactionSentForSignature(this.wallet,e),!this.connected)throw this.tracker.trackTransactionSigningFailed(this.wallet,e,"Wallet was not connected"),new OM("Connect wallet to send a transaction.");VP()&&qP();const{notifications:n,modals:r,returnStrategy:i,twaReturnUrl:o,skipRedirectToWallet:s}=this.getModalsAndNotificationsConfiguration(t);rU({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!1});const a=()=>{c.signal.aborted||(rU({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!0}),this.walletInfo&&"universalLink"in this.walletInfo&&("universal-link"===this.walletInfo.openMethod||"custom-deeplink"===this.walletInfo.openMethod)&&(bI(this.walletInfo.universalLink)?NL(this.walletInfo.universalLink,{returnStrategy:i,twaReturnUrl:o||tL.twaReturnUrl,forceRedirect:!1}):BL(this.walletInfo.universalLink,this.walletInfo.deepLink,{returnStrategy:i,forceRedirect:!1},(()=>{}))))},c=new AbortController,u=this.onTransactionModalStateChange((e=>{(null==e?void 0:e.openModal)||(u(),e||c.abort())}));try{const t=yield this.waitForSendTransaction({transaction:e,signal:c.signal},a);return this.tracker.trackTransactionSigned(this.wallet,e,t),rU({name:"transaction-sent",showNotification:n.includes("success"),openModal:r.includes("success")}),t}catch(ej){throw rU({name:"transaction-canceled",showNotification:n.includes("error"),openModal:r.includes("error")}),ej instanceof JC?ej:(console.error(ej),new OM("Unhandled error:"+ej))}finally{u()}}))}connectEmbeddedWallet(e){return Ok(this,null,(function*(){const t=t=>{iP(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=tL.connectRequestParameters;return"loading"===(null==n?void 0:n.state)?this.connectRequestParametersCallback=t:t(null==n?void 0:n.value),yield this.waitForWalletConnection({ignoreErrors:!1})}))}connectExternalWallet(){return Ok(this,null,(function*(){const e=new AbortController;$D();const t=this.onModalStateChange((n=>{const{status:r,closeReason:i}=n;"opened"!==r&&(t(),"action-cancelled"===i&&e.abort())}));return yield this.waitForWalletConnection({ignoreErrors:!0,signal:e.signal})}))}waitForWalletConnection(e){return Ok(this,null,(function*(){return new Promise(((t,n)=>{this.tracker.trackConnectionStarted();const{ignoreErrors:r=!1,signal:i=null}=e;if(i&&i.aborted)return this.tracker.trackConnectionError("Connection was cancelled"),n(new OM("Wallet was not connected"));const o=e=>Ok(this,null,(function*(){if(e)this.tracker.trackConnectionCompleted(e),a(),t(e);else{if(this.tracker.trackConnectionError("Connection was cancelled"),r)return;a(),n(new OM("Wallet was not connected"))}})),s=e=>{this.tracker.trackConnectionError(e.message),r||(a(),n(e))},a=this.onStatusChange((e=>o(e)),(e=>s(e)));i&&i.addEventListener("abort",(()=>{a(),n(new OM("Wallet was not connected"))}),{once:!0})}))}))}waitForSendTransaction(e,t){return Ok(this,null,(function*(){return new Promise(((n,r)=>{const{transaction:i,signal:o}=e;if(o.aborted)return this.tracker.trackTransactionSigningFailed(this.wallet,i,"Transaction was cancelled"),r(new OM("Transaction was not sent"));const s=e=>Ok(this,null,(function*(){n(e)})),a=()=>{this.tracker.trackTransactionSigningFailed(this.wallet,i,"Transaction was cancelled"),r(new OM("Transaction was not sent"))};o.addEventListener("abort",a,{once:!0}),this.connector.sendTransaction(i,{onRequestSent:t,signal:o}).then((e=>(o.removeEventListener("abort",a),s(e)))).catch((e=>(o.removeEventListener("abort",a),(e=>{r(e)})(e))))}))}))}onTransactionModalStateChange(e){return this.transactionModal.onStateChange(e)}subscribeToWalletChange(){this.connector.onStatusChange((e=>Ok(this,null,(function*(){var t;e?(yield this.updateWalletInfo(e),this.setPreferredWalletAppName((null==(t=this.walletInfo)?void 0:t.appName)||e.device.appName)):this.walletInfoStorage.removeWalletInfo()}))))}setPreferredWalletAppName(e){this.preferredWalletStorage.setPreferredWalletAppName(e),nL({preferredWalletAppName:e})}getSelectedWalletInfo(e){return Ok(this,null,(function*(){let t,n=oU();if(!n)return null;if("name"in n)t=n;else{const r=iL(yield this.walletsList,tL.walletsListConfiguration).find((t=>cL(t,e.device.appName)));if(!r)throw new OM(`Cannot find WalletInfo for the '${e.device.appName}' wallet`);t=Tk(Tk({},r),n)}return t}))}updateWalletInfo(e){return Ok(this,null,(function*(){const t=yield this.getSelectedWalletInfo(e);if(t)return this.walletInfo=t,void this.walletInfoStorage.setWalletInfo(t);const n=this.walletInfoStorage.getWalletInfo();this.walletInfo=n||((yield this.walletsList).find((t=>cL(t,e.device.appName)))||null)}))}normalizeWidgetRoot(e){if(!e||!document.getElementById(e)){e="tc-widget-root";const t=document.createElement("div");t.id=e,document.body.appendChild(t)}return e}checkButtonRootExist(e){if(null!=e&&!document.getElementById(e))throw new OM(`${e} element not found in the document.`)}getModalsAndNotificationsConfiguration(e){var t,n,r,i,o,s;const a=["before","success","error"];let c=a;(null==(t=this.actionsConfiguration)?void 0:t.notifications)&&"all"!==(null==(n=this.actionsConfiguration)?void 0:n.notifications)&&(c=this.actionsConfiguration.notifications),(null==e?void 0:e.notifications)&&(c="all"===e.notifications?a:e.notifications);let u=["before"];(null==(r=this.actionsConfiguration)?void 0:r.modals)&&(u="all"===this.actionsConfiguration.modals?a:this.actionsConfiguration.modals),(null==e?void 0:e.modals)&&(u="all"===e.modals?a:e.modals);const l=(null==e?void 0:e.returnStrategy)||(null==(i=this.actionsConfiguration)?void 0:i.returnStrategy)||"back",d=(null==e?void 0:e.twaReturnUrl)||(null==(o=this.actionsConfiguration)?void 0:o.twaReturnUrl);let f=(null==e?void 0:e.skipRedirectToWallet)||(null==(s=this.actionsConfiguration)?void 0:s.skipRedirectToWallet)||"ios";return VP()&&(f="never"),{notifications:c,modals:u,returnStrategy:l,twaReturnUrl:d,skipRedirectToWallet:f}}}var hU,pU=Object.defineProperty,gU=Object.getOwnPropertySymbols,mU=Object.prototype.hasOwnProperty,bU=Object.prototype.propertyIsEnumerable,yU=(e,t,n)=>t in e?pU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vU=(e,t)=>{for(var n in t||(t={}))mU.call(t,n)&&yU(e,n,t[n]);if(gU)for(var n of gU(t))bU.call(t,n)&&yU(e,n,t[n]);return e},wU={exports:{}},xU={};!function(e){e.exports=function(){if(hU)return xU;hU=1;var e=I,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,n,s){var a,c={},u=null,l=null;for(a in void 0!==s&&(u=""+s),void 0!==n.key&&(u=""+n.key),void 0!==n.ref&&(l=n.ref),n)r.call(n,a)&&!o.hasOwnProperty(a)&&(c[a]=n[a]);if(e&&e.defaultProps)for(a in n=e.defaultProps)void 0===c[a]&&(c[a]=n[a]);return{$$typeof:t,type:e,key:u,ref:l,props:c,_owner:i.current}}return xU.Fragment=n,xU.jsx=s,xU.jsxs=s,xU}()}(wU);const SU=wU.exports.jsx;function AU(){return"undefined"!==typeof window}const EU=(0,I.createContext)(null);let _U=null;(0,I.memo)((e=>{var t=e,{children:n}=t,r=((e,t)=>{var n={};for(var r in e)mU.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&gU)for(var r of gU(e))t.indexOf(r)<0&&bU.call(e,r)&&(n[r]=e[r]);return n})(t,["children"]);return AU()&&!_U&&(_U=new fU(r)),SU(EU.Provider,{value:_U,children:n})}));class CU extends OM{constructor(...e){super(...e),Object.setPrototypeOf(this,CU.prototype)}}class IU extends CU{constructor(...e){super(...e),Object.setPrototypeOf(this,IU.prototype)}}function kU(){const e=(0,I.useContext)(EU),t=(0,I.useCallback)((t=>{e&&(e.uiOptions=t)}),[e]);return AU()?(function(e){if(!e)throw new IU("You should add on the top of the app to use TonConnect")}(e),[e,t]):[null,()=>{}]}const TU="ton-connect-button";(0,I.memo)((({className:e,style:t})=>{const[n,r]=kU();return(0,I.useEffect)((()=>(r({buttonRootId:TU}),()=>r({buttonRootId:null}))),[r]),SU("div",{id:TU,className:e,style:vU({width:"fit-content"},t)})}));var MU=n(42474),PU=n(11187),OU=n(39374),RU=n(48764).Buffer;function NU(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}var BU,LU="ton-proof-item-v2/",DU="ton-connect";function UU(e){return jU.apply(this,arguments)}function jU(){return jU=(0,w.Z)(A().mark((function e(t){var n,r,i,o,s,a,c;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=RU.from((0,PU.hL)(t.Workchain,{size:4})),r=RU.from((0,PU.hL)(t.Timstamp,{size:8}).reverse()),i=RU.from((0,PU.hL)(t.Domain.LengthBytes,{size:4}).reverse()),o=RU.concat([RU.from(LU),n,t.Address,i,RU.from(t.Domain.Value),r,RU.from(t.Payload)]),s=(0,MU.createHash)("sha256").update(o).digest(),a=RU.concat([RU.from([255,255]),RU.from(DU),RU.from(s)]),c=(0,MU.createHash)("sha256").update(a).digest(),e.abrupt("return",RU.from(c));case 8:case"end":return e.stop()}}),e)}))),jU.apply(this,arguments)}var FU=function(e){L(n,e);var t=NU(n);function n(){var e;(0,M.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o2&&void 0!==arguments[2]?arguments[2]:"files:login";T().set("".concat(n,":").concat(e,":last"),t)}var WU={files:[],isLoad:!0},GU=function(e){e.files.forEach((function(e){e.PinTime||(e.PinTime=(new Date).getTime())}))};function ZU(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"files",t=(0,I.useState)(WU),n=t[0],r=t[1];(0,I.useEffect)((function(){try{var t=T().get(e,WU);t.isLoad=!1,t!==WU&&(GU(t),r(t))}catch(n){console.error(n)}}),[e]);var i=(0,I.useCallback)((function(t){var i=qU(qU({},n),{},{files:t});GU(i),r(i),T().set(e,i)}),[n,e]),o=(0,I.useCallback)((function(e){e.Hash&&i(n.files.filter((function(t){return t.Hash!==e.Hash})))}),[n,i]);return(0,I.useMemo)((function(){return qU(qU({},n),{},{setFiles:i,deleteItem:o,key:e})}),[n,i,o,e])}function KU(e){var t=(0,I.useState)({}),n=t[0],r=t[1];return(0,I.useEffect)((function(){if(!e.account)return function(){};r((function(){return{sign:function(){var t=(0,w.Z)(A().mark((function t(n){var r;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null===(r=e.useWallet)||void 0===r?void 0:r.sign(n,e.account));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}}))}),[e]),n}var XU={account:"",wallet:"crust",key:"files:login",authBasic:null,authBearer:null},YU={crust:new re,"polkadot-js":new SC,subWallet:new TC,talisman:new zC,metamask:new f_,metax:new YA,flow:new Yx,solana:new _C,algorand:new G,elrond:new ce,"aptos-martian":new K,"aptos-petra":new Y,"wallet-connect":new ZA,oasis:new f_,mimir:new yC,"ton-connect":new FU};function JU(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"files:login",t=(0,I.useState)(XU),n=t[0],r=t[1],i=(0,I.useState)(),o=i[0],s=i[1],a=(0,I.useState)(""),c=a[0],u=a[1],l=(0,I.useState)(),d=l[0],f=l[1],h=(0,I.useState)(!0),p=h[0],g=h[1],m=(0,C.useRouter)(),b=(0,I.useCallback)((function(t){var n=qU(qU({},t),{},{key:e});console.info("nAccount:",n),r(n),T().set(e,n),zU.includes(n.wallet)&&n.account&&HU(n.wallet,n)}),[e]);(0,I.useEffect)((function(){var e=YU[n.wallet];e.onAccountChange=function(e){console.info("accountsChange::",e,n),!_().isEmpty(e)&&e.find((function(e){return e==n.account}))||b(XU)},e.onChainChange=function(e){b(qU({},n))}}),[n]),(0,I.useEffect)((function(){var t=function(){var t=(0,w.Z)(A().mark((function t(){var n,i,o,a,c,u,l;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=T().get(e,XU),s(void 0),i=YU.mimir,t.next=5,i.init();case 5:if(!i.provider){t.next=17;break}return t.next=8,i.login(n);case 8:return o=t.sent,a=(0,v.Z)(o,2),c=a[0],u=a[1],s(c),r(u),T().set(e,u),g(!1),t.abrupt("return");case 17:if(n!==XU&&""!==n.account&&n.authBasic){t.next=20;break}return g(!1),t.abrupt("return");case 20:(l=YU[n.wallet]).init(n).then((function(){l.account&&r(n),s(l.accounts)})).then((function(){return g(!1)}));case 22:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();t().catch((function(e){console.error(e),g(!1)}))}),[e,m.pathname]);var y=(0,I.useCallback)((0,w.Z)(A().mark((function e(){return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:YU[n.wallet].disconnect(),b(qU({},XU));case 2:case"end":return e.stop()}}),e)}))),[b,n]),x=(0,I.useState)(),S=x[0],E=x[1],k=(0,I.useMemo)((function(){return qU(qU({},n),{},{accounts:o,key:e,isLoad:p,setLoginUser:b,logout:y,useWallet:YU[n.wallet],crust:YU.crust,metamask:YU.metamask,walletConnect:YU["wallet-connect"],nickName:c,setNickName:u,setMember:f,member:d,setIsLoadingNickname:E,isLoadingNickname:S})}),[n,o,p,b,y,c,d,e,S]),M=KU(k);return k.sign=M.sign,k}var QU=I.createContext(null);function $U(){return(0,I.useContext)(QU)}},42103:function(e,t,n){"use strict";n.d(t,{C8:function(){return p},JS:function(){return d},WJ:function(){return l},_v:function(){return a},iQ:function(){return u},vw:function(){return h}});var r=n(50029),i=n(87794),o=n.n(i),s=n(47687);function a(e){return new Promise((function(t){setTimeout(t,e)}))}var c=function(e,t){return e.events.find((function(e){return"".concat(e.event.section.toString(),"(").concat(e.event.method.toString(),")")===t}))};function u(e,t){return new Promise((function(n,r){e.signAndSend(t,{nonce:-1,tip:0},(function(e){e.status.isFinalized&&(!!c(e,"system(ExtrinsicSuccess)")?n():r("Error"));(e.status.isFinalityTimeout||e.status.isRetracted)&&r("Timeout")})).catch(r)}))}var l=function(e){return e.wallet.startsWith("metamask")||"metax"===e.wallet||"wallet-connect"===e.wallet?"eth":"flow"===e.wallet?"flow":"solana"===e.wallet?"sol":"elrond"===e.wallet?"elrond":"algorand"===e.wallet?"algo":"aptos-martian"==e.wallet||"aptos-petra"==e.wallet?"aptos":"ton-connect"==e.wallet?"ton":"substrate"};function d(e){return f.apply(this,arguments)}function f(){return f=(0,r.Z)(o().mark((function e(t){var n,r,i,a,c,u,d,f,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=h.length>1&&void 0!==h[1]?h[1]:s.kb[t.wallet],r="aptos-martian"===t.wallet||"aptos-petra"==t.wallet||"ton-connect"==t.wallet?t.pubKey||"":t.account,e.next=4,n.sign(r,t.account);case 4:i=e.sent,t.signature=i,a=l(t),c="".concat(a,"-").concat(r).concat(i.includes(":")?"-"+i:":"+i),u=window.btoa(c),d="".concat(u),f="".concat(u),t.authBasic=d,t.authBearer=f;case 13:case"end":return e.stop()}}),e)}))),f.apply(this,arguments)}var h="User rejected action",p="UserClosed"},39275:function(e,t,n){"use strict";n.d(t,{cC:function(){return u},vx:function(){return l}});var r=n(50029),i=n(92777),o=n(82262),s=n(59499),a=n(87794),c=n.n(a),u=function(){function e(){(0,i.Z)(this,e),(0,s.Z)(this,"name",void 0),(0,s.Z)(this,"icon",void 0),(0,s.Z)(this,"group",void 0),(0,s.Z)(this,"accounts",[]),(0,s.Z)(this,"account",void 0),(0,s.Z)(this,"pubKey",void 0),(0,s.Z)(this,"isInit",void 0),(0,s.Z)(this,"isConnected",void 0),(0,s.Z)(this,"onAccountChange",void 0),(0,s.Z)(this,"onChainChange",void 0)}return(0,o.Z)(e,[{key:"init",value:function(){var e=(0,r.Z)(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetchAccounts();case 2:this.accounts=e.sent,t&&this.accounts.includes(t.account)&&(this.account=t.account,this.isConnected=!0);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"disconnect",value:function(){this.isConnected=!1,this.onAccountChange=void 0,this.onChainChange=void 0,this.isInit=!1}},{key:"getProvider",value:function(){}}]),e}(),l=(0,o.Z)((function e(){(0,i.Z)(this,e),(0,s.Z)(this,"account",""),(0,s.Z)(this,"pubKey",void 0),(0,s.Z)(this,"wallet",void 0),(0,s.Z)(this,"key","files:login"),(0,s.Z)(this,"authBasic",void 0),(0,s.Z)(this,"authBearer",void 0),(0,s.Z)(this,"signature",void 0),(0,s.Z)(this,"profileImage",void 0)}))},78e3:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AmpStateContext=void 0;var r=(0,n(92648).Z)(n(67294)).default.createContext({});t.AmpStateContext=r},9470:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInAmpMode=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.ampFirst,n=void 0!==t&&t,r=e.hybrid,i=void 0!==r&&r,o=e.hasQuery,s=void 0!==o&&o;return n||i&&s}},72717:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultHead=l,t.default=void 0;var r=n(6495).Z,i=n(92648).Z,o=(0,n(91598).Z)(n(67294)),s=i(n(11585)),a=n(78e3),c=n(15850),u=n(9470);n(99475);function l(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=[o.default.createElement("meta",{charSet:"utf-8"})];return e||t.push(o.default.createElement("meta",{name:"viewport",content:"width=device-width"})),t}function d(e,t){return"string"===typeof t||"number"===typeof t?e:t.type===o.default.Fragment?e.concat(o.default.Children.toArray(t.props.children).reduce((function(e,t){return"string"===typeof t||"number"===typeof t?e:e.concat(t)}),[])):e.concat(t)}var f=["name","httpEquiv","charSet","itemProp"];function h(e,t){var n=t.inAmpMode;return e.reduce(d,[]).reverse().concat(l(n).reverse()).filter(function(){var e=new Set,t=new Set,n=new Set,r={};return function(i){var o=!0,s=!1;if(i.key&&"number"!==typeof i.key&&i.key.indexOf("$")>0){s=!0;var a=i.key.slice(i.key.indexOf("$")+1);e.has(a)?o=!1:e.add(a)}switch(i.type){case"title":case"base":t.has(i.type)?o=!1:t.add(i.type);break;case"meta":for(var c=0,u=f.length;c1&&void 0!==arguments[1]?arguments[1]:{};f(this,e),this.init(t,n)}return p(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||w,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function i(){return!e||"string"===typeof e}for(var o="string"!==typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!e[s]&&n&&(e[s]=new n),e=Object.prototype.hasOwnProperty.call(e,s)?e[s]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function k(e,t,n){var r=I(e,t,Object);r.obj[r.k]=n}function T(e,t){var n=I(e,t),r=n.obj,i=n.k;if(r)return r[i]}function M(e,t,n){var r=T(e,n);return void 0!==r?r:T(t,n)}function P(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"===typeof e[r]||e[r]instanceof String||"string"===typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):P(e[r],t[r],n):e[r]=t[r]);return e}function O(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var R={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function N(e){return"string"===typeof e?e.replace(/[&<>"'\/]/g,(function(e){return R[e]})):e}var B="undefined"!==typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,L=[" ",",","?","!",";"];function D(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;oo+s;)s++,c=i[a=r.slice(o,o+s).join(n)];if(void 0===c)return;if("string"===typeof c)return c;if(a&&"string"===typeof c[a])return c[a];var u=r.slice(o+s).join(n);return u?D(c,u,n):void 0}i=i[r[o]]}return i}}var U=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return f(this,t),n=m(this,b(t).call(this)),B&&A.call(g(n)),n.data=e||{},n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),void 0===n.options.ignoreJSONStructure&&(n.options.ignoreJSONStructure=!0),n}return v(t,e),p(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,s=[e,t];n&&"string"!==typeof n&&(s=s.concat(n)),n&&"string"===typeof n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."));var a=T(this.data,s);return a||!o||"string"!==typeof n?a:D(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[e,t];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(s=e.split("."))[1]),this.addNamespaces(t),k(this.data,s,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!==typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},s=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(s=e.split("."))[1]),this.addNamespaces(t);var a=T(this.data,s)||{};r?P(a,n,i):a=d({},a,n),k(this.data,s,a),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?d({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),t}(A),j={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}},F={},V=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return f(this,t),n=m(this,b(t).call(this)),B&&A.call(g(n)),C(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,g(n)),n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=S.create("translator"),n}return v(t,e),p(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(void 0===e||null===e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS,o=n&&e.indexOf(n)>-1,s=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!function(e,t,n){t=t||"",n=n||"";var r=L.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}(e,n,r);if(o&&!s){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var c=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(c[0])>-1)&&(i=c.shift()),e=c.join(r)}return"string"===typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,n,r){var i=this;if("object"!==u(n)&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),n||(n={}),void 0===e||null===e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],n),a=s.key,c=s.namespaces,l=c[c.length-1],f=n.lng||this.language,h=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f&&"cimode"===f.toLowerCase()){if(h){var p=n.nsSeparator||this.options.nsSeparator;return l+p+a}return a}var g=this.resolve(e,n),m=g&&g.res,b=g&&g.usedKey||a,y=g&&g.exactUsedKey||a,v=Object.prototype.toString.apply(m),w=["[object Number]","[object Function]","[object RegExp]"],x=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,A="string"!==typeof m&&"boolean"!==typeof m&&"number"!==typeof m;if(S&&m&&A&&w.indexOf(v)<0&&("string"!==typeof x||"[object Array]"!==v)){if(!n.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(b,m,d({},n,{ns:c})):"key '".concat(a," (").concat(this.language,")' returned an object instead of string.");if(o){var E="[object Array]"===v,_=E?[]:{},C=E?y:b;for(var I in m)if(Object.prototype.hasOwnProperty.call(m,I)){var k="".concat(C).concat(o).concat(I);_[I]=this.translate(k,d({},n,{joinArrays:!1,ns:c})),_[I]===k&&(_[I]=m[I])}m=_}}else if(S&&"string"===typeof x&&"[object Array]"===v)(m=m.join(x))&&(m=this.extendTranslation(m,e,n,r));else{var T=!1,M=!1,P=void 0!==n.count&&"string"!==typeof n.count,O=t.hasDefaultValue(n),R=P?this.pluralResolver.getSuffix(f,n.count,n):"",N=n["defaultValue".concat(R)]||n.defaultValue;!this.isValidLookup(m)&&O&&(T=!0,m=N),this.isValidLookup(m)||(M=!0,m=a);var B=n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,L=B&&M?void 0:m,D=O&&N!==m&&this.options.updateMissing;if(M||T||D){if(this.logger.log(D?"updateKey":"missingKey",f,l,a,D?N:m),o){var U=this.resolve(a,d({},n,{keySeparator:!1}));U&&U.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var j=[],F=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&F&&F[0])for(var V=0;V1&&void 0!==arguments[1]?arguments[1]:{};return"string"===typeof e&&(e=[e]),e.forEach((function(e){if(!s.isValidLookup(t)){var c=s.extractFromKey(e,a),u=c.key;n=u;var l=c.namespaces;s.options.fallbackNS&&(l=l.concat(s.options.fallbackNS));var d=void 0!==a.count&&"string"!==typeof a.count,f=void 0!==a.context&&("string"===typeof a.context||"number"===typeof a.context)&&""!==a.context,h=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);l.forEach((function(e){s.isValidLookup(t)||(o=e,!F["".concat(h[0],"-").concat(e)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(F["".concat(h[0],"-").concat(e)]=!0,s.logger.warn('key "'.concat(n,'" for languages "').concat(h.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach((function(n){if(!s.isValidLookup(t)){i=n;var o,c,l=u,h=[l];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(h,u,n,e,a);else d&&(o=s.pluralResolver.getSuffix(n,a.count,a)),d&&f&&h.push(l+o),f&&h.push(l+="".concat(s.options.contextSeparator).concat(a.context)),d&&h.push(l+=o);for(;c=h.pop();)s.isValidLookup(t)||(r=c,t=s.getResource(n,e,c,a))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),t}(A);function q(e){return e.charAt(0).toUpperCase()+e.slice(1)}var z=function(){function e(t){f(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=S.create("languageUtils")}return p(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"===typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=q(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=q(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=q(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"===typeof e&&(e=e(t)),"string"===typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"===typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"===typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),H=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],W={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},G=["v1","v2","v3"],Z={zero:0,one:1,two:2,few:3,many:4,other:5};function K(){var e={};return H.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:W[t.fc]}}))})),e}var X=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f(this,e),this.languageUtils=t,this.options=n,this.logger=S.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!==typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=K()}return p(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(n){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return Z[e]-Z[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"===typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!G.includes(this.options.compatibilityJSON)}}]),e}(),Y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f(this,e),this.logger=S.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return p(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:N,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?O(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?O(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?O(t.nestingPrefix):t.nestingPrefixEscaped||O("$t("),this.nestingSuffix=t.nestingSuffix?O(t.nestingSuffix):t.nestingSuffixEscaped||O(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,s,a=this,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var l=function(e){if(e.indexOf(a.formatSeparator)<0){var i=M(t,c,e);return a.alwaysFormat?a.format(i,void 0,n,d({},r,t,{interpolationkey:e})):i}var o=e.split(a.formatSeparator),s=o.shift().trim(),u=o.join(a.formatSeparator).trim();return a.format(M(t,c,s),u,n,d({},r,t,{interpolationkey:s}))};this.resetRegExp();var f=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?u(a.escape(e)):u(e)}}].forEach((function(t){for(s=0;i=t.regex.exec(e);){if(void 0===(o=l(i[1].trim())))if("function"===typeof f){var n=f(e,i,r);o="string"===typeof n?n:""}else{if(h){o=i[0];continue}a.logger.warn("missed to pass in variable ".concat(i[1]," for interpolating ").concat(e)),o=""}else"string"===typeof o||a.useRawValueToEscape||(o=_(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=c.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++s>=a.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=d({},o);function a(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0],i=(i=this.interpolate(i,s)).replace(/'/g,'"');try{s=JSON.parse(i),t&&(s=d({},t,s))}catch(o){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),o),"".concat(e).concat(n).concat(i)}return delete s.defaultValue,e}for(s.applyPostProcessor=!1,delete s.defaultValue;n=this.nestingRegexp.exec(e);){var c=[],u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var l=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=l.shift(),c=l,u=!0}if((r=t(a.call(this,n[1].trim(),s),s))&&n[0]===e&&"string"!==typeof r)return r;"string"!==typeof r&&(r=_(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),u&&(r=c.reduce((function(e,t){return i.format(e,t,o.lng,d({},o,{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();var J=function(e){function t(e,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return f(this,t),i=m(this,b(t).call(this)),B&&A.call(g(i)),i.backend=e,i.store=n,i.services=r,i.languageUtils=r.languageUtils,i.options=o,i.logger=S.create("backendConnector"),i.state={},i.queue=[],i.backend&&i.backend.init&&i.backend.init(r,o.backend,o),i}return v(t,e),p(t,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o=[],s=[],a=[],c=[];return e.forEach((function(e){var r=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[a]=2:i.state[a]<0||(1===i.state[a]?s.indexOf(a)<0&&s.push(a):(i.state[a]=1,r=!1,s.indexOf(a)<0&&s.push(a),o.indexOf(a)<0&&o.push(a),c.indexOf(t)<0&&c.push(t)))})),r||a.push(e)})),(o.length||s.length)&&this.queue.push({pending:s,loaded:{},errors:[],callback:r}),{toLoad:o,pending:s,toLoadLanguages:a,toLoadNamespaces:c}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var s={};this.queue.forEach((function(n){!function(e,t,n,r){var i=I(e,t,Object),o=i.obj,s=i.k;o[s]=o[s]||[],r&&(o[s]=o[s].concat(n)),r||o[s].push(n)}(n.loaded,[i],o),function(e,t){for(var n=e.indexOf(t);-1!==n;)e.splice(n,1),n=e.indexOf(t)}(n.pending,e),t&&n.errors.push(t),0!==n.pending.length||n.done||(Object.keys(n.loaded).forEach((function(e){s[e]||(s[e]=[]),n.loaded[e].length&&n.loaded[e].forEach((function(t){s[e].indexOf(t)<0&&s[e].push(t)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,s=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[n](e,t,(function(a,c){a&&c&&i<5?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,s)}),o):s(a,c)})):s(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"===typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"===typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,s){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&s&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),s),t.loaded(e,r,s)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):void 0!==n&&null!==n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,d({},o,{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),t}(A);function Q(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===u(e[1])&&(t=e[1]),"string"===typeof e[1]&&(t.defaultValue=e[1]),"string"===typeof e[2]&&(t.tDescription=e[2]),"object"===u(e[2])||"object"===u(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function $(e){return"string"===typeof e.ns&&(e.ns=[e.ns]),"string"===typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"===typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function ee(){}var te=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(f(this,t),e=m(this,b(t).call(this)),B&&A.call(g(e)),e.options=$(n),e.services={},e.logger=S,e.modules={external:[]},r&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,r),m(e,g(e));setTimeout((function(){e.init(n,r)}),0)}return e}return v(t,e),p(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;function r(e){return e?"function"===typeof e?new e:e:null}if("function"===typeof t&&(n=t,t={}),!t.defaultNS&&t.ns&&("string"===typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0])),this.options=d({},Q(),this.options,$(t)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),this.format=this.options.interpolation.format,n||(n=ee),!this.options.isClone){this.modules.logger?S.init(r(this.modules.logger),this.options):S.init(null,this.options);var i=new z(this.options);this.store=new U(this.options.resources,this.options);var o=this.services;o.logger=S,o.resourceStore=this.store,o.languageUtils=i,o.pluralResolver=new X(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),o.interpolator=new Y(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new J(r(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i1?n-1:0),i=1;i0&&"dev"!==s[0]&&(this.options.lng=s[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var a=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];a.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var c=["addResource","addResources","addResourceBundle","removeResourceBundle"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var u=E(),l=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?l():setTimeout(l,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ee,r=n,i="string"===typeof e?e:this.language;if("function"===typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)s(i);else{var a=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);a.forEach((function(e){return s(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(o,this.options.ns,r)}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=E();return e||(e=this.languages),t||(t=this.options.ns),n||(n=ee),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&j.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=E();this.emit("languageChanging",e);var i=function(e){if(n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t-1)&&n.store.hasLanguageSomeTranslations(r)){n.resolvedLanguage=r;break}}},o=function(o){e||o||!n.services.languageDetector||(o=[]);var s="string"===typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);s&&(n.language||i(s),n.translator.language||n.translator.changeLanguage(s),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(s)),n.loadResources(s,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,s)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==u(i)){for(var s=arguments.length,a=new Array(s>2?s-2:0),c=2;c1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var s=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var a=n.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(r,e)||(!this.services.backendConnector.backend||!(!s(r,e)||i&&!s(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=E();return this.options.ns?("string"===typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=E();"string"===typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr"}},{key:"createInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new t(e,n)}},{key:"cloneInstance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ee,i=d({},this.options,n,{isClone:!0}),o=new t(i),s=["store","services","language"];return s.forEach((function(t){o[t]=e[t]})),o.services=d({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new V(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&r(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(n)}catch(a){console&&console.log(a)}}(e,t,n,r):void 0};function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ye(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};be(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}var t,n,r;return t=e,n=[{key:"init",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=ae(n,this.options||{},ve()),this.allOptions=r,this.services&&this.options.reloadInterval&&setInterval((function(){return t.reload()}),this.options.reloadInterval)}},{key:"readMulti",value:function(e,t,n){this._readAny(e,e,t,t,n)}},{key:"read",value:function(e,t,n){this._readAny([e],e,[t],t,n)}},{key:"_readAny",value:function(e,t,n,r,i){var o,s=this,a=this.options.loadPath;"function"===typeof this.options.loadPath&&(a=this.options.loadPath(e,n)),(a=function(e){return!!e&&"function"===typeof e.then}(o=a)?o:Promise.resolve(o)).then((function(o){var a=s.services.interpolator.interpolate(o,{lng:e.join("+"),ns:n.join("+")});s.loadUrl(a,i,t,r)}))}},{key:"loadUrl",value:function(e,t,n,r){var i=this;this.options.request(this.options,e,void 0,(function(o,s){if(s&&(s.status>=500&&s.status<600||!s.status))return t("failed loading "+e+"; status code: "+s.status,!0);if(s&&s.status>=400&&s.status<500)return t("failed loading "+e+"; status code: "+s.status,!1);if(!s&&o&&o.message&&o.message.indexOf("Failed to fetch")>-1)return t("failed loading "+e+": "+o.message,!0);if(o)return t(o,!1);var a,c;try{a="string"===typeof s.data?i.options.parse(s.data,n,r):s.data}catch(u){c="failed parsing "+e+" to json"}if(c)return t(c,!1);t(null,a)}))}},{key:"create",value:function(e,t,n,r,i){var o=this;if(this.options.addPath){"string"===typeof e&&(e=[e]);var s=this.options.parsePayload(t,n,r),a=0,c=[],u=[];e.forEach((function(n){var r=o.options.addPath;"function"===typeof o.options.addPath&&(r=o.options.addPath(n,t));var l=o.services.interpolator.interpolate(r,{lng:n,ns:t});o.options.request(o.options,l,s,(function(t,n){a+=1,c.push(t),u.push(n),a===e.length&&i&&i(c,u)}))}))}}},{key:"reload",value:function(){var e=this,t=this.services,n=t.backendConnector,r=t.languageUtils,i=t.logger,o=n.language;if(!o||"cimode"!==o.toLowerCase()){var s=[],a=function(e){r.toResolveHierarchy(e).forEach((function(e){s.indexOf(e)<0&&s.push(e)}))};a(o),this.allOptions.preload&&this.allOptions.preload.forEach((function(e){return a(e)})),s.forEach((function(t){e.allOptions.ns.forEach((function(e){n.read(t,e,"read",null,null,(function(r,o){r&&i.warn("loading namespace ".concat(e," for language ").concat(t," failed"),r),!r&&o&&i.log("loaded namespace ".concat(e," for language ").concat(t),o),n.loaded("".concat(t,"|").concat(e),r,o)}))}))}))}}}],n&&ye(t.prototype,n),r&&ye(t,r),e}();we.type="backend";var xe=we,Se=n(81960),Ae=n(22479),Ee=n(40849),_e=n(90356),Ce=n(96486),Ie=n.n(Ce),ke={last:0};var Te=n(5320),Me=n(69168);var Pe=n(47687),Oe=n(68156),Re=n(54335),Ne=n(94184),Be=n.n(Ne),Le=n(98255),De=n(85893);function Ue(e){return e.title?e.title:"error"===e.type?"Error":"warn"===e.type?"Warning":"success"===e.type?"Success":""}var je=c.memo((0,Re.ZP)((function(e){var t=e.className,n=(0,c.useContext)(_e.Il).alert,r=(0,a.useRouter)(),i=""===r.pathname||"/"===r.pathname;return(0,De.jsx)("div",{className:Be()(t,{isMain:i}),children:n.alerts.map((function(e,t){return(0,De.jsx)(De.Fragment,{children:e.modal?(0,De.jsx)("div",{style:{position:"fixed",top:0,width:"100%",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",background:"rgba(0,0,0, 0.3)"},children:(0,De.jsxs)("div",{style:{background:"white",borderRadius:8,overflow:"hidden"},children:[(0,De.jsxs)("div",{style:{borderBottom:"1px solid #eeeeee",padding:14},children:[(0,De.jsx)("span",{style:{fontSize:22,color:"#333333"},children:Ue(e)}),(0,De.jsx)("span",{className:"close cru-fo-x",onClick:function(){return n.close(e)}})]}),(0,De.jsxs)("div",{style:{padding:14,minWidth:"260px",maxWidth:"400px"},children:[(0,De.jsx)("div",{style:{fontSize:18,color:"#666666",marginBottom:"1.6rem"},children:e.msg}),(0,De.jsx)(Le.Z,{fluid:!0,className:"ok",content:"OK",onClick:function(){return n.close(e)}})]})]})}):(0,De.jsxs)(Oe.Z,{className:Be()("msg","font-sans-regular",{isMain:i}),size:"small",children:[(0,De.jsx)("span",{className:"cru-fo ".concat((r=e.type,"success"===r?"cru-fo-check-circle":"error"===r?"cru-fo-x-circle":"cru-fo-info-circle")," ").concat(e.type)}),e.title&&(0,De.jsx)(Oe.Z.Header,{children:e.title}),(0,De.jsx)(Oe.Z.Content,{children:e.msg})]},"alert_".concat(t))});var r}))})})).withConfig({displayName:"AlertMessage",componentId:"sc-hvhjpq-0"})(["position:fixed;width:100%;height:0;overflow:visible;z-index:10000;top:2.3rem;display:flex;flex-direction:column;align-items:center;left:0;.msg{flex-shrink:0;display:block;padding:1.14rem 1.7rem;background:#FFFFFF;box-shadow:0 0.57rem 1.14rem 0 rgba(0,0,0,0.1) !important;border-radius:0.86rem !important;border:0.07rem solid #EEEEEE;&.isMain{border:unset;margin-right:3.4rem;.content{}}.content{display:inline-block;color:var(--secend-color) !important;font-size:1.14rem;}}.cru-fo{font-size:1.4rem;float:left;margin-right:0.8rem;display:inline-block;}.success{color:#56CB8F;}.error{color:#F37565;}.warn{color:#cbae56;}.info{color:#3b62d2;}.close{cursor:pointer;float:right;margin-top:5px;vertical-align:baseline;right:1rem;font-size:1rem;color:#666666;&:hover{color:#333333;}}"])),Fe=n(46702),Ve=n.n(Fe),qe=n(10720);var ze=(0,Re.ZP)((function(e){var t=(0,_e.qD)(),n=t.recaptcha,r=t.alert,i=n._onChange,o=n._onExpired,s=n._onLoaded,a=n.loadingScript,c=n.showReCaptcha;return(0,De.jsx)(De.Fragment,{children:c&&(0,De.jsx)("div",{className:e.className,style:{display:"flex",position:"fixed",zIndex:1e5,background:"rgba(0,0,0,0.4)",justifyContent:"center",alignItems:"center",left:0,top:0,width:"100vw",height:"100vh"},children:(0,De.jsxs)("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",background:"#ffffff",borderRadius:20,width:500,height:300},children:[a&&(0,De.jsx)(Ae.Z,{active:!0,inverted:!0,style:{position:"fixed",left:0,top:0,width:"100vw",height:"100vh"},children:(0,De.jsx)(Ee.Z,{size:"large",inverted:!0,content:"Loading"})}),(0,De.jsx)(Ve(),{languageOverride:"en",sitekey:qe.ok,onLoad:s,onVerify:i,onError:function(e){r.error(e)},onExpire:o}),(0,De.jsx)("div",{style:{height:40}}),(0,De.jsx)(Le.Z,{content:"Cancel",onClick:function(){i("")}})]})})})})).withConfig({displayName:"ReCaptcha",componentId:"sc-ztbxw8-0"})(["background-color:black;.rc-frame{}"]),He=n(83966),We="undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self?self:{};function Ge(e,t){return e(t={exports:{}},t.exports),t.exports}var Ze=Ge((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+e.className+" ").indexOf(" "+t+" ")},e.exports=t.default})),Ke=Ge((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){e.classList?e.classList.add(t):(0,r.default)(e)||(e.className=e.className+" "+t)};var n,r=(n=Ze)&&n.__esModule?n:{default:n};e.exports=t.default})),Xe=function(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")},Ye=Ge((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hasClass=t.removeClass=t.addClass=void 0;var n=o(Ke),r=o(Xe),i=o(Ze);function o(e){return e&&e.__esModule?e:{default:e}}t.addClass=n.default,t.removeClass=r.default,t.hasClass=i.default,t.default={addClass:n.default,removeClass:r.default,hasClass:i.default}})),Je=Ye.removeClass,Qe=Ye.addClass;var $e=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},et="object"==typeof We&&We&&We.Object===Object&&We,tt="object"==typeof self&&self&&self.Object===Object&&self,nt=et||tt||Function("return this")(),rt=function(){return nt.Date.now()},it=nt.Symbol,ot=Object.prototype,st=ot.hasOwnProperty,at=ot.toString,ct=it?it.toStringTag:void 0;var ut=function(e){var t=st.call(e,ct),n=e[ct];try{e[ct]=void 0;var r=!0}catch(o){}var i=at.call(e);return r&&(t?e[ct]=n:delete e[ct]),i},lt=Object.prototype.toString;var dt=function(e){return lt.call(e)},ft=it?it.toStringTag:void 0;var ht=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ft&&ft in Object(e)?ut(e):dt(e)};var pt=function(e){return null!=e&&"object"==typeof e};var gt=function(e){return"symbol"==typeof e||pt(e)&&"[object Symbol]"==ht(e)},mt=/^\s+|\s+$/g,bt=/^[-+]0x[0-9a-f]+$/i,yt=/^0b[01]+$/i,vt=/^0o[0-7]+$/i,wt=parseInt;var xt=function(e){if("number"==typeof e)return e;if(gt(e))return NaN;if($e(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=$e(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(mt,"");var n=yt.test(e);return n||vt.test(e)?wt(e.slice(2),n?2:8):bt.test(e)?NaN:+e},St=Math.max,At=Math.min;var Et=function(e,t,n){var r,i,o,s,a,c,u=0,l=!1,d=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var n=r,o=i;return r=i=void 0,u=t,s=e.apply(o,n)}function p(e){return u=e,a=setTimeout(m,t),l?h(e):s}function g(e){var n=e-c;return void 0===c||n>=t||n<0||d&&e-u>=o}function m(){var e=rt();if(g(e))return b(e);a=setTimeout(m,function(e){var n=t-(e-c);return d?At(n,o-(e-u)):n}(e))}function b(e){return a=void 0,f&&r?h(e):(r=i=void 0,s)}function y(){var e=rt(),n=g(e);if(r=arguments,i=this,c=e,n){if(void 0===a)return p(c);if(d)return a=setTimeout(m,t),h(c)}return void 0===a&&(a=setTimeout(m,t)),s}return t=xt(t)||0,$e(n)&&(l=!!n.leading,o=(d="maxWait"in n)?St(xt(n.maxWait)||0,t):o,f="trailing"in n?!!n.trailing:f),y.cancel=function(){void 0!==a&&clearTimeout(a),u=0,r=c=i=a=void 0},y.flush=function(){return void 0===a?s:b(rt())},y};var _t=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return $e(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Et(e,t,{leading:r,maxWait:t,trailing:i})},Ct=null,It=[],kt=function(){Ct&&(clearTimeout(Ct),Ct=null)},Tt=function(e){if(e&&It.push(e),"undefined"===typeof document)kt(),setTimeout((function(){Tt()}),100);else{kt();for(var t=0,n=It.length;t-1),this.matchCache[e]},Ot.prototype.feature=function(e){return this.featureCache[e]},Ot.prototype.addFeature=function(e,t){return this.featureCache[e]||(this.featureCache[e]=t),t},Ot.prototype.setUserAgent=function(e){void 0===e&&(e=null),this.userAgent=e||this.userAgent||("undefined"!==typeof document?window.navigator.userAgent:""),this.userAgent&&(kt(),this.matchCache={},this.userAgent=this.userAgent.toLowerCase())},Ot.prototype.onOrientationChange=function(e){},Ot.prototype.getClasses=function(){return this.classes||(this.userAgent||this.setUserAgent(),this.landscape?this.classes+="landscape ":this.classes+="portrait ",this.touch&&(this.classes+="touch "),this.ios?this.ipad?this.classes+="ios ipad tablet ":this.iphone?this.classes+="ios iphone mobile ":this.ipod&&(this.classes+="ios ipod mobile "):this.android?this.androidTablet?this.classes+="android tablet ":this.classes+="android mobile ":this.blackberry?this.blackberryTablet?this.classes+="blackberry tablet ":this.classes+="blackberry mobile ":this.windows?this.windowsTablet?this.classes+="windows tablet ":this.windowsPhone?this.classes+="windows mobile ":this.classes+="windows desktop ":this.fxos?this.fxosTablet?this.classes+="fxos tablet ":this.classes+="fxos mobile ":this.meego?this.classes+="meego mobile ":this.nodeWebkit?this.classes+="node-webkit ":this.television?this.classes+="television ":this.desktop&&(this.classes+="desktop "),this.cordova&&(this.classes+="cordova "),!this.desktop&&this.deviceorientation&&(this.classes+="deviceorientation "),this.classes=this.classes.slice(0,-1)),this.classes},Ot.prototype.addClasses=function(e){if(!this.targetNode){if(this.targetNode=e,e||"undefined"===typeof document||(this.targetNode=document.documentElement),!this.targetNode)return;this.userAgent||this.setUserAgent(),this.commitClasses(),this.addListener()}},Ot.prototype.addListener=function(){var e=this;if(!this.hasListener){this.hasListener=!0,this.handleOrientation=this.handleOrientation.bind(this),this.onResize=_t(this.handleOrientation,200);var t=function(){setTimeout((function(){e.handleOrientation()}),10)};"onorientationchange"in window?window.addEventListener("orientationchange",t,!1):window.addEventListener("resize",this.onResize,!1),t()}},Ot.prototype.handleOrientation=function(){this.onOrientationChange(this.landscape),this.targetNode&&(this.landscape?(Je(this.targetNode,"portrait"),Qe(this.targetNode,"landscape")):(Je(this.targetNode,"landscape"),Qe(this.targetNode,"portrait")))},Ot.prototype.commitClasses=function(){!this.state.addedClasses&&this.targetNode&&(this.state.addedClasses=!0,this.targetNode.className+=this.getClasses())},Rt.features.get=function(){return{wheelEvent:this.feature("wheelEvent")||this.addFeature("wheelEvent","onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll")}},Rt.deviceorientation.get=function(){return this.canOrientate||(this.canOrientate="ondeviceorientation"in window||"deviceorientation"in window),!this.desktop&&this.canOrientate},Rt.ie9.get=function(){return this.matchCache.ie9||"undefined"!==typeof document&&(this.matchCache.ie9=this.windows&&Mt(10)),this.matchCache.ie9||!1},Rt.touchDevice.get=function(){return this.matchCache.touchDevice||"undefined"!==typeof document&&(this.matchCache.touchDevice=!(!navigator||!navigator.userAgent)&&navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/)),this.matchCache.touchDevice||!1},Rt.touch.get=function(){return this.matchCache.touch||"undefined"!==typeof document&&(this.matchCache.touch="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch||navigator&&navigator.msMaxTouchPoints>0||navigator&&navigator.maxTouchPoints),this.matchCache.touch||!1},Rt.ios.get=function(){return this.iphone||this.ipod||this.ipad},Rt.iphone.get=function(){return!this.windows&&this.match("iphone")},Rt.ipod.get=function(){return this.match("ipod")},Rt.ipad.get=function(){return this.match("ipad")},Rt.android.get=function(){return!this.windows&&this.match("android")},Rt.androidPhone.get=function(){return this.android&&this.match("mobile")},Rt.androidTablet.get=function(){return this.android&&!this.match("mobile")},Rt.blackberry.get=function(){return this.match("blackberry")||this.match("bb10")||this.match("rim")},Rt.blackberryPhone.get=function(){return this.blackberry&&!this.match("tablet")},Rt.blackberryTablet.get=function(){return this.blackberry&&this.match("tablet")},Rt.windows.get=function(){return this.match("windows")},Rt.ie10.get=function(){return this.matchCache.ie10||"undefined"!==typeof document&&(this.matchCache.ie10=this.windows&&Mt(10)),this.matchCache.ie10||!1},Rt.windowsPhone.get=function(){return this.windows&&this.match("phone")},Rt.windowsTablet.get=function(){return this.windows&&this.match("touch")&&!this.windowsPhone},Rt.fxos.get=function(){return(this.match("(mobile;")||this.match("(tablet;"))&&this.match("; rv:")},Rt.fxosPhone.get=function(){return this.fxos&&this.match("mobile")},Rt.fxosTablet.get=function(){return this.fxos&&this.match("tablet")},Rt.meego.get=function(){return this.match("meego")},Rt.cordova.get=function(){return window.cordova&&"file:"===location.protocol},Rt.nodeWebkit.get=function(){return"object"===typeof window.process},Rt.mobile.get=function(){return this.androidPhone||this.iphone||this.ipod||this.windowsPhone||this.blackberryPhone||this.fxosPhone||this.meego},Rt.tablet.get=function(){return this.ipad||this.androidTablet||this.blackberryTablet||this.windowsTablet||this.fxosTablet},Rt.desktop.get=function(){return!this.tablet&&!this.mobile},Rt.television.get=function(){var e,t=["googletv","viera","smarttv","internet.tv","netcast","nettv","appletv","boxee","kylo","roku","dlnadoc","roku","pov_tv","hbbtv","ce-html"];for(e=0;e++1},Rt.landscape.get=function(){return"undefined"!==typeof window&&("orientation"in window?0!==window.orientation:window.innerHeight/window.innerWidth<1)},Object.defineProperties(Ot.prototype,Rt),Object.defineProperties(Ot,Nt);new Ot;var Bt=Ot;function Lt(e){return(0,De.jsxs)(De.Fragment,{children:[e.children,(0,De.jsx)(Ae.Z,{active:!0,inverted:!0,style:{position:"fixed",left:0,top:0,width:"100vw",height:"100vh"},children:(0,De.jsx)(Ee.Z,{active:!0,inverted:!0,size:"large"})})]})}var Dt=["/files/share","/files/receive"];function Ut(e){var t=(0,Pe.WY)(),n=(0,a.useRouter)();return(0,c.useEffect)((function(){var e=(new Bt).mobile;"/mobile"!==n.pathname&&e?n.replace("/mobile"):"/mobile"!==n.pathname||e||n.replace("/")}),[n]),"/mobile"===n.pathname||Dt.includes(n.pathname)?e.children:t.account&&t.authBasic||""===n.pathname||"/"===n.pathname?t.account&&t.authBasic&&(""===n.pathname||"/"===n.pathname)?(n.replace("/home/".concat(window.location.search)),(0,De.jsx)(Lt,{children:e.children})):e.children:(n.replace("/"),(0,De.jsx)(Lt,{children:e.children}))}var jt=n(61509);function Ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Vt(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"Loading"),n((function(){return!0}))}),[]),a=(0,c.useCallback)((function(){n((function(){return!1}))}),[]);return(0,c.useMemo)((function(){return{isLoading:t,show:s,hide:a,msg:i}}),[t,s,a,i])}(),i=(0,Me.Zn)(),o=function(){var e=(0,c.useState)(!0),t=e[0],n=e[1],r=(0,c.useState)(),i=r[0],o=r[1],s=(0,c.useState)(!1),a=s[0],u=s[1],l=(0,c.useState)({}),d=l[0],f=l[1];return{loadingScript:t,token:i,showReCaptcha:a,getToken:function(){return new Promise((function(e){f({call:e}),u(!0)}))},_onLoaded:function(){n(!1)},_onChange:function(e){o(e),d.call&&d.call(e),u(!1)},_onExpired:function(){o(void 0)}}}(),s=(0,c.useMemo)((function(){return{alert:t,api:n,loading:r,store:i,recaptcha:o}}),[t,n,r,i,o]);return(0,De.jsx)(_e.wI,{value:s,children:e.children})}function zt(e){var t=(0,_e.qD)().loading,n=e.show||t.isLoading,r=e.show?e.msg||"Loading":t.msg;return(0,De.jsx)(Ae.Z,{active:n,inverted:!0,style:{position:"fixed",left:0,top:0,width:"100vw",height:"100vh"},children:(0,De.jsx)(Ee.Z,{size:"large",inverted:!0,content:r})})}function Ht(e){var t=e.Component,n=e.pageProps;return(0,De.jsxs)(qt,{children:[(0,De.jsx)(s(),{children:(0,De.jsx)("title",{children:He.y7})}),(0,De.jsxs)(He.ZP,{children:[(0,De.jsx)(t,Vt({},n)),(0,De.jsx)(zt,{})]}),(0,De.jsx)(je,{})]})}function Wt(){return function(){var e=(0,Pe.WY)(),t=e.account,n=e.wallet;(0,c.useEffect)((function(){t&&"crust"===n&&(e.setIsLoadingNickname(!0),(0,jt.fb)(t).then(e.setMember).catch(console.error).then((function(){return(0,jt.fV)(t)})).then((function(t){return e.setNickName(t)})).catch(console.error).then((function(){return e.setIsLoadingNickname(!1)}))),e.setMember(void 0),e.setNickName("")}),[t,n])}(),null}function Gt(e){var t=e.Component,n=e.pageProps,r=(0,Pe.xX)(),i=!r.isLoad;return(0,De.jsxs)(Pe.it.Provider,{value:r,children:[(0,De.jsx)(Wt,{}),(0,De.jsxs)(qt,{children:[(0,De.jsx)(s(),{children:(0,De.jsx)("title",{children:He.y7})}),(0,De.jsxs)(He.ZP,{children:[i&&(0,De.jsx)(Ut,{children:(0,De.jsx)(t,Vt({},n))}),(0,De.jsx)(zt,{show:r.isLoad}),(0,De.jsx)(ze,{})]}),(0,De.jsx)(je,{})]})]})}var Zt=["/share","/invite_bonus_guide","/rewards_history"];function Kt(e){var t=(0,a.useRouter)().pathname,n=(0,c.useMemo)((function(){return Zt.includes(t)}),[t]);return function(){var e=(0,c.useState)(!1),t=e[0],n=e[1];return(0,c.useEffect)((function(){ne.use(new xe).use(Se.Db).init({backend:{loadPath:"/locales/{{lng}}.json"},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}},(function(){n(!0)}))}),[]),t}()?n?(0,De.jsx)(Ht,Vt({},e)):(0,De.jsx)(Gt,Vt({},e)):(0,De.jsx)("div",{})}var Xt=n(41549);function Yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Jt(e){for(var t=1;t>6],i=0===(32&n);if(31===(31&n)){var o=n;for(n=0;128===(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;n<<=7,n|=127&o}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:a.tag[n]}}function d(e,t,n){var r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0===(128&r))return r;var i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(var o=0;o=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=a.tagClassByName[n||"universal"]<<6)}e.exports=c,c.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},r(u,s.Node),u.prototype._encodeComposite=function(e,t,n,r){var o,s=d(e,t,n,this.reporter);if(r.length<128)return(o=new i(2))[0]=s,o[1]=r.length,this._createEncoderBuffer([o,r]);for(var a=1,c=r.length;c>=256;c>>=8)a++;(o=new i(2+a))[0]=s,o[1]=128|a;c=1+a;for(var u=r.length;u>0;c--,u>>=8)o[c]=255&u;return this._createEncoderBuffer([o,r])},u.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var n=new i(2*e.length),r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var o=0;for(r=0;r=128;s>>=7)o++}var a=new i(o),c=a.length-1;for(r=e.length-1;r>=0;r--){s=e[r];for(a[c--]=127&s;(s>>=7)>0;)a[c--]=128|127&s}return this._createEncoderBuffer(a)},u.prototype._encodeTime=function(e,t){var n,r=new Date(e);return"gentime"===t?n=[l(r.getFullYear()),l(r.getUTCMonth()+1),l(r.getUTCDate()),l(r.getUTCHours()),l(r.getUTCMinutes()),l(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[l(r.getFullYear()%100),l(r.getUTCMonth()+1),l(r.getUTCDate()),l(r.getUTCHours()),l(r.getUTCMinutes()),l(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(e,t){if("string"===typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!==typeof e&&!i.isBuffer(e)){var n=e.toArray();!e.sign&&128&n[0]&&n.unshift(0),e=new i(n)}if(i.isBuffer(e)){var r=e.length;0===e.length&&r++;var o=new i(r);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);r=1;for(var s=e;s>=256;s>>=8)r++;for(s=(o=new Array(r)).length-1;s>=0;s--)o[s]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},u.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},u.prototype._use=function(e,t){return"function"===typeof e&&(e=e(t)),e._getEncoder("der").tree},u.prototype._skipDefault=function(e,t,n){var r,i=this._baseState;if(null===i.default)return!1;var o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,n).join()),o.length!==i.defaultBuffer.length)return!1;for(r=0;r=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function c(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"===typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"===typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=6)i=a(e,n,n+6),this.words[r]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=a(e,t,n+6),this.words[r]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var f=l[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?g+n:u[f-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r("undefined"!==typeof s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,u=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function p(e,t,n){return(new g).mulp(e,t,n)}function g(e,t){this.x=e,this.y=t}Math.imul||(h=f),o.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?h(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},g.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},g.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},i(y,b),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new x}return m[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},i(A,S),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},1670:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s=n(4300).Buffer}catch(e){}function a(e,t,n){for(var i=0,o=Math.min(e.length,n),s=0,a=t;a=49&&u<=54?u-49+10:u>=17&&u<=22?u-17+10:u,s|=c}return r(!(240&s),"Invalid character in "+e),i}function c(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s"}o.isBN=function(e){return e instanceof o||null!==e&&"object"===typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this._strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"===typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=6)i=a(e,n,n+6),this.words[r]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=a(e,t,n+6),this.words[r]|=i<>>26-o&4194303),this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for?o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l:o.prototype.inspect=l;var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],l=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modrn(l).toString(e);n=(p=p.idivn(l)).isZero()?g+n:d[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&s}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,g=h>>>13,m=0|s[2],b=8191&m,y=m>>>13,v=0|s[3],w=8191&v,x=v>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],C=8191&_,I=_>>>13,k=0|s[6],T=8191&k,M=k>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],V=8191&F,q=F>>>13,z=0|a[1],H=8191&z,W=z>>>13,G=0|a[2],Z=8191&G,K=G>>>13,X=0|a[3],Y=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,V))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,V)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(g,V)|0,o=Math.imul(g,q);var be=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,q))+Math.imul(y,V)|0,o=Math.imul(y,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,W)|0;var ye=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,Z)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(x,V)|0,o=Math.imul(x,q),r=r+Math.imul(b,H)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,K)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(w,H)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var xe=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(M,V)|0,o=Math.imul(M,q),r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,q))+Math.imul(R,V)|0,o=Math.imul(R,q),r=r+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0;var Ee=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),r=r+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,fe)|0;var _e=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(U,H),i=(i=Math.imul(U,W))+Math.imul(j,H)|0,o=Math.imul(j,W),r=r+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Ce=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,Z),i=(i=Math.imul(U,K))+Math.imul(j,Z)|0,o=Math.imul(j,K),r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(x,de)|0,o=o+Math.imul(x,fe)|0;var Ie=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,fe)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,fe)|0;var ke=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(j,$)|0,o=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,fe)|0;var Te=(u+(r=r+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,fe)|0;var Me=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,fe)|0;var Pe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(B,de)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,de),i=(i=Math.imul(U,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Re=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=be,c[2]=ye,c[3]=ve,c[4]=we,c[5]=xe,c[6]=Se,c[7]=Ae,c[8]=Ee,c[9]=_e,c[10]=Ce,c[11]=Ie,c[12]=ke,c[13]=Te,c[14]=Me,c[15]=Pe,c[16]=Oe,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function b(e,t,n){return m(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(g=p),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):n<63?p(this,e,t):n<1024?m(this,e,t):b(this,e,t)},y.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},y.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);a&&(a.words[d]=f)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,f=1;0===(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new _(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function x(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},i(x,w),x.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},x.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new x;else if("p224"===e)t=new S;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return v[e]=t,t},_.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new C(e)},i(C,_),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},3500:function(e,t,n){var r;function i(e){this.rand=e}if(e.exports=function(e){return r||(r=new i(null)),r.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n>>24]^l[p>>>16&255]^d[g>>>8&255]^f[255&m]^t[b++],s=u[p>>>24]^l[g>>>16&255]^d[m>>>8&255]^f[255&h]^t[b++],a=u[g>>>24]^l[m>>>16&255]^d[h>>>8&255]^f[255&p]^t[b++],c=u[m>>>24]^l[h>>>16&255]^d[p>>>8&255]^f[255&g]^t[b++],h=o,p=s,g=a,m=c;return o=(r[h>>>24]<<24|r[p>>>16&255]<<16|r[g>>>8&255]<<8|r[255&m])^t[b++],s=(r[p>>>24]<<24|r[g>>>16&255]<<16|r[m>>>8&255]<<8|r[255&h])^t[b++],a=(r[g>>>24]<<24|r[m>>>16&255]<<16|r[h>>>8&255]<<8|r[255&p])^t[b++],c=(r[m>>>24]<<24|r[h>>>16&255]<<16|r[p>>>8&255]<<8|r[255&g])^t[b++],[o>>>=0,s>>>=0,a>>>=0,c>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,c=0;c<256;++c){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,n[s]=u,r[u]=s;var l=e[s],d=e[l],f=e[d],h=257*e[u]^16843008*u;i[0][s]=h<<24|h>>>8,i[1][s]=h<<16|h>>>16,i[2][s]=h<<8|h>>>24,i[3][s]=h,h=16843009*f^65537*d^257*l^16843008*s,o[0][u]=h<<24|h>>>8,o[1][u]=h<<16|h>>>16,o[2][u]=h<<8|h>>>24,o[3][u]=h,0===s?s=a=1:(s=l^e[e[e[f^l]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function u(e){this._key=i(e),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t===4&&(s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s]),i[o]=i[o-t]^s}for(var u=[],l=0;l>>24]]^c.INV_SUB_MIX[1][c.SBOX[f>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[f>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&f]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(e){return s(e=i(e),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},u.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},u.prototype.decryptBlock=function(e){var t=(e=i(e))[1];e[1]=e[3],e[3]=t;var n=s(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},u.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=u},6624:function(e,t,n){var r=n(1387),i=n(5055).Buffer,o=n(1043),s=n(3782),a=n(7225),c=n(4734),u=n(598);function l(e,t,n){if(12===t.length)return e._finID=i.concat([t,i.from([0,0,0,1])]),i.concat([t,i.from([0,0,0,2])]);var r=new a(n),o=t.length,s=o%16;r.update(t),s&&(s=16-s,r.update(i.alloc(s,0))),r.update(i.alloc(8,0));var c=8*o,l=i.alloc(8);l.writeUIntBE(c,0,8),r.update(l),e._finID=r.state;var d=i.from(e._finID);return u(d),d}function d(e,t,n,s){o.call(this);var c=i.alloc(4,0);this._cipher=new r.AES(t);var u=this._cipher.encryptBlock(c);this._ghash=new a(u),n=l(this,n,u),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}s(d,o),d.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},d.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=c(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i16)throw new Error("unable to decrypt data");var n=-1;for(;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},d.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(e,t){var n=o[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=u(t,!1,n.key,n.iv);return f(e,r.key,r.iv)},t.createDecipheriv=f},2:function(e,t,n){var r=n(6370),i=n(6624),o=n(5055).Buffer,s=n(126),a=n(1043),c=n(1387),u=n(8368);function l(e,t,n){a.call(this),this._cache=new f,this._cipher=new c.AES(t),this._prev=o.from(n),this._mode=e,this._autopadding=!0}n(3782)(l,a),l.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return o.concat(r)};var d=o.alloc(16,16);function f(){this.cache=o.allocUnsafe(0)}function h(e,t,n){var a=r[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"===typeof t&&(t=o.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"===typeof n&&(n=o.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===a.type?new s(a.module,t,n):"auth"===a.type?new i(a.module,t,n):new l(a.module,t,n)}l.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(d))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},f.prototype.add=function(e){this.cache=o.concat([this.cache,e])},f.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},f.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),n=-1;++n>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function s(e){this.h=e,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}s.prototype.ghash=function(e){for(var t=-1;++t0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,t&&(n[0]=n[0]^225<<24)}this.state=o(r)},s.prototype.update=function(e){var t;for(this.cache=r.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},s.prototype.final=function(e,t){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(o([0,e,0,t])),this.state},e.exports=s},598:function(e){e.exports=function(e){for(var t,n=e.length;n--;){if(255!==(t=e.readUInt8(n))){t++,e.writeUInt8(t,n);break}e.writeUInt8(0,n)}}},9825:function(e,t,n){var r=n(4734);t.encrypt=function(e,t){var n=r(t,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},t.decrypt=function(e,t){var n=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return r(i,n)}},321:function(e,t,n){var r=n(5055).Buffer,i=n(4734);function o(e,t,n){var o=t.length,s=i(t,e._cache);return e._cache=e._cache.slice(o),e._prev=r.concat([e._prev,n?t:s]),s}t.encrypt=function(e,t,n){for(var i,s=r.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=r.allocUnsafe(0)),!(e._cache.length<=t.length)){s=r.concat([s,o(e,t,n)]);break}i=e._cache.length,s=r.concat([s,o(e,t.slice(0,i),n)]),t=t.slice(i)}return s}},3147:function(e,t,n){var r=n(5055).Buffer;function i(e,t,n){for(var r,i,s=-1,a=0;++s<8;)r=t&1<<7-s?128:0,a+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^r))>>s%8,e._prev=o(e._prev,n?r:i);return a}function o(e,t){var n=e.length,i=-1,o=r.allocUnsafe(e.length);for(e=r.concat([e,r.from([t])]);++i>7;return o}t.encrypt=function(e,t,n){for(var o=t.length,s=r.allocUnsafe(o),a=-1;++a=0||!n.umod(e.prime1)||!n.umod(e.prime2);)n=new i(o(t));return n}e.exports=s,s.getr=a},9276:function(e,t,n){e.exports=n(2908)},4078:function(e,t,n){var r=n(5055).Buffer,i=n(9739),o=n(3726),s=n(3782),a=n(9807),c=n(4013),u=n(2908);function l(e){o.Writable.call(this);var t=u[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function d(e){o.Writable.call(this);var t=u[e];if(!t)throw new Error("Unknown message digest");this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function f(e){return new l(e)}function h(e){return new d(e)}Object.keys(u).forEach((function(e){u[e].id=r.from(u[e].id,"hex"),u[e.toLowerCase()]=u[e]})),s(l,o.Writable),l.prototype._write=function(e,t,n){this._hash.update(e),n()},l.prototype.update=function(e,t){return"string"===typeof e&&(e=r.from(e,t)),this._hash.update(e),this},l.prototype.sign=function(e,t){this.end();var n=this._hash.digest(),r=a(n,e,this._hashType,this._signType,this._tag);return t?r.toString(t):r},s(d,o.Writable),d.prototype._write=function(e,t,n){this._hash.update(e),n()},d.prototype.update=function(e,t){return"string"===typeof e&&(e=r.from(e,t)),this._hash.update(e),this},d.prototype.verify=function(e,t,n){"string"===typeof t&&(t=r.from(t,n)),this.end();var i=this._hash.digest();return c(t,i,e,this._signType,this._tag)},e.exports={Sign:f,Verify:h,createSign:f,createVerify:h}},9807:function(e,t,n){var r=n(5055).Buffer,i=n(4873),o=n(7166),s=n(949).ec,a=n(1670),c=n(9902),u=n(9267);function l(e,t){var n=u[t.curve.join(".")];if(!n)throw new Error("unknown curve "+t.curve.join("."));var i=new s(n).keyFromPrivate(t.privateKey).sign(e);return r.from(i.toDER())}function d(e,t,n){for(var r,i=t.params.priv_key,o=t.params.p,s=t.params.q,c=t.params.g,u=new a(0),l=p(e,s).mod(s),d=!1,b=h(i,s,e,n);!1===d;)u=m(c,r=g(s,b,n),o,s),0===(d=r.invm(s).imul(l.add(i.mul(u))).mod(s)).cmpn(0)&&(d=!1,u=new a(0));return f(u,d)}function f(e,t){e=e.toArray(),t=t.toArray(),128&e[0]&&(e=[0].concat(e)),128&t[0]&&(t=[0].concat(t));var n=[48,e.length+t.length+4,2,e.length];return n=n.concat(e,[2,t.length],t),r.from(n)}function h(e,t,n,o){if((e=r.from(e.toArray())).length0&&n.ishrn(r),n}function g(e,t,n){var o,s;do{for(o=r.alloc(0);8*o.length=t)throw new Error("invalid sig")}e.exports=function(e,t,n,o,a){var l=s(n);if("ec"===l.type){if("ecdsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong public key type");return c(e,t,l)}if("dsa"===l.type){if("dsa"!==o)throw new Error("wrong public key type");return function(e,t,n){var r=n.data.p,o=n.data.q,a=n.data.g,c=n.data.pub_key,l=s.signature.decode(e,"der"),d=l.s,f=l.r;u(d,o),u(f,o);var h=i.mont(r),p=d.invm(o);return 0===a.toRed(h).redPow(new i(t).mul(p).mod(o)).fromRed().mul(c.toRed(h).redPow(f.mul(p).mod(o)).fromRed()).mod(r).mod(o).cmp(f)}(e,t,l)}if("rsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong public key type");t=r.concat([a,t]);for(var d=l.modulus.byteLength(),f=[1],h=0;t.length+f.length+2n)?t=("rmd160"===e?new c:u(e)).update(t).digest():t.lengtha?t=e(t):t.length0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},i.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},i.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];n=o.r28shl(n,a),i=o.r28shl(i,a),o.pc2(n,i,e.keys,s)}},c.prototype._update=function(e,t,n,r){var i=this._desState,s=o.readUInt32BE(e,t),a=o.readUInt32BE(e,t+4);o.ip(s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,s,a,i.tmp,0):this._decrypt(i,s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],o.writeUInt32BE(n,s,r),o.writeUInt32BE(n,a,r+4)},c.prototype._pad=function(e,t){for(var n=e.length-t,r=t;r>>0,s=f}o.rip(a,s,r,i)},c.prototype._decrypt=function(e,t,n,r,i){for(var s=n,a=t,c=e.keys.length-2;c>=0;c-=2){var u=e.keys[c],l=e.keys[c+1];o.expand(s,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var d=o.substitute(u,l),f=s;s=(a^o.permute(d))>>>0,a=f}o.rip(s,a,r,i)}},6159:function(e,t,n){"use strict";var r=n(3523),i=n(3782),o=n(9876),s=n(1016);function a(e,t){r.equal(t.length,24,"Invalid key length");var n=t.slice(0,8),i=t.slice(8,16),o=t.slice(16,24);this.ciphers="encrypt"===e?[s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:o})]:[s.create({type:"decrypt",key:o}),s.create({type:"encrypt",key:i}),s.create({type:"decrypt",key:n})]}function c(e){o.call(this,e);var t=new a(this.type,this.options.key);this._edeState=t}i(c,o),e.exports=c,c.create=function(e){return new c(e)},c.prototype._update=function(e,t,n,r){var i=this._edeState;i.ciphers[0]._update(e,t,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},c.prototype._pad=s.prototype._pad,c.prototype._unpad=s.prototype._unpad},5334:function(e,t){"use strict";t.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},t.writeUInt32BE=function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},t.ip=function(e,t,n,r){for(var i=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=t>>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=e>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1}n[r+0]=i>>>0,n[r+1]=o>>>0},t.rip=function(e,t,n,r){for(var i=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)i<<=1,i|=t>>>a+s&1,i<<=1,i|=e>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=t>>>a+s&1,o<<=1,o|=e>>>a+s&1;n[r+0]=i>>>0,n[r+1]=o>>>0},t.pc1=function(e,t,n,r){for(var i=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1}for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;n[r+0]=i>>>0,n[r+1]=o>>>0},t.r28shl=function(e,t){return e<>>28-t};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,r,i){for(var o=0,s=0,a=n.length>>>1,c=0;c>>n[c]&1;for(c=a;c>>n[c]&1;r[i+0]=o>>>0,r[i+1]=s>>>0},t.expand=function(e,t,n){var r=0,i=0;r=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=e>>>o&63;for(o=11;o>=3;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var r=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var n=0,i=0;i<4;i++){n<<=4,n|=r[64*i+(e>>>18-6*i&63)]}for(i=0;i<4;i++){n<<=4,n|=r[256+64*i+(t>>>18-6*i&63)]}return n>>>0};var i=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,n=0;n>>i[n]&1;return t>>>0},t.padSplit=function(e,t,n){for(var r=e.toString(2);r.lengthe;)n.ishrn(1);if(n.isEven()&&n.iadd(a),n.testn(1)||n.iadd(c),t.cmp(c)){if(!t.cmp(u))for(;n.mod(l).cmp(d);)n.iadd(h)}else for(;n.mod(o).cmp(f);)n.iadd(h);if(g(p=n.shrn(1))&&g(n)&&m(p)&&m(n)&&s.test(p)&&s.test(n))return n}}},949:function(e,t,n){"use strict";var r=t;r.version=n(2531).i8,r.utils=n(4401),r.rand=n(3500),r.curve=n(9359),r.curves=n(6226),r.ec=n(4088),r.eddsa=n(8511)},2727:function(e,t,n){"use strict";var r=n(711),i=n(4401),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var n=e._getDoubles(),r=o(t,1,this._bitLength),i=(1<=c;t--)u=(u<<1)+r[t];s.push(u)}for(var l=this.jpoint(null,null,null),d=this.jpoint(null,null,null),f=i;f>0;f--){for(c=0;c=0;u--){for(t=0;u>=0&&0===s[u];u--)t++;if(u>=0&&t++,c=c.dblp(t),u<0)break;var l=s[u];a(0!==l),c="affine"===e.type?l>0?c.mixedAdd(i[l-1>>1]):c.mixedAdd(i[-l-1>>1].neg()):l>0?c.add(i[l-1>>1]):c.add(i[-l-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,r,i){for(var a=this._wnafT1,c=this._wnafT2,u=this._wnafT3,l=0,d=0;d=1;d-=2){var h=d-1,p=d;if(1===a[h]&&1===a[p]){var g=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(g[1]=t[h].add(t[p]),g[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(g[1]=t[h].toJ().mixedAdd(t[p]),g[2]=t[h].add(t[p].neg())):(g[1]=t[h].toJ().mixedAdd(t[p]),g[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],b=s(n[h],n[p]);l=Math.max(b[0].length,l),u[h]=new Array(l),u[p]=new Array(l);for(var y=0;y=0;d--){for(var A=0;d>=0;){var E=!0;for(y=0;y=0&&A++,x=x.dblp(A),d<0)break;for(y=0;y0?_=c[y][C-1>>1]:C<0&&(_=c[y][-C-1>>1].neg()),x="affine"===_.type?x.mixedAdd(_):x.add(_))}}for(d=0;d=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),s=o.redSub(n),a=r.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),d=s.redMul(o);return this.curve.point(c,u,d,l)},u.prototype._projDbl=function(){var e,t,n,r=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var s=(u=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=r.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),t=s.redMul(u.redSub(o)),n=s.redSqr().redSub(s).redSub(s);else{var a=this.z.redSqr(),c=s.redSub(a).redISub(a);e=r.redSub(i).redISub(o).redMul(c),t=s.redMul(u.redSub(o)),n=s.redMul(c)}}else{var u=i.redAdd(o);a=this.curve._mulC(this.z).redSqr(),c=u.redSub(a).redSub(a);e=this.curve._mulC(r.redISub(u)).redMul(c),t=this.curve._mulC(u).redMul(i.redISub(o)),n=u.redMul(c)}return this.curve.point(e,t,n)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),s=i.redSub(r),a=i.redAdd(r),c=n.redAdd(t),u=o.redMul(s),l=a.redMul(c),d=o.redMul(c),f=s.redMul(a);return this.curve.point(u,l,f,d)},u.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(s.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(s.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},u.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},9359:function(e,t,n){"use strict";var r=t;r.base=n(2727),r.short=n(4720),r.mont=n(6653),r.edwards=n(2705)},6653:function(e,t,n){"use strict";var r=n(711),i=n(3782),o=n(2727),s=n(4401);function a(e){o.call(this,"mont",e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,n){o.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(t,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),s=i.redMul(r),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},4720:function(e,t,n){"use strict";var r=n(4401),i=n(711),o=n(3782),s=n(2727),a=r.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,n,r){s.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,n,r){s.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),n=new i(2).toRed(t).redInvm(),r=n.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,r,o,s,a,c,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),b=new i(1),y=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),l=m.sub(v.mul(p));var w=b.sub(v.mul(g));if(!r&&u.cmp(d)<0)t=c.neg(),n=p,r=u.neg(),o=l;else if(r&&2===++y)break;c=u,h=f,f=u,m=p,p=l,b=g,g=w}s=u.neg(),a=l;var x=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(x)>=0&&(s=t,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(t&&!o||!t&&o)&&(r=r.redNeg()),this.point(e,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},u.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=r.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=n.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(d,f,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,n=0;n=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},6226:function(e,t,n){"use strict";var r,i=t,o=n(7028),s=n(9359),a=n(4401).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var n=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(9702)}catch(e){r=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},4088:function(e,t,n){"use strict";var r=n(711),i=n(4910),o=n(4401),s=n(6226),a=n(3500),c=o.assert,u=n(4724),l=n(7526);function d(e){if(!(this instanceof d))return new d(e);"string"===typeof e&&(c(s.hasOwnProperty(e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=d,d.prototype.keyPair=function(e){return new u(this,e)},d.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(t.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},d.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,n,o){"object"===typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new r(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new r(1)),f=0;;f++){var h=o.k?o.k(f):new r(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new l({r:m,s:b,recoveryParam:y})}}}}}},d.prototype.verify=function(e,t,n,i){e=this._truncateToN(new r(e,16)),n=this.keyFromPublic(n,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),d)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,n.getPublic(),d)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},d.prototype.recoverPubKey=function(e,t,n,i){c((3&n)===n,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new r(e),a=t.r,u=t.s,d=1&n,f=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),d):this.curve.pointFromX(a,d);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),g=u.mul(h).umod(o);return this.g.mulAdd(p,a,g)},d.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new l(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},4724:function(e,t,n){"use strict";var r=n(711),i=n(4401).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"===typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new r(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},7526:function(e,t,n){"use strict";var r=n(711),i=n(4401),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var o=c(e,n);if(!1===o)return!1;if(o+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var s=c(e,n);if(!1===s)return!1;var u=e.slice(n.place,s+n.place);if(n.place+=s,2!==e[n.place++])return!1;var l=c(e,n);if(!1===l)return!1;if(e.length!==l+n.place)return!1;var d=e.slice(n.place,l+n.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new r(u),this.s=new r(d),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=u(t),n=u(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];l(r,t.length),(r=r.concat(t)).push(2),l(r,n.length);var o=r.concat(n),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},8511:function(e,t,n){"use strict";var r=n(7028),i=n(6226),o=n(4401),s=o.assert,a=o.parseBytes,c=n(9917),u=n(9314);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=r.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,n){e=a(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,r[s]=a,o.iushrn(1)}return r},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0;e.cmpn(-r)>0||t.cmpn(-i)>0;){var o,s,a,c=e.andln(3)+r&3,u=t.andln(3)+i&3;if(3===c&&(c=-1),3===u&&(u=-1),0===(1&c))o=0;else o=3!==(a=e.andln(7)+r&7)&&5!==a||2!==u?c:-c;if(n[0].push(o),0===(1&u))s=0;else s=3!==(a=t.andln(7)+i&7)&&5!==a||2!==c?u:-u;n[1].push(s),2*r===o+1&&(r=1-r),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},8368:function(e,t,n){var r=n(5055).Buffer,i=n(3533);e.exports=function(e,t,n,o){if(r.isBuffer(e)||(e=r.from(e,"binary")),t&&(r.isBuffer(t)||(t=r.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=n/8,a=r.alloc(s),c=r.alloc(o||0),u=r.alloc(0);s>0||o>0;){var l=new i;l.update(u),l.update(e),t&&l.update(t),u=l.digest();var d=0;if(s>0){var f=a.length-s;d=Math.min(s,u.length),u.copy(a,f,0,d),s-=d}if(d0){var h=c.length-o,p=Math.min(o,u.length-d);u.copy(c,h,d,d+p),o-=p}}return u.fill(0),{key:a,iv:c}}},9029:function(e,t,n){"use strict";var r=n(5055).Buffer,i=n(3726).Transform;function o(e){i.call(this),this._block=r.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(3782)(o,i),o.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},o.prototype.update=function(e,t){if(function(e,t){if(!r.isBuffer(e)&&"string"!==typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");r.isBuffer(e)||(e=r.from(e,t));for(var n=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},7028:function(e,t,n){var r=t;r.utils=n(263),r.common=n(1330),r.sha=n(301),r.ripemd=n(3079),r.hmac=n(3092),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},1330:function(e,t,n){"use strict";var r=n(263),i=n(3523);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=r.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=r.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},t.g1_256=function(e){return r(e,17)^r(e,19)^e>>>10}},263:function(e,t,n){"use strict";var r=n(3523),i=n(3782);function o(e,t){return 55296===(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320===(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"===typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(e="0"+e),i=0;i>6|192,n[r++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},t.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},t.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},t.sum64_lo=function(e,t,n,r){return t+r>>>0},t.sum64_4_hi=function(e,t,n,r,i,o,s,a){var c=0,u=t;return c+=(u=u+r>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,n,r,i,o,s,a){return t+r+o+a>>>0},t.sum64_5_hi=function(e,t,n,r,i,o,s,a,c,u){var l=0,d=t;return l+=(d=d+r>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,n,r,i,o,s,a,c,u){return t+r+o+a+u>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},4910:function(e,t,n){"use strict";var r=n(7028),i=n(6545),o=n(3523);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),n=i.toArray(e.nonce,e.nonceEnc||"hex"),r=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}e.exports=s,s.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},s.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(r=n,n=t,t=null),n&&(n=i.toArray(n,r||"hex"),this._update(n));for(var o=[];o.length>>32-t}function u(e,t,n,r,i,o,s){return c(e+(t&n|~t&r)+i+o|0,s)+t|0}function l(e,t,n,r,i,o,s){return c(e+(t&r|n&~r)+i+o|0,s)+t|0}function d(e,t,n,r,i,o,s){return c(e+(t^n^r)+i+o|0,s)+t|0}function f(e,t,n,r,i,o,s){return c(e+(n^(t|~r))+i+o|0,s)+t|0}r(a,i),a.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=u(n,r,i,o,e[0],3614090360,7),o=u(o,n,r,i,e[1],3905402710,12),i=u(i,o,n,r,e[2],606105819,17),r=u(r,i,o,n,e[3],3250441966,22),n=u(n,r,i,o,e[4],4118548399,7),o=u(o,n,r,i,e[5],1200080426,12),i=u(i,o,n,r,e[6],2821735955,17),r=u(r,i,o,n,e[7],4249261313,22),n=u(n,r,i,o,e[8],1770035416,7),o=u(o,n,r,i,e[9],2336552879,12),i=u(i,o,n,r,e[10],4294925233,17),r=u(r,i,o,n,e[11],2304563134,22),n=u(n,r,i,o,e[12],1804603682,7),o=u(o,n,r,i,e[13],4254626195,12),i=u(i,o,n,r,e[14],2792965006,17),n=l(n,r=u(r,i,o,n,e[15],1236535329,22),i,o,e[1],4129170786,5),o=l(o,n,r,i,e[6],3225465664,9),i=l(i,o,n,r,e[11],643717713,14),r=l(r,i,o,n,e[0],3921069994,20),n=l(n,r,i,o,e[5],3593408605,5),o=l(o,n,r,i,e[10],38016083,9),i=l(i,o,n,r,e[15],3634488961,14),r=l(r,i,o,n,e[4],3889429448,20),n=l(n,r,i,o,e[9],568446438,5),o=l(o,n,r,i,e[14],3275163606,9),i=l(i,o,n,r,e[3],4107603335,14),r=l(r,i,o,n,e[8],1163531501,20),n=l(n,r,i,o,e[13],2850285829,5),o=l(o,n,r,i,e[2],4243563512,9),i=l(i,o,n,r,e[7],1735328473,14),n=d(n,r=l(r,i,o,n,e[12],2368359562,20),i,o,e[5],4294588738,4),o=d(o,n,r,i,e[8],2272392833,11),i=d(i,o,n,r,e[11],1839030562,16),r=d(r,i,o,n,e[14],4259657740,23),n=d(n,r,i,o,e[1],2763975236,4),o=d(o,n,r,i,e[4],1272893353,11),i=d(i,o,n,r,e[7],4139469664,16),r=d(r,i,o,n,e[10],3200236656,23),n=d(n,r,i,o,e[13],681279174,4),o=d(o,n,r,i,e[0],3936430074,11),i=d(i,o,n,r,e[3],3572445317,16),r=d(r,i,o,n,e[6],76029189,23),n=d(n,r,i,o,e[9],3654602809,4),o=d(o,n,r,i,e[12],3873151461,11),i=d(i,o,n,r,e[15],530742520,16),n=f(n,r=d(r,i,o,n,e[2],3299628645,23),i,o,e[0],4096336452,6),o=f(o,n,r,i,e[7],1126891415,10),i=f(i,o,n,r,e[14],2878612391,15),r=f(r,i,o,n,e[5],4237533241,21),n=f(n,r,i,o,e[12],1700485571,6),o=f(o,n,r,i,e[3],2399980690,10),i=f(i,o,n,r,e[10],4293915773,15),r=f(r,i,o,n,e[1],2240044497,21),n=f(n,r,i,o,e[8],1873313359,6),o=f(o,n,r,i,e[15],4264355552,10),i=f(i,o,n,r,e[6],2734768916,15),r=f(r,i,o,n,e[13],1309151649,21),n=f(n,r,i,o,e[4],4149444226,6),o=f(o,n,r,i,e[11],3174756917,10),i=f(i,o,n,r,e[2],718787259,15),r=f(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},1354:function(e,t,n){var r=n(711),i=n(3500);function o(e){this.rand=e||new i.Rand}e.exports=o,o.create=function(e){return new o(e)},o.prototype._randbelow=function(e){var t=e.bitLength(),n=Math.ceil(t/8);do{var i=new r(this.rand.generate(n))}while(i.cmp(e)>=0);return i},o.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},o.prototype.test=function(e,t,n){var i=e.bitLength(),o=r.mont(e),s=new r(1).toRed(o);t||(t=Math.max(1,i/48|0));for(var a=e.subn(1),c=0;!a.testn(c);c++);for(var u=e.shrn(c),l=a.toRed(o);t>0;t--){var d=this._randrange(new r(2),a);n&&n(d);var f=d.toRed(o).redPow(u);if(0!==f.cmp(s)&&0!==f.cmp(l)){for(var h=1;h0;t--){var l=this._randrange(new r(2),s),d=e.gcd(l);if(0!==d.cmpn(1))return d;var f=l.toRed(i).redPow(c);if(0!==f.cmp(o)&&0!==f.cmp(u)){for(var h=1;h>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}},8687:function(e,t,n){"use strict";var r=n(7160);t.certificate=n(8782);var i=r.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));t.RSAPrivateKey=i;var o=r.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));t.RSAPublicKey=o;var s=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}));t.PublicKey=s;var a=r.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),c=r.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(a),this.key("subjectPrivateKey").octstr())}));t.PrivateKey=c;var u=r.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));t.EncryptedPrivateKey=u;var l=r.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));t.DSAPrivateKey=l,t.DSAparam=r.define("DSAparam",(function(){this.int()}));var d=r.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(f),this.key("publicKey").optional().explicit(1).bitstr())}));t.ECPrivateKey=d;var f=r.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));t.signature=r.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},8782:function(e,t,n){"use strict";var r=n(7160),i=r.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=r.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),s=r.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),a=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())})),c=r.define("RelativeDistinguishedName",(function(){this.setof(o)})),u=r.define("RDNSequence",(function(){this.seqof(c)})),l=r.define("Name",(function(){this.choice({rdnSequence:this.use(u)})})),d=r.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))})),f=r.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),h=r.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(s),this.key("issuer").use(l),this.key("validity").use(d),this.key("subject").use(l),this.key("subjectPublicKeyInfo").use(a),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(f).optional())})),p=r.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(h),this.key("signatureAlgorithm").use(s),this.key("signatureValue").bitstr())}));e.exports=p},6501:function(e,t,n){var r=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,s=n(8368),a=n(6594),c=n(5055).Buffer;e.exports=function(e,t){var n,u=e.toString(),l=u.match(r);if(l){var d="aes"+l[1],f=c.from(l[2],"hex"),h=c.from(l[3].replace(/[\r\n]/g,""),"base64"),p=s(t,f.slice(0,8),parseInt(l[1],10)).key,g=[],m=a.createDecipheriv(d,p,f);g.push(m.update(h)),g.push(m.final()),n=c.concat(g)}else{var b=u.match(o);n=new c(b[2].replace(/[\r\n]/g,""),"base64")}return{tag:u.match(i)[1],data:n}}},9902:function(e,t,n){var r=n(8687),i=n(2510),o=n(6501),s=n(6594),a=n(4978),c=n(5055).Buffer;function u(e){var t;"object"!==typeof e||c.isBuffer(e)||(t=e.passphrase,e=e.key),"string"===typeof e&&(e=c.from(e));var n,i,s=o(e,t),a=s.tag,u=s.data;switch(a){case"CERTIFICATE":i=r.certificate.decode(u,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(i||(i=r.PublicKey.decode(u,"der")),n=i.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(i.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return i.subjectPrivateKey=i.subjectPublicKey,{type:"ec",data:i};case"1.2.840.10040.4.1":return i.algorithm.params.pub_key=r.DSAparam.decode(i.subjectPublicKey.data,"der"),{type:"dsa",data:i.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+a);case"ENCRYPTED PRIVATE KEY":u=l(u=r.EncryptedPrivateKey.decode(u,"der"),t);case"PRIVATE KEY":switch(n=(i=r.PrivateKey.decode(u,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(i.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:i.algorithm.curve,privateKey:r.ECPrivateKey.decode(i.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return i.algorithm.params.priv_key=r.DSAparam.decode(i.subjectPrivateKey,"der"),{type:"dsa",params:i.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+a);case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(u,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(u,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(u,"der")};case"EC PRIVATE KEY":return{curve:(u=r.ECPrivateKey.decode(u,"der")).parameters.value,privateKey:u.privateKey};default:throw new Error("unknown key type "+a)}}function l(e,t){var n=e.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[e.algorithm.decrypt.cipher.algo.join(".")],u=e.algorithm.decrypt.cipher.iv,l=e.subjectPrivateKey,d=parseInt(o.split("-")[1],10)/8,f=a.pbkdf2Sync(t,n,r,d,"sha1"),h=s.createDecipheriv(o,f,u),p=[];return p.push(h.update(l)),p.push(h.final()),c.concat(p)}e.exports=u,u.signature=r.signature},4978:function(e,t,n){var r=n(6113),i=n(5349),o=n(7007),s=n(5407);r.pbkdf2Sync&&-1!==r.pbkdf2Sync.toString().indexOf("keylen, digest")?(t.pbkdf2Sync=function(e,t,n,a,c){return i(n,a),e=s(e,o,"Password"),t=s(t,o,"Salt"),c=c||"sha1",r.pbkdf2Sync(e,t,n,a,c)},t.pbkdf2=function(e,t,n,a,c,u){if(i(n,a),e=s(e,o,"Password"),t=s(t,o,"Salt"),"function"===typeof c&&(u=c,c="sha1"),"function"!==typeof u)throw new Error("No callback provided to pbkdf2");return r.pbkdf2(e,t,n,a,c,u)}):(t.pbkdf2Sync=n(2127),t.pbkdf2=n(9601))},9601:function(e,t,r){var o,s=r(5055).Buffer,a=r(5349),c=r(7007),u=r(2127),l=r(5407),d=n.g.crypto&&n.g.crypto.subtle,f={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},h=[];function p(e){if(n.g.process&&!n.g.process.browser)return Promise.resolve(!1);if(!d||!d.importKey||!d.deriveBits)return Promise.resolve(!1);if(void 0!==h[e])return h[e];var t=g(o=o||s.alloc(8),o,10,128,e).then((function(){return!0})).catch((function(){return!1}));return h[e]=t,t}function g(e,t,n,r,i){return d.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return d.deriveBits({name:"PBKDF2",salt:t,iterations:n,hash:{name:i}},e,r<<3)})).then((function(e){return s.from(e)}))}e.exports=function(e,t,r,o,s,d){"function"===typeof s&&(d=s,s=void 0);var h=f[(s=s||"sha1").toLowerCase()];if(!h||"function"!==typeof n.g.Promise)return i.nextTick((function(){var n;try{n=u(e,t,r,o,s)}catch(e){return d(e)}d(null,n)}));if(a(r,o),e=l(e,c,"Password"),t=l(t,c,"Salt"),"function"!==typeof d)throw new Error("No callback provided to pbkdf2");!function(e,t){e.then((function(e){i.nextTick((function(){t(null,e)}))}),(function(e){i.nextTick((function(){t(e)}))}))}(p(h).then((function(n){return n?g(e,t,r,o,h):u(e,t,r,o,s)})),d)}},7007:function(e){var t;t="utf-8",e.exports=t},5349:function(e){var t=Math.pow(2,30)-1;e.exports=function(e,n){if("number"!==typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!==typeof n)throw new TypeError("Key length not a number");if(n<0||n>t||n!==n)throw new TypeError("Bad key length")}},2127:function(e,t,n){var r={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20},i=n(4873),o=n(5055).Buffer,s=n(5349),a=n(7007),c=n(5407);e.exports=function(e,t,n,u,l){s(n,u),e=c(e,a,"Password"),t=c(t,a,"Salt"),l=l||"sha1";var d=o.allocUnsafe(u),f=o.allocUnsafe(t.length+4);t.copy(f,0,0,t.length);for(var h=0,p=r[l],g=Math.ceil(u/p),m=1;m<=g;m++){f.writeUInt32BE(m,t.length);for(var b=i(l,e).update(f).digest(),y=b,v=1;vf||new s(t).cmp(c.modulus)>=0)throw new Error("decryption error");o=n?u(new s(t),c):a(t,c);var h=l.alloc(f-o.length);if(o=l.concat([h,o],f),4===i)return d(c,o);if(1===i)return function(e,t,n){var r=t.slice(0,2),i=2,o=0;for(;0!==t[i++];)if(i>=t.length){o++;break}var s=t.slice(2,i-1);("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++;s.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,o,n);if(3===i)return o;throw new Error("unknown padding")}},3995:function(e,t,n){var r=n(9902),i=n(7223),o=n(9739),s=n(5520),a=n(6386),c=n(711),u=n(1607),l=n(7166),d=n(5055).Buffer;function f(e,t){var n=e.modulus.byteLength(),r=t.length,u=o("sha1").update(d.alloc(0)).digest(),l=u.length,f=2*l;if(r>n-f-2)throw new Error("message too long");var h=d.alloc(n-r-f-2),p=n-l-1,g=i(l),m=a(d.concat([u,h,d.alloc(1,1),t],p),s(g,p)),b=a(g,s(m,l));return new c(d.concat([d.alloc(1),b,m],n))}function h(e){for(var t,n=d.allocUnsafe(e),r=0,o=i(2*e),s=0;ro-11)throw new Error("message too long");r=n?d.alloc(o-i-3,255):h(o-i-3);return new c(d.concat([d.from([0,n?1:2]),r,d.alloc(1),t],o))}(s,t,n);else{if(3!==i)throw new Error("unknown padding");if((o=new c(t)).cmp(s.modulus)>=0)throw new Error("data too long for modulus")}return n?l(o,s):u(o,s)}},1607:function(e,t,n){var r=n(711),i=n(5055).Buffer;e.exports=function(e,t){return i.from(e.toRed(r.mont(t.modulus)).redPow(new r(t.publicExponent)).fromRed().toArray())}},6386:function(e){e.exports=function(e,t){for(var n=e.length,r=-1;++rs)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>o)for(var r=0;rl||e<0)throw new TypeError("offset must be a uint32");if(e>c||e>t)throw new RangeError("offset out of range")}function f(e,t,n){if("number"!==typeof e||e!==e)throw new TypeError("size must be a number");if(e>l||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>c)throw new RangeError("buffer too small")}function h(e,t,n,r){var o=e.buffer,s=new Uint8Array(o,t,n);return u.getRandomValues(s),r?void i.nextTick((function(){r(null,e)})):e}u&&u.getRandomValues?(t.randomFill=function(e,t,r,i){if(!a.isBuffer(e)&&!(e instanceof n.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"===typeof t)i=t,t=0,r=e.length;else if("function"===typeof r)i=r,r=e.length-t;else if("function"!==typeof i)throw new TypeError('"cb" argument must be a function');return d(t,e.length),f(r,t,e.length),h(e,t,r,i)},t.randomFillSync=function(e,t,r){"undefined"===typeof t&&(t=0);if(!a.isBuffer(e)&&!(e instanceof n.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');d(t,e.length),void 0===r&&(r=e.length-t);return f(r,t,e.length),h(e,t,r)}):(t.randomFill=o,t.randomFillSync=o)},4646:function(e){"use strict";const t={};function n(e,n,r){function i(e,t,r){return"string"===typeof n?n:n(e,t,r)}r||(r=Error);class o extends r{constructor(e,t,n){super(i(e,t,n))}}o.prototype.name=r.name,o.prototype.code=e,t[e]=o}function r(e,t){if(Array.isArray(e)){const n=e.length;return e=e.map((e=>String(e))),n>2?`one of ${t} ${e.slice(0,n-1).join(", ")}, or `+e[n-1]:2===n?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}return`of ${t} ${String(e)}`}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,n){let i,o;if("string"===typeof t&&function(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o=`The ${e} ${i} ${r(t,"type")}`;else{const n=function(e,t,n){return"number"!==typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";o=`The "${e}" ${n} ${i} ${r(t,"type")}`}return o+=". Received type "+typeof n,o}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},2403:function(e,t,n){"use strict";var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var o=n(1709),s=n(7337);n(3782)(l,o);for(var a=r(s.prototype),c=0;c0)if("string"===typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),r)s.endEmitted?A(e,new S):k(e,s,t,!0);else if(s.ended)A(e,new w);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?k(e,s,t,!1):R(e,s)):k(e,s,t,!1)}else r||(s.reading=!1,R(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function P(e){var t=e._readableState;l("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(O,e))}function O(e){var t=e._readableState;l("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){l("readable nexttick read 0"),e.read(0)}function D(e,t){l("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(l("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function F(e){var t=e._readableState;l("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){if(l("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function q(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):P(this),null;if(0===(e=M(e,t))&&t.ended)return 0===t.length&&F(this),null;var r,i=t.needReadable;return l("need readable",i),(0===t.length||t.length-e0?j(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&F(this)),null!==r&&this.emit("data",r),r},C.prototype._read=function(e){A(this,new x("_read()"))},C.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,l("pipe count=%d opts=%j",r.pipesCount,t);var o=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?c:b;function a(e,t){l("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,f())}function c(){l("onend"),e.end()}r.endEmitted?i.nextTick(o):n.once("end",o),e.on("unpipe",a);var u=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,U(e))}}(n);e.on("drain",u);var d=!1;function f(){l("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",u),e.removeListener("error",p),e.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",b),n.removeListener("data",h),d=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||u()}function h(t){l("ondata");var i=e.write(t);l("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==q(r.pipes,e))&&!d&&(l("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function p(t){l("onerror",t),b(),e.removeListener("error",p),0===s(e,"error")&&A(e,t)}function g(){e.removeListener("finish",m),b()}function m(){l("onfinish"),e.removeListener("close",g),b()}function b(){l("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"===typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",p),e.once("close",g),e.once("finish",m),e.emit("pipe",n),r.flowing||(l("pipe resume"),n.resume()),e},C.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,l("on readable",r.length,r.reading),r.length?P(this):r.reading||i.nextTick(L,this))),n},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(B,this),n},C.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(B,this),t},C.prototype.resume=function(){var e=this._readableState;return e.flowing||(l("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(D,e,t))}(this,e)),e.paused=!1,this},C.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(l("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(l("wrapped data"),n.decoder&&(i=n.decoder.write(i)),!n.objectMode||null!==i&&void 0!==i)&&((n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause())))})),e)void 0===this[i]&&"function"===typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new S(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(e,t,n){n(new m("_write()"))},C.prototype._writev=null,C.prototype.end=function(e,t,n){var r=this._writableState;return"function"===typeof e?(n=e,e=null,t=null):"function"===typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,R(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),C.prototype.destroy=f.destroy,C.prototype._undestroy=f.undestroy,C.prototype._destroy=function(e,t){t(e)}},6871:function(e,t,n){"use strict";var r;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=n(9698),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),d=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var n=e[h].read();null!==n&&(e[d]=null,e[a]=null,e[c]=null,t(p(n,!1)))}}function m(e){i.nextTick(g,e)}var b=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((r={get stream(){return this[h]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise((function(t,n){i.nextTick((function(){e[u]?n(e[u]):t(p(void 0,!0))}))}));var n,r=this[d];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[l]?n(p(void 0,!0)):t[f](n,r)}),r)}}(r,this));else{var o=this[h].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[f])}return this[d]=n,n}},o(r,Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var e=this;return new Promise((function(t,n){e[h].destroy(null,(function(e){e?n(e):t(p(void 0,!0))}))}))})),r),b);e.exports=function(e){var t,n=Object.create(y,(o(t={},h,{value:e,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,l,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var r=n[h].read();r?(n[d]=null,n[a]=null,n[c]=null,e(p(r,!1))):(n[a]=e,n[c]=t)},writable:!0}),t));return n[d]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[c];return null!==t&&(n[d]=null,n[a]=null,n[c]=null,t(e)),void(n[u]=e)}var r=n[a];null!==r&&(n[d]=null,n[a]=null,n[c]=null,r(p(void 0,!0))),n[l]=!0})),e.on("readable",m.bind(null,n)),n}},4379:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){for(var n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t=s.allocUnsafe(e>>>0),n=this.head,r=0;n;)u(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0===(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:c,value:function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){r||(r=e),e&&s.forEach(u),o||(s.forEach(u),i(r))}))}));return t.reduce(l)}},6776:function(e,t,n){"use strict";var r=n(4646).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,i){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},4678:function(e,t,n){e.exports=n(2781)},3726:function(e,t,n){var r=n(2781);"disable"===i.env.READABLE_STREAM&&r?(e.exports=r.Readable,Object.assign(e.exports,r),e.exports.Stream=r):((t=e.exports=n(1709)).Stream=r||t,t.Readable=t,t.Writable=n(7337),t.Duplex=n(2403),t.Transform=n(1170),t.PassThrough=n(7889),t.finished=n(9698),t.pipeline=n(8442))},3225:function(e,t,n){"use strict";var r=n(4300).Buffer,i=n(3782),o=n(9029),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],c=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],l=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],d=[0,1518500249,1859775393,2400959708,2840853838],f=[1352829926,1548603684,1836072691,2053994217,0];function h(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(e,t){return e<>>32-t}function g(e,t,n,r,i,o,s,a){return p(e+(t^n^r)+o+s|0,a)+i|0}function m(e,t,n,r,i,o,s,a){return p(e+(t&n|~t&r)+o+s|0,a)+i|0}function b(e,t,n,r,i,o,s,a){return p(e+((t|~n)^r)+o+s|0,a)+i|0}function y(e,t,n,r,i,o,s,a){return p(e+(t&r|n&~r)+o+s|0,a)+i|0}function v(e,t,n,r,i,o,s,a){return p(e+(t^(n|~r))+o+s|0,a)+i|0}i(h,o),h.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,w=0|this._a,x=0|this._b,S=0|this._c,A=0|this._d,E=0|this._e,_=0;_<80;_+=1){var C,I;_<16?(C=g(n,r,i,o,h,e[a[_]],d[0],u[_]),I=v(w,x,S,A,E,e[c[_]],f[0],l[_])):_<32?(C=m(n,r,i,o,h,e[a[_]],d[1],u[_]),I=y(w,x,S,A,E,e[c[_]],f[1],l[_])):_<48?(C=b(n,r,i,o,h,e[a[_]],d[2],u[_]),I=b(w,x,S,A,E,e[c[_]],f[2],l[_])):_<64?(C=y(n,r,i,o,h,e[a[_]],d[3],u[_]),I=m(w,x,S,A,E,e[c[_]],f[3],l[_])):(C=v(n,r,i,o,h,e[a[_]],d[4],u[_]),I=g(w,x,S,A,E,e[c[_]],f[4],l[_])),n=h,h=o,o=p(i,10),i=r,r=C,w=E,E=A,A=p(S,10),S=x,x=I}var k=this._b+i+A|0;this._b=this._c+o+E|0,this._c=this._d+h+w|0,this._d=this._e+n+x|0,this._e=this._a+r+S|0,this._a=k},h.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=r.alloc?r.alloc(20):new r(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=h},5055:function(e,t,n){var r=n(4300),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,n){if("number"===typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!==typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"===typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},2858:function(e,t,n){var r=n(5055).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"===typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},4371:function(e,t,n){var r=e.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};r.sha=n(4018),r.sha1=n(4179),r.sha224=n(532),r.sha256=n(1843),r.sha384=n(7455),r.sha512=n(9934)},4018:function(e,t,n){var r=n(3782),i=n(2858),o=n(5055).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function d(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,c=0;c<16;++c)t[c]=e.readInt32BE(4*c);for(;c<80;++c)t[c]=t[c-3]^t[c-8]^t[c-14]^t[c-16];for(var f=0;f<80;++f){var h=~~(f/20),p=u(n)+d(h,r,i,o)+a+t[f]+s[h]|0;a=o,o=i,i=l(r),r=n,n=p}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},c.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=c},4179:function(e,t,n){var r=n(3782),i=n(2858),o=n(5055).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(e){return e<<1|e>>>31}function l(e){return e<<5|e>>>27}function d(e){return e<<30|e>>>2}function f(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,c=0;c<16;++c)t[c]=e.readInt32BE(4*c);for(;c<80;++c)t[c]=u(t[c-3]^t[c-8]^t[c-14]^t[c-16]);for(var h=0;h<80;++h){var p=~~(h/20),g=l(n)+f(p,r,i,o)+a+t[h]+s[p]|0;a=o,o=i,i=d(r),r=n,n=g}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},c.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=c},532:function(e,t,n){var r=n(3782),i=n(1843),o=n(2858),s=n(5055).Buffer,a=new Array(64);function c(){this.init(),this._w=a,o.call(this,64,56)}r(c,i),c.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},c.prototype._hash=function(){var e=s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=c},1843:function(e,t,n){var r=n(3782),i=n(2858),o=n(5055).Buffer,s=[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],a=new Array(64);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(e,t,n){return n^e&(t^n)}function l(e,t,n){return e&t|n&(e|t)}function d(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function f(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function h(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function p(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}r(c,i),c.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},c.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,c=0|this._f,g=0|this._g,m=0|this._h,b=0;b<16;++b)t[b]=e.readInt32BE(4*b);for(;b<64;++b)t[b]=p(t[b-2])+t[b-7]+h(t[b-15])+t[b-16]|0;for(var y=0;y<64;++y){var v=m+f(a)+u(a,c,g)+s[y]+t[y]|0,w=d(n)+l(n,r,i)|0;m=g,g=c,c=a,a=o+v|0,o=i,i=r,r=n,n=v+w|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=c+this._f|0,this._g=g+this._g|0,this._h=m+this._h|0},c.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=c},7455:function(e,t,n){var r=n(3782),i=n(9934),o=n(2858),s=n(5055).Buffer,a=new Array(160);function c(){this.init(),this._w=a,o.call(this,128,112)}r(c,i),c.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},c.prototype._hash=function(){var e=s.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=c},9934:function(e,t,n){var r=n(3782),i=n(2858),o=n(5055).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function c(){this.init(),this._w=a,i.call(this,128,112)}function u(e,t,n){return n^e&(t^n)}function l(e,t,n){return e&t|n&(e|t)}function d(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function h(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function b(e,t){return e>>>0>>0?1:0}r(c,i),c.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},c.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,c=0|this._fh,y=0|this._gh,v=0|this._hh,w=0|this._al,x=0|this._bl,S=0|this._cl,A=0|this._dl,E=0|this._el,_=0|this._fl,C=0|this._gl,I=0|this._hl,k=0;k<32;k+=2)t[k]=e.readInt32BE(4*k),t[k+1]=e.readInt32BE(4*k+4);for(;k<160;k+=2){var T=t[k-30],M=t[k-30+1],P=h(T,M),O=p(M,T),R=g(T=t[k-4],M=t[k-4+1]),N=m(M,T),B=t[k-14],L=t[k-14+1],D=t[k-32],U=t[k-32+1],j=O+L|0,F=P+B+b(j,O)|0;F=(F=F+R+b(j=j+N|0,N)|0)+D+b(j=j+U|0,U)|0,t[k]=F,t[k+1]=j}for(var V=0;V<160;V+=2){F=t[V],j=t[V+1];var q=l(n,r,i),z=l(w,x,S),H=d(n,w),W=d(w,n),G=f(a,E),Z=f(E,a),K=s[V],X=s[V+1],Y=u(a,c,y),J=u(E,_,C),Q=I+Z|0,$=v+G+b(Q,I)|0;$=($=($=$+Y+b(Q=Q+J|0,J)|0)+K+b(Q=Q+X|0,X)|0)+F+b(Q=Q+j|0,j)|0;var ee=W+z|0,te=H+q+b(ee,W)|0;v=y,I=C,y=c,C=_,c=a,_=E,a=o+$+b(E=A+Q|0,A)|0,o=i,A=S,i=r,S=x,r=n,x=w,n=$+te+b(w=Q+ee|0,Q)|0}this._al=this._al+w|0,this._bl=this._bl+x|0,this._cl=this._cl+S|0,this._dl=this._dl+A|0,this._el=this._el+E|0,this._fl=this._fl+_|0,this._gl=this._gl+C|0,this._hl=this._hl+I|0,this._ah=this._ah+n+b(this._al,w)|0,this._bh=this._bh+r+b(this._bl,x)|0,this._ch=this._ch+i+b(this._cl,S)|0,this._dh=this._dh+o+b(this._dl,A)|0,this._eh=this._eh+a+b(this._el,E)|0,this._fh=this._fh+c+b(this._fl,_)|0,this._gh=this._gh+y+b(this._gl,C)|0,this._hh=this._hh+v+b(this._hl,I)|0},c.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=c},3704:function(e,t,n){"use strict";var r=n(5055).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!==typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=f,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function s(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"\ufffd";if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"\ufffd";if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"\ufffd"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.s=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},6769:function(e){function t(e){try{if(!n.g.localStorage)return!1}catch(e){return!1}var t=n.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,n){if(t("noDeprecation"))return e;var r=!1;return function(){if(!r){if(t("throwDeprecation"))throw new Error(n);t("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return e.apply(this,arguments)}}},4300:function(e){"use strict";e.exports=n(48764)},6113:function(e){"use strict";e.exports=n(42474)},2361:function(e){"use strict";e.exports=n(17187)},2781:function(e){"use strict";e.exports=n(79681)},1576:function(e){"use strict";e.exports=n(32553)},3837:function(e){"use strict";e.exports=n(89539)},6144:function(e){"use strict";e.exports=n(51951)},5866:function(e){"use strict";e.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},2908:function(e){"use strict";e.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},9267:function(e){"use strict";e.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},7992:function(e){"use strict";e.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},2531:function(e){"use strict";e.exports={i8:"6.5.3"}},2510:function(e){"use strict";e.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')}},o={};function s(e){var n=o[e];if(void 0!==n)return n.exports;var r=o[e]={id:e,loaded:!1,exports:{}},i=!0;try{t[e].call(r.exports,r,r.exports,s),i=!1}finally{i&&delete o[e]}return r.loaded=!0,r.exports}s.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},s.ab="//";var a={};!function(){"use strict";var e=a;e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=s(7223),e.createHash=e.Hash=s(9739),e.createHmac=e.Hmac=s(4873);var t=s(9276),n=Object.keys(t),r=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(n);e.getHashes=function(){return r};var i=s(4978);e.pbkdf2=i.pbkdf2,e.pbkdf2Sync=i.pbkdf2Sync;var o=s(8996);e.Cipher=o.Cipher,e.createCipher=o.createCipher,e.Cipheriv=o.Cipheriv,e.createCipheriv=o.createCipheriv,e.Decipher=o.Decipher,e.createDecipher=o.createDecipher,e.Decipheriv=o.Decipheriv,e.createDecipheriv=o.createDecipheriv,e.getCiphers=o.getCiphers,e.listCiphers=o.listCiphers;var c=s(6587);e.DiffieHellmanGroup=c.DiffieHellmanGroup,e.createDiffieHellmanGroup=c.createDiffieHellmanGroup,e.getDiffieHellman=c.getDiffieHellman,e.createDiffieHellman=c.createDiffieHellman,e.DiffieHellman=c.DiffieHellman;var u=s(4078);e.createSign=u.createSign,e.Sign=u.Sign,e.createVerify=u.createVerify,e.Verify=u.Verify,e.createECDH=s(9942);var l=s(9783);e.publicEncrypt=l.publicEncrypt,e.privateEncrypt=l.privateEncrypt,e.publicDecrypt=l.publicDecrypt,e.privateDecrypt=l.privateDecrypt;var d=s(6445);e.randomFill=d.randomFill,e.randomFillSync=d.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}}(),e.exports=a}()},70166:function(){},73014:function(){},67284:function(){},79681:function(e,t,n){var r=n(34155);!function(){var t={782:function(e){"function"===typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},646:function(e){"use strict";const t={};function n(e,n,r){function i(e,t,r){return"string"===typeof n?n:n(e,t,r)}r||(r=Error);class o extends r{constructor(e,t,n){super(i(e,t,n))}}o.prototype.name=r.name,o.prototype.code=e,t[e]=o}function r(e,t){if(Array.isArray(e)){const n=e.length;return e=e.map((e=>String(e))),n>2?`one of ${t} ${e.slice(0,n-1).join(", ")}, or `+e[n-1]:2===n?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}return`of ${t} ${String(e)}`}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,n){let i,o;if("string"===typeof t&&function(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o=`The ${e} ${i} ${r(t,"type")}`;else{const n=function(e,t,n){return"number"!==typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";o=`The "${e}" ${n} ${i} ${r(t,"type")}`}return o+=". Received type "+typeof n,o}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},403:function(e,t,n){"use strict";var i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var o=n(709),s=n(337);n(782)(l,o);for(var a=i(s.prototype),c=0;c0)if("string"===typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),r)s.endEmitted?A(e,new S):k(e,s,t,!0);else if(s.ended)A(e,new w);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?k(e,s,t,!1):R(e,s)):k(e,s,t,!1)}else r||(s.reading=!1,R(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function P(e){var t=e._readableState;l("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(O,e))}function O(e){var t=e._readableState;l("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(N,e,t))}function N(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){l("readable nexttick read 0"),e.read(0)}function D(e,t){l("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(l("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function F(e){var t=e._readableState;l("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(V,t,e))}function V(e,t){if(l("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function q(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):P(this),null;if(0===(e=M(e,t))&&t.ended)return 0===t.length&&F(this),null;var r,i=t.needReadable;return l("need readable",i),(0===t.length||t.length-e0?j(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&F(this)),null!==r&&this.emit("data",r),r},C.prototype._read=function(e){A(this,new x("_read()"))},C.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,l("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?c:b;function a(e,t){l("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,f())}function c(){l("onend"),e.end()}i.endEmitted?r.nextTick(o):n.once("end",o),e.on("unpipe",a);var u=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,U(e))}}(n);e.on("drain",u);var d=!1;function f(){l("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",u),e.removeListener("error",p),e.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",b),n.removeListener("data",h),d=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||u()}function h(t){l("ondata");var r=e.write(t);l("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==q(i.pipes,e))&&!d&&(l("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function p(t){l("onerror",t),b(),e.removeListener("error",p),0===s(e,"error")&&A(e,t)}function g(){e.removeListener("finish",m),b()}function m(){l("onfinish"),e.removeListener("close",g),b()}function b(){l("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"===typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",p),e.once("close",g),e.once("finish",m),e.emit("pipe",n),i.flowing||(l("pipe resume"),n.resume()),e},C.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,l("on readable",i.length,i.reading),i.length?P(this):i.reading||r.nextTick(L,this))),n},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(B,this),n},C.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(B,this),t},C.prototype.resume=function(){var e=this._readableState;return e.flowing||(l("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(D,e,t))}(this,e)),e.paused=!1,this},C.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(l("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(l("wrapped data"),n.decoder&&(i=n.decoder.write(i)),!n.objectMode||null!==i&&void 0!==i)&&((n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause())))})),e)void 0===this[i]&&"function"===typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new S(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(e,t,n){n(new m("_write()"))},C.prototype._writev=null,C.prototype.end=function(e,t,n){var i=this._writableState;return"function"===typeof e?(n=e,e=null,t=null):"function"===typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,R(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),C.prototype.destroy=f.destroy,C.prototype._undestroy=f.undestroy,C.prototype._destroy=function(e,t){t(e)}},871:function(e,t,n){"use strict";var i;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=n(698),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),d=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var n=e[h].read();null!==n&&(e[d]=null,e[a]=null,e[c]=null,t(p(n,!1)))}}function m(e){r.nextTick(g,e)}var b=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i={get stream(){return this[h]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[u]?n(e[u]):t(p(void 0,!0))}))}));var n,i=this[d];if(i)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[l]?n(p(void 0,!0)):t[f](n,r)}),r)}}(i,this));else{var o=this[h].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[f])}return this[d]=n,n}},o(i,Symbol.asyncIterator,(function(){return this})),o(i,"return",(function(){var e=this;return new Promise((function(t,n){e[h].destroy(null,(function(e){e?n(e):t(p(void 0,!0))}))}))})),i),b);e.exports=function(e){var t,n=Object.create(y,(o(t={},h,{value:e,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,l,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var r=n[h].read();r?(n[d]=null,n[a]=null,n[c]=null,e(p(r,!1))):(n[a]=e,n[c]=t)},writable:!0}),t));return n[d]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[c];return null!==t&&(n[d]=null,n[a]=null,n[c]=null,t(e)),void(n[u]=e)}var r=n[a];null!==r&&(n[d]=null,n[a]=null,n[c]=null,r(p(void 0,!0))),n[l]=!0})),e.on("readable",m.bind(null,n)),n}},379:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){for(var n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t=s.allocUnsafe(e>>>0),n=this.head,r=0;n;)u(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0===(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:c,value:function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){r||(r=e),e&&s.forEach(u),o||(s.forEach(u),i(r))}))}));return t.reduce(l)}},776:function(e,t,n){"use strict";var r=n(646).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,i){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},678:function(e,t,n){e.exports=n(781)},55:function(e,t,n){var r=n(300),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,n){if("number"===typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!==typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"===typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},173:function(e,t,n){e.exports=i;var r=n(361).EventEmitter;function i(){r.call(this)}n(782)(i,r),i.Readable=n(709),i.Writable=n(337),i.Duplex=n(403),i.Transform=n(170),i.PassThrough=n(889),i.finished=n(698),i.pipeline=n(442),i.Stream=i,i.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",c));var s=!1;function a(){s||(s=!0,e.end())}function c(){s||(s=!0,"function"===typeof e.destroy&&e.destroy())}function u(e){if(l(),0===r.listenerCount(this,"error"))throw e}function l(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",c),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",l),n.removeListener("close",l),e.removeListener("close",l)}return n.on("error",u),e.on("error",u),n.on("end",l),n.on("close",l),e.on("close",l),e.emit("pipe",n),e}},704:function(e,t,n){"use strict";var r=n(55).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!==typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=f,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function s(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"\ufffd";if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"\ufffd";if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"\ufffd"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.s=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},769:function(e){function t(e){try{if(!n.g.localStorage)return!1}catch(e){return!1}var t=n.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,n){if(t("noDeprecation"))return e;var r=!1;return function(){if(!r){if(t("throwDeprecation"))throw new Error(n);t("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return e.apply(this,arguments)}}},300:function(e){"use strict";e.exports=n(48764)},361:function(e){"use strict";e.exports=n(17187)},781:function(e){"use strict";e.exports=n(17187).EventEmitter},837:function(e){"use strict";e.exports=n(89539)}},i={};function o(e){var n=i[e];if(void 0!==n)return n.exports;var r=i[e]={exports:{}},s=!0;try{t[e](r,r.exports,o),s=!1}finally{s&&delete i[e]}return r.exports}o.ab="//";var s=o(173);e.exports=s}()},51951:function(module){var __dirname="/";(function(){var __webpack_modules__={950:function(__unused_webpack_module,exports){var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;no[s]^n?1:-1;return c==u?0:u(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else tj?g.c=g.e=null:e.ej)g.c=g.e=null;else if(an-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}function Z(e,t,n){var r,i,o,s,a=0,c=e.length,u=t%h,l=t/h|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%h)+(r=l*o+(s=e[c]/h|0)*u)%h*h+a)/n|0)+(r/h|0)+l*s,e[c]=i%n;return a&&(e=[a].concat(e)),e}function K(e,t,n,r){var i,o;if(n!=r)o=rt[i]?1:-1;break}return o}function X(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]j?e.c=e.e=null:n=m.length){if(!r)break e;for(;m.length<=p;m.push(0));h=g=0,c=(a%=l)-l+(i=1)}else{for(h=d=m[p],i=1;10<=d;d/=10,i++);g=(c=(a%=l)-l+i)<0?0:h/b[i-c-1]%10|0}if(r=r||t<0||null!=m[p+1]||(c<0?h:h%b[i-c-1]),r=n<4?(g||r)&&(0==n||n==(e.s<0?3:2)):5j?e.c=e.e=null:e.e>>11))?(n=crypto.getRandomValues(new Uint32Array(2)),t[u]=n[0],t[u+1]=n[1]):(d.push(c%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw F=!1,Error(a+"crypto unavailable");for(t=crypto.randomBytes(i*=7);ur;)f[a]=0,a||(++c,f=[1].concat(f));for(u=f.length;!f[--u];);for(p=0,e="";p<=u;e+=s.charAt(f[p++]));e=x(e,c,s.charAt(0))}return e},n=function(e,t,n,r,i){var o,a,c,d,f,h,p,m,b,y,v,w,x,S,A,E,_,C=e.s==t.s?1:-1,I=e.c,k=t.c;if(!(I&&I[0]&&k&&k[0]))return new W(e.s&&t.s&&(I?!k||I[0]!=k[0]:k)?I&&0==I[0]||!k?0*C:C/0:NaN);for(b=(m=new W(C)).c=[],C=n+(a=e.e-t.e)+1,i||(i=u,a=g(e.e/l)-g(t.e/l),C=C/l|0),c=0;k[c]==(I[c]||0);c++);if(k[c]>(I[c]||0)&&a--,C<0)b.push(1),d=!0;else{for(S=I.length,E=k.length,C+=2,1<(f=s(i/(k[c=0]+1)))&&(k=Z(k,f,i),I=Z(I,f,i),E=k.length,S=I.length),x=E,v=(y=I.slice(0,E)).length;v=i/2&&A++;do{if(f=0,(o=K(k,y,E,v))<0){if(w=y[0],E!=v&&(w=w*i+(y[1]||0)),1<(f=s(w/A)))for(i<=f&&(f=i-1),p=(h=Z(k,f,i)).length,v=y.length;1==K(h,y,p,v);)f--,X(h,Ec&&(h.c.length=c):r&&(h=h.mod(t))}if(i){if(0===(i=s(i/2)))break;f=i%2}else if($(e=e.times(n),e.e+1,1),14c&&(p.c.length=c):r&&(p=p.mod(t))}return r?h:(d&&(h=R.div(h)),t?h.mod(t):c?$(h,q,B,void 0):h)},O.integerValue=function(e){var t=new W(this);return null==e?e=B:y(e,0,8),$(t,t.e+1,e)},O.isEqualTo=O.eq=function(e,t){return 0===b(this,new W(e,t))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(e,t){return 0this.c.length-2},O.isLessThan=O.lt=function(e,t){return b(this,new W(e,t))<0},O.isLessThanOrEqualTo=O.lte=function(e,t){return-1===(t=b(this,new W(e,t)))||0===t},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return 0r&&(r=this.e+1),r},O.shiftedBy=function(e){return y(e,-d,d),this.times("1e"+e)},O.squareRoot=O.sqrt=function(){var e,t,r,i,o,s=this,a=s.c,c=s.s,u=s.e,l=N+4,d=new W("0.5");if(1!==c||!a||!a[0])return new W(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if((r=0==(c=Math.sqrt(+ee(s)))||c==1/0?(((t=m(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=g((u+1)/2)-(u<0||u%2),new W(t=c==1/0?"1e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):new W(c+"")).c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(o=r,r=d.times(o.plus(n(s,o,l,1))),m(o.c).slice(0,c)===(t=m(r.c)).slice(0,c)){if(r.e=c.trillion||i&&1===f(p/c.trillion)?(h=o.trillion,t/=c.trillion):p=c.billion||i&&1===f(p/c.billion)?(h=o.billion,t/=c.billion):p=c.million||i&&1===f(p/c.million)?(h=o.million,t/=c.million):(p=c.thousand||i&&1===f(p/c.thousand))&&(h=o.thousand,t/=c.thousand),h=h&&(a?" ":"")+h,l){var m=t<0,b=t.toString().split(".")[0],y=m?b.length-1:b.length;g=Math.max(l-y,0)}return{value:t,abbreviation:h,mantissaPrecision:g}}({value:f,forceAverage:I,lowPrecision:k,abbreviations:s.currentAbbreviations(),spaceSeparated:N,roundingFunction:U,totalLength:E});f=F.value,j+=F.abbreviation,E&&(M=F.mantissaPrecision)}if(D){var V=(p=(h={value:f,characteristicPrecision:_}).value,m=void 0===(g=h.characteristicPrecision)?0:g,w=(v=r(p.toExponential().split("e"),2))[0],x=v[1],S=+w,m&&11)for(var n=1;n "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var u="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},l=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new r(e):u(e)})(e)}:u};function d(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw a(this,8);return new o(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}c.create=l(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){r=e,c.create=l(),r._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},50593:function(e,t,n){"use strict";e.exports=o;var r=n(51408);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(99693);function o(e){r.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},85054:function(e){"use strict";e.exports={}},35994:function(e,t,n){"use strict";t.Service=n(77948)},77948:function(e,t,n){"use strict";e.exports=i;var r=n(99693);function i(e,t,n){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null!==n){if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){s(c)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:function(e,t,n){"use strict";e.exports=i;var r=n(99693);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},99693:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function m(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}d.create=f(),d.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(d.alloc=i.pool(d.alloc,i.Array.prototype.subarray)),d.prototype._push=function(e,t,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},d.prototype.bool=function(e){return this._push(h,1,e?1:0)},d.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=o.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var b=i.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r>>0;if(!t)return this._push(h,1,0);if(i.isString(e)){var n=d.alloc(t=s.length(e));s.decode(e,n,0),e=n}return this.uint32(t)._push(b,t,e)},d.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(h,1,0)},d.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new c(u,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(u,0,0),this.len=0),this},d.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},d.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},d._configure=function(e){r=e,d.create=f(),r._configure()}},43155:function(e,t,n){"use strict";e.exports=o;var r=n(41173);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(99693);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},91915:function(e){self,e.exports=(()=>{var e={192:(e,t)=>{var n,r,i=function(){var e=function(e,t){var n=e,r=s[t],i=null,o=0,c=null,m=[],b={},v=function(e,t){i=function(e){for(var t=new Array(e),n=0;n=7&&A(e),null==c&&(c=C(n,r,m)),_(c,t)},w=function(e,t){for(var n=-1;n<=7;n+=1)if(!(e+n<=-1||o<=e+n))for(var r=-1;r<=7;r+=1)t+r<=-1||o<=t+r||(i[e+n][t+r]=0<=n&&n<=6&&(0==r||6==r)||0<=r&&r<=6&&(0==n||6==n)||2<=n&&n<=4&&2<=r&&r<=4)},x=function(){for(var e=8;e>r&1);i[Math.floor(r/3)][r%3+o-8-3]=s}for(r=0;r<18;r+=1)s=!e&&1==(t>>r&1),i[r%3+o-8-3][Math.floor(r/3)]=s},E=function(e,t){for(var n=r<<3|t,s=a.getBCHTypeInfo(n),c=0;c<15;c+=1){var u=!e&&1==(s>>c&1);c<6?i[c][8]=u:c<8?i[c+1][8]=u:i[o-15+c][8]=u}for(c=0;c<15;c+=1)u=!e&&1==(s>>c&1),c<8?i[8][o-c-1]=u:c<9?i[8][15-c-1+1]=u:i[8][15-c-1]=u;i[o-8][8]=!e},_=function(e,t){for(var n=-1,r=o-1,s=7,c=0,u=a.getMaskFunction(t),l=o-1;l>0;l-=2)for(6==l&&(l-=1);;){for(var d=0;d<2;d+=1)if(null==i[r][l-d]){var f=!1;c>>s&1)),u(r,l-d)&&(f=!f),i[r][l-d]=f,-1==(s-=1)&&(c+=1,s=7)}if((r+=n)<0||o<=r){r-=n,n=-n;break}}},C=function(e,t,n){for(var r=l.getRSBlocks(e,t),i=d(),o=0;o8*c)throw"code length overflow. ("+i.getLengthInBits()+">"+8*c+")";for(i.getLengthInBits()+4<=8*c&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*c||(i.put(236,8),i.getLengthInBits()>=8*c));)i.put(17,8);return function(e,t){for(var n=0,r=0,i=0,o=new Array(t.length),s=new Array(t.length),c=0;c=0?p.getAt(g):0}}var m=0;for(f=0;fr)&&(e=r,t=n)}return t}())},b.createTableTag=function(e,t){e=e||2;var n="";n+='',n+="";for(var r=0;r";for(var i=0;i';n+=""}return(n+="")+"
    "},b.createSvgTag=function(e,t,n,r){var i={};"object"==typeof arguments[0]&&(e=(i=arguments[0]).cellSize,t=i.margin,n=i.alt,r=i.title),e=e||2,t=void 0===t?4*e:t,(n="string"==typeof n?{text:n}:n||{}).text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,(r="string"==typeof r?{text:r}:r||{}).text=r.text||null,r.id=r.text?r.id||"qrcode-title":null;var o,s,a,c,u=b.getModuleCount()*e+2*t,l="";for(c="l"+e+",0 0,"+e+" -"+e+",0 0,-"+e+"z ",l+=''+I(r.text)+"":"",l+=n.text?''+I(n.text)+"":"",l+='',l+='"},b.createDataURL=function(e,t){e=e||2,t=void 0===t?4*e:t;var n=b.getModuleCount()*e+2*t,r=t,i=n-t;return y(n,n,(function(t,n){if(r<=t&&t"};var I=function(e){for(var t="",n=0;n":t+=">";break;case"&":t+="&";break;case'"':t+=""";break;default:t+=r}}return t};return b.createASCII=function(e,t){if((e=e||1)<2)return function(e){e=void 0===e?2:e;var t,n,r,i,o,s=1*b.getModuleCount()+2*e,a=e,c=s-e,u={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},l={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},d="";for(t=0;t=c?l[o]:u[o];d+="\n"}return s%2&&e>0?d.substring(0,d.length-s-1)+Array(s+1).join("\u2580"):d.substring(0,d.length-1)}(t);e-=1,t=void 0===t?2*e:t;var n,r,i,o,s=b.getModuleCount()*e+2*t,a=t,c=s-t,u=Array(e+1).join("\u2588\u2588"),l=Array(e+1).join(" "),d="",f="";for(n=0;n>>8),t.push(255&s)):t.push(r)}}return t}};var t,n,r,i,o,s={L:1,M:0,Q:3,H:2},a=(t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,r=7973,o=function(e){for(var t=0;0!=e;)t+=1,e>>>=1;return t},(i={}).getBCHTypeInfo=function(e){for(var t=e<<10;o(t)-o(n)>=0;)t^=n<=0;)t^=r<5&&(n+=3+o-5)}for(r=0;r=256;)t-=255;return e[t]}}}();function u(e,t){if(void 0===e.length)throw e.length+"/"+t;var n=function(){for(var n=0;n>>7-t%8&1)},put:function(e,t){for(var r=0;r>>t-r-1&1))},getLengthInBits:function(){return t},putBit:function(n){var r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1}};return n},f=function(e){var t=e,n={getMode:function(){return 1},getLength:function(e){return t.length},write:function(e){for(var n=t,i=0;i+2>>8&255)+(255&i),e.put(i,13),n+=2}if(n>>8)},writeBytes:function(e,n,r){n=n||0,r=r||e.length;for(var i=0;i0&&(t+=","),t+=e[n];return t+"]"}};return t},b=function(e){var t=e,n=0,r=0,i=0,o={read:function(){for(;i<8;){if(n>=t.length){if(0==i)return-1;throw"unexpected end of file./"+i}var e=t.charAt(n);if(n+=1,"="==e)return i=0,-1;e.match(/^\s$/)||(r=r<<6|s(e.charCodeAt(0)),i+=6)}var o=r>>>i-8&255;return i-=8,o}},s=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(43==e)return 62;if(47==e)return 63;throw"c:"+e};return o},y=function(e,t,n){for(var r=function(e,t){var n=e,r=t,i=new Array(e*t),o={setPixel:function(e,t,r){i[t*n+e]=r},write:function(e){e.writeString("GIF87a"),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(","),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);var t=s(2);e.writeByte(2);for(var i=0;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(";")}},s=function(e){for(var t=1<>>t!=0)throw"length over";for(;u+t>=8;)c.writeByte(255&(e<>>=8-u,l=0,u=0;l|=e<0&&c.writeByte(l)}});f.write(t,r);var h=0,p=String.fromCharCode(i[h]);for(h+=1;h=6;)o(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(o(e<<6-t),e=0,t=0),n%3!=0)for(var i=3-n%3,s=0;s>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(e)},void 0===(r="function"==typeof(n=function(){return i})?n.apply(t,[]):n)||(e.exports=r)},676:(e,t,n)=>{"use strict";n.d(t,{default:()=>R});var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2||o&&s||a&&c)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var l=0;return o&&a?l=Math.PI/2:a&&s?l=Math.PI:s&&c&&(l=-Math.PI/2),void this._basicCornerRounded({x:t,y:n,size:r,rotation:l})}if(1===u)return l=0,a?l=Math.PI/2:s?l=Math.PI:c&&(l=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:l})}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawExtraRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,c=i?+i(0,1):0,u=o+s+a+c;if(0!==u)if(u>2||o&&s||a&&c)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var l=0;return o&&a?l=Math.PI/2:a&&s?l=Math.PI:s&&c&&(l=-Math.PI/2),void this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:l})}if(1===u)return l=0,a?l=Math.PI/2:s?l=Math.PI:c&&(l=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:l})}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawClassy=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,c=i?+i(0,1):0;0!==o+s+a+c?o||a?s||c?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e.prototype._drawClassyRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,c=i?+i(0,1):0;0!==o+s+a+c?o||a?s||c?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e}();var f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]r||i&&i=(t-o.hideXDots)/2&&e<(t+o.hideXDots)/2&&n>=(t-o.hideYDots)/2&&n<(t+o.hideYDots)/2||(null===(r=v[e])||void 0===r?void 0:r[n])||(null===(i=v[e-t+7])||void 0===i?void 0:i[n])||(null===(s=v[e])||void 0===s?void 0:s[n-t+7])||(null===(a=w[e])||void 0===a?void 0:a[n])||(null===(c=w[e-t+7])||void 0===c?void 0:c[n])||(null===(u=w[e])||void 0===u?void 0:u[n-t+7]))})),this.drawCorners(),this._options.image?[4,this.drawImage({width:o.width,height:o.height,count:t,dotSize:i})]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},e.prototype.drawBackground=function(){var e,t,n,r=this._element,i=this._options;if(r){var o=null===(e=i.backgroundOptions)||void 0===e?void 0:e.gradient,s=null===(t=i.backgroundOptions)||void 0===t?void 0:t.color;if((o||s)&&this._createColor({options:o,color:s,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"background-color"}),null===(n=i.backgroundOptions)||void 0===n?void 0:n.round){var a=Math.min(i.width,i.height),c=document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id","clip-path-background-color"),this._defs.appendChild(this._backgroundClipPath),c.setAttribute("x",String((i.width-a)/2)),c.setAttribute("y",String((i.height-a)/2)),c.setAttribute("width",String(a)),c.setAttribute("height",String(a)),c.setAttribute("rx",String(a/2*i.backgroundOptions.round)),this._backgroundClipPath.appendChild(c)}}},e.prototype.drawDots=function(e){var t,n,r=this;if(!this._qr)throw"QR code is not defined";var i=this._options,o=this._qr.getModuleCount();if(o>i.width||o>i.height)throw"The canvas is too small.";var s=Math.min(i.width,i.height)-2*i.margin,a=i.shape===m?s/Math.sqrt(2):s,c=Math.floor(a/o),u=Math.floor((i.width-o*c)/2),l=Math.floor((i.height-o*c)/2),f=new d({svg:this._element,type:i.dotsOptions.type});this._dotsClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id","clip-path-dot-color"),this._defs.appendChild(this._dotsClipPath),this._createColor({options:null===(t=i.dotsOptions)||void 0===t?void 0:t.gradient,color:i.dotsOptions.color,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"dot-color"});for(var h=function(t){for(var i=function(i){return e&&!e(t,i)?"continue":(null===(n=p._qr)||void 0===n?void 0:n.isDark(t,i))?(f.draw(u+t*c,l+i*c,c,(function(n,s){return!(t+n<0||i+s<0||t+n>=o||i+s>=o)&&!(e&&!e(t+n,i+s))&&!!r._qr&&r._qr.isDark(t+n,i+s)})),void(f._element&&p._dotsClipPath&&p._dotsClipPath.appendChild(f._element))):"continue"},s=0;s=b-1&&g<=y-b&&A>=b-1&&A<=y-b||Math.sqrt((g-S)*(g-S)+(A-S)*(A-S))>S?x[g][A]=0:x[g][A]=this._qr.isDark(A-2*b<0?A:A>=o?A-2*b:A-b,g-2*b<0?g:g>=o?g-2*b:g-b)?1:0}var E=function(e){for(var t=function(t){if(!x[e][t])return"continue";f.draw(v+e*c,w+t*c,c,(function(n,r){var i;return!!(null===(i=x[e+n])||void 0===i?void 0:i[t+r])})),f._element&&_._dotsClipPath&&_._dotsClipPath.appendChild(f._element)},n=0;ns?a:s,l=document.createElementNS("http://www.w3.org/2000/svg","rect");if(l.setAttribute("x",String(i)),l.setAttribute("y",String(o)),l.setAttribute("height",String(s)),l.setAttribute("width",String(a)),l.setAttribute("clip-path","url('#clip-path-"+c+"')"),t){var d;if("radial"===t.type)(d=document.createElementNS("http://www.w3.org/2000/svg","radialGradient")).setAttribute("id",c),d.setAttribute("gradientUnits","userSpaceOnUse"),d.setAttribute("fx",String(i+a/2)),d.setAttribute("fy",String(o+s/2)),d.setAttribute("cx",String(i+a/2)),d.setAttribute("cy",String(o+s/2)),d.setAttribute("r",String(u/2));else{var f=((t.rotation||0)+r)%(2*Math.PI),h=(f+2*Math.PI)%(2*Math.PI),p=i+a/2,g=o+s/2,m=i+a/2,b=o+s/2;h>=0&&h<=.25*Math.PI||h>1.75*Math.PI&&h<=2*Math.PI?(p-=a/2,g-=s/2*Math.tan(f),m+=a/2,b+=s/2*Math.tan(f)):h>.25*Math.PI&&h<=.75*Math.PI?(g-=s/2,p-=a/2/Math.tan(f),b+=s/2,m+=a/2/Math.tan(f)):h>.75*Math.PI&&h<=1.25*Math.PI?(p+=a/2,g+=s/2*Math.tan(f),m-=a/2,b-=s/2*Math.tan(f)):h>1.25*Math.PI&&h<=1.75*Math.PI&&(g+=s/2,p+=a/2/Math.tan(f),b-=s/2,m-=a/2/Math.tan(f)),(d=document.createElementNS("http://www.w3.org/2000/svg","linearGradient")).setAttribute("id",c),d.setAttribute("gradientUnits","userSpaceOnUse"),d.setAttribute("x1",String(Math.round(p))),d.setAttribute("y1",String(Math.round(g))),d.setAttribute("x2",String(Math.round(m))),d.setAttribute("y2",String(Math.round(b)))}t.colorStops.forEach((function(e){var t=e.offset,n=e.color,r=document.createElementNS("http://www.w3.org/2000/svg","stop");r.setAttribute("offset",100*t+"%"),r.setAttribute("stop-color",n),d.appendChild(r)})),l.setAttribute("fill","url('#"+c+"')"),this._defs.appendChild(d)}else n&&l.setAttribute("fill",n);this._element.appendChild(l)},e}(),S="canvas";for(var A={},E=0;E<=40;E++)A[E]=E;const _={type:S,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:A[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{round:0,color:"#fff"}};var C=function(){return(C=Object.assign||function(e){for(var t,n=1,r=arguments.length;nMath.min(t.width,t.height)&&(t.margin=Math.min(t.width,t.height)),t.dotsOptions=C({},t.dotsOptions),t.dotsOptions.gradient&&(t.dotsOptions.gradient=I(t.dotsOptions.gradient)),t.cornersSquareOptions&&(t.cornersSquareOptions=C({},t.cornersSquareOptions),t.cornersSquareOptions.gradient&&(t.cornersSquareOptions.gradient=I(t.cornersSquareOptions.gradient))),t.cornersDotOptions&&(t.cornersDotOptions=C({},t.cornersDotOptions),t.cornersDotOptions.gradient&&(t.cornersDotOptions.gradient=I(t.cornersDotOptions.gradient))),t.backgroundOptions&&(t.backgroundOptions=C({},t.backgroundOptions),t.backgroundOptions.gradient&&(t.backgroundOptions.gradient=I(t.backgroundOptions.gradient))),t}var T=n(192),M=n.n(T),P=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},O=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]\r\n'+r],{type:"image/svg+xml"})]):[2,new Promise((function(n){return t.toBlob(n,"image/"+e,1)}))]:[2,null]}}))}))},e.prototype.download=function(e){return P(this,void 0,void 0,(function(){var t,n,r,i,o;return O(this,(function(s){switch(s.label){case 0:if(!this._qr)throw"QR code is empty";return t="png",n="qr","string"==typeof e?(t=e,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):"object"==typeof e&&null!==e&&(e.name&&(n=e.name),e.extension&&(t=e.extension)),[4,this._getElement(t)];case 1:return(r=s.sent())?("svg"===t.toLowerCase()?(i=new XMLSerializer,o='\r\n'+(o=i.serializeToString(r)),a("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o),n+".svg")):a(r.toDataURL("image/"+t),n+"."+t),[2]):[2]}}))}))},e}()}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(676)})().default},17563:function(e,t,n){"use strict";const r=n(70610),i=n(25459),o=n(80500),s=n(92806),a=Symbol("encodeFragmentIdentifier");function c(e){if("string"!==typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function l(e,t){return t.decode?i(e):e}function d(e){return Array.isArray(e)?e.sort():"object"===typeof e?d(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function f(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function h(e){const t=(e=f(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"===typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function g(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return(e,n,r)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"===typeof n&&n.includes(e.arrayFormatSeparator),o="string"===typeof n&&!i&&l(n,e).includes(e.arrayFormatSeparator);n=o?l(n,e):n;const s=i||o?n.split(e.arrayFormatSeparator).map((t=>l(t,e))):null===n?n:l(n,e);r[t]=s};case"bracket-separator":return(t,n,r)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(r[t]=n?l(n,e):n);const o=null===n?[]:n.split(e.arrayFormatSeparator).map((t=>l(t,e)));void 0!==r[t]?r[t]=[].concat(r[t],o):r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!==typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){if(""===i)continue;let[e,s]=o(t.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:l(s,t),n(l(e,t),s,r)}for(const i of Object.keys(r)){const e=r[i];if("object"===typeof e&&null!==e)for(const n of Object.keys(e))e[n]=p(e[n],t);else r[i]=p(e,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce(((e,t)=>{const n=r[t];return Boolean(n)&&"object"===typeof n&&!Array.isArray(n)?e[t]=d(n):e[t]=n,e}),Object.create(null))}t.extract=h,t.parse=g,t.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>{return t.skipNull&&(null===(r=e[n])||void 0===r)||t.skipEmptyString&&""===e[n];var r},r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),"[",i,"]"].join("")]:[...n,[u(t,e),"[",u(i,e),"]=",u(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),"[]"].join("")]:[...n,[u(t,e),"[]=",u(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),":list="].join("")]:[...n,[u(t,e),":list=",u(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[u(n,e),t,u(i,e)].join("")]:[[r,u(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,u(t,e)]:[...n,[u(t,e),"=",u(r,e)].join("")]}}(t),i={};for(const s of Object.keys(e))n(s)||(i[s]=e[s]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((n=>{const i=e[n];return void 0===i?"":null===i?u(n,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?u(n,t)+"[]":i.reduce(r(n),[]).join("&"):u(n,t)+"="+u(i,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=o(e,"#");return Object.assign({url:n.split("?")[0]||"",query:g(h(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:l(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0,[a]:!0},n);const r=f(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),s=Object.assign(o,e.query);let c=t.stringify(s,n);c&&(c=`?${c}`);let l=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(l=`#${n[a]?u(e.fragmentIdentifier,n):e.fragmentIdentifier}`),`${r}${c}${l}`},t.pick=(e,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[a]:!1},r);const{url:i,query:o,fragmentIdentifier:c}=t.parseUrl(e,r);return t.stringifyUrl({url:i,query:s(o,n),fragmentIdentifier:c},r)},t.exclude=(e,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return t.pick(e,i,r)}},25459:function(e){"use strict";var t="%[a-f0-9]{2}",n=new RegExp("("+t+")|([^%]+?)","gi"),r=new RegExp("("+t+")+","gi");function i(e,t){try{return[decodeURIComponent(e.join(""))]}catch(o){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n)||[],r=1;r-1?d:0,e.charCodeAt(h+1)){case 100:case 102:if(l>=c)break;if(null==n[l])break;d=c)break;if(null==n[l])break;d=c)break;if(void 0===n[l])break;d",d=h+2,h++;break}u+=i(n[l]),d=h+2,h++;break;case 115:if(l>=c)break;d2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,n){var i,o,s,a;if("string"===typeof t&&(o="not ",t.substr(!s||s<0?0:+s,o.length)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))a="The ".concat(e," ").concat(i," ").concat(r(t,"type"));else{var c=function(e,t,n){return"number"!==typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(c," ").concat(i," ").concat(r(t,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},56753:function(e,t,n){"use strict";var r=n(34155),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var o=n(79481),s=n(64229);n(35717)(l,o);for(var a=i(s.prototype),c=0;c0)if("string"===typeof t||s.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),r)s.endEmitted?S(e,new x):I(e,s,t,!0);else if(s.ended)S(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?I(e,s,t,!1):O(e,s)):I(e,s,t,!1)}else r||(s.reading=!1,O(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=k?e=k:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(P,e))}function P(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function O(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function B(e){u("readable nexttick read 0"),e.read(0)}function L(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function U(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function j(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(F,t,e))}function F(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function V(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):M(this),null;if(0===(e=T(e,t))&&t.ended)return 0===t.length&&j(this),null;var r,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e0?U(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&j(this)),null!==r&&this.emit("data",r),r},_.prototype._read=function(e){S(this,new w("_read()"))},_.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,u("pipe count=%d opts=%j",r.pipesCount,t);var s=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?c:m;function a(t,i){u("onunpipe"),t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,u("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",m),n.removeListener("data",f),d=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function c(){u("onend"),e.end()}r.endEmitted?i.nextTick(s):n.once("end",s),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,D(e))}}(n);e.on("drain",l);var d=!1;function f(t){u("ondata");var i=e.write(t);u("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==V(r.pipes,e))&&!d&&(u("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function h(t){u("onerror",t),m(),e.removeListener("error",h),0===o(e,"error")&&S(e,t)}function p(){e.removeListener("finish",g),m()}function g(){u("onfinish"),e.removeListener("close",p),m()}function m(){u("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,n){if("function"===typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",p),e.once("finish",g),e.emit("pipe",n),r.flowing||(u("pipe resume"),n.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,u("on readable",r.length,r.reading),r.length?M(this):r.reading||i.nextTick(B,this))),n},_.prototype.addListener=_.prototype.on,_.prototype.removeListener=function(e,t){var n=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(N,this),n},_.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(N,this),t},_.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(L,e,t))}(this,e)),e.paused=!1,this},_.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},_.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(u("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(u("wrapped data"),n.decoder&&(i=n.decoder.write(i)),!n.objectMode||null!==i&&void 0!==i)&&((n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause())))})),e)void 0===this[i]&&"function"===typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new g("_write()"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;return"function"===typeof e?(n=e,e=null,t=null):"function"===typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,P(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(_.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(_.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=d.destroy,_.prototype._undestroy=d.undestroy,_.prototype._destroy=function(e,t){t(e)}},45850:function(e,t,n){"use strict";var r,i=n(34155);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=n(8610),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),d=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var n=e[h].read();null!==n&&(e[d]=null,e[a]=null,e[c]=null,t(p(n,!1)))}}function m(e){i.nextTick(g,e)}var b=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((o(r={get stream(){return this[h]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise((function(t,n){i.nextTick((function(){e[u]?n(e[u]):t(p(void 0,!0))}))}));var n,r=this[d];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[l]?n(p(void 0,!0)):t[f](n,r)}),r)}}(r,this));else{var o=this[h].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[f])}return this[d]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var e=this;return new Promise((function(t,n){e[h].destroy(null,(function(e){e?n(e):t(p(void 0,!0))}))}))})),r),b);e.exports=function(e){var t,n=Object.create(y,(o(t={},h,{value:e,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,l,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var r=n[h].read();r?(n[d]=null,n[a]=null,n[c]=null,e(p(r,!1))):(n[a]=e,n[c]=t)},writable:!0}),t));return n[d]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[c];return null!==t&&(n[d]=null,n[a]=null,n[c]=null,t(e)),void(n[u]=e)}var r=n[a];null!==r&&(n[d]=null,n[a]=null,n[c]=null,r(p(void 0,!0))),n[l]=!0})),e.on("readable",m.bind(null,n)),n}},57327:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){for(var n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t,n,r,i=s.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=i,r=a,s.prototype.copy.call(t,n,r),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0===(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:c,value:function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){r||(r=e),e&&s.forEach(u),o||(s.forEach(u),i(r))}))}));return t.reduce(l)}},82457:function(e,t,n){"use strict";var r=n(94281).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,i){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},22503:function(e,t,n){e.exports=n(17187).EventEmitter},88473:function(e,t,n){(t=e.exports=n(79481)).Stream=t,t.Readable=t,t.Writable=n(64229),t.Duplex=n(56753),t.Transform=n(74605),t.PassThrough=n(82725),t.finished=n(8610),t.pipeline=n(59946)},89509:function(e,t,n){var r=n(48764),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,n){if("number"===typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!==typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"===typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},3321:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});var r=n(29745),i=n(23671),o=n(18232),s=n(9695),a=n.n(s),c=n(34714),u=n(72987),l=n(47630),d=n.n(l),f=(n(45697),n(67294)),h=n(86663),p=n(7392),g=n(73935),m=n(41779),b=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i1?s-1:0),c=1;c1?c-1:0),l=1;l1?s-1:0),c=1;c1?a-1:0),u=1;u1?a-1:0),u=1;u=i(t,n)&&e0&&void 0!==arguments[0]?arguments[0]:n;if(!this||this.constructor!==e)return new e(a);if(t&&!t.includes(a))throw new Error("Unsupported hash length");var c=new o.default({capacity:a});return this.update=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";if(i.Buffer.isBuffer(e))return c.absorb(e),s;if("string"===typeof e)return s.update(i.Buffer.from(e,t));throw new TypeError("Not a string or buffer")},this.digest=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"binary",t="string"===typeof e?{format:e}:e,n=c.squeeze({buffer:t.buffer,padding:t.padding||r});return t.format&&"binary"!==t.format?n.toString(t.format):n},this.reset=function(){return c.reset(),s},this}},a=s({allowedSizes:[224,256,384,512],defaultSize:512,padding:1});var c=s({allowedSizes:[224,256,384,512],defaultSize:512,padding:6});t.Aj=c,s({allowedSizes:[128,256],defaultSize:256,padding:31});var u=a;c.SHA3Hash=u},55926:function(e,t,n){"use strict";const r=n(79742),i=n(80645),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},29274:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,i=n(55926),o=(r=n(99618))&&r.__esModule?r:{default:r};var s=function(e,t){for(var n=0;n>>8,t[n+2]=e[r+1]>>>16,t[n+3]=e[r+1]>>>24,t[n+4]=e[r],t[n+5]=e[r]>>>8,t[n+6]=e[r]>>>16,t[n+7]=e[r]>>>24}return t},c=function(e){var t=this,n=e.capacity,r=e.padding,c=(0,o.default)(),u=n/8,l=200-n/4,d=0,f=new Uint32Array(50),h=i.Buffer.allocUnsafe(l);return this.absorb=function(e){for(var n=0;n=l&&(s(h,f),c(f),d=0);return t},this.squeeze=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={buffer:e.buffer||i.Buffer.allocUnsafe(u),padding:e.padding||r,queue:i.Buffer.allocUnsafe(h.length),state:new Uint32Array(f.length)};h.copy(t.queue);for(var n=0;n>>l,s[(u+1)%2]=c<>>l,(0,o.default)(s,0)(t,f),(0,o.default)(n,0)(s,0)}};t.default=a},76325:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=[10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1];t.default=n},23010:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=[1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44];t.default=n},57959:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,i=(r=n(76605))&&r.__esModule?r:{default:r};var o=function(e){for(var t=e.A,n=e.C,r=e.D,o=e.W,s=0,a=0,c=0;c<5;c++){var u=2*c,l=2*(c+5),d=2*(c+10),f=2*(c+15),h=2*(c+20);n[u]=t[u]^t[l]^t[d]^t[f]^t[h],n[u+1]=t[u+1]^t[l+1]^t[d+1]^t[f+1]^t[h+1]}for(var p=0;p<5;p++){(0,i.default)(n,(p+1)%5)(o,0),s=o[0],a=o[1],o[0]=s<<1|a>>>31,o[1]=a<<1|s>>>31,r[2*p]=n[(p+4)%5*2]^o[0],r[2*p+1]=n[(p+4)%5*2+1]^o[1];for(var g=0;g<25;g+=5)t[2*(g+p)]^=r[2*p],t[2*(g+p)+1]^=r[2*p+1]}};t.default=o},96774:function(e){e.exports=function(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!==typeof e||!e||"object"!==typeof t||!t)return!1;var o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c{if("string"!==typeof e||"string"!==typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},58971:function(e,t,n){var r=n(62195),i=n(39015),o=[n(19257)];e.exports=r.createStore(i,o)},19257:function(e,t,n){e.exports=function(){return n(55703),{}}},55703:function(){"object"!==typeof JSON&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,(function(e){var t=meta[e];return"string"===typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function str(e,t){var n,r,i,o,s,a=gap,c=t[e];switch(c&&"object"===typeof c&&"function"===typeof c.toJSON&&(c=c.toJSON(e)),"function"===typeof rep&&(c=rep.call(t,e,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(o=c.length,n=0;n=0;n--)if(o(t[n])){var r=t[n].split("="),i=unescape(r[0]);e(unescape(r[1]),i)}}function c(e){e&&u(e)&&(s.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function u(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(s.cookie)}},39627:function(e,t,n){var r=n(69078).Global;function i(){return r.localStorage}function o(e){return i().getItem(e)}e.exports={name:"localStorage",read:o,write:function(e,t){return i().setItem(e,t)},each:function(e){for(var t=i().length-1;t>=0;t--){var n=i().key(t);e(o(n),n)}},remove:function(e){return i().removeItem(e)},clearAll:function(){return i().clear()}}},8728:function(e){e.exports={name:"memoryStorage",read:function(e){return t[e]},write:function(e,n){t[e]=n},each:function(e){for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)},remove:function(e){delete t[e]},clearAll:function(e){t={}}};var t={}},95347:function(e,t,n){var r=n(69078).Global;e.exports={name:"oldFF-globalStorage",read:function(e){return i[e]},write:function(e,t){i[e]=t},each:o,remove:function(e){return i.removeItem(e)},clearAll:function(){o((function(e,t){delete i[e]}))}};var i=r.globalStorage;function o(e){for(var t=i.length-1;t>=0;t--){var n=i.key(t);e(i[n],n)}}},34524:function(e,t,n){var r=n(69078).Global;e.exports={name:"oldIE-userDataStorage",write:function(e,t){if(a)return;var n=u(e);s((function(e){e.setAttribute(n,t),e.save(i)}))},read:function(e){if(a)return;var t=u(e),n=null;return s((function(e){n=e.getAttribute(t)})),n},each:function(e){s((function(t){for(var n=t.XMLDocument.documentElement.attributes,r=n.length-1;r>=0;r--){var i=n[r];e(t.getAttribute(i.name),i.name)}}))},remove:function(e){var t=u(e);s((function(e){e.removeAttribute(t),e.save(i)}))},clearAll:function(){s((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(i);for(var n=t.length-1;n>=0;n--)e.removeAttribute(t[n].name);e.save(i)}))}};var i="storejs",o=r.document,s=function(){if(!o||!o.documentElement||!o.documentElement.addBehavior)return null;var e,t,n;try{(t=new ActiveXObject("htmlfile")).open(),t.write('',n+="";for(var r=0;r";for(var i=0;i';n+=""}return(n+="")+"
    "},b.createSvgTag=function(e,t,n,r){var i={};"object"==typeof arguments[0]&&(e=(i=arguments[0]).cellSize,t=i.margin,n=i.alt,r=i.title),e=e||2,t=void 0===t?4*e:t,(n="string"==typeof n?{text:n}:n||{}).text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,(r="string"==typeof r?{text:r}:r||{}).text=r.text||null,r.id=r.text?r.id||"qrcode-title":null;var o,s,a,c,u=b.getModuleCount()*e+2*t,l="";for(c="l"+e+",0 0,"+e+" -"+e+",0 0,-"+e+"z ",l+=''+I(r.text)+"":"",l+=n.text?''+I(n.text)+"":"",l+='',l+='"},b.createDataURL=function(e,t){e=e||2,t=void 0===t?4*e:t;var n=b.getModuleCount()*e+2*t,r=t,i=n-t;return y(n,n,(function(t,n){if(r<=t&&t"};var I=function(e){for(var t="",n=0;n":t+=">";break;case"&":t+="&";break;case'"':t+=""";break;default:t+=r}}return t};return b.createASCII=function(e,t){if((e=e||1)<2)return function(e){e=void 0===e?2:e;var t,n,r,i,o,s=1*b.getModuleCount()+2*e,a=e,c=s-e,u={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},l={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},d="";for(t=0;t=c?l[o]:u[o];d+="\n"}return s%2&&e>0?d.substring(0,d.length-s-1)+Array(s+1).join("\u2580"):d.substring(0,d.length-1)}(t);e-=1,t=void 0===t?2*e:t;var n,r,i,o,s=b.getModuleCount()*e+2*t,a=t,c=s-t,u=Array(e+1).join("\u2588\u2588"),l=Array(e+1).join(" "),d="",f="";for(n=0;n>>8),t.push(255&s)):t.push(r)}}return t}};var t,n,r,i,o,s={L:1,M:0,Q:3,H:2},a=(t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,r=7973,o=function(e){for(var t=0;0!=e;)t+=1,e>>>=1;return t},(i={}).getBCHTypeInfo=function(e){for(var t=e<<10;o(t)-o(n)>=0;)t^=n<=0;)t^=r<5&&(n+=3+o-5)}for(r=0;r=256;)t-=255;return e[t]}}}();function u(e,t){if(void 0===e.length)throw e.length+"/"+t;var n=function(){for(var n=0;n>>7-t%8&1)},put:function(e,t){for(var r=0;r>>t-r-1&1))},getLengthInBits:function(){return t},putBit:function(n){var r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1}};return n},f=function(e){var t=e,n={getMode:function(){return 1},getLength:function(e){return t.length},write:function(e){for(var n=t,i=0;i+2>>8&255)+(255&i),e.put(i,13),n+=2}if(n>>8)},writeBytes:function(e,n,r){n=n||0,r=r||e.length;for(var i=0;i0&&(t+=","),t+=e[n];return t+"]"}};return t},b=function(e){var t=e,n=0,r=0,i=0,o={read:function(){for(;i<8;){if(n>=t.length){if(0==i)return-1;throw"unexpected end of file./"+i}var e=t.charAt(n);if(n+=1,"="==e)return i=0,-1;e.match(/^\s$/)||(r=r<<6|s(e.charCodeAt(0)),i+=6)}var o=r>>>i-8&255;return i-=8,o}},s=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(43==e)return 62;if(47==e)return 63;throw"c:"+e};return o},y=function(e,t,n){for(var r=function(e,t){var n=e,r=t,i=new Array(e*t),o={setPixel:function(e,t,r){i[t*n+e]=r},write:function(e){e.writeString("GIF87a"),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(","),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);var t=s(2);e.writeByte(2);for(var i=0;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(";")}},s=function(e){for(var t=1<>>t!=0)throw"length over";for(;u+t>=8;)c.writeByte(255&(e<>>=8-u,l=0,u=0;l|=e<0&&c.writeByte(l)}});f.write(t,r);var h=0,p=String.fromCharCode(i[h]);for(h+=1;h=6;)o(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(o(e<<6-t),e=0,t=0),n%3!=0)for(var i=3-n%3,s=0;s>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(e)},void 0===(r="function"==typeof(n=function(){return i})?n.apply(t,[]):n)||(e.exports=r)},676:(e,t,n)=>{"use strict";n.d(t,{default:()=>R});var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2||o&&s||a&&c)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var l=0;return o&&a?l=Math.PI/2:a&&s?l=Math.PI:s&&c&&(l=-Math.PI/2),void this._basicCornerRounded({x:t,y:n,size:r,rotation:l})}if(1===u)return l=0,a?l=Math.PI/2:s?l=Math.PI:c&&(l=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:l})}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawExtraRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,c=i?+i(0,1):0,u=o+s+a+c;if(0!==u)if(u>2||o&&s||a&&c)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var l=0;return o&&a?l=Math.PI/2:a&&s?l=Math.PI:s&&c&&(l=-Math.PI/2),void this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:l})}if(1===u)return l=0,a?l=Math.PI/2:s?l=Math.PI:c&&(l=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:l})}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawClassy=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,c=i?+i(0,1):0;0!==o+s+a+c?o||a?s||c?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e.prototype._drawClassyRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,c=i?+i(0,1):0;0!==o+s+a+c?o||a?s||c?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e}();var f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]r||i&&i=(t-o.hideXDots)/2&&e<(t+o.hideXDots)/2&&n>=(t-o.hideYDots)/2&&n<(t+o.hideYDots)/2||(null===(r=v[e])||void 0===r?void 0:r[n])||(null===(i=v[e-t+7])||void 0===i?void 0:i[n])||(null===(s=v[e])||void 0===s?void 0:s[n-t+7])||(null===(a=w[e])||void 0===a?void 0:a[n])||(null===(c=w[e-t+7])||void 0===c?void 0:c[n])||(null===(u=w[e])||void 0===u?void 0:u[n-t+7]))})),this.drawCorners(),this._options.image?[4,this.drawImage({width:o.width,height:o.height,count:t,dotSize:i})]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},e.prototype.drawBackground=function(){var e,t,n,r=this._element,i=this._options;if(r){var o=null===(e=i.backgroundOptions)||void 0===e?void 0:e.gradient,s=null===(t=i.backgroundOptions)||void 0===t?void 0:t.color;if((o||s)&&this._createColor({options:o,color:s,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"background-color"}),null===(n=i.backgroundOptions)||void 0===n?void 0:n.round){var a=Math.min(i.width,i.height),c=document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id","clip-path-background-color"),this._defs.appendChild(this._backgroundClipPath),c.setAttribute("x",String((i.width-a)/2)),c.setAttribute("y",String((i.height-a)/2)),c.setAttribute("width",String(a)),c.setAttribute("height",String(a)),c.setAttribute("rx",String(a/2*i.backgroundOptions.round)),this._backgroundClipPath.appendChild(c)}}},e.prototype.drawDots=function(e){var t,n,r=this;if(!this._qr)throw"QR code is not defined";var i=this._options,o=this._qr.getModuleCount();if(o>i.width||o>i.height)throw"The canvas is too small.";var s=Math.min(i.width,i.height)-2*i.margin,a=i.shape===m?s/Math.sqrt(2):s,c=Math.floor(a/o),u=Math.floor((i.width-o*c)/2),l=Math.floor((i.height-o*c)/2),f=new d({svg:this._element,type:i.dotsOptions.type});this._dotsClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id","clip-path-dot-color"),this._defs.appendChild(this._dotsClipPath),this._createColor({options:null===(t=i.dotsOptions)||void 0===t?void 0:t.gradient,color:i.dotsOptions.color,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"dot-color"});for(var h=function(t){for(var i=function(i){return e&&!e(t,i)?"continue":(null===(n=p._qr)||void 0===n?void 0:n.isDark(t,i))?(f.draw(u+t*c,l+i*c,c,(function(n,s){return!(t+n<0||i+s<0||t+n>=o||i+s>=o)&&!(e&&!e(t+n,i+s))&&!!r._qr&&r._qr.isDark(t+n,i+s)})),void(f._element&&p._dotsClipPath&&p._dotsClipPath.appendChild(f._element))):"continue"},s=0;s=b-1&&g<=y-b&&A>=b-1&&A<=y-b||Math.sqrt((g-S)*(g-S)+(A-S)*(A-S))>S?x[g][A]=0:x[g][A]=this._qr.isDark(A-2*b<0?A:A>=o?A-2*b:A-b,g-2*b<0?g:g>=o?g-2*b:g-b)?1:0}var E=function(e){for(var t=function(t){if(!x[e][t])return"continue";f.draw(v+e*c,w+t*c,c,(function(n,r){var i;return!!(null===(i=x[e+n])||void 0===i?void 0:i[t+r])})),f._element&&_._dotsClipPath&&_._dotsClipPath.appendChild(f._element)},n=0;ns?a:s,l=document.createElementNS("http://www.w3.org/2000/svg","rect");if(l.setAttribute("x",String(i)),l.setAttribute("y",String(o)),l.setAttribute("height",String(s)),l.setAttribute("width",String(a)),l.setAttribute("clip-path","url('#clip-path-"+c+"')"),t){var d;if("radial"===t.type)(d=document.createElementNS("http://www.w3.org/2000/svg","radialGradient")).setAttribute("id",c),d.setAttribute("gradientUnits","userSpaceOnUse"),d.setAttribute("fx",String(i+a/2)),d.setAttribute("fy",String(o+s/2)),d.setAttribute("cx",String(i+a/2)),d.setAttribute("cy",String(o+s/2)),d.setAttribute("r",String(u/2));else{var f=((t.rotation||0)+r)%(2*Math.PI),h=(f+2*Math.PI)%(2*Math.PI),p=i+a/2,g=o+s/2,m=i+a/2,b=o+s/2;h>=0&&h<=.25*Math.PI||h>1.75*Math.PI&&h<=2*Math.PI?(p-=a/2,g-=s/2*Math.tan(f),m+=a/2,b+=s/2*Math.tan(f)):h>.25*Math.PI&&h<=.75*Math.PI?(g-=s/2,p-=a/2/Math.tan(f),b+=s/2,m+=a/2/Math.tan(f)):h>.75*Math.PI&&h<=1.25*Math.PI?(p+=a/2,g+=s/2*Math.tan(f),m-=a/2,b-=s/2*Math.tan(f)):h>1.25*Math.PI&&h<=1.75*Math.PI&&(g+=s/2,p+=a/2/Math.tan(f),b-=s/2,m-=a/2/Math.tan(f)),(d=document.createElementNS("http://www.w3.org/2000/svg","linearGradient")).setAttribute("id",c),d.setAttribute("gradientUnits","userSpaceOnUse"),d.setAttribute("x1",String(Math.round(p))),d.setAttribute("y1",String(Math.round(g))),d.setAttribute("x2",String(Math.round(m))),d.setAttribute("y2",String(Math.round(b)))}t.colorStops.forEach((function(e){var t=e.offset,n=e.color,r=document.createElementNS("http://www.w3.org/2000/svg","stop");r.setAttribute("offset",100*t+"%"),r.setAttribute("stop-color",n),d.appendChild(r)})),l.setAttribute("fill","url('#"+c+"')"),this._defs.appendChild(d)}else n&&l.setAttribute("fill",n);this._element.appendChild(l)},e}(),S="canvas";for(var A={},E=0;E<=40;E++)A[E]=E;const _={type:S,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:A[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{round:0,color:"#fff"}};var C=function(){return(C=Object.assign||function(e){for(var t,n=1,r=arguments.length;nMath.min(t.width,t.height)&&(t.margin=Math.min(t.width,t.height)),t.dotsOptions=C({},t.dotsOptions),t.dotsOptions.gradient&&(t.dotsOptions.gradient=I(t.dotsOptions.gradient)),t.cornersSquareOptions&&(t.cornersSquareOptions=C({},t.cornersSquareOptions),t.cornersSquareOptions.gradient&&(t.cornersSquareOptions.gradient=I(t.cornersSquareOptions.gradient))),t.cornersDotOptions&&(t.cornersDotOptions=C({},t.cornersDotOptions),t.cornersDotOptions.gradient&&(t.cornersDotOptions.gradient=I(t.cornersDotOptions.gradient))),t.backgroundOptions&&(t.backgroundOptions=C({},t.backgroundOptions),t.backgroundOptions.gradient&&(t.backgroundOptions.gradient=I(t.backgroundOptions.gradient))),t}var T=n(192),M=n.n(T),P=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},O=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]\r\n'+r],{type:"image/svg+xml"})]):[2,new Promise((function(n){return t.toBlob(n,"image/"+e,1)}))]:[2,null]}}))}))},e.prototype.download=function(e){return P(this,void 0,void 0,(function(){var t,n,r,i,o;return O(this,(function(s){switch(s.label){case 0:if(!this._qr)throw"QR code is empty";return t="png",n="qr","string"==typeof e?(t=e,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):"object"==typeof e&&null!==e&&(e.name&&(n=e.name),e.extension&&(t=e.extension)),[4,this._getElement(t)];case 1:return(r=s.sent())?("svg"===t.toLowerCase()?(i=new XMLSerializer,o='\r\n'+(o=i.serializeToString(r)),a("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o),n+".svg")):a(r.toDataURL("image/"+t),n+"."+t),[2]):[2]}}))}))},e}()}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(676)})().default},17563:function(e,t,n){"use strict";const r=n(70610),i=n(25459),o=n(80500),s=n(92806),a=Symbol("encodeFragmentIdentifier");function c(e){if("string"!==typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function l(e,t){return t.decode?i(e):e}function d(e){return Array.isArray(e)?e.sort():"object"===typeof e?d(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function f(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function h(e){const t=(e=f(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"===typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function g(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return(e,n,r)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"===typeof n&&n.includes(e.arrayFormatSeparator),o="string"===typeof n&&!i&&l(n,e).includes(e.arrayFormatSeparator);n=o?l(n,e):n;const s=i||o?n.split(e.arrayFormatSeparator).map((t=>l(t,e))):null===n?n:l(n,e);r[t]=s};case"bracket-separator":return(t,n,r)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(r[t]=n?l(n,e):n);const o=null===n?[]:n.split(e.arrayFormatSeparator).map((t=>l(t,e)));void 0!==r[t]?r[t]=[].concat(r[t],o):r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!==typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){if(""===i)continue;let[e,s]=o(t.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:l(s,t),n(l(e,t),s,r)}for(const i of Object.keys(r)){const e=r[i];if("object"===typeof e&&null!==e)for(const n of Object.keys(e))e[n]=p(e[n],t);else r[i]=p(e,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce(((e,t)=>{const n=r[t];return Boolean(n)&&"object"===typeof n&&!Array.isArray(n)?e[t]=d(n):e[t]=n,e}),Object.create(null))}t.extract=h,t.parse=g,t.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>{return t.skipNull&&(null===(r=e[n])||void 0===r)||t.skipEmptyString&&""===e[n];var r},r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),"[",i,"]"].join("")]:[...n,[u(t,e),"[",u(i,e),"]=",u(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),"[]"].join("")]:[...n,[u(t,e),"[]=",u(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),":list="].join("")]:[...n,[u(t,e),":list=",u(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[u(n,e),t,u(i,e)].join("")]:[[r,u(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,u(t,e)]:[...n,[u(t,e),"=",u(r,e)].join("")]}}(t),i={};for(const s of Object.keys(e))n(s)||(i[s]=e[s]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((n=>{const i=e[n];return void 0===i?"":null===i?u(n,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?u(n,t)+"[]":i.reduce(r(n),[]).join("&"):u(n,t)+"="+u(i,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=o(e,"#");return Object.assign({url:n.split("?")[0]||"",query:g(h(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:l(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0,[a]:!0},n);const r=f(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),s=Object.assign(o,e.query);let c=t.stringify(s,n);c&&(c=`?${c}`);let l=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(l=`#${n[a]?u(e.fragmentIdentifier,n):e.fragmentIdentifier}`),`${r}${c}${l}`},t.pick=(e,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[a]:!1},r);const{url:i,query:o,fragmentIdentifier:c}=t.parseUrl(e,r);return t.stringifyUrl({url:i,query:s(o,n),fragmentIdentifier:c},r)},t.exclude=(e,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return t.pick(e,i,r)}},25459:function(e){"use strict";var t="%[a-f0-9]{2}",n=new RegExp("("+t+")|([^%]+?)","gi"),r=new RegExp("("+t+")+","gi");function i(e,t){try{return[decodeURIComponent(e.join(""))]}catch(o){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n)||[],r=1;r-1?d:0,e.charCodeAt(h+1)){case 100:case 102:if(l>=c)break;if(null==n[l])break;d=c)break;if(null==n[l])break;d=c)break;if(void 0===n[l])break;d",d=h+2,h++;break}u+=i(n[l]),d=h+2,h++;break;case 115:if(l>=c)break;d2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,n){var i,o,s,a;if("string"===typeof t&&(o="not ",t.substr(!s||s<0?0:+s,o.length)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))a="The ".concat(e," ").concat(i," ").concat(r(t,"type"));else{var c=function(e,t,n){return"number"!==typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(c," ").concat(i," ").concat(r(t,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},56753:function(e,t,n){"use strict";var r=n(34155),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var o=n(79481),s=n(64229);n(35717)(l,o);for(var a=i(s.prototype),c=0;c0)if("string"===typeof t||s.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),r)s.endEmitted?S(e,new x):I(e,s,t,!0);else if(s.ended)S(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?I(e,s,t,!1):O(e,s)):I(e,s,t,!1)}else r||(s.reading=!1,O(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=k?e=k:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(P,e))}function P(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function O(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function B(e){u("readable nexttick read 0"),e.read(0)}function L(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function U(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function j(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(F,t,e))}function F(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function V(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):M(this),null;if(0===(e=T(e,t))&&t.ended)return 0===t.length&&j(this),null;var r,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e0?U(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&j(this)),null!==r&&this.emit("data",r),r},_.prototype._read=function(e){S(this,new w("_read()"))},_.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,u("pipe count=%d opts=%j",r.pipesCount,t);var s=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?c:m;function a(t,i){u("onunpipe"),t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,u("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",m),n.removeListener("data",f),d=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function c(){u("onend"),e.end()}r.endEmitted?i.nextTick(s):n.once("end",s),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,D(e))}}(n);e.on("drain",l);var d=!1;function f(t){u("ondata");var i=e.write(t);u("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==V(r.pipes,e))&&!d&&(u("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function h(t){u("onerror",t),m(),e.removeListener("error",h),0===o(e,"error")&&S(e,t)}function p(){e.removeListener("finish",g),m()}function g(){u("onfinish"),e.removeListener("close",p),m()}function m(){u("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,n){if("function"===typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",p),e.once("finish",g),e.emit("pipe",n),r.flowing||(u("pipe resume"),n.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,u("on readable",r.length,r.reading),r.length?M(this):r.reading||i.nextTick(B,this))),n},_.prototype.addListener=_.prototype.on,_.prototype.removeListener=function(e,t){var n=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(N,this),n},_.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(N,this),t},_.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(L,e,t))}(this,e)),e.paused=!1,this},_.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},_.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(u("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(u("wrapped data"),n.decoder&&(i=n.decoder.write(i)),!n.objectMode||null!==i&&void 0!==i)&&((n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause())))})),e)void 0===this[i]&&"function"===typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new g("_write()"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;return"function"===typeof e?(n=e,e=null,t=null):"function"===typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,P(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(_.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(_.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=d.destroy,_.prototype._undestroy=d.undestroy,_.prototype._destroy=function(e,t){t(e)}},45850:function(e,t,n){"use strict";var r,i=n(34155);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=n(8610),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),d=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var n=e[h].read();null!==n&&(e[d]=null,e[a]=null,e[c]=null,t(p(n,!1)))}}function m(e){i.nextTick(g,e)}var b=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((o(r={get stream(){return this[h]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise((function(t,n){i.nextTick((function(){e[u]?n(e[u]):t(p(void 0,!0))}))}));var n,r=this[d];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[l]?n(p(void 0,!0)):t[f](n,r)}),r)}}(r,this));else{var o=this[h].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[f])}return this[d]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var e=this;return new Promise((function(t,n){e[h].destroy(null,(function(e){e?n(e):t(p(void 0,!0))}))}))})),r),b);e.exports=function(e){var t,n=Object.create(y,(o(t={},h,{value:e,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,l,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var r=n[h].read();r?(n[d]=null,n[a]=null,n[c]=null,e(p(r,!1))):(n[a]=e,n[c]=t)},writable:!0}),t));return n[d]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[c];return null!==t&&(n[d]=null,n[a]=null,n[c]=null,t(e)),void(n[u]=e)}var r=n[a];null!==r&&(n[d]=null,n[a]=null,n[c]=null,r(p(void 0,!0))),n[l]=!0})),e.on("readable",m.bind(null,n)),n}},57327:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){for(var n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t,n,r,i=s.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=i,r=a,s.prototype.copy.call(t,n,r),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0===(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:c,value:function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){r||(r=e),e&&s.forEach(u),o||(s.forEach(u),i(r))}))}));return t.reduce(l)}},82457:function(e,t,n){"use strict";var r=n(94281).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,i){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},22503:function(e,t,n){e.exports=n(17187).EventEmitter},88473:function(e,t,n){(t=e.exports=n(79481)).Stream=t,t.Readable=t,t.Writable=n(64229),t.Duplex=n(56753),t.Transform=n(74605),t.PassThrough=n(82725),t.finished=n(8610),t.pipeline=n(59946)},89509:function(e,t,n){var r=n(48764),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,n){if("number"===typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!==typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"===typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},3321:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});var r=n(29745),i=n(23671),o=n(18232),s=n(9695),a=n.n(s),c=n(34714),u=n(72987),l=n(47630),d=n.n(l),f=(n(45697),n(67294)),h=n(86663),p=n(7392),g=n(73935),m=n(41779),b=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i1?s-1:0),c=1;c1?c-1:0),l=1;l1?s-1:0),c=1;c1?a-1:0),u=1;u1?a-1:0),u=1;u=i(t,n)&&e0&&void 0!==arguments[0]?arguments[0]:n;if(!this||this.constructor!==e)return new e(a);if(t&&!t.includes(a))throw new Error("Unsupported hash length");var c=new o.default({capacity:a});return this.update=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";if(i.Buffer.isBuffer(e))return c.absorb(e),s;if("string"===typeof e)return s.update(i.Buffer.from(e,t));throw new TypeError("Not a string or buffer")},this.digest=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"binary",t="string"===typeof e?{format:e}:e,n=c.squeeze({buffer:t.buffer,padding:t.padding||r});return t.format&&"binary"!==t.format?n.toString(t.format):n},this.reset=function(){return c.reset(),s},this}},a=s({allowedSizes:[224,256,384,512],defaultSize:512,padding:1});var c=s({allowedSizes:[224,256,384,512],defaultSize:512,padding:6});t.Aj=c,s({allowedSizes:[128,256],defaultSize:256,padding:31});var u=a;c.SHA3Hash=u},55926:function(e,t,n){"use strict";const r=n(79742),i=n(80645),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||Y(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(X(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n);for(let c=0;c>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function z(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw z(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},29274:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,i=n(55926),o=(r=n(99618))&&r.__esModule?r:{default:r};var s=function(e,t){for(var n=0;n>>8,t[n+2]=e[r+1]>>>16,t[n+3]=e[r+1]>>>24,t[n+4]=e[r],t[n+5]=e[r]>>>8,t[n+6]=e[r]>>>16,t[n+7]=e[r]>>>24}return t},c=function(e){var t=this,n=e.capacity,r=e.padding,c=(0,o.default)(),u=n/8,l=200-n/4,d=0,f=new Uint32Array(50),h=i.Buffer.allocUnsafe(l);return this.absorb=function(e){for(var n=0;n=l&&(s(h,f),c(f),d=0);return t},this.squeeze=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={buffer:e.buffer||i.Buffer.allocUnsafe(u),padding:e.padding||r,queue:i.Buffer.allocUnsafe(h.length),state:new Uint32Array(f.length)};h.copy(t.queue);for(var n=0;n>>l,s[(u+1)%2]=c<>>l,(0,o.default)(s,0)(t,f),(0,o.default)(n,0)(s,0)}};t.default=a},76325:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=[10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1];t.default=n},23010:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=[1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44];t.default=n},57959:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,i=(r=n(76605))&&r.__esModule?r:{default:r};var o=function(e){for(var t=e.A,n=e.C,r=e.D,o=e.W,s=0,a=0,c=0;c<5;c++){var u=2*c,l=2*(c+5),d=2*(c+10),f=2*(c+15),h=2*(c+20);n[u]=t[u]^t[l]^t[d]^t[f]^t[h],n[u+1]=t[u+1]^t[l+1]^t[d+1]^t[f+1]^t[h+1]}for(var p=0;p<5;p++){(0,i.default)(n,(p+1)%5)(o,0),s=o[0],a=o[1],o[0]=s<<1|a>>>31,o[1]=a<<1|s>>>31,r[2*p]=n[(p+4)%5*2]^o[0],r[2*p+1]=n[(p+4)%5*2+1]^o[1];for(var g=0;g<25;g+=5)t[2*(g+p)]^=r[2*p],t[2*(g+p)+1]^=r[2*p+1]}};t.default=o},96774:function(e){e.exports=function(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!==typeof e||!e||"object"!==typeof t||!t)return!1;var o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c{if("string"!==typeof e||"string"!==typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},58971:function(e,t,n){var r=n(62195),i=n(39015),o=[n(19257)];e.exports=r.createStore(i,o)},19257:function(e,t,n){e.exports=function(){return n(55703),{}}},55703:function(){"object"!==typeof JSON&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,(function(e){var t=meta[e];return"string"===typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function str(e,t){var n,r,i,o,s,a=gap,c=t[e];switch(c&&"object"===typeof c&&"function"===typeof c.toJSON&&(c=c.toJSON(e)),"function"===typeof rep&&(c=rep.call(t,e,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(o=c.length,n=0;n=0;n--)if(o(t[n])){var r=t[n].split("="),i=unescape(r[0]);e(unescape(r[1]),i)}}function c(e){e&&u(e)&&(s.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function u(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(s.cookie)}},39627:function(e,t,n){var r=n(69078).Global;function i(){return r.localStorage}function o(e){return i().getItem(e)}e.exports={name:"localStorage",read:o,write:function(e,t){return i().setItem(e,t)},each:function(e){for(var t=i().length-1;t>=0;t--){var n=i().key(t);e(o(n),n)}},remove:function(e){return i().removeItem(e)},clearAll:function(){return i().clear()}}},8728:function(e){e.exports={name:"memoryStorage",read:function(e){return t[e]},write:function(e,n){t[e]=n},each:function(e){for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)},remove:function(e){delete t[e]},clearAll:function(e){t={}}};var t={}},95347:function(e,t,n){var r=n(69078).Global;e.exports={name:"oldFF-globalStorage",read:function(e){return i[e]},write:function(e,t){i[e]=t},each:o,remove:function(e){return i.removeItem(e)},clearAll:function(){o((function(e,t){delete i[e]}))}};var i=r.globalStorage;function o(e){for(var t=i.length-1;t>=0;t--){var n=i.key(t);e(i[n],n)}}},34524:function(e,t,n){var r=n(69078).Global;e.exports={name:"oldIE-userDataStorage",write:function(e,t){if(a)return;var n=u(e);s((function(e){e.setAttribute(n,t),e.save(i)}))},read:function(e){if(a)return;var t=u(e),n=null;return s((function(e){n=e.getAttribute(t)})),n},each:function(e){s((function(t){for(var n=t.XMLDocument.documentElement.attributes,r=n.length-1;r>=0;r--){var i=n[r];e(t.getAttribute(i.name),i.name)}}))},remove:function(e){var t=u(e);s((function(e){e.removeAttribute(t),e.save(i)}))},clearAll:function(){s((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(i);for(var n=t.length-1;n>=0;n--)e.removeAttribute(t[n].name);e.save(i)}))}};var i="storejs",o=r.document,s=function(){if(!o||!o.documentElement||!o.documentElement.addBehavior)return null;var e,t,n;try{(t=new ActiveXObject("htmlfile")).open(),t.write('
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/docs/CrustFiles_FAQ/index.html b/docs/docs/CrustFiles_FAQ/index.html index 2d381bb5..7334f847 100644 --- a/docs/docs/CrustFiles_FAQ/index.html +++ b/docs/docs/CrustFiles_FAQ/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/docs/CrustFiles_ShareandEarn/index.html b/docs/docs/CrustFiles_ShareandEarn/index.html index a66c51a8..d5e1a2f6 100644 --- a/docs/docs/CrustFiles_ShareandEarn/index.html +++ b/docs/docs/CrustFiles_ShareandEarn/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/docs/CrustFiles_Users/index.html b/docs/docs/CrustFiles_Users/index.html index a362903b..112b246a 100644 --- a/docs/docs/CrustFiles_Users/index.html +++ b/docs/docs/CrustFiles_Users/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/docs/CrustFiles_Welcome/index.html b/docs/docs/CrustFiles_Welcome/index.html index c6d5da28..bf2b98f2 100644 --- a/docs/docs/CrustFiles_Welcome/index.html +++ b/docs/docs/CrustFiles_Welcome/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/files/index.html b/docs/files/index.html index 55732f62..c065afb9 100644 --- a/docs/files/index.html +++ b/docs/files/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/files/vault/index.html b/docs/files/vault/index.html index c2a891bc..aae7e763 100644 --- a/docs/files/vault/index.html +++ b/docs/files/vault/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/home/index.html b/docs/home/index.html index 8b7f787e..2144bdc7 100644 --- a/docs/home/index.html +++ b/docs/home/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/images/chain/u2u.png b/docs/images/chain/u2u.png new file mode 100644 index 0000000000000000000000000000000000000000..843a859fbfcd1dd76474944a1c1b6ef6bfecce44 GIT binary patch literal 5225 zcmZ{oWl+?C)`$P>5=(7!!?P{R;qqK~EE|WE?R21rwY$hs^F**jTXiAGsLh=jX9g9>7E>a;NP<^dC|Y z)%=Nw6jzRLebOefeJ-qB{mxI-#N51Q)_mw~+lLPys>OM6k(6&0iLJpz$~|kU%2I>; zD#g;7fxaidPud)>ab3TD7XQrG;Z{N*MIOzc_=lf_{C==eJeAEl!R*zT|#fKqx4W~hFWXHOorWRU2Ad4sm zECYx}oRNPN>d{rGrw#xGKmteyig(aMn)(rjgYxV+>Hq~;%i4)%{I!>p+@8-889t>2 z47`3Q2FO#-fhLVP&3ihBFi#HY_N13Ec!vf4=H{1w-^qX#8TMrGUBG8lRu!*QjuJ98 zLKZ!3ZF8;Api;<-=sw-JDMCosr?}6BqjVxI2FEPI7=*Zq(2R_uo%E+PFh^|corLrO zo+@0`&2iJ@d&ag~(oRF?N@o!0fXX6lTp`I$#hBQU1ViDuiYgd&#n0oTD%emU68uzz zUh>F$WtI!(VRt_Ha8d_nxmsJ<@r8s*lUK-FW>&BQR2KD1nM6ORlEp&Q+r_9*XPNz9 zd>Wt_7U{7Mo!}7CID`ODL8L%Z3r+PJj2V5LYVnBcq*kE*(#`2Dn8Vu+m|0BZyicl5 z#>377GR#)SxTfDq?ww#SeZ%=`DTpk+q8VRzk2}>vHHd7iD(gf>L=t>m?J4S+ra6md zAS#7QI6!|q6k5qoe%Z779@l zzaikAUu^a`d+tBMeI}^M5{O;Xbc2^IOM2$6L9+@;)d*{mrc(+}28+80HeeSK&@1fI zpEuVV*NWUIEqO|^@g@3I)IgL(Pv~}f?lCV|rP5R*UdGpkNJcFPxZ|gadHI6%2ym8 zB?~!~s{5?)OugPg%w1b1PRXdb7sYD4x=&poj1^d^p=cdw>)#;o|J~GD@t085-zgAU zewK=F;3#_p5x~4UOd# zXpH@K0gDs=wS9}zsv`Lk`Io-7CE5~U0MyP9 z{!Zg(uAR!&0Z;%r;VQ>`Db+eSuJ6(^9)3Uu6o_gT|=5>vmL8 zZv8sg9MVXYt0fNp{-U@n)jW{XP-)bYVLl8Uw?zlBxMfmcSbqSw8C81{ZG8%*V#Ey7 zQf`3W=ifyl8L8I$ti7)Ck;Mxdd#^8GC-MoJ740}C|4~7s)}D_}Ya0H;Wj`~gjKa6= z;pSw6kJ_T}rZF2Ogrx)Y+S4rvX(KWCiQss4qyo2|o6><~(1hVp#)G^?4<#Dfq;&Ci zit9WI&eeb$p0xEDo3cdM-m|IzA zN1zP;^bS|x^}?-jL+!6}Ii+f&Zl;0@0O3K-aNeiX1t0eCh82-<=q~&#>*NE4y2K9U zY!=2_s5J8W#ZZ>B5e2$BGx(87wPZZ=(~J`RrC0dYOroU;@~5AMlh$~#$PN1Wpa%}~ zuEdtXr31vD(5%Lc%t3nZwhDY;j(V!RbrWprs-$I}>(w`^GZJl>5cvdMN;#a*%sM^bp$}lQ6W~mSE?V2)3G81>{R^!P;K^kOw&2YiMV(ydmdQ zqw>3xp4@i$(aD)Dp+IUC&hgS(BdFWBpzG4Tpv#j%$%vZJ+PlggsQKo73vXG{UiiG+ z*`>tLW6!?V#?mvVnjmxw>J@2f+7(jdP~7Dyl2Y*mqlcm!7veONL!;($YT7hhJmZ@rEgm%DmE7+fievhJ zK%efSZLxi^t7C7BBP8{2hJ^Fsd?}dO@4Vf-yRJpFDT;wB#x!ckAM}mp$R^qIElTyJ ze8$~8&9TXI#IVC==vX;=lJ72t0)l~_;mhA`GG2wVkTyC!lP)ui6CK>|V5BNq3ec8x zIT&+%K{_=X%^@4J%O#R%!w@tNUcVV(PC|_QO8bi)6{_xKq^H8}VvsD=*Vm*8zdt|Dv`vy-k7D*OeM2>Nc9@s~zsxyu@9^?g)92U^^ocjvi78^d z_k}u#2-xY4g597rO>~=$IHD>2%*2;}r;@df_oA669%}eZ*H@FQyIa2O5ILDbzUmJI zYZK`&4K~KV?f$jZ*ZD4cb53tF9E*KSR^IIC|`6R2{K#pIv}p1Q^lpU;?O?z z+s#%d994Ee3BPlhaP<8I4^`2?L~iTotKA7F-5Ae5jPjq%dkiHTy(Nvw1X9o4Y2J(| zmf4T!6nKT`GgTPb7Ec*d7%4HT5*KDzhLTL*S#NOkBqVdb!Fz~2CvdTR4O<7P)E@`h zZG?GGS!&J6L*ubF*uK)d0s6wb=q)63)*4vJ96tYrIrHfqXzqxv#fuwv8PJt)ikHut z`lwh7?q!FVn@jeHo&(m=7zNDcEaPZv=A@AX&riwxDs%jVDv+_NvbXElCH$R)osMIt zf8hio`<&wJ*<%58in85Wu)oS5*JXm8W1|LdAUt8agmkXiiVS?X`MMw zhkB;XLj}VYBBL>=_=ULl`|-rZkBgsI+hmXysG<~WA5FYmmmU# z(jp)>;y>OV#`ngyAAep@mTOM(!pW6#MsFd-=w;9s2`jvug1~R&QrBJ)pK6scbb)4W zP$QWg6g4x3#*C{4%v0Pc;(hP;$c4nwZf)mX-}Wy8m`b66HHfUir`)Q*<#HdsQcjvv z--Ma-k&_g-f$~`jselM_v#^vOXHPjz*OPn?zU|yD{M+!x#`SR6F9cRJH}mXgo#yqC z692BKvH&g?AIthx%7`2lr6}4t69`Y5w3cz_vzS%-JEWavdsSvRx8sB6wYPWGe0Ils z?VfLXsEZsMB>(u0e$hc}Dq{~JR267!nuS!{;b}lgYHU`{F6e&zfEa&7)^1JZmfw4S zpM-hv$Kb-5d!zrH&fc6_)$cPQ{v^?_u)p-DEn}7`Q(SuwJ9WMpU-q%sSf>?yoV-RWzYA&(aU;sN~2#@b~n1>cOO9BpbW&?%<-{%F=2)P z)oK*_*^v6P$g9};x?j8>c9eUnCD6+p$3JxAOp_!#CE!|G+kL3J(RC*o!QPZ(zxeWw zAJ1)vt`*M{sSUhuSsr)ZDp}CkJ>SjizTH>QNEmHgkGro{l+m&3(8$#V^;r^rZ+R-~ zcStk9k5%YtU!lZG=<~dOV30ccI3#gc;I)F26}jIF+vXkq_O+0MDT|bEQ?`~1R3ATD zB}O>U5E$DVJimu|cP*+-P9z>v^YvN9sJPtQ;SXIBMiAS!V~mD;y~@ov3)luix5N+p z+qsU9^-n%^eRA7`OXX{|UxN2el2jO8#FOu_c;14sCzTSuN8xYm{Oaq(r3Wm7u&$49 z_}}jJ+x@h&yZ?A5uK|mxM1TH-ivq{}Q5&QBkruEcZI6Bri-z%bo`#Ti9kF^(nIX2& zx|5;%?9&7j$?W`aj#HxrIHnNH$z&?Fc@rLD0Po<>1IKFAg)*5~YX436u~uhJF7{>m z*VXjLj!HqOC2yQ5#kXg~WoZr)_eIct`GyAmk-hZMfxdont*P^UOY>YxvrjdzFJ&gf z{>bGOgVV&10G7g=&tAyx7rFNf+U&uf+H>7?AqZ-U-y)?)!+MEYw;yM8tv;S>f3SDH zZTELWb3C>7lly$i7xe|M`g_jVP@#%a3IfmIBTx;2POMNpU>>#X&c&w|lVEDwJwS`s+|HpDv)R{r8 z3>R}jk;z5G<`=MzP$w2%gg(|re(?$Ao10$Re7}aJ<7JuX#pQAX_LVEEy4}BPu1Cab zTpb&%Ifai+BTEq>O-Ek&3iJTQf;xMr`QL&B_Dvf%dBNgwt*}p@qD?H7!UjVsJ>Weo z4}4jgy2yO?gdIw0y&sfxywzG}WB01K%bJbMsBS5l)W&FBxr-hDbkv0Y6hZ_` zjItQ5GxJktr-Hfga&nm;v<}rIbV9(VpA)!QB7}S3H1A_7Lz&$7K?jr@tAyfYL`gz* zjk?h-E~(WJ5uTDyG&D9RzxsFPbgO(skF&*y&CTV@-j{FA#c8~TU;DELTd$OX^%J&q z2elnj<(@Jo+a?(;3Roa@CrxRo|Kt_8n91JK_;EO}1RT*?pP%#Os=^I0Rg*Ld1%AtQ z!w)^Na%XA)3pHGNk7Q|t6=}hK5iKadtNImL3uEc#u4EMSYPwB1M;StL|3EDdCFAc( z6%ud;>8!(%TKecAISWj~Gv}^Y|L7$t_3{h#4x~Sch}rks^jlgCWRU4wnlvkHhjOV8 zKWcb#6wuZQEg3$wJ~%5I9Rx}>T*^it8btZO^uWvTf8lGD#h{Qk9wxLfR`LCf5U$(> zpNRZ0aa^2qFYyNY_=GyiKMNm5JV`Puu0;TYpwOyWKHj!{uYr4|7^9HD^DGeTy!?k| z-WI>EjPf;YA%&=n`b^{YzdxIRud1o9owcvMtgW~GKLAoNsXJnlQerS^W0?a%*n08Lc{ JyjIyN@;^Y2o{Ing literal 0 HcmV?d00001 diff --git a/docs/index.html b/docs/index.html index fbf7a9de..12962f86 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/invite_bonus_guide/index.html b/docs/invite_bonus_guide/index.html index 5026367c..bbad60a9 100644 --- a/docs/invite_bonus_guide/index.html +++ b/docs/invite_bonus_guide/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/mobile/index.html b/docs/mobile/index.html index 0abeda7a..c7b9bd7a 100644 --- a/docs/mobile/index.html +++ b/docs/mobile/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/rewards_history/index.html b/docs/rewards_history/index.html index db8eb05c..6c66d29f 100644 --- a/docs/rewards_history/index.html +++ b/docs/rewards_history/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/setting/index.html b/docs/setting/index.html index 93ab7dc5..aeb32083 100644 --- a/docs/setting/index.html +++ b/docs/setting/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/share-earn/index.html b/docs/share-earn/index.html index 04292479..502c85f2 100644 --- a/docs/share-earn/index.html +++ b/docs/share-earn/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/share/index.html b/docs/share/index.html index 98cb24cd..f9b02367 100644 --- a/docs/share/index.html +++ b/docs/share/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/user/index.html b/docs/user/index.html index 0012a992..aa9d4a3d 100644 --- a/docs/user/index.html +++ b/docs/user/index.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file