@dodoex/wallet-web3 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/dist/PhArrowCircleDown-4a08ae8e.js +14 -0
  2. package/dist/PhArrowClockwise-401ea1c0.js +14 -0
  3. package/dist/PhArrowDown-789ae7d2.js +14 -0
  4. package/dist/PhArrowLeft-2e6d4940.js +14 -0
  5. package/dist/PhArrowRight-2928b0dc.js +14 -0
  6. package/dist/PhArrowSquareOut-17d61d08.js +14 -0
  7. package/dist/PhArrowUp-1cfcf9df.js +14 -0
  8. package/dist/PhArrowUpRight-552c41cb.js +14 -0
  9. package/dist/PhArrowsClockwise-92a70162.js +14 -0
  10. package/dist/PhArrowsDownUp-ce27c8a7.js +14 -0
  11. package/dist/PhArrowsLeftRight-ed549dc7.js +14 -0
  12. package/dist/PhBank-92a1a1df.js +14 -0
  13. package/dist/PhBrowser-495dc3ce.js +14 -0
  14. package/dist/PhCaretDown-610f20fc.js +14 -0
  15. package/dist/PhCaretLeft-2a86ee53.js +14 -0
  16. package/dist/PhCaretRight-f3057f58.js +14 -0
  17. package/dist/PhCaretUp-7b74b8cb.js +14 -0
  18. package/dist/PhCheck-c514f32c.js +14 -0
  19. package/dist/PhCircleHalf-3bfd24c9.js +14 -0
  20. package/dist/PhClock-29284ead.js +14 -0
  21. package/dist/PhCompass-101d3241.js +14 -0
  22. package/dist/PhCopy-d92dcd27.js +14 -0
  23. package/dist/PhCreditCard-d8d77fc2.js +14 -0
  24. package/dist/PhCurrencyDollar-6553df79.js +14 -0
  25. package/dist/PhDesktop-91653c8e.js +14 -0
  26. package/dist/PhDeviceMobile-0f3d8fa2.js +14 -0
  27. package/dist/PhDotsThree-67debca2.js +14 -0
  28. package/dist/PhEnvelope-f83faab2.js +14 -0
  29. package/dist/PhFunnelSimple-5058af43.js +14 -0
  30. package/dist/PhGlobe-c4653621.js +14 -0
  31. package/dist/PhIdentificationCard-848bf9a1.js +14 -0
  32. package/dist/PhImage-de71fc6b.js +14 -0
  33. package/dist/PhInfo-9614a766.js +14 -0
  34. package/dist/PhLightbulb-7d582ae7.js +14 -0
  35. package/dist/PhMagnifyingGlass-c926bd63.js +14 -0
  36. package/dist/PhPaperPlaneRight-76b25832.js +14 -0
  37. package/dist/PhPlus-767ddc55.js +14 -0
  38. package/dist/PhPower-95f188dd.js +14 -0
  39. package/dist/PhPuzzlePiece-f016afe5.js +14 -0
  40. package/dist/PhQrCode-e9b7ab93.js +14 -0
  41. package/dist/PhQuestion-ea0e639d.js +14 -0
  42. package/dist/PhQuestionMark-13d6338e.js +14 -0
  43. package/dist/PhSealCheck-45bb7b9c.js +14 -0
  44. package/dist/PhSignOut-6b91c59c.js +14 -0
  45. package/dist/PhSpinner-eb9b7ac1.js +14 -0
  46. package/dist/PhTrash-758cc3b3.js +14 -0
  47. package/dist/PhUser-0834861d.js +14 -0
  48. package/dist/PhVault-e4d6f9af.js +14 -0
  49. package/dist/PhWallet-5e257abe.js +14 -0
  50. package/dist/PhWarning-6af3740e.js +14 -0
  51. package/dist/PhWarningCircle-a78fd8e8.js +14 -0
  52. package/dist/PhX-60c46532.js +14 -0
  53. package/dist/{__tslib-83c7dd77.js → __tslib-6d6a586c.js} +1 -1
  54. package/dist/{alchemy-provider-5870b6fa-ef26112b.js → alchemy-provider-5870b6fa-a9fe5aa5.js} +1 -1
  55. package/dist/{alchemy-websocket-provider-213da986-2d698146.js → alchemy-websocket-provider-213da986-16164c2e.js} +1 -1
  56. package/dist/basic-77fe1b96.js +1320 -0
  57. package/dist/{blocto-05d7faf5.js → blocto-ab8ba330.js} +1 -1
  58. package/dist/{ccip-ea7099a8.js → ccip-e246f9cf.js} +1 -1
  59. package/dist/cjs/PhArrowCircleDown-df23d036.cjs +14 -0
  60. package/dist/cjs/PhArrowClockwise-440d23dc.cjs +14 -0
  61. package/dist/cjs/PhArrowDown-252590ed.cjs +14 -0
  62. package/dist/cjs/PhArrowLeft-d480faa4.cjs +14 -0
  63. package/dist/cjs/PhArrowRight-969dbdd8.cjs +14 -0
  64. package/dist/cjs/PhArrowSquareOut-eabfdecb.cjs +14 -0
  65. package/dist/cjs/PhArrowUp-66bd5f15.cjs +14 -0
  66. package/dist/cjs/PhArrowUpRight-6df3b31b.cjs +14 -0
  67. package/dist/cjs/PhArrowsClockwise-3a9d2dc6.cjs +14 -0
  68. package/dist/cjs/PhArrowsDownUp-47a7788f.cjs +14 -0
  69. package/dist/cjs/PhArrowsLeftRight-f90368dd.cjs +14 -0
  70. package/dist/cjs/PhBank-670a2708.cjs +14 -0
  71. package/dist/cjs/PhBrowser-b9c35fd1.cjs +14 -0
  72. package/dist/cjs/PhCaretDown-11a46455.cjs +14 -0
  73. package/dist/cjs/PhCaretLeft-04f11ca7.cjs +14 -0
  74. package/dist/cjs/PhCaretRight-391111c1.cjs +14 -0
  75. package/dist/cjs/PhCaretUp-b17dccf6.cjs +14 -0
  76. package/dist/cjs/PhCheck-08bf36b0.cjs +14 -0
  77. package/dist/cjs/PhCircleHalf-0a9eac35.cjs +14 -0
  78. package/dist/cjs/PhClock-cf1cc2cb.cjs +14 -0
  79. package/dist/cjs/PhCompass-e9671b30.cjs +14 -0
  80. package/dist/cjs/PhCopy-9132cbc5.cjs +14 -0
  81. package/dist/cjs/PhCreditCard-853e1556.cjs +14 -0
  82. package/dist/cjs/PhCurrencyDollar-34eea829.cjs +14 -0
  83. package/dist/cjs/PhDesktop-c02b883b.cjs +14 -0
  84. package/dist/cjs/PhDeviceMobile-93c2088c.cjs +14 -0
  85. package/dist/cjs/PhDotsThree-69beaba7.cjs +14 -0
  86. package/dist/cjs/PhEnvelope-86ee730e.cjs +14 -0
  87. package/dist/cjs/PhFunnelSimple-056c2f76.cjs +14 -0
  88. package/dist/cjs/PhGlobe-64c4ee8e.cjs +14 -0
  89. package/dist/cjs/PhIdentificationCard-ec7a98e0.cjs +14 -0
  90. package/dist/cjs/PhImage-07904cbb.cjs +14 -0
  91. package/dist/cjs/PhInfo-34eeeace.cjs +14 -0
  92. package/dist/cjs/PhLightbulb-39ebe854.cjs +14 -0
  93. package/dist/cjs/PhMagnifyingGlass-2fbe4400.cjs +14 -0
  94. package/dist/cjs/PhPaperPlaneRight-e06c210f.cjs +14 -0
  95. package/dist/cjs/PhPlus-03a04ed3.cjs +14 -0
  96. package/dist/cjs/PhPower-4cc2ecb8.cjs +14 -0
  97. package/dist/cjs/PhPuzzlePiece-035d561e.cjs +14 -0
  98. package/dist/cjs/PhQrCode-37e23b36.cjs +14 -0
  99. package/dist/cjs/PhQuestion-bfba435e.cjs +14 -0
  100. package/dist/cjs/PhQuestionMark-8ef38ecf.cjs +14 -0
  101. package/dist/cjs/PhSealCheck-5458de15.cjs +14 -0
  102. package/dist/cjs/PhSignOut-2d177ea1.cjs +14 -0
  103. package/dist/cjs/PhSpinner-e7c590df.cjs +14 -0
  104. package/dist/cjs/PhTrash-1920f5dc.cjs +14 -0
  105. package/dist/cjs/PhUser-84a1a685.cjs +14 -0
  106. package/dist/cjs/PhVault-1493c03f.cjs +14 -0
  107. package/dist/cjs/PhWallet-f0502f03.cjs +14 -0
  108. package/dist/cjs/PhWarning-1bf637ba.cjs +14 -0
  109. package/dist/cjs/PhWarningCircle-b1747661.cjs +14 -0
  110. package/dist/cjs/PhX-f864d86c.cjs +14 -0
  111. package/dist/cjs/{__tslib-12e41834.cjs → __tslib-a9f27ba6.cjs} +1 -1
  112. package/dist/cjs/{alchemy-provider-5870b6fa-683a7f2e.cjs → alchemy-provider-5870b6fa-bb1c607e.cjs} +1 -1
  113. package/dist/cjs/{alchemy-websocket-provider-213da986-5c9807c6.cjs → alchemy-websocket-provider-213da986-521569b5.cjs} +1 -1
  114. package/dist/cjs/basic-b777d2b1.cjs +1320 -0
  115. package/dist/cjs/{blocto-4db38a28.cjs → blocto-09e0d574.cjs} +1 -1
  116. package/dist/cjs/{ccip-82e883e4.cjs → ccip-6ebee1cf.cjs} +1 -1
  117. package/dist/cjs/core-78a709db.cjs +210 -0
  118. package/dist/cjs/{draggabilly-308ac2a9.cjs → draggabilly-76af6217.cjs} +1 -1
  119. package/dist/cjs/features-fa5c5622.cjs +1 -0
  120. package/dist/cjs/id-c0538166.cjs +1 -0
  121. package/dist/cjs/{index-2c097978.cjs → index-07e81389.cjs} +1 -1
  122. package/dist/cjs/{index-eae76bd0.cjs → index-093cef5a.cjs} +2 -2
  123. package/dist/cjs/{index-362be9fb.cjs → index-208df3f3.cjs} +1 -1
  124. package/dist/cjs/{index-c8fa7932.cjs → index-253e7cce.cjs} +1 -1
  125. package/dist/cjs/index-2e8e7a50.cjs +4 -0
  126. package/dist/cjs/index-395b933d.cjs +2 -0
  127. package/dist/cjs/{index-281d00df.cjs → index-54d7fc75.cjs} +1 -1
  128. package/dist/cjs/{index-3714da35.cjs → index-5d28acf4.cjs} +2 -2
  129. package/dist/cjs/{index-85a2526e.cjs → index-5dac528b.cjs} +7 -7
  130. package/dist/cjs/index-702e8f89.cjs +15 -0
  131. package/dist/cjs/{index-ceda42fb.cjs → index-823e17e6.cjs} +1 -1
  132. package/dist/cjs/{index-9325806f.cjs → index-916994aa.cjs} +1 -1
  133. package/dist/cjs/{index-00b0ab99.cjs → index-a2b665f4.cjs} +1 -1
  134. package/dist/cjs/{index-c6b53b3f.cjs → index-b099293c.cjs} +1 -1
  135. package/dist/cjs/index-d72ddbc1.cjs +17 -0
  136. package/dist/cjs/index-ef4ef0cc.cjs +1449 -0
  137. package/dist/cjs/index.cjs +1 -1
  138. package/dist/cjs/{interface-10b0ba33.cjs → interface-4947cfa6.cjs} +1 -1
  139. package/dist/cjs/{lib-typedarrays-012f607a.cjs → lib-typedarrays-a9baf142.cjs} +1 -1
  140. package/dist/cjs/native-55bb141d.cjs +1 -0
  141. package/dist/cjs/{portis-2144bb98.cjs → portis-08d9d731.cjs} +1 -1
  142. package/dist/cjs/property-29e6f732.cjs +29 -0
  143. package/dist/cjs/providers/connector/safeGnosis/query.d.ts +2 -1
  144. package/dist/cjs/providers/connector/types.d.ts +1 -1
  145. package/dist/cjs/providers/wallets/index.d.ts +1 -0
  146. package/dist/cjs/rainbow-6e84bcfa.cjs +1 -0
  147. package/dist/cjs/sha224-b46bc3e6.cjs +1 -0
  148. package/dist/cjs/sha256-ccd47519.cjs +1 -0
  149. package/dist/cjs/{typed-data-e878587d.cjs → typed-data-5176b792.cjs} +1 -1
  150. package/dist/cjs/uAuth-b29d2670.cjs +1 -0
  151. package/dist/cjs/w3m-modal-70bcf6d8.cjs +2380 -0
  152. package/dist/cjs/walletConnect-20d477a9.cjs +1 -0
  153. package/dist/cjs/{walletLink-8e49b6d5.cjs → walletLink-08b8da20.cjs} +2 -2
  154. package/dist/core-4d7ad6f2.js +210 -0
  155. package/dist/{draggabilly-c6f65920.js → draggabilly-daf3b444.js} +1 -1
  156. package/dist/features-d8d1c9ce.js +1 -0
  157. package/dist/id-d4d22b29.js +1 -0
  158. package/dist/{index-227927b5.js → index-09298bd0.js} +7 -7
  159. package/dist/{index-f360d801.js → index-244a8189.js} +1 -1
  160. package/dist/{index-f4727f94.js → index-2ad0fb2a.js} +1 -1
  161. package/dist/index-35d87b79.js +17 -0
  162. package/dist/{index-eb473b84.js → index-587ff998.js} +1 -1
  163. package/dist/{index-a6b10e09.js → index-750a7dfe.js} +1 -1
  164. package/dist/{index-abb4eaf1.js → index-8bd12de1.js} +1 -1
  165. package/dist/{index-1e0435b6.js → index-938686fb.js} +1 -1
  166. package/dist/{index-1db47472.js → index-9d7fee1e.js} +2 -2
  167. package/dist/{index-af823ebd.js → index-aa744ca0.js} +1 -1
  168. package/dist/{index-cfa6ef57.js → index-b7d25e8a.js} +2 -2
  169. package/dist/index-bb1a0019.js +15 -0
  170. package/dist/index-c5ca8a4e.js +4 -0
  171. package/dist/{index-1cf97dd7.js → index-cddbc8e8.js} +1 -1
  172. package/dist/index-f095c09e.js +2 -0
  173. package/dist/index-ffdf981b.js +1449 -0
  174. package/dist/index.js +1 -1
  175. package/dist/{interface-ec064b7d.js → interface-0c535796.js} +1 -1
  176. package/dist/{lib-typedarrays-ecebfb2c.js → lib-typedarrays-979d2723.js} +1 -1
  177. package/dist/native-029c50f7.js +1 -0
  178. package/dist/{portis-e3d3d420.js → portis-9602ac9f.js} +1 -1
  179. package/dist/property-8eb37909.js +35 -0
  180. package/dist/providers/connector/safeGnosis/query.d.ts +2 -1
  181. package/dist/providers/connector/types.d.ts +1 -1
  182. package/dist/providers/wallets/index.d.ts +1 -0
  183. package/dist/rainbow-ccab7a95.js +1 -0
  184. package/dist/sha224-fe98e1bf.js +1 -0
  185. package/dist/sha256-5a24dfd5.js +1 -0
  186. package/dist/{typed-data-0f706378.js → typed-data-3a3d44dc.js} +1 -1
  187. package/dist/uAuth-27f5728d.js +1 -0
  188. package/dist/w3m-modal-49add722.js +2380 -0
  189. package/dist/walletConnect-a541881e.js +1 -0
  190. package/dist/{walletLink-68441960.js → walletLink-67264328.js} +2 -2
  191. package/package.json +3 -3
  192. package/dist/_commonjs-dynamic-modules-7cfc9805.js +0 -1
  193. package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +0 -1
  194. package/dist/cjs/id-ea22b6ce.cjs +0 -1
  195. package/dist/cjs/index-35edc6a0.cjs +0 -60
  196. package/dist/cjs/index-8a25465c.cjs +0 -6
  197. package/dist/cjs/index-9f2a69d5.cjs +0 -1
  198. package/dist/cjs/index-fdda1836.cjs +0 -17
  199. package/dist/cjs/index.es-80622213.cjs +0 -9
  200. package/dist/cjs/rainbow-18d05876.cjs +0 -1
  201. package/dist/cjs/sha224-1c092a15.cjs +0 -1
  202. package/dist/cjs/sha256-9e1680c1.cjs +0 -1
  203. package/dist/cjs/uAuth-b89f7081.cjs +0 -1
  204. package/dist/cjs/walletConnect-b79e1e97.cjs +0 -1
  205. package/dist/id-397f0303.js +0 -1
  206. package/dist/index-02e42cd2.js +0 -17
  207. package/dist/index-65d96278.js +0 -60
  208. package/dist/index-89717995.js +0 -6
  209. package/dist/index-f08d6a6b.js +0 -1
  210. package/dist/index.es-7adbb6c0.js +0 -9
  211. package/dist/rainbow-73b82cd7.js +0 -1
  212. package/dist/sha224-51e5e6a9.js +0 -1
  213. package/dist/sha256-549e482b.js +0 -1
  214. package/dist/uAuth-ce19d386.js +0 -1
  215. package/dist/walletConnect-b0b635de.js +0 -1
