@reown/appkit-cdn 1.8.15-viem-upgrade.0 → 1.8.15-viem-upgrade-2.0

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 (427) hide show
  1. package/dist/ConstantsUtil-DSO-aT76.js +24 -0
  2. package/dist/ConstantsUtil-DSO-aT76.js.map +1 -0
  3. package/dist/ExchangeController-D7JbbTDN.js +265 -0
  4. package/dist/ExchangeController-D7JbbTDN.js.map +1 -0
  5. package/dist/HelpersUtil-BfwO5f4J.js +141 -0
  6. package/dist/HelpersUtil-BfwO5f4J.js.map +1 -0
  7. package/dist/NavigationUtil-Ci15WS4K.js +9 -0
  8. package/dist/NavigationUtil-Ci15WS4K.js.map +1 -0
  9. package/dist/PhArrowCircleDown-B41iUlWV.js +74 -0
  10. package/dist/PhArrowCircleDown-B41iUlWV.js.map +1 -0
  11. package/dist/PhArrowClockwise-BY8u5n41.js +74 -0
  12. package/dist/PhArrowClockwise-BY8u5n41.js.map +1 -0
  13. package/dist/PhArrowDown-ClD8GZ65.js +74 -0
  14. package/dist/PhArrowDown-ClD8GZ65.js.map +1 -0
  15. package/dist/PhArrowLeft-B8MXUz60.js +74 -0
  16. package/dist/PhArrowLeft-B8MXUz60.js.map +1 -0
  17. package/dist/PhArrowRight-Cewa_Slb.js +74 -0
  18. package/dist/PhArrowRight-Cewa_Slb.js.map +1 -0
  19. package/dist/PhArrowSquareOut-whgWh-lD.js +74 -0
  20. package/dist/PhArrowSquareOut-whgWh-lD.js.map +1 -0
  21. package/dist/PhArrowUp-B1HXBxie.js +74 -0
  22. package/dist/PhArrowUp-B1HXBxie.js.map +1 -0
  23. package/dist/PhArrowUpRight-CfFYe4FP.js +74 -0
  24. package/dist/PhArrowUpRight-CfFYe4FP.js.map +1 -0
  25. package/dist/PhArrowsClockwise-gL1Gkrtx.js +74 -0
  26. package/dist/PhArrowsClockwise-gL1Gkrtx.js.map +1 -0
  27. package/dist/PhArrowsDownUp-BqUEdUQr.js +74 -0
  28. package/dist/PhArrowsDownUp-BqUEdUQr.js.map +1 -0
  29. package/dist/PhArrowsLeftRight-BlZU63eY.js +74 -0
  30. package/dist/PhArrowsLeftRight-BlZU63eY.js.map +1 -0
  31. package/dist/PhBank-gbg_jlI7.js +74 -0
  32. package/dist/PhBank-gbg_jlI7.js.map +1 -0
  33. package/dist/PhBrowser-CMlD-YJw.js +74 -0
  34. package/dist/PhBrowser-CMlD-YJw.js.map +1 -0
  35. package/dist/PhCaretDown-3agTO8Jp.js +74 -0
  36. package/dist/PhCaretDown-3agTO8Jp.js.map +1 -0
  37. package/dist/PhCaretLeft-_MTni7Z5.js +74 -0
  38. package/dist/PhCaretLeft-_MTni7Z5.js.map +1 -0
  39. package/dist/PhCaretRight-Ci9fAHPG.js +74 -0
  40. package/dist/PhCaretRight-Ci9fAHPG.js.map +1 -0
  41. package/dist/PhCaretUp-vFG4Fame.js +74 -0
  42. package/dist/PhCaretUp-vFG4Fame.js.map +1 -0
  43. package/dist/PhCheck-mChGK6K_.js +74 -0
  44. package/dist/PhCheck-mChGK6K_.js.map +1 -0
  45. package/dist/PhCircleHalf-DZ7-vfxf.js +74 -0
  46. package/dist/PhCircleHalf-DZ7-vfxf.js.map +1 -0
  47. package/dist/PhClock-Bc5XWXb6.js +74 -0
  48. package/dist/PhClock-Bc5XWXb6.js.map +1 -0
  49. package/dist/PhCompass-Cu2MB-55.js +74 -0
  50. package/dist/PhCompass-Cu2MB-55.js.map +1 -0
  51. package/dist/PhCopy-BGUjyTts.js +74 -0
  52. package/dist/PhCopy-BGUjyTts.js.map +1 -0
  53. package/dist/PhCreditCard-vxFWID4B.js +74 -0
  54. package/dist/PhCreditCard-vxFWID4B.js.map +1 -0
  55. package/dist/PhCurrencyDollar-BfOoDhJr.js +74 -0
  56. package/dist/PhCurrencyDollar-BfOoDhJr.js.map +1 -0
  57. package/dist/PhDesktop-Cq6jwzbS.js +74 -0
  58. package/dist/PhDesktop-Cq6jwzbS.js.map +1 -0
  59. package/dist/PhDeviceMobile-BCtTp6jj.js +74 -0
  60. package/dist/PhDeviceMobile-BCtTp6jj.js.map +1 -0
  61. package/dist/PhDotsThree-BGgD-WIO.js +74 -0
  62. package/dist/PhDotsThree-BGgD-WIO.js.map +1 -0
  63. package/dist/PhEnvelope-CQiV0-zG.js +74 -0
  64. package/dist/PhEnvelope-CQiV0-zG.js.map +1 -0
  65. package/dist/PhFunnelSimple-BHGtxTNf.js +74 -0
  66. package/dist/PhFunnelSimple-BHGtxTNf.js.map +1 -0
  67. package/dist/PhGlobe-Q8oVkf6X.js +74 -0
  68. package/dist/PhGlobe-Q8oVkf6X.js.map +1 -0
  69. package/dist/PhIdentificationCard-Cz9LzvVR.js +74 -0
  70. package/dist/PhIdentificationCard-Cz9LzvVR.js.map +1 -0
  71. package/dist/PhImage-CP5_qKk-.js +74 -0
  72. package/dist/PhImage-CP5_qKk-.js.map +1 -0
  73. package/dist/PhInfo-CTlE1X9Z.js +74 -0
  74. package/dist/PhInfo-CTlE1X9Z.js.map +1 -0
  75. package/dist/PhLightbulb-CcLpnAAb.js +74 -0
  76. package/dist/PhLightbulb-CcLpnAAb.js.map +1 -0
  77. package/dist/PhMagnifyingGlass-n58GUAck.js +74 -0
  78. package/dist/PhMagnifyingGlass-n58GUAck.js.map +1 -0
  79. package/dist/PhPaperPlaneRight-C0sf2XV8.js +74 -0
  80. package/dist/PhPaperPlaneRight-C0sf2XV8.js.map +1 -0
  81. package/dist/PhPlus-BJxvt7Uc.js +74 -0
  82. package/dist/PhPlus-BJxvt7Uc.js.map +1 -0
  83. package/dist/PhPower-BvktxO2-.js +74 -0
  84. package/dist/PhPower-BvktxO2-.js.map +1 -0
  85. package/dist/PhPuzzlePiece-CDDyUPYo.js +74 -0
  86. package/dist/PhPuzzlePiece-CDDyUPYo.js.map +1 -0
  87. package/dist/PhQrCode-BlGI8529.js +74 -0
  88. package/dist/PhQrCode-BlGI8529.js.map +1 -0
  89. package/dist/PhQuestion-DGZj6iDZ.js +74 -0
  90. package/dist/PhQuestion-DGZj6iDZ.js.map +1 -0
  91. package/dist/PhQuestionMark-CTmeI7MQ.js +74 -0
  92. package/dist/PhQuestionMark-CTmeI7MQ.js.map +1 -0
  93. package/dist/PhSealCheck-BSlqkxnH.js +74 -0
  94. package/dist/PhSealCheck-BSlqkxnH.js.map +1 -0
  95. package/dist/PhSignOut-CEXxlRk3.js +74 -0
  96. package/dist/PhSignOut-CEXxlRk3.js.map +1 -0
  97. package/dist/PhSpinner-Do1pY8fG.js +74 -0
  98. package/dist/PhSpinner-Do1pY8fG.js.map +1 -0
  99. package/dist/PhTrash-JNKavmpg.js +74 -0
  100. package/dist/PhTrash-JNKavmpg.js.map +1 -0
  101. package/dist/PhUser-BW7E-xYg.js +74 -0
  102. package/dist/PhUser-BW7E-xYg.js.map +1 -0
  103. package/dist/PhVault-mzxUgBYN.js +74 -0
  104. package/dist/PhVault-mzxUgBYN.js.map +1 -0
  105. package/dist/PhWallet-BR9JThKU.js +74 -0
  106. package/dist/PhWallet-BR9JThKU.js.map +1 -0
  107. package/dist/PhWarning-DxuQ70WM.js +74 -0
  108. package/dist/PhWarning-DxuQ70WM.js.map +1 -0
  109. package/dist/PhWarningCircle-DCI0JC1F.js +74 -0
  110. package/dist/PhWarningCircle-DCI0JC1F.js.map +1 -0
  111. package/dist/PhX-CWNXqpGn.js +74 -0
  112. package/dist/PhX-CWNXqpGn.js.map +1 -0
  113. package/dist/SwapController-B9-o3mQi.js +684 -0
  114. package/dist/SwapController-B9-o3mQi.js.map +1 -0
  115. package/dist/WebCryptoP256-C3tULCeM.js +3306 -0
  116. package/dist/WebCryptoP256-C3tULCeM.js.map +1 -0
  117. package/dist/add-D30MIcu9.js +20 -0
  118. package/dist/add-D30MIcu9.js.map +1 -0
  119. package/dist/all-wallets-C80If_mR.js +11 -0
  120. package/dist/all-wallets-C80If_mR.js.map +1 -0
  121. package/dist/app-store-BmykKf9Z.js +22 -0
  122. package/dist/app-store-BmykKf9Z.js.map +1 -0
  123. package/dist/appkit-8yrMZRW-.js +122304 -0
  124. package/dist/appkit-8yrMZRW-.js.map +1 -0
  125. package/dist/appkit.js +11 -0
  126. package/dist/appkit.js.map +1 -0
  127. package/dist/apple-Dj3k73U9.js +23 -0
  128. package/dist/apple-Dj3k73U9.js.map +1 -0
  129. package/dist/arrow-bottom-circle-BChVBNAj.js +16 -0
  130. package/dist/arrow-bottom-circle-BChVBNAj.js.map +1 -0
  131. package/dist/arrow-bottom-yR02zZ81.js +13 -0
  132. package/dist/arrow-bottom-yR02zZ81.js.map +1 -0
  133. package/dist/arrow-left-Cee83VTx.js +13 -0
  134. package/dist/arrow-left-Cee83VTx.js.map +1 -0
  135. package/dist/arrow-right-DQ18mteW.js +13 -0
  136. package/dist/arrow-right-DQ18mteW.js.map +1 -0
  137. package/dist/arrow-top-B6s5gNau.js +13 -0
  138. package/dist/arrow-top-B6s5gNau.js.map +1 -0
  139. package/dist/async-directive-CMZZt7_p.js +73 -0
  140. package/dist/async-directive-CMZZt7_p.js.map +1 -0
  141. package/dist/bank-CbtVBu5E.js +19 -0
  142. package/dist/bank-CbtVBu5E.js.map +1 -0
  143. package/dist/basic-DgeOYTPN.js +4914 -0
  144. package/dist/basic-DgeOYTPN.js.map +1 -0
  145. package/dist/browser-5XoTmr4n.js +1991 -0
  146. package/dist/browser-5XoTmr4n.js.map +1 -0
  147. package/dist/browser-DKlNidhn.js +19 -0
  148. package/dist/browser-DKlNidhn.js.map +1 -0
  149. package/dist/card-SMLX2mqy.js +19 -0
  150. package/dist/card-SMLX2mqy.js.map +1 -0
  151. package/dist/ccip-CelHgeHp.js +164 -0
  152. package/dist/ccip-CelHgeHp.js.map +1 -0
  153. package/dist/checkmark-BFaipJhW.js +16 -0
  154. package/dist/checkmark-BFaipJhW.js.map +1 -0
  155. package/dist/checkmark-bold-Bo-g2gCt.js +13 -0
  156. package/dist/checkmark-bold-Bo-g2gCt.js.map +1 -0
  157. package/dist/chevron-bottom-CLdpL1_U.js +13 -0
  158. package/dist/chevron-bottom-CLdpL1_U.js.map +1 -0
  159. package/dist/chevron-left-BMatzLVm.js +13 -0
  160. package/dist/chevron-left-BMatzLVm.js.map +1 -0
  161. package/dist/chevron-right-2QBn-njW.js +13 -0
  162. package/dist/chevron-right-2QBn-njW.js.map +1 -0
  163. package/dist/chevron-top-3JfkBBnK.js +13 -0
  164. package/dist/chevron-top-3JfkBBnK.js.map +1 -0
  165. package/dist/chrome-store-zmrzd-ux.js +66 -0
  166. package/dist/chrome-store-zmrzd-ux.js.map +1 -0
  167. package/dist/class-map-k3nlzPqR.js +101 -0
  168. package/dist/class-map-k3nlzPqR.js.map +1 -0
  169. package/dist/clock-CwBvHRGi.js +13 -0
  170. package/dist/clock-CwBvHRGi.js.map +1 -0
  171. package/dist/close-DGwKhnz2.js +13 -0
  172. package/dist/close-DGwKhnz2.js.map +1 -0
  173. package/dist/clsx.m-D57qXwfE.js +21 -0
  174. package/dist/clsx.m-D57qXwfE.js.map +1 -0
  175. package/dist/coinPlaceholder-Bjl3yxih.js +13 -0
  176. package/dist/coinPlaceholder-Bjl3yxih.js.map +1 -0
  177. package/dist/compass-Ci53Xt_m.js +13 -0
  178. package/dist/compass-Ci53Xt_m.js.map +1 -0
  179. package/dist/copy-DEV1V6UY.js +20 -0
  180. package/dist/copy-DEV1V6UY.js.map +1 -0
  181. package/dist/core-C57n14fz.js +16288 -0
  182. package/dist/core-C57n14fz.js.map +1 -0
  183. package/dist/cursor-aZqnhG2b.js +8 -0
  184. package/dist/cursor-aZqnhG2b.js.map +1 -0
  185. package/dist/cursor-transparent-B1JSDQ4k.js +17 -0
  186. package/dist/cursor-transparent-B1JSDQ4k.js.map +1 -0
  187. package/dist/data-capture-4tu-_Un-.js +549 -0
  188. package/dist/data-capture-4tu-_Un-.js.map +1 -0
  189. package/dist/desktop-CYHnO2jB.js +14 -0
  190. package/dist/desktop-CYHnO2jB.js.map +1 -0
  191. package/dist/disconnect-Bort8PHj.js +13 -0
  192. package/dist/disconnect-Bort8PHj.js.map +1 -0
  193. package/dist/discord-DC76-391.js +22 -0
  194. package/dist/discord-DC76-391.js.map +1 -0
  195. package/dist/email-CetCpugE.js +421 -0
  196. package/dist/email-CetCpugE.js.map +1 -0
  197. package/dist/embedded-wallet-DGmopvFw.js +952 -0
  198. package/dist/embedded-wallet-DGmopvFw.js.map +1 -0
  199. package/dist/etherscan-CM1VXVi8.js +11 -0
  200. package/dist/etherscan-CM1VXVi8.js.map +1 -0
  201. package/dist/exclamation-triangle-C2EQS3zg.js +9 -0
  202. package/dist/exclamation-triangle-C2EQS3zg.js.map +1 -0
  203. package/dist/extension-CrQTWCzR.js +13 -0
  204. package/dist/extension-CrQTWCzR.js.map +1 -0
  205. package/dist/external-link-C-HaFB9S.js +13 -0
  206. package/dist/external-link-C-HaFB9S.js.map +1 -0
  207. package/dist/facebook-vNJNGTyY.js +31 -0
  208. package/dist/facebook-vNJNGTyY.js.map +1 -0
  209. package/dist/farcaster-BojA8Y3Q.js +17 -0
  210. package/dist/farcaster-BojA8Y3Q.js.map +1 -0
  211. package/dist/features-BqXSc1qT.js +319 -0
  212. package/dist/features-BqXSc1qT.js.map +1 -0
  213. package/dist/filters-CPcSdM3I.js +13 -0
  214. package/dist/filters-CPcSdM3I.js.map +1 -0
  215. package/dist/github-lRHD4KBY.js +23 -0
  216. package/dist/github-lRHD4KBY.js.map +1 -0
  217. package/dist/google-CxxvUUsR.js +23 -0
  218. package/dist/google-CxxvUUsR.js.map +1 -0
  219. package/dist/hashTypedData-CGPAwUvI.js +259 -0
  220. package/dist/hashTypedData-CGPAwUvI.js.map +1 -0
  221. package/dist/help-circle-YHj9O9n4.js +17 -0
  222. package/dist/help-circle-YHj9O9n4.js.map +1 -0
  223. package/dist/id-BbzMFdj1.js +17 -0
  224. package/dist/id-BbzMFdj1.js.map +1 -0
  225. package/dist/if-defined-G2Q1ofvJ.js +11 -0
  226. package/dist/if-defined-G2Q1ofvJ.js.map +1 -0
  227. package/dist/image-BXTuNWmr.js +9 -0
  228. package/dist/image-BXTuNWmr.js.map +1 -0
  229. package/dist/index-21QOMdJE.js +984 -0
  230. package/dist/index-21QOMdJE.js.map +1 -0
  231. package/dist/index-51p9LM0s.js +218 -0
  232. package/dist/index-51p9LM0s.js.map +1 -0
  233. package/dist/index-ALlvRvBi.js +3987 -0
  234. package/dist/index-ALlvRvBi.js.map +1 -0
  235. package/dist/index-B6tCHS_j.js +120 -0
  236. package/dist/index-B6tCHS_j.js.map +1 -0
  237. package/dist/index-B9IUGIqh.js +211 -0
  238. package/dist/index-B9IUGIqh.js.map +1 -0
  239. package/dist/index-BFKYwgq3.js +7488 -0
  240. package/dist/index-BFKYwgq3.js.map +1 -0
  241. package/dist/index-BPB7fVHQ.js +281 -0
  242. package/dist/index-BPB7fVHQ.js.map +1 -0
  243. package/dist/index-BdRMG5oJ.js +126 -0
  244. package/dist/index-BdRMG5oJ.js.map +1 -0
  245. package/dist/index-Bowi-aBJ.js +147 -0
  246. package/dist/index-Bowi-aBJ.js.map +1 -0
  247. package/dist/index-BpOoitMw.js +131 -0
  248. package/dist/index-BpOoitMw.js.map +1 -0
  249. package/dist/index-BqCjN5Bk.js +124 -0
  250. package/dist/index-BqCjN5Bk.js.map +1 -0
  251. package/dist/index-Bv2Jkp0T.js +967 -0
  252. package/dist/index-Bv2Jkp0T.js.map +1 -0
  253. package/dist/index-C2tJFA0B.js +1372 -0
  254. package/dist/index-C2tJFA0B.js.map +1 -0
  255. package/dist/index-C3h1bsiv.js +109 -0
  256. package/dist/index-C3h1bsiv.js.map +1 -0
  257. package/dist/index-CFC2NxJ5.js +180 -0
  258. package/dist/index-CFC2NxJ5.js.map +1 -0
  259. package/dist/index-CG2tDcOE.js +182 -0
  260. package/dist/index-CG2tDcOE.js.map +1 -0
  261. package/dist/index-CM8qnUNO.js +181 -0
  262. package/dist/index-CM8qnUNO.js.map +1 -0
  263. package/dist/index-CNivx0yI.js +1178 -0
  264. package/dist/index-CNivx0yI.js.map +1 -0
  265. package/dist/index-CStkjfQQ.js +521 -0
  266. package/dist/index-CStkjfQQ.js.map +1 -0
  267. package/dist/index-CV3sK6gH.js +7258 -0
  268. package/dist/index-CV3sK6gH.js.map +1 -0
  269. package/dist/index-CZkzO2fh.js +70 -0
  270. package/dist/index-CZkzO2fh.js.map +1 -0
  271. package/dist/index-Ce3DzdHE.js +520 -0
  272. package/dist/index-Ce3DzdHE.js.map +1 -0
  273. package/dist/index-CgVqanW1.js +611 -0
  274. package/dist/index-CgVqanW1.js.map +1 -0
  275. package/dist/index-Ci6Y519l.js +249 -0
  276. package/dist/index-Ci6Y519l.js.map +1 -0
  277. package/dist/index-CnpO-uMV.js +62 -0
  278. package/dist/index-CnpO-uMV.js.map +1 -0
  279. package/dist/index-Cs_Ue1li.js +9530 -0
  280. package/dist/index-Cs_Ue1li.js.map +1 -0
  281. package/dist/index-CzIN86Z6.js +52 -0
  282. package/dist/index-CzIN86Z6.js.map +1 -0
  283. package/dist/index-DGrOD_Uk.js +136 -0
  284. package/dist/index-DGrOD_Uk.js.map +1 -0
  285. package/dist/index-DQgrdARk.js +198 -0
  286. package/dist/index-DQgrdARk.js.map +1 -0
  287. package/dist/index-DUrjw7B_.js +92 -0
  288. package/dist/index-DUrjw7B_.js.map +1 -0
  289. package/dist/index-DYvUtH2H.js +198 -0
  290. package/dist/index-DYvUtH2H.js.map +1 -0
  291. package/dist/index-DjlKuTuO.js +1582 -0
  292. package/dist/index-DjlKuTuO.js.map +1 -0
  293. package/dist/index-DrdtZOyM.js +286 -0
  294. package/dist/index-DrdtZOyM.js.map +1 -0
  295. package/dist/index-Dt1IUAIj.js +716 -0
  296. package/dist/index-Dt1IUAIj.js.map +1 -0
  297. package/dist/index-DvmMzzVa.js +18322 -0
  298. package/dist/index-DvmMzzVa.js.map +1 -0
  299. package/dist/index-DzZOIbsR.js +147 -0
  300. package/dist/index-DzZOIbsR.js.map +1 -0
  301. package/dist/index-ENsIYRhz.js +542 -0
  302. package/dist/index-ENsIYRhz.js.map +1 -0
  303. package/dist/index-QqIUi-wY.js +2402 -0
  304. package/dist/index-QqIUi-wY.js.map +1 -0
  305. package/dist/index-SlVjFZvp.js +110 -0
  306. package/dist/index-SlVjFZvp.js.map +1 -0
  307. package/dist/index-VKogKIsA.js +985 -0
  308. package/dist/index-VKogKIsA.js.map +1 -0
  309. package/dist/index-bd39Gizk.js +153 -0
  310. package/dist/index-bd39Gizk.js.map +1 -0
  311. package/dist/index-ciqjpb4e.js +73 -0
  312. package/dist/index-ciqjpb4e.js.map +1 -0
  313. package/dist/index-d4z00ajR.js +456 -0
  314. package/dist/index-d4z00ajR.js.map +1 -0
  315. package/dist/index-dTaiyIFQ.js +257 -0
  316. package/dist/index-dTaiyIFQ.js.map +1 -0
  317. package/dist/index-nkefGcqB.js +9350 -0
  318. package/dist/index-nkefGcqB.js.map +1 -0
  319. package/dist/index-pg-zQJY9.js +441 -0
  320. package/dist/index-pg-zQJY9.js.map +1 -0
  321. package/dist/index.es-Dpl-2r0L.js +8503 -0
  322. package/dist/index.es-Dpl-2r0L.js.map +1 -0
  323. package/dist/info-BhGLu7a7.js +8 -0
  324. package/dist/info-BhGLu7a7.js.map +1 -0
  325. package/dist/info-circle-qS-gYigf.js +17 -0
  326. package/dist/info-circle-qS-gYigf.js.map +1 -0
  327. package/dist/jsxRuntime.module-Bj81_EKI.js +14 -0
  328. package/dist/jsxRuntime.module-Bj81_EKI.js.map +1 -0
  329. package/dist/lightbulb-CkRo4E3y.js +8 -0
  330. package/dist/lightbulb-CkRo4E3y.js.map +1 -0
  331. package/dist/localBatchGatewayRequest-BP_oqSkW.js +103 -0
  332. package/dist/localBatchGatewayRequest-BP_oqSkW.js.map +1 -0
  333. package/dist/mail-DPd51pyO.js +13 -0
  334. package/dist/mail-DPd51pyO.js.map +1 -0
  335. package/dist/metamask-sdk-yihv7E6u.js +16699 -0
  336. package/dist/metamask-sdk-yihv7E6u.js.map +1 -0
  337. package/dist/mobile-CRO9ITfa.js +14 -0
  338. package/dist/mobile-CRO9ITfa.js.map +1 -0
  339. package/dist/more-DyaHLM9d.js +16 -0
  340. package/dist/more-DyaHLM9d.js.map +1 -0
  341. package/dist/native-CMPA4OCm.js +17 -0
  342. package/dist/native-CMPA4OCm.js.map +1 -0
  343. package/dist/network-placeholder-DGSqV09i.js +19 -0
  344. package/dist/network-placeholder-DGSqV09i.js.map +1 -0
  345. package/dist/nftPlaceholder-CLGGLw6g.js +13 -0
  346. package/dist/nftPlaceholder-CLGGLw6g.js.map +1 -0
  347. package/dist/off-CDy-1GjF.js +13 -0
  348. package/dist/off-CDy-1GjF.js.map +1 -0
  349. package/dist/onramp-pjFNY0fj.js +979 -0
  350. package/dist/onramp-pjFNY0fj.js.map +1 -0
  351. package/dist/parseSignature-CV_ULbSZ.js +2828 -0
  352. package/dist/parseSignature-CV_ULbSZ.js.map +1 -0
  353. package/dist/pay-with-exchange-Cz8dXxOa.js +603 -0
  354. package/dist/pay-with-exchange-Cz8dXxOa.js.map +1 -0
  355. package/dist/play-store-CdQ0GJhU.js +37 -0
  356. package/dist/play-store-CdQ0GJhU.js.map +1 -0
  357. package/dist/plus-DD_oKDcI.js +18 -0
  358. package/dist/plus-DD_oKDcI.js.map +1 -0
  359. package/dist/property-8UcTqffH.js +623 -0
  360. package/dist/property-8UcTqffH.js.map +1 -0
  361. package/dist/qr-code-BJLuAwDg.js +11 -0
  362. package/dist/qr-code-BJLuAwDg.js.map +1 -0
  363. package/dist/receive-Brpo8_fV.js +262 -0
  364. package/dist/receive-Brpo8_fV.js.map +1 -0
  365. package/dist/recycle-horizontal-DMqA4Y6p.js +14 -0
  366. package/dist/recycle-horizontal-DMqA4Y6p.js.map +1 -0
  367. package/dist/ref-6sYmD-zI.js +43 -0
  368. package/dist/ref-6sYmD-zI.js.map +1 -0
  369. package/dist/refresh-SYbxLwZK.js +13 -0
  370. package/dist/refresh-SYbxLwZK.js.map +1 -0
  371. package/dist/reown-logo-FMoXntuJ.js +17 -0
  372. package/dist/reown-logo-FMoXntuJ.js.map +1 -0
  373. package/dist/search-DyRiO0T8.js +13 -0
  374. package/dist/search-DyRiO0T8.js.map +1 -0
  375. package/dist/secp256k1-DCQG8fZg.js +2031 -0
  376. package/dist/secp256k1-DCQG8fZg.js.map +1 -0
  377. package/dist/send-AaCUn2jw.js +20 -0
  378. package/dist/send-AaCUn2jw.js.map +1 -0
  379. package/dist/send-cysMDEC9.js +1365 -0
  380. package/dist/send-cysMDEC9.js.map +1 -0
  381. package/dist/socials-BU9YyLx1.js +796 -0
  382. package/dist/socials-BU9YyLx1.js.map +1 -0
  383. package/dist/swapHorizontal-kHwa5wbg.js +13 -0
  384. package/dist/swapHorizontal-kHwa5wbg.js.map +1 -0
  385. package/dist/swapHorizontalBold-Bf_Sy4KD.js +13 -0
  386. package/dist/swapHorizontalBold-Bf_Sy4KD.js.map +1 -0
  387. package/dist/swapHorizontalMedium-C4oU0KJg.js +21 -0
  388. package/dist/swapHorizontalMedium-C4oU0KJg.js.map +1 -0
  389. package/dist/swapHorizontalRoundedBold-IJ8G94V0.js +13 -0
  390. package/dist/swapHorizontalRoundedBold-IJ8G94V0.js.map +1 -0
  391. package/dist/swapVertical-CuDVDBMJ.js +13 -0
  392. package/dist/swapVertical-CuDVDBMJ.js.map +1 -0
  393. package/dist/swaps-TcZwQiir.js +2121 -0
  394. package/dist/swaps-TcZwQiir.js.map +1 -0
  395. package/dist/telegram-DSi6IsaA.js +21 -0
  396. package/dist/telegram-DSi6IsaA.js.map +1 -0
  397. package/dist/three-dots-CqgQBZQ6.js +10 -0
  398. package/dist/three-dots-CqgQBZQ6.js.map +1 -0
  399. package/dist/transactions-CcagUdpJ.js +38 -0
  400. package/dist/transactions-CcagUdpJ.js.map +1 -0
  401. package/dist/twitch-DrUmltT6.js +23 -0
  402. package/dist/twitch-DrUmltT6.js.map +1 -0
  403. package/dist/twitterIcon-eNCEY2nh.js +11 -0
  404. package/dist/twitterIcon-eNCEY2nh.js.map +1 -0
  405. package/dist/vanilla-CgG5xMJO.js +448 -0
  406. package/dist/vanilla-CgG5xMJO.js.map +1 -0
  407. package/dist/verify-DGCdp1PG.js +13 -0
  408. package/dist/verify-DGCdp1PG.js.map +1 -0
  409. package/dist/verify-filled-BN5Rdq_X.js +13 -0
  410. package/dist/verify-filled-BN5Rdq_X.js.map +1 -0
  411. package/dist/w3m-modal-C23tcwd0.js +2008 -0
  412. package/dist/w3m-modal-C23tcwd0.js.map +1 -0
  413. package/dist/w3m-modal-D_WKuA4j.js +1725 -0
  414. package/dist/w3m-modal-D_WKuA4j.js.map +1 -0
  415. package/dist/wallet-Dh8w0rox.js +13 -0
  416. package/dist/wallet-Dh8w0rox.js.map +1 -0
  417. package/dist/wallet-placeholder-gjfCYn59.js +19 -0
  418. package/dist/wallet-placeholder-gjfCYn59.js.map +1 -0
  419. package/dist/wallet-standard-CWX-EDlP.js +523 -0
  420. package/dist/wallet-standard-CWX-EDlP.js.map +1 -0
  421. package/dist/walletconnect-BI4tTckl.js +39 -0
  422. package/dist/walletconnect-BI4tTckl.js.map +1 -0
  423. package/dist/warning-circle-jCqjcA2f.js +17 -0
  424. package/dist/warning-circle-jCqjcA2f.js.map +1 -0
  425. package/dist/x-BfcQ5n6S.js +17 -0
  426. package/dist/x-BfcQ5n6S.js.map +1 -0
  427. package/package.json +10 -10
