@dcl/governance-site 2.0.0 → 2.0.1-20995780683.commit-d6baf5e

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 (77) hide show
  1. package/assets/BlockOverrides-9837a6f9.js +5 -0
  2. package/assets/ConstantsUtil-298f7898.js +1 -0
  3. package/assets/ExchangeController-d2354ec6.js +1 -0
  4. package/assets/HelpersUtil-8cddb046.js +62 -0
  5. package/assets/MathUtil-b514a570.js +1 -0
  6. package/assets/NavigationUtil-a0d0ce87.js +1 -0
  7. package/assets/NetworkUtil-220ea128.js +1 -0
  8. package/assets/PhWallet-fd2006d2.js +14 -0
  9. package/assets/{features-b72c9430.js → ReownAuthentication-468828df.js} +4 -4
  10. package/assets/SwapController-7bfd6ce7.js +1 -0
  11. package/assets/{UserAvatar-78751cb5.js → UserAvatar-456716f1.js} +1 -1
  12. package/assets/ccip-ddcec720.js +1 -0
  13. package/assets/data-capture-3e424a2c.js +242 -0
  14. package/assets/email-ea617f9c.js +90 -0
  15. package/assets/embedded-wallet-814bf005.js +410 -0
  16. package/assets/features-fd521597.js +1 -0
  17. package/assets/fortmatic-f3cb4aa6.js +13 -0
  18. package/assets/if-defined-0a35f675.js +5 -0
  19. package/assets/index-034d22a0.js +138 -0
  20. package/assets/{index-a8255d1c.css → index-05771666.css} +4 -4
  21. package/assets/index-07a61b45.js +51 -0
  22. package/assets/index-1039ded0.js +132 -0
  23. package/assets/index-123c1362.js +224 -0
  24. package/assets/index-15bbaaa0.js +7 -0
  25. package/assets/{index-073512a1.js → index-206e3e77.js} +1 -1
  26. package/assets/index-27a991e4.js +53 -0
  27. package/assets/index-2d0efdd2.js +210 -0
  28. package/assets/index-32d53c87.js +189 -0
  29. package/assets/index-3b861a37.js +102 -0
  30. package/assets/index-4207595b.js +100 -0
  31. package/assets/index-4243d275.js +43 -0
  32. package/assets/index-42ce7246.js +63 -0
  33. package/assets/index-47e87339.js +152 -0
  34. package/assets/index-48bd3fca.js +277 -0
  35. package/assets/index-49cc5044.js +46 -0
  36. package/assets/index-5788a0d6.js +468 -0
  37. package/assets/index-5824c226.js +81 -0
  38. package/assets/index-5da565ce.js +78 -0
  39. package/assets/index-685e7949.js +425 -0
  40. package/assets/index-84e8ecf6.js +647 -0
  41. package/assets/index-965fdf98.js +3425 -0
  42. package/assets/index-9d970383.js +152 -0
  43. package/assets/index-a59b6662.js +68 -0
  44. package/assets/index-b457d047.js +1062 -0
  45. package/assets/index-b65e06cc.js +27 -0
  46. package/assets/{index-2ef9f1d1.js → index-d70e4ab8.js} +66 -66
  47. package/assets/index-d7a6ceea.js +30 -0
  48. package/assets/index-d9c55c27.js +77 -0
  49. package/assets/index-db5b7889.js +77 -0
  50. package/assets/index-e3222791.js +78 -0
  51. package/assets/index-eb060c20.js +1 -0
  52. package/assets/index-f3f03959.js +90 -0
  53. package/assets/index-fcda68c9.js +19 -0
  54. package/assets/index-ff4dea43.js +85 -0
  55. package/assets/networks-14f3c0d2.js +1 -0
  56. package/assets/onramp-dcdb1a34.js +422 -0
  57. package/assets/pay-with-exchange-a64f18a3.js +280 -0
  58. package/assets/receive-ca7bc867.js +131 -0
  59. package/assets/ref-88e1be05.js +13 -0
  60. package/assets/send-8739c9fb.js +554 -0
  61. package/assets/socials-ccc593f5.js +250 -0
  62. package/assets/swaps-0a90eb06.js +1050 -0
  63. package/assets/transactions-bb8cb277.js +16 -0
  64. package/assets/{tslib.es6-82b9ba96.js → tslib.es6-db2ec995.js} +2 -2
  65. package/assets/w3m-modal-869dafbc.js +891 -0
  66. package/assets/zoraTestnet-adc7b76b.js +36 -0
  67. package/index.html +4 -4
  68. package/package.json +3 -3
  69. package/assets/basic-ca749c4c.js +0 -1435
  70. package/assets/core-806d78ea.js +0 -249
  71. package/assets/fortmatic-12e0f2e5.js +0 -13
  72. package/assets/index-372705ba.js +0 -1321
  73. package/assets/index-4be588a0.js +0 -94
  74. package/assets/index-74e34dfb.js +0 -39
  75. package/assets/index-bbb36593.js +0 -7
  76. package/assets/index-c1c8440f.js +0 -47
  77. package/assets/w3m-modal-26eff9d9.js +0 -1209