@@ -0,0 +1,2380 @@
1
+ "use strict";var e=require("./core-78a709db.cjs"),t=require("./index-ef4ef0cc.cjs");require("events"),require("./index-2e8e7a50.cjs"),require("./__tslib-a9f27ba6.cjs"),require("./index-5dac528b.cjs"),require("@ethersproject/providers"),require("zustand"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/address"),require("@ethersproject/abstract-signer"),require("buffer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("@ethersproject/constants"),require("@ethersproject/transactions");const o={getGasPriceInEther:(e,t)=>Number(t*e)/1e18,getGasPriceInUSD(t,r,i){const n=o.getGasPriceInEther(r,i);return e.NumberUtil.bigNumber(t).times(n).toNumber()},getPriceImpact({sourceTokenAmount:t,sourceTokenPriceInUSD:o,toTokenPriceInUSD:r,toTokenAmount:i}){const n=e.NumberUtil.bigNumber(t).times(o),a=e.NumberUtil.bigNumber(i).times(r);return n.minus(a).div(n).times(100).toNumber()},getMaxSlippage(t,o){const r=e.NumberUtil.bigNumber(t).div(100);return e.NumberUtil.multiply(o,r).toNumber()},getProviderFee:(t,o=.0085)=>e.NumberUtil.bigNumber(t).times(o).toString(),isInsufficientNetworkTokenForGas(t,o){const r=o||"0";return!!e.NumberUtil.bigNumber(t).eq(0)||e.NumberUtil.bigNumber(e.NumberUtil.bigNumber(r)).gt(t)},isInsufficientSourceTokenForSwap(t,o,r){const i=r?.find((e=>e.address===o))?.quantity?.numeric;return e.NumberUtil.bigNumber(i||"0").lt(t)}},r=15e4,i={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:e.ConstantsUtil$1.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},n=e.proxy({...i}),a={state:n,subscribe:t=>e.subscribe(n,(()=>t(n))),subscribeKey:(t,o)=>e.subscribeKey(n,t,o),getParams(){const t=e.ChainController.state.activeChain,o=e.ChainController.getAccountData(t)?.caipAddress??e.ChainController.state.activeCaipAddress,r=e.CoreHelperUtil.getPlainAddress(o),i=e.getActiveNetworkTokenAddress(),a=e.ConnectorController.getConnectorId(e.ChainController.state.activeChain);if(!r)throw new Error("No address found to swap the tokens from.");const s=!n.toToken?.address||!n.toToken?.decimals,c=!n.sourceToken?.address||!n.sourceToken?.decimals||!e.NumberUtil.bigNumber(n.sourceTokenAmount).gt(0),l=!n.sourceTokenAmount;return{networkAddress:i,fromAddress:r,fromCaipAddress:o,sourceTokenAddress:n.sourceToken?.address,toTokenAddress:n.toToken?.address,toTokenAmount:n.toTokenAmount,toTokenDecimals:n.toToken?.decimals,sourceTokenAmount:n.sourceTokenAmount,sourceTokenDecimals:n.sourceToken?.decimals,invalidToToken:s,invalidSourceToken:c,invalidSourceTokenAmount:l,availableToSwap:o&&!s&&!c&&!l,isAuthConnector:a===e.ConstantsUtil.CONNECTOR_ID.AUTH}},async setSourceToken(e){if(!e)return n.sourceToken=e,n.sourceTokenAmount="",void(n.sourceTokenPriceInUSD=0);n.sourceToken=e,await s.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){n.sourceTokenAmount=e},async setToToken(e){if(!e)return n.toToken=e,n.toTokenAmount="",void(n.toTokenPriceInUSD=0);n.toToken=e,await s.setTokenPrice(e.address,"toToken")},setToTokenAmount(t){n.toTokenAmount=t?e.NumberUtil.toFixed(t,6):""},async setTokenPrice(e,t){let o=n.tokensPriceMap[e]||0;o||(n.loadingPrices=!0,o=await s.getAddressPrice(e)),"sourceToken"===t?n.sourceTokenPriceInUSD=o:"toToken"===t&&(n.toTokenPriceInUSD=o),n.loadingPrices&&(n.loadingPrices=!1),s.getParams().availableToSwap&&!n.switchingTokens&&s.swapTokens()},async switchTokens(){if(!n.initializing&&n.initialized&&!n.switchingTokens){n.switchingTokens=!0;try{const e=n.toToken?{...n.toToken}:void 0,t=n.sourceToken?{...n.sourceToken}:void 0,o=e&&""===n.toTokenAmount?"1":n.toTokenAmount;s.setSourceTokenAmount(o),s.setToTokenAmount(""),await s.setSourceToken(e),await s.setToToken(t),n.switchingTokens=!1,s.swapTokens()}catch(e){throw n.switchingTokens=!1,e}}},resetState(){n.myTokensWithBalance=i.myTokensWithBalance,n.tokensPriceMap=i.tokensPriceMap,n.initialized=i.initialized,n.initializing=i.initializing,n.switchingTokens=i.switchingTokens,n.sourceToken=i.sourceToken,n.sourceTokenAmount=i.sourceTokenAmount,n.sourceTokenPriceInUSD=i.sourceTokenPriceInUSD,n.toToken=i.toToken,n.toTokenAmount=i.toTokenAmount,n.toTokenPriceInUSD=i.toTokenPriceInUSD,n.networkPrice=i.networkPrice,n.networkTokenSymbol=i.networkTokenSymbol,n.networkBalanceInUSD=i.networkBalanceInUSD,n.inputError=i.inputError},resetValues(){const{networkAddress:e}=s.getParams(),t=n.tokens?.find((t=>t.address===e));s.setSourceToken(t),s.setToToken(void 0)},getApprovalLoadingState:()=>n.loadingApprovalTransaction,clearError(){n.transactionError=void 0},async initializeState(){if(!n.initializing){if(n.initializing=!0,!n.initialized)try{await s.fetchTokens(),n.initialized=!0}catch(t){n.initialized=!1,e.SnackController.showError("Failed to initialize swap"),e.RouterController.goBack()}n.initializing=!1}},async fetchTokens(){const{networkAddress:e}=s.getParams();await s.getNetworkTokenPrice(),await s.getMyTokensWithBalance();const t=n.myTokensWithBalance?.find((t=>t.address===e));t&&(n.networkTokenSymbol=t.symbol,s.setSourceToken(t),s.setSourceTokenAmount("0"))},async getTokenList(){const t=e.ChainController.state.activeCaipNetwork?.caipNetworkId;if(n.caipNetworkId!==t||!n.tokens)try{n.tokensLoading=!0;const o=await e.SwapApiUtil.getTokenList(t);n.tokens=o,n.caipNetworkId=t,n.popularTokens=o.sort(((e,t)=>e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0));const r=(t&&e.ConstantsUtil$1.SUGGESTED_TOKENS_BY_CHAIN?.[t]||[]).map((e=>o.find((t=>t.symbol===e)))).filter((e=>Boolean(e))),i=(e.ConstantsUtil$1.SWAP_SUGGESTED_TOKENS||[]).map((e=>o.find((t=>t.symbol===e)))).filter((e=>Boolean(e))).filter((e=>!r.some((t=>t.address===e.address))));n.suggestedTokens=[...r,...i]}catch(e){n.tokens=[],n.popularTokens=[],n.suggestedTokens=[]}finally{n.tokensLoading=!1}},async getAddressPrice(t){const o=n.tokensPriceMap[t];if(o)return o;const r=await e.BlockchainApiController.fetchTokenPrice({addresses:[t]}),i=r?.fungibles||[],a=[...n.tokens||[],...n.myTokensWithBalance||[]],s=a?.find((e=>e.address===t))?.symbol,c=i.find((e=>e.symbol.toLowerCase()===s?.toLowerCase()))?.price||0,l=parseFloat(c.toString());return n.tokensPriceMap[t]=l,l},async getNetworkTokenPrice(){const{networkAddress:t}=s.getParams(),o=await e.BlockchainApiController.fetchTokenPrice({addresses:[t]}).catch((()=>(e.SnackController.showError("Failed to fetch network token price"),{fungibles:[]}))),r=o.fungibles?.[0],i=r?.price.toString()||"0";n.tokensPriceMap[t]=parseFloat(i),n.networkTokenSymbol=r?.symbol||"",n.networkPrice=i},async getMyTokensWithBalance(t){const o=await e.BalanceUtil.getMyTokensWithBalance({forceUpdate:t,caipNetwork:e.ChainController.state.activeCaipNetwork,address:e.ChainController.getAccountData()?.address}),r=e.SwapApiUtil.mapBalancesToSwapTokens(o);r&&(await s.getInitialGasPrice(),s.setBalances(r))},setBalances(t){const{networkAddress:o}=s.getParams(),r=e.ChainController.state.activeCaipNetwork;if(!r)return;const i=t.find((e=>e.address===o));t.forEach((e=>{n.tokensPriceMap[e.address]=e.price||0})),n.myTokensWithBalance=t.filter((e=>e.address.startsWith(r.caipNetworkId))),n.networkBalanceInUSD=i?e.NumberUtil.multiply(i.quantity.numeric,i.price).toString():"0"},async getInitialGasPrice(){const t=await e.SwapApiUtil.fetchGasPrice();if(!t)return{gasPrice:null,gasPriceInUSD:null};switch(e.ChainController.state?.activeCaipNetwork?.chainNamespace){case e.ConstantsUtil.CHAIN.SOLANA:return n.gasFee=t.standard??"0",n.gasPriceInUSD=e.NumberUtil.multiply(t.standard,n.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(n.gasFee),gasPriceInUSD:Number(n.gasPriceInUSD)};case e.ConstantsUtil.CHAIN.EVM:default:const i=t.standard??"0",a=BigInt(i),s=BigInt(r),c=o.getGasPriceInUSD(n.networkPrice,s,a);return n.gasFee=i,n.gasPriceInUSD=c,{gasPrice:a,gasPriceInUSD:c}}},async swapTokens(){const t=e.ChainController.getAccountData()?.address,o=n.sourceToken,r=n.toToken,i=e.NumberUtil.bigNumber(n.sourceTokenAmount).gt(0);if(i||s.setToTokenAmount(""),!r||!o||n.loadingPrices||!i||!t)return;n.loadingQuote=!0;const a=e.NumberUtil.bigNumber(n.sourceTokenAmount).times(10**o.decimals).round(0).toFixed(0);try{const i=await e.BlockchainApiController.fetchSwapQuote({userAddress:t,from:o.address,to:r.address,gasPrice:n.gasFee,amount:a.toString()});n.loadingQuote=!1;const c=i?.quotes?.[0]?.toAmount;if(!c)return void e.AlertController.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");const l=e.NumberUtil.bigNumber(c).div(10**r.decimals).toString();s.setToTokenAmount(l);s.hasInsufficientToken(n.sourceTokenAmount,o.address)?n.inputError="Insufficient balance":(n.inputError=void 0,s.setTransactionDetails())}catch(t){const o=await e.SwapApiUtil.handleSwapError(t);n.loadingQuote=!1,n.inputError=o||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:t,availableToSwap:o}=s.getParams(),r=n.sourceToken,i=n.toToken;if(t&&o&&r&&i&&!n.loadingQuote)try{n.loadingBuildTransaction=!0;let o;return o=await e.SwapApiUtil.fetchSwapAllowance({userAddress:t,tokenAddress:r.address,sourceTokenAmount:n.sourceTokenAmount,sourceTokenDecimals:r.decimals})?await s.createSwapTransaction():await s.createAllowanceTransaction(),n.loadingBuildTransaction=!1,n.fetchError=!1,o}catch(t){return e.RouterController.goBack(),e.SnackController.showError("Failed to check allowance"),n.loadingBuildTransaction=!1,n.approvalTransaction=void 0,n.swapTransaction=void 0,void(n.fetchError=!0)}},async createAllowanceTransaction(){const{fromCaipAddress:t,sourceTokenAddress:o,toTokenAddress:r}=s.getParams();if(t&&r){if(!o)throw new Error("createAllowanceTransaction - No source token address found.");try{const i=await e.BlockchainApiController.generateApproveCalldata({from:o,to:r,userAddress:t}),a=e.CoreHelperUtil.getPlainAddress(i.tx.from);if(!a)throw new Error("SwapController:createAllowanceTransaction - address is required");const s={data:i.tx.data,to:a,gasPrice:BigInt(i.tx.eip155.gasPrice),value:BigInt(i.tx.value),toAmount:n.toTokenAmount};return n.swapTransaction=void 0,n.approvalTransaction={data:s.data,to:s.to,gasPrice:s.gasPrice,value:s.value,toAmount:s.toAmount},{data:s.data,to:s.to,gasPrice:s.gasPrice,value:s.value,toAmount:s.toAmount}}catch(t){return e.RouterController.goBack(),e.SnackController.showError("Failed to create approval transaction"),n.approvalTransaction=void 0,n.swapTransaction=void 0,void(n.fetchError=!0)}}},async createSwapTransaction(){const{networkAddress:t,fromCaipAddress:r,sourceTokenAmount:i}=s.getParams(),a=n.sourceToken,c=n.toToken;if(!(r&&i&&a&&c))return;const l=e.ConnectionController.parseUnits(i,a.decimals)?.toString();try{const i=await e.BlockchainApiController.generateSwapCalldata({userAddress:r,from:a.address,to:c.address,amount:l,disableEstimate:!0}),s=a.address===t,u=BigInt(i.tx.eip155.gas),d=BigInt(i.tx.eip155.gasPrice),p=e.CoreHelperUtil.getPlainAddress(i.tx.to);if(!p)throw new Error("SwapController:createSwapTransaction - address is required");const h={data:i.tx.data,to:p,gas:u,gasPrice:d,value:s?BigInt(l??"0"):BigInt("0"),toAmount:n.toTokenAmount};return n.gasPriceInUSD=o.getGasPriceInUSD(n.networkPrice,u,d),n.approvalTransaction=void 0,n.swapTransaction=h,h}catch(t){return e.RouterController.goBack(),e.SnackController.showError("Failed to create transaction"),n.approvalTransaction=void 0,n.swapTransaction=void 0,void(n.fetchError=!0)}},onEmbeddedWalletApprovalSuccess(){e.SnackController.showLoading("Approve limit increase in your wallet"),e.RouterController.replace("SwapPreview")},async sendTransactionForApproval(t){const{fromAddress:o,isAuthConnector:r}=s.getParams();n.loadingApprovalTransaction=!0;r?e.RouterController.pushTransactionStack({onSuccess:s.onEmbeddedWalletApprovalSuccess}):e.SnackController.showLoading("Approve limit increase in your wallet");try{await e.ConnectionController.sendTransaction({address:o,to:t.to,data:t.data,value:t.value,chainNamespace:e.ConstantsUtil.CHAIN.EVM}),await s.swapTokens(),await s.getTransaction(),n.approvalTransaction=void 0,n.loadingApprovalTransaction=!1}catch(t){const o=t;n.transactionError=o?.displayMessage,n.loadingApprovalTransaction=!1,e.SnackController.showError(o?.displayMessage||"Transaction error"),e.EventsController.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:o?.displayMessage||o?.message||"Unknown",network:e.ChainController.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:s.state.sourceToken?.symbol||"",swapToToken:s.state.toToken?.symbol||"",swapFromAmount:s.state.sourceTokenAmount||"",swapToAmount:s.state.toTokenAmount||"",isSmartAccount:e.getPreferredAccountType(e.ConstantsUtil.CHAIN.EVM)===e.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(t){if(!t)return;const{fromAddress:o,toTokenAmount:r,isAuthConnector:i}=s.getParams();n.loadingTransaction=!0;const c=`Swapping ${n.sourceToken?.symbol} to ${e.NumberUtil.formatNumberToLocalString(r,3)} ${n.toToken?.symbol}`,l=`Swapped ${n.sourceToken?.symbol} to ${e.NumberUtil.formatNumberToLocalString(r,3)} ${n.toToken?.symbol}`;i?e.RouterController.pushTransactionStack({onSuccess(){e.RouterController.replace("Account"),e.SnackController.showLoading(c),a.resetState()}}):e.SnackController.showLoading("Confirm transaction in your wallet");try{const r=[n.sourceToken?.address,n.toToken?.address].join(","),c=await e.ConnectionController.sendTransaction({address:o,to:t.to,data:t.data,value:t.value,chainNamespace:e.ConstantsUtil.CHAIN.EVM});return n.loadingTransaction=!1,e.SnackController.showSuccess(l),e.EventsController.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:e.ChainController.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:s.state.sourceToken?.symbol||"",swapToToken:s.state.toToken?.symbol||"",swapFromAmount:s.state.sourceTokenAmount||"",swapToAmount:s.state.toTokenAmount||"",isSmartAccount:e.getPreferredAccountType(e.ConstantsUtil.CHAIN.EVM)===e.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),a.resetState(),i||e.RouterController.replace("Account"),a.getMyTokensWithBalance(r),c}catch(t){const o=t;return n.transactionError=o?.displayMessage,n.loadingTransaction=!1,e.SnackController.showError(o?.displayMessage||"Transaction error"),void e.EventsController.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:o?.displayMessage||o?.message||"Unknown",network:e.ChainController.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:s.state.sourceToken?.symbol||"",swapToToken:s.state.toToken?.symbol||"",swapFromAmount:s.state.sourceTokenAmount||"",swapToAmount:s.state.toTokenAmount||"",isSmartAccount:e.getPreferredAccountType(e.ConstantsUtil.CHAIN.EVM)===e.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}})}},hasInsufficientToken:(e,t)=>o.isInsufficientSourceTokenForSwap(e,t,n.myTokensWithBalance),setTransactionDetails(){const{toTokenAddress:e,toTokenDecimals:t}=s.getParams();e&&t&&(n.gasPriceInUSD=o.getGasPriceInUSD(n.networkPrice,BigInt(n.gasFee),BigInt(r)),n.priceImpact=o.getPriceImpact({sourceTokenAmount:n.sourceTokenAmount,sourceTokenPriceInUSD:n.sourceTokenPriceInUSD,toTokenPriceInUSD:n.toTokenPriceInUSD,toTokenAmount:n.toTokenAmount}),n.maxSlippage=o.getMaxSlippage(n.slippage,n.toTokenAmount),n.providerFee=o.getProviderFee(n.sourceTokenAmount))}},s=e.withErrorBoundary(a),c=e.proxy({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),l={state:c,subscribe:t=>e.subscribe(c,(()=>t(c))),subscribeKey:(t,o)=>e.subscribeKey(c,t,o),showTooltip({message:e,triggerRect:t,variant:o}){c.open=!0,c.message=e,c.triggerRect=t,c.variant=o},hide(){c.open=!1,c.message="",c.triggerRect={width:0,height:0,top:0,left:0}}},u=e.withErrorBoundary(l),d={isUnsupportedChainView:()=>"UnsupportedChain"===e.RouterController.state.view||"SwitchNetwork"===e.RouterController.state.view&&e.RouterController.state.history.includes("UnsupportedChain"),async safeClose(){if(this.isUnsupportedChainView())return void e.ModalController.shake();await e.SIWXUtil.isSIWXCloseDisabled()?e.ModalController.shake():("DataCapture"!==e.RouterController.state.view&&"DataCaptureOtpConfirm"!==e.RouterController.state.view||e.ConnectionController.disconnect(),e.ModalController.close())}},p={interpolate(e,t,o){if(2!==e.length||2!==t.length)throw new Error("inputRange and outputRange must be an array of length 2");const r=e[0]||0,i=e[1]||0,n=t[0]||0,a=t[1]||0;return o<r?n:o>i?a:(a-n)/(i-r)*(o-r)+n}};var h=e.css`
2
+ :host {
3
+ display: block;
4
+ border-radius: clamp(0px, ${({borderRadius:e})=>e[8]}, 44px);
5
+ box-shadow: 0 0 0 1px ${({tokens:e})=>e.theme.foregroundPrimary};
6
+ overflow: hidden;
7
+ }
8
+ `,m=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let w=class extends e.i{render(){return e.b`<slot></slot>`}};w.styles=[e.resetStyles,h],w=m([t.customElement("wui-card")],w);var g=e.css`
9
+ :host {
10
+ width: 100%;
11
+ }
12
+
13
+ :host > wui-flex {
14
+ width: 100%;
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ gap: ${({spacing:e})=>e[2]};
19
+ padding: ${({spacing:e})=>e[3]};
20
+ border-radius: ${({borderRadius:e})=>e[6]};
21
+ border: 1px solid ${({tokens:e})=>e.theme.borderPrimary};
22
+ box-sizing: border-box;
23
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
24
+ box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.25);
25
+ color: ${({tokens:e})=>e.theme.textPrimary};
26
+ }
27
+
28
+ :host > wui-flex[data-type='info'] {
29
+ .icon-box {
30
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
31
+
32
+ wui-icon {
33
+ color: ${({tokens:e})=>e.theme.iconDefault};
34
+ }
35
+ }
36
+ }
37
+ :host > wui-flex[data-type='success'] {
38
+ .icon-box {
39
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
40
+
41
+ wui-icon {
42
+ color: ${({tokens:e})=>e.core.borderSuccess};
43
+ }
44
+ }
45
+ }
46
+ :host > wui-flex[data-type='warning'] {
47
+ .icon-box {
48
+ background-color: ${({tokens:e})=>e.core.backgroundWarning};
49
+
50
+ wui-icon {
51
+ color: ${({tokens:e})=>e.core.borderWarning};
52
+ }
53
+ }
54
+ }
55
+ :host > wui-flex[data-type='error'] {
56
+ .icon-box {
57
+ background-color: ${({tokens:e})=>e.core.backgroundError};
58
+
59
+ wui-icon {
60
+ color: ${({tokens:e})=>e.core.borderError};
61
+ }
62
+ }
63
+ }
64
+
65
+ wui-flex {
66
+ width: 100%;
67
+ }
68
+
69
+ wui-text {
70
+ word-break: break-word;
71
+ flex: 1;
72
+ }
73
+
74
+ .close {
75
+ cursor: pointer;
76
+ color: ${({tokens:e})=>e.theme.iconDefault};
77
+ }
78
+
79
+ .icon-box {
80
+ height: 40px;
81
+ width: 40px;
82
+ border-radius: ${({borderRadius:e})=>e[2]};
83
+ background-color: var(--local-icon-bg-value);
84
+ }
85
+ `,y=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};const b={info:"info",success:"checkmark",warning:"warningCircle",error:"warning"};let f=class extends e.i{constructor(){super(...arguments),this.message="",this.type="info"}render(){return e.b`
86
+ <wui-flex
87
+ data-type=${t.o(this.type)}
88
+ flexDirection="row"
89
+ justifyContent="space-between"
90
+ alignItems="center"
91
+ gap="2"
92
+ >
93
+ <wui-flex columnGap="2" flexDirection="row" alignItems="center">
94
+ <wui-flex
95
+ flexDirection="row"
96
+ alignItems="center"
97
+ justifyContent="center"
98
+ class="icon-box"
99
+ >
100
+ <wui-icon color="inherit" size="md" name=${b[this.type]}></wui-icon>
101
+ </wui-flex>
102
+ <wui-text variant="md-medium" color="inherit" data-testid="wui-alertbar-text"
103
+ >${this.message}</wui-text
104
+ >
105
+ </wui-flex>
106
+ <wui-icon
107
+ class="close"
108
+ color="inherit"
109
+ size="sm"
110
+ name="close"
111
+ @click=${this.onClose}
112
+ ></wui-icon>
113
+ </wui-flex>
114
+ `}onClose(){e.AlertController.close()}};f.styles=[e.resetStyles,g],y([t.n()],f.prototype,"message",void 0),y([t.n()],f.prototype,"type",void 0),f=y([t.customElement("wui-alertbar")],f);var v=e.css`
115
+ :host {
116
+ display: block;
117
+ position: absolute;
118
+ top: ${({spacing:e})=>e[3]};
119
+ left: ${({spacing:e})=>e[4]};
120
+ right: ${({spacing:e})=>e[4]};
121
+ opacity: 0;
122
+ pointer-events: none;
123
+ }
124
+ `,k=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};const x={info:{backgroundColor:"fg-350",iconColor:"fg-325",icon:"info"},success:{backgroundColor:"success-glass-reown-020",iconColor:"success-125",icon:"checkmark"},warning:{backgroundColor:"warning-glass-reown-020",iconColor:"warning-100",icon:"warningCircle"},error:{backgroundColor:"error-glass-reown-020",iconColor:"error-125",icon:"warning"}};let C=class extends e.i{constructor(){super(),this.unsubscribe=[],this.open=e.AlertController.state.open,this.onOpen(!0),this.unsubscribe.push(e.AlertController.subscribeKey("open",(e=>{this.open=e,this.onOpen(!1)})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const{message:t,variant:o}=e.AlertController.state,r=x[o];return e.b`
125
+ <wui-alertbar
126
+ message=${t}
127
+ backgroundColor=${r?.backgroundColor}
128
+ iconColor=${r?.iconColor}
129
+ icon=${r?.icon}
130
+ type=${o}
131
+ ></wui-alertbar>
132
+ `}onOpen(e){this.open?(this.animate([{opacity:0,transform:"scale(0.85)"},{opacity:1,transform:"scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: auto"):e||(this.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: none")}};C.styles=v,k([t.r()],C.prototype,"open",void 0),C=k([t.customElement("w3m-alertbar")],C);var A=e.css`
133
+ :host {
134
+ position: relative;
135
+ }
136
+
137
+ button {
138
+ display: flex;
139
+ justify-content: center;
140
+ align-items: center;
141
+ background-color: transparent;
142
+ padding: ${({spacing:e})=>e[1]};
143
+ }
144
+
145
+ /* -- Colors --------------------------------------------------- */
146
+ button[data-type='accent'] wui-icon {
147
+ color: ${({tokens:e})=>e.core.iconAccentPrimary};
148
+ }
149
+
150
+ button[data-type='neutral'][data-variant='primary'] wui-icon {
151
+ color: ${({tokens:e})=>e.theme.iconInverse};
152
+ }
153
+
154
+ button[data-type='neutral'][data-variant='secondary'] wui-icon {
155
+ color: ${({tokens:e})=>e.theme.iconDefault};
156
+ }
157
+
158
+ button[data-type='success'] wui-icon {
159
+ color: ${({tokens:e})=>e.core.iconSuccess};
160
+ }
161
+
162
+ button[data-type='error'] wui-icon {
163
+ color: ${({tokens:e})=>e.core.iconError};
164
+ }
165
+
166
+ /* -- Sizes --------------------------------------------------- */
167
+ button[data-size='xs'] {
168
+ width: 16px;
169
+ height: 16px;
170
+
171
+ border-radius: ${({borderRadius:e})=>e[1]};
172
+ }
173
+
174
+ button[data-size='sm'] {
175
+ width: 20px;
176
+ height: 20px;
177
+ border-radius: ${({borderRadius:e})=>e[1]};
178
+ }
179
+
180
+ button[data-size='md'] {
181
+ width: 24px;
182
+ height: 24px;
183
+ border-radius: ${({borderRadius:e})=>e[2]};
184
+ }
185
+
186
+ button[data-size='lg'] {
187
+ width: 28px;
188
+ height: 28px;
189
+ border-radius: ${({borderRadius:e})=>e[2]};
190
+ }
191
+
192
+ button[data-size='xs'] wui-icon {
193
+ width: 8px;
194
+ height: 8px;
195
+ }
196
+
197
+ button[data-size='sm'] wui-icon {
198
+ width: 12px;
199
+ height: 12px;
200
+ }
201
+
202
+ button[data-size='md'] wui-icon {
203
+ width: 16px;
204
+ height: 16px;
205
+ }
206
+
207
+ button[data-size='lg'] wui-icon {
208
+ width: 20px;
209
+ height: 20px;
210
+ }
211
+
212
+ /* -- Hover --------------------------------------------------- */
213
+ @media (hover: hover) {
214
+ button[data-type='accent']:hover:enabled {
215
+ background-color: ${({tokens:e})=>e.core.foregroundAccent010};
216
+ }
217
+
218
+ button[data-variant='primary'][data-type='neutral']:hover:enabled {
219
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
220
+ }
221
+
222
+ button[data-variant='secondary'][data-type='neutral']:hover:enabled {
223
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
224
+ }
225
+
226
+ button[data-type='success']:hover:enabled {
227
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
228
+ }
229
+
230
+ button[data-type='error']:hover:enabled {
231
+ background-color: ${({tokens:e})=>e.core.backgroundError};
232
+ }
233
+ }
234
+
235
+ /* -- Focus --------------------------------------------------- */
236
+ button:focus-visible {
237
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent020};
238
+ }
239
+
240
+ /* -- Properties --------------------------------------------------- */
241
+ button[data-full-width='true'] {
242
+ width: 100%;
243
+ }
244
+
245
+ :host([fullWidth]) {
246
+ width: 100%;
247
+ }
248
+
249
+ button[disabled] {
250
+ opacity: 0.5;
251
+ cursor: not-allowed;
252
+ }
253
+ `,T=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let S=class extends e.i{constructor(){super(...arguments),this.icon="card",this.variant="primary",this.type="accent",this.size="md",this.iconSize=void 0,this.fullWidth=!1,this.disabled=!1}render(){return e.b`<button
254
+ data-variant=${this.variant}
255
+ data-type=${this.type}
256
+ data-size=${this.size}
257
+ data-full-width=${this.fullWidth}
258
+ ?disabled=${this.disabled}
259
+ >
260
+ <wui-icon color="inherit" name=${this.icon} size=${t.o(this.iconSize)}></wui-icon>
261
+ </button>`}};S.styles=[e.resetStyles,e.elementStyles,A],T([t.n()],S.prototype,"icon",void 0),T([t.n()],S.prototype,"variant",void 0),T([t.n()],S.prototype,"type",void 0),T([t.n()],S.prototype,"size",void 0),T([t.n()],S.prototype,"iconSize",void 0),T([t.n({type:Boolean})],S.prototype,"fullWidth",void 0),T([t.n({type:Boolean})],S.prototype,"disabled",void 0),S=T([t.customElement("wui-icon-button")],S);var E=e.css`
262
+ button {
263
+ display: block;
264
+ display: flex;
265
+ align-items: center;
266
+ padding: ${({spacing:e})=>e[1]};
267
+ transition: background-color ${({durations:e})=>e.lg}
268
+ ${({easings:e})=>e["ease-out-power-2"]};
269
+ will-change: background-color;
270
+ border-radius: ${({borderRadius:e})=>e[32]};
271
+ }
272
+
273
+ wui-image {
274
+ border-radius: 100%;
275
+ }
276
+
277
+ wui-text {
278
+ padding-left: ${({spacing:e})=>e[1]};
279
+ }
280
+
281
+ .left-icon-container,
282
+ .right-icon-container {
283
+ width: 24px;
284
+ height: 24px;
285
+ justify-content: center;
286
+ align-items: center;
287
+ }
288
+
289
+ wui-icon {
290
+ color: ${({tokens:e})=>e.theme.iconDefault};
291
+ }
292
+
293
+ /* -- Sizes --------------------------------------------------- */
294
+ button[data-size='lg'] {
295
+ height: 32px;
296
+ }
297
+
298
+ button[data-size='md'] {
299
+ height: 28px;
300
+ }
301
+
302
+ button[data-size='sm'] {
303
+ height: 24px;
304
+ }
305
+
306
+ button[data-size='lg'] wui-image {
307
+ width: 24px;
308
+ height: 24px;
309
+ }
310
+
311
+ button[data-size='md'] wui-image {
312
+ width: 20px;
313
+ height: 20px;
314
+ }
315
+
316
+ button[data-size='sm'] wui-image {
317
+ width: 16px;
318
+ height: 16px;
319
+ }
320
+
321
+ button[data-size='lg'] .left-icon-container {
322
+ width: 24px;
323
+ height: 24px;
324
+ }
325
+
326
+ button[data-size='md'] .left-icon-container {
327
+ width: 20px;
328
+ height: 20px;
329
+ }
330
+
331
+ button[data-size='sm'] .left-icon-container {
332
+ width: 16px;
333
+ height: 16px;
334
+ }
335
+
336
+ /* -- Variants --------------------------------------------------------- */
337
+ button[data-type='filled-dropdown'] {
338
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
339
+ }
340
+
341
+ button[data-type='text-dropdown'] {
342
+ background-color: transparent;
343
+ }
344
+
345
+ /* -- Focus states --------------------------------------------------- */
346
+ button:focus-visible:enabled {
347
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
348
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent040};
349
+ }
350
+
351
+ /* -- Hover & Active states ----------------------------------------------------------- */
352
+ @media (hover: hover) and (pointer: fine) {
353
+ button:hover:enabled,
354
+ button:active:enabled {
355
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
356
+ }
357
+ }
358
+
359
+ /* -- Disabled states --------------------------------------------------- */
360
+ button:disabled {
361
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
362
+ opacity: 0.5;
363
+ }
364
+ `,I=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};const P={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},N={lg:"lg",md:"md",sm:"sm"};let $=class extends e.i{constructor(){super(...arguments),this.imageSrc="",this.text="",this.size="lg",this.type="text-dropdown",this.disabled=!1}render(){return e.b`<button ?disabled=${this.disabled} data-size=${this.size} data-type=${this.type}>
365
+ ${this.imageTemplate()} ${this.textTemplate()}
366
+ <wui-flex class="right-icon-container">
367
+ <wui-icon name="chevronBottom"></wui-icon>
368
+ </wui-flex>
369
+ </button>`}textTemplate(){const t=P[this.size];return this.text?e.b`<wui-text color="primary" variant=${t}>${this.text}</wui-text>`:null}imageTemplate(){if(this.imageSrc)return e.b`<wui-image src=${this.imageSrc} alt="select visual"></wui-image>`;const t=N[this.size];return e.b` <wui-flex class="left-icon-container">
370
+ <wui-icon size=${t} name="networkPlaceholder"></wui-icon>
371
+ </wui-flex>`}};$.styles=[e.resetStyles,e.elementStyles,E],I([t.n()],$.prototype,"imageSrc",void 0),I([t.n()],$.prototype,"text",void 0),I([t.n()],$.prototype,"size",void 0),I([t.n()],$.prototype,"type",void 0),I([t.n({type:Boolean})],$.prototype,"disabled",void 0),$=I([t.customElement("wui-select")],$);const R={ACCOUNT_TABS:[{label:"Tokens"},{label:"Activity"}],SECURE_SITE_ORIGIN:("undefined"!=typeof process&&void 0!==process.env?process.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},ANIMATION_DURATIONS:{HeaderText:120,ModalHeight:150,ViewTransition:150},VIEWS_WITH_LEGAL_FOOTER:["Connect","ConnectWallets","OnRampTokenSelect","OnRampFiatSelect","OnRampProviders"],VIEWS_WITH_DEFAULT_FOOTER:["Networks"]};var U=e.css`
372
+ button {
373
+ background-color: transparent;
374
+ padding: ${({spacing:e})=>e[1]};
375
+ }
376
+
377
+ button:focus-visible {
378
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent020};
379
+ }
380
+
381
+ button[data-variant='accent']:hover:enabled,
382
+ button[data-variant='accent']:focus-visible {
383
+ background-color: ${({tokens:e})=>e.core.foregroundAccent010};
384
+ }
385
+
386
+ button[data-variant='primary']:hover:enabled,
387
+ button[data-variant='primary']:focus-visible,
388
+ button[data-variant='secondary']:hover:enabled,
389
+ button[data-variant='secondary']:focus-visible {
390
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
391
+ }
392
+
393
+ button[data-size='xs'] > wui-icon {
394
+ width: 8px;
395
+ height: 8px;
396
+ }
397
+
398
+ button[data-size='sm'] > wui-icon {
399
+ width: 12px;
400
+ height: 12px;
401
+ }
402
+
403
+ button[data-size='xs'],
404
+ button[data-size='sm'] {
405
+ border-radius: ${({borderRadius:e})=>e[1]};
406
+ }
407
+
408
+ button[data-size='md'],
409
+ button[data-size='lg'] {
410
+ border-radius: ${({borderRadius:e})=>e[2]};
411
+ }
412
+
413
+ button[data-size='md'] > wui-icon {
414
+ width: 16px;
415
+ height: 16px;
416
+ }
417
+
418
+ button[data-size='lg'] > wui-icon {
419
+ width: 20px;
420
+ height: 20px;
421
+ }
422
+
423
+ button:disabled {
424
+ background-color: transparent;
425
+ cursor: not-allowed;
426
+ opacity: 0.5;
427
+ }
428
+
429
+ button:hover:not(:disabled) {
430
+ background-color: var(--wui-color-accent-glass-015);
431
+ }
432
+
433
+ button:focus-visible:not(:disabled) {
434
+ background-color: var(--wui-color-accent-glass-015);
435
+ box-shadow:
436
+ inset 0 0 0 1px var(--wui-color-accent-100),
437
+ 0 0 0 4px var(--wui-color-accent-glass-020);
438
+ }
439
+ `,O=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let _=class extends e.i{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.icon="copy",this.iconColor="default",this.variant="accent"}render(){return e.b`
440
+ <button data-variant=${this.variant} ?disabled=${this.disabled} data-size=${this.size}>
441
+ <wui-icon
442
+ color=${{accent:"accent-primary",primary:"inverse",secondary:"default"}[this.variant]||this.iconColor}
443
+ size=${this.size}
444
+ name=${this.icon}
445
+ ></wui-icon>
446
+ </button>
447
+ `}};_.styles=[e.resetStyles,e.elementStyles,U],O([t.n()],_.prototype,"size",void 0),O([t.n({type:Boolean})],_.prototype,"disabled",void 0),O([t.n()],_.prototype,"icon",void 0),O([t.n()],_.prototype,"iconColor",void 0),O([t.n()],_.prototype,"variant",void 0),_=O([t.customElement("wui-icon-link")],_);const W=e.w`<svg width="86" height="96" fill="none">
448
+ <path
449
+ d="M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z"
450
+ />
451
+ </svg>`,D=e.w`
452
+ <svg fill="none" viewBox="0 0 36 40">
453
+ <path
454
+ d="M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z"
455
+ />
456
+ </svg>
457
+ `;var L=e.css`
458
+ :host {
459
+ position: relative;
460
+ border-radius: inherit;
461
+ display: flex;
462
+ justify-content: center;
463
+ align-items: center;
464
+ width: var(--local-width);
465
+ height: var(--local-height);
466
+ }
467
+
468
+ :host([data-round='true']) {
469
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
470
+ border-radius: 100%;
471
+ outline: 1px solid ${({tokens:e})=>e.core.glass010};
472
+ }
473
+
474
+ svg {
475
+ position: absolute;
476
+ top: 0;
477
+ left: 0;
478
+ width: 100%;
479
+ height: 100%;
480
+ z-index: 1;
481
+ }
482
+
483
+ svg > path {
484
+ stroke: var(--local-stroke);
485
+ }
486
+
487
+ wui-image {
488
+ width: 100%;
489
+ height: 100%;
490
+ -webkit-clip-path: var(--local-path);
491
+ clip-path: var(--local-path);
492
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
493
+ }
494
+
495
+ wui-icon {
496
+ transform: translateY(-5%);
497
+ width: var(--local-icon-size);
498
+ height: var(--local-icon-size);
499
+ }
500
+ `,B=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let z=class extends e.i{constructor(){super(...arguments),this.size="md",this.name="uknown",this.networkImagesBySize={sm:D,md:t.networkSvgMd,lg:W},this.selected=!1,this.round=!1}render(){const t={sm:"4",md:"6",lg:"10"};return this.round?(this.dataset.round="true",this.style.cssText="\n --local-width: var(--apkt-spacing-10);\n --local-height: var(--apkt-spacing-10);\n --local-icon-size: var(--apkt-spacing-4);\n "):this.style.cssText=`\n\n --local-path: var(--apkt-path-network-${this.size});\n --local-width: var(--apkt-width-network-${this.size});\n --local-height: var(--apkt-height-network-${this.size});\n --local-icon-size: var(--apkt-spacing-${t[this.size]});\n `,e.b`${this.templateVisual()} ${this.svgTemplate()} `}svgTemplate(){return this.round?null:this.networkImagesBySize[this.size]}templateVisual(){return this.imageSrc?e.b`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:e.b`<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`}};z.styles=[e.resetStyles,L],B([t.n()],z.prototype,"size",void 0),B([t.n()],z.prototype,"name",void 0),B([t.n({type:Object})],z.prototype,"networkImagesBySize",void 0),B([t.n()],z.prototype,"imageSrc",void 0),B([t.n({type:Boolean})],z.prototype,"selected",void 0),B([t.n({type:Boolean})],z.prototype,"round",void 0),z=B([t.customElement("wui-network-image")],z);var j=e.css`
501
+ :host {
502
+ position: relative;
503
+ display: flex;
504
+ width: 100%;
505
+ height: 1px;
506
+ background-color: ${({tokens:e})=>e.theme.borderPrimary};
507
+ justify-content: center;
508
+ align-items: center;
509
+ }
510
+
511
+ :host > wui-text {
512
+ position: absolute;
513
+ padding: 0px 8px;
514
+ transition: background-color ${({durations:e})=>e.lg}
515
+ ${({easings:e})=>e["ease-out-power-2"]};
516
+ will-change: background-color;
517
+ }
518
+
519
+ :host([data-bg-color='primary']) > wui-text {
520
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
521
+ }
522
+
523
+ :host([data-bg-color='secondary']) > wui-text {
524
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
525
+ }
526
+ `,F=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let q=class extends e.i{constructor(){super(...arguments),this.text="",this.bgColor="primary"}render(){return this.dataset.bgColor=this.bgColor,e.b`${this.template()}`}template(){return this.text?e.b`<wui-text variant="md-regular" color="secondary">${this.text}</wui-text>`:null}};q.styles=[e.resetStyles,j],F([t.n()],q.prototype,"text",void 0),F([t.n()],q.prototype,"bgColor",void 0),q=F([t.customElement("wui-separator")],q);const M={INVALID_PAYMENT_CONFIG:"INVALID_PAYMENT_CONFIG",INVALID_RECIPIENT:"INVALID_RECIPIENT",INVALID_ASSET:"INVALID_ASSET",INVALID_AMOUNT:"INVALID_AMOUNT",UNKNOWN_ERROR:"UNKNOWN_ERROR",UNABLE_TO_INITIATE_PAYMENT:"UNABLE_TO_INITIATE_PAYMENT",INVALID_CHAIN_NAMESPACE:"INVALID_CHAIN_NAMESPACE",GENERIC_PAYMENT_ERROR:"GENERIC_PAYMENT_ERROR",UNABLE_TO_GET_EXCHANGES:"UNABLE_TO_GET_EXCHANGES",ASSET_NOT_SUPPORTED:"ASSET_NOT_SUPPORTED",UNABLE_TO_GET_PAY_URL:"UNABLE_TO_GET_PAY_URL",UNABLE_TO_GET_BUY_STATUS:"UNABLE_TO_GET_BUY_STATUS",UNABLE_TO_GET_TOKEN_BALANCES:"UNABLE_TO_GET_TOKEN_BALANCES",UNABLE_TO_GET_QUOTE:"UNABLE_TO_GET_QUOTE",UNABLE_TO_GET_QUOTE_STATUS:"UNABLE_TO_GET_QUOTE_STATUS",INVALID_RECIPIENT_ADDRESS_FOR_ASSET:"INVALID_RECIPIENT_ADDRESS_FOR_ASSET"},H={[M.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[M.INVALID_RECIPIENT]:"Invalid recipient address",[M.INVALID_ASSET]:"Invalid asset specified",[M.INVALID_AMOUNT]:"Invalid payment amount",[M.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[M.UNKNOWN_ERROR]:"Unknown payment error occurred",[M.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[M.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[M.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[M.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[M.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[M.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[M.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[M.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[M.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[M.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"};class V extends Error{get message(){return H[this.code]}constructor(e,t){super(H[e]),this.name="AppKitPayError",this.code=e,this.details=t,Error.captureStackTrace&&Error.captureStackTrace(this,V)}}const G="https://rpc.walletconnect.org/v1/json-rpc",K="reown_test";function Y(e){if(!e)return null;const t=e.steps[0];return t&&t.type===de?t:null}function Q(e,t=0){if(!e)return[];const o=e.steps.filter((e=>e.type===pe)),r=o.filter(((e,o)=>o+1>t));return o.length>0&&o.length<3?r:[]}const X=new e.FetchUtil({baseUrl:e.CoreHelperUtil.getApiUrl(),clientId:null});class Z extends Error{}function J(){const{projectId:t,sdkType:o,sdkVersion:r}=e.OptionsController.state;return{projectId:t,st:o||"appkit",sv:r||"html-wagmi-4.2.2"}}async function ee(t,o){const r=function(){const t=e.OptionsController.getSnapshot().projectId;return`${G}?projectId=${t}`}(),{sdkType:i,sdkVersion:n,projectId:a}=e.OptionsController.getSnapshot(),s={jsonrpc:"2.0",id:1,method:t,params:{...o||{},st:i,sv:n,projectId:a}},c=await fetch(r,{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}}),l=await c.json();if(l.error)throw new Z(l.error.message);return l}async function te(e){return(await ee("reown_getExchanges",e)).result}async function oe(e){return(await ee("reown_getExchangePayUrl",e)).result}async function re(t){const o=e.HelpersUtil.isLowerCaseMatch(t.sourceToken.network,t.toToken.network),r=e.HelpersUtil.isLowerCaseMatch(t.sourceToken.asset,t.toToken.asset);return o&&r?async function({sourceToken:t,toToken:o,amount:r,recipient:i}){const n=e.ConnectionController.parseUnits(r,t.metadata.decimals),a=e.ConnectionController.parseUnits(r,o.metadata.decimals);return Promise.resolve({type:ue,origin:{amount:n?.toString()??"0",currency:t},destination:{amount:a?.toString()??"0",currency:o},fees:[{id:"service",label:"Service Fee",amount:"0",currency:o}],steps:[{requestId:ue,type:"deposit",deposit:{amount:n?.toString()??"0",currency:t.asset,receiver:i}}],timeInSeconds:6})}(t):async function(t){const o=e.NumberUtil.bigNumber(t.amount).times(10**t.toToken.metadata.decimals).toString(),{chainId:r,chainNamespace:i}=e.ParseUtil.parseCaipNetworkId(t.sourceToken.network),{chainId:n,chainNamespace:a}=e.ParseUtil.parseCaipNetworkId(t.toToken.network),s="native"===t.sourceToken.asset?e.getNativeTokenAddress(i):t.sourceToken.asset,c="native"===t.toToken.asset?e.getNativeTokenAddress(a):t.toToken.asset;return await X.post({path:"/appkit/v1/transfers/quote",body:{user:t.address,originChainId:r.toString(),originCurrency:s,destinationChainId:n.toString(),destinationCurrency:c,recipient:t.recipient,amount:o},params:J()})}(t)}const ie=["eip155","solana"],ne={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},ae={56:"714",204:"714"};function se(t,o){const{chainNamespace:r,chainId:i}=e.ParseUtil.parseCaipNetworkId(t),n=ne[r];if(!n)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${r}`);let a=n.native.assetNamespace,s=n.native.assetReference;"native"!==o?(a=n.defaultTokenNamespace,s=o):"eip155"===r&&ae[i]&&(s=ae[i]);return`${`${r}:${i}`}/${a}:${s}`}function ce(t){const o=e.NumberUtil.bigNumber(t,{safe:!0});return o.lt(.001)?"<0.001":o.round(4).toString()}const le="unknown",ue="direct-transfer",de="deposit",pe="transaction",he=e.proxy({paymentAsset:{network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},recipient:"0x0",amount:0,isConfigured:!1,error:null,isPaymentInProgress:!1,exchanges:[],isLoading:!1,openInNewTab:!0,redirectUrl:void 0,payWithExchange:void 0,currentPayment:void 0,analyticsSet:!1,paymentId:void 0,choice:"pay",tokenBalances:{[e.ConstantsUtil.CHAIN.EVM]:[],[e.ConstantsUtil.CHAIN.SOLANA]:[]},isFetchingTokenBalances:!1,selectedPaymentAsset:null,quote:void 0,quoteStatus:"waiting",quoteError:null,isFetchingQuote:!1,selectedExchange:void 0,exchangeUrlForQuote:void 0,requestId:void 0}),me={state:he,subscribe:t=>e.subscribe(he,(()=>t(he))),subscribeKey:(t,o)=>e.subscribeKey(he,t,o),async handleOpenPay(t){this.resetState(),this.setPaymentConfig(t),this.initializeAnalytics(),function(){const{chainNamespace:t}=e.ParseUtil.parseCaipNetworkId(me.state.paymentAsset.network);if(!e.CoreHelperUtil.isAddress(me.state.recipient,t))throw new V(M.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${t}"`)}(),await this.prepareTokenLogo(),he.isConfigured=!0,e.EventsController.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:he.exchanges,configuration:{network:he.paymentAsset.network,asset:he.paymentAsset.asset,recipient:he.recipient,amount:he.amount}}}),await e.ModalController.open({view:"Pay"})},resetState(){he.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},he.recipient="0x0",he.amount=0,he.isConfigured=!1,he.error=null,he.isPaymentInProgress=!1,he.isLoading=!1,he.currentPayment=void 0,he.selectedExchange=void 0,he.exchangeUrlForQuote=void 0,he.requestId=void 0},resetQuoteState(){he.quote=void 0,he.quoteStatus="waiting",he.quoteError=null,he.isFetchingQuote=!1,he.requestId=void 0},setPaymentConfig(e){if(!e.paymentAsset)throw new V(M.INVALID_PAYMENT_CONFIG);try{he.choice=e.choice??"pay",he.paymentAsset=e.paymentAsset,he.recipient=e.recipient,he.amount=e.amount,he.openInNewTab=e.openInNewTab??!0,he.redirectUrl=e.redirectUrl,he.payWithExchange=e.payWithExchange,he.error=null}catch(e){throw new V(M.INVALID_PAYMENT_CONFIG,e.message)}},setSelectedPaymentAsset(e){he.selectedPaymentAsset=e},setSelectedExchange(e){he.selectedExchange=e},setRequestId(e){he.requestId=e},setPaymentInProgress(e){he.isPaymentInProgress=e},getPaymentAsset:()=>he.paymentAsset,getExchanges:()=>he.exchanges,async fetchExchanges(){try{he.isLoading=!0;const e=await te({page:0});he.exchanges=e.exchanges.slice(0,2)}catch(t){throw e.SnackController.showError(H.UNABLE_TO_GET_EXCHANGES),new V(M.UNABLE_TO_GET_EXCHANGES)}finally{he.isLoading=!1}},async getAvailableExchanges(e){try{const t=e?.asset&&e?.network?se(e.network,e.asset):void 0;return await te({page:e?.page??0,asset:t,amount:e?.amount?.toString()})}catch(e){throw new V(M.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(t,o,r=!1){try{const i=Number(o.amount),n=await oe({exchangeId:t,asset:se(o.network,o.asset),amount:i.toString(),recipient:`${o.network}:${o.recipient}`});return e.EventsController.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{source:"pay",exchange:{id:t},configuration:{network:o.network,asset:o.asset,recipient:o.recipient,amount:i},currentPayment:{type:"exchange",exchangeId:t},headless:r}}),r&&(this.initiatePayment(),e.EventsController.sendEvent({type:"track",event:"PAY_INITIATED",properties:{source:"pay",paymentId:he.paymentId||le,configuration:{network:o.network,asset:o.asset,recipient:o.recipient,amount:i},currentPayment:{type:"exchange",exchangeId:t}}})),n}catch(e){if(e instanceof Error&&e.message.includes("is not supported"))throw new V(M.ASSET_NOT_SUPPORTED);throw new Error(e.message)}},async generateExchangeUrlForQuote({exchangeId:e,paymentAsset:t,amount:o,recipient:r}){const i=await oe({exchangeId:e,asset:se(t.network,t.asset),amount:o.toString(),recipient:r});he.exchangeSessionId=i.sessionId,he.exchangeUrlForQuote=i.url},async openPayUrl(t,o,r=!1){try{const i=await this.getPayUrl(t.exchangeId,o,r);if(!i)throw new V(M.UNABLE_TO_GET_PAY_URL);const n=t.openInNewTab??!0?"_blank":"_self";return e.CoreHelperUtil.openHref(i.url,n),i}catch(e){throw he.error=e instanceof V?e.message:H.GENERIC_PAYMENT_ERROR,new V(M.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:t,fromAddress:o,toAddress:r,amount:i,paymentAsset:n}){if(he.currentPayment={type:"wallet",status:"IN_PROGRESS"},!he.isPaymentInProgress)try{this.initiatePayment();const a=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===n.network));if(!a)throw new Error("Target network not found");const s=e.ChainController.state.activeCaipNetwork;switch(e.HelpersUtil.isLowerCaseMatch(s?.caipNetworkId,a.caipNetworkId)||await e.ChainController.switchActiveNetwork(a),t){case e.ConstantsUtil.CHAIN.EVM:"native"===n.asset&&(he.currentPayment.result=await async function(t,o,r){if(o!==e.ConstantsUtil.CHAIN.EVM)throw new V(M.INVALID_CHAIN_NAMESPACE);if(!r.fromAddress)throw new V(M.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");const i="string"==typeof r.amount?parseFloat(r.amount):r.amount;if(isNaN(i))throw new V(M.INVALID_PAYMENT_CONFIG);const n=t.metadata?.decimals??18,a=e.ConnectionController.parseUnits(i.toString(),n);if("bigint"!=typeof a)throw new V(M.GENERIC_PAYMENT_ERROR);return await e.ConnectionController.sendTransaction({chainNamespace:o,to:r.recipient,address:r.fromAddress,value:a,data:"0x"})??void 0}(n,t,{recipient:r,amount:i,fromAddress:o})),n.asset.startsWith("0x")&&(he.currentPayment.result=await async function(t,o){if(!o.fromAddress)throw new V(M.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");const r=t.asset,i=o.recipient,n=Number(t.metadata.decimals),a=e.ConnectionController.parseUnits(o.amount.toString(),n);if(void 0===a)throw new V(M.GENERIC_PAYMENT_ERROR);return await e.ConnectionController.writeContract({fromAddress:o.fromAddress,tokenAddress:r,args:[i,a],method:"transfer",abi:e.ContractUtil.getERC20Abi(r),chainNamespace:e.ConstantsUtil.CHAIN.EVM})??void 0}(n,{recipient:r,amount:i,fromAddress:o})),he.currentPayment.status="SUCCESS";break;case e.ConstantsUtil.CHAIN.SOLANA:he.currentPayment.result=await async function(t,o){if(t!==e.ConstantsUtil.CHAIN.SOLANA)throw new V(M.INVALID_CHAIN_NAMESPACE);if(!o.fromAddress)throw new V(M.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");const r="string"==typeof o.amount?parseFloat(o.amount):o.amount;if(isNaN(r)||r<=0)throw new V(M.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!e.ProviderController.getProvider(t))throw new V(M.GENERIC_PAYMENT_ERROR,"No Solana provider available.");const i=await e.ConnectionController.sendTransaction({chainNamespace:e.ConstantsUtil.CHAIN.SOLANA,to:o.recipient,value:r,tokenMint:o.tokenMint});if(!i)throw new V(M.GENERIC_PAYMENT_ERROR,"Transaction failed.");return i}catch(e){if(e instanceof V)throw e;throw new V(M.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${e}`)}}(t,{recipient:r,amount:i,fromAddress:o,tokenMint:"native"===n.asset?void 0:n.asset}),he.currentPayment.status="SUCCESS";break;default:throw new V(M.INVALID_CHAIN_NAMESPACE)}}catch(t){throw he.error=t instanceof V?t.message:H.GENERIC_PAYMENT_ERROR,he.currentPayment.status="FAILED",e.SnackController.showError(he.error),t}finally{he.isPaymentInProgress=!1}},async onSendTransaction(t){try{const{namespace:o,transactionStep:r}=t;me.initiatePayment();const i=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===he.paymentAsset?.network));if(!i)throw new Error("Target network not found");const n=e.ChainController.state.activeCaipNetwork;if(e.HelpersUtil.isLowerCaseMatch(n?.caipNetworkId,i.caipNetworkId)||await e.ChainController.switchActiveNetwork(i),o===e.ConstantsUtil.CHAIN.EVM){const{from:t,to:i,data:n,value:a}=r.transaction;await e.ConnectionController.sendTransaction({address:t,to:i,data:n,value:BigInt(a),chainNamespace:o})}else if(o===e.ConstantsUtil.CHAIN.SOLANA){const{instructions:t}=r.transaction;await e.ConnectionController.writeSolanaTransaction({instructions:t})}}catch(t){throw he.error=t instanceof V?t.message:H.GENERIC_PAYMENT_ERROR,e.SnackController.showError(he.error),t}finally{he.isPaymentInProgress=!1}},getExchangeById:e=>he.exchanges.find((t=>t.id===e)),validatePayConfig(e){const{paymentAsset:t,recipient:o,amount:r}=e;if(!t)throw new V(M.INVALID_PAYMENT_CONFIG);if(!o)throw new V(M.INVALID_RECIPIENT);if(!t.asset)throw new V(M.INVALID_ASSET);if(null==r||r<=0)throw new V(M.INVALID_AMOUNT)},async handlePayWithExchange(t){try{he.currentPayment={type:"exchange",exchangeId:t};const{network:e,asset:o}=he.paymentAsset,r={network:e,asset:o,amount:he.amount,recipient:he.recipient},i=await this.getPayUrl(t,r);if(!i)throw new V(M.UNABLE_TO_INITIATE_PAYMENT);return he.currentPayment.sessionId=i.sessionId,he.currentPayment.status="IN_PROGRESS",he.currentPayment.exchangeId=t,this.initiatePayment(),{url:i.url,openInNewTab:he.openInNewTab}}catch(t){return he.error=t instanceof V?t.message:H.GENERIC_PAYMENT_ERROR,he.isPaymentInProgress=!1,e.SnackController.showError(he.error),null}},async getBuyStatus(t,o){try{const r=await async function(e){return(await ee("reown_getExchangeBuyStatus",e)).result}({sessionId:o,exchangeId:t});return"SUCCESS"!==r.status&&"FAILED"!==r.status||e.EventsController.sendEvent({type:"track",event:"SUCCESS"===r.status?"PAY_SUCCESS":"PAY_ERROR",properties:{message:"FAILED"===r.status?e.CoreHelperUtil.parseError(he.error):void 0,source:"pay",paymentId:he.paymentId||le,configuration:{network:he.paymentAsset.network,asset:he.paymentAsset.asset,recipient:he.recipient,amount:he.amount},currentPayment:{type:"exchange",exchangeId:he.currentPayment?.exchangeId,sessionId:he.currentPayment?.sessionId,result:r.txHash}}}),r}catch(e){throw new V(M.UNABLE_TO_GET_BUY_STATUS)}},async fetchTokensFromEOA({caipAddress:t,caipNetwork:o,namespace:r}){if(!t)return[];const{address:i}=e.ParseUtil.parseCaipAddress(t);let n=o;r===e.ConstantsUtil.CHAIN.EVM&&(n=void 0);return await e.BalanceUtil.getMyTokensWithBalance({address:i,caipNetwork:n})},async fetchTokensFromExchange(){if(!he.selectedExchange)return[];const t=await async function(e){return await X.get({path:`/appkit/v1/transfers/assets/exchanges/${e}`,params:J()})}(he.selectedExchange.id),o=Object.values(t.assets).flat();return await Promise.all(o.map((async t=>{const o={chainId:(r=t).network,address:`${r.network}:${r.asset}`,symbol:r.metadata.symbol,name:r.metadata.name,iconUrl:r.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:r.metadata.decimals.toString()}};var r;const{chainNamespace:i}=e.ParseUtil.parseCaipNetworkId(o.chainId);let n=o.address;if(e.CoreHelperUtil.isCaipAddress(n)){const{address:t}=e.ParseUtil.parseCaipAddress(n);n=t}const a=await e.AssetUtil.getImageByToken(n??"",i).catch((()=>{}));return o.iconUrl=a??"",o})))},async fetchTokens({caipAddress:t,caipNetwork:o,namespace:r}){try{he.isFetchingTokenBalances=!0;const e=Boolean(he.selectedExchange)?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:t,caipNetwork:o,namespace:r}),i=await e;he.tokenBalances={...he.tokenBalances,[r]:i}}catch(t){const o=t instanceof Error?t.message:"Unable to get token balances";e.SnackController.showError(o)}finally{he.isFetchingTokenBalances=!1}},async fetchQuote({amount:t,address:o,sourceToken:r,toToken:i,recipient:n}){try{me.resetQuoteState(),he.isFetchingQuote=!0;const a=await re({amount:t,address:he.selectedExchange?void 0:o,sourceToken:r,toToken:i,recipient:n});if(he.selectedExchange){const t=Y(a);if(t){const o=`${r.network}:${t.deposit.receiver}`,i=e.NumberUtil.formatNumber(t.deposit.amount,{decimals:r.metadata.decimals??0,round:8});await me.generateExchangeUrlForQuote({exchangeId:he.selectedExchange.id,paymentAsset:r,amount:i.toString(),recipient:o})}}he.quote=a}catch(t){let o=H.UNABLE_TO_GET_QUOTE;if(t instanceof Error&&t.cause&&t.cause instanceof Response)try{const e=await t.cause.json();e.error&&"string"==typeof e.error&&(o=e.error)}catch{}throw he.quoteError=o,e.SnackController.showError(o),new V(M.UNABLE_TO_GET_QUOTE)}finally{he.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:e}){try{if(e===ue){const e=he.selectedExchange,t=he.exchangeSessionId;if(e&&t){switch((await this.getBuyStatus(e.id,t)).status){case"IN_PROGRESS":case"UNKNOWN":default:he.quoteStatus="waiting";break;case"SUCCESS":he.quoteStatus="success",he.isPaymentInProgress=!1;break;case"FAILED":he.quoteStatus="failure",he.isPaymentInProgress=!1}return}return void(he.quoteStatus="success")}const{status:t}=await async function(e){return await X.get({path:"/appkit/v1/transfers/status",params:{requestId:e.requestId,...J()}})}({requestId:e});he.quoteStatus=t}catch{throw he.quoteStatus="failure",new V(M.UNABLE_TO_GET_QUOTE_STATUS)}},initiatePayment(){he.isPaymentInProgress=!0,he.paymentId=crypto.randomUUID()},initializeAnalytics(){he.analyticsSet||(he.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",(t=>{if(he.currentPayment?.status&&"UNKNOWN"!==he.currentPayment.status){const t={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[he.currentPayment.status];e.EventsController.sendEvent({type:"track",event:t,properties:{message:"FAILED"===he.currentPayment.status?e.CoreHelperUtil.parseError(he.error):void 0,source:"pay",paymentId:he.paymentId||le,configuration:{network:he.paymentAsset.network,asset:he.paymentAsset.asset,recipient:he.recipient,amount:he.amount},currentPayment:{type:he.currentPayment.type,exchangeId:he.currentPayment.exchangeId,sessionId:he.currentPayment.sessionId,result:he.currentPayment.result}}})}})))},async prepareTokenLogo(){if(!he.paymentAsset.metadata.logoURI)try{const{chainNamespace:t}=e.ParseUtil.parseCaipNetworkId(he.paymentAsset.network),o=await e.AssetUtil.getImageByToken(he.paymentAsset.asset,t);he.paymentAsset.metadata.logoURI=o}catch{}}};var we=e.css`
527
+ wui-separator {
528
+ margin: var(--apkt-spacing-3) calc(var(--apkt-spacing-3) * -1) var(--apkt-spacing-2)
529
+ calc(var(--apkt-spacing-3) * -1);
530
+ width: calc(100% + var(--apkt-spacing-3) * 2);
531
+ }
532
+
533
+ .token-display {
534
+ padding: var(--apkt-spacing-3) var(--apkt-spacing-3);
535
+ border-radius: var(--apkt-borderRadius-5);
536
+ background-color: var(--apkt-tokens-theme-backgroundPrimary);
537
+ margin-top: var(--apkt-spacing-3);
538
+ margin-bottom: var(--apkt-spacing-3);
539
+ }
540
+
541
+ .token-display wui-text {
542
+ text-transform: none;
543
+ }
544
+
545
+ wui-loading-spinner {
546
+ padding: var(--apkt-spacing-2);
547
+ }
548
+
549
+ .left-image-container {
550
+ position: relative;
551
+ justify-content: center;
552
+ align-items: center;
553
+ }
554
+
555
+ .token-image {
556
+ border-radius: ${({borderRadius:e})=>e.round};
557
+ width: 40px;
558
+ height: 40px;
559
+ }
560
+
561
+ .chain-image {
562
+ position: absolute;
563
+ width: 20px;
564
+ height: 20px;
565
+ bottom: -3px;
566
+ right: -5px;
567
+ border-radius: ${({borderRadius:e})=>e.round};
568
+ border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
569
+ }
570
+
571
+ .payment-methods-container {
572
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
573
+ border-top-right-radius: ${({borderRadius:e})=>e[8]};
574
+ border-top-left-radius: ${({borderRadius:e})=>e[8]};
575
+ }
576
+ `,ge=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let ye=class extends e.i{constructor(){super(),this.unsubscribe=[],this.amount=me.state.amount,this.namespace=void 0,this.paymentAsset=me.state.paymentAsset,this.activeConnectorIds=e.ConnectorController.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=me.state.exchanges,this.isLoading=me.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(me.subscribeKey("amount",(e=>this.amount=e))),this.unsubscribe.push(e.ConnectorController.subscribeKey("activeConnectorIds",(e=>this.activeConnectorIds=e))),this.unsubscribe.push(me.subscribeKey("exchanges",(e=>this.exchanges=e))),this.unsubscribe.push(me.subscribeKey("isLoading",(e=>this.isLoading=e))),me.fetchExchanges(),me.setSelectedExchange(void 0)}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){return e.b`
577
+ <wui-flex flexDirection="column">
578
+ ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()}
579
+ </wui-flex>
580
+ `}paymentMethodsTemplate(){return e.b`
581
+ <wui-flex flexDirection="column" padding="3" gap="2" class="payment-methods-container">
582
+ ${this.payWithWalletTemplate()} ${this.templateSeparator()}
583
+ ${this.templateExchangeOptions()}
584
+ </wui-flex>
585
+ `}initializeNamespace(){const t=e.ChainController.state.activeChain;this.namespace=t,this.caipAddress=e.ChainController.getAccountData(t)?.caipAddress,this.unsubscribe.push(e.ChainController.subscribeChainProp("accountState",(e=>{this.caipAddress=e?.caipAddress}),t))}paymentDetailsTemplate(){const o=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===this.paymentAsset.network));return e.b`
586
+ <wui-flex
587
+ alignItems="center"
588
+ justifyContent="space-between"
589
+ .padding=${["6","8","6","8"]}
590
+ gap="2"
591
+ >
592
+ <wui-flex alignItems="center" gap="1">
593
+ <wui-text variant="h1-regular" color="primary">
594
+ ${ce(this.amount||"0")}
595
+ </wui-text>
596
+
597
+ <wui-flex flexDirection="column">
598
+ <wui-text variant="h6-regular" color="secondary">
599
+ ${this.paymentAsset.metadata.symbol||"Unknown"}
600
+ </wui-text>
601
+ <wui-text variant="md-medium" color="secondary"
602
+ >on ${o?.name||"Unknown"}</wui-text
603
+ >
604
+ </wui-flex>
605
+ </wui-flex>
606
+
607
+ <wui-flex class="left-image-container">
608
+ <wui-image
609
+ src=${t.o(this.paymentAsset.metadata.logoURI)}
610
+ class="token-image"
611
+ ></wui-image>
612
+ <wui-image
613
+ src=${t.o(e.AssetUtil.getNetworkImage(o))}
614
+ class="chain-image"
615
+ ></wui-image>
616
+ </wui-flex>
617
+ </wui-flex>
618
+ `}payWithWalletTemplate(){return function(t){const{chainNamespace:o}=e.ParseUtil.parseCaipNetworkId(t);return ie.includes(o)}(this.paymentAsset.network)?this.caipAddress?this.connectedWalletTemplate():this.disconnectedWalletTemplate():e.b``}connectedWalletTemplate(){const{name:o,image:r}=this.getWalletProperties({namespace:this.namespace});return e.b`
619
+ <wui-flex flexDirection="column" gap="3">
620
+ <wui-list-item
621
+ type="secondary"
622
+ boxColor="foregroundSecondary"
623
+ @click=${this.onWalletPayment}
624
+ .boxed=${!1}
625
+ ?chevron=${!0}
626
+ ?fullSize=${!1}
627
+ ?rounded=${!0}
628
+ data-testid="wallet-payment-option"
629
+ imageSrc=${t.o(r)}
630
+ imageSize="3xl"
631
+ >
632
+ <wui-text variant="lg-regular" color="primary">Pay with ${o}</wui-text>
633
+ </wui-list-item>
634
+
635
+ <wui-list-item
636
+ type="secondary"
637
+ icon="power"
638
+ iconColor="error"
639
+ @click=${this.onDisconnect}
640
+ data-testid="disconnect-button"
641
+ ?chevron=${!1}
642
+ boxColor="foregroundSecondary"
643
+ >
644
+ <wui-text variant="lg-regular" color="secondary">Disconnect</wui-text>
645
+ </wui-list-item>
646
+ </wui-flex>
647
+ `}disconnectedWalletTemplate(){return e.b`<wui-list-item
648
+ type="secondary"
649
+ boxColor="foregroundSecondary"
650
+ variant="icon"
651
+ iconColor="default"
652
+ iconVariant="overlay"
653
+ icon="wallet"
654
+ @click=${this.onWalletPayment}
655
+ ?chevron=${!0}
656
+ data-testid="wallet-payment-option"
657
+ >
658
+ <wui-text variant="lg-regular" color="primary">Pay with wallet</wui-text>
659
+ </wui-list-item>`}templateExchangeOptions(){if(this.isLoading)return e.b`<wui-flex justifyContent="center" alignItems="center">
660
+ <wui-loading-spinner size="md"></wui-loading-spinner>
661
+ </wui-flex>`;const o=this.exchanges.filter((t=>function(t){const o=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===t.network));return!!o&&Boolean(o.testnet)}(this.paymentAsset)?t.id===K:t.id!==K));return 0===o.length?e.b`<wui-flex justifyContent="center" alignItems="center">
662
+ <wui-text variant="md-medium" color="primary">No exchanges available</wui-text>
663
+ </wui-flex>`:o.map((o=>e.b`
664
+ <wui-list-item
665
+ type="secondary"
666
+ boxColor="foregroundSecondary"
667
+ @click=${()=>this.onExchangePayment(o)}
668
+ data-testid="exchange-option-${o.id}"
669
+ ?chevron=${!0}
670
+ imageSrc=${t.o(o.imageUrl)}
671
+ >
672
+ <wui-text flexGrow="1" variant="lg-regular" color="primary">
673
+ Pay with ${o.name}
674
+ </wui-text>
675
+ </wui-list-item>
676
+ `))}templateSeparator(){return e.b`<wui-separator text="or" bgColor="secondary"></wui-separator>`}async onWalletPayment(){if(!this.namespace)throw new Error("Namespace not found");this.caipAddress?e.RouterController.push("PayQuote"):(await e.ConnectorController.connect(),await e.ModalController.open({view:"PayQuote"}))}onExchangePayment(t){me.setSelectedExchange(t),e.RouterController.push("PayQuote")}async onDisconnect(){try{await e.ConnectionController.disconnect(),await e.ModalController.open({view:"Pay"})}catch{console.error("Failed to disconnect"),e.SnackController.showError("Failed to disconnect")}}getWalletProperties({namespace:t}){if(!t)return{name:void 0,image:void 0};const o=this.activeConnectorIds[t];if(!o)return{name:void 0,image:void 0};const r=e.ConnectorController.getConnector({id:o,namespace:t});if(!r)return{name:void 0,image:void 0};const i=e.AssetUtil.getConnectorImage(r);return{name:r.name,image:i}}};ye.styles=we,ge([t.r()],ye.prototype,"amount",void 0),ge([t.r()],ye.prototype,"namespace",void 0),ge([t.r()],ye.prototype,"paymentAsset",void 0),ge([t.r()],ye.prototype,"activeConnectorIds",void 0),ge([t.r()],ye.prototype,"caipAddress",void 0),ge([t.r()],ye.prototype,"exchanges",void 0),ge([t.r()],ye.prototype,"isLoading",void 0),ye=ge([t.customElement("w3m-pay-view")],ye);var be=e.css`
677
+ :host {
678
+ display: inline-flex;
679
+ align-items: center;
680
+ justify-content: center;
681
+ }
682
+
683
+ .pulse-container {
684
+ position: relative;
685
+ width: var(--pulse-size);
686
+ height: var(--pulse-size);
687
+ display: flex;
688
+ align-items: center;
689
+ justify-content: center;
690
+ }
691
+
692
+ .pulse-rings {
693
+ position: absolute;
694
+ inset: 0;
695
+ pointer-events: none;
696
+ }
697
+
698
+ .pulse-ring {
699
+ position: absolute;
700
+ inset: 0;
701
+ border-radius: 50%;
702
+ border: 2px solid var(--pulse-color);
703
+ opacity: 0;
704
+ animation: pulse var(--pulse-duration, 2s) ease-out infinite;
705
+ }
706
+
707
+ .pulse-content {
708
+ position: relative;
709
+ z-index: 1;
710
+ display: flex;
711
+ align-items: center;
712
+ justify-content: center;
713
+ }
714
+
715
+ @keyframes pulse {
716
+ 0% {
717
+ transform: scale(0.5);
718
+ opacity: var(--pulse-opacity, 0.3);
719
+ }
720
+ 50% {
721
+ opacity: calc(var(--pulse-opacity, 0.3) * 0.5);
722
+ }
723
+ 100% {
724
+ transform: scale(1.2);
725
+ opacity: 0;
726
+ }
727
+ }
728
+ `,fe=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};const ve={"accent-primary":e.vars.tokens.core.backgroundAccentPrimary};let ke=class extends e.i{constructor(){super(...arguments),this.rings=3,this.duration=2,this.opacity=.3,this.size="200px",this.variant="accent-primary"}render(){const t=ve[this.variant];this.style.cssText=`\n --pulse-size: ${this.size};\n --pulse-duration: ${this.duration}s;\n --pulse-color: ${t};\n --pulse-opacity: ${this.opacity};\n `;const o=Array.from({length:this.rings},((e,t)=>this.renderRing(t,this.rings)));return e.b`
729
+ <div class="pulse-container">
730
+ <div class="pulse-rings">${o}</div>
731
+ <div class="pulse-content">
732
+ <slot></slot>
733
+ </div>
734
+ </div>
735
+ `}renderRing(t,o){const r=`animation-delay: ${t/o*this.duration}s;`;return e.b`<div class="pulse-ring" style=${r}></div>`}};ke.styles=[e.resetStyles,be],fe([t.n({type:Number})],ke.prototype,"rings",void 0),fe([t.n({type:Number})],ke.prototype,"duration",void 0),fe([t.n({type:Number})],ke.prototype,"opacity",void 0),fe([t.n()],ke.prototype,"size",void 0),fe([t.n()],ke.prototype,"variant",void 0),ke=fe([t.customElement("wui-pulse")],ke);const xe=[{id:"received",title:"Receiving funds",icon:"dollar"},{id:"processing",title:"Swapping asset",icon:"recycleHorizontal"},{id:"sending",title:"Sending asset to the recipient address",icon:"send"}],Ce=["success","submitted","failure","timeout","refund"];var Ae=e.css`
736
+ :host {
737
+ display: block;
738
+ height: 100%;
739
+ width: 100%;
740
+ }
741
+
742
+ wui-image {
743
+ border-radius: ${({borderRadius:e})=>e.round};
744
+ }
745
+
746
+ .token-badge-container {
747
+ position: absolute;
748
+ bottom: 6px;
749
+ left: 50%;
750
+ transform: translateX(-50%);
751
+ border-radius: ${({borderRadius:e})=>e[4]};
752
+ z-index: 3;
753
+ min-width: 105px;
754
+ }
755
+
756
+ .token-badge-container.loading {
757
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
758
+ border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary};
759
+ }
760
+
761
+ .token-badge-container.success {
762
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
763
+ border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary};
764
+ }
765
+
766
+ .token-image-container {
767
+ position: relative;
768
+ }
769
+
770
+ .token-image {
771
+ border-radius: ${({borderRadius:e})=>e.round};
772
+ width: 64px;
773
+ height: 64px;
774
+ }
775
+
776
+ .token-image.success {
777
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
778
+ }
779
+
780
+ .token-image.error {
781
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
782
+ }
783
+
784
+ .token-image.loading {
785
+ background: ${({colors:e})=>e.accent010};
786
+ }
787
+
788
+ .token-image wui-icon {
789
+ width: 32px;
790
+ height: 32px;
791
+ }
792
+
793
+ .token-badge {
794
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
795
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary};
796
+ border-radius: ${({borderRadius:e})=>e[4]};
797
+ }
798
+
799
+ .token-badge wui-text {
800
+ white-space: nowrap;
801
+ }
802
+
803
+ .payment-lifecycle-container {
804
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
805
+ border-top-right-radius: ${({borderRadius:e})=>e[6]};
806
+ border-top-left-radius: ${({borderRadius:e})=>e[6]};
807
+ }
808
+
809
+ .payment-step-badge {
810
+ padding: ${({spacing:e})=>e[1]} ${({spacing:e})=>e[2]};
811
+ border-radius: ${({borderRadius:e})=>e[1]};
812
+ }
813
+
814
+ .payment-step-badge.loading {
815
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
816
+ }
817
+
818
+ .payment-step-badge.error {
819
+ background-color: ${({tokens:e})=>e.core.backgroundError};
820
+ }
821
+
822
+ .payment-step-badge.success {
823
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
824
+ }
825
+
826
+ .step-icon-container {
827
+ position: relative;
828
+ height: 40px;
829
+ width: 40px;
830
+ border-radius: ${({borderRadius:e})=>e.round};
831
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
832
+ }
833
+
834
+ .step-icon-box {
835
+ position: absolute;
836
+ right: -4px;
837
+ bottom: -1px;
838
+ padding: 2px;
839
+ border-radius: ${({borderRadius:e})=>e.round};
840
+ border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
841
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
842
+ }
843
+
844
+ .step-icon-box.success {
845
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
846
+ }
847
+ `,Te=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};const Se={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]};let Ee=class extends e.i{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=me.state.paymentAsset,this.quoteStatus=me.state.quoteStatus,this.quote=me.state.quote,this.amount=me.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=e.ConnectorController.state.activeConnectorIds,this.selectedExchange=me.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(me.subscribeKey("quoteStatus",(e=>this.quoteStatus=e)),me.subscribeKey("quote",(e=>this.quote=e)),e.ConnectorController.subscribeKey("activeConnectorIds",(e=>this.activeConnectorIds=e)),me.subscribeKey("selectedExchange",(e=>this.selectedExchange=e)))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach((e=>e()))}render(){return e.b`
848
+ <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2">
849
+ ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()}
850
+ </wui-flex>
851
+ `}tokenTemplate(){const o=ce(this.amount||"0"),r=this.paymentAsset.metadata.symbol??"Unknown",i=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===this.paymentAsset.network)),n="failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus;return"success"===this.quoteStatus||"submitted"===this.quoteStatus?e.b`<wui-flex alignItems="center" justifyContent="center">
852
+ <wui-flex justifyContent="center" alignItems="center" class="token-image success">
853
+ <wui-icon name="checkmark" color="success" size="inherit"></wui-icon>
854
+ </wui-flex>
855
+ </wui-flex>`:n?e.b`<wui-flex alignItems="center" justifyContent="center">
856
+ <wui-flex justifyContent="center" alignItems="center" class="token-image error">
857
+ <wui-icon name="close" color="error" size="inherit"></wui-icon>
858
+ </wui-flex>
859
+ </wui-flex>`:e.b`
860
+ <wui-flex alignItems="center" justifyContent="center">
861
+ <wui-flex class="token-image-container">
862
+ <wui-pulse size="125px" rings="3" duration="4" opacity="0.5" variant="accent-primary">
863
+ <wui-flex justifyContent="center" alignItems="center" class="token-image loading">
864
+ <wui-icon name="paperPlaneTitle" color="accent-primary" size="inherit"></wui-icon>
865
+ </wui-flex>
866
+ </wui-pulse>
867
+
868
+ <wui-flex
869
+ justifyContent="center"
870
+ alignItems="center"
871
+ class="token-badge-container loading"
872
+ >
873
+ <wui-flex
874
+ alignItems="center"
875
+ justifyContent="center"
876
+ gap="01"
877
+ padding="1"
878
+ class="token-badge"
879
+ >
880
+ <wui-image
881
+ src=${t.o(e.AssetUtil.getNetworkImage(i))}
882
+ class="chain-image"
883
+ size="mdl"
884
+ ></wui-image>
885
+
886
+ <wui-text variant="lg-regular" color="primary">${o} ${r}</wui-text>
887
+ </wui-flex>
888
+ </wui-flex>
889
+ </wui-flex>
890
+ </wui-flex>
891
+ `}paymentTemplate(){return e.b`
892
+ <wui-flex flexDirection="column" gap="2" .padding=${["0","6","0","6"]}>
893
+ ${this.renderPayment()}
894
+ <wui-separator></wui-separator>
895
+ ${this.renderWallet()}
896
+ </wui-flex>
897
+ `}paymentLifecycleTemplate(){const t=this.getStepsWithStatus();return e.b`
898
+ <wui-flex flexDirection="column" padding="4" gap="2" class="payment-lifecycle-container">
899
+ <wui-flex alignItems="center" justifyContent="space-between">
900
+ <wui-text variant="md-regular" color="secondary">PAYMENT CYCLE</wui-text>
901
+
902
+ ${this.renderPaymentCycleBadge()}
903
+ </wui-flex>
904
+
905
+ <wui-flex flexDirection="column" gap="5" .padding=${["2","0","2","0"]}>
906
+ ${t.map((e=>this.renderStep(e)))}
907
+ </wui-flex>
908
+ </wui-flex>
909
+ `}renderPaymentCycleBadge(){const t="failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus,o="success"===this.quoteStatus||"submitted"===this.quoteStatus;if(t)return e.b`
910
+ <wui-flex
911
+ justifyContent="center"
912
+ alignItems="center"
913
+ class="payment-step-badge error"
914
+ gap="1"
915
+ >
916
+ <wui-icon name="close" color="error" size="xs"></wui-icon>
917
+ <wui-text variant="sm-regular" color="error">Failed</wui-text>
918
+ </wui-flex>
919
+ `;if(o)return e.b`
920
+ <wui-flex
921
+ justifyContent="center"
922
+ alignItems="center"
923
+ class="payment-step-badge success"
924
+ gap="1"
925
+ >
926
+ <wui-icon name="checkmark" color="success" size="xs"></wui-icon>
927
+ <wui-text variant="sm-regular" color="success">Completed</wui-text>
928
+ </wui-flex>
929
+ `;const r=this.quote?.timeInSeconds??0;return e.b`
930
+ <wui-flex alignItems="center" justifyContent="space-between" gap="3">
931
+ <wui-flex
932
+ justifyContent="center"
933
+ alignItems="center"
934
+ class="payment-step-badge loading"
935
+ gap="1"
936
+ >
937
+ <wui-icon name="clock" color="default" size="xs"></wui-icon>
938
+ <wui-text variant="sm-regular" color="primary">Est. ${r} sec</wui-text>
939
+ </wui-flex>
940
+
941
+ <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon>
942
+ </wui-flex>
943
+ `}renderPayment(){const o=e.ChainController.getAllRequestedCaipNetworks().find((t=>{const o=this.quote?.origin.currency.network;if(!o)return!1;const{chainId:r}=e.ParseUtil.parseCaipNetworkId(o);return e.HelpersUtil.isLowerCaseMatch(t.id.toString(),r.toString())})),r=ce(e.NumberUtil.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString()),i=this.quote?.origin.currency.metadata.symbol??"Unknown";return e.b`
944
+ <wui-flex
945
+ alignItems="flex-start"
946
+ justifyContent="space-between"
947
+ .padding=${["3","0","3","0"]}
948
+ >
949
+ <wui-text variant="lg-regular" color="secondary">Payment Method</wui-text>
950
+
951
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="1">
952
+ <wui-flex alignItems="center" gap="01">
953
+ <wui-text variant="lg-regular" color="primary">${r}</wui-text>
954
+ <wui-text variant="lg-regular" color="secondary">${i}</wui-text>
955
+ </wui-flex>
956
+
957
+ <wui-flex alignItems="center" gap="1">
958
+ <wui-text variant="md-regular" color="secondary">on</wui-text>
959
+ <wui-image
960
+ src=${t.o(e.AssetUtil.getNetworkImage(o))}
961
+ size="xs"
962
+ ></wui-image>
963
+ <wui-text variant="md-regular" color="secondary">${o?.name}</wui-text>
964
+ </wui-flex>
965
+ </wui-flex>
966
+ </wui-flex>
967
+ `}renderWallet(){return e.b`
968
+ <wui-flex
969
+ alignItems="flex-start"
970
+ justifyContent="space-between"
971
+ .padding=${["3","0","3","0"]}
972
+ >
973
+ <wui-text variant="lg-regular" color="secondary"
974
+ >${this.selectedExchange?"Exchange":"Wallet"}</wui-text
975
+ >
976
+
977
+ ${this.renderWalletText()}
978
+ </wui-flex>
979
+ `}renderWalletText(){const{image:o}=this.getWalletProperties({namespace:this.namespace}),{address:r}=this.caipAddress?e.ParseUtil.parseCaipAddress(this.caipAddress):{},i=this.selectedExchange?.name;return this.selectedExchange?e.b`
980
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
981
+ <wui-text variant="lg-regular" color="primary">${i}</wui-text>
982
+ <wui-image src=${t.o(this.selectedExchange.imageUrl)} size="mdl"></wui-image>
983
+ </wui-flex>
984
+ `:e.b`
985
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
986
+ <wui-text variant="lg-regular" color="primary">
987
+ ${t.UiHelperUtil.getTruncateString({string:this.profileName||r||i||"",charsStart:this.profileName?16:4,charsEnd:this.profileName?0:6,truncate:this.profileName?"end":"middle"})}
988
+ </wui-text>
989
+
990
+ <wui-image src=${t.o(o)} size="mdl"></wui-image>
991
+ </wui-flex>
992
+ `}getStepsWithStatus(){return"failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus?xe.map((e=>({...e,status:"failed"}))):xe.map((e=>{const t=(Se[e.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...e,status:t}}))}renderStep({title:o,icon:r,status:i}){const n={"step-icon-box":!0,success:"completed"===i};return e.b`
993
+ <wui-flex alignItems="center" gap="3">
994
+ <wui-flex justifyContent="center" alignItems="center" class="step-icon-container">
995
+ <wui-icon name=${r} color="default" size="mdl"></wui-icon>
996
+
997
+ <wui-flex alignItems="center" justifyContent="center" class=${t.e$1(n)}>
998
+ ${this.renderStatusIndicator(i)}
999
+ </wui-flex>
1000
+ </wui-flex>
1001
+
1002
+ <wui-text variant="md-regular" color="primary">${o}</wui-text>
1003
+ </wui-flex>
1004
+ `}renderStatusIndicator(t){return"completed"===t?e.b`<wui-icon size="sm" color="success" name="checkmark"></wui-icon>`:"failed"===t?e.b`<wui-icon size="sm" color="error" name="close"></wui-icon>`:"pending"===t?e.b`<wui-loading-spinner color="accent-primary" size="sm"></wui-loading-spinner>`:null}startPolling(){this.pollingInterval||(this.fetchQuoteStatus(),this.pollingInterval=setInterval((()=>{this.fetchQuoteStatus()}),3e3))}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}async fetchQuoteStatus(){const e=me.state.requestId;if(!e||Ce.includes(this.quoteStatus))this.stopPolling();else try{await me.fetchQuoteStatus({requestId:e}),Ce.includes(this.quoteStatus)&&this.stopPolling()}catch{this.stopPolling()}}initializeNamespace(){const t=e.ChainController.state.activeChain;this.namespace=t,this.caipAddress=e.ChainController.getAccountData(t)?.caipAddress,this.profileName=e.ChainController.getAccountData(t)?.profileName??null,this.unsubscribe.push(e.ChainController.subscribeChainProp("accountState",(e=>{this.caipAddress=e?.caipAddress,this.profileName=e?.profileName??null}),t))}getWalletProperties({namespace:t}){if(!t)return{name:void 0,image:void 0};const o=this.activeConnectorIds[t];if(!o)return{name:void 0,image:void 0};const r=e.ConnectorController.getConnector({id:o,namespace:t});if(!r)return{name:void 0,image:void 0};const i=e.AssetUtil.getConnectorImage(r);return{name:r.name,image:i}}};Ee.styles=Ae,Te([t.r()],Ee.prototype,"paymentAsset",void 0),Te([t.r()],Ee.prototype,"quoteStatus",void 0),Te([t.r()],Ee.prototype,"quote",void 0),Te([t.r()],Ee.prototype,"amount",void 0),Te([t.r()],Ee.prototype,"namespace",void 0),Te([t.r()],Ee.prototype,"caipAddress",void 0),Te([t.r()],Ee.prototype,"profileName",void 0),Te([t.r()],Ee.prototype,"activeConnectorIds",void 0),Te([t.r()],Ee.prototype,"selectedExchange",void 0),Ee=Te([t.customElement("w3m-pay-loading-view")],Ee);var Ie=e.css`
1005
+ button {
1006
+ display: flex;
1007
+ align-items: center;
1008
+ height: 40px;
1009
+ padding: ${({spacing:e})=>e[2]};
1010
+ border-radius: ${({borderRadius:e})=>e[4]};
1011
+ column-gap: ${({spacing:e})=>e[1]};
1012
+ background-color: transparent;
1013
+ transition: background-color ${({durations:e})=>e.lg}
1014
+ ${({easings:e})=>e["ease-out-power-2"]};
1015
+ will-change: background-color;
1016
+ }
1017
+
1018
+ wui-image,
1019
+ .icon-box {
1020
+ width: ${({spacing:e})=>e[6]};
1021
+ height: ${({spacing:e})=>e[6]};
1022
+ border-radius: ${({borderRadius:e})=>e[4]};
1023
+ }
1024
+
1025
+ wui-text {
1026
+ flex: 1;
1027
+ }
1028
+
1029
+ .icon-box {
1030
+ position: relative;
1031
+ }
1032
+
1033
+ .icon-box[data-active='true'] {
1034
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
1035
+ }
1036
+
1037
+ .circle {
1038
+ position: absolute;
1039
+ left: 16px;
1040
+ top: 15px;
1041
+ width: 8px;
1042
+ height: 8px;
1043
+ background-color: ${({tokens:e})=>e.core.textSuccess};
1044
+ box-shadow: 0 0 0 2px ${({tokens:e})=>e.theme.foregroundPrimary};
1045
+ border-radius: 50%;
1046
+ }
1047
+
1048
+ /* -- Hover & Active states ----------------------------------------------------------- */
1049
+ @media (hover: hover) {
1050
+ button:hover:enabled,
1051
+ button:active:enabled {
1052
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1053
+ }
1054
+ }
1055
+ `,Pe=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let Ne=class extends e.i{constructor(){super(...arguments),this.address="",this.profileName="",this.alt="",this.imageSrc="",this.icon=void 0,this.iconSize="md",this.enableGreenCircle=!0,this.loading=!1,this.charsStart=4,this.charsEnd=6}render(){return e.b`
1056
+ <button>
1057
+ ${this.leftImageTemplate()} ${this.textTemplate()} ${this.rightImageTemplate()}
1058
+ </button>
1059
+ `}leftImageTemplate(){const o=this.icon?e.b`<wui-icon
1060
+ size=${t.o(this.iconSize)}
1061
+ color="default"
1062
+ name=${this.icon}
1063
+ class="icon"
1064
+ ></wui-icon>`:e.b`<wui-image src=${this.imageSrc} alt=${this.alt}></wui-image>`;return e.b`
1065
+ <wui-flex
1066
+ alignItems="center"
1067
+ justifyContent="center"
1068
+ class="icon-box"
1069
+ data-active=${Boolean(this.icon)}
1070
+ >
1071
+ ${o}
1072
+ ${this.enableGreenCircle?e.b`<wui-flex class="circle"></wui-flex>`:null}
1073
+ </wui-flex>
1074
+ `}textTemplate(){return e.b`
1075
+ <wui-text variant="lg-regular" color="primary">
1076
+ ${t.UiHelperUtil.getTruncateString({string:this.profileName||this.address,charsStart:this.profileName?16:this.charsStart,charsEnd:this.profileName?0:this.charsEnd,truncate:this.profileName?"end":"middle"})}
1077
+ </wui-text>
1078
+ `}rightImageTemplate(){return e.b`<wui-icon name="chevronBottom" size="sm" color="default"></wui-icon>`}};Ne.styles=[e.resetStyles,e.elementStyles,Ie],Pe([t.n()],Ne.prototype,"address",void 0),Pe([t.n()],Ne.prototype,"profileName",void 0),Pe([t.n()],Ne.prototype,"alt",void 0),Pe([t.n()],Ne.prototype,"imageSrc",void 0),Pe([t.n()],Ne.prototype,"icon",void 0),Pe([t.n()],Ne.prototype,"iconSize",void 0),Pe([t.n({type:Boolean})],Ne.prototype,"enableGreenCircle",void 0),Pe([t.n({type:Boolean})],Ne.prototype,"loading",void 0),Pe([t.n({type:Number})],Ne.prototype,"charsStart",void 0),Pe([t.n({type:Number})],Ne.prototype,"charsEnd",void 0),Ne=Pe([t.customElement("wui-wallet-switch")],Ne);var $e=e.i$1`
1079
+ :host {
1080
+ display: block;
1081
+ }
1082
+ `,Re=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let Ue=class extends e.i{render(){return e.b`
1083
+ <wui-flex flexDirection="column" gap="4">
1084
+ <wui-flex alignItems="center" justifyContent="space-between">
1085
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
1086
+ <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
1087
+ </wui-flex>
1088
+
1089
+ <wui-flex alignItems="center" justifyContent="space-between">
1090
+ <wui-text variant="md-regular" color="secondary">Network Fee</wui-text>
1091
+
1092
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
1093
+ <wui-shimmer
1094
+ width="75px"
1095
+ height="16px"
1096
+ borderRadius="4xs"
1097
+ variant="light"
1098
+ ></wui-shimmer>
1099
+
1100
+ <wui-flex alignItems="center" gap="01">
1101
+ <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer>
1102
+ <wui-shimmer
1103
+ width="49px"
1104
+ height="14px"
1105
+ borderRadius="4xs"
1106
+ variant="light"
1107
+ ></wui-shimmer>
1108
+ </wui-flex>
1109
+ </wui-flex>
1110
+ </wui-flex>
1111
+
1112
+ <wui-flex alignItems="center" justifyContent="space-between">
1113
+ <wui-text variant="md-regular" color="secondary">Service Fee</wui-text>
1114
+ <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
1115
+ </wui-flex>
1116
+ </wui-flex>
1117
+ `}};Ue.styles=[$e],Ue=Re([t.customElement("w3m-pay-fees-skeleton")],Ue);var Oe=e.css`
1118
+ :host {
1119
+ display: block;
1120
+ }
1121
+
1122
+ wui-image {
1123
+ border-radius: ${({borderRadius:e})=>e.round};
1124
+ }
1125
+ `,_e=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let We=class extends e.i{constructor(){super(),this.unsubscribe=[],this.quote=me.state.quote,this.unsubscribe.push(me.subscribeKey("quote",(e=>this.quote=e)))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const t=e.NumberUtil.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0,round:6}).toString();return e.b`
1126
+ <wui-flex flexDirection="column" gap="4">
1127
+ <wui-flex alignItems="center" justifyContent="space-between">
1128
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
1129
+ <wui-text variant="md-regular" color="primary">
1130
+ ${t} ${this.quote?.origin.currency.metadata.symbol||"Unknown"}
1131
+ </wui-text>
1132
+ </wui-flex>
1133
+
1134
+ ${this.quote&&this.quote.fees.length>0?this.quote.fees.map((e=>this.renderFee(e))):null}
1135
+ </wui-flex>
1136
+ `}renderFee(o){const r="network"===o.id,i=e.NumberUtil.formatNumber(o.amount||"0",{decimals:o.currency.metadata.decimals??0,round:6}).toString();if(r){const r=e.ChainController.getAllRequestedCaipNetworks().find((t=>e.HelpersUtil.isLowerCaseMatch(t.caipNetworkId,o.currency.network)));return e.b`
1137
+ <wui-flex alignItems="center" justifyContent="space-between">
1138
+ <wui-text variant="md-regular" color="secondary">${o.label}</wui-text>
1139
+
1140
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
1141
+ <wui-text variant="md-regular" color="primary">
1142
+ ${i} ${o.currency.metadata.symbol||"Unknown"}
1143
+ </wui-text>
1144
+
1145
+ <wui-flex alignItems="center" gap="01">
1146
+ <wui-image
1147
+ src=${t.o(e.AssetUtil.getNetworkImage(r))}
1148
+ size="xs"
1149
+ ></wui-image>
1150
+ <wui-text variant="sm-regular" color="secondary">
1151
+ ${r?.name||"Unknown"}
1152
+ </wui-text>
1153
+ </wui-flex>
1154
+ </wui-flex>
1155
+ </wui-flex>
1156
+ `}return e.b`
1157
+ <wui-flex alignItems="center" justifyContent="space-between">
1158
+ <wui-text variant="md-regular" color="secondary">${o.label}</wui-text>
1159
+ <wui-text variant="md-regular" color="primary">
1160
+ ${i} ${o.currency.metadata.symbol||"Unknown"}
1161
+ </wui-text>
1162
+ </wui-flex>
1163
+ `}};We.styles=[Oe],_e([t.r()],We.prototype,"quote",void 0),We=_e([t.customElement("w3m-pay-fees")],We);var De=e.css`
1164
+ :host {
1165
+ display: block;
1166
+ width: 100%;
1167
+ }
1168
+
1169
+ .disabled-container {
1170
+ padding: ${({spacing:e})=>e[2]};
1171
+ min-height: 168px;
1172
+ }
1173
+
1174
+ wui-icon {
1175
+ width: ${({spacing:e})=>e[8]};
1176
+ height: ${({spacing:e})=>e[8]};
1177
+ }
1178
+
1179
+ wui-flex > wui-text {
1180
+ max-width: 273px;
1181
+ }
1182
+ `,Le=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let Be=class extends e.i{constructor(){super(),this.unsubscribe=[],this.selectedExchange=me.state.selectedExchange,this.unsubscribe.push(me.subscribeKey("selectedExchange",(e=>this.selectedExchange=e)))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const t=Boolean(this.selectedExchange);return e.b`
1183
+ <wui-flex
1184
+ flexDirection="column"
1185
+ alignItems="center"
1186
+ justifyContent="center"
1187
+ gap="3"
1188
+ class="disabled-container"
1189
+ >
1190
+ <wui-icon name="coins" color="default" size="inherit"></wui-icon>
1191
+
1192
+ <wui-text variant="md-regular" color="primary" align="center">
1193
+ You don't have enough funds to complete this transaction
1194
+ </wui-text>
1195
+
1196
+ ${t?null:e.b`<wui-button
1197
+ size="md"
1198
+ variant="neutral-secondary"
1199
+ @click=${this.dispatchConnectOtherWalletEvent.bind(this)}
1200
+ >Connect other wallet</wui-button
1201
+ >`}
1202
+ </wui-flex>
1203
+ `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}};Be.styles=[De],Le([t.n({type:Array})],Be.prototype,"selectedExchange",void 0),Be=Le([t.customElement("w3m-pay-options-empty")],Be);var ze=e.css`
1204
+ :host {
1205
+ display: block;
1206
+ width: 100%;
1207
+ }
1208
+
1209
+ .pay-options-container {
1210
+ max-height: 196px;
1211
+ overflow-y: auto;
1212
+ overflow-x: hidden;
1213
+ scrollbar-width: none;
1214
+ }
1215
+
1216
+ .pay-options-container::-webkit-scrollbar {
1217
+ display: none;
1218
+ }
1219
+
1220
+ .pay-option-container {
1221
+ border-radius: ${({borderRadius:e})=>e[4]};
1222
+ padding: ${({spacing:e})=>e[3]};
1223
+ min-height: 60px;
1224
+ }
1225
+
1226
+ .token-images-container {
1227
+ position: relative;
1228
+ justify-content: center;
1229
+ align-items: center;
1230
+ }
1231
+
1232
+ .chain-image {
1233
+ position: absolute;
1234
+ bottom: -3px;
1235
+ right: -5px;
1236
+ border: 2px solid ${({tokens:e})=>e.theme.foregroundSecondary};
1237
+ }
1238
+ `,je=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let Fe=class extends e.i{render(){return e.b`
1239
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
1240
+ ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()}
1241
+ </wui-flex>
1242
+ `}renderOptionEntry(){return e.b`
1243
+ <wui-flex
1244
+ alignItems="center"
1245
+ justifyContent="space-between"
1246
+ gap="2"
1247
+ class="pay-option-container"
1248
+ >
1249
+ <wui-flex alignItems="center" gap="2">
1250
+ <wui-flex class="token-images-container">
1251
+ <wui-shimmer
1252
+ width="32px"
1253
+ height="32px"
1254
+ rounded
1255
+ variant="light"
1256
+ class="token-image"
1257
+ ></wui-shimmer>
1258
+ <wui-shimmer
1259
+ width="16px"
1260
+ height="16px"
1261
+ rounded
1262
+ variant="light"
1263
+ class="chain-image"
1264
+ ></wui-shimmer>
1265
+ </wui-flex>
1266
+
1267
+ <wui-flex flexDirection="column" gap="1">
1268
+ <wui-shimmer
1269
+ width="74px"
1270
+ height="16px"
1271
+ borderRadius="4xs"
1272
+ variant="light"
1273
+ ></wui-shimmer>
1274
+ <wui-shimmer
1275
+ width="46px"
1276
+ height="14px"
1277
+ borderRadius="4xs"
1278
+ variant="light"
1279
+ ></wui-shimmer>
1280
+ </wui-flex>
1281
+ </wui-flex>
1282
+ </wui-flex>
1283
+ `}};Fe.styles=[ze],Fe=je([t.customElement("w3m-pay-options-skeleton")],Fe);var qe=e.css`
1284
+ :host {
1285
+ display: block;
1286
+ width: 100%;
1287
+ }
1288
+
1289
+ .pay-options-container {
1290
+ max-height: 196px;
1291
+ overflow-y: auto;
1292
+ overflow-x: hidden;
1293
+ scrollbar-width: none;
1294
+ mask-image: var(--options-mask-image);
1295
+ -webkit-mask-image: var(--options-mask-image);
1296
+ }
1297
+
1298
+ .pay-options-container::-webkit-scrollbar {
1299
+ display: none;
1300
+ }
1301
+
1302
+ .pay-option-container {
1303
+ cursor: pointer;
1304
+ border-radius: ${({borderRadius:e})=>e[4]};
1305
+ padding: ${({spacing:e})=>e[3]};
1306
+ transition: background-color ${({durations:e})=>e.lg}
1307
+ ${({easings:e})=>e["ease-out-power-1"]};
1308
+ will-change: background-color;
1309
+ }
1310
+
1311
+ .token-images-container {
1312
+ position: relative;
1313
+ justify-content: center;
1314
+ align-items: center;
1315
+ }
1316
+
1317
+ .token-image {
1318
+ border-radius: ${({borderRadius:e})=>e.round};
1319
+ width: 32px;
1320
+ height: 32px;
1321
+ }
1322
+
1323
+ .chain-image {
1324
+ position: absolute;
1325
+ width: 16px;
1326
+ height: 16px;
1327
+ bottom: -3px;
1328
+ right: -5px;
1329
+ border-radius: ${({borderRadius:e})=>e.round};
1330
+ border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
1331
+ }
1332
+
1333
+ @media (hover: hover) and (pointer: fine) {
1334
+ .pay-option-container:hover {
1335
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1336
+ }
1337
+ }
1338
+ `,Me=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let He=class extends e.i{constructor(){super(),this.unsubscribe=[],this.options=[],this.selectedPaymentAsset=null}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),this.resizeObserver?.disconnect();const e=this.shadowRoot?.querySelector(".pay-options-container");e?.removeEventListener("scroll",this.handleOptionsListScroll.bind(this))}firstUpdated(){const e=this.shadowRoot?.querySelector(".pay-options-container");e&&(requestAnimationFrame(this.handleOptionsListScroll.bind(this)),e?.addEventListener("scroll",this.handleOptionsListScroll.bind(this)),this.resizeObserver=new ResizeObserver((()=>{this.handleOptionsListScroll()})),this.resizeObserver?.observe(e),this.handleOptionsListScroll())}render(){return e.b`
1339
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
1340
+ ${this.options.map((e=>this.payOptionTemplate(e)))}
1341
+ </wui-flex>
1342
+ `}payOptionTemplate(o){const{network:r,metadata:i,asset:n,amount:a="0"}=o,s=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===r)),c=`${r}:${n}`===`${this.selectedPaymentAsset?.network}:${this.selectedPaymentAsset?.asset}`,l=e.NumberUtil.bigNumber(a,{safe:!0}),u=l.gt(0);return e.b`
1343
+ <wui-flex
1344
+ alignItems="center"
1345
+ justifyContent="space-between"
1346
+ gap="2"
1347
+ @click=${()=>this.onSelect?.(o)}
1348
+ class="pay-option-container"
1349
+ >
1350
+ <wui-flex alignItems="center" gap="2">
1351
+ <wui-flex class="token-images-container">
1352
+ <wui-image
1353
+ src=${t.o(i.logoURI)}
1354
+ class="token-image"
1355
+ size="3xl"
1356
+ ></wui-image>
1357
+ <wui-image
1358
+ src=${t.o(e.AssetUtil.getNetworkImage(s))}
1359
+ class="chain-image"
1360
+ size="md"
1361
+ ></wui-image>
1362
+ </wui-flex>
1363
+
1364
+ <wui-flex flexDirection="column" gap="1">
1365
+ <wui-text variant="lg-regular" color="primary">${i.symbol}</wui-text>
1366
+ ${u?e.b`<wui-text variant="sm-regular" color="secondary">
1367
+ ${l.round(6).toString()} ${i.symbol}
1368
+ </wui-text>`:null}
1369
+ </wui-flex>
1370
+ </wui-flex>
1371
+
1372
+ ${c?e.b`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null}
1373
+ </wui-flex>
1374
+ `}handleOptionsListScroll(){const e=this.shadowRoot?.querySelector(".pay-options-container");if(!e)return;e.scrollHeight>300?(e.style.setProperty("--options-mask-image","linear-gradient(\n to bottom,\n rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px,\n rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px,\n black 50px,\n black calc(100% - 50px),\n rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px),\n rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100%\n )"),e.style.setProperty("--options-scroll--top-opacity",p.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--options-scroll--bottom-opacity",p.interpolate([0,50],[0,1],e.scrollHeight-e.scrollTop-e.offsetHeight).toString())):(e.style.setProperty("--options-mask-image","none"),e.style.setProperty("--options-scroll--top-opacity","0"),e.style.setProperty("--options-scroll--bottom-opacity","0"))}};He.styles=[qe],Me([t.n({type:Array})],He.prototype,"options",void 0),Me([t.n()],He.prototype,"selectedPaymentAsset",void 0),Me([t.n()],He.prototype,"onSelect",void 0),He=Me([t.customElement("w3m-pay-options")],He);var Ve=e.css`
1375
+ .payment-methods-container {
1376
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1377
+ border-top-right-radius: ${({borderRadius:e})=>e[5]};
1378
+ border-top-left-radius: ${({borderRadius:e})=>e[5]};
1379
+ }
1380
+
1381
+ .pay-options-container {
1382
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
1383
+ border-radius: ${({borderRadius:e})=>e[5]};
1384
+ padding: ${({spacing:e})=>e[1]};
1385
+ }
1386
+
1387
+ w3m-tooltip-trigger {
1388
+ display: flex;
1389
+ align-items: center;
1390
+ justify-content: center;
1391
+ max-width: fit-content;
1392
+ }
1393
+
1394
+ wui-image {
1395
+ border-radius: ${({borderRadius:e})=>e.round};
1396
+ }
1397
+
1398
+ w3m-pay-options.disabled {
1399
+ opacity: 0.5;
1400
+ pointer-events: none;
1401
+ }
1402
+ `,Ge=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};const Ke={eip155:{icon:"ethereum",label:"EVM"},solana:{icon:"solana",label:"Solana"},bip122:{icon:"bitcoin",label:"Bitcoin"},ton:{icon:"ton",label:"Ton"}};let Ye=class extends e.i{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=me.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=me.state.amount,this.recipient=me.state.recipient,this.activeConnectorIds=e.ConnectorController.state.activeConnectorIds,this.selectedPaymentAsset=me.state.selectedPaymentAsset,this.selectedExchange=me.state.selectedExchange,this.isFetchingQuote=me.state.isFetchingQuote,this.quoteError=me.state.quoteError,this.quote=me.state.quote,this.isFetchingTokenBalances=me.state.isFetchingTokenBalances,this.tokenBalances=me.state.tokenBalances,this.isPaymentInProgress=me.state.isPaymentInProgress,this.exchangeUrlForQuote=me.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(me.subscribeKey("paymentAsset",(e=>this.paymentAsset=e))),this.unsubscribe.push(me.subscribeKey("tokenBalances",(e=>this.onTokenBalancesChanged(e)))),this.unsubscribe.push(me.subscribeKey("isFetchingTokenBalances",(e=>this.isFetchingTokenBalances=e))),this.unsubscribe.push(e.ConnectorController.subscribeKey("activeConnectorIds",(e=>this.activeConnectorIds=e))),this.unsubscribe.push(me.subscribeKey("selectedPaymentAsset",(e=>this.selectedPaymentAsset=e))),this.unsubscribe.push(me.subscribeKey("isFetchingQuote",(e=>this.isFetchingQuote=e))),this.unsubscribe.push(me.subscribeKey("quoteError",(e=>this.quoteError=e))),this.unsubscribe.push(me.subscribeKey("quote",(e=>this.quote=e))),this.unsubscribe.push(me.subscribeKey("amount",(e=>this.amount=e))),this.unsubscribe.push(me.subscribeKey("recipient",(e=>this.recipient=e))),this.unsubscribe.push(me.subscribeKey("isPaymentInProgress",(e=>this.isPaymentInProgress=e))),this.unsubscribe.push(me.subscribeKey("selectedExchange",(e=>this.selectedExchange=e))),this.unsubscribe.push(me.subscribeKey("exchangeUrlForQuote",(e=>this.exchangeUrlForQuote=e))),this.resetQuoteState(),this.initializeNamespace(),this.fetchTokens()}disconnectedCallback(){super.disconnectedCallback(),this.resetAssetsState(),this.unsubscribe.forEach((e=>e()))}updated(e){super.updated(e);e.has("selectedPaymentAsset")&&this.fetchQuote()}render(){return e.b`
1403
+ <wui-flex flexDirection="column">
1404
+ ${this.profileTemplate()}
1405
+
1406
+ <wui-flex
1407
+ flexDirection="column"
1408
+ gap="4"
1409
+ class="payment-methods-container"
1410
+ .padding=${["4","4","5","4"]}
1411
+ >
1412
+ ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()}
1413
+
1414
+ <wui-flex
1415
+ alignItems="center"
1416
+ justifyContent="space-between"
1417
+ .padding=${["1","0","1","0"]}
1418
+ >
1419
+ <wui-separator></wui-separator>
1420
+ </wui-flex>
1421
+
1422
+ ${this.paymentActionsTemplate()}
1423
+ </wui-flex>
1424
+ </wui-flex>
1425
+ `}profileTemplate(){if(this.selectedExchange){const t=e.NumberUtil.formatNumber(this.quote?.origin.amount,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return e.b`
1426
+ <wui-flex
1427
+ .padding=${["4","3","4","3"]}
1428
+ alignItems="center"
1429
+ justifyContent="space-between"
1430
+ gap="2"
1431
+ >
1432
+ <wui-text variant="lg-regular" color="secondary">Paying with</wui-text>
1433
+
1434
+ ${this.quote?e.b`<wui-text variant="lg-regular" color="primary">
1435
+ ${e.NumberUtil.bigNumber(t,{safe:!0}).round(6).toString()}
1436
+ ${this.quote.origin.currency.metadata.symbol}
1437
+ </wui-text>`:e.b`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`}
1438
+ </wui-flex>
1439
+ `}const o=e.CoreHelperUtil.getPlainAddress(this.caipAddress)??"",{name:r,image:i}=this.getWalletProperties({namespace:this.namespace}),{icon:n,label:a}=Ke[this.namespace]??{};return e.b`
1440
+ <wui-flex
1441
+ .padding=${["4","3","4","3"]}
1442
+ alignItems="center"
1443
+ justifyContent="space-between"
1444
+ gap="2"
1445
+ >
1446
+ <wui-wallet-switch
1447
+ profileName=${t.o(this.profileName)}
1448
+ address=${t.o(o)}
1449
+ imageSrc=${t.o(i)}
1450
+ alt=${t.o(r)}
1451
+ @click=${this.onConnectOtherWallet.bind(this)}
1452
+ data-testid="wui-wallet-switch"
1453
+ ></wui-wallet-switch>
1454
+
1455
+ <wui-wallet-switch
1456
+ profileName=${t.o(a)}
1457
+ address=${t.o(o)}
1458
+ icon=${t.o(n)}
1459
+ iconSize="xs"
1460
+ .enableGreenCircle=${!1}
1461
+ alt=${t.o(a)}
1462
+ @click=${this.onConnectOtherWallet.bind(this)}
1463
+ data-testid="wui-wallet-switch"
1464
+ ></wui-wallet-switch>
1465
+ </wui-flex>
1466
+ `}initializeNamespace(){const t=e.ChainController.state.activeChain;this.namespace=t,this.caipAddress=e.ChainController.getAccountData(t)?.caipAddress,this.profileName=e.ChainController.getAccountData(t)?.profileName??null,this.unsubscribe.push(e.ChainController.subscribeChainProp("accountState",(e=>this.onAccountStateChanged(e)),t))}async fetchTokens(){if(this.namespace){let t;if(this.caipAddress){const{chainId:o,chainNamespace:r}=e.ParseUtil.parseCaipAddress(this.caipAddress),i=`${r}:${o}`;t=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===i))}await me.fetchTokens({caipAddress:this.caipAddress,caipNetwork:t,namespace:this.namespace})}}fetchQuote(){if(this.amount&&this.recipient&&this.selectedPaymentAsset&&this.paymentAsset){const{address:t}=this.caipAddress?e.ParseUtil.parseCaipAddress(this.caipAddress):{};me.fetchQuote({amount:this.amount.toString(),address:t,sourceToken:this.selectedPaymentAsset,toToken:this.paymentAsset,recipient:this.recipient})}}getWalletProperties({namespace:t}){if(!t)return{name:void 0,image:void 0};const o=this.activeConnectorIds[t];if(!o)return{name:void 0,image:void 0};const r=e.ConnectorController.getConnector({id:o,namespace:t});if(!r)return{name:void 0,image:void 0};const i=e.AssetUtil.getConnectorImage(r);return{name:r.name,image:i}}paymentOptionsViewTemplate(){return e.b`
1467
+ <wui-flex flexDirection="column" gap="2">
1468
+ <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text>
1469
+ <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex>
1470
+ </wui-flex>
1471
+ `}paymentOptionsTemplate(){const o=this.getPaymentAssetFromTokenBalances();if(this.isFetchingTokenBalances)return e.b`<w3m-pay-options-skeleton></w3m-pay-options-skeleton>`;if(0===o.length)return e.b`<w3m-pay-options-empty
1472
+ @connectOtherWallet=${this.onConnectOtherWallet.bind(this)}
1473
+ ></w3m-pay-options-empty>`;const r={disabled:this.isFetchingQuote};return e.b`<w3m-pay-options
1474
+ class=${t.e$1(r)}
1475
+ .options=${o}
1476
+ .selectedPaymentAsset=${t.o(this.selectedPaymentAsset)}
1477
+ .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)}
1478
+ ></w3m-pay-options>`}amountWithFeeTemplate(){return this.isFetchingQuote||!this.selectedPaymentAsset||this.quoteError?e.b`<w3m-pay-fees-skeleton></w3m-pay-fees-skeleton>`:e.b`<w3m-pay-fees></w3m-pay-fees>`}paymentActionsTemplate(){const t=this.isFetchingQuote||this.isFetchingTokenBalances,o=this.isFetchingQuote||this.isFetchingTokenBalances||!this.selectedPaymentAsset||Boolean(this.quoteError),r=e.NumberUtil.formatNumber(this.quote?.origin.amount??0,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return this.selectedExchange?t||o?e.b`
1479
+ <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer>
1480
+ `:e.b`<wui-button
1481
+ size="lg"
1482
+ fullWidth
1483
+ variant="accent-secondary"
1484
+ @click=${this.onPayWithExchange.bind(this)}
1485
+ >
1486
+ ${`Continue in ${this.selectedExchange.name}`}
1487
+
1488
+ <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon>
1489
+ </wui-button>`:e.b`
1490
+ <wui-flex alignItems="center" justifyContent="space-between">
1491
+ <wui-flex flexDirection="column" gap="1">
1492
+ <wui-text variant="md-regular" color="secondary">Order Total</wui-text>
1493
+
1494
+ ${t||o?e.b`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:e.b`<wui-flex alignItems="center" gap="01">
1495
+ <wui-text variant="h4-regular" color="primary">${ce(r)}</wui-text>
1496
+
1497
+ <wui-text variant="lg-regular" color="secondary">
1498
+ ${this.quote?.origin.currency.metadata.symbol||"Unknown"}
1499
+ </wui-text>
1500
+ </wui-flex>`}
1501
+ </wui-flex>
1502
+
1503
+ ${this.actionButtonTemplate({isLoading:t,isDisabled:o})}
1504
+ </wui-flex>
1505
+ `}actionButtonTemplate(t){const o=Q(this.quote),{isLoading:r,isDisabled:i}=t;let n="Pay";return o.length>1&&0===this.completedTransactionsCount&&(n="Approve"),e.b`
1506
+ <wui-button
1507
+ size="lg"
1508
+ variant="accent-primary"
1509
+ ?loading=${r||this.isPaymentInProgress}
1510
+ ?disabled=${i||this.isPaymentInProgress}
1511
+ @click=${()=>{o.length>0?this.onSendTransactions():this.onTransfer()}}
1512
+ >
1513
+ ${n}
1514
+ ${r?null:e.b`<wui-icon
1515
+ name="arrowRight"
1516
+ color="inherit"
1517
+ size="sm"
1518
+ slot="iconRight"
1519
+ ></wui-icon>`}
1520
+ </wui-button>
1521
+ `}getPaymentAssetFromTokenBalances(){if(!this.namespace)return[];return(this.tokenBalances[this.namespace]??[]).map((t=>{try{return function(t){const o=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===t.chainId));let r=t.address;if(!o)throw new Error(`Target network not found for balance chainId "${t.chainId}"`);if(e.HelpersUtil.isLowerCaseMatch(t.symbol,o.nativeCurrency.symbol))r="native";else if(e.CoreHelperUtil.isCaipAddress(r)){const{address:t}=e.ParseUtil.parseCaipAddress(r);r=t}else if(!r)throw new Error(`Balance address not found for balance symbol "${t.symbol}"`);return{network:o.caipNetworkId,asset:r,metadata:{name:t.name,symbol:t.symbol,decimals:Number(t.quantity.decimals),logoURI:t.iconUrl},amount:t.quantity.numeric}}(t)}catch(e){return null}})).filter((e=>Boolean(e))).filter((t=>{const{chainId:o}=e.ParseUtil.parseCaipNetworkId(t.network),{chainId:r}=e.ParseUtil.parseCaipNetworkId(this.paymentAsset.network);return!!e.HelpersUtil.isLowerCaseMatch(t.asset,this.paymentAsset.asset)||(!this.selectedExchange||!e.HelpersUtil.isLowerCaseMatch(o.toString(),r.toString()))}))}onTokenBalancesChanged(e){this.tokenBalances=e;const[t]=this.getPaymentAssetFromTokenBalances();t&&me.setSelectedPaymentAsset(t)}async onConnectOtherWallet(){await e.ConnectorController.connect(),await e.ModalController.open({view:"PayQuote"})}onAccountStateChanged(t){const{address:o}=this.caipAddress?e.ParseUtil.parseCaipAddress(this.caipAddress):{};if(this.caipAddress=t?.caipAddress,this.profileName=t?.profileName??null,o){const{address:t}=this.caipAddress?e.ParseUtil.parseCaipAddress(this.caipAddress):{};t?e.HelpersUtil.isLowerCaseMatch(t,o)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):e.ModalController.close()}}onSelectedPaymentAssetChanged(e){this.isFetchingQuote||me.setSelectedPaymentAsset(e)}async onTransfer(){const t=Y(this.quote);if(t){if(!e.HelpersUtil.isLowerCaseMatch(this.selectedPaymentAsset?.asset,t.deposit.currency))throw new Error("Quote asset is not the same as the selected payment asset");const o=this.selectedPaymentAsset?.amount??"0",r=e.NumberUtil.formatNumber(t.deposit.amount,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!e.NumberUtil.bigNumber(o).gte(r))return void e.SnackController.showError("Insufficient funds");if(this.quote&&this.selectedPaymentAsset&&this.caipAddress&&this.namespace){const{address:o}=e.ParseUtil.parseCaipAddress(this.caipAddress);await me.onTransfer({chainNamespace:this.namespace,fromAddress:o,toAddress:t.deposit.receiver,amount:r,paymentAsset:this.selectedPaymentAsset}),me.setRequestId(t.requestId),e.RouterController.push("PayLoading")}}}async onSendTransactions(){const t=this.selectedPaymentAsset?.amount??"0",o=e.NumberUtil.formatNumber(this.quote?.origin.amount??0,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!e.NumberUtil.bigNumber(t).gte(o))return void e.SnackController.showError("Insufficient funds");const r=Q(this.quote),[i]=Q(this.quote,this.completedTransactionsCount);if(i&&this.namespace){await me.onSendTransaction({namespace:this.namespace,transactionStep:i}),this.completedTransactionsCount+=1;this.completedTransactionsCount===r.length&&(me.setRequestId(i.requestId),e.RouterController.push("PayLoading"))}}onPayWithExchange(){if(this.exchangeUrlForQuote){const t=e.CoreHelperUtil.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!t)throw new Error("Could not create popup window");t.location.href=this.exchangeUrlForQuote;const o=Y(this.quote);o&&me.setRequestId(o.requestId),me.initiatePayment(),e.RouterController.push("PayLoading")}}resetAssetsState(){me.setSelectedPaymentAsset(null)}resetQuoteState(){me.resetQuoteState()}};Ye.styles=Ve,Ge([t.r()],Ye.prototype,"profileName",void 0),Ge([t.r()],Ye.prototype,"paymentAsset",void 0),Ge([t.r()],Ye.prototype,"namespace",void 0),Ge([t.r()],Ye.prototype,"caipAddress",void 0),Ge([t.r()],Ye.prototype,"amount",void 0),Ge([t.r()],Ye.prototype,"recipient",void 0),Ge([t.r()],Ye.prototype,"activeConnectorIds",void 0),Ge([t.r()],Ye.prototype,"selectedPaymentAsset",void 0),Ge([t.r()],Ye.prototype,"selectedExchange",void 0),Ge([t.r()],Ye.prototype,"isFetchingQuote",void 0),Ge([t.r()],Ye.prototype,"quoteError",void 0),Ge([t.r()],Ye.prototype,"quote",void 0),Ge([t.r()],Ye.prototype,"isFetchingTokenBalances",void 0),Ge([t.r()],Ye.prototype,"tokenBalances",void 0),Ge([t.r()],Ye.prototype,"isPaymentInProgress",void 0),Ge([t.r()],Ye.prototype,"exchangeUrlForQuote",void 0),Ge([t.r()],Ye.prototype,"completedTransactionsCount",void 0),Ye=Ge([t.customElement("w3m-pay-quote-view")],Ye);var Qe=e.css`
1522
+ wui-image {
1523
+ border-radius: ${({borderRadius:e})=>e.round};
1524
+ }
1525
+
1526
+ .transfers-badge {
1527
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1528
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary};
1529
+ border-radius: ${({borderRadius:e})=>e[4]};
1530
+ }
1531
+ `,Xe=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let Ze=class extends e.i{constructor(){super(),this.unsubscribe=[],this.paymentAsset=me.state.paymentAsset,this.amount=me.state.amount,this.unsubscribe.push(me.subscribeKey("paymentAsset",(e=>{this.paymentAsset=e})),me.subscribeKey("amount",(e=>{this.amount=e})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const o=e.ChainController.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===this.paymentAsset.network));return e.b`<wui-flex
1532
+ alignItems="center"
1533
+ gap="1"
1534
+ .padding=${["1","2","1","1"]}
1535
+ class="transfers-badge"
1536
+ >
1537
+ <wui-image src=${t.o(this.paymentAsset.metadata.logoURI)} size="xl"></wui-image>
1538
+ <wui-text variant="lg-regular" color="primary">
1539
+ ${this.amount} ${this.paymentAsset.metadata.symbol}
1540
+ </wui-text>
1541
+ <wui-text variant="sm-regular" color="secondary">
1542
+ on ${o?.name??"Unknown"}
1543
+ </wui-text>
1544
+ </wui-flex>`}};Ze.styles=[Qe],Xe([t.n()],Ze.prototype,"paymentAsset",void 0),Xe([t.n()],Ze.prototype,"amount",void 0),Ze=Xe([t.customElement("w3m-pay-header")],Ze);var Je=e.css`
1545
+ :host {
1546
+ height: 60px;
1547
+ }
1548
+
1549
+ :host > wui-flex {
1550
+ box-sizing: border-box;
1551
+ background-color: var(--local-header-background-color);
1552
+ }
1553
+
1554
+ wui-text {
1555
+ background-color: var(--local-header-background-color);
1556
+ }
1557
+
1558
+ wui-flex.w3m-header-title {
1559
+ transform: translateY(0);
1560
+ opacity: 1;
1561
+ }
1562
+
1563
+ wui-flex.w3m-header-title[view-direction='prev'] {
1564
+ animation:
1565
+ slide-down-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]},
1566
+ slide-down-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]};
1567
+ animation-delay: 0ms, 200ms;
1568
+ }
1569
+
1570
+ wui-flex.w3m-header-title[view-direction='next'] {
1571
+ animation:
1572
+ slide-up-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]},
1573
+ slide-up-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]};
1574
+ animation-delay: 0ms, 200ms;
1575
+ }
1576
+
1577
+ wui-icon-button[data-hidden='true'] {
1578
+ opacity: 0 !important;
1579
+ pointer-events: none;
1580
+ }
1581
+
1582
+ @keyframes slide-up-out {
1583
+ from {
1584
+ transform: translateY(0px);
1585
+ opacity: 1;
1586
+ }
1587
+ to {
1588
+ transform: translateY(3px);
1589
+ opacity: 0;
1590
+ }
1591
+ }
1592
+
1593
+ @keyframes slide-up-in {
1594
+ from {
1595
+ transform: translateY(-3px);
1596
+ opacity: 0;
1597
+ }
1598
+ to {
1599
+ transform: translateY(0);
1600
+ opacity: 1;
1601
+ }
1602
+ }
1603
+
1604
+ @keyframes slide-down-out {
1605
+ from {
1606
+ transform: translateY(0px);
1607
+ opacity: 1;
1608
+ }
1609
+ to {
1610
+ transform: translateY(-3px);
1611
+ opacity: 0;
1612
+ }
1613
+ }
1614
+
1615
+ @keyframes slide-down-in {
1616
+ from {
1617
+ transform: translateY(3px);
1618
+ opacity: 0;
1619
+ }
1620
+ to {
1621
+ transform: translateY(0);
1622
+ opacity: 1;
1623
+ }
1624
+ }
1625
+ `,et=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};const tt=["SmartSessionList"],ot={PayWithExchange:e.vars.tokens.theme.foregroundPrimary};function rt(){const t=e.RouterController.state.data?.connector?.name,o=e.RouterController.state.data?.wallet?.name,r=e.RouterController.state.data?.network?.name,i=o??t,n=e.ConnectorController.getConnectors(),a=1===n.length&&"w3m-email"===n[0]?.id,s=e.ChainController.getAccountData()?.socialProvider;return{Connect:`Connect ${a?"Email":""} Wallet`,Create:"Create Wallet",ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",UsageExceeded:"Usage Exceeded",ConnectingExternal:i??"Connect Wallet",ConnectingWalletConnect:i??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview Convert",Downloads:i?`Get ${i}`:"Downloads",EmailLogin:"Email Login",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a Wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Pay:"How you pay",ProfileWallets:"Wallets",SwitchNetwork:r??"Switch Network",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade Your Wallet",UpdateEmailWallet:"Edit Email",UpdateEmailPrimaryOtp:"Confirm Current Email",UpdateEmailSecondaryOtp:"Confirm New Email",WhatIsABuy:"What is Buy?",RegisterAccountName:"Choose Name",RegisterAccountNameSuccess:"",WalletReceive:"Receive",WalletCompatibleNetworks:"Compatible Networks",Swap:"Swap",SwapSelectToken:"Select Token",SwapPreview:"Preview Swap",WalletSend:"Send",WalletSendPreview:"Review Send",WalletSendSelectToken:"Select Token",WalletSendConfirmed:"Confirmed",WhatIsANetwork:"What is a network?",WhatIsAWallet:"What is a Wallet?",ConnectWallets:"Connect Wallet",ConnectSocials:"All Socials",ConnectingSocial:s?s.charAt(0).toUpperCase()+s.slice(1):"Connect Social",ConnectingMultiChain:"Select Chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch Chain",SmartSessionCreated:void 0,SmartSessionList:"Smart Sessions",SIWXSignMessage:"Sign In",PayLoading:"Processing payment...",PayQuote:"Payment Quote",DataCapture:"Profile",DataCaptureOtpConfirm:"Confirm Email",FundWallet:"Fund Wallet",PayWithExchange:"Deposit from Exchange",PayWithExchangeSelectAsset:"Select Asset",SmartAccountSettings:"Smart Account Settings"}}let it=class extends e.i{constructor(){super(),this.unsubscribe=[],this.heading=rt()[e.RouterController.state.view],this.network=e.ChainController.state.activeCaipNetwork,this.networkImage=e.AssetUtil.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=e.RouterController.state.view,this.viewDirection="",this.unsubscribe.push(e.AssetController.subscribeNetworkImages((()=>{this.networkImage=e.AssetUtil.getNetworkImage(this.network)})),e.RouterController.subscribeKey("view",(e=>{setTimeout((()=>{this.view=e,this.heading=rt()[e]}),R.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()})),e.ChainController.subscribeKey("activeCaipNetwork",(t=>{this.network=t,this.networkImage=e.AssetUtil.getNetworkImage(this.network)})))}disconnectCallback(){this.unsubscribe.forEach((e=>e()))}render(){const t=ot[e.RouterController.state.view]??e.vars.tokens.theme.backgroundPrimary;return this.style.setProperty("--local-header-background-color",t),e.b`
1626
+ <wui-flex
1627
+ .padding=${["0","4","0","4"]}
1628
+ justifyContent="space-between"
1629
+ alignItems="center"
1630
+ >
1631
+ ${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()}
1632
+ </wui-flex>
1633
+ `}onWalletHelp(){e.EventsController.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),e.RouterController.push("WhatIsAWallet")}async onClose(){await d.safeClose()}rightHeaderTemplate(){const t=e.OptionsController?.state?.features?.smartSessions;return"Account"===e.RouterController.state.view&&t?e.b`<wui-flex>
1634
+ <wui-icon-button
1635
+ icon="clock"
1636
+ size="lg"
1637
+ iconSize="lg"
1638
+ type="neutral"
1639
+ variant="primary"
1640
+ @click=${()=>e.RouterController.push("SmartSessionList")}
1641
+ data-testid="w3m-header-smart-sessions"
1642
+ ></wui-icon-button>
1643
+ ${this.closeButtonTemplate()}
1644
+ </wui-flex> `:this.closeButtonTemplate()}closeButtonTemplate(){return e.b`
1645
+ <wui-icon-button
1646
+ icon="close"
1647
+ size="lg"
1648
+ type="neutral"
1649
+ variant="primary"
1650
+ iconSize="lg"
1651
+ @click=${this.onClose.bind(this)}
1652
+ data-testid="w3m-header-close"
1653
+ ></wui-icon-button>
1654
+ `}titleTemplate(){if("PayQuote"===this.view)return e.b`<w3m-pay-header></w3m-pay-header>`;const t=tt.includes(this.view);return e.b`
1655
+ <wui-flex
1656
+ view-direction="${this.viewDirection}"
1657
+ class="w3m-header-title"
1658
+ alignItems="center"
1659
+ gap="2"
1660
+ >
1661
+ <wui-text
1662
+ display="inline"
1663
+ variant="lg-regular"
1664
+ color="primary"
1665
+ data-testid="w3m-header-text"
1666
+ >
1667
+ ${this.heading}
1668
+ </wui-text>
1669
+ ${t?e.b`<wui-tag variant="accent" size="md">Beta</wui-tag>`:null}
1670
+ </wui-flex>
1671
+ `}leftHeaderTemplate(){const{view:o}=e.RouterController.state,r="Connect"===o,i=e.OptionsController.state.enableEmbedded,n="ApproveTransaction"===o,a="ConnectingSiwe"===o,s="Account"===o,c=e.OptionsController.state.enableNetworkSwitch,l=n||a||r&&i;return s&&c?e.b`<wui-select
1672
+ id="dynamic"
1673
+ data-testid="w3m-account-select-network"
1674
+ active-network=${t.o(this.network?.name)}
1675
+ @click=${this.onNetworks.bind(this)}
1676
+ imageSrc=${t.o(this.networkImage)}
1677
+ ></wui-select>`:this.showBack&&!l?e.b`<wui-icon-button
1678
+ data-testid="header-back"
1679
+ id="dynamic"
1680
+ icon="chevronLeft"
1681
+ size="lg"
1682
+ iconSize="lg"
1683
+ type="neutral"
1684
+ variant="primary"
1685
+ @click=${this.onGoBack.bind(this)}
1686
+ ></wui-icon-button>`:e.b`<wui-icon-button
1687
+ data-hidden=${!r}
1688
+ id="dynamic"
1689
+ icon="helpCircle"
1690
+ size="lg"
1691
+ iconSize="lg"
1692
+ type="neutral"
1693
+ variant="primary"
1694
+ @click=${this.onWalletHelp.bind(this)}
1695
+ ></wui-icon-button>`}onNetworks(){this.isAllowedNetworkSwitch()&&(e.EventsController.sendEvent({type:"track",event:"CLICK_NETWORKS"}),e.RouterController.push("Networks"))}isAllowedNetworkSwitch(){const t=e.ChainController.getAllRequestedCaipNetworks(),o=!!t&&t.length>1,r=t?.find((({id:e})=>e===this.network?.id));return o||!r}onViewChange(){const{history:t}=e.RouterController.state;let o=R.VIEW_DIRECTION.Next;t.length<this.prevHistoryLength&&(o=R.VIEW_DIRECTION.Prev),this.prevHistoryLength=t.length,this.viewDirection=o}async onHistoryChange(){const{history:t}=e.RouterController.state,o=this.shadowRoot?.querySelector("#dynamic");t.length>1&&!this.showBack&&o?(await o.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,o.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):t.length<=1&&this.showBack&&o&&(await o.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,o.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){e.RouterController.goBack()}};it.styles=Je,et([t.r()],it.prototype,"heading",void 0),et([t.r()],it.prototype,"network",void 0),et([t.r()],it.prototype,"networkImage",void 0),et([t.r()],it.prototype,"showBack",void 0),et([t.r()],it.prototype,"prevHistoryLength",void 0),et([t.r()],it.prototype,"view",void 0),et([t.r()],it.prototype,"viewDirection",void 0),it=et([t.customElement("w3m-header")],it);var nt=e.css`
1696
+ :host {
1697
+ display: flex;
1698
+ align-items: center;
1699
+ gap: ${({spacing:e})=>e[1]};
1700
+ padding: ${({spacing:e})=>e[2]} ${({spacing:e})=>e[3]}
1701
+ ${({spacing:e})=>e[2]} ${({spacing:e})=>e[2]};
1702
+ border-radius: ${({borderRadius:e})=>e[20]};
1703
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1704
+ box-shadow:
1705
+ 0px 0px 8px 0px rgba(0, 0, 0, 0.1),
1706
+ inset 0 0 0 1px ${({tokens:e})=>e.theme.borderPrimary};
1707
+ max-width: 320px;
1708
+ }
1709
+
1710
+ wui-icon-box {
1711
+ border-radius: ${({borderRadius:e})=>e.round} !important;
1712
+ overflow: hidden;
1713
+ }
1714
+
1715
+ wui-loading-spinner {
1716
+ padding: ${({spacing:e})=>e[1]};
1717
+ background-color: ${({tokens:e})=>e.core.foregroundAccent010};
1718
+ border-radius: ${({borderRadius:e})=>e.round} !important;
1719
+ }
1720
+ `,at=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let st=class extends e.i{constructor(){super(...arguments),this.message="",this.variant="success"}render(){return e.b`
1721
+ ${this.templateIcon()}
1722
+ <wui-text variant="lg-regular" color="primary" data-testid="wui-snackbar-message"
1723
+ >${this.message}</wui-text
1724
+ >
1725
+ `}templateIcon(){return"loading"===this.variant?e.b`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:e.b`<wui-icon-box
1726
+ size="md"
1727
+ color=${{success:"success",error:"error",warning:"warning",info:"default"}[this.variant]}
1728
+ icon=${{success:"checkmark",error:"warning",warning:"warningCircle",info:"info"}[this.variant]}
1729
+ ></wui-icon-box>`}};st.styles=[e.resetStyles,nt],at([t.n()],st.prototype,"message",void 0),at([t.n()],st.prototype,"variant",void 0),st=at([t.customElement("wui-snackbar")],st);var ct=e.i$1`
1730
+ :host {
1731
+ display: block;
1732
+ position: absolute;
1733
+ opacity: 0;
1734
+ pointer-events: none;
1735
+ top: 11px;
1736
+ left: 50%;
1737
+ width: max-content;
1738
+ }
1739
+ `,lt=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let ut=class extends e.i{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=e.SnackController.state.open,this.unsubscribe.push(e.SnackController.subscribeKey("open",(e=>{this.open=e,this.onOpen()})))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach((e=>e()))}render(){const{message:t,variant:o}=e.SnackController.state;return e.b` <wui-snackbar message=${t} variant=${o}></wui-snackbar> `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),e.SnackController.state.autoClose&&(this.timeout=setTimeout((()=>e.SnackController.hide()),2500))):this.animate([{opacity:1,transform:"translateX(-50%) scale(1)"},{opacity:0,transform:"translateX(-50%) scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"})}};ut.styles=ct,lt([t.r()],ut.prototype,"open",void 0),ut=lt([t.customElement("w3m-snackbar")],ut);var dt=e.i$1`
1740
+ :host {
1741
+ width: 100%;
1742
+ display: block;
1743
+ }
1744
+ `,pt=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let ht=class extends e.i{constructor(){super(),this.unsubscribe=[],this.text="",this.open=u.state.open,this.unsubscribe.push(e.RouterController.subscribeKey("view",(()=>{u.hide()})),e.ModalController.subscribeKey("open",(e=>{e||u.hide()})),u.subscribeKey("open",(e=>{this.open=e})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),u.hide()}render(){return e.b`
1745
+ <div
1746
+ @pointermove=${this.onMouseEnter.bind(this)}
1747
+ @pointerleave=${this.onMouseLeave.bind(this)}
1748
+ >
1749
+ ${this.renderChildren()}
1750
+ </div>
1751
+ `}renderChildren(){return e.b`<slot></slot> `}onMouseEnter(){const e=this.getBoundingClientRect();if(!this.open){const t=document.querySelector("w3m-modal"),o={width:e.width,height:e.height,left:e.left,top:e.top};if(t){const r=t.getBoundingClientRect();o.left=e.left-(window.innerWidth-r.width)/2,o.top=e.top-(window.innerHeight-r.height)/2}u.showTooltip({message:this.text,triggerRect:o,variant:"shade"})}}onMouseLeave(e){this.contains(e.relatedTarget)||u.hide()}};ht.styles=[dt],pt([t.n()],ht.prototype,"text",void 0),pt([t.r()],ht.prototype,"open",void 0),ht=pt([t.customElement("w3m-tooltip-trigger")],ht);var mt=e.css`
1752
+ :host {
1753
+ pointer-events: none;
1754
+ }
1755
+
1756
+ :host > wui-flex {
1757
+ display: var(--w3m-tooltip-display);
1758
+ opacity: var(--w3m-tooltip-opacity);
1759
+ padding: 9px ${({spacing:e})=>e[3]} 10px ${({spacing:e})=>e[3]};
1760
+ border-radius: ${({borderRadius:e})=>e[3]};
1761
+ color: ${({tokens:e})=>e.theme.backgroundPrimary};
1762
+ position: absolute;
1763
+ top: var(--w3m-tooltip-top);
1764
+ left: var(--w3m-tooltip-left);
1765
+ transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px));
1766
+ max-width: calc(var(--apkt-modal-width) - ${({spacing:e})=>e[5]});
1767
+ transition: opacity ${({durations:e})=>e.lg}
1768
+ ${({easings:e})=>e["ease-out-power-2"]};
1769
+ will-change: opacity;
1770
+ opacity: 0;
1771
+ animation-duration: ${({durations:e})=>e.xl};
1772
+ animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]};
1773
+ animation-name: fade-in;
1774
+ animation-fill-mode: forwards;
1775
+ }
1776
+
1777
+ :host([data-variant='shade']) > wui-flex {
1778
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1779
+ }
1780
+
1781
+ :host([data-variant='shade']) > wui-flex > wui-text {
1782
+ color: ${({tokens:e})=>e.theme.textSecondary};
1783
+ }
1784
+
1785
+ :host([data-variant='fill']) > wui-flex {
1786
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
1787
+ border: 1px solid ${({tokens:e})=>e.theme.borderPrimary};
1788
+ }
1789
+
1790
+ wui-icon {
1791
+ position: absolute;
1792
+ width: 12px !important;
1793
+ height: 4px !important;
1794
+ color: ${({tokens:e})=>e.theme.foregroundPrimary};
1795
+ }
1796
+
1797
+ wui-icon[data-placement='top'] {
1798
+ bottom: 0px;
1799
+ left: 50%;
1800
+ transform: translate(-50%, 95%);
1801
+ }
1802
+
1803
+ wui-icon[data-placement='bottom'] {
1804
+ top: 0;
1805
+ left: 50%;
1806
+ transform: translate(-50%, -95%) rotate(180deg);
1807
+ }
1808
+
1809
+ wui-icon[data-placement='right'] {
1810
+ top: 50%;
1811
+ left: 0;
1812
+ transform: translate(-65%, -50%) rotate(90deg);
1813
+ }
1814
+
1815
+ wui-icon[data-placement='left'] {
1816
+ top: 50%;
1817
+ right: 0%;
1818
+ transform: translate(65%, -50%) rotate(270deg);
1819
+ }
1820
+
1821
+ @keyframes fade-in {
1822
+ from {
1823
+ opacity: 0;
1824
+ }
1825
+ to {
1826
+ opacity: 1;
1827
+ }
1828
+ }
1829
+ `,wt=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let gt=class extends e.i{constructor(){super(),this.unsubscribe=[],this.open=u.state.open,this.message=u.state.message,this.triggerRect=u.state.triggerRect,this.variant=u.state.variant,this.unsubscribe.push(u.subscribe((e=>{this.open=e.open,this.message=e.message,this.triggerRect=e.triggerRect,this.variant=e.variant})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){this.dataset.variant=this.variant;const t=this.triggerRect.top,o=this.triggerRect.left;return this.style.cssText=`\n --w3m-tooltip-top: ${t}px;\n --w3m-tooltip-left: ${o}px;\n --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px;\n --w3m-tooltip-display: ${this.open?"flex":"none"};\n --w3m-tooltip-opacity: ${this.open?1:0};\n `,e.b`<wui-flex>
1830
+ <wui-icon data-placement="top" size="inherit" name="cursor"></wui-icon>
1831
+ <wui-text color="primary" variant="sm-regular">${this.message}</wui-text>
1832
+ </wui-flex>`}};gt.styles=[mt],wt([t.r()],gt.prototype,"open",void 0),wt([t.r()],gt.prototype,"message",void 0),wt([t.r()],gt.prototype,"triggerRect",void 0),wt([t.r()],gt.prototype,"variant",void 0),gt=wt([t.customElement("w3m-tooltip")],gt);const yt={getTabsByNamespace:t=>Boolean(t)&&t===e.ConstantsUtil.CHAIN.EVM?!1===e.OptionsController.state.remoteFeatures?.activity?R.ACCOUNT_TABS.filter((e=>"Activity"!==e.label)):R.ACCOUNT_TABS:[],isValidReownName:e=>/^[a-zA-Z0-9]+$/gu.test(e),isValidEmail:e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/gu.test(e),validateReownName:e=>e.replace(/\^/gu,"").toLowerCase().replace(/[^a-zA-Z0-9]/gu,""),hasFooter(){const t=e.RouterController.state.view;if(R.VIEWS_WITH_LEGAL_FOOTER.includes(t)){const{termsConditionsUrl:t,privacyPolicyUrl:o}=e.OptionsController.state,r=e.OptionsController.state.features?.legalCheckbox;return!(!t&&!o||r)}return R.VIEWS_WITH_DEFAULT_FOOTER.includes(t)}};var bt=e.css`
1833
+ :host wui-ux-by-reown {
1834
+ padding-top: 0;
1835
+ }
1836
+
1837
+ :host wui-ux-by-reown.branding-only {
1838
+ padding-top: ${({spacing:e})=>e[3]};
1839
+ }
1840
+
1841
+ a {
1842
+ text-decoration: none;
1843
+ color: ${({tokens:e})=>e.core.textAccentPrimary};
1844
+ font-weight: 500;
1845
+ }
1846
+ `,ft=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let vt=class extends e.i{constructor(){super(),this.unsubscribe=[],this.remoteFeatures=e.OptionsController.state.remoteFeatures,this.unsubscribe.push(e.OptionsController.subscribeKey("remoteFeatures",(e=>this.remoteFeatures=e)))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const{termsConditionsUrl:t,privacyPolicyUrl:o}=e.OptionsController.state,r=e.OptionsController.state.features?.legalCheckbox;return!t&&!o||r?e.b`
1847
+ <wui-flex flexDirection="column"> ${this.reownBrandingTemplate(!0)} </wui-flex>
1848
+ `:e.b`
1849
+ <wui-flex flexDirection="column">
1850
+ <wui-flex .padding=${["4","3","3","3"]} justifyContent="center">
1851
+ <wui-text color="secondary" variant="md-regular" align="center">
1852
+ By connecting your wallet, you agree to our <br />
1853
+ ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()}
1854
+ </wui-text>
1855
+ </wui-flex>
1856
+ ${this.reownBrandingTemplate()}
1857
+ </wui-flex>
1858
+ `}andTemplate(){const{termsConditionsUrl:t,privacyPolicyUrl:o}=e.OptionsController.state;return t&&o?"and":""}termsTemplate(){const{termsConditionsUrl:t}=e.OptionsController.state;return t?e.b`<a href=${t} target="_blank" rel="noopener noreferrer"
1859
+ >Terms of Service</a
1860
+ >`:null}privacyTemplate(){const{privacyPolicyUrl:t}=e.OptionsController.state;return t?e.b`<a href=${t} target="_blank" rel="noopener noreferrer"
1861
+ >Privacy Policy</a
1862
+ >`:null}reownBrandingTemplate(t=!1){return this.remoteFeatures?.reownBranding?t?e.b`<wui-ux-by-reown class="branding-only"></wui-ux-by-reown>`:e.b`<wui-ux-by-reown></wui-ux-by-reown>`:null}};vt.styles=[bt],ft([t.r()],vt.prototype,"remoteFeatures",void 0),vt=ft([t.customElement("w3m-legal-footer")],vt);var kt=e.i$1``,xt=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let Ct=class extends e.i{render(){const{termsConditionsUrl:t,privacyPolicyUrl:o}=e.OptionsController.state;return t||o?e.b`
1863
+ <wui-flex
1864
+ .padding=${["4","3","3","3"]}
1865
+ flexDirection="column"
1866
+ alignItems="center"
1867
+ justifyContent="center"
1868
+ gap="3"
1869
+ >
1870
+ <wui-text color="secondary" variant="md-regular" align="center">
1871
+ We work with the best providers to give you the lowest fees and best support. More options
1872
+ coming soon!
1873
+ </wui-text>
1874
+
1875
+ ${this.howDoesItWorkTemplate()}
1876
+ </wui-flex>
1877
+ `:null}howDoesItWorkTemplate(){return e.b` <wui-link @click=${this.onWhatIsBuy.bind(this)}>
1878
+ <wui-icon size="xs" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon>
1879
+ How does it work?
1880
+ </wui-link>`}onWhatIsBuy(){e.EventsController.sendEvent({type:"track",event:"SELECT_WHAT_IS_A_BUY",properties:{isSmartAccount:e.getPreferredAccountType(e.ChainController.state.activeChain)===e.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),e.RouterController.push("WhatIsABuy")}};Ct.styles=[kt],Ct=xt([t.customElement("w3m-onramp-providers-footer")],Ct);var At=e.css`
1881
+ :host {
1882
+ display: block;
1883
+ }
1884
+
1885
+ div.container {
1886
+ position: absolute;
1887
+ bottom: 0;
1888
+ left: 0;
1889
+ right: 0;
1890
+ overflow: hidden;
1891
+ height: auto;
1892
+ display: block;
1893
+ }
1894
+
1895
+ div.container[status='hide'] {
1896
+ animation: fade-out;
1897
+ animation-duration: var(--apkt-duration-dynamic);
1898
+ animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]};
1899
+ animation-fill-mode: both;
1900
+ animation-delay: 0s;
1901
+ }
1902
+
1903
+ div.container[status='show'] {
1904
+ animation: fade-in;
1905
+ animation-duration: var(--apkt-duration-dynamic);
1906
+ animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]};
1907
+ animation-fill-mode: both;
1908
+ animation-delay: var(--apkt-duration-dynamic);
1909
+ }
1910
+
1911
+ @keyframes fade-in {
1912
+ from {
1913
+ opacity: 0;
1914
+ filter: blur(6px);
1915
+ }
1916
+ to {
1917
+ opacity: 1;
1918
+ filter: blur(0px);
1919
+ }
1920
+ }
1921
+
1922
+ @keyframes fade-out {
1923
+ from {
1924
+ opacity: 1;
1925
+ filter: blur(0px);
1926
+ }
1927
+ to {
1928
+ opacity: 0;
1929
+ filter: blur(6px);
1930
+ }
1931
+ }
1932
+ `,Tt=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let St=class extends e.i{constructor(){super(...arguments),this.resizeObserver=void 0,this.unsubscribe=[],this.status="hide",this.view=e.RouterController.state.view}firstUpdated(){this.status=yt.hasFooter()?"show":"hide",this.unsubscribe.push(e.RouterController.subscribeKey("view",(e=>{if(this.view=e,this.status=yt.hasFooter()?"show":"hide","hide"===this.status){document.documentElement.style.setProperty("--apkt-footer-height","0px")}}))),this.resizeObserver=new ResizeObserver((e=>{for(const t of e)if(t.target===this.getWrapper()){const e=`${t.contentRect.height}px`;document.documentElement.style.setProperty("--apkt-footer-height",e)}})),this.resizeObserver.observe(this.getWrapper())}render(){return e.b`
1933
+ <div class="container" status=${this.status}>${this.templatePageContainer()}</div>
1934
+ `}templatePageContainer(){return yt.hasFooter()?e.b` ${this.templateFooter()}`:null}templateFooter(){switch(this.view){case"Networks":return this.templateNetworksFooter();case"Connect":case"ConnectWallets":case"OnRampFiatSelect":case"OnRampTokenSelect":return e.b`<w3m-legal-footer></w3m-legal-footer>`;case"OnRampProviders":return e.b`<w3m-onramp-providers-footer></w3m-onramp-providers-footer>`;default:return null}}templateNetworksFooter(){return e.b` <wui-flex
1935
+ class="footer-in"
1936
+ padding="3"
1937
+ flexDirection="column"
1938
+ gap="3"
1939
+ alignItems="center"
1940
+ >
1941
+ <wui-text variant="md-regular" color="secondary" align="center">
1942
+ Your connected wallet may not support some of the networks available for this dApp
1943
+ </wui-text>
1944
+ <wui-link @click=${this.onNetworkHelp.bind(this)}>
1945
+ <wui-icon size="sm" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon>
1946
+ What is a network
1947
+ </wui-link>
1948
+ </wui-flex>`}onNetworkHelp(){e.EventsController.sendEvent({type:"track",event:"CLICK_NETWORK_HELP"}),e.RouterController.push("WhatIsANetwork")}getWrapper(){return this.shadowRoot?.querySelector("div.container")}};St.styles=[At],Tt([t.r()],St.prototype,"status",void 0),Tt([t.r()],St.prototype,"view",void 0),St=Tt([t.customElement("w3m-footer")],St);var Et=e.css`
1949
+ :host {
1950
+ display: block;
1951
+ width: inherit;
1952
+ }
1953
+ `,It=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};let Pt=class extends e.i{constructor(){super(),this.unsubscribe=[],this.viewState=e.RouterController.state.view,this.history=e.RouterController.state.history.join(","),this.unsubscribe.push(e.RouterController.subscribeKey("view",(()=>{this.history=e.RouterController.state.history.join(","),document.documentElement.style.setProperty("--apkt-duration-dynamic","var(--apkt-durations-lg)")})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),document.documentElement.style.setProperty("--apkt-duration-dynamic","0s")}render(){return e.b`${this.templatePageContainer()}`}templatePageContainer(){return e.b`<w3m-router-container
1954
+ history=${this.history}
1955
+ .setView=${()=>{this.viewState=e.RouterController.state.view}}
1956
+ >
1957
+ ${this.viewTemplate(this.viewState)}
1958
+ </w3m-router-container>`}viewTemplate(t){switch(t){case"AccountSettings":return e.b`<w3m-account-settings-view></w3m-account-settings-view>`;case"Account":return e.b`<w3m-account-view></w3m-account-view>`;case"AllWallets":return e.b`<w3m-all-wallets-view></w3m-all-wallets-view>`;case"ApproveTransaction":return e.b`<w3m-approve-transaction-view></w3m-approve-transaction-view>`;case"BuyInProgress":return e.b`<w3m-buy-in-progress-view></w3m-buy-in-progress-view>`;case"ChooseAccountName":return e.b`<w3m-choose-account-name-view></w3m-choose-account-name-view>`;case"Connect":default:return e.b`<w3m-connect-view></w3m-connect-view>`;case"Create":return e.b`<w3m-connect-view walletGuide="explore"></w3m-connect-view>`;case"ConnectingWalletConnect":return e.b`<w3m-connecting-wc-view></w3m-connecting-wc-view>`;case"ConnectingWalletConnectBasic":return e.b`<w3m-connecting-wc-basic-view></w3m-connecting-wc-basic-view>`;case"ConnectingExternal":return e.b`<w3m-connecting-external-view></w3m-connecting-external-view>`;case"ConnectingSiwe":return e.b`<w3m-connecting-siwe-view></w3m-connecting-siwe-view>`;case"ConnectWallets":return e.b`<w3m-connect-wallets-view></w3m-connect-wallets-view>`;case"ConnectSocials":return e.b`<w3m-connect-socials-view></w3m-connect-socials-view>`;case"ConnectingSocial":return e.b`<w3m-connecting-social-view></w3m-connecting-social-view>`;case"DataCapture":return e.b`<w3m-data-capture-view></w3m-data-capture-view>`;case"DataCaptureOtpConfirm":return e.b`<w3m-data-capture-otp-confirm-view></w3m-data-capture-otp-confirm-view>`;case"Downloads":return e.b`<w3m-downloads-view></w3m-downloads-view>`;case"EmailLogin":return e.b`<w3m-email-login-view></w3m-email-login-view>`;case"EmailVerifyOtp":return e.b`<w3m-email-verify-otp-view></w3m-email-verify-otp-view>`;case"EmailVerifyDevice":return e.b`<w3m-email-verify-device-view></w3m-email-verify-device-view>`;case"GetWallet":return e.b`<w3m-get-wallet-view></w3m-get-wallet-view>`;case"Networks":return e.b`<w3m-networks-view></w3m-networks-view>`;case"SwitchNetwork":return e.b`<w3m-network-switch-view></w3m-network-switch-view>`;case"ProfileWallets":return e.b`<w3m-profile-wallets-view></w3m-profile-wallets-view>`;case"Transactions":return e.b`<w3m-transactions-view></w3m-transactions-view>`;case"OnRampProviders":return e.b`<w3m-onramp-providers-view></w3m-onramp-providers-view>`;case"OnRampTokenSelect":return e.b`<w3m-onramp-token-select-view></w3m-onramp-token-select-view>`;case"OnRampFiatSelect":return e.b`<w3m-onramp-fiat-select-view></w3m-onramp-fiat-select-view>`;case"UpgradeEmailWallet":return e.b`<w3m-upgrade-wallet-view></w3m-upgrade-wallet-view>`;case"UpdateEmailWallet":return e.b`<w3m-update-email-wallet-view></w3m-update-email-wallet-view>`;case"UpdateEmailPrimaryOtp":return e.b`<w3m-update-email-primary-otp-view></w3m-update-email-primary-otp-view>`;case"UpdateEmailSecondaryOtp":return e.b`<w3m-update-email-secondary-otp-view></w3m-update-email-secondary-otp-view>`;case"UnsupportedChain":return e.b`<w3m-unsupported-chain-view></w3m-unsupported-chain-view>`;case"Swap":return e.b`<w3m-swap-view></w3m-swap-view>`;case"SwapSelectToken":return e.b`<w3m-swap-select-token-view></w3m-swap-select-token-view>`;case"SwapPreview":return e.b`<w3m-swap-preview-view></w3m-swap-preview-view>`;case"WalletSend":return e.b`<w3m-wallet-send-view></w3m-wallet-send-view>`;case"WalletSendSelectToken":return e.b`<w3m-wallet-send-select-token-view></w3m-wallet-send-select-token-view>`;case"WalletSendPreview":return e.b`<w3m-wallet-send-preview-view></w3m-wallet-send-preview-view>`;case"WalletSendConfirmed":return e.b`<w3m-send-confirmed-view></w3m-send-confirmed-view>`;case"WhatIsABuy":return e.b`<w3m-what-is-a-buy-view></w3m-what-is-a-buy-view>`;case"WalletReceive":return e.b`<w3m-wallet-receive-view></w3m-wallet-receive-view>`;case"WalletCompatibleNetworks":return e.b`<w3m-wallet-compatible-networks-view></w3m-wallet-compatible-networks-view>`;case"WhatIsAWallet":return e.b`<w3m-what-is-a-wallet-view></w3m-what-is-a-wallet-view>`;case"ConnectingMultiChain":return e.b`<w3m-connecting-multi-chain-view></w3m-connecting-multi-chain-view>`;case"WhatIsANetwork":return e.b`<w3m-what-is-a-network-view></w3m-what-is-a-network-view>`;case"ConnectingFarcaster":return e.b`<w3m-connecting-farcaster-view></w3m-connecting-farcaster-view>`;case"SwitchActiveChain":return e.b`<w3m-switch-active-chain-view></w3m-switch-active-chain-view>`;case"RegisterAccountName":return e.b`<w3m-register-account-name-view></w3m-register-account-name-view>`;case"RegisterAccountNameSuccess":return e.b`<w3m-register-account-name-success-view></w3m-register-account-name-success-view>`;case"SmartSessionCreated":return e.b`<w3m-smart-session-created-view></w3m-smart-session-created-view>`;case"SmartSessionList":return e.b`<w3m-smart-session-list-view></w3m-smart-session-list-view>`;case"SIWXSignMessage":return e.b`<w3m-siwx-sign-message-view></w3m-siwx-sign-message-view>`;case"Pay":return e.b`<w3m-pay-view></w3m-pay-view>`;case"PayLoading":return e.b`<w3m-pay-loading-view></w3m-pay-loading-view>`;case"PayQuote":return e.b`<w3m-pay-quote-view></w3m-pay-quote-view>`;case"FundWallet":return e.b`<w3m-fund-wallet-view></w3m-fund-wallet-view>`;case"PayWithExchange":return e.b`<w3m-deposit-from-exchange-view></w3m-deposit-from-exchange-view>`;case"PayWithExchangeSelectAsset":return e.b`<w3m-deposit-from-exchange-select-asset-view></w3m-deposit-from-exchange-select-asset-view>`;case"UsageExceeded":return e.b`<w3m-usage-exceeded-view></w3m-usage-exceeded-view>`;case"SmartAccountSettings":return e.b`<w3m-smart-account-settings-view></w3m-smart-account-settings-view>`}}};Pt.styles=[Et],It([t.r()],Pt.prototype,"viewState",void 0),It([t.r()],Pt.prototype,"history",void 0),Pt=It([t.customElement("w3m-router")],Pt);var Nt=e.css`
1959
+ :host {
1960
+ z-index: ${({tokens:e})=>e.core.zIndex};
1961
+ display: block;
1962
+ backface-visibility: hidden;
1963
+ will-change: opacity;
1964
+ position: fixed;
1965
+ top: 0;
1966
+ left: 0;
1967
+ right: 0;
1968
+ bottom: 0;
1969
+ pointer-events: none;
1970
+ opacity: 0;
1971
+ background-color: ${({tokens:e})=>e.theme.overlay};
1972
+ backdrop-filter: blur(0px);
1973
+ transition:
1974
+ opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
1975
+ backdrop-filter ${({durations:e})=>e.lg}
1976
+ ${({easings:e})=>e["ease-out-power-2"]};
1977
+ will-change: opacity;
1978
+ }
1979
+
1980
+ :host(.open) {
1981
+ opacity: 1;
1982
+ backdrop-filter: blur(8px);
1983
+ }
1984
+
1985
+ :host(.appkit-modal) {
1986
+ position: relative;
1987
+ pointer-events: unset;
1988
+ background: none;
1989
+ width: 100%;
1990
+ opacity: 1;
1991
+ }
1992
+
1993
+ wui-card {
1994
+ max-width: var(--apkt-modal-width);
1995
+ width: 100%;
1996
+ position: relative;
1997
+ outline: none;
1998
+ transform: translateY(4px);
1999
+ box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05);
2000
+ transition:
2001
+ transform ${({durations:e})=>e.lg}
2002
+ ${({easings:e})=>e["ease-out-power-2"]},
2003
+ border-radius ${({durations:e})=>e.lg}
2004
+ ${({easings:e})=>e["ease-out-power-1"]},
2005
+ background-color ${({durations:e})=>e.lg}
2006
+ ${({easings:e})=>e["ease-out-power-1"]},
2007
+ box-shadow ${({durations:e})=>e.lg}
2008
+ ${({easings:e})=>e["ease-out-power-1"]};
2009
+ will-change: border-radius, background-color, transform, box-shadow;
2010
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
2011
+ padding: var(--local-modal-padding);
2012
+ box-sizing: border-box;
2013
+ }
2014
+
2015
+ :host(.open) wui-card {
2016
+ transform: translateY(0px);
2017
+ }
2018
+
2019
+ wui-card::before {
2020
+ z-index: 1;
2021
+ pointer-events: none;
2022
+ content: '';
2023
+ position: absolute;
2024
+ inset: 0;
2025
+ border-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
2026
+ transition: box-shadow ${({durations:e})=>e.lg}
2027
+ ${({easings:e})=>e["ease-out-power-2"]};
2028
+ transition-delay: ${({durations:e})=>e.md};
2029
+ will-change: box-shadow;
2030
+ }
2031
+
2032
+ :host([data-mobile-fullscreen='true']) wui-card::before {
2033
+ border-radius: 0px;
2034
+ }
2035
+
2036
+ :host([data-border='true']) wui-card::before {
2037
+ box-shadow: inset 0px 0px 0px 4px ${({tokens:e})=>e.theme.foregroundSecondary};
2038
+ }
2039
+
2040
+ :host([data-border='false']) wui-card::before {
2041
+ box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.theme.borderPrimaryDark};
2042
+ }
2043
+
2044
+ :host([data-border='true']) wui-card {
2045
+ animation:
2046
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
2047
+ card-background-border var(--apkt-duration-dynamic)
2048
+ ${({easings:e})=>e["ease-out-power-2"]};
2049
+ animation-fill-mode: backwards, both;
2050
+ animation-delay: var(--apkt-duration-dynamic);
2051
+ }
2052
+
2053
+ :host([data-border='false']) wui-card {
2054
+ animation:
2055
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
2056
+ card-background-default var(--apkt-duration-dynamic)
2057
+ ${({easings:e})=>e["ease-out-power-2"]};
2058
+ animation-fill-mode: backwards, both;
2059
+ animation-delay: 0s;
2060
+ }
2061
+
2062
+ :host(.appkit-modal) wui-card {
2063
+ max-width: var(--apkt-modal-width);
2064
+ }
2065
+
2066
+ wui-card[shake='true'] {
2067
+ animation:
2068
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
2069
+ w3m-shake ${({durations:e})=>e.xl}
2070
+ ${({easings:e})=>e["ease-out-power-2"]};
2071
+ }
2072
+
2073
+ wui-flex {
2074
+ overflow-x: hidden;
2075
+ overflow-y: auto;
2076
+ display: flex;
2077
+ align-items: center;
2078
+ justify-content: center;
2079
+ width: 100%;
2080
+ height: 100%;
2081
+ }
2082
+
2083
+ @media (max-height: 700px) and (min-width: 431px) {
2084
+ wui-flex {
2085
+ align-items: flex-start;
2086
+ }
2087
+
2088
+ wui-card {
2089
+ margin: var(--apkt-spacing-6) 0px;
2090
+ }
2091
+ }
2092
+
2093
+ @media (max-width: 430px) {
2094
+ :host([data-mobile-fullscreen='true']) {
2095
+ height: 100dvh;
2096
+ }
2097
+ :host([data-mobile-fullscreen='true']) wui-flex {
2098
+ align-items: stretch;
2099
+ }
2100
+ :host([data-mobile-fullscreen='true']) wui-card {
2101
+ max-width: 100%;
2102
+ height: 100%;
2103
+ border-radius: 0;
2104
+ border: none;
2105
+ }
2106
+ :host(:not([data-mobile-fullscreen='true'])) wui-flex {
2107
+ align-items: flex-end;
2108
+ }
2109
+
2110
+ :host(:not([data-mobile-fullscreen='true'])) wui-card {
2111
+ max-width: 100%;
2112
+ border-bottom: none;
2113
+ }
2114
+
2115
+ :host(:not([data-mobile-fullscreen='true'])) wui-card[data-embedded='true'] {
2116
+ border-bottom-left-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
2117
+ border-bottom-right-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
2118
+ }
2119
+
2120
+ :host(:not([data-mobile-fullscreen='true'])) wui-card:not([data-embedded='true']) {
2121
+ border-bottom-left-radius: 0px;
2122
+ border-bottom-right-radius: 0px;
2123
+ }
2124
+
2125
+ wui-card[shake='true'] {
2126
+ animation: w3m-shake 0.5s ${({easings:e})=>e["ease-out-power-2"]};
2127
+ }
2128
+ }
2129
+
2130
+ @keyframes fade-in {
2131
+ 0% {
2132
+ transform: scale(0.99) translateY(4px);
2133
+ }
2134
+ 100% {
2135
+ transform: scale(1) translateY(0);
2136
+ }
2137
+ }
2138
+
2139
+ @keyframes w3m-shake {
2140
+ 0% {
2141
+ transform: scale(1) rotate(0deg);
2142
+ }
2143
+ 20% {
2144
+ transform: scale(1) rotate(-1deg);
2145
+ }
2146
+ 40% {
2147
+ transform: scale(1) rotate(1.5deg);
2148
+ }
2149
+ 60% {
2150
+ transform: scale(1) rotate(-1.5deg);
2151
+ }
2152
+ 80% {
2153
+ transform: scale(1) rotate(1deg);
2154
+ }
2155
+ 100% {
2156
+ transform: scale(1) rotate(0deg);
2157
+ }
2158
+ }
2159
+
2160
+ @keyframes card-background-border {
2161
+ from {
2162
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
2163
+ }
2164
+ to {
2165
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
2166
+ }
2167
+ }
2168
+
2169
+ @keyframes card-background-default {
2170
+ from {
2171
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
2172
+ }
2173
+ to {
2174
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
2175
+ }
2176
+ }
2177
+ `,$t=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};const Rt="scroll-lock",Ut={PayWithExchange:"0",PayWithExchangeSelectAsset:"0",Pay:"0",PayQuote:"0",PayLoading:"0"};class Ot extends e.i{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=e.OptionsController.state.enableEmbedded,this.open=e.ModalController.state.open,this.caipAddress=e.ChainController.state.activeCaipAddress,this.caipNetwork=e.ChainController.state.activeCaipNetwork,this.shake=e.ModalController.state.shake,this.filterByNamespace=e.ConnectorController.state.filterByNamespace,this.padding=e.vars.spacing[1],this.mobileFullScreen=e.OptionsController.state.enableMobileFullScreen,this.initializeTheming(),e.ApiController.prefetchAnalyticsConfig(),this.unsubscribe.push(e.ModalController.subscribeKey("open",(e=>e?this.onOpen():this.onClose())),e.ModalController.subscribeKey("shake",(e=>this.shake=e)),e.ChainController.subscribeKey("activeCaipNetwork",(e=>this.onNewNetwork(e))),e.ChainController.subscribeKey("activeCaipAddress",(e=>this.onNewAddress(e))),e.OptionsController.subscribeKey("enableEmbedded",(e=>this.enableEmbedded=e)),e.ConnectorController.subscribeKey("filterByNamespace",(t=>{this.filterByNamespace===t||e.ChainController.getAccountData(t)?.caipAddress||(e.ApiController.fetchRecommendedWallets(),this.filterByNamespace=t)})),e.RouterController.subscribeKey("view",(()=>{this.dataset.border=yt.hasFooter()?"true":"false",this.padding=Ut[e.RouterController.state.view]??e.vars.spacing[1]})))}firstUpdated(){if(this.dataset.border=yt.hasFooter()?"true":"false",this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),this.caipAddress){if(this.enableEmbedded)return e.ModalController.close(),void this.prefetch();this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),this.onRemoveKeyboardListener()}render(){return this.style.setProperty("--local-modal-padding",this.padding),this.enableEmbedded?e.b`${this.contentTemplate()}
2178
+ <w3m-tooltip></w3m-tooltip> `:this.open?e.b`
2179
+ <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
2180
+ ${this.contentTemplate()}
2181
+ </wui-flex>
2182
+ <w3m-tooltip></w3m-tooltip>
2183
+ `:null}contentTemplate(){return e.b` <wui-card
2184
+ shake="${this.shake}"
2185
+ data-embedded="${t.o(this.enableEmbedded)}"
2186
+ role="alertdialog"
2187
+ aria-modal="true"
2188
+ tabindex="0"
2189
+ data-testid="w3m-modal-card"
2190
+ >
2191
+ <w3m-header></w3m-header>
2192
+ <w3m-router></w3m-router>
2193
+ <w3m-footer></w3m-footer>
2194
+ <w3m-snackbar></w3m-snackbar>
2195
+ <w3m-alertbar></w3m-alertbar>
2196
+ </wui-card>`}async onOverlayClick(e){if(e.target===e.currentTarget){if(this.mobileFullScreen)return;await this.handleClose()}}async handleClose(){await d.safeClose()}initializeTheming(){const{themeVariables:o,themeMode:r}=e.ThemeController.state,i=t.UiHelperUtil.getColorTheme(r);e.initializeTheming(o,i)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),e.SnackController.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const e=document.createElement("style");e.dataset.w3m=Rt,e.textContent="\n body {\n touch-action: none;\n overflow: hidden;\n overscroll-behavior: contain;\n }\n w3m-modal {\n pointer-events: auto;\n }\n ",document.head.appendChild(e)}onScrollUnlock(){const e=document.head.querySelector(`style[data-w3m="${Rt}"]`);e&&e.remove()}onAddKeyboardListener(){this.abortController=new AbortController;const e=this.shadowRoot?.querySelector("wui-card");e?.focus(),window.addEventListener("keydown",(t=>{if("Escape"===t.key)this.handleClose();else if("Tab"===t.key){const{tagName:o}=t.target;!o||o.includes("W3M-")||o.includes("WUI-")||e?.focus()}}),this.abortController)}onRemoveKeyboardListener(){this.abortController?.abort(),this.abortController=void 0}async onNewAddress(t){const o=e.ChainController.state.isSwitchingNamespace,r="ProfileWallets"===e.RouterController.state.view;!t&&!o&&!r&&e.ModalController.close(),await e.SIWXUtil.initializeIfEnabled(t),this.caipAddress=t,e.ChainController.setIsSwitchingNamespace(!1)}onNewNetwork(t){const o=this.caipNetwork,r=o?.caipNetworkId?.toString(),i=t?.caipNetworkId?.toString(),n=r!==i,a="UnsupportedChain"===e.RouterController.state.view,c=e.ModalController.state.open;let l=!1;this.enableEmbedded&&"SwitchNetwork"===e.RouterController.state.view&&(l=!0),n&&s.resetState(),c&&a&&(l=!0),l&&"SIWXSignMessage"!==e.RouterController.state.view&&e.RouterController.goBack(),this.caipNetwork=t}prefetch(){this.hasPrefetched||(e.ApiController.prefetch(),e.ApiController.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}}Ot.styles=Nt,$t([t.n({type:Boolean})],Ot.prototype,"enableEmbedded",void 0),$t([t.r()],Ot.prototype,"open",void 0),$t([t.r()],Ot.prototype,"caipAddress",void 0),$t([t.r()],Ot.prototype,"caipNetwork",void 0),$t([t.r()],Ot.prototype,"shake",void 0),$t([t.r()],Ot.prototype,"filterByNamespace",void 0),$t([t.r()],Ot.prototype,"padding",void 0),$t([t.r()],Ot.prototype,"mobileFullScreen",void 0),exports.W3mModal=class extends Ot{},exports.W3mModal=$t([t.customElement("w3m-modal")],exports.W3mModal),exports.AppKitModal=class extends Ot{},exports.AppKitModal=$t([t.customElement("appkit-modal")],exports.AppKitModal);var _t=e.css`
2197
+ .icon-box {
2198
+ width: 64px;
2199
+ height: 64px;
2200
+ border-radius: ${({borderRadius:e})=>e[5]};
2201
+ background-color: ${({colors:e})=>e.semanticError010};
2202
+ }
2203
+ `,Wt=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};exports.W3mUsageExceededView=class extends e.i{constructor(){super()}render(){return e.b`
2204
+ <wui-flex
2205
+ flexDirection="column"
2206
+ alignItems="center"
2207
+ gap="4"
2208
+ .padding="${["1","3","4","3"]}"
2209
+ >
2210
+ <wui-flex justifyContent="center" alignItems="center" class="icon-box">
2211
+ <wui-icon size="xxl" color="error" name="warningCircle"></wui-icon>
2212
+ </wui-flex>
2213
+
2214
+ <wui-text variant="lg-medium" color="primary" align="center">
2215
+ The app isn't responding as expected
2216
+ </wui-text>
2217
+ <wui-text variant="md-regular" color="secondary" align="center">
2218
+ Try again or reach out to the app team for help.
2219
+ </wui-text>
2220
+
2221
+ <wui-button
2222
+ variant="neutral-secondary"
2223
+ size="md"
2224
+ @click=${this.onTryAgainClick.bind(this)}
2225
+ data-testid="w3m-usage-exceeded-button"
2226
+ >
2227
+ <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
2228
+ Try Again
2229
+ </wui-button>
2230
+ </wui-flex>
2231
+ `}onTryAgainClick(){e.RouterController.goBack()}},exports.W3mUsageExceededView.styles=_t,exports.W3mUsageExceededView=Wt([t.customElement("w3m-usage-exceeded-view")],exports.W3mUsageExceededView);var Dt=e.css`
2232
+ :host {
2233
+ width: 100%;
2234
+ }
2235
+ `,Lt=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};exports.W3mListWallet=class extends e.i{constructor(){super(...arguments),this.hasImpressionSent=!1,this.walletImages=[],this.imageSrc="",this.name="",this.size="md",this.tabIdx=void 0,this.disabled=!1,this.showAllWallets=!1,this.loading=!1,this.loadingSpinnerColor="accent-100",this.rdnsId="",this.displayIndex=void 0,this.walletRank=void 0,this.namespaces=[]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.cleanupIntersectionObserver()}updated(e){super.updated(e),(e.has("name")||e.has("imageSrc")||e.has("walletRank"))&&(this.hasImpressionSent=!1);e.has("walletRank")&&this.walletRank&&!this.intersectionObserver&&this.setupIntersectionObserver()}setupIntersectionObserver(){this.intersectionObserver=new IntersectionObserver((e=>{e.forEach((e=>{!e.isIntersecting||this.loading||this.hasImpressionSent||this.sendImpressionEvent()}))}),{threshold:.1}),this.intersectionObserver.observe(this)}cleanupIntersectionObserver(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=void 0)}sendImpressionEvent(){this.name&&!this.hasImpressionSent&&this.walletRank&&(this.hasImpressionSent=!0,(this.rdnsId||this.name)&&e.EventsController.sendWalletImpressionEvent({name:this.name,walletRank:this.walletRank,rdnsId:this.rdnsId,view:e.RouterController.state.view,displayIndex:this.displayIndex}))}handleGetWalletNamespaces(){return Object.keys(e.AdapterController.state.adapters).length>1?this.namespaces:[]}render(){return e.b`
2236
+ <wui-list-wallet
2237
+ .walletImages=${this.walletImages}
2238
+ imageSrc=${t.o(this.imageSrc)}
2239
+ name=${this.name}
2240
+ size=${t.o(this.size)}
2241
+ tagLabel=${t.o(this.tagLabel)}
2242
+ .tagVariant=${this.tagVariant}
2243
+ .walletIcon=${this.walletIcon}
2244
+ .tabIdx=${this.tabIdx}
2245
+ .disabled=${this.disabled}
2246
+ .showAllWallets=${this.showAllWallets}
2247
+ .loading=${this.loading}
2248
+ loadingSpinnerColor=${this.loadingSpinnerColor}
2249
+ .namespaces=${this.handleGetWalletNamespaces()}
2250
+ ></wui-list-wallet>
2251
+ `}},exports.W3mListWallet.styles=Dt,Lt([t.n({type:Array})],exports.W3mListWallet.prototype,"walletImages",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"imageSrc",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"name",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"size",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"tagLabel",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"tagVariant",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"walletIcon",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"tabIdx",void 0),Lt([t.n({type:Boolean})],exports.W3mListWallet.prototype,"disabled",void 0),Lt([t.n({type:Boolean})],exports.W3mListWallet.prototype,"showAllWallets",void 0),Lt([t.n({type:Boolean})],exports.W3mListWallet.prototype,"loading",void 0),Lt([t.n({type:String})],exports.W3mListWallet.prototype,"loadingSpinnerColor",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"rdnsId",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"displayIndex",void 0),Lt([t.n()],exports.W3mListWallet.prototype,"walletRank",void 0),Lt([t.n({type:Array})],exports.W3mListWallet.prototype,"namespaces",void 0),exports.W3mListWallet=Lt([t.customElement("w3m-list-wallet")],exports.W3mListWallet);var Bt=e.css`
2252
+ :host {
2253
+ --local-duration-height: 0s;
2254
+ --local-duration: ${({durations:e})=>e.lg};
2255
+ --local-transition: ${({easings:e})=>e["ease-out-power-2"]};
2256
+ }
2257
+
2258
+ .container {
2259
+ display: block;
2260
+ overflow: hidden;
2261
+ overflow: hidden;
2262
+ position: relative;
2263
+ height: var(--local-container-height);
2264
+ transition: height var(--local-duration-height) var(--local-transition);
2265
+ will-change: height, padding-bottom;
2266
+ }
2267
+
2268
+ .container[data-mobile-fullscreen='true'] {
2269
+ overflow: scroll;
2270
+ }
2271
+
2272
+ .page {
2273
+ position: absolute;
2274
+ top: 0;
2275
+ left: 0;
2276
+ right: 0;
2277
+ width: 100%;
2278
+ height: auto;
2279
+ width: inherit;
2280
+ box-sizing: border-box;
2281
+ display: flex;
2282
+ flex-direction: column;
2283
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
2284
+ border-bottom-left-radius: var(--local-border-bottom-radius);
2285
+ border-bottom-right-radius: var(--local-border-bottom-radius);
2286
+ transition: border-bottom-left-radius var(--local-duration) var(--local-transition);
2287
+ }
2288
+
2289
+ .page[data-mobile-fullscreen='true'] {
2290
+ height: 100%;
2291
+ }
2292
+
2293
+ .page-content {
2294
+ display: flex;
2295
+ flex-direction: column;
2296
+ min-height: 100%;
2297
+ }
2298
+
2299
+ .footer {
2300
+ height: var(--apkt-footer-height);
2301
+ }
2302
+
2303
+ div.page[view-direction^='prev-'] .page-content {
2304
+ animation:
2305
+ slide-left-out var(--local-duration) forwards var(--local-transition),
2306
+ slide-left-in var(--local-duration) forwards var(--local-transition);
2307
+ animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg});
2308
+ }
2309
+
2310
+ div.page[view-direction^='next-'] .page-content {
2311
+ animation:
2312
+ slide-right-out var(--local-duration) forwards var(--local-transition),
2313
+ slide-right-in var(--local-duration) forwards var(--local-transition);
2314
+ animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg});
2315
+ }
2316
+
2317
+ @keyframes slide-left-out {
2318
+ from {
2319
+ transform: translateX(0px) scale(1);
2320
+ opacity: 1;
2321
+ filter: blur(0px);
2322
+ }
2323
+ to {
2324
+ transform: translateX(8px) scale(0.99);
2325
+ opacity: 0;
2326
+ filter: blur(4px);
2327
+ }
2328
+ }
2329
+
2330
+ @keyframes slide-left-in {
2331
+ from {
2332
+ transform: translateX(-8px) scale(0.99);
2333
+ opacity: 0;
2334
+ filter: blur(4px);
2335
+ }
2336
+ to {
2337
+ transform: translateX(0) translateY(0) scale(1);
2338
+ opacity: 1;
2339
+ filter: blur(0px);
2340
+ }
2341
+ }
2342
+
2343
+ @keyframes slide-right-out {
2344
+ from {
2345
+ transform: translateX(0px) scale(1);
2346
+ opacity: 1;
2347
+ filter: blur(0px);
2348
+ }
2349
+ to {
2350
+ transform: translateX(-8px) scale(0.99);
2351
+ opacity: 0;
2352
+ filter: blur(4px);
2353
+ }
2354
+ }
2355
+
2356
+ @keyframes slide-right-in {
2357
+ from {
2358
+ transform: translateX(8px) scale(0.99);
2359
+ opacity: 0;
2360
+ filter: blur(4px);
2361
+ }
2362
+ to {
2363
+ transform: translateX(0) translateY(0) scale(1);
2364
+ opacity: 1;
2365
+ filter: blur(0px);
2366
+ }
2367
+ }
2368
+ `,zt=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a};exports.W3mRouterContainer=class extends e.i{constructor(){super(...arguments),this.resizeObserver=void 0,this.transitionDuration="0.15s",this.transitionFunction="",this.history="",this.view="",this.setView=void 0,this.viewDirection="",this.historyState="",this.previousHeight="0px",this.mobileFullScreen=e.OptionsController.state.enableMobileFullScreen,this.onViewportResize=()=>{this.updateContainerHeight()}}updated(e){if(e.has("history")){const e=this.history;""!==this.historyState&&this.historyState!==e&&this.onViewChange(e)}e.has("transitionDuration")&&this.style.setProperty("--local-duration",this.transitionDuration),e.has("transitionFunction")&&this.style.setProperty("--local-transition",this.transitionFunction)}firstUpdated(){this.transitionFunction&&this.style.setProperty("--local-transition",this.transitionFunction),this.style.setProperty("--local-duration",this.transitionDuration),this.historyState=this.history,this.resizeObserver=new ResizeObserver((e=>{for(const t of e)if(t.target===this.getWrapper()){let e=t.contentRect.height;const o=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");if(this.mobileFullScreen){e=(window.visualViewport?.height||window.innerHeight)-this.getHeaderHeight()-o,this.style.setProperty("--local-border-bottom-radius","0px")}else{e=e+o,this.style.setProperty("--local-border-bottom-radius",o?"var(--apkt-borderRadius-5)":"0px")}this.style.setProperty("--local-container-height",`${e}px`),"0px"!==this.previousHeight&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${e}px`}})),this.resizeObserver.observe(this.getWrapper()),this.updateContainerHeight(),window.addEventListener("resize",this.onViewportResize),window.visualViewport?.addEventListener("resize",this.onViewportResize)}disconnectedCallback(){const e=this.getWrapper();e&&this.resizeObserver&&this.resizeObserver.unobserve(e),window.removeEventListener("resize",this.onViewportResize),window.visualViewport?.removeEventListener("resize",this.onViewportResize)}render(){return e.b`
2369
+ <div class="container" data-mobile-fullscreen="${t.o(this.mobileFullScreen)}">
2370
+ <div
2371
+ class="page"
2372
+ data-mobile-fullscreen="${t.o(this.mobileFullScreen)}"
2373
+ view-direction="${this.viewDirection}"
2374
+ >
2375
+ <div class="page-content">
2376
+ <slot></slot>
2377
+ </div>
2378
+ </div>
2379
+ </div>
2380
+ `}onViewChange(e){const o=e.split(",").filter(Boolean),r=this.historyState.split(",").filter(Boolean),i=r.length,n=o.length,a=o[o.length-1]||"",s=t.UiHelperUtil.cssDurationToNumber(this.transitionDuration);let c="";n>i?c="next":n<i?c="prev":n===i&&o[n-1]!==r[i-1]&&(c="next"),this.viewDirection=`${c}-${a}`,setTimeout((()=>{this.historyState=e,this.setView?.(a)}),s),setTimeout((()=>{this.viewDirection=""}),2*s)}getWrapper(){return this.shadowRoot?.querySelector("div.page")}updateContainerHeight(){const e=this.getWrapper();if(!e)return;const t=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");let o=0;if(this.mobileFullScreen){o=(window.visualViewport?.height||window.innerHeight)-this.getHeaderHeight()-t,this.style.setProperty("--local-border-bottom-radius","0px")}else o=e.getBoundingClientRect().height+t,this.style.setProperty("--local-border-bottom-radius",t?"var(--apkt-borderRadius-5)":"0px");this.style.setProperty("--local-container-height",`${o}px`),"0px"!==this.previousHeight&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${o}px`}getHeaderHeight(){return 60}},exports.W3mRouterContainer.styles=[Bt],zt([t.n({type:String})],exports.W3mRouterContainer.prototype,"transitionDuration",void 0),zt([t.n({type:String})],exports.W3mRouterContainer.prototype,"transitionFunction",void 0),zt([t.n({type:String})],exports.W3mRouterContainer.prototype,"history",void 0),zt([t.n({type:String})],exports.W3mRouterContainer.prototype,"view",void 0),zt([t.n({attribute:!1})],exports.W3mRouterContainer.prototype,"setView",void 0),zt([t.r()],exports.W3mRouterContainer.prototype,"viewDirection",void 0),zt([t.r()],exports.W3mRouterContainer.prototype,"historyState",void 0),zt([t.r()],exports.W3mRouterContainer.prototype,"previousHeight",void 0),zt([t.r()],exports.W3mRouterContainer.prototype,"mobileFullScreen",void 0),exports.W3mRouterContainer=zt([t.customElement("w3m-router-container")],exports.W3mRouterContainer),exports.W3mModalBase=Ot;