PageSourceSearch

https://bloomprotocol.ai/_next/static/chunks/8820.2641fd88dbdcb5ab.js

js bloomprotocol.ai collected 2026-10-05 12:24:16 UTC 77,436 bytes, 1,062 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.