@@ -0,0 +1,2121 @@
1
+ import { m as css, o as i, C as ChainController, N as NumberUtil, x, d as ConstantsUtil, E as EventsController, R as RouterController, a as CoreHelperUtil, a3 as ModalController, y as getPreferredAccountType, W as W3mFrameRpcConstants, r as resetStyles, n as elementStyles } from "./appkit-8yrMZRW-.js";
2
+ import { r, n } from "./class-map-k3nlzPqR.js";
3
+ import { c as customElement } from "./index-CNivx0yI.js";
4
+ import "./index-51p9LM0s.js";
5
+ import "./index-BdRMG5oJ.js";
6
+ import { M as MathUtil } from "./index-C3h1bsiv.js";
7
+ import "./index-CG2tDcOE.js";
8
+ import { S as SwapController } from "./SwapController-B9-o3mQi.js";
9
+ import "./index-CZkzO2fh.js";
10
+ import "./index-B9IUGIqh.js";
11
+ import "./index-Ci6Y519l.js";
12
+ import "./index-Bowi-aBJ.js";
13
+ const InputUtil = {
14
+ numericInputKeyDown(event, currentValue, onChange) {
15
+ const allowedKeys = [
16
+ "Backspace",
17
+ "Meta",
18
+ "Ctrl",
19
+ "a",
20
+ "A",
21
+ "c",
22
+ "C",
23
+ "x",
24
+ "X",
25
+ "v",
26
+ "V",
27
+ "ArrowLeft",
28
+ "ArrowRight",
29
+ "Tab"
30
+ ];
31
+ const controlPressed = event.metaKey || event.ctrlKey;
32
+ const eventKey = event.key;
33
+ const lowercaseEventKey = eventKey.toLocaleLowerCase();
34
+ const selectAll = lowercaseEventKey === "a";
35
+ const copyKey = lowercaseEventKey === "c";
36
+ const pasteKey = lowercaseEventKey === "v";
37
+ const cutKey = lowercaseEventKey === "x";
38
+ const isComma = eventKey === ",";
39
+ const isDot = eventKey === ".";
40
+ const isNumericKey = eventKey >= "0" && eventKey <= "9";
41
+ if (!controlPressed && (selectAll || copyKey || pasteKey || cutKey)) {
42
+ event.preventDefault();
43
+ }
44
+ if (currentValue === "0" && !isComma && !isDot && eventKey === "0") {
45
+ event.preventDefault();
46
+ }
47
+ if (currentValue === "0" && isNumericKey) {
48
+ onChange(eventKey);
49
+ event.preventDefault();
50
+ }
51
+ if (isComma || isDot) {
52
+ if (!currentValue) {
53
+ onChange("0.");
54
+ event.preventDefault();
55
+ }
56
+ if ((currentValue == null ? void 0 : currentValue.includes(".")) || (currentValue == null ? void 0 : currentValue.includes(","))) {
57
+ event.preventDefault();
58
+ }
59
+ }
60
+ if (!isNumericKey && !allowedKeys.includes(eventKey) && !isDot && !isComma) {
61
+ event.preventDefault();
62
+ }
63
+ }
64
+ };
65
+ const styles$7 = css`
66
+ :host {
67
+ width: 100%;
68
+ }
69
+
70
+ .details-container > wui-flex {
71
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
72
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
73
+ width: 100%;
74
+ }
75
+
76
+ .details-container > wui-flex > button {
77
+ border: none;
78
+ background: none;
79
+ padding: ${({ spacing }) => spacing["3"]};
80
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
81
+ cursor: pointer;
82
+ }
83
+
84
+ .details-content-container {
85
+ padding: ${({ spacing }) => spacing["2"]};
86
+ padding-top: 0px;
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ }
91
+
92
+ .details-content-container > wui-flex {
93
+ width: 100%;
94
+ }
95
+
96
+ .details-row {
97
+ width: 100%;
98
+ padding: ${({ spacing }) => spacing["3"]};
99
+ padding-left: ${({ spacing }) => spacing["3"]};
100
+ padding-right: ${({ spacing }) => spacing["2"]};
101
+ border-radius: calc(
102
+ ${({ borderRadius }) => borderRadius["1"]} + ${({ borderRadius }) => borderRadius["1"]}
103
+ );
104
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
105
+ }
106
+
107
+ .details-row-title {
108
+ white-space: nowrap;
109
+ }
110
+
111
+ .details-row.provider-free-row {
112
+ padding-right: ${({ spacing }) => spacing["2"]};
113
+ }
114
+ `;
115
+ var __decorate$7 = function(decorators, target, key, desc) {
116
+ var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
117
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
118
+ else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
119
+ return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
120
+ };
121
+ const slippageRate = ConstantsUtil.CONVERT_SLIPPAGE_TOLERANCE;
122
+ let WuiSwapDetails = class WuiSwapDetails2 extends i {
123
+ constructor() {
124
+ var _a;
125
+ super();
126
+ this.unsubscribe = [];
127
+ this.networkName = (_a = ChainController.state.activeCaipNetwork) == null ? void 0 : _a.name;
128
+ this.detailsOpen = false;
129
+ this.sourceToken = SwapController.state.sourceToken;
130
+ this.toToken = SwapController.state.toToken;
131
+ this.toTokenAmount = SwapController.state.toTokenAmount;
132
+ this.sourceTokenPriceInUSD = SwapController.state.sourceTokenPriceInUSD;
133
+ this.toTokenPriceInUSD = SwapController.state.toTokenPriceInUSD;
134
+ this.priceImpact = SwapController.state.priceImpact;
135
+ this.maxSlippage = SwapController.state.maxSlippage;
136
+ this.networkTokenSymbol = SwapController.state.networkTokenSymbol;
137
+ this.inputError = SwapController.state.inputError;
138
+ this.unsubscribe.push(...[
139
+ SwapController.subscribe((newState) => {
140
+ this.sourceToken = newState.sourceToken;
141
+ this.toToken = newState.toToken;
142
+ this.toTokenAmount = newState.toTokenAmount;
143
+ this.priceImpact = newState.priceImpact;
144
+ this.maxSlippage = newState.maxSlippage;
145
+ this.sourceTokenPriceInUSD = newState.sourceTokenPriceInUSD;
146
+ this.toTokenPriceInUSD = newState.toTokenPriceInUSD;
147
+ this.inputError = newState.inputError;
148
+ })
149
+ ]);
150
+ }
151
+ render() {
152
+ const minReceivedAmount = this.toTokenAmount && this.maxSlippage ? NumberUtil.bigNumber(this.toTokenAmount).minus(this.maxSlippage).toString() : null;
153
+ if (!this.sourceToken || !this.toToken || this.inputError) {
154
+ return null;
155
+ }
156
+ const toTokenSwappedAmount = this.sourceTokenPriceInUSD && this.toTokenPriceInUSD ? 1 / this.toTokenPriceInUSD * this.sourceTokenPriceInUSD : 0;
157
+ return x`
158
+ <wui-flex flexDirection="column" alignItems="center" gap="01" class="details-container">
159
+ <wui-flex flexDirection="column">
160
+ <button @click=${this.toggleDetails.bind(this)}>
161
+ <wui-flex justifyContent="space-between" .padding=${["0", "2", "0", "2"]}>
162
+ <wui-flex justifyContent="flex-start" flexGrow="1" gap="2">
163
+ <wui-text variant="sm-regular" color="primary">
164
+ 1 ${this.sourceToken.symbol} =
165
+ ${NumberUtil.formatNumberToLocalString(toTokenSwappedAmount, 3)}
166
+ ${this.toToken.symbol}
167
+ </wui-text>
168
+ <wui-text variant="sm-regular" color="secondary">
169
+ $${NumberUtil.formatNumberToLocalString(this.sourceTokenPriceInUSD)}
170
+ </wui-text>
171
+ </wui-flex>
172
+ <wui-icon name="chevronBottom"></wui-icon>
173
+ </wui-flex>
174
+ </button>
175
+ ${this.detailsOpen ? x`
176
+ <wui-flex flexDirection="column" gap="2" class="details-content-container">
177
+ ${this.priceImpact ? x` <wui-flex flexDirection="column" gap="2">
178
+ <wui-flex
179
+ justifyContent="space-between"
180
+ alignItems="center"
181
+ class="details-row"
182
+ >
183
+ <wui-flex alignItems="center" gap="2">
184
+ <wui-text
185
+ class="details-row-title"
186
+ variant="sm-regular"
187
+ color="secondary"
188
+ >
189
+ Price impact
190
+ </wui-text>
191
+ <w3m-tooltip-trigger
192
+ text="Price impact reflects the change in market price due to your trade"
193
+ >
194
+ <wui-icon size="sm" color="default" name="info"></wui-icon>
195
+ </w3m-tooltip-trigger>
196
+ </wui-flex>
197
+ <wui-flex>
198
+ <wui-text variant="sm-regular" color="secondary">
199
+ ${NumberUtil.formatNumberToLocalString(this.priceImpact, 3)}%
200
+ </wui-text>
201
+ </wui-flex>
202
+ </wui-flex>
203
+ </wui-flex>` : null}
204
+ ${this.maxSlippage && this.sourceToken.symbol ? x`<wui-flex flexDirection="column" gap="2">
205
+ <wui-flex
206
+ justifyContent="space-between"
207
+ alignItems="center"
208
+ class="details-row"
209
+ >
210
+ <wui-flex alignItems="center" gap="2">
211
+ <wui-text
212
+ class="details-row-title"
213
+ variant="sm-regular"
214
+ color="secondary"
215
+ >
216
+ Max. slippage
217
+ </wui-text>
218
+ <w3m-tooltip-trigger
219
+ text=${`Max slippage sets the minimum amount you must receive for the transaction to proceed. ${minReceivedAmount ? `Transaction will be reversed if you receive less than ${NumberUtil.formatNumberToLocalString(minReceivedAmount, 6)} ${this.toToken.symbol} due to price changes.` : ""}`}
220
+ >
221
+ <wui-icon size="sm" color="default" name="info"></wui-icon>
222
+ </w3m-tooltip-trigger>
223
+ </wui-flex>
224
+ <wui-flex>
225
+ <wui-text variant="sm-regular" color="secondary">
226
+ ${NumberUtil.formatNumberToLocalString(this.maxSlippage, 6)}
227
+ ${this.toToken.symbol} ${slippageRate}%
228
+ </wui-text>
229
+ </wui-flex>
230
+ </wui-flex>
231
+ </wui-flex>` : null}
232
+ <wui-flex flexDirection="column" gap="2">
233
+ <wui-flex
234
+ justifyContent="space-between"
235
+ alignItems="center"
236
+ class="details-row provider-free-row"
237
+ >
238
+ <wui-flex alignItems="center" gap="2">
239
+ <wui-text class="details-row-title" variant="sm-regular" color="secondary">
240
+ Provider fee
241
+ </wui-text>
242
+ </wui-flex>
243
+ <wui-flex>
244
+ <wui-text variant="sm-regular" color="secondary">0.85%</wui-text>
245
+ </wui-flex>
246
+ </wui-flex>
247
+ </wui-flex>
248
+ </wui-flex>
249
+ ` : null}
250
+ </wui-flex>
251
+ </wui-flex>
252
+ `;
253
+ }
254
+ toggleDetails() {
255
+ this.detailsOpen = !this.detailsOpen;
256
+ }
257
+ };
258
+ WuiSwapDetails.styles = [styles$7];
259
+ __decorate$7([
260
+ r()
261
+ ], WuiSwapDetails.prototype, "networkName", void 0);
262
+ __decorate$7([
263
+ n()
264
+ ], WuiSwapDetails.prototype, "detailsOpen", void 0);
265
+ __decorate$7([
266
+ r()
267
+ ], WuiSwapDetails.prototype, "sourceToken", void 0);
268
+ __decorate$7([
269
+ r()
270
+ ], WuiSwapDetails.prototype, "toToken", void 0);
271
+ __decorate$7([
272
+ r()
273
+ ], WuiSwapDetails.prototype, "toTokenAmount", void 0);
274
+ __decorate$7([
275
+ r()
276
+ ], WuiSwapDetails.prototype, "sourceTokenPriceInUSD", void 0);
277
+ __decorate$7([
278
+ r()
279
+ ], WuiSwapDetails.prototype, "toTokenPriceInUSD", void 0);
280
+ __decorate$7([
281
+ r()
282
+ ], WuiSwapDetails.prototype, "priceImpact", void 0);
283
+ __decorate$7([
284
+ r()
285
+ ], WuiSwapDetails.prototype, "maxSlippage", void 0);
286
+ __decorate$7([
287
+ r()
288
+ ], WuiSwapDetails.prototype, "networkTokenSymbol", void 0);
289
+ __decorate$7([
290
+ r()
291
+ ], WuiSwapDetails.prototype, "inputError", void 0);
292
+ WuiSwapDetails = __decorate$7([
293
+ customElement("w3m-swap-details")
294
+ ], WuiSwapDetails);
295
+ const styles$6 = css`
296
+ :host {
297
+ width: 100%;
298
+ }
299
+
300
+ :host > wui-flex {
301
+ display: flex;
302
+ flex-direction: row;
303
+ justify-content: space-between;
304
+ align-items: center;
305
+ border-radius: ${({ borderRadius }) => borderRadius["5"]};
306
+ padding: ${({ spacing }) => spacing["5"]};
307
+ padding-right: ${({ spacing }) => spacing["3"]};
308
+ background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
309
+ box-shadow: inset 0px 0px 0px 1px ${({ tokens }) => tokens.theme.foregroundPrimary};
310
+ width: 100%;
311
+ height: 100px;
312
+ box-sizing: border-box;
313
+ position: relative;
314
+ }
315
+
316
+ wui-shimmer.market-value {
317
+ opacity: 0;
318
+ }
319
+
320
+ :host > wui-flex > svg.input_mask {
321
+ position: absolute;
322
+ inset: 0;
323
+ z-index: 5;
324
+ }
325
+
326
+ :host wui-flex .input_mask__border,
327
+ :host wui-flex .input_mask__background {
328
+ transition: fill ${({ durations }) => durations["md"]}
329
+ ${({ easings }) => easings["ease-out-power-1"]};
330
+ will-change: fill;
331
+ }
332
+
333
+ :host wui-flex .input_mask__border {
334
+ fill: ${({ tokens }) => tokens.core.glass010};
335
+ }
336
+
337
+ :host wui-flex .input_mask__background {
338
+ fill: ${({ tokens }) => tokens.theme.foregroundPrimary};
339
+ }
340
+ `;
341
+ var __decorate$6 = function(decorators, target, key, desc) {
342
+ var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
343
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
344
+ else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
345
+ return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
346
+ };
347
+ let W3mSwapInputSkeleton = class W3mSwapInputSkeleton2 extends i {
348
+ constructor() {
349
+ super(...arguments);
350
+ this.target = "sourceToken";
351
+ }
352
+ render() {
353
+ return x`
354
+ <wui-flex class justifyContent="space-between">
355
+ <wui-flex
356
+ flex="1"
357
+ flexDirection="column"
358
+ alignItems="flex-start"
359
+ justifyContent="center"
360
+ class="swap-input"
361
+ gap="1"
362
+ >
363
+ <wui-shimmer width="80px" height="40px" rounded variant="light"></wui-shimmer>
364
+ </wui-flex>
365
+ ${this.templateTokenSelectButton()}
366
+ </wui-flex>
367
+ `;
368
+ }
369
+ templateTokenSelectButton() {
370
+ return x`
371
+ <wui-flex
372
+ class="swap-token-button"
373
+ flexDirection="column"
374
+ alignItems="flex-end"
375
+ justifyContent="center"
376
+ gap="1"
377
+ >
378
+ <wui-shimmer width="80px" height="40px" rounded variant="light"></wui-shimmer>
379
+ </wui-flex>
380
+ `;
381
+ }
382
+ };
383
+ W3mSwapInputSkeleton.styles = [styles$6];
384
+ __decorate$6([
385
+ n()
386
+ ], W3mSwapInputSkeleton.prototype, "target", void 0);
387
+ W3mSwapInputSkeleton = __decorate$6([
388
+ customElement("w3m-swap-input-skeleton")
389
+ ], W3mSwapInputSkeleton);
390
+ const styles$5 = css`
391
+ :host > wui-flex {
392
+ display: flex;
393
+ flex-direction: row;
394
+ justify-content: space-between;
395
+ align-items: center;
396
+ border-radius: ${({ borderRadius }) => borderRadius["5"]};
397
+ background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
398
+ padding: ${({ spacing }) => spacing["5"]};
399
+ padding-right: ${({ spacing }) => spacing["3"]};
400
+ width: 100%;
401
+ height: 100px;
402
+ box-sizing: border-box;
403
+ box-shadow: inset 0px 0px 0px 1px ${({ tokens }) => tokens.theme.foregroundPrimary};
404
+ position: relative;
405
+ transition: box-shadow ${({ easings }) => easings["ease-out-power-1"]}
406
+ ${({ durations }) => durations["lg"]};
407
+ will-change: background-color;
408
+ }
409
+
410
+ :host wui-flex.focus {
411
+ box-shadow: inset 0px 0px 0px 1px ${({ tokens }) => tokens.core.glass010};
412
+ }
413
+
414
+ :host > wui-flex .swap-input,
415
+ :host > wui-flex .swap-token-button {
416
+ z-index: 10;
417
+ }
418
+
419
+ :host > wui-flex .swap-input {
420
+ -webkit-mask-image: linear-gradient(
421
+ 270deg,
422
+ transparent 0px,
423
+ transparent 8px,
424
+ black 24px,
425
+ black 25px,
426
+ black 32px,
427
+ black 100%
428
+ );
429
+ mask-image: linear-gradient(
430
+ 270deg,
431
+ transparent 0px,
432
+ transparent 8px,
433
+ black 24px,
434
+ black 25px,
435
+ black 32px,
436
+ black 100%
437
+ );
438
+ }
439
+
440
+ :host > wui-flex .swap-input input {
441
+ background: none;
442
+ border: none;
443
+ height: 42px;
444
+ width: 100%;
445
+ font-size: 32px;
446
+ font-style: normal;
447
+ font-weight: 400;
448
+ line-height: 130%;
449
+ letter-spacing: -1.28px;
450
+ outline: none;
451
+ caret-color: ${({ tokens }) => tokens.core.textAccentPrimary};
452
+ color: ${({ tokens }) => tokens.theme.textPrimary};
453
+ padding: 0px;
454
+ }
455
+
456
+ :host > wui-flex .swap-input input:focus-visible {
457
+ outline: none;
458
+ }
459
+
460
+ :host > wui-flex .swap-input input::-webkit-outer-spin-button,
461
+ :host > wui-flex .swap-input input::-webkit-inner-spin-button {
462
+ -webkit-appearance: none;
463
+ margin: 0;
464
+ }
465
+
466
+ .max-value-button {
467
+ background-color: transparent;
468
+ border: none;
469
+ cursor: pointer;
470
+ color: ${({ tokens }) => tokens.core.glass010};
471
+ padding-left: 0px;
472
+ }
473
+
474
+ .market-value {
475
+ min-height: 18px;
476
+ }
477
+ `;
478
+ var __decorate$5 = function(decorators, target, key, desc) {
479
+ var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
480
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
481
+ else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
482
+ return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
483
+ };
484
+ const MINIMUM_USD_VALUE_TO_CONVERT = 5e-5;
485
+ let W3mSwapInput = class W3mSwapInput2 extends i {
486
+ constructor() {
487
+ super(...arguments);
488
+ this.focused = false;
489
+ this.price = 0;
490
+ this.target = "sourceToken";
491
+ this.onSetAmount = null;
492
+ this.onSetMaxValue = null;
493
+ }
494
+ render() {
495
+ const marketValue = this.marketValue || "0";
496
+ const isMarketValueGreaterThanZero = NumberUtil.bigNumber(marketValue).gt("0");
497
+ return x`
498
+ <wui-flex
499
+ class="${this.focused ? "focus" : ""}"
500
+ justifyContent="space-between"
501
+ alignItems="center"
502
+ >
503
+ <wui-flex
504
+ flex="1"
505
+ flexDirection="column"
506
+ alignItems="flex-start"
507
+ justifyContent="center"
508
+ class="swap-input"
509
+ >
510
+ <input
511
+ data-testid="swap-input-${this.target}"
512
+ @focusin=${() => this.onFocusChange(true)}
513
+ @focusout=${() => this.onFocusChange(false)}
514
+ ?disabled=${this.disabled}
515
+ value=${this.value || ""}
516
+ @input=${this.dispatchInputChangeEvent}
517
+ @keydown=${this.handleKeydown}
518
+ placeholder="0"
519
+ type="text"
520
+ inputmode="decimal"
521
+ pattern="[0-9,.]*"
522
+ />
523
+ <wui-text class="market-value" variant="sm-regular" color="secondary">
524
+ ${isMarketValueGreaterThanZero ? `$${NumberUtil.formatNumberToLocalString(this.marketValue, 2)}` : null}
525
+ </wui-text>
526
+ </wui-flex>
527
+ ${this.templateTokenSelectButton()}
528
+ </wui-flex>
529
+ `;
530
+ }
531
+ handleKeydown(event) {
532
+ return InputUtil.numericInputKeyDown(event, this.value, (value) => {
533
+ var _a;
534
+ return (_a = this.onSetAmount) == null ? void 0 : _a.call(this, this.target, value);
535
+ });
536
+ }
537
+ dispatchInputChangeEvent(event) {
538
+ if (!this.onSetAmount) {
539
+ return;
540
+ }
541
+ const value = event.target.value.replace(/[^0-9.]/gu, "");
542
+ if (value === "," || value === ".") {
543
+ this.onSetAmount(this.target, "0.");
544
+ } else if (value.endsWith(",")) {
545
+ this.onSetAmount(this.target, value.replace(",", "."));
546
+ } else {
547
+ this.onSetAmount(this.target, value);
548
+ }
549
+ }
550
+ setMaxValueToInput() {
551
+ var _a;
552
+ (_a = this.onSetMaxValue) == null ? void 0 : _a.call(this, this.target, this.balance);
553
+ }
554
+ templateTokenSelectButton() {
555
+ if (!this.token) {
556
+ return x` <wui-button
557
+ data-testid="swap-select-token-button-${this.target}"
558
+ class="swap-token-button"
559
+ size="md"
560
+ variant="neutral-secondary"
561
+ @click=${this.onSelectToken.bind(this)}
562
+ >
563
+ Select token
564
+ </wui-button>`;
565
+ }
566
+ return x`
567
+ <wui-flex
568
+ class="swap-token-button"
569
+ flexDirection="column"
570
+ alignItems="flex-end"
571
+ justifyContent="center"
572
+ gap="1"
573
+ >
574
+ <wui-token-button
575
+ data-testid="swap-input-token-${this.target}"
576
+ text=${this.token.symbol}
577
+ imageSrc=${this.token.logoUri}
578
+ @click=${this.onSelectToken.bind(this)}
579
+ >
580
+ </wui-token-button>
581
+ <wui-flex alignItems="center" gap="1"> ${this.tokenBalanceTemplate()} </wui-flex>
582
+ </wui-flex>
583
+ `;
584
+ }
585
+ tokenBalanceTemplate() {
586
+ const balanceValueInUSD = NumberUtil.multiply(this.balance, this.price);
587
+ const haveBalance = balanceValueInUSD ? balanceValueInUSD == null ? void 0 : balanceValueInUSD.gt(MINIMUM_USD_VALUE_TO_CONVERT) : false;
588
+ return x`
589
+ ${haveBalance ? x`<wui-text variant="sm-regular" color="secondary">
590
+ ${NumberUtil.formatNumberToLocalString(this.balance, 2)}
591
+ </wui-text>` : null}
592
+ ${this.target === "sourceToken" ? this.tokenActionButtonTemplate(haveBalance) : null}
593
+ `;
594
+ }
595
+ tokenActionButtonTemplate(haveBalance) {
596
+ if (haveBalance) {
597
+ return x` <button class="max-value-button" @click=${this.setMaxValueToInput.bind(this)}>
598
+ <wui-text color="accent-primary" variant="sm-medium">Max</wui-text>
599
+ </button>`;
600
+ }
601
+ return x` <button class="max-value-button" @click=${this.onBuyToken.bind(this)}>
602
+ <wui-text color="accent-primary" variant="sm-medium">Buy</wui-text>
603
+ </button>`;
604
+ }
605
+ onFocusChange(state) {
606
+ this.focused = state;
607
+ }
608
+ onSelectToken() {
609
+ EventsController.sendEvent({ type: "track", event: "CLICK_SELECT_TOKEN_TO_SWAP" });
610
+ RouterController.push("SwapSelectToken", {
611
+ target: this.target
612
+ });
613
+ }
614
+ onBuyToken() {
615
+ RouterController.push("OnRampProviders");
616
+ }
617
+ };
618
+ W3mSwapInput.styles = [styles$5];
619
+ __decorate$5([
620
+ n()
621
+ ], W3mSwapInput.prototype, "focused", void 0);
622
+ __decorate$5([
623
+ n()
624
+ ], W3mSwapInput.prototype, "balance", void 0);
625
+ __decorate$5([
626
+ n()
627
+ ], W3mSwapInput.prototype, "value", void 0);
628
+ __decorate$5([
629
+ n()
630
+ ], W3mSwapInput.prototype, "price", void 0);
631
+ __decorate$5([
632
+ n()
633
+ ], W3mSwapInput.prototype, "marketValue", void 0);
634
+ __decorate$5([
635
+ n()
636
+ ], W3mSwapInput.prototype, "disabled", void 0);
637
+ __decorate$5([
638
+ n()
639
+ ], W3mSwapInput.prototype, "target", void 0);
640
+ __decorate$5([
641
+ n()
642
+ ], W3mSwapInput.prototype, "token", void 0);
643
+ __decorate$5([
644
+ n()
645
+ ], W3mSwapInput.prototype, "onSetAmount", void 0);
646
+ __decorate$5([
647
+ n()
648
+ ], W3mSwapInput.prototype, "onSetMaxValue", void 0);
649
+ W3mSwapInput = __decorate$5([
650
+ customElement("w3m-swap-input")
651
+ ], W3mSwapInput);
652
+ const styles$4 = css`
653
+ :host > wui-flex:first-child {
654
+ overflow-y: auto;
655
+ overflow-x: hidden;
656
+ scrollbar-width: none;
657
+ }
658
+
659
+ :host > wui-flex:first-child::-webkit-scrollbar {
660
+ display: none;
661
+ }
662
+
663
+ wui-loading-hexagon {
664
+ position: absolute;
665
+ }
666
+
667
+ .action-button {
668
+ width: 100%;
669
+ border-radius: ${({ borderRadius }) => borderRadius["4"]};
670
+ }
671
+
672
+ .action-button:disabled {
673
+ border-color: 1px solid ${({ tokens }) => tokens.core.glass010};
674
+ }
675
+
676
+ .swap-inputs-container {
677
+ position: relative;
678
+ }
679
+
680
+ wui-icon-box {
681
+ width: 32px;
682
+ height: 32px;
683
+ border-radius: ${({ borderRadius }) => borderRadius["10"]} !important;
684
+ border: 4px solid ${({ tokens }) => tokens.theme.backgroundPrimary};
685
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
686
+ position: absolute;
687
+ top: 50%;
688
+ left: 50%;
689
+ transform: translate(-50%, -50%);
690
+ z-index: 3;
691
+ }
692
+
693
+ .replace-tokens-button-container {
694
+ display: flex;
695
+ justify-content: center;
696
+ align-items: center;
697
+ position: absolute;
698
+ top: 50%;
699
+ left: 50%;
700
+ transform: translate(-50%, -50%);
701
+ gap: ${({ spacing }) => spacing["2"]};
702
+ border-radius: ${({ borderRadius }) => borderRadius["4"]};
703
+ background-color: ${({ tokens }) => tokens.theme.backgroundPrimary};
704
+ padding: ${({ spacing }) => spacing["2"]};
705
+ }
706
+
707
+ .details-container > wui-flex {
708
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
709
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
710
+ width: 100%;
711
+ }
712
+
713
+ .details-container > wui-flex > button {
714
+ border: none;
715
+ background: none;
716
+ padding: ${({ spacing }) => spacing["3"]};
717
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
718
+ transition: background ${({ durations }) => durations["lg"]}
719
+ ${({ easings }) => easings["ease-out-power-2"]};
720
+ will-change: background;
721
+ }
722
+
723
+ .details-container > wui-flex > button:hover {
724
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
725
+ }
726
+
727
+ .details-content-container {
728
+ padding: ${({ spacing }) => spacing["2"]};
729
+ display: flex;
730
+ align-items: center;
731
+ justify-content: center;
732
+ }
733
+
734
+ .details-content-container > wui-flex {
735
+ width: 100%;
736
+ }
737
+
738
+ .details-row {
739
+ width: 100%;
740
+ padding: ${({ spacing }) => spacing["3"]} ${({ spacing }) => spacing["5"]};
741
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
742
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
743
+ }
744
+ `;
745
+ var __decorate$4 = function(decorators, target, key, desc) {
746
+ var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
747
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
748
+ else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
749
+ return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
750
+ };
751
+ let W3mSwapView = class W3mSwapView2 extends i {
752
+ subscribe({ resetSwapState, initializeSwapState }) {
753
+ return () => {
754
+ ChainController.subscribeKey("activeCaipNetwork", (newCaipNetwork) => this.onCaipNetworkChange({
755
+ newCaipNetwork,
756
+ resetSwapState,
757
+ initializeSwapState
758
+ }));
759
+ ChainController.subscribeChainProp("accountState", (val) => {
760
+ this.onCaipAddressChange({
761
+ newCaipAddress: val == null ? void 0 : val.caipAddress,
762
+ resetSwapState,
763
+ initializeSwapState
764
+ });
765
+ });
766
+ };
767
+ }
768
+ constructor() {
769
+ var _a, _b, _c;
770
+ super();
771
+ this.unsubscribe = [];
772
+ this.initialParams = (_a = RouterController.state.data) == null ? void 0 : _a.swap;
773
+ this.detailsOpen = false;
774
+ this.caipAddress = (_b = ChainController.getAccountData()) == null ? void 0 : _b.caipAddress;
775
+ this.caipNetworkId = (_c = ChainController.state.activeCaipNetwork) == null ? void 0 : _c.caipNetworkId;
776
+ this.initialized = SwapController.state.initialized;
777
+ this.loadingQuote = SwapController.state.loadingQuote;
778
+ this.loadingPrices = SwapController.state.loadingPrices;
779
+ this.loadingTransaction = SwapController.state.loadingTransaction;
780
+ this.sourceToken = SwapController.state.sourceToken;
781
+ this.sourceTokenAmount = SwapController.state.sourceTokenAmount;
782
+ this.sourceTokenPriceInUSD = SwapController.state.sourceTokenPriceInUSD;
783
+ this.toToken = SwapController.state.toToken;
784
+ this.toTokenAmount = SwapController.state.toTokenAmount;
785
+ this.toTokenPriceInUSD = SwapController.state.toTokenPriceInUSD;
786
+ this.inputError = SwapController.state.inputError;
787
+ this.fetchError = SwapController.state.fetchError;
788
+ this.lastTokenPriceUpdate = 0;
789
+ this.minTokenPriceUpdateInterval = 1e4;
790
+ this.visibilityChangeHandler = () => {
791
+ if (document == null ? void 0 : document.hidden) {
792
+ clearInterval(this.interval);
793
+ this.interval = void 0;
794
+ } else {
795
+ this.startTokenPriceInterval();
796
+ }
797
+ };
798
+ this.startTokenPriceInterval = () => {
799
+ if (this.interval && Date.now() - this.lastTokenPriceUpdate < this.minTokenPriceUpdateInterval) {
800
+ return;
801
+ }
802
+ if (this.lastTokenPriceUpdate && Date.now() - this.lastTokenPriceUpdate > this.minTokenPriceUpdateInterval) {
803
+ this.fetchTokensAndValues();
804
+ }
805
+ clearInterval(this.interval);
806
+ this.interval = setInterval(() => {
807
+ this.fetchTokensAndValues();
808
+ }, this.minTokenPriceUpdateInterval);
809
+ };
810
+ this.watchTokensAndValues = () => {
811
+ if (!this.sourceToken || !this.toToken) {
812
+ return;
813
+ }
814
+ this.subscribeToVisibilityChange();
815
+ this.startTokenPriceInterval();
816
+ };
817
+ this.onDebouncedGetSwapCalldata = CoreHelperUtil.debounce(async () => {
818
+ await SwapController.swapTokens();
819
+ }, 200);
820
+ this.subscribe({ resetSwapState: true, initializeSwapState: false })();
821
+ this.unsubscribe.push(...[
822
+ this.subscribe({ resetSwapState: false, initializeSwapState: true }),
823
+ ModalController.subscribeKey("open", (isOpen) => {
824
+ if (!isOpen) {
825
+ SwapController.resetState();
826
+ }
827
+ }),
828
+ RouterController.subscribeKey("view", (newRoute) => {
829
+ if (!newRoute.includes("Swap")) {
830
+ SwapController.resetValues();
831
+ }
832
+ }),
833
+ SwapController.subscribe((newState) => {
834
+ this.initialized = newState.initialized;
835
+ this.loadingQuote = newState.loadingQuote;
836
+ this.loadingPrices = newState.loadingPrices;
837
+ this.loadingTransaction = newState.loadingTransaction;
838
+ this.sourceToken = newState.sourceToken;
839
+ this.sourceTokenAmount = newState.sourceTokenAmount;
840
+ this.sourceTokenPriceInUSD = newState.sourceTokenPriceInUSD;
841
+ this.toToken = newState.toToken;
842
+ this.toTokenAmount = newState.toTokenAmount;
843
+ this.toTokenPriceInUSD = newState.toTokenPriceInUSD;
844
+ this.inputError = newState.inputError;
845
+ this.fetchError = newState.fetchError;
846
+ if (newState.sourceToken && newState.toToken) {
847
+ this.watchTokensAndValues();
848
+ }
849
+ })
850
+ ]);
851
+ }
852
+ async firstUpdated() {
853
+ SwapController.initializeState();
854
+ this.watchTokensAndValues();
855
+ await this.handleSwapParameters();
856
+ }
857
+ disconnectedCallback() {
858
+ this.unsubscribe.forEach((unsubscribe) => unsubscribe == null ? void 0 : unsubscribe());
859
+ clearInterval(this.interval);
860
+ document == null ? void 0 : document.removeEventListener("visibilitychange", this.visibilityChangeHandler);
861
+ }
862
+ render() {
863
+ return x`
864
+ <wui-flex flexDirection="column" .padding=${["0", "4", "4", "4"]} gap="3">
865
+ ${this.initialized ? this.templateSwap() : this.templateLoading()}
866
+ </wui-flex>
867
+ `;
868
+ }
869
+ subscribeToVisibilityChange() {
870
+ document == null ? void 0 : document.removeEventListener("visibilitychange", this.visibilityChangeHandler);
871
+ document == null ? void 0 : document.addEventListener("visibilitychange", this.visibilityChangeHandler);
872
+ }
873
+ fetchTokensAndValues() {
874
+ SwapController.getNetworkTokenPrice();
875
+ SwapController.getMyTokensWithBalance();
876
+ SwapController.swapTokens();
877
+ this.lastTokenPriceUpdate = Date.now();
878
+ }
879
+ templateSwap() {
880
+ return x`
881
+ <wui-flex flexDirection="column" gap="3">
882
+ <wui-flex flexDirection="column" alignItems="center" gap="2" class="swap-inputs-container">
883
+ ${this.templateTokenInput("sourceToken", this.sourceToken)}
884
+ ${this.templateTokenInput("toToken", this.toToken)} ${this.templateReplaceTokensButton()}
885
+ </wui-flex>
886
+ ${this.templateDetails()} ${this.templateActionButton()}
887
+ </wui-flex>
888
+ `;
889
+ }
890
+ actionButtonLabel() {
891
+ const haveNoAmount = !this.sourceTokenAmount || this.sourceTokenAmount === "0";
892
+ if (this.fetchError) {
893
+ return "Swap";
894
+ }
895
+ if (!this.sourceToken || !this.toToken) {
896
+ return "Select token";
897
+ }
898
+ if (haveNoAmount) {
899
+ return "Enter amount";
900
+ }
901
+ if (this.inputError) {
902
+ return this.inputError;
903
+ }
904
+ return "Review swap";
905
+ }
906
+ templateReplaceTokensButton() {
907
+ return x`
908
+ <wui-flex class="replace-tokens-button-container">
909
+ <wui-icon-box
910
+ @click=${this.onSwitchTokens.bind(this)}
911
+ icon="recycleHorizontal"
912
+ size="md"
913
+ variant="default"
914
+ ></wui-icon-box>
915
+ </wui-flex>
916
+ `;
917
+ }
918
+ templateLoading() {
919
+ return x`
920
+ <wui-flex flexDirection="column" gap="4">
921
+ <wui-flex flexDirection="column" alignItems="center" gap="2" class="swap-inputs-container">
922
+ <w3m-swap-input-skeleton target="sourceToken"></w3m-swap-input-skeleton>
923
+ <w3m-swap-input-skeleton target="toToken"></w3m-swap-input-skeleton>
924
+ ${this.templateReplaceTokensButton()}
925
+ </wui-flex>
926
+ ${this.templateActionButton()}
927
+ </wui-flex>
928
+ `;
929
+ }
930
+ templateTokenInput(target, token) {
931
+ var _a, _b;
932
+ const myToken = (_a = SwapController.state.myTokensWithBalance) == null ? void 0 : _a.find((ct) => (ct == null ? void 0 : ct.address) === (token == null ? void 0 : token.address));
933
+ const amount = target === "toToken" ? this.toTokenAmount : this.sourceTokenAmount;
934
+ const price = target === "toToken" ? this.toTokenPriceInUSD : this.sourceTokenPriceInUSD;
935
+ const marketValue = NumberUtil.parseLocalStringToNumber(amount) * price;
936
+ return x`<w3m-swap-input
937
+ .value=${target === "toToken" ? this.toTokenAmount : this.sourceTokenAmount}
938
+ .disabled=${target === "toToken"}
939
+ .onSetAmount=${this.handleChangeAmount.bind(this)}
940
+ target=${target}
941
+ .token=${token}
942
+ .balance=${(_b = myToken == null ? void 0 : myToken.quantity) == null ? void 0 : _b.numeric}
943
+ .price=${myToken == null ? void 0 : myToken.price}
944
+ .marketValue=${marketValue}
945
+ .onSetMaxValue=${this.onSetMaxValue.bind(this)}
946
+ ></w3m-swap-input>`;
947
+ }
948
+ onSetMaxValue(target, balance) {
949
+ const maxValue = NumberUtil.bigNumber(balance || "0");
950
+ this.handleChangeAmount(target, maxValue.gt(0) ? maxValue.toFixed(20) : "0");
951
+ }
952
+ templateDetails() {
953
+ if (!this.sourceToken || !this.toToken || this.inputError) {
954
+ return null;
955
+ }
956
+ return x`<w3m-swap-details .detailsOpen=${this.detailsOpen}></w3m-swap-details>`;
957
+ }
958
+ handleChangeAmount(target, value) {
959
+ SwapController.clearError();
960
+ if (target === "sourceToken") {
961
+ SwapController.setSourceTokenAmount(value);
962
+ } else {
963
+ SwapController.setToTokenAmount(value);
964
+ }
965
+ this.onDebouncedGetSwapCalldata();
966
+ }
967
+ templateActionButton() {
968
+ const haveNoTokenSelected = !this.toToken || !this.sourceToken;
969
+ const haveNoAmount = !this.sourceTokenAmount || this.sourceTokenAmount === "0";
970
+ const loading = this.loadingQuote || this.loadingPrices || this.loadingTransaction;
971
+ const disabled = loading || haveNoTokenSelected || haveNoAmount || this.inputError;
972
+ return x` <wui-flex gap="2">
973
+ <wui-button
974
+ data-testid="swap-action-button"
975
+ class="action-button"
976
+ fullWidth
977
+ size="lg"
978
+ borderRadius="xs"
979
+ variant="accent-primary"
980
+ ?loading=${Boolean(loading)}
981
+ ?disabled=${Boolean(disabled)}
982
+ @click=${this.onSwapPreview.bind(this)}
983
+ >
984
+ ${this.actionButtonLabel()}
985
+ </wui-button>
986
+ </wui-flex>`;
987
+ }
988
+ async onSwitchTokens() {
989
+ await SwapController.switchTokens();
990
+ }
991
+ async onSwapPreview() {
992
+ var _a, _b;
993
+ if (this.fetchError) {
994
+ await SwapController.swapTokens();
995
+ }
996
+ EventsController.sendEvent({
997
+ type: "track",
998
+ event: "INITIATE_SWAP",
999
+ properties: {
1000
+ network: this.caipNetworkId || "",
1001
+ swapFromToken: ((_a = this.sourceToken) == null ? void 0 : _a.symbol) || "",
1002
+ swapToToken: ((_b = this.toToken) == null ? void 0 : _b.symbol) || "",
1003
+ swapFromAmount: this.sourceTokenAmount || "",
1004
+ swapToAmount: this.toTokenAmount || "",
1005
+ isSmartAccount: getPreferredAccountType(ChainController.state.activeChain) === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT
1006
+ }
1007
+ });
1008
+ RouterController.push("SwapPreview");
1009
+ }
1010
+ async handleSwapParameters() {
1011
+ if (!this.initialParams) {
1012
+ return;
1013
+ }
1014
+ if (!SwapController.state.initialized) {
1015
+ const waitForInitialization = new Promise((resolve) => {
1016
+ const unsubscribe = SwapController.subscribeKey("initialized", (initialized) => {
1017
+ if (initialized) {
1018
+ unsubscribe == null ? void 0 : unsubscribe();
1019
+ resolve();
1020
+ }
1021
+ });
1022
+ });
1023
+ await waitForInitialization;
1024
+ }
1025
+ await this.setSwapParameters(this.initialParams);
1026
+ }
1027
+ async setSwapParameters({ amount, fromToken, toToken }) {
1028
+ if (!SwapController.state.tokens || !SwapController.state.myTokensWithBalance) {
1029
+ const waitForTokens = new Promise((resolve) => {
1030
+ const unsubscribe = SwapController.subscribeKey("myTokensWithBalance", (tokens) => {
1031
+ if (tokens && tokens.length > 0) {
1032
+ unsubscribe == null ? void 0 : unsubscribe();
1033
+ resolve();
1034
+ }
1035
+ });
1036
+ setTimeout(() => {
1037
+ unsubscribe == null ? void 0 : unsubscribe();
1038
+ resolve();
1039
+ }, 5e3);
1040
+ });
1041
+ await waitForTokens;
1042
+ }
1043
+ const allTokens = [
1044
+ ...SwapController.state.tokens || [],
1045
+ ...SwapController.state.myTokensWithBalance || []
1046
+ ];
1047
+ if (fromToken) {
1048
+ const token = allTokens.find((t) => t.symbol.toLowerCase() === fromToken.toLowerCase());
1049
+ if (token) {
1050
+ SwapController.setSourceToken(token);
1051
+ }
1052
+ }
1053
+ if (toToken) {
1054
+ const token = allTokens.find((t) => t.symbol.toLowerCase() === toToken.toLowerCase());
1055
+ if (token) {
1056
+ SwapController.setToToken(token);
1057
+ }
1058
+ }
1059
+ if (amount && !isNaN(Number(amount))) {
1060
+ SwapController.setSourceTokenAmount(amount);
1061
+ }
1062
+ }
1063
+ onCaipAddressChange({ newCaipAddress, resetSwapState, initializeSwapState }) {
1064
+ if (this.caipAddress !== newCaipAddress) {
1065
+ this.caipAddress = newCaipAddress;
1066
+ if (resetSwapState) {
1067
+ SwapController.resetState();
1068
+ }
1069
+ if (initializeSwapState) {
1070
+ SwapController.initializeState();
1071
+ }
1072
+ }
1073
+ }
1074
+ onCaipNetworkChange({ newCaipNetwork, resetSwapState, initializeSwapState }) {
1075
+ if (this.caipNetworkId !== (newCaipNetwork == null ? void 0 : newCaipNetwork.caipNetworkId)) {
1076
+ this.caipNetworkId = newCaipNetwork == null ? void 0 : newCaipNetwork.caipNetworkId;
1077
+ if (resetSwapState) {
1078
+ SwapController.resetState();
1079
+ }
1080
+ if (initializeSwapState) {
1081
+ SwapController.initializeState();
1082
+ }
1083
+ }
1084
+ }
1085
+ };
1086
+ W3mSwapView.styles = styles$4;
1087
+ __decorate$4([
1088
+ n({ type: Object })
1089
+ ], W3mSwapView.prototype, "initialParams", void 0);
1090
+ __decorate$4([
1091
+ r()
1092
+ ], W3mSwapView.prototype, "interval", void 0);
1093
+ __decorate$4([
1094
+ r()
1095
+ ], W3mSwapView.prototype, "detailsOpen", void 0);
1096
+ __decorate$4([
1097
+ r()
1098
+ ], W3mSwapView.prototype, "caipAddress", void 0);
1099
+ __decorate$4([
1100
+ r()
1101
+ ], W3mSwapView.prototype, "caipNetworkId", void 0);
1102
+ __decorate$4([
1103
+ r()
1104
+ ], W3mSwapView.prototype, "initialized", void 0);
1105
+ __decorate$4([
1106
+ r()
1107
+ ], W3mSwapView.prototype, "loadingQuote", void 0);
1108
+ __decorate$4([
1109
+ r()
1110
+ ], W3mSwapView.prototype, "loadingPrices", void 0);
1111
+ __decorate$4([
1112
+ r()
1113
+ ], W3mSwapView.prototype, "loadingTransaction", void 0);
1114
+ __decorate$4([
1115
+ r()
1116
+ ], W3mSwapView.prototype, "sourceToken", void 0);
1117
+ __decorate$4([
1118
+ r()
1119
+ ], W3mSwapView.prototype, "sourceTokenAmount", void 0);
1120
+ __decorate$4([
1121
+ r()
1122
+ ], W3mSwapView.prototype, "sourceTokenPriceInUSD", void 0);
1123
+ __decorate$4([
1124
+ r()
1125
+ ], W3mSwapView.prototype, "toToken", void 0);
1126
+ __decorate$4([
1127
+ r()
1128
+ ], W3mSwapView.prototype, "toTokenAmount", void 0);
1129
+ __decorate$4([
1130
+ r()
1131
+ ], W3mSwapView.prototype, "toTokenPriceInUSD", void 0);
1132
+ __decorate$4([
1133
+ r()
1134
+ ], W3mSwapView.prototype, "inputError", void 0);
1135
+ __decorate$4([
1136
+ r()
1137
+ ], W3mSwapView.prototype, "fetchError", void 0);
1138
+ __decorate$4([
1139
+ r()
1140
+ ], W3mSwapView.prototype, "lastTokenPriceUpdate", void 0);
1141
+ W3mSwapView = __decorate$4([
1142
+ customElement("w3m-swap-view")
1143
+ ], W3mSwapView);
1144
+ const styles$3 = css`
1145
+ :host > wui-flex:first-child {
1146
+ overflow-y: auto;
1147
+ overflow-x: hidden;
1148
+ scrollbar-width: none;
1149
+ }
1150
+
1151
+ :host > wui-flex:first-child::-webkit-scrollbar {
1152
+ display: none;
1153
+ }
1154
+
1155
+ .preview-container,
1156
+ .details-container {
1157
+ width: 100%;
1158
+ }
1159
+
1160
+ .token-image {
1161
+ width: 24px;
1162
+ height: 24px;
1163
+ box-shadow: 0 0 0 2px ${({ tokens }) => tokens.core.glass010};
1164
+ border-radius: 12px;
1165
+ }
1166
+
1167
+ wui-loading-hexagon {
1168
+ position: absolute;
1169
+ }
1170
+
1171
+ .token-item {
1172
+ display: flex;
1173
+ align-items: center;
1174
+ justify-content: center;
1175
+ gap: ${({ spacing }) => spacing["2"]};
1176
+ padding: ${({ spacing }) => spacing["2"]};
1177
+ height: 40px;
1178
+ border: none;
1179
+ border-radius: 80px;
1180
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1181
+ box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.theme.foregroundPrimary};
1182
+ cursor: pointer;
1183
+ transition: background ${({ durations }) => durations["lg"]}
1184
+ ${({ easings }) => easings["ease-out-power-2"]};
1185
+ will-change: background;
1186
+ }
1187
+
1188
+ .token-item:hover {
1189
+ background: ${({ tokens }) => tokens.core.glass010};
1190
+ }
1191
+
1192
+ .preview-token-details-container {
1193
+ width: 100%;
1194
+ }
1195
+
1196
+ .details-row {
1197
+ width: 100%;
1198
+ padding: ${({ spacing }) => spacing["3"]} ${({ spacing }) => spacing["5"]};
1199
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
1200
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1201
+ }
1202
+
1203
+ .action-buttons-container {
1204
+ width: 100%;
1205
+ gap: ${({ spacing }) => spacing["2"]};
1206
+ }
1207
+
1208
+ .action-buttons-container > button {
1209
+ display: flex;
1210
+ align-items: center;
1211
+ justify-content: center;
1212
+ background: transparent;
1213
+ height: 48px;
1214
+ border-radius: ${({ borderRadius }) => borderRadius["4"]};
1215
+ border: none;
1216
+ box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.core.glass010};
1217
+ }
1218
+
1219
+ .action-buttons-container > button:disabled {
1220
+ opacity: 0.8;
1221
+ cursor: not-allowed;
1222
+ }
1223
+
1224
+ .action-button > wui-loading-spinner {
1225
+ display: inline-block;
1226
+ }
1227
+
1228
+ .cancel-button:hover,
1229
+ .action-button:hover {
1230
+ cursor: pointer;
1231
+ }
1232
+
1233
+ .action-buttons-container > wui-button.cancel-button {
1234
+ flex: 2;
1235
+ }
1236
+
1237
+ .action-buttons-container > wui-button.action-button {
1238
+ flex: 4;
1239
+ }
1240
+
1241
+ .action-buttons-container > button.action-button > wui-text {
1242
+ color: white;
1243
+ }
1244
+
1245
+ .details-container > wui-flex {
1246
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1247
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
1248
+ width: 100%;
1249
+ }
1250
+
1251
+ .details-container > wui-flex > button {
1252
+ border: none;
1253
+ background: none;
1254
+ padding: ${({ spacing }) => spacing["3"]};
1255
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
1256
+ transition: background ${({ durations }) => durations["lg"]}
1257
+ ${({ easings }) => easings["ease-out-power-2"]};
1258
+ will-change: background;
1259
+ }
1260
+
1261
+ .details-container > wui-flex > button:hover {
1262
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1263
+ }
1264
+
1265
+ .details-content-container {
1266
+ padding: ${({ spacing }) => spacing["2"]};
1267
+ display: flex;
1268
+ align-items: center;
1269
+ justify-content: center;
1270
+ }
1271
+
1272
+ .details-content-container > wui-flex {
1273
+ width: 100%;
1274
+ }
1275
+
1276
+ .details-row {
1277
+ width: 100%;
1278
+ padding: ${({ spacing }) => spacing["3"]} ${({ spacing }) => spacing["5"]};
1279
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
1280
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1281
+ }
1282
+ `;
1283
+ var __decorate$3 = function(decorators, target, key, desc) {
1284
+ var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1285
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1286
+ else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
1287
+ return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1288
+ };
1289
+ let W3mSwapPreviewView = class W3mSwapPreviewView2 extends i {
1290
+ constructor() {
1291
+ var _a;
1292
+ super();
1293
+ this.unsubscribe = [];
1294
+ this.detailsOpen = true;
1295
+ this.approvalTransaction = SwapController.state.approvalTransaction;
1296
+ this.swapTransaction = SwapController.state.swapTransaction;
1297
+ this.sourceToken = SwapController.state.sourceToken;
1298
+ this.sourceTokenAmount = SwapController.state.sourceTokenAmount ?? "";
1299
+ this.sourceTokenPriceInUSD = SwapController.state.sourceTokenPriceInUSD;
1300
+ this.balanceSymbol = (_a = ChainController.getAccountData()) == null ? void 0 : _a.balanceSymbol;
1301
+ this.toToken = SwapController.state.toToken;
1302
+ this.toTokenAmount = SwapController.state.toTokenAmount ?? "";
1303
+ this.toTokenPriceInUSD = SwapController.state.toTokenPriceInUSD;
1304
+ this.caipNetwork = ChainController.state.activeCaipNetwork;
1305
+ this.inputError = SwapController.state.inputError;
1306
+ this.loadingQuote = SwapController.state.loadingQuote;
1307
+ this.loadingApprovalTransaction = SwapController.state.loadingApprovalTransaction;
1308
+ this.loadingBuildTransaction = SwapController.state.loadingBuildTransaction;
1309
+ this.loadingTransaction = SwapController.state.loadingTransaction;
1310
+ this.unsubscribe.push(...[
1311
+ ChainController.subscribeChainProp("accountState", (val) => {
1312
+ if ((val == null ? void 0 : val.balanceSymbol) !== this.balanceSymbol) {
1313
+ RouterController.goBack();
1314
+ }
1315
+ }),
1316
+ ChainController.subscribeKey("activeCaipNetwork", (newCaipNetwork) => {
1317
+ if (this.caipNetwork !== newCaipNetwork) {
1318
+ this.caipNetwork = newCaipNetwork;
1319
+ }
1320
+ }),
1321
+ SwapController.subscribe((newState) => {
1322
+ this.approvalTransaction = newState.approvalTransaction;
1323
+ this.swapTransaction = newState.swapTransaction;
1324
+ this.sourceToken = newState.sourceToken;
1325
+ this.toToken = newState.toToken;
1326
+ this.toTokenPriceInUSD = newState.toTokenPriceInUSD;
1327
+ this.sourceTokenAmount = newState.sourceTokenAmount ?? "";
1328
+ this.toTokenAmount = newState.toTokenAmount ?? "";
1329
+ this.inputError = newState.inputError;
1330
+ if (newState.inputError) {
1331
+ RouterController.goBack();
1332
+ }
1333
+ this.loadingQuote = newState.loadingQuote;
1334
+ this.loadingApprovalTransaction = newState.loadingApprovalTransaction;
1335
+ this.loadingBuildTransaction = newState.loadingBuildTransaction;
1336
+ this.loadingTransaction = newState.loadingTransaction;
1337
+ })
1338
+ ]);
1339
+ }
1340
+ firstUpdated() {
1341
+ SwapController.getTransaction();
1342
+ this.refreshTransaction();
1343
+ }
1344
+ disconnectedCallback() {
1345
+ this.unsubscribe.forEach((unsubscribe) => unsubscribe == null ? void 0 : unsubscribe());
1346
+ clearInterval(this.interval);
1347
+ }
1348
+ render() {
1349
+ return x`
1350
+ <wui-flex flexDirection="column" .padding=${["0", "4", "4", "4"]} gap="3">
1351
+ ${this.templateSwap()}
1352
+ </wui-flex>
1353
+ `;
1354
+ }
1355
+ refreshTransaction() {
1356
+ this.interval = setInterval(() => {
1357
+ if (!SwapController.getApprovalLoadingState()) {
1358
+ SwapController.getTransaction();
1359
+ }
1360
+ }, 1e4);
1361
+ }
1362
+ templateSwap() {
1363
+ var _a, _b, _c, _d;
1364
+ const sourceTokenText = `${NumberUtil.formatNumberToLocalString(parseFloat(this.sourceTokenAmount))} ${(_a = this.sourceToken) == null ? void 0 : _a.symbol}`;
1365
+ const toTokenText = `${NumberUtil.formatNumberToLocalString(parseFloat(this.toTokenAmount))} ${(_b = this.toToken) == null ? void 0 : _b.symbol}`;
1366
+ const sourceTokenValue = parseFloat(this.sourceTokenAmount) * this.sourceTokenPriceInUSD;
1367
+ const toTokenValue = parseFloat(this.toTokenAmount) * this.toTokenPriceInUSD;
1368
+ const sentPrice = NumberUtil.formatNumberToLocalString(sourceTokenValue);
1369
+ const receivePrice = NumberUtil.formatNumberToLocalString(toTokenValue);
1370
+ const loading = this.loadingQuote || this.loadingBuildTransaction || this.loadingTransaction || this.loadingApprovalTransaction;
1371
+ return x`
1372
+ <wui-flex flexDirection="column" alignItems="center" gap="4">
1373
+ <wui-flex class="preview-container" flexDirection="column" alignItems="flex-start" gap="4">
1374
+ <wui-flex
1375
+ class="preview-token-details-container"
1376
+ alignItems="center"
1377
+ justifyContent="space-between"
1378
+ gap="4"
1379
+ >
1380
+ <wui-flex flexDirection="column" alignItems="flex-start" gap="01">
1381
+ <wui-text variant="sm-regular" color="secondary">Send</wui-text>
1382
+ <wui-text variant="md-regular" color="primary">$${sentPrice}</wui-text>
1383
+ </wui-flex>
1384
+ <wui-token-button
1385
+ flexDirection="row-reverse"
1386
+ text=${sourceTokenText}
1387
+ imageSrc=${(_c = this.sourceToken) == null ? void 0 : _c.logoUri}
1388
+ >
1389
+ </wui-token-button>
1390
+ </wui-flex>
1391
+ <wui-icon name="recycleHorizontal" color="default" size="md"></wui-icon>
1392
+ <wui-flex
1393
+ class="preview-token-details-container"
1394
+ alignItems="center"
1395
+ justifyContent="space-between"
1396
+ gap="4"
1397
+ >
1398
+ <wui-flex flexDirection="column" alignItems="flex-start" gap="01">
1399
+ <wui-text variant="sm-regular" color="secondary">Receive</wui-text>
1400
+ <wui-text variant="md-regular" color="primary">$${receivePrice}</wui-text>
1401
+ </wui-flex>
1402
+ <wui-token-button
1403
+ flexDirection="row-reverse"
1404
+ text=${toTokenText}
1405
+ imageSrc=${(_d = this.toToken) == null ? void 0 : _d.logoUri}
1406
+ >
1407
+ </wui-token-button>
1408
+ </wui-flex>
1409
+ </wui-flex>
1410
+
1411
+ ${this.templateDetails()}
1412
+
1413
+ <wui-flex flexDirection="row" alignItems="center" justifyContent="center" gap="2">
1414
+ <wui-icon size="sm" color="default" name="info"></wui-icon>
1415
+ <wui-text variant="sm-regular" color="secondary">Review transaction carefully</wui-text>
1416
+ </wui-flex>
1417
+
1418
+ <wui-flex
1419
+ class="action-buttons-container"
1420
+ flexDirection="row"
1421
+ alignItems="center"
1422
+ justifyContent="space-between"
1423
+ gap="2"
1424
+ >
1425
+ <wui-button
1426
+ class="cancel-button"
1427
+ fullWidth
1428
+ size="lg"
1429
+ borderRadius="xs"
1430
+ variant="neutral-secondary"
1431
+ @click=${this.onCancelTransaction.bind(this)}
1432
+ >
1433
+ <wui-text variant="md-medium" color="secondary">Cancel</wui-text>
1434
+ </wui-button>
1435
+ <wui-button
1436
+ class="action-button"
1437
+ fullWidth
1438
+ size="lg"
1439
+ borderRadius="xs"
1440
+ variant="accent-primary"
1441
+ ?loading=${loading}
1442
+ ?disabled=${loading}
1443
+ @click=${this.onSendTransaction.bind(this)}
1444
+ >
1445
+ <wui-text variant="md-medium" color="invert"> ${this.actionButtonLabel()} </wui-text>
1446
+ </wui-button>
1447
+ </wui-flex>
1448
+ </wui-flex>
1449
+ `;
1450
+ }
1451
+ templateDetails() {
1452
+ if (!this.sourceToken || !this.toToken || this.inputError) {
1453
+ return null;
1454
+ }
1455
+ return x`<w3m-swap-details .detailsOpen=${this.detailsOpen}></w3m-swap-details>`;
1456
+ }
1457
+ actionButtonLabel() {
1458
+ if (this.loadingApprovalTransaction) {
1459
+ return "Approving...";
1460
+ }
1461
+ if (this.approvalTransaction) {
1462
+ return "Approve";
1463
+ }
1464
+ return "Swap";
1465
+ }
1466
+ onCancelTransaction() {
1467
+ RouterController.goBack();
1468
+ }
1469
+ onSendTransaction() {
1470
+ if (this.approvalTransaction) {
1471
+ SwapController.sendTransactionForApproval(this.approvalTransaction);
1472
+ } else {
1473
+ SwapController.sendTransactionForSwap(this.swapTransaction);
1474
+ }
1475
+ }
1476
+ };
1477
+ W3mSwapPreviewView.styles = styles$3;
1478
+ __decorate$3([
1479
+ r()
1480
+ ], W3mSwapPreviewView.prototype, "interval", void 0);
1481
+ __decorate$3([
1482
+ r()
1483
+ ], W3mSwapPreviewView.prototype, "detailsOpen", void 0);
1484
+ __decorate$3([
1485
+ r()
1486
+ ], W3mSwapPreviewView.prototype, "approvalTransaction", void 0);
1487
+ __decorate$3([
1488
+ r()
1489
+ ], W3mSwapPreviewView.prototype, "swapTransaction", void 0);
1490
+ __decorate$3([
1491
+ r()
1492
+ ], W3mSwapPreviewView.prototype, "sourceToken", void 0);
1493
+ __decorate$3([
1494
+ r()
1495
+ ], W3mSwapPreviewView.prototype, "sourceTokenAmount", void 0);
1496
+ __decorate$3([
1497
+ r()
1498
+ ], W3mSwapPreviewView.prototype, "sourceTokenPriceInUSD", void 0);
1499
+ __decorate$3([
1500
+ r()
1501
+ ], W3mSwapPreviewView.prototype, "balanceSymbol", void 0);
1502
+ __decorate$3([
1503
+ r()
1504
+ ], W3mSwapPreviewView.prototype, "toToken", void 0);
1505
+ __decorate$3([
1506
+ r()
1507
+ ], W3mSwapPreviewView.prototype, "toTokenAmount", void 0);
1508
+ __decorate$3([
1509
+ r()
1510
+ ], W3mSwapPreviewView.prototype, "toTokenPriceInUSD", void 0);
1511
+ __decorate$3([
1512
+ r()
1513
+ ], W3mSwapPreviewView.prototype, "caipNetwork", void 0);
1514
+ __decorate$3([
1515
+ r()
1516
+ ], W3mSwapPreviewView.prototype, "inputError", void 0);
1517
+ __decorate$3([
1518
+ r()
1519
+ ], W3mSwapPreviewView.prototype, "loadingQuote", void 0);
1520
+ __decorate$3([
1521
+ r()
1522
+ ], W3mSwapPreviewView.prototype, "loadingApprovalTransaction", void 0);
1523
+ __decorate$3([
1524
+ r()
1525
+ ], W3mSwapPreviewView.prototype, "loadingBuildTransaction", void 0);
1526
+ __decorate$3([
1527
+ r()
1528
+ ], W3mSwapPreviewView.prototype, "loadingTransaction", void 0);
1529
+ W3mSwapPreviewView = __decorate$3([
1530
+ customElement("w3m-swap-preview-view")
1531
+ ], W3mSwapPreviewView);
1532
+ const styles$2 = css`
1533
+ :host {
1534
+ width: 100%;
1535
+ height: 60px;
1536
+ min-height: 60px;
1537
+ }
1538
+
1539
+ :host > wui-flex {
1540
+ cursor: pointer;
1541
+ height: 100%;
1542
+ display: flex;
1543
+ column-gap: ${({ spacing }) => spacing["3"]};
1544
+ padding: ${({ spacing }) => spacing["2"]};
1545
+ padding-right: ${({ spacing }) => spacing["4"]};
1546
+ width: 100%;
1547
+ background-color: transparent;
1548
+ border-radius: ${({ borderRadius }) => borderRadius["4"]};
1549
+ color: ${({ tokens }) => tokens.theme.foregroundSecondary};
1550
+ transition:
1551
+ background-color ${({ durations }) => durations["lg"]}
1552
+ ${({ easings }) => easings["ease-out-power-2"]},
1553
+ opacity ${({ durations }) => durations["lg"]} ${({ easings }) => easings["ease-out-power-2"]};
1554
+ will-change: background-color, opacity;
1555
+ }
1556
+
1557
+ @media (hover: hover) and (pointer: fine) {
1558
+ :host > wui-flex:hover {
1559
+ background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
1560
+ }
1561
+
1562
+ :host > wui-flex:active {
1563
+ background-color: ${({ tokens }) => tokens.core.glass010};
1564
+ }
1565
+ }
1566
+
1567
+ :host([disabled]) > wui-flex {
1568
+ opacity: 0.6;
1569
+ }
1570
+
1571
+ :host([disabled]) > wui-flex:hover {
1572
+ background-color: transparent;
1573
+ }
1574
+
1575
+ :host > wui-flex > wui-flex {
1576
+ flex: 1;
1577
+ }
1578
+
1579
+ :host > wui-flex > wui-image,
1580
+ :host > wui-flex > .token-item-image-placeholder {
1581
+ width: 40px;
1582
+ max-width: 40px;
1583
+ height: 40px;
1584
+ border-radius: ${({ borderRadius }) => borderRadius["20"]};
1585
+ position: relative;
1586
+ }
1587
+
1588
+ :host > wui-flex > .token-item-image-placeholder {
1589
+ display: flex;
1590
+ align-items: center;
1591
+ justify-content: center;
1592
+ }
1593
+
1594
+ :host > wui-flex > wui-image::after,
1595
+ :host > wui-flex > .token-item-image-placeholder::after {
1596
+ position: absolute;
1597
+ content: '';
1598
+ inset: 0;
1599
+ box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.core.glass010};
1600
+ border-radius: ${({ borderRadius }) => borderRadius["8"]};
1601
+ }
1602
+
1603
+ button > wui-icon-box[data-variant='square-blue'] {
1604
+ border-radius: ${({ borderRadius }) => borderRadius["2"]};
1605
+ position: relative;
1606
+ border: none;
1607
+ width: 36px;
1608
+ height: 36px;
1609
+ }
1610
+ `;
1611
+ var __decorate$2 = function(decorators, target, key, desc) {
1612
+ var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1613
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1614
+ else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
1615
+ return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1616
+ };
1617
+ let WuiTokenListItem = class WuiTokenListItem2 extends i {
1618
+ constructor() {
1619
+ super();
1620
+ this.observer = new IntersectionObserver(() => void 0);
1621
+ this.imageSrc = void 0;
1622
+ this.name = void 0;
1623
+ this.symbol = void 0;
1624
+ this.price = void 0;
1625
+ this.amount = void 0;
1626
+ this.visible = false;
1627
+ this.imageError = false;
1628
+ this.observer = new IntersectionObserver((entries) => {
1629
+ entries.forEach((entry) => {
1630
+ if (entry.isIntersecting) {
1631
+ this.visible = true;
1632
+ } else {
1633
+ this.visible = false;
1634
+ }
1635
+ });
1636
+ }, { threshold: 0.1 });
1637
+ }
1638
+ firstUpdated() {
1639
+ this.observer.observe(this);
1640
+ }
1641
+ disconnectedCallback() {
1642
+ this.observer.disconnect();
1643
+ }
1644
+ render() {
1645
+ var _a;
1646
+ if (!this.visible) {
1647
+ return null;
1648
+ }
1649
+ const value = this.amount && this.price ? (_a = NumberUtil.multiply(this.price, this.amount)) == null ? void 0 : _a.toFixed(3) : null;
1650
+ return x`
1651
+ <wui-flex alignItems="center">
1652
+ ${this.visualTemplate()}
1653
+ <wui-flex flexDirection="column" gap="1">
1654
+ <wui-flex justifyContent="space-between">
1655
+ <wui-text variant="md-medium" color="primary" lineClamp="1">${this.name}</wui-text>
1656
+ ${value ? x`
1657
+ <wui-text variant="md-medium" color="primary">
1658
+ $${NumberUtil.formatNumberToLocalString(value, 3)}
1659
+ </wui-text>
1660
+ ` : null}
1661
+ </wui-flex>
1662
+ <wui-flex justifyContent="space-between">
1663
+ <wui-text variant="sm-regular" color="secondary" lineClamp="1">${this.symbol}</wui-text>
1664
+ ${this.amount ? x`<wui-text variant="sm-regular" color="secondary">
1665
+ ${NumberUtil.formatNumberToLocalString(this.amount, 5)}
1666
+ </wui-text>` : null}
1667
+ </wui-flex>
1668
+ </wui-flex>
1669
+ </wui-flex>
1670
+ `;
1671
+ }
1672
+ visualTemplate() {
1673
+ if (this.imageError) {
1674
+ return x`<wui-flex class="token-item-image-placeholder">
1675
+ <wui-icon name="image" color="inherit"></wui-icon>
1676
+ </wui-flex>`;
1677
+ }
1678
+ if (this.imageSrc) {
1679
+ return x`<wui-image
1680
+ width="40"
1681
+ height="40"
1682
+ src=${this.imageSrc}
1683
+ @onLoadError=${this.imageLoadError}
1684
+ ></wui-image>`;
1685
+ }
1686
+ return null;
1687
+ }
1688
+ imageLoadError() {
1689
+ this.imageError = true;
1690
+ }
1691
+ };
1692
+ WuiTokenListItem.styles = [resetStyles, elementStyles, styles$2];
1693
+ __decorate$2([
1694
+ n()
1695
+ ], WuiTokenListItem.prototype, "imageSrc", void 0);
1696
+ __decorate$2([
1697
+ n()
1698
+ ], WuiTokenListItem.prototype, "name", void 0);
1699
+ __decorate$2([
1700
+ n()
1701
+ ], WuiTokenListItem.prototype, "symbol", void 0);
1702
+ __decorate$2([
1703
+ n()
1704
+ ], WuiTokenListItem.prototype, "price", void 0);
1705
+ __decorate$2([
1706
+ n()
1707
+ ], WuiTokenListItem.prototype, "amount", void 0);
1708
+ __decorate$2([
1709
+ r()
1710
+ ], WuiTokenListItem.prototype, "visible", void 0);
1711
+ __decorate$2([
1712
+ r()
1713
+ ], WuiTokenListItem.prototype, "imageError", void 0);
1714
+ WuiTokenListItem = __decorate$2([
1715
+ customElement("wui-token-list-item")
1716
+ ], WuiTokenListItem);
1717
+ const styles$1 = css`
1718
+ :host {
1719
+ width: 100%;
1720
+ }
1721
+
1722
+ :host > wui-flex {
1723
+ cursor: pointer;
1724
+ height: 100%;
1725
+ width: 100%;
1726
+ display: flex;
1727
+ column-gap: ${({ spacing }) => spacing["3"]};
1728
+ padding: ${({ spacing }) => spacing["2"]};
1729
+ padding-right: ${({ spacing }) => spacing["4"]};
1730
+ }
1731
+
1732
+ wui-flex {
1733
+ display: flex;
1734
+ flex: 1;
1735
+ }
1736
+ `;
1737
+ var __decorate$1 = function(decorators, target, key, desc) {
1738
+ var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1739
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1740
+ else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
1741
+ return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1742
+ };
1743
+ let WuiTokenListItemLoader = class WuiTokenListItemLoader2 extends i {
1744
+ render() {
1745
+ return x`
1746
+ <wui-flex alignItems="center">
1747
+ <wui-shimmer width="40px" height="40px"></wui-shimmer>
1748
+ <wui-flex flexDirection="column" gap="1">
1749
+ <wui-shimmer width="72px" height="16px" borderRadius="4xs"></wui-shimmer>
1750
+ <wui-shimmer width="148px" height="14px" borderRadius="4xs"></wui-shimmer>
1751
+ </wui-flex>
1752
+ <wui-flex flexDirection="column" gap="1" alignItems="flex-end">
1753
+ <wui-shimmer width="24px" height="12px" borderRadius="4xs"></wui-shimmer>
1754
+ <wui-shimmer width="32px" height="12px" borderRadius="4xs"></wui-shimmer>
1755
+ </wui-flex>
1756
+ </wui-flex>
1757
+ `;
1758
+ }
1759
+ };
1760
+ WuiTokenListItemLoader.styles = [resetStyles, styles$1];
1761
+ WuiTokenListItemLoader = __decorate$1([
1762
+ customElement("wui-token-list-item-loader")
1763
+ ], WuiTokenListItemLoader);
1764
+ const styles = css`
1765
+ :host {
1766
+ --tokens-scroll--top-opacity: 0;
1767
+ --tokens-scroll--bottom-opacity: 1;
1768
+ --suggested-tokens-scroll--left-opacity: 0;
1769
+ --suggested-tokens-scroll--right-opacity: 1;
1770
+ }
1771
+
1772
+ :host > wui-flex:first-child {
1773
+ overflow-y: hidden;
1774
+ overflow-x: hidden;
1775
+ scrollbar-width: none;
1776
+ scrollbar-height: none;
1777
+ }
1778
+
1779
+ :host > wui-flex:first-child::-webkit-scrollbar {
1780
+ display: none;
1781
+ }
1782
+
1783
+ wui-loading-hexagon {
1784
+ position: absolute;
1785
+ }
1786
+
1787
+ .suggested-tokens-container {
1788
+ overflow-x: auto;
1789
+ mask-image: linear-gradient(
1790
+ to right,
1791
+ rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 0px,
1792
+ rgba(200, 200, 200, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 1px,
1793
+ black 50px,
1794
+ black 90px,
1795
+ black calc(100% - 90px),
1796
+ black calc(100% - 50px),
1797
+ rgba(155, 155, 155, calc(1 - var(--suggested-tokens-scroll--right-opacity))) calc(100% - 1px),
1798
+ rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--right-opacity))) 100%
1799
+ );
1800
+ }
1801
+
1802
+ .suggested-tokens-container::-webkit-scrollbar {
1803
+ display: none;
1804
+ }
1805
+
1806
+ .tokens-container {
1807
+ border-top: 1px solid ${({ tokens }) => tokens.core.glass010};
1808
+ height: 100%;
1809
+ max-height: 390px;
1810
+ }
1811
+
1812
+ .tokens {
1813
+ width: 100%;
1814
+ overflow-y: auto;
1815
+ mask-image: linear-gradient(
1816
+ to bottom,
1817
+ rgba(0, 0, 0, calc(1 - var(--tokens-scroll--top-opacity))) 0px,
1818
+ rgba(200, 200, 200, calc(1 - var(--tokens-scroll--top-opacity))) 1px,
1819
+ black 50px,
1820
+ black 90px,
1821
+ black calc(100% - 90px),
1822
+ black calc(100% - 50px),
1823
+ rgba(155, 155, 155, calc(1 - var(--tokens-scroll--bottom-opacity))) calc(100% - 1px),
1824
+ rgba(0, 0, 0, calc(1 - var(--tokens-scroll--bottom-opacity))) 100%
1825
+ );
1826
+ }
1827
+
1828
+ .network-search-input,
1829
+ .select-network-button {
1830
+ height: 40px;
1831
+ }
1832
+
1833
+ .select-network-button {
1834
+ border: none;
1835
+ display: flex;
1836
+ flex-direction: row;
1837
+ align-items: center;
1838
+ justify-content: center;
1839
+ gap: ${({ spacing }) => spacing["2"]};
1840
+ box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.core.glass010};
1841
+ background-color: transparent;
1842
+ border-radius: ${({ borderRadius }) => borderRadius["3"]};
1843
+ padding: ${({ spacing }) => spacing["2"]};
1844
+ align-items: center;
1845
+ transition: background-color ${({ durations }) => durations["lg"]}
1846
+ ${({ easings }) => easings["ease-out-power-2"]};
1847
+ will-change: background-color;
1848
+ }
1849
+
1850
+ .select-network-button:hover {
1851
+ background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
1852
+ }
1853
+
1854
+ .select-network-button > wui-image {
1855
+ width: 26px;
1856
+ height: 26px;
1857
+ border-radius: ${({ borderRadius }) => borderRadius["4"]};
1858
+ box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.core.glass010};
1859
+ }
1860
+ `;
1861
+ var __decorate = function(decorators, target, key, desc) {
1862
+ var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1863
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1864
+ else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
1865
+ return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1866
+ };
1867
+ let W3mSwapSelectTokenView = class W3mSwapSelectTokenView2 extends i {
1868
+ constructor() {
1869
+ var _a;
1870
+ super();
1871
+ this.unsubscribe = [];
1872
+ this.targetToken = (_a = RouterController.state.data) == null ? void 0 : _a.target;
1873
+ this.sourceToken = SwapController.state.sourceToken;
1874
+ this.sourceTokenAmount = SwapController.state.sourceTokenAmount;
1875
+ this.toToken = SwapController.state.toToken;
1876
+ this.myTokensWithBalance = SwapController.state.myTokensWithBalance;
1877
+ this.popularTokens = SwapController.state.popularTokens;
1878
+ this.suggestedTokens = SwapController.state.suggestedTokens;
1879
+ this.tokensLoading = SwapController.state.tokensLoading;
1880
+ this.searchValue = "";
1881
+ this.unsubscribe.push(SwapController.subscribe((newState) => {
1882
+ this.sourceToken = newState.sourceToken;
1883
+ this.toToken = newState.toToken;
1884
+ this.myTokensWithBalance = newState.myTokensWithBalance;
1885
+ this.popularTokens = newState.popularTokens;
1886
+ this.suggestedTokens = newState.suggestedTokens;
1887
+ this.tokensLoading = newState.tokensLoading;
1888
+ }));
1889
+ }
1890
+ async firstUpdated() {
1891
+ await SwapController.getTokenList();
1892
+ }
1893
+ updated() {
1894
+ var _a, _b;
1895
+ const suggestedTokensContainer = (_a = this.renderRoot) == null ? void 0 : _a.querySelector(".suggested-tokens-container");
1896
+ suggestedTokensContainer == null ? void 0 : suggestedTokensContainer.addEventListener("scroll", this.handleSuggestedTokensScroll.bind(this));
1897
+ const tokensList = (_b = this.renderRoot) == null ? void 0 : _b.querySelector(".tokens");
1898
+ tokensList == null ? void 0 : tokensList.addEventListener("scroll", this.handleTokenListScroll.bind(this));
1899
+ }
1900
+ disconnectedCallback() {
1901
+ var _a, _b;
1902
+ super.disconnectedCallback();
1903
+ const suggestedTokensContainer = (_a = this.renderRoot) == null ? void 0 : _a.querySelector(".suggested-tokens-container");
1904
+ const tokensList = (_b = this.renderRoot) == null ? void 0 : _b.querySelector(".tokens");
1905
+ suggestedTokensContainer == null ? void 0 : suggestedTokensContainer.removeEventListener("scroll", this.handleSuggestedTokensScroll.bind(this));
1906
+ tokensList == null ? void 0 : tokensList.removeEventListener("scroll", this.handleTokenListScroll.bind(this));
1907
+ clearInterval(this.interval);
1908
+ }
1909
+ render() {
1910
+ return x`
1911
+ <wui-flex flexDirection="column" gap="3">
1912
+ ${this.templateSearchInput()} ${this.templateSuggestedTokens()} ${this.templateTokens()}
1913
+ </wui-flex>
1914
+ `;
1915
+ }
1916
+ onSelectToken(token) {
1917
+ if (this.targetToken === "sourceToken") {
1918
+ SwapController.setSourceToken(token);
1919
+ } else {
1920
+ SwapController.setToToken(token);
1921
+ if (this.sourceToken && this.sourceTokenAmount) {
1922
+ SwapController.swapTokens();
1923
+ }
1924
+ }
1925
+ RouterController.goBack();
1926
+ }
1927
+ templateSearchInput() {
1928
+ return x`
1929
+ <wui-flex .padding=${["1", "3", "0", "3"]} gap="2">
1930
+ <wui-input-text
1931
+ data-testid="swap-select-token-search-input"
1932
+ class="network-search-input"
1933
+ size="sm"
1934
+ placeholder="Search token"
1935
+ icon="search"
1936
+ .value=${this.searchValue}
1937
+ @inputChange=${this.onSearchInputChange.bind(this)}
1938
+ ></wui-input-text>
1939
+ </wui-flex>
1940
+ `;
1941
+ }
1942
+ templateMyTokens() {
1943
+ const yourTokens = this.myTokensWithBalance ? Object.values(this.myTokensWithBalance) : [];
1944
+ const filteredYourTokens = this.filterTokensWithText(yourTokens, this.searchValue);
1945
+ if ((filteredYourTokens == null ? void 0 : filteredYourTokens.length) > 0) {
1946
+ return x`<wui-flex justifyContent="flex-start" padding="2">
1947
+ <wui-text variant="md-medium" color="secondary">Your tokens</wui-text>
1948
+ </wui-flex>
1949
+ ${filteredYourTokens.map((token) => {
1950
+ var _a, _b, _c;
1951
+ const selected = token.symbol === ((_a = this.sourceToken) == null ? void 0 : _a.symbol) || token.symbol === ((_b = this.toToken) == null ? void 0 : _b.symbol);
1952
+ return x`
1953
+ <wui-token-list-item
1954
+ data-testid="swap-select-token-item-${token.symbol}"
1955
+ name=${token.name}
1956
+ ?disabled=${selected}
1957
+ symbol=${token.symbol}
1958
+ price=${token == null ? void 0 : token.price}
1959
+ amount=${(_c = token == null ? void 0 : token.quantity) == null ? void 0 : _c.numeric}
1960
+ imageSrc=${token.logoUri}
1961
+ @click=${() => {
1962
+ if (!selected) {
1963
+ this.onSelectToken(token);
1964
+ }
1965
+ }}
1966
+ >
1967
+ </wui-token-list-item>
1968
+ `;
1969
+ })}`;
1970
+ }
1971
+ return null;
1972
+ }
1973
+ templateAllTokens() {
1974
+ const tokens = this.popularTokens ? this.popularTokens : [];
1975
+ const filteredTokens = this.filterTokensWithText(tokens, this.searchValue);
1976
+ if (this.tokensLoading) {
1977
+ return x`
1978
+ <wui-token-list-item-loader></wui-token-list-item-loader>
1979
+ <wui-token-list-item-loader></wui-token-list-item-loader>
1980
+ <wui-token-list-item-loader></wui-token-list-item-loader>
1981
+ <wui-token-list-item-loader></wui-token-list-item-loader>
1982
+ <wui-token-list-item-loader></wui-token-list-item-loader>
1983
+ `;
1984
+ }
1985
+ if ((filteredTokens == null ? void 0 : filteredTokens.length) > 0) {
1986
+ return x`
1987
+ ${filteredTokens.map((token) => x`
1988
+ <wui-token-list-item
1989
+ data-testid="swap-select-token-item-${token.symbol}"
1990
+ name=${token.name}
1991
+ symbol=${token.symbol}
1992
+ imageSrc=${token.logoUri}
1993
+ @click=${() => this.onSelectToken(token)}
1994
+ >
1995
+ </wui-token-list-item>
1996
+ `)}
1997
+ `;
1998
+ }
1999
+ return null;
2000
+ }
2001
+ templateTokens() {
2002
+ return x`
2003
+ <wui-flex class="tokens-container">
2004
+ <wui-flex class="tokens" .padding=${["0", "2", "2", "2"]} flexDirection="column">
2005
+ ${this.templateMyTokens()}
2006
+ <wui-flex justifyContent="flex-start" padding="3">
2007
+ <wui-text variant="md-medium" color="secondary">Tokens</wui-text>
2008
+ </wui-flex>
2009
+ ${this.templateAllTokens()}
2010
+ </wui-flex>
2011
+ </wui-flex>
2012
+ `;
2013
+ }
2014
+ templateSuggestedTokens() {
2015
+ const tokens = this.suggestedTokens ? this.suggestedTokens.slice(0, 8) : null;
2016
+ if (this.tokensLoading) {
2017
+ return x`
2018
+ <wui-flex
2019
+ class="suggested-tokens-container"
2020
+ .padding=${["0", "3", "0", "3"]}
2021
+ gap="2"
2022
+ >
2023
+ <wui-token-button loading></wui-token-button>
2024
+ <wui-token-button loading></wui-token-button>
2025
+ <wui-token-button loading></wui-token-button>
2026
+ <wui-token-button loading></wui-token-button>
2027
+ <wui-token-button loading></wui-token-button>
2028
+ </wui-flex>
2029
+ `;
2030
+ }
2031
+ if (!tokens) {
2032
+ return null;
2033
+ }
2034
+ return x`
2035
+ <wui-flex
2036
+ class="suggested-tokens-container"
2037
+ .padding=${["0", "3", "0", "3"]}
2038
+ gap="2"
2039
+ >
2040
+ ${tokens.map((token) => x`
2041
+ <wui-token-button
2042
+ text=${token.symbol}
2043
+ imageSrc=${token.logoUri}
2044
+ @click=${() => this.onSelectToken(token)}
2045
+ >
2046
+ </wui-token-button>
2047
+ `)}
2048
+ </wui-flex>
2049
+ `;
2050
+ }
2051
+ onSearchInputChange(event) {
2052
+ this.searchValue = event.detail;
2053
+ }
2054
+ handleSuggestedTokensScroll() {
2055
+ var _a;
2056
+ const container = (_a = this.renderRoot) == null ? void 0 : _a.querySelector(".suggested-tokens-container");
2057
+ if (!container) {
2058
+ return;
2059
+ }
2060
+ container.style.setProperty("--suggested-tokens-scroll--left-opacity", MathUtil.interpolate([0, 100], [0, 1], container.scrollLeft).toString());
2061
+ container.style.setProperty("--suggested-tokens-scroll--right-opacity", MathUtil.interpolate([0, 100], [0, 1], container.scrollWidth - container.scrollLeft - container.offsetWidth).toString());
2062
+ }
2063
+ handleTokenListScroll() {
2064
+ var _a;
2065
+ const container = (_a = this.renderRoot) == null ? void 0 : _a.querySelector(".tokens");
2066
+ if (!container) {
2067
+ return;
2068
+ }
2069
+ container.style.setProperty("--tokens-scroll--top-opacity", MathUtil.interpolate([0, 100], [0, 1], container.scrollTop).toString());
2070
+ container.style.setProperty("--tokens-scroll--bottom-opacity", MathUtil.interpolate([0, 100], [0, 1], container.scrollHeight - container.scrollTop - container.offsetHeight).toString());
2071
+ }
2072
+ filterTokensWithText(tokens, text) {
2073
+ return tokens.filter((token) => `${token.symbol} ${token.name} ${token.address}`.toLowerCase().includes(text.toLowerCase())).sort((a, b) => {
2074
+ const aText = `${a.symbol} ${a.name} ${a.address}`.toLowerCase();
2075
+ const bText = `${b.symbol} ${b.name} ${b.address}`.toLowerCase();
2076
+ const aIndex = aText.indexOf(text.toLowerCase());
2077
+ const bIndex = bText.indexOf(text.toLowerCase());
2078
+ return aIndex - bIndex;
2079
+ });
2080
+ }
2081
+ };
2082
+ W3mSwapSelectTokenView.styles = styles;
2083
+ __decorate([
2084
+ r()
2085
+ ], W3mSwapSelectTokenView.prototype, "interval", void 0);
2086
+ __decorate([
2087
+ r()
2088
+ ], W3mSwapSelectTokenView.prototype, "targetToken", void 0);
2089
+ __decorate([
2090
+ r()
2091
+ ], W3mSwapSelectTokenView.prototype, "sourceToken", void 0);
2092
+ __decorate([
2093
+ r()
2094
+ ], W3mSwapSelectTokenView.prototype, "sourceTokenAmount", void 0);
2095
+ __decorate([
2096
+ r()
2097
+ ], W3mSwapSelectTokenView.prototype, "toToken", void 0);
2098
+ __decorate([
2099
+ r()
2100
+ ], W3mSwapSelectTokenView.prototype, "myTokensWithBalance", void 0);
2101
+ __decorate([
2102
+ r()
2103
+ ], W3mSwapSelectTokenView.prototype, "popularTokens", void 0);
2104
+ __decorate([
2105
+ r()
2106
+ ], W3mSwapSelectTokenView.prototype, "suggestedTokens", void 0);
2107
+ __decorate([
2108
+ r()
2109
+ ], W3mSwapSelectTokenView.prototype, "tokensLoading", void 0);
2110
+ __decorate([
2111
+ r()
2112
+ ], W3mSwapSelectTokenView.prototype, "searchValue", void 0);
2113
+ W3mSwapSelectTokenView = __decorate([
2114
+ customElement("w3m-swap-select-token-view")
2115
+ ], W3mSwapSelectTokenView);
2116
+ export {
2117
+ W3mSwapPreviewView,
2118
+ W3mSwapSelectTokenView,
2119
+ W3mSwapView
2120
+ };
2121
+ //# sourceMappingURL=swaps-TcZwQiir.js.map