@@ -0,0 +1,1062 @@
1
+ import{j as U,r as Ee,k as Pe,l as _,m as u,a6 as y,h as O,x as v,a7 as ve,a8 as Se,a9 as ke,aa as N,O as ce,N as A,ab as me,C as m,p as _e,s as Ce,a as $e,E as M,M as G,S as R,t as Re,H as P,o as T,R as z,v as Oe,n as Ue}from"./index-48bd3fca.js";import{n as x,c as C,r as h,U as Le,b as Ie}from"./index-84e8ecf6.js";import{o as f}from"./if-defined-0a35f675.js";import"./index-47e87339.js";import"./index-d9c55c27.js";import"./index-42ce7246.js";import"./index-db5b7889.js";import"./index-07a61b45.js";import"./index-123c1362.js";import"./index-b65e06cc.js";import{C as I}from"./NetworkUtil-220ea128.js";import"./index-d7a6ceea.js";import{M as ge}from"./MathUtil-b514a570.js";const qe=U`
2
+ :host {
3
+ position: relative;
4
+ }
5
+
6
+ button {
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ background-color: transparent;
11
+ padding: ${({spacing:t})=>t[1]};
12
+ }
13
+
14
+ /* -- Colors --------------------------------------------------- */
15
+ button[data-type='accent'] wui-icon {
16
+ color: ${({tokens:t})=>t.core.iconAccentPrimary};
17
+ }
18
+
19
+ button[data-type='neutral'][data-variant='primary'] wui-icon {
20
+ color: ${({tokens:t})=>t.theme.iconInverse};
21
+ }
22
+
23
+ button[data-type='neutral'][data-variant='secondary'] wui-icon {
24
+ color: ${({tokens:t})=>t.theme.iconDefault};
25
+ }
26
+
27
+ button[data-type='success'] wui-icon {
28
+ color: ${({tokens:t})=>t.core.iconSuccess};
29
+ }
30
+
31
+ button[data-type='error'] wui-icon {
32
+ color: ${({tokens:t})=>t.core.iconError};
33
+ }
34
+
35
+ /* -- Sizes --------------------------------------------------- */
36
+ button[data-size='xs'] {
37
+ width: 16px;
38
+ height: 16px;
39
+
40
+ border-radius: ${({borderRadius:t})=>t[1]};
41
+ }
42
+
43
+ button[data-size='sm'] {
44
+ width: 20px;
45
+ height: 20px;
46
+ border-radius: ${({borderRadius:t})=>t[1]};
47
+ }
48
+
49
+ button[data-size='md'] {
50
+ width: 24px;
51
+ height: 24px;
52
+ border-radius: ${({borderRadius:t})=>t[2]};
53
+ }
54
+
55
+ button[data-size='lg'] {
56
+ width: 28px;
57
+ height: 28px;
58
+ border-radius: ${({borderRadius:t})=>t[2]};
59
+ }
60
+
61
+ button[data-size='xs'] wui-icon {
62
+ width: 8px;
63
+ height: 8px;
64
+ }
65
+
66
+ button[data-size='sm'] wui-icon {
67
+ width: 12px;
68
+ height: 12px;
69
+ }
70
+
71
+ button[data-size='md'] wui-icon {
72
+ width: 16px;
73
+ height: 16px;
74
+ }
75
+
76
+ button[data-size='lg'] wui-icon {
77
+ width: 20px;
78
+ height: 20px;
79
+ }
80
+
81
+ /* -- Hover --------------------------------------------------- */
82
+ @media (hover: hover) {
83
+ button[data-type='accent']:hover:enabled {
84
+ background-color: ${({tokens:t})=>t.core.foregroundAccent010};
85
+ }
86
+
87
+ button[data-variant='primary'][data-type='neutral']:hover:enabled {
88
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
89
+ }
90
+
91
+ button[data-variant='secondary'][data-type='neutral']:hover:enabled {
92
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
93
+ }
94
+
95
+ button[data-type='success']:hover:enabled {
96
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
97
+ }
98
+
99
+ button[data-type='error']:hover:enabled {
100
+ background-color: ${({tokens:t})=>t.core.backgroundError};
101
+ }
102
+ }
103
+
104
+ /* -- Focus --------------------------------------------------- */
105
+ button:focus-visible {
106
+ box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020};
107
+ }
108
+
109
+ /* -- Properties --------------------------------------------------- */
110
+ button[data-full-width='true'] {
111
+ width: 100%;
112
+ }
113
+
114
+ :host([fullWidth]) {
115
+ width: 100%;
116
+ }
117
+
118
+ button[disabled] {
119
+ opacity: 0.5;
120
+ cursor: not-allowed;
121
+ }
122
+ `;var F=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};let S=class extends _{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 u`<button
123
+ data-variant=${this.variant}
124
+ data-type=${this.type}
125
+ data-size=${this.size}
126
+ data-full-width=${this.fullWidth}
127
+ ?disabled=${this.disabled}
128
+ >
129
+ <wui-icon color="inherit" name=${this.icon} size=${f(this.iconSize)}></wui-icon>
130
+ </button>`}};S.styles=[Ee,Pe,qe];F([x()],S.prototype,"icon",void 0);F([x()],S.prototype,"variant",void 0);F([x()],S.prototype,"type",void 0);F([x()],S.prototype,"size",void 0);F([x()],S.prototype,"iconSize",void 0);F([x({type:Boolean})],S.prototype,"fullWidth",void 0);F([x({type:Boolean})],S.prototype,"disabled",void 0);S=F([C("wui-icon-button")],S);const d={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"},q={[d.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[d.INVALID_RECIPIENT]:"Invalid recipient address",[d.INVALID_ASSET]:"Invalid asset specified",[d.INVALID_AMOUNT]:"Invalid payment amount",[d.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[d.UNKNOWN_ERROR]:"Unknown payment error occurred",[d.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[d.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[d.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[d.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[d.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[d.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[d.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[d.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[d.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[d.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"};class p extends Error{get message(){return q[this.code]}constructor(e,n){super(q[e]),this.name="AppKitPayError",this.code=e,this.details=n,Error.captureStackTrace&&Error.captureStackTrace(this,p)}}const De="https://rpc.walletconnect.org/v1/json-rpc",fe="reown_test";function Fe(){const{chainNamespace:t}=y.parseCaipNetworkId(l.state.paymentAsset.network);if(!O.isAddress(l.state.recipient,t))throw new p(d.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${t}"`)}async function Be(t,e,n){var c;if(e!==I.CHAIN.EVM)throw new p(d.INVALID_CHAIN_NAMESPACE);if(!n.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");const s=typeof n.amount=="string"?parseFloat(n.amount):n.amount;if(isNaN(s))throw new p(d.INVALID_PAYMENT_CONFIG);const i=((c=t.metadata)==null?void 0:c.decimals)??18,a=v.parseUnits(s.toString(),i);if(typeof a!="bigint")throw new p(d.GENERIC_PAYMENT_ERROR);return await v.sendTransaction({chainNamespace:e,to:n.recipient,address:n.fromAddress,value:a,data:"0x"})??void 0}async function je(t,e){if(!e.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");const n=t.asset,s=e.recipient,i=Number(t.metadata.decimals),a=v.parseUnits(e.amount.toString(),i);if(a===void 0)throw new p(d.GENERIC_PAYMENT_ERROR);return await v.writeContract({fromAddress:e.fromAddress,tokenAddress:n,args:[s,a],method:"transfer",abi:ve.getERC20Abi(n),chainNamespace:I.CHAIN.EVM})??void 0}async function We(t,e){if(t!==I.CHAIN.SOLANA)throw new p(d.INVALID_CHAIN_NAMESPACE);if(!e.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");const n=typeof e.amount=="string"?parseFloat(e.amount):e.amount;if(isNaN(n)||n<=0)throw new p(d.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!Se.getProvider(t))throw new p(d.GENERIC_PAYMENT_ERROR,"No Solana provider available.");const i=await v.sendTransaction({chainNamespace:I.CHAIN.SOLANA,to:e.recipient,value:n,tokenMint:e.tokenMint});if(!i)throw new p(d.GENERIC_PAYMENT_ERROR,"Transaction failed.");return i}catch(s){throw s instanceof p?s:new p(d.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${s}`)}}async function Me({sourceToken:t,toToken:e,amount:n,recipient:s}){const i=v.parseUnits(n,t.metadata.decimals),a=v.parseUnits(n,e.metadata.decimals);return Promise.resolve({type:ae,origin:{amount:(i==null?void 0:i.toString())??"0",currency:t},destination:{amount:(a==null?void 0:a.toString())??"0",currency:e},fees:[{id:"service",label:"Service Fee",amount:"0",currency:e}],steps:[{requestId:ae,type:"deposit",deposit:{amount:(i==null?void 0:i.toString())??"0",currency:t.asset,receiver:s}}],timeInSeconds:6})}function ie(t){if(!t)return null;const e=t.steps[0];return!e||e.type!==st?null:e}function te(t,e=0){if(!t)return[];const n=t.steps.filter(i=>i.type===it),s=n.filter((i,a)=>a+1>e);return n.length>0&&n.length<3?s:[]}const le=new ke({baseUrl:O.getApiUrl(),clientId:null});class ze extends Error{}function Ge(){const t=ce.getSnapshot().projectId;return`${De}?projectId=${t}`}function ue(){const{projectId:t,sdkType:e,sdkVersion:n}=ce.state;return{projectId:t,st:e||"appkit",sv:n||"html-wagmi-4.2.2"}}async function de(t,e){const n=Ge(),{sdkType:s,sdkVersion:i,projectId:a}=ce.getSnapshot(),o={jsonrpc:"2.0",id:1,method:t,params:{...e||{},st:s,sv:i,projectId:a}},g=await(await fetch(n,{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json"}})).json();if(g.error)throw new ze(g.error.message);return g}async function we(t){return(await de("reown_getExchanges",t)).result}async function ye(t){return(await de("reown_getExchangePayUrl",t)).result}async function Qe(t){return(await de("reown_getExchangeBuyStatus",t)).result}async function Ve(t){const e=A.bigNumber(t.amount).times(10**t.toToken.metadata.decimals).toString(),{chainId:n,chainNamespace:s}=y.parseCaipNetworkId(t.sourceToken.network),{chainId:i,chainNamespace:a}=y.parseCaipNetworkId(t.toToken.network),o=t.sourceToken.asset==="native"?me(s):t.sourceToken.asset,c=t.toToken.asset==="native"?me(a):t.toToken.asset;return await le.post({path:"/appkit/v1/transfers/quote",body:{user:t.address,originChainId:n.toString(),originCurrency:o,destinationChainId:i.toString(),destinationCurrency:c,recipient:t.recipient,amount:e},params:ue()})}async function Ye(t){const e=N.isLowerCaseMatch(t.sourceToken.network,t.toToken.network),n=N.isLowerCaseMatch(t.sourceToken.asset,t.toToken.asset);return e&&n?Me(t):Ve(t)}async function He(t){return await le.get({path:"/appkit/v1/transfers/status",params:{requestId:t.requestId,...ue()}})}async function Ke(t){return await le.get({path:`/appkit/v1/transfers/assets/exchanges/${t}`,params:ue()})}const Xe=["eip155","solana"],Je={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}};function ne(t,e){const{chainNamespace:n,chainId:s}=y.parseCaipNetworkId(t),i=Je[n];if(!i)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${n}`);let a=i.native.assetNamespace,o=i.native.assetReference;return e!=="native"&&(a=i.defaultTokenNamespace,o=e),`${`${n}:${s}`}/${a}:${o}`}function Ze(t){const{chainNamespace:e}=y.parseCaipNetworkId(t);return Xe.includes(e)}function et(t){const n=m.getAllRequestedCaipNetworks().find(i=>i.caipNetworkId===t.chainId);let s=t.address;if(!n)throw new Error(`Target network not found for balance chainId "${t.chainId}"`);if(N.isLowerCaseMatch(t.symbol,n.nativeCurrency.symbol))s="native";else if(O.isCaipAddress(s)){const{address:i}=y.parseCaipAddress(s);s=i}else if(!s)throw new Error(`Balance address not found for balance symbol "${t.symbol}"`);return{network:n.caipNetworkId,asset:s,metadata:{name:t.name,symbol:t.symbol,decimals:Number(t.quantity.decimals),logoURI:t.iconUrl},amount:t.quantity.numeric}}function tt(t){return{chainId:t.network,address:`${t.network}:${t.asset}`,symbol:t.metadata.symbol,name:t.metadata.name,iconUrl:t.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:t.metadata.decimals.toString()}}}function X(t){const e=A.bigNumber(t,{safe:!0});return e.lt(.001)?"<0.001":e.round(4).toString()}function nt(t){const n=m.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===t.network);return n?!!n.testnet:!1}const be=0,se="unknown",ae="direct-transfer",st="deposit",it="transaction",r=_e({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:{[I.CHAIN.EVM]:[],[I.CHAIN.SOLANA]:[]},isFetchingTokenBalances:!1,selectedPaymentAsset:null,quote:void 0,quoteStatus:"waiting",quoteError:null,isFetchingQuote:!1,selectedExchange:void 0,exchangeUrlForQuote:void 0,requestId:void 0}),l={state:r,subscribe(t){return Ce(r,()=>t(r))},subscribeKey(t,e){return $e(r,t,e)},async handleOpenPay(t){this.resetState(),this.setPaymentConfig(t),this.initializeAnalytics(),Fe(),await this.prepareTokenLogo(),r.isConfigured=!0,M.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:r.exchanges,configuration:{network:r.paymentAsset.network,asset:r.paymentAsset.asset,recipient:r.recipient,amount:r.amount}}}),await G.open({view:"Pay"})},resetState(){r.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},r.recipient="0x0",r.amount=0,r.isConfigured=!1,r.error=null,r.isPaymentInProgress=!1,r.isLoading=!1,r.currentPayment=void 0,r.selectedExchange=void 0,r.exchangeUrlForQuote=void 0,r.requestId=void 0},resetQuoteState(){r.quote=void 0,r.quoteStatus="waiting",r.quoteError=null,r.isFetchingQuote=!1,r.requestId=void 0},setPaymentConfig(t){if(!t.paymentAsset)throw new p(d.INVALID_PAYMENT_CONFIG);try{r.choice=t.choice??"pay",r.paymentAsset=t.paymentAsset,r.recipient=t.recipient,r.amount=t.amount,r.openInNewTab=t.openInNewTab??!0,r.redirectUrl=t.redirectUrl,r.payWithExchange=t.payWithExchange,r.error=null}catch(e){throw new p(d.INVALID_PAYMENT_CONFIG,e.message)}},setSelectedPaymentAsset(t){r.selectedPaymentAsset=t},setSelectedExchange(t){r.selectedExchange=t},setRequestId(t){r.requestId=t},setPaymentInProgress(t){r.isPaymentInProgress=t},getPaymentAsset(){return r.paymentAsset},getExchanges(){return r.exchanges},async fetchExchanges(){try{r.isLoading=!0;const t=await we({page:be});r.exchanges=t.exchanges.slice(0,2)}catch{throw R.showError(q.UNABLE_TO_GET_EXCHANGES),new p(d.UNABLE_TO_GET_EXCHANGES)}finally{r.isLoading=!1}},async getAvailableExchanges(t){var e;try{const n=t!=null&&t.asset&&(t!=null&&t.network)?ne(t.network,t.asset):void 0;return await we({page:(t==null?void 0:t.page)??be,asset:n,amount:(e=t==null?void 0:t.amount)==null?void 0:e.toString()})}catch{throw new p(d.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(t,e,n=!1){try{const s=Number(e.amount),i=await ye({exchangeId:t,asset:ne(e.network,e.asset),amount:s.toString(),recipient:`${e.network}:${e.recipient}`});return M.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{source:"pay",exchange:{id:t},configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},headless:n}}),n&&(this.initiatePayment(),M.sendEvent({type:"track",event:"PAY_INITIATED",properties:{source:"pay",paymentId:r.paymentId||se,configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t}}})),i}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new p(d.ASSET_NOT_SUPPORTED):new Error(s.message)}},async generateExchangeUrlForQuote({exchangeId:t,paymentAsset:e,amount:n,recipient:s}){const i=await ye({exchangeId:t,asset:ne(e.network,e.asset),amount:n.toString(),recipient:s});r.exchangeSessionId=i.sessionId,r.exchangeUrlForQuote=i.url},async openPayUrl(t,e,n=!1){try{const s=await this.getPayUrl(t.exchangeId,e,n);if(!s)throw new p(d.UNABLE_TO_GET_PAY_URL);const a=t.openInNewTab??!0?"_blank":"_self";return O.openHref(s.url,a),s}catch(s){throw s instanceof p?r.error=s.message:r.error=q.GENERIC_PAYMENT_ERROR,new p(d.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:t,fromAddress:e,toAddress:n,amount:s,paymentAsset:i}){if(r.currentPayment={type:"wallet",status:"IN_PROGRESS"},!r.isPaymentInProgress)try{this.initiatePayment();const o=m.getAllRequestedCaipNetworks().find(g=>g.caipNetworkId===i.network);if(!o)throw new Error("Target network not found");const c=m.state.activeCaipNetwork;switch(N.isLowerCaseMatch(c==null?void 0:c.caipNetworkId,o.caipNetworkId)||await m.switchActiveNetwork(o),t){case I.CHAIN.EVM:i.asset==="native"&&(r.currentPayment.result=await Be(i,t,{recipient:n,amount:s,fromAddress:e})),i.asset.startsWith("0x")&&(r.currentPayment.result=await je(i,{recipient:n,amount:s,fromAddress:e})),r.currentPayment.status="SUCCESS";break;case I.CHAIN.SOLANA:r.currentPayment.result=await We(t,{recipient:n,amount:s,fromAddress:e,tokenMint:i.asset==="native"?void 0:i.asset}),r.currentPayment.status="SUCCESS";break;default:throw new p(d.INVALID_CHAIN_NAMESPACE)}}catch(a){throw a instanceof p?r.error=a.message:r.error=q.GENERIC_PAYMENT_ERROR,r.currentPayment.status="FAILED",R.showError(r.error),a}finally{r.isPaymentInProgress=!1}},async onSendTransaction(t){try{const{namespace:e,transactionStep:n}=t;l.initiatePayment();const i=m.getAllRequestedCaipNetworks().find(o=>{var c;return o.caipNetworkId===((c=r.paymentAsset)==null?void 0:c.network)});if(!i)throw new Error("Target network not found");const a=m.state.activeCaipNetwork;if(N.isLowerCaseMatch(a==null?void 0:a.caipNetworkId,i.caipNetworkId)||await m.switchActiveNetwork(i),e===I.CHAIN.EVM){const{from:o,to:c,data:g,value:L}=n.transaction;await v.sendTransaction({address:o,to:c,data:g,value:BigInt(L),chainNamespace:e})}else if(e===I.CHAIN.SOLANA){const{instructions:o}=n.transaction;await v.writeSolanaTransaction({instructions:o})}}catch(e){throw e instanceof p?r.error=e.message:r.error=q.GENERIC_PAYMENT_ERROR,R.showError(r.error),e}finally{r.isPaymentInProgress=!1}},getExchangeById(t){return r.exchanges.find(e=>e.id===t)},validatePayConfig(t){const{paymentAsset:e,recipient:n,amount:s}=t;if(!e)throw new p(d.INVALID_PAYMENT_CONFIG);if(!n)throw new p(d.INVALID_RECIPIENT);if(!e.asset)throw new p(d.INVALID_ASSET);if(s==null||s<=0)throw new p(d.INVALID_AMOUNT)},async handlePayWithExchange(t){try{r.currentPayment={type:"exchange",exchangeId:t};const{network:e,asset:n}=r.paymentAsset,s={network:e,asset:n,amount:r.amount,recipient:r.recipient},i=await this.getPayUrl(t,s);if(!i)throw new p(d.UNABLE_TO_INITIATE_PAYMENT);return r.currentPayment.sessionId=i.sessionId,r.currentPayment.status="IN_PROGRESS",r.currentPayment.exchangeId=t,this.initiatePayment(),{url:i.url,openInNewTab:r.openInNewTab}}catch(e){return e instanceof p?r.error=e.message:r.error=q.GENERIC_PAYMENT_ERROR,r.isPaymentInProgress=!1,R.showError(r.error),null}},async getBuyStatus(t,e){var n,s;try{const i=await Qe({sessionId:e,exchangeId:t});return(i.status==="SUCCESS"||i.status==="FAILED")&&M.sendEvent({type:"track",event:i.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:i.status==="FAILED"?O.parseError(r.error):void 0,source:"pay",paymentId:r.paymentId||se,configuration:{network:r.paymentAsset.network,asset:r.paymentAsset.asset,recipient:r.recipient,amount:r.amount},currentPayment:{type:"exchange",exchangeId:(n=r.currentPayment)==null?void 0:n.exchangeId,sessionId:(s=r.currentPayment)==null?void 0:s.sessionId,result:i.txHash}}}),i}catch{throw new p(d.UNABLE_TO_GET_BUY_STATUS)}},async fetchTokensFromEOA({caipAddress:t,caipNetwork:e,namespace:n}){if(!t)return[];const{address:s}=y.parseCaipAddress(t);let i=e;return n===I.CHAIN.EVM&&(i=void 0),await Re.getMyTokensWithBalance({address:s,caipNetwork:i})},async fetchTokensFromExchange(){if(!r.selectedExchange)return[];const t=await Ke(r.selectedExchange.id),e=Object.values(t.assets).flat();return await Promise.all(e.map(async s=>{const i=tt(s),{chainNamespace:a}=y.parseCaipNetworkId(i.chainId);let o=i.address;if(O.isCaipAddress(o)){const{address:g}=y.parseCaipAddress(o);o=g}const c=await P.getImageByToken(o??"",a).catch(()=>{});return i.iconUrl=c??"",i}))},async fetchTokens({caipAddress:t,caipNetwork:e,namespace:n}){try{r.isFetchingTokenBalances=!0;const a=await(!!r.selectedExchange?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:t,caipNetwork:e,namespace:n}));r.tokenBalances={...r.tokenBalances,[n]:a}}catch(s){const i=s instanceof Error?s.message:"Unable to get token balances";R.showError(i)}finally{r.isFetchingTokenBalances=!1}},async fetchQuote({amount:t,address:e,sourceToken:n,toToken:s,recipient:i}){try{l.resetQuoteState(),r.isFetchingQuote=!0;const a=await Ye({amount:t,address:r.selectedExchange?void 0:e,sourceToken:n,toToken:s,recipient:i});if(r.selectedExchange){const o=ie(a);if(o){const c=`${n.network}:${o.deposit.receiver}`,g=A.formatNumber(o.deposit.amount,{decimals:n.metadata.decimals??0,round:8});await l.generateExchangeUrlForQuote({exchangeId:r.selectedExchange.id,paymentAsset:n,amount:g.toString(),recipient:c})}}r.quote=a}catch(a){let o=q.UNABLE_TO_GET_QUOTE;if(a instanceof Error&&a.cause&&a.cause instanceof Response)try{const c=await a.cause.json();c.error&&typeof c.error=="string"&&(o=c.error)}catch{}throw r.quoteError=o,R.showError(o),new p(d.UNABLE_TO_GET_QUOTE)}finally{r.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:t}){try{if(t===ae){const n=r.selectedExchange,s=r.exchangeSessionId;if(n&&s){switch((await this.getBuyStatus(n.id,s)).status){case"IN_PROGRESS":r.quoteStatus="waiting";break;case"SUCCESS":r.quoteStatus="success",r.isPaymentInProgress=!1;break;case"FAILED":r.quoteStatus="failure",r.isPaymentInProgress=!1;break;case"UNKNOWN":r.quoteStatus="waiting";break;default:r.quoteStatus="waiting";break}return}r.quoteStatus="success";return}const{status:e}=await He({requestId:t});r.quoteStatus=e}catch{throw r.quoteStatus="failure",new p(d.UNABLE_TO_GET_QUOTE_STATUS)}},initiatePayment(){r.isPaymentInProgress=!0,r.paymentId=crypto.randomUUID()},initializeAnalytics(){r.analyticsSet||(r.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",t=>{var e;if((e=r.currentPayment)!=null&&e.status&&r.currentPayment.status!=="UNKNOWN"){const n={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[r.currentPayment.status];M.sendEvent({type:"track",event:n,properties:{message:r.currentPayment.status==="FAILED"?O.parseError(r.error):void 0,source:"pay",paymentId:r.paymentId||se,configuration:{network:r.paymentAsset.network,asset:r.paymentAsset.asset,recipient:r.recipient,amount:r.amount},currentPayment:{type:r.currentPayment.type,exchangeId:r.currentPayment.exchangeId,sessionId:r.currentPayment.sessionId,result:r.currentPayment.result}}})}}))},async prepareTokenLogo(){if(!r.paymentAsset.metadata.logoURI)try{const{chainNamespace:t}=y.parseCaipNetworkId(r.paymentAsset.network),e=await P.getImageByToken(r.paymentAsset.asset,t);r.paymentAsset.metadata.logoURI=e}catch{}}},at=U`
131
+ wui-separator {
132
+ margin: var(--apkt-spacing-3) calc(var(--apkt-spacing-3) * -1) var(--apkt-spacing-2)
133
+ calc(var(--apkt-spacing-3) * -1);
134
+ width: calc(100% + var(--apkt-spacing-3) * 2);
135
+ }
136
+
137
+ .token-display {
138
+ padding: var(--apkt-spacing-3) var(--apkt-spacing-3);
139
+ border-radius: var(--apkt-borderRadius-5);
140
+ background-color: var(--apkt-tokens-theme-backgroundPrimary);
141
+ margin-top: var(--apkt-spacing-3);
142
+ margin-bottom: var(--apkt-spacing-3);
143
+ }
144
+
145
+ .token-display wui-text {
146
+ text-transform: none;
147
+ }
148
+
149
+ wui-loading-spinner {
150
+ padding: var(--apkt-spacing-2);
151
+ }
152
+
153
+ .left-image-container {
154
+ position: relative;
155
+ justify-content: center;
156
+ align-items: center;
157
+ }
158
+
159
+ .token-image {
160
+ border-radius: ${({borderRadius:t})=>t.round};
161
+ width: 40px;
162
+ height: 40px;
163
+ }
164
+
165
+ .chain-image {
166
+ position: absolute;
167
+ width: 20px;
168
+ height: 20px;
169
+ bottom: -3px;
170
+ right: -5px;
171
+ border-radius: ${({borderRadius:t})=>t.round};
172
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
173
+ }
174
+
175
+ .payment-methods-container {
176
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
177
+ border-top-right-radius: ${({borderRadius:t})=>t[8]};
178
+ border-top-left-radius: ${({borderRadius:t})=>t[8]};
179
+ }
180
+ `;var B=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};let k=class extends _{constructor(){super(),this.unsubscribe=[],this.amount=l.state.amount,this.namespace=void 0,this.paymentAsset=l.state.paymentAsset,this.activeConnectorIds=T.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=l.state.exchanges,this.isLoading=l.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(l.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(T.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(l.subscribeKey("exchanges",e=>this.exchanges=e)),this.unsubscribe.push(l.subscribeKey("isLoading",e=>this.isLoading=e)),l.fetchExchanges(),l.setSelectedExchange(void 0)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return u`
181
+ <wui-flex flexDirection="column">
182
+ ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()}
183
+ </wui-flex>
184
+ `}paymentMethodsTemplate(){return u`
185
+ <wui-flex flexDirection="column" padding="3" gap="2" class="payment-methods-container">
186
+ ${this.payWithWalletTemplate()} ${this.templateSeparator()}
187
+ ${this.templateExchangeOptions()}
188
+ </wui-flex>
189
+ `}initializeNamespace(){var n;const e=m.state.activeChain;this.namespace=e,this.caipAddress=(n=m.getAccountData(e))==null?void 0:n.caipAddress,this.unsubscribe.push(m.subscribeChainProp("accountState",s=>{this.caipAddress=s==null?void 0:s.caipAddress},e))}paymentDetailsTemplate(){const n=m.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===this.paymentAsset.network);return u`
190
+ <wui-flex
191
+ alignItems="center"
192
+ justifyContent="space-between"
193
+ .padding=${["6","8","6","8"]}
194
+ gap="2"
195
+ >
196
+ <wui-flex alignItems="center" gap="1">
197
+ <wui-text variant="h1-regular" color="primary">
198
+ ${X(this.amount||"0")}
199
+ </wui-text>
200
+
201
+ <wui-flex flexDirection="column">
202
+ <wui-text variant="h6-regular" color="secondary">
203
+ ${this.paymentAsset.metadata.symbol||"Unknown"}
204
+ </wui-text>
205
+ <wui-text variant="md-medium" color="secondary"
206
+ >on ${(n==null?void 0:n.name)||"Unknown"}</wui-text
207
+ >
208
+ </wui-flex>
209
+ </wui-flex>
210
+
211
+ <wui-flex class="left-image-container">
212
+ <wui-image
213
+ src=${f(this.paymentAsset.metadata.logoURI)}
214
+ class="token-image"
215
+ ></wui-image>
216
+ <wui-image
217
+ src=${f(P.getNetworkImage(n))}
218
+ class="chain-image"
219
+ ></wui-image>
220
+ </wui-flex>
221
+ </wui-flex>
222
+ `}payWithWalletTemplate(){return Ze(this.paymentAsset.network)?this.caipAddress?this.connectedWalletTemplate():this.disconnectedWalletTemplate():u``}connectedWalletTemplate(){const{name:e,image:n}=this.getWalletProperties({namespace:this.namespace});return u`
223
+ <wui-flex flexDirection="column" gap="3">
224
+ <wui-list-item
225
+ type="secondary"
226
+ boxColor="foregroundSecondary"
227
+ @click=${this.onWalletPayment}
228
+ .boxed=${!1}
229
+ ?chevron=${!0}
230
+ ?fullSize=${!1}
231
+ ?rounded=${!0}
232
+ data-testid="wallet-payment-option"
233
+ imageSrc=${f(n)}
234
+ imageSize="3xl"
235
+ >
236
+ <wui-text variant="lg-regular" color="primary">Pay with ${e}</wui-text>
237
+ </wui-list-item>
238
+
239
+ <wui-list-item
240
+ type="secondary"
241
+ icon="power"
242
+ iconColor="error"
243
+ @click=${this.onDisconnect}
244
+ data-testid="disconnect-button"
245
+ ?chevron=${!1}
246
+ boxColor="foregroundSecondary"
247
+ >
248
+ <wui-text variant="lg-regular" color="secondary">Disconnect</wui-text>
249
+ </wui-list-item>
250
+ </wui-flex>
251
+ `}disconnectedWalletTemplate(){return u`<wui-list-item
252
+ type="secondary"
253
+ boxColor="foregroundSecondary"
254
+ variant="icon"
255
+ iconColor="default"
256
+ iconVariant="overlay"
257
+ icon="wallet"
258
+ @click=${this.onWalletPayment}
259
+ ?chevron=${!0}
260
+ data-testid="wallet-payment-option"
261
+ >
262
+ <wui-text variant="lg-regular" color="primary">Pay with wallet</wui-text>
263
+ </wui-list-item>`}templateExchangeOptions(){if(this.isLoading)return u`<wui-flex justifyContent="center" alignItems="center">
264
+ <wui-loading-spinner size="md"></wui-loading-spinner>
265
+ </wui-flex>`;const e=this.exchanges.filter(n=>nt(this.paymentAsset)?n.id===fe:n.id!==fe);return e.length===0?u`<wui-flex justifyContent="center" alignItems="center">
266
+ <wui-text variant="md-medium" color="primary">No exchanges available</wui-text>
267
+ </wui-flex>`:e.map(n=>u`
268
+ <wui-list-item
269
+ type="secondary"
270
+ boxColor="foregroundSecondary"
271
+ @click=${()=>this.onExchangePayment(n)}
272
+ data-testid="exchange-option-${n.id}"
273
+ ?chevron=${!0}
274
+ imageSrc=${f(n.imageUrl)}
275
+ >
276
+ <wui-text flexGrow="1" variant="lg-regular" color="primary">
277
+ Pay with ${n.name}
278
+ </wui-text>
279
+ </wui-list-item>
280
+ `)}templateSeparator(){return u`<wui-separator text="or" bgColor="secondary"></wui-separator>`}async onWalletPayment(){if(!this.namespace)throw new Error("Namespace not found");this.caipAddress?z.push("PayQuote"):(await T.connect(),await G.open({view:"PayQuote"}))}onExchangePayment(e){l.setSelectedExchange(e),z.push("PayQuote")}async onDisconnect(){try{await v.disconnect(),await G.open({view:"Pay"})}catch{console.error("Failed to disconnect"),R.showError("Failed to disconnect")}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=T.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const i=P.getConnectorImage(s);return{name:s.name,image:i}}};k.styles=at;B([h()],k.prototype,"amount",void 0);B([h()],k.prototype,"namespace",void 0);B([h()],k.prototype,"paymentAsset",void 0);B([h()],k.prototype,"activeConnectorIds",void 0);B([h()],k.prototype,"caipAddress",void 0);B([h()],k.prototype,"exchanges",void 0);B([h()],k.prototype,"isLoading",void 0);k=B([C("w3m-pay-view")],k);const rt=U`
281
+ :host {
282
+ display: inline-flex;
283
+ align-items: center;
284
+ justify-content: center;
285
+ }
286
+
287
+ .pulse-container {
288
+ position: relative;
289
+ width: var(--pulse-size);
290
+ height: var(--pulse-size);
291
+ display: flex;
292
+ align-items: center;
293
+ justify-content: center;
294
+ }
295
+
296
+ .pulse-rings {
297
+ position: absolute;
298
+ inset: 0;
299
+ pointer-events: none;
300
+ }
301
+
302
+ .pulse-ring {
303
+ position: absolute;
304
+ inset: 0;
305
+ border-radius: 50%;
306
+ border: 2px solid var(--pulse-color);
307
+ opacity: 0;
308
+ animation: pulse var(--pulse-duration, 2s) ease-out infinite;
309
+ }
310
+
311
+ .pulse-content {
312
+ position: relative;
313
+ z-index: 1;
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ }
318
+
319
+ @keyframes pulse {
320
+ 0% {
321
+ transform: scale(0.5);
322
+ opacity: var(--pulse-opacity, 0.3);
323
+ }
324
+ 50% {
325
+ opacity: calc(var(--pulse-opacity, 0.3) * 0.5);
326
+ }
327
+ 100% {
328
+ transform: scale(1.2);
329
+ opacity: 0;
330
+ }
331
+ }
332
+ `;var W=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};const ot=3,ct=2,lt=.3,ut="200px",dt={"accent-primary":Oe.tokens.core.backgroundAccentPrimary};let D=class extends _{constructor(){super(...arguments),this.rings=ot,this.duration=ct,this.opacity=lt,this.size=ut,this.variant="accent-primary"}render(){const e=dt[this.variant];this.style.cssText=`
333
+ --pulse-size: ${this.size};
334
+ --pulse-duration: ${this.duration}s;
335
+ --pulse-color: ${e};
336
+ --pulse-opacity: ${this.opacity};
337
+ `;const n=Array.from({length:this.rings},(s,i)=>this.renderRing(i,this.rings));return u`
338
+ <div class="pulse-container">
339
+ <div class="pulse-rings">${n}</div>
340
+ <div class="pulse-content">
341
+ <slot></slot>
342
+ </div>
343
+ </div>
344
+ `}renderRing(e,n){const i=`animation-delay: ${e/n*this.duration}s;`;return u`<div class="pulse-ring" style=${i}></div>`}};D.styles=[Ee,rt];W([x({type:Number})],D.prototype,"rings",void 0);W([x({type:Number})],D.prototype,"duration",void 0);W([x({type:Number})],D.prototype,"opacity",void 0);W([x()],D.prototype,"size",void 0);W([x()],D.prototype,"variant",void 0);D=W([C("wui-pulse")],D);const xe=[{id:"received",title:"Receiving funds",icon:"dollar"},{id:"processing",title:"Swapping asset",icon:"recycleHorizontal"},{id:"sending",title:"Sending asset to the recipient address",icon:"send"}],Ae=["success","submitted","failure","timeout","refund"],pt=U`
345
+ :host {
346
+ display: block;
347
+ height: 100%;
348
+ width: 100%;
349
+ }
350
+
351
+ wui-image {
352
+ border-radius: ${({borderRadius:t})=>t.round};
353
+ }
354
+
355
+ .token-badge-container {
356
+ position: absolute;
357
+ bottom: 6px;
358
+ left: 50%;
359
+ transform: translateX(-50%);
360
+ border-radius: ${({borderRadius:t})=>t[4]};
361
+ z-index: 3;
362
+ min-width: 105px;
363
+ }
364
+
365
+ .token-badge-container.loading {
366
+ background-color: ${({tokens:t})=>t.theme.backgroundPrimary};
367
+ border: 3px solid ${({tokens:t})=>t.theme.backgroundPrimary};
368
+ }
369
+
370
+ .token-badge-container.success {
371
+ background-color: ${({tokens:t})=>t.theme.backgroundPrimary};
372
+ border: 3px solid ${({tokens:t})=>t.theme.backgroundPrimary};
373
+ }
374
+
375
+ .token-image-container {
376
+ position: relative;
377
+ }
378
+
379
+ .token-image {
380
+ border-radius: ${({borderRadius:t})=>t.round};
381
+ width: 64px;
382
+ height: 64px;
383
+ }
384
+
385
+ .token-image.success {
386
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
387
+ }
388
+
389
+ .token-image.error {
390
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
391
+ }
392
+
393
+ .token-image.loading {
394
+ background: ${({colors:t})=>t.accent010};
395
+ }
396
+
397
+ .token-image wui-icon {
398
+ width: 32px;
399
+ height: 32px;
400
+ }
401
+
402
+ .token-badge {
403
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
404
+ border: 1px solid ${({tokens:t})=>t.theme.foregroundSecondary};
405
+ border-radius: ${({borderRadius:t})=>t[4]};
406
+ }
407
+
408
+ .token-badge wui-text {
409
+ white-space: nowrap;
410
+ }
411
+
412
+ .payment-lifecycle-container {
413
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
414
+ border-top-right-radius: ${({borderRadius:t})=>t[6]};
415
+ border-top-left-radius: ${({borderRadius:t})=>t[6]};
416
+ }
417
+
418
+ .payment-step-badge {
419
+ padding: ${({spacing:t})=>t[1]} ${({spacing:t})=>t[2]};
420
+ border-radius: ${({borderRadius:t})=>t[1]};
421
+ }
422
+
423
+ .payment-step-badge.loading {
424
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
425
+ }
426
+
427
+ .payment-step-badge.error {
428
+ background-color: ${({tokens:t})=>t.core.backgroundError};
429
+ }
430
+
431
+ .payment-step-badge.success {
432
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
433
+ }
434
+
435
+ .step-icon-container {
436
+ position: relative;
437
+ height: 40px;
438
+ width: 40px;
439
+ border-radius: ${({borderRadius:t})=>t.round};
440
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
441
+ }
442
+
443
+ .step-icon-box {
444
+ position: absolute;
445
+ right: -4px;
446
+ bottom: -1px;
447
+ padding: 2px;
448
+ border-radius: ${({borderRadius:t})=>t.round};
449
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
450
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
451
+ }
452
+
453
+ .step-icon-box.success {
454
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
455
+ }
456
+ `;var $=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};const ht={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]},mt=3e3;let E=class extends _{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=l.state.paymentAsset,this.quoteStatus=l.state.quoteStatus,this.quote=l.state.quote,this.amount=l.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=T.state.activeConnectorIds,this.selectedExchange=l.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(l.subscribeKey("quoteStatus",e=>this.quoteStatus=e),l.subscribeKey("quote",e=>this.quote=e),T.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e),l.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach(e=>e())}render(){return u`
457
+ <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2">
458
+ ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()}
459
+ </wui-flex>
460
+ `}tokenTemplate(){const e=X(this.amount||"0"),n=this.paymentAsset.metadata.symbol??"Unknown",i=m.getAllRequestedCaipNetworks().find(c=>c.caipNetworkId===this.paymentAsset.network),a=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund";return this.quoteStatus==="success"||this.quoteStatus==="submitted"?u`<wui-flex alignItems="center" justifyContent="center">
461
+ <wui-flex justifyContent="center" alignItems="center" class="token-image success">
462
+ <wui-icon name="checkmark" color="success" size="inherit"></wui-icon>
463
+ </wui-flex>
464
+ </wui-flex>`:a?u`<wui-flex alignItems="center" justifyContent="center">
465
+ <wui-flex justifyContent="center" alignItems="center" class="token-image error">
466
+ <wui-icon name="close" color="error" size="inherit"></wui-icon>
467
+ </wui-flex>
468
+ </wui-flex>`:u`
469
+ <wui-flex alignItems="center" justifyContent="center">
470
+ <wui-flex class="token-image-container">
471
+ <wui-pulse size="125px" rings="3" duration="4" opacity="0.5" variant="accent-primary">
472
+ <wui-flex justifyContent="center" alignItems="center" class="token-image loading">
473
+ <wui-icon name="paperPlaneTitle" color="accent-primary" size="inherit"></wui-icon>
474
+ </wui-flex>
475
+ </wui-pulse>
476
+
477
+ <wui-flex
478
+ justifyContent="center"
479
+ alignItems="center"
480
+ class="token-badge-container loading"
481
+ >
482
+ <wui-flex
483
+ alignItems="center"
484
+ justifyContent="center"
485
+ gap="01"
486
+ padding="1"
487
+ class="token-badge"
488
+ >
489
+ <wui-image
490
+ src=${f(P.getNetworkImage(i))}
491
+ class="chain-image"
492
+ size="mdl"
493
+ ></wui-image>
494
+
495
+ <wui-text variant="lg-regular" color="primary">${e} ${n}</wui-text>
496
+ </wui-flex>
497
+ </wui-flex>
498
+ </wui-flex>
499
+ </wui-flex>
500
+ `}paymentTemplate(){return u`
501
+ <wui-flex flexDirection="column" gap="2" .padding=${["0","6","0","6"]}>
502
+ ${this.renderPayment()}
503
+ <wui-separator></wui-separator>
504
+ ${this.renderWallet()}
505
+ </wui-flex>
506
+ `}paymentLifecycleTemplate(){const e=this.getStepsWithStatus();return u`
507
+ <wui-flex flexDirection="column" padding="4" gap="2" class="payment-lifecycle-container">
508
+ <wui-flex alignItems="center" justifyContent="space-between">
509
+ <wui-text variant="md-regular" color="secondary">PAYMENT CYCLE</wui-text>
510
+
511
+ ${this.renderPaymentCycleBadge()}
512
+ </wui-flex>
513
+
514
+ <wui-flex flexDirection="column" gap="5" .padding=${["2","0","2","0"]}>
515
+ ${e.map(n=>this.renderStep(n))}
516
+ </wui-flex>
517
+ </wui-flex>
518
+ `}renderPaymentCycleBadge(){var i;const e=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund",n=this.quoteStatus==="success"||this.quoteStatus==="submitted";if(e)return u`
519
+ <wui-flex
520
+ justifyContent="center"
521
+ alignItems="center"
522
+ class="payment-step-badge error"
523
+ gap="1"
524
+ >
525
+ <wui-icon name="close" color="error" size="xs"></wui-icon>
526
+ <wui-text variant="sm-regular" color="error">Failed</wui-text>
527
+ </wui-flex>
528
+ `;if(n)return u`
529
+ <wui-flex
530
+ justifyContent="center"
531
+ alignItems="center"
532
+ class="payment-step-badge success"
533
+ gap="1"
534
+ >
535
+ <wui-icon name="checkmark" color="success" size="xs"></wui-icon>
536
+ <wui-text variant="sm-regular" color="success">Completed</wui-text>
537
+ </wui-flex>
538
+ `;const s=((i=this.quote)==null?void 0:i.timeInSeconds)??0;return u`
539
+ <wui-flex alignItems="center" justifyContent="space-between" gap="3">
540
+ <wui-flex
541
+ justifyContent="center"
542
+ alignItems="center"
543
+ class="payment-step-badge loading"
544
+ gap="1"
545
+ >
546
+ <wui-icon name="clock" color="default" size="xs"></wui-icon>
547
+ <wui-text variant="sm-regular" color="primary">Est. ${s} sec</wui-text>
548
+ </wui-flex>
549
+
550
+ <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon>
551
+ </wui-flex>
552
+ `}renderPayment(){var o,c,g;const n=m.getAllRequestedCaipNetworks().find(L=>{var Y;const Q=(Y=this.quote)==null?void 0:Y.origin.currency.network;if(!Q)return!1;const{chainId:V}=y.parseCaipNetworkId(Q);return N.isLowerCaseMatch(L.id.toString(),V.toString())}),s=A.formatNumber(((o=this.quote)==null?void 0:o.origin.amount)||"0",{decimals:((c=this.quote)==null?void 0:c.origin.currency.metadata.decimals)??0}).toString(),i=X(s),a=((g=this.quote)==null?void 0:g.origin.currency.metadata.symbol)??"Unknown";return u`
553
+ <wui-flex
554
+ alignItems="flex-start"
555
+ justifyContent="space-between"
556
+ .padding=${["3","0","3","0"]}
557
+ >
558
+ <wui-text variant="lg-regular" color="secondary">Payment Method</wui-text>
559
+
560
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="1">
561
+ <wui-flex alignItems="center" gap="01">
562
+ <wui-text variant="lg-regular" color="primary">${i}</wui-text>
563
+ <wui-text variant="lg-regular" color="secondary">${a}</wui-text>
564
+ </wui-flex>
565
+
566
+ <wui-flex alignItems="center" gap="1">
567
+ <wui-text variant="md-regular" color="secondary">on</wui-text>
568
+ <wui-image
569
+ src=${f(P.getNetworkImage(n))}
570
+ size="xs"
571
+ ></wui-image>
572
+ <wui-text variant="md-regular" color="secondary">${n==null?void 0:n.name}</wui-text>
573
+ </wui-flex>
574
+ </wui-flex>
575
+ </wui-flex>
576
+ `}renderWallet(){return u`
577
+ <wui-flex
578
+ alignItems="flex-start"
579
+ justifyContent="space-between"
580
+ .padding=${["3","0","3","0"]}
581
+ >
582
+ <wui-text variant="lg-regular" color="secondary">Wallet</wui-text>
583
+
584
+ ${this.renderWalletText()}
585
+ </wui-flex>
586
+ `}renderWalletText(){var i;const{image:e}=this.getWalletProperties({namespace:this.namespace}),{address:n}=this.caipAddress?y.parseCaipAddress(this.caipAddress):{},s=(i=this.selectedExchange)==null?void 0:i.name;return this.selectedExchange?u`
587
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
588
+ <wui-text variant="lg-regular" color="primary">${s}</wui-text>
589
+ <wui-image src=${f(this.selectedExchange.imageUrl)} size="mdl"></wui-image>
590
+ </wui-flex>
591
+ `:u`
592
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
593
+ <wui-text variant="lg-regular" color="primary">
594
+ ${Le.getTruncateString({string:this.profileName||n||s||"",charsStart:this.profileName?16:4,charsEnd:this.profileName?0:6,truncate:this.profileName?"end":"middle"})}
595
+ </wui-text>
596
+
597
+ <wui-image src=${f(e)} size="mdl"></wui-image>
598
+ </wui-flex>
599
+ `}getStepsWithStatus(){return this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund"?xe.map(n=>({...n,status:"failed"})):xe.map(n=>{const i=(ht[n.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...n,status:i}})}renderStep({title:e,icon:n,status:s}){return u`
600
+ <wui-flex alignItems="center" gap="3">
601
+ <wui-flex justifyContent="center" alignItems="center" class="step-icon-container">
602
+ <wui-icon name=${n} color="default" size="mdl"></wui-icon>
603
+
604
+ <wui-flex alignItems="center" justifyContent="center" class=${Ie({"step-icon-box":!0,success:s==="completed"})}>
605
+ ${this.renderStatusIndicator(s)}
606
+ </wui-flex>
607
+ </wui-flex>
608
+
609
+ <wui-text variant="md-regular" color="primary">${e}</wui-text>
610
+ </wui-flex>
611
+ `}renderStatusIndicator(e){return e==="completed"?u`<wui-icon size="sm" color="success" name="checkmark"></wui-icon>`:e==="failed"?u`<wui-icon size="sm" color="error" name="close"></wui-icon>`:e==="pending"?u`<wui-loading-spinner color="accent-primary" size="sm"></wui-loading-spinner>`:null}startPolling(){this.pollingInterval||(this.fetchQuoteStatus(),this.pollingInterval=setInterval(()=>{this.fetchQuoteStatus()},mt))}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}async fetchQuoteStatus(){const e=l.state.requestId;if(!e||Ae.includes(this.quoteStatus))this.stopPolling();else try{await l.fetchQuoteStatus({requestId:e}),Ae.includes(this.quoteStatus)&&this.stopPolling()}catch{this.stopPolling()}}initializeNamespace(){var n,s;const e=m.state.activeChain;this.namespace=e,this.caipAddress=(n=m.getAccountData(e))==null?void 0:n.caipAddress,this.profileName=((s=m.getAccountData(e))==null?void 0:s.profileName)??null,this.unsubscribe.push(m.subscribeChainProp("accountState",i=>{this.caipAddress=i==null?void 0:i.caipAddress,this.profileName=(i==null?void 0:i.profileName)??null},e))}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=T.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const i=P.getConnectorImage(s);return{name:s.name,image:i}}};E.styles=pt;$([h()],E.prototype,"paymentAsset",void 0);$([h()],E.prototype,"quoteStatus",void 0);$([h()],E.prototype,"quote",void 0);$([h()],E.prototype,"amount",void 0);$([h()],E.prototype,"namespace",void 0);$([h()],E.prototype,"caipAddress",void 0);$([h()],E.prototype,"profileName",void 0);$([h()],E.prototype,"activeConnectorIds",void 0);$([h()],E.prototype,"selectedExchange",void 0);E=$([C("w3m-pay-loading-view")],E);const gt=Ue`
612
+ :host {
613
+ display: block;
614
+ }
615
+ `;var ft=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};let re=class extends _{render(){return u`
616
+ <wui-flex flexDirection="column" gap="4">
617
+ <wui-flex alignItems="center" justifyContent="space-between">
618
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
619
+ <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
620
+ </wui-flex>
621
+
622
+ <wui-flex alignItems="center" justifyContent="space-between">
623
+ <wui-text variant="md-regular" color="secondary">Network Fee</wui-text>
624
+
625
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
626
+ <wui-shimmer
627
+ width="75px"
628
+ height="16px"
629
+ borderRadius="4xs"
630
+ variant="light"
631
+ ></wui-shimmer>
632
+
633
+ <wui-flex alignItems="center" gap="01">
634
+ <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer>
635
+ <wui-shimmer
636
+ width="49px"
637
+ height="14px"
638
+ borderRadius="4xs"
639
+ variant="light"
640
+ ></wui-shimmer>
641
+ </wui-flex>
642
+ </wui-flex>
643
+ </wui-flex>
644
+
645
+ <wui-flex alignItems="center" justifyContent="space-between">
646
+ <wui-text variant="md-regular" color="secondary">Service Fee</wui-text>
647
+ <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
648
+ </wui-flex>
649
+ </wui-flex>
650
+ `}};re.styles=[gt];re=ft([C("w3m-pay-fees-skeleton")],re);const wt=U`
651
+ :host {
652
+ display: block;
653
+ }
654
+
655
+ wui-image {
656
+ border-radius: ${({borderRadius:t})=>t.round};
657
+ }
658
+ `;var Ne=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};let J=class extends _{constructor(){super(),this.unsubscribe=[],this.quote=l.state.quote,this.unsubscribe.push(l.subscribeKey("quote",e=>this.quote=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var n,s,i;const e=A.formatNumber(((n=this.quote)==null?void 0:n.origin.amount)||"0",{decimals:((s=this.quote)==null?void 0:s.origin.currency.metadata.decimals)??0,round:6}).toString();return u`
659
+ <wui-flex flexDirection="column" gap="4">
660
+ <wui-flex alignItems="center" justifyContent="space-between">
661
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
662
+ <wui-text variant="md-regular" color="primary">
663
+ ${e} ${((i=this.quote)==null?void 0:i.origin.currency.metadata.symbol)||"Unknown"}
664
+ </wui-text>
665
+ </wui-flex>
666
+
667
+ ${this.quote&&this.quote.fees.length>0?this.quote.fees.map(a=>this.renderFee(a)):null}
668
+ </wui-flex>
669
+ `}renderFee(e){const n=e.id==="network",s=A.formatNumber(e.amount||"0",{decimals:e.currency.metadata.decimals??0,round:6}).toString();if(n){const a=m.getAllRequestedCaipNetworks().find(o=>N.isLowerCaseMatch(o.caipNetworkId,e.currency.network));return u`
670
+ <wui-flex alignItems="center" justifyContent="space-between">
671
+ <wui-text variant="md-regular" color="secondary">${e.label}</wui-text>
672
+
673
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
674
+ <wui-text variant="md-regular" color="primary">
675
+ ${s} ${e.currency.metadata.symbol||"Unknown"}
676
+ </wui-text>
677
+
678
+ <wui-flex alignItems="center" gap="01">
679
+ <wui-image
680
+ src=${f(P.getNetworkImage(a))}
681
+ size="xs"
682
+ ></wui-image>
683
+ <wui-text variant="sm-regular" color="secondary">
684
+ ${(a==null?void 0:a.name)||"Unknown"}
685
+ </wui-text>
686
+ </wui-flex>
687
+ </wui-flex>
688
+ </wui-flex>
689
+ `}return u`
690
+ <wui-flex alignItems="center" justifyContent="space-between">
691
+ <wui-text variant="md-regular" color="secondary">${e.label}</wui-text>
692
+ <wui-text variant="md-regular" color="primary">
693
+ ${s} ${e.currency.metadata.symbol||"Unknown"}
694
+ </wui-text>
695
+ </wui-flex>
696
+ `}};J.styles=[wt];Ne([h()],J.prototype,"quote",void 0);J=Ne([C("w3m-pay-fees")],J);const yt=U`
697
+ :host {
698
+ display: block;
699
+ width: 100%;
700
+ }
701
+
702
+ .disabled-container {
703
+ padding: ${({spacing:t})=>t[2]};
704
+ min-height: 168px;
705
+ }
706
+
707
+ wui-icon {
708
+ width: ${({spacing:t})=>t[8]};
709
+ height: ${({spacing:t})=>t[8]};
710
+ }
711
+
712
+ wui-flex > wui-text {
713
+ max-width: 273px;
714
+ }
715
+ `;var Te=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};let Z=class extends _{constructor(){super(),this.unsubscribe=[],this.selectedExchange=l.state.selectedExchange,this.unsubscribe.push(l.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=!!this.selectedExchange;return u`
716
+ <wui-flex
717
+ flexDirection="column"
718
+ alignItems="center"
719
+ justifyContent="center"
720
+ gap="3"
721
+ class="disabled-container"
722
+ >
723
+ <wui-icon name="coins" color="default" size="inherit"></wui-icon>
724
+
725
+ <wui-text variant="md-regular" color="primary" align="center">
726
+ You don't have enough funds to complete this transaction
727
+ </wui-text>
728
+
729
+ ${e?null:u`<wui-button
730
+ size="md"
731
+ variant="neutral-secondary"
732
+ @click=${this.dispatchConnectOtherWalletEvent.bind(this)}
733
+ >Connect other wallet</wui-button
734
+ >`}
735
+ </wui-flex>
736
+ `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}};Z.styles=[yt];Te([x({type:Array})],Z.prototype,"selectedExchange",void 0);Z=Te([C("w3m-pay-options-empty")],Z);const bt=U`
737
+ :host {
738
+ display: block;
739
+ width: 100%;
740
+ }
741
+
742
+ .pay-options-container {
743
+ max-height: 196px;
744
+ overflow-y: auto;
745
+ overflow-x: hidden;
746
+ scrollbar-width: none;
747
+ }
748
+
749
+ .pay-options-container::-webkit-scrollbar {
750
+ display: none;
751
+ }
752
+
753
+ .pay-option-container {
754
+ border-radius: ${({borderRadius:t})=>t[4]};
755
+ padding: ${({spacing:t})=>t[3]};
756
+ min-height: 60px;
757
+ }
758
+
759
+ .token-images-container {
760
+ position: relative;
761
+ justify-content: center;
762
+ align-items: center;
763
+ }
764
+
765
+ .chain-image {
766
+ position: absolute;
767
+ bottom: -3px;
768
+ right: -5px;
769
+ border: 2px solid ${({tokens:t})=>t.theme.foregroundSecondary};
770
+ }
771
+ `;var xt=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};let oe=class extends _{render(){return u`
772
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
773
+ ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()}
774
+ </wui-flex>
775
+ `}renderOptionEntry(){return u`
776
+ <wui-flex
777
+ alignItems="center"
778
+ justifyContent="space-between"
779
+ gap="2"
780
+ class="pay-option-container"
781
+ >
782
+ <wui-flex alignItems="center" gap="2">
783
+ <wui-flex class="token-images-container">
784
+ <wui-shimmer
785
+ width="32px"
786
+ height="32px"
787
+ rounded
788
+ variant="light"
789
+ class="token-image"
790
+ ></wui-shimmer>
791
+ <wui-shimmer
792
+ width="16px"
793
+ height="16px"
794
+ rounded
795
+ variant="light"
796
+ class="chain-image"
797
+ ></wui-shimmer>
798
+ </wui-flex>
799
+
800
+ <wui-flex flexDirection="column" gap="1">
801
+ <wui-shimmer
802
+ width="74px"
803
+ height="16px"
804
+ borderRadius="4xs"
805
+ variant="light"
806
+ ></wui-shimmer>
807
+ <wui-shimmer
808
+ width="46px"
809
+ height="14px"
810
+ borderRadius="4xs"
811
+ variant="light"
812
+ ></wui-shimmer>
813
+ </wui-flex>
814
+ </wui-flex>
815
+ </wui-flex>
816
+ `}};oe.styles=[bt];oe=xt([C("w3m-pay-options-skeleton")],oe);const At=U`
817
+ :host {
818
+ display: block;
819
+ width: 100%;
820
+ }
821
+
822
+ .pay-options-container {
823
+ max-height: 196px;
824
+ overflow-y: auto;
825
+ overflow-x: hidden;
826
+ scrollbar-width: none;
827
+ mask-image: var(--options-mask-image);
828
+ -webkit-mask-image: var(--options-mask-image);
829
+ }
830
+
831
+ .pay-options-container::-webkit-scrollbar {
832
+ display: none;
833
+ }
834
+
835
+ .pay-option-container {
836
+ cursor: pointer;
837
+ border-radius: ${({borderRadius:t})=>t[4]};
838
+ padding: ${({spacing:t})=>t[3]};
839
+ transition: background-color ${({durations:t})=>t.lg}
840
+ ${({easings:t})=>t["ease-out-power-1"]};
841
+ will-change: background-color;
842
+ }
843
+
844
+ .token-images-container {
845
+ position: relative;
846
+ justify-content: center;
847
+ align-items: center;
848
+ }
849
+
850
+ .token-image {
851
+ border-radius: ${({borderRadius:t})=>t.round};
852
+ width: 32px;
853
+ height: 32px;
854
+ }
855
+
856
+ .chain-image {
857
+ position: absolute;
858
+ width: 16px;
859
+ height: 16px;
860
+ bottom: -3px;
861
+ right: -5px;
862
+ border-radius: ${({borderRadius:t})=>t.round};
863
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
864
+ }
865
+
866
+ @media (hover: hover) and (pointer: fine) {
867
+ .pay-option-container:hover {
868
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
869
+ }
870
+ }
871
+ `;var ee=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};const Et=300;let j=class extends _{constructor(){super(),this.unsubscribe=[],this.options=[],this.selectedPaymentAsset=null}disconnectedCallback(){var n,s;this.unsubscribe.forEach(i=>i()),(n=this.resizeObserver)==null||n.disconnect();const e=(s=this.shadowRoot)==null?void 0:s.querySelector(".pay-options-container");e==null||e.removeEventListener("scroll",this.handleOptionsListScroll.bind(this))}firstUpdated(){var n,s;const e=(n=this.shadowRoot)==null?void 0:n.querySelector(".pay-options-container");e&&(requestAnimationFrame(this.handleOptionsListScroll.bind(this)),e==null||e.addEventListener("scroll",this.handleOptionsListScroll.bind(this)),this.resizeObserver=new ResizeObserver(()=>{this.handleOptionsListScroll()}),(s=this.resizeObserver)==null||s.observe(e),this.handleOptionsListScroll())}render(){return u`
872
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
873
+ ${this.options.map(e=>this.payOptionTemplate(e))}
874
+ </wui-flex>
875
+ `}payOptionTemplate(e){var pe,he;const{network:n,metadata:s,asset:i,amount:a="0"}=e,c=m.getAllRequestedCaipNetworks().find(H=>H.caipNetworkId===n),g=`${n}:${i}`,L=`${(pe=this.selectedPaymentAsset)==null?void 0:pe.network}:${(he=this.selectedPaymentAsset)==null?void 0:he.asset}`,Q=g===L,V=A.bigNumber(a,{safe:!0}),Y=V.gt(0);return u`
876
+ <wui-flex
877
+ alignItems="center"
878
+ justifyContent="space-between"
879
+ gap="2"
880
+ @click=${()=>{var H;return(H=this.onSelect)==null?void 0:H.call(this,e)}}
881
+ class="pay-option-container"
882
+ >
883
+ <wui-flex alignItems="center" gap="2">
884
+ <wui-flex class="token-images-container">
885
+ <wui-image
886
+ src=${f(s.logoURI)}
887
+ class="token-image"
888
+ size="3xl"
889
+ ></wui-image>
890
+ <wui-image
891
+ src=${f(P.getNetworkImage(c))}
892
+ class="chain-image"
893
+ size="md"
894
+ ></wui-image>
895
+ </wui-flex>
896
+
897
+ <wui-flex flexDirection="column" gap="1">
898
+ <wui-text variant="lg-regular" color="primary">${s.symbol}</wui-text>
899
+ ${Y?u`<wui-text variant="sm-regular" color="secondary">
900
+ ${V.round(6).toString()} ${s.symbol}
901
+ </wui-text>`:null}
902
+ </wui-flex>
903
+ </wui-flex>
904
+
905
+ ${Q?u`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null}
906
+ </wui-flex>
907
+ `}handleOptionsListScroll(){var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector(".pay-options-container");if(!e)return;e.scrollHeight>Et?(e.style.setProperty("--options-mask-image",`linear-gradient(
908
+ to bottom,
909
+ rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px,
910
+ rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px,
911
+ black 50px,
912
+ black calc(100% - 50px),
913
+ rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px),
914
+ rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100%
915
+ )`),e.style.setProperty("--options-scroll--top-opacity",ge.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--options-scroll--bottom-opacity",ge.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"))}};j.styles=[At];ee([x({type:Array})],j.prototype,"options",void 0);ee([x()],j.prototype,"selectedPaymentAsset",void 0);ee([x()],j.prototype,"onSelect",void 0);j=ee([C("w3m-pay-options")],j);const It=U`
916
+ .payment-methods-container {
917
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
918
+ border-top-right-radius: ${({borderRadius:t})=>t[5]};
919
+ border-top-left-radius: ${({borderRadius:t})=>t[5]};
920
+ }
921
+
922
+ .pay-options-container {
923
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
924
+ border-radius: ${({borderRadius:t})=>t[5]};
925
+ padding: ${({spacing:t})=>t[1]};
926
+ }
927
+
928
+ w3m-tooltip-trigger {
929
+ display: flex;
930
+ align-items: center;
931
+ justify-content: center;
932
+ max-width: fit-content;
933
+ }
934
+
935
+ wui-image {
936
+ border-radius: ${({borderRadius:t})=>t.round};
937
+ }
938
+
939
+ w3m-pay-options.disabled {
940
+ opacity: 0.5;
941
+ pointer-events: none;
942
+ }
943
+ `;var b=globalThis&&globalThis.__decorate||function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a};const K={eip155:"ethereum",solana:"solana",bip122:"bitcoin",ton:"ton"},Nt={eip155:{icon:K.eip155,label:"EVM"},solana:{icon:K.solana,label:"Solana"},bip122:{icon:K.bip122,label:"Bitcoin"},ton:{icon:K.ton,label:"Ton"}};let w=class extends _{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=l.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=l.state.amount,this.recipient=l.state.recipient,this.activeConnectorIds=T.state.activeConnectorIds,this.selectedPaymentAsset=l.state.selectedPaymentAsset,this.selectedExchange=l.state.selectedExchange,this.isFetchingQuote=l.state.isFetchingQuote,this.quoteError=l.state.quoteError,this.quote=l.state.quote,this.isFetchingTokenBalances=l.state.isFetchingTokenBalances,this.tokenBalances=l.state.tokenBalances,this.isPaymentInProgress=l.state.isPaymentInProgress,this.exchangeUrlForQuote=l.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(l.subscribeKey("paymentAsset",e=>this.paymentAsset=e)),this.unsubscribe.push(l.subscribeKey("tokenBalances",e=>this.onTokenBalancesChanged(e))),this.unsubscribe.push(l.subscribeKey("isFetchingTokenBalances",e=>this.isFetchingTokenBalances=e)),this.unsubscribe.push(T.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(l.subscribeKey("selectedPaymentAsset",e=>this.selectedPaymentAsset=e)),this.unsubscribe.push(l.subscribeKey("isFetchingQuote",e=>this.isFetchingQuote=e)),this.unsubscribe.push(l.subscribeKey("quoteError",e=>this.quoteError=e)),this.unsubscribe.push(l.subscribeKey("quote",e=>this.quote=e)),this.unsubscribe.push(l.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(l.subscribeKey("recipient",e=>this.recipient=e)),this.unsubscribe.push(l.subscribeKey("isPaymentInProgress",e=>this.isPaymentInProgress=e)),this.unsubscribe.push(l.subscribeKey("selectedExchange",e=>this.selectedExchange=e)),this.unsubscribe.push(l.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 u`
944
+ <wui-flex flexDirection="column">
945
+ ${this.profileTemplate()}
946
+
947
+ <wui-flex
948
+ flexDirection="column"
949
+ gap="4"
950
+ class="payment-methods-container"
951
+ .padding=${["4","4","5","4"]}
952
+ >
953
+ ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()}
954
+
955
+ <wui-flex
956
+ alignItems="center"
957
+ justifyContent="space-between"
958
+ .padding=${["1","0","1","0"]}
959
+ >
960
+ <wui-separator></wui-separator>
961
+ </wui-flex>
962
+
963
+ ${this.paymentActionsTemplate()}
964
+ </wui-flex>
965
+ </wui-flex>
966
+ `}profileTemplate(){var o,c;if(this.selectedExchange){const g=A.formatNumber((o=this.quote)==null?void 0:o.origin.amount,{decimals:((c=this.quote)==null?void 0:c.origin.currency.metadata.decimals)??0}).toString();return u`
967
+ <wui-flex
968
+ .padding=${["4","3","4","3"]}
969
+ alignItems="center"
970
+ justifyContent="space-between"
971
+ gap="2"
972
+ >
973
+ <wui-text variant="lg-regular" color="secondary">Paying with</wui-text>
974
+
975
+ ${this.quote?u`<wui-text variant="lg-regular" color="primary">
976
+ ${A.bigNumber(g,{safe:!0}).round(6).toString()}
977
+ ${this.quote.origin.currency.metadata.symbol}
978
+ </wui-text>`:u`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`}
979
+ </wui-flex>
980
+ `}const e=O.getPlainAddress(this.caipAddress)??"",{name:n,image:s}=this.getWalletProperties({namespace:this.namespace}),{icon:i,label:a}=Nt[this.namespace]??{};return u`
981
+ <wui-flex
982
+ .padding=${["4","3","4","3"]}
983
+ alignItems="center"
984
+ justifyContent="space-between"
985
+ gap="2"
986
+ >
987
+ <wui-wallet-switch
988
+ profileName=${f(this.profileName)}
989
+ address=${f(e)}
990
+ imageSrc=${f(s)}
991
+ alt=${f(n)}
992
+ @click=${this.onConnectOtherWallet.bind(this)}
993
+ data-testid="wui-wallet-switch"
994
+ ></wui-wallet-switch>
995
+
996
+ <wui-wallet-switch
997
+ profileName=${f(a)}
998
+ address=${f(e)}
999
+ icon=${f(i)}
1000
+ iconSize="xs"
1001
+ .enableGreenCircle=${!1}
1002
+ alt=${f(a)}
1003
+ @click=${this.onConnectOtherWallet.bind(this)}
1004
+ data-testid="wui-wallet-switch"
1005
+ ></wui-wallet-switch>
1006
+ </wui-flex>
1007
+ `}initializeNamespace(){var n,s;const e=m.state.activeChain;this.namespace=e,this.caipAddress=(n=m.getAccountData(e))==null?void 0:n.caipAddress,this.profileName=((s=m.getAccountData(e))==null?void 0:s.profileName)??null,this.unsubscribe.push(m.subscribeChainProp("accountState",i=>this.onAccountStateChanged(i),e))}async fetchTokens(){if(this.namespace){let e;if(this.caipAddress){const{chainId:n,chainNamespace:s}=y.parseCaipAddress(this.caipAddress),i=`${s}:${n}`;e=m.getAllRequestedCaipNetworks().find(o=>o.caipNetworkId===i)}await l.fetchTokens({caipAddress:this.caipAddress,caipNetwork:e,namespace:this.namespace})}}fetchQuote(){if(this.amount&&this.recipient&&this.selectedPaymentAsset&&this.paymentAsset){const{address:e}=this.caipAddress?y.parseCaipAddress(this.caipAddress):{};l.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};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=T.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const i=P.getConnectorImage(s);return{name:s.name,image:i}}paymentOptionsViewTemplate(){return u`
1008
+ <wui-flex flexDirection="column" gap="2">
1009
+ <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text>
1010
+ <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex>
1011
+ </wui-flex>
1012
+ `}paymentOptionsTemplate(){const e=this.getPaymentAssetFromTokenBalances();if(this.isFetchingTokenBalances)return u`<w3m-pay-options-skeleton></w3m-pay-options-skeleton>`;if(e.length===0)return u`<w3m-pay-options-empty
1013
+ @connectOtherWallet=${this.onConnectOtherWallet.bind(this)}
1014
+ ></w3m-pay-options-empty>`;const n={disabled:this.isFetchingQuote};return u`<w3m-pay-options
1015
+ class=${Ie(n)}
1016
+ .options=${e}
1017
+ .selectedPaymentAsset=${f(this.selectedPaymentAsset)}
1018
+ .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)}
1019
+ ></w3m-pay-options>`}amountWithFeeTemplate(){return this.isFetchingQuote||!this.selectedPaymentAsset||this.quoteError?u`<w3m-pay-fees-skeleton></w3m-pay-fees-skeleton>`:u`<w3m-pay-fees></w3m-pay-fees>`}paymentActionsTemplate(){var i,a,o;const e=this.isFetchingQuote||this.isFetchingTokenBalances,n=this.isFetchingQuote||this.isFetchingTokenBalances||!this.selectedPaymentAsset||!!this.quoteError,s=A.formatNumber(((i=this.quote)==null?void 0:i.origin.amount)??0,{decimals:((a=this.quote)==null?void 0:a.origin.currency.metadata.decimals)??0}).toString();return this.selectedExchange?e||n?u`
1020
+ <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer>
1021
+ `:u`<wui-button
1022
+ size="lg"
1023
+ fullWidth
1024
+ variant="accent-secondary"
1025
+ @click=${this.onPayWithExchange.bind(this)}
1026
+ >
1027
+ ${`Continue in ${this.selectedExchange.name}`}
1028
+
1029
+ <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon>
1030
+ </wui-button>`:u`
1031
+ <wui-flex alignItems="center" justifyContent="space-between">
1032
+ <wui-flex flexDirection="column" gap="1">
1033
+ <wui-text variant="md-regular" color="secondary">Order Total</wui-text>
1034
+
1035
+ ${e||n?u`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:u`<wui-flex alignItems="center" gap="01">
1036
+ <wui-text variant="h4-regular" color="primary">${X(s)}</wui-text>
1037
+
1038
+ <wui-text variant="lg-regular" color="secondary">
1039
+ ${((o=this.quote)==null?void 0:o.origin.currency.metadata.symbol)||"Unknown"}
1040
+ </wui-text>
1041
+ </wui-flex>`}
1042
+ </wui-flex>
1043
+
1044
+ ${this.actionButtonTemplate({isLoading:e,isDisabled:n})}
1045
+ </wui-flex>
1046
+ `}actionButtonTemplate(e){const n=te(this.quote),{isLoading:s,isDisabled:i}=e;let a="Pay";return n.length>1&&this.completedTransactionsCount===0&&(a="Approve"),u`
1047
+ <wui-button
1048
+ size="lg"
1049
+ variant="accent-primary"
1050
+ ?loading=${s||this.isPaymentInProgress}
1051
+ ?disabled=${i||this.isPaymentInProgress}
1052
+ @click=${()=>{n.length>0?this.onSendTransactions():this.onTransfer()}}
1053
+ >
1054
+ ${a}
1055
+ ${s?null:u`<wui-icon
1056
+ name="arrowRight"
1057
+ color="inherit"
1058
+ size="sm"
1059
+ slot="iconRight"
1060
+ ></wui-icon>`}
1061
+ </wui-button>
1062
+ `}getPaymentAssetFromTokenBalances(){return this.namespace?(this.tokenBalances[this.namespace]??[]).map(i=>{try{return et(i)}catch{return null}}).filter(i=>!!i).filter(i=>{const{chainId:a}=y.parseCaipNetworkId(i.network),{chainId:o}=y.parseCaipNetworkId(this.paymentAsset.network);return N.isLowerCaseMatch(i.asset,this.paymentAsset.asset)?!0:this.selectedExchange?!N.isLowerCaseMatch(a.toString(),o.toString()):!0}):[]}onTokenBalancesChanged(e){this.tokenBalances=e;const[n]=this.getPaymentAssetFromTokenBalances();n&&l.setSelectedPaymentAsset(n)}async onConnectOtherWallet(){await T.connect(),await G.open({view:"PayQuote"})}onAccountStateChanged(e){const{address:n}=this.caipAddress?y.parseCaipAddress(this.caipAddress):{};if(this.caipAddress=e==null?void 0:e.caipAddress,this.profileName=(e==null?void 0:e.profileName)??null,n){const{address:s}=this.caipAddress?y.parseCaipAddress(this.caipAddress):{};s?N.isLowerCaseMatch(s,n)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):G.close()}}onSelectedPaymentAssetChanged(e){this.isFetchingQuote||l.setSelectedPaymentAsset(e)}async onTransfer(){var n,s,i;const e=ie(this.quote);if(e){if(!N.isLowerCaseMatch((n=this.selectedPaymentAsset)==null?void 0:n.asset,e.deposit.currency))throw new Error("Quote asset is not the same as the selected payment asset");const o=((s=this.selectedPaymentAsset)==null?void 0:s.amount)??"0",c=A.formatNumber(e.deposit.amount,{decimals:((i=this.selectedPaymentAsset)==null?void 0:i.metadata.decimals)??0}).toString();if(!A.bigNumber(o).gte(c)){R.showError("Insufficient funds");return}if(this.quote&&this.selectedPaymentAsset&&this.caipAddress&&this.namespace){const{address:L}=y.parseCaipAddress(this.caipAddress);await l.onTransfer({chainNamespace:this.namespace,fromAddress:L,toAddress:e.deposit.receiver,amount:c,paymentAsset:this.selectedPaymentAsset}),l.setRequestId(e.requestId),z.push("PayLoading")}}}async onSendTransactions(){var o,c,g;const e=((o=this.selectedPaymentAsset)==null?void 0:o.amount)??"0",n=A.formatNumber(((c=this.quote)==null?void 0:c.origin.amount)??0,{decimals:((g=this.selectedPaymentAsset)==null?void 0:g.metadata.decimals)??0}).toString();if(!A.bigNumber(e).gte(n)){R.showError("Insufficient funds");return}const i=te(this.quote),[a]=te(this.quote,this.completedTransactionsCount);a&&this.namespace&&(await l.onSendTransaction({namespace:this.namespace,transactionStep:a}),this.completedTransactionsCount+=1,this.completedTransactionsCount===i.length&&(l.setRequestId(a.requestId),z.push("PayLoading")))}onPayWithExchange(){if(this.exchangeUrlForQuote){const e=O.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!e)throw new Error("Could not create popup window");e.location.href=this.exchangeUrlForQuote;const n=ie(this.quote);n&&l.setRequestId(n.requestId),l.initiatePayment(),z.push("PayLoading")}}resetAssetsState(){l.setSelectedPaymentAsset(null)}resetQuoteState(){l.resetQuoteState()}};w.styles=It;b([h()],w.prototype,"profileName",void 0);b([h()],w.prototype,"paymentAsset",void 0);b([h()],w.prototype,"namespace",void 0);b([h()],w.prototype,"caipAddress",void 0);b([h()],w.prototype,"amount",void 0);b([h()],w.prototype,"recipient",void 0);b([h()],w.prototype,"activeConnectorIds",void 0);b([h()],w.prototype,"selectedPaymentAsset",void 0);b([h()],w.prototype,"selectedExchange",void 0);b([h()],w.prototype,"isFetchingQuote",void 0);b([h()],w.prototype,"quoteError",void 0);b([h()],w.prototype,"quote",void 0);b([h()],w.prototype,"isFetchingTokenBalances",void 0);b([h()],w.prototype,"tokenBalances",void 0);b([h()],w.prototype,"isPaymentInProgress",void 0);b([h()],w.prototype,"exchangeUrlForQuote",void 0);b([h()],w.prototype,"completedTransactionsCount",void 0);w=b([C("w3m-pay-quote-view")],w);export{p as A,l as P,k as W,d as a,E as b,w as c};