cppay-sdk 0.0.2-beta.25 → 0.0.2-beta.27

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