PageSourceSearch

https://www.xstable.ai/_next/static/chunks/9957.b2fe9efc8ad4fb7f.js

js xstable.ai collected 2026-10-05 14:39:44 UTC 79,008 bytes, 1,064 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9957],{3189:(e,t,i)=>{var a=i(56059),n=i(81767),s=i(55284);i(79909);var r=i(46756),o=i(63412),c=i(91392);let l=(0,c.AH)`
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:e})=>e[1]};
12  }
13
14  /* -- Colors --------------------------------------------------- */
15  button[data-type='accent'] wui-icon {
16    color: ${({tokens:e})=>e.core.iconAccentPrimary};
17  }
18
19  button[data-type='neutral'][data-variant='primary'] wui-icon {
20    color: ${({tokens:e})=>e.theme.iconInverse};
21  }
22
23  button[data-type='neutral'][data-variant='secondary'] wui-icon {
24    color: ${({tokens:e})=>e.theme.iconDefault};
25  }
26
27  button[data-type='success'] wui-icon {
28    color: ${({tokens:e})=>e.core.iconSuccess};
29  }
30
31  button[data-type='error'] wui-icon {
32    color: ${({tokens:e})=>e.core.iconError};
33  }
34
35  /* -- Sizes --------------------------------------------------- */
36  button[data-size='xs'] {
37    width: 16px;
38    height: 16px;
39
40    border-radius: ${({borderRadius:e})=>e[1]};
41  }
42
43  button[data-size='sm'] {
44    width: 20px;
45    height: 20px;
46    border-radius: ${({borderRadius:e})=>e[1]};
47  }
48
49  button[data-size='md'] {
50    width: 24px;
51    height: 24px;
52    border-radius: ${({borderRadius:e})=>e[2]};
53  }
54
55  button[data-size='lg'] {
56    width: 28px;
57    height: 28px;
58    border-radius: ${({borderRadius:e})=>e[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:e})=>e.core.foregroundAccent010};
85    }
86
87    button[data-variant='primary'][data-type='neutral']:hover:enabled {
88      background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
89    }
90
91    button[data-variant='secondary'][data-type='neutral']:hover:enabled {
92      background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
93    }
94
95    button[data-type='success']:hover:enabled {
96      background-color: ${({tokens:e})=>e.core.backgroundSuccess};
97    }
98
99    button[data-type='error']:hover:enabled {
100      background-color: ${({tokens:e})=>e.core.backgroundError};
101    }
102  }
103
104  /* -- Focus --------------------------------------------------- */
105  button:focus-visible {
106    box-shadow: 0 0 0 4px ${({tokens:e})=>e.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 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
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=${(0,s.J)(this.iconSize)}></wui-icon>
130    </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)},3477:(e,t,i)=>{i(39909)},9957:(e,t,i)=>{i.r(t),i.d(t,{PayController:()=>es,W3mPayLoadingView:()=>eA,W3mPayQuoteView:()=>eW,W3mPayView:()=>ec,arbitrumUSDC:()=>eX,arbitrumUSDT:()=>e5,baseETH:()=>eH,baseSepoliaETH:()=>eK,baseUSDC:()=>eV,ethereumUSDC:()=>eJ,ethereumUSDT:()=>e3,getExchanges:()=>ej,getIsPaymentInProgress:()=>eY,getPayError:()=>eG,getPayResult:()=>ez,openPay:()=>eM,optimismUSDC:()=>eZ,optimismUSDT:()=>e2,pay:()=>eB,polygonUSDC:()=>e0,polygonUSDT:()=>
130e4,solanaSOL:()=>e6,solanaUSDC:()=>e1,solanaUSDT:()=>e8});var a=i(56059),n=i(81767),s=i(55284),r=i(32590),o=i(82376),c=i(28877),l=i(26274),u=i(53984),d=i(36071),p=i(82875),m=i(2076);i(56060),i(6647),i(48029),i(3189),i(42808),i(3477),i(42978),i(73732),i(16017),i(44141),i(66803),i(12981);var h=i(91004),y=i(36442),g=i(57873),w=i(52335),f=i(12050),b=i(42242),x=i(33432),E=i(71016),A=i(33384);let v={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"},I={[v.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[v.INVALID_RECIPIENT]:"Invalid recipient address",[v.INVALID_ASSET]:"Invalid asset specified",[v.INVALID_AMOUNT]:"Invalid payment amount",[v.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[v.UNKNOWN_ERROR]:"Unknown payment error occurred",[v.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[v.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[v.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[v.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[v.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[v.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[v.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[v.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[v.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[v.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"};class k extends Error{get message(){return I[this.code]}constructor(e,t){super(I[e]),this.name="AppKitPayError",this.code=e,this.details=t,Error.captureStackTrace&&Error.captureStackTrace(this,k)}}var N=i(77909),S=i(18627),P=i(89188);let T="reown_test";var C=i(53344),$=i(79482);async function _(e,t,i){if(t!==g.o.CHAIN.EVM)throw new k(v.INVALID_CHAIN_NAMESPACE);if(!i.fromAddress)throw new k(v.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");let a="string"==typeof i.amount?parseFloat(i.amount):i.amount;if(isNaN(a))throw new k(v.INVALID_PAYMENT_CONFIG);let n=e.metadata?.decimals??18,s=d.x.parseUnits(a.toString(),n);if("bigint"!=typeof s)throw new k(v.GENERIC_PAYMENT_ERROR);return await d.x.sendTransaction({chainNamespace:t,to:i.recipient,address:i.fromAddress,value:s,data:"0x"})??void 0}async function q(e,t){if(!t.fromAddress)throw new k(v.INVALID_PAYMENT_CONFIG,"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 k(v.GENERIC_PAYMENT_ERROR);return await d.x.writeContract({fromAddress:t.fromAddress,tokenAddress:i,args:[a,s],method:"transfer",abi:C.v.getERC20Abi(i),chainNamespace:g.o.CHAIN.EVM})??void 0}async function O(e,t){if(e!==g.o.CHAIN.SOLANA)throw new k(v.INVALID_CHAIN_NAMESPACE);if(!t.fromAddress)throw new k(v.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");let i="string"==typeof t.amount?parseFloat(t.amount):t.amount;if(isNaN(i)||i<=0)throw new k(v.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!$.G.getProvider(e))throw new k(v.GENERIC_PAYMENT_ERROR,"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 k(v.GENERIC_PAYMENT_ERROR,"Transaction failed.");return a}catch(e){if(e instanceof k)throw e;throw new k(v.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${e}`)}}async function R({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:et,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:et,type:"deposit",deposit:{amount:n?.toString()??"0",currency:e.asset,receiver:a}}],timeInSeconds:6})}function U(e){if(!e)return null;let t=e.steps[0];return t&&t.type===ei?t:null}function D(e,t=0){if(!e)return[];let i=e.steps.filter(e=>e.type===ea),a=i.filter((e,i)=>i+1>t);return i.length>0&&i.length<3?a:[]}let L=new N.Z({baseUrl:x.w.getApiUrl(),clientId:null});
130class F extends Error{}function W(){let{projectId:e,sdkType:t,sdkVersion:i}=S.H.state;return{projectId:e,st:t||"appkit",sv:i||"html-wagmi-4.2.2"}}async function M(e,t){let i=function(){let e=S.H.getSnapshot().projectId;return`https://rpc.walletconnect.org/v1/json-rpc?projectId=${e}`}(),{sdkType:a,sdkVersion:n,projectId:s}=S.H.getSnapshot(),r={jsonrpc:"2.0",id:1,method:e,params:{...t||{},st:a,sv:n,projectId:s}},o=await fetch(i,{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}}),c=await o.json();if(c.error)throw new F(c.error.message);return c}async function B(e){return(await M("reown_getExchanges",e)).result}async function j(e){return(await M("reown_getExchangePayUrl",e)).result}async function z(e){return(await M("reown_getExchangeBuyStatus",e)).result}async function G(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,P.NH)(a):e.sourceToken.asset,o="native"===e.toToken.asset?(0,P.NH)(s):e.toToken.asset;return await L.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:W()})}async function Y(e){let t=A.y.isLowerCaseMatch(e.sourceToken.network,e.toToken.network),i=A.y.isLowerCaseMatch(e.sourceToken.asset,e.toToken.asset);return t&&i?R(e):G(e)}async function Q(e){return await L.get({path:"/appkit/v1/transfers/status",params:{requestId:e.requestId,...W()}})}async function H(e){return await L.get({path:`/appkit/v1/transfers/assets/exchanges/${e}`,params:W()})}let V=["eip155","solana"],K={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},J={56:"714",204:"714"};function Z(e,t){let{chainNamespace:i,chainId:a}=w.C.parseCaipNetworkId(e),n=K[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):"eip155"===i&&J[a]&&(r=J[a]);let o=`${i}:${a}`;return`${o}/${s}:${r}`}function X(e){let t=f.S.bigNumber(e,{safe:!0});return t.lt(.001)?"<0.001":t.round(4).toString()}let ee="unknown",et="direct-transfer",ei="deposit",ea="transaction",en=(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}),es={state:en,subscribe:e=>(0,h.B1)(en,()=>e(en)),subscribeKey:(e,t)=>(0,y.u$)(en,e,t),async handleOpenPay(e){this.resetState(),this.setPaymentConfig(e),this.initializeAnalytics();let{chainNamespace:t}=w.C.parseCaipNetworkId(es.state.paymentAsset.network);if(!x.w.isAddress(es.state.recipient,t))throw new k(v.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${t}"`);await this.prepareTokenLogo(),en.isConfigured=!0,b.E.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:en.exchanges,configuration:{network:en.paymentAsset.network,asset:en.paymentAsset.asset,recipient:en.recipient,amount:en.amount}}}),await u.W.open({view:"Pay"})},resetState(){en.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},en.recipient="0x0",en.amount=0,en.isConfigured=!1,en.error=null,en.isPaymentInProgress=!1,en.isLoading=!1,en.currentPayment=void 0,en.selectedExchange=void 0,en.exchangeUrlForQuote=void 0,en.requestId=void 0},resetQuoteState(){en.quote=void 0,en.quoteStatus="waiting",en.quoteError=null,en.isFetchingQuote=!1,en.requestId=void 0}
130,setPaymentConfig(e){if(!e.paymentAsset)throw new k(v.INVALID_PAYMENT_CONFIG);try{en.choice=e.choice??"pay",en.paymentAsset=e.paymentAsset,en.recipient=e.recipient,en.amount=e.amount,en.openInNewTab=e.openInNewTab??!0,en.redirectUrl=e.redirectUrl,en.payWithExchange=e.payWithExchange,en.error=null}catch(e){throw new k(v.INVALID_PAYMENT_CONFIG,e.message)}},setSelectedPaymentAsset(e){en.selectedPaymentAsset=e},setSelectedExchange(e){en.selectedExchange=e},setRequestId(e){en.requestId=e},setPaymentInProgress(e){en.isPaymentInProgress=e},getPaymentAsset:()=>en.paymentAsset,getExchanges:()=>en.exchanges,async fetchExchanges(){try{en.isLoading=!0,en.exchanges=(await B({page:0})).exchanges.slice(0,2)}catch(e){throw p.P.showError(I.UNABLE_TO_GET_EXCHANGES),new k(v.UNABLE_TO_GET_EXCHANGES)}finally{en.isLoading=!1}},async getAvailableExchanges(e){try{let t=e?.asset&&e?.network?Z(e.network,e.asset):void 0;return await B({page:e?.page??0,asset:t,amount:e?.amount?.toString()})}catch(e){throw new k(v.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(e,t,i=!1){try{let a=Number(t.amount),n=await j({exchangeId:e,asset:Z(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:en.paymentId||ee,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 k(v.ASSET_NOT_SUPPORTED);throw Error(e.message)}},async generateExchangeUrlForQuote({exchangeId:e,paymentAsset:t,amount:i,recipient:a}){let n=await j({exchangeId:e,asset:Z(t.network,t.asset),amount:i.toString(),recipient:a});en.exchangeSessionId=n.sessionId,en.exchangeUrlForQuote=n.url},async openPayUrl(e,t,i=!1){try{let a=await this.getPayUrl(e.exchangeId,t,i);if(!a)throw new k(v.UNABLE_TO_GET_PAY_URL);let n=e.openInNewTab??!0;return x.w.openHref(a.url,n?"_blank":"_self"),a}catch(e){throw e instanceof k?en.error=e.message:en.error=I.GENERIC_PAYMENT_ERROR,new k(v.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:e,fromAddress:t,toAddress:i,amount:a,paymentAsset:n}){if(en.currentPayment={type:"wallet",status:"IN_PROGRESS"},!en.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(!A.y.isLowerCaseMatch(r?.caipNetworkId,s.caipNetworkId)&&await o.W.switchActiveNetwork(s),e){case g.o.CHAIN.EVM:"native"===n.asset&&(en.currentPayment.result=await _(n,e,{recipient:i,amount:a,fromAddress:t})),n.asset.startsWith("0x")&&(en.currentPayment.result=await q(n,{recipient:i,amount:a,fromAddress:t})),en.currentPayment.status="SUCCESS";break;case g.o.CHAIN.SOLANA:en.currentPayment.result=await O(e,{recipient:i,amount:a,fromAddress:t,tokenMint:"native"===n.asset?void 0:n.asset}),en.currentPayment.status="SUCCESS";break;default:throw new k(v.INVALID_CHAIN_NAMESPACE)}}catch(e){throw e instanceof k?en.error=e.message:en.error=I.GENERIC_PAYMENT_ERROR,en.currentPayment.status="FAILED",p.P.showError(en.error),e}finally{en.isPaymentInProgress=!1}},async onSendTransaction(e){try{let{namespace:t,transactionStep:i}=e;es.initiatePayment();let a=o.W.getAllRequestedCaipNetworks().find(e=>e.caipNetworkId===en.paymentAsset?.network);if(!a)throw Error("Target network not found");let n=o.W.state.activeCaipNetwork;if(A.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 k?en.error=e.message:en.error=I.GENER
130IC_PAYMENT_ERROR,p.P.showError(en.error),e}finally{en.isPaymentInProgress=!1}},getExchangeById:e=>en.exchanges.find(t=>t.id===e),validatePayConfig(e){let{paymentAsset:t,recipient:i,amount:a}=e;if(!t)throw new k(v.INVALID_PAYMENT_CONFIG);if(!i)throw new k(v.INVALID_RECIPIENT);if(!t.asset)throw new k(v.INVALID_ASSET);if(null==a||a<=0)throw new k(v.INVALID_AMOUNT)},async handlePayWithExchange(e){try{en.currentPayment={type:"exchange",exchangeId:e};let{network:t,asset:i}=en.paymentAsset,a={network:t,asset:i,amount:en.amount,recipient:en.recipient},n=await this.getPayUrl(e,a);if(!n)throw new k(v.UNABLE_TO_INITIATE_PAYMENT);return en.currentPayment.sessionId=n.sessionId,en.currentPayment.status="IN_PROGRESS",en.currentPayment.exchangeId=e,this.initiatePayment(),{url:n.url,openInNewTab:en.openInNewTab}}catch(e){return e instanceof k?en.error=e.message:en.error=I.GENERIC_PAYMENT_ERROR,en.isPaymentInProgress=!1,p.P.showError(en.error),null}},async getBuyStatus(e,t){try{let i=await z({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(en.error):void 0,source:"pay",paymentId:en.paymentId||ee,configuration:{network:en.paymentAsset.network,asset:en.paymentAsset.asset,recipient:en.recipient,amount:en.amount},currentPayment:{type:"exchange",exchangeId:en.currentPayment?.exchangeId,sessionId:en.currentPayment?.sessionId,result:i.txHash}}}),i}catch(e){throw new k(v.UNABLE_TO_GET_BUY_STATUS)}},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 E.Z.getMyTokensWithBalance({address:a,caipNetwork:n})},async fetchTokensFromExchange(){if(!en.selectedExchange)return[];let e=Object.values((await H(en.selectedExchange.id)).assets).flat();return await Promise.all(e.map(async e=>{let t={chainId:e.network,address:`${e.network}:${e.asset}`,symbol:e.metadata.symbol,name:e.metadata.name,iconUrl:e.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:e.metadata.decimals.toString()}},{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{en.isFetchingTokenBalances=!0;let a=en.selectedExchange?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:e,caipNetwork:t,namespace:i}),n=await a;en.tokenBalances={...en.tokenBalances,[i]:n}}catch(t){let e=t instanceof Error?t.message:"Unable to get token balances";p.P.showError(e)}finally{en.isFetchingTokenBalances=!1}},async fetchQuote({amount:e,address:t,sourceToken:i,toToken:a,recipient:n}){try{es.resetQuoteState(),en.isFetchingQuote=!0;let s=await Y({amount:e,address:en.selectedExchange?void 0:t,sourceToken:i,toToken:a,recipient:n});if(en.selectedExchange){let e=U(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 es.generateExchangeUrlForQuote({exchangeId:en.selectedExchange.id,paymentAsset:i,amount:a.toString(),recipient:t})}}en.quote=s}catch(t){let e=I.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 en.quoteError=e,p.P.showError(e),new k(v.UNABLE_TO_GET_QUOTE)}finally{en.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:e}){try{if(e===et){let e=en.selectedExchange,t=en.exchangeSessionId;if(e&&t){switch((await this.getBuyStatus(e.id,t)).status){case"IN_PROGRESS":case"UNKNOWN":default:en.quoteStatus="waiting";break;case"SUCCESS":en.quoteStatus="success",en.isPaymentInProgress=!1;break;case"FAILED":en.quoteStatus="failure",en.isPaymentInProgress=!1}return}en.quoteStatus="success";return}let{status:t}=await Q({requestId:e});en.quoteStatus=t}catch{throw en.quoteStatus="failure",new k(v.UNABLE_TO_GET_QUOTE_
130STATUS)}},initiatePayment(){en.isPaymentInProgress=!0,en.paymentId=crypto.randomUUID()},initializeAnalytics(){en.analyticsSet||(en.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",e=>{if(en.currentPayment?.status&&"UNKNOWN"!==en.currentPayment.status){let e={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[en.currentPayment.status];b.E.sendEvent({type:"track",event:e,properties:{message:"FAILED"===en.currentPayment.status?x.w.parseError(en.error):void 0,source:"pay",paymentId:en.paymentId||ee,configuration:{network:en.paymentAsset.network,asset:en.paymentAsset.asset,recipient:en.recipient,amount:en.amount},currentPayment:{type:en.currentPayment.type,exchangeId:en.currentPayment.exchangeId,sessionId:en.currentPayment.sessionId,result:en.currentPayment.result}}})}}))},async prepareTokenLogo(){if(!en.paymentAsset.metadata.logoURI)try{let{chainNamespace:e}=w.C.parseCaipNetworkId(en.paymentAsset.network),t=await c.$.getImageByToken(en.paymentAsset.asset,e);en.paymentAsset.metadata.logoURI=t}catch{}}},er=(0,m.AH)`
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:e})=>e.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:e})=>e.round};
172    border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
173  }
174
175  .payment-methods-container {
176    background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
177    border-top-right-radius: ${({borderRadius:e})=>e[8]};
178    border-top-left-radius: ${({borderRadius:e})=>e[8]};
179  }
180`;var eo=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=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.amount=es.state.amount,this.namespace=void 0,this.paymentAsset=es.state.paymentAsset,this.activeConnectorIds=r.a.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=es.state.exchanges,this.isLoading=es.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(es.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(r.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(es.subscribeKey("exchanges",e=>this.exchanges=e)),this.unsubscribe.push(es.subscribeKey("isLoading",e=>this.isLoading=e)),es.fetchExchanges(),es.setSelectedExchange(void 0)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return(0,a.qy)`
181      <wui-flex flexDirection="column">
182        ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()}
183      </wui-flex>
184    `}paymentMethodsTemplate(){return(0,a.qy)`
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(){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)`
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 ${e?.name||"Unknown"}</wui-text
207            >
208          </wui-flex>
209        </wui-flex>
210
211        <wui-flex class="left-image-container">
212          <wui-image
213            src=${(0,s.J)(this.paymentAsset.metadata.logoURI)}
214            class="token-image"
215          ></wui-image>
216          <wui-image
217            src=${(0,s.J)(c.$.getNetworkImage(e))}
218            class="chain-image"
219          ></wui-image>
220        </wui-flex>
221      </wui-flex>
222    `}payWithWalletTemplate(){return!function(e){let{chainNamespace:t}=w.C.parseCaipNetworkId(e);return V.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)`
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=${(0,s.J)(t)}
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(0,a.qy)`<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(0,a.qy)`<wui-flex justifyContent="center" alignItems="center">
264        <wui-loading-spinner size="md"></wui-loading-spinner>
265      </wui-flex>`;let e=this.exchanges.filter(e=>!function(e){let t=o.W.getAllRequestedCaipNetworks().find(t=>t.caipNetworkId===e.network);return!!t&&!!t.testnet}(this.paymentAsset)?e.id!==T:e.id===T);return 0===e.length?(0,a.qy)`<wui-flex justifyContent="center" alignItems="center">
266        <wui-text variant="md-medium" color="primary">No exchanges available</wui-text>
267      </wui-flex>`:e.map(e=>(0,a.qy)`
268        <wui-list-item
269          type="secondary"
270          boxColor="foregroundSecondary"
271          @click=${()=>this.onExchangePayment(e)}
272          data-testid="exchange-option-${e.id}"
273          ?chevron=${!0}
274          imageSrc=${(0,s.J)(e.imageUrl)}
275        >
276          <wui-text flexGrow="1" variant="lg-regular" color="primary">
277            Pay with ${e.name}
278          </wui-text>
279        </wui-list-item>
280      `)}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){es.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}}};ec.styles=er,eo([(0,n.wk)()],ec.prototype,"amount",void 0),eo([(0,n.wk)()],ec.prototype,"namespace",void 0),eo([(0,n.wk)()],ec.prototype,"paymentAsset",void 0),eo([(0,n.wk)()],ec.prototype,"activeConnectorIds",void 0),eo([(0,n.wk)()],ec.prototype,"caipAddress",void 0),eo([(0,n.wk)()],ec.prototype,"exchanges",void 0),eo([(0,n.wk)()],ec.prototype,"isLoading",void 0),ec=eo([(0,m.EM)("w3m-pay-view")],ec);var el=i(88787),eu=i(91392),ed=i(46756),ep=i(63412);let em=(0,eu.AH)`
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 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 ey={"accent-primary":eu.f.tokens.core.backgroundAccentPrimary},eg=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=ey[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    `;let t=Array.from({length:this.rings},(e,t)=>this.renderRing(t,this.rings));return(0,a.qy)`
338      <div class="pulse-container">
339        <div class="pulse-rings">${t}</div>
340        <div class="pulse-content">
341          <slot></slot>
342        </div>
343      </div>
344    `}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>`}};eg.styles=[ed.W5,em],eh([(0,n.MZ)({type:Number})],eg.prototype,"rings",void 0),eh([(0,n.MZ)({type:Number})],eg.prototype,"duration",void 0),eh([(0,n.MZ)({type:Number})],eg.prototype,"opacity",void 0),eh([(0,n.MZ)()],eg.prototype,"size",void 0),eh([(0,n.MZ)()],eg.prototype,"variant",void 0),eg=eh([(0,ep.E)("wui-pulse")],eg);let ew=[{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"}],ef=["success","submitted","failure","timeout","refund"],eb=(0,m.AH)`
345  :host {
346    display: block;
347    height: 100%;
348    width: 100%;
349  }
350
351  wui-image {
352    border-radius: ${({borderRadius:e})=>e.round};
353  }
354
355  .token-badge-container {
356    position: absolute;
357    bottom: 6px;
358    left: 50%;
359    transform: translateX(-50%);
360    border-radius: ${({borderRadius:e})=>e[4]};
361    z-index: 3;
362    min-width: 105px;
363  }
364
365  .token-badge-container.loading {
366    background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
367    border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary};
368  }
369
370  .token-badge-container.success {
371    background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
372    border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary};
373  }
374
375  .token-image-container {
376    position: relative;
377  }
378
379  .token-image {
380    border-radius: ${({borderRadius:e})=>e.round};
381    width: 64px;
382    height: 64px;
383  }
384
385  .token-image.success {
386    background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
387  }
388
389  .token-image.error {
390    background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
391  }
392
393  .token-image.loading {
394    background: ${({colors:e})=>e.accent010};
395  }
396
397  .token-image wui-icon {
398    width: 32px;
399    height: 32px;
400  }
401
402  .token-badge {
403    background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
404    border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary};
405    border-radius: ${({borderRadius:e})=>e[4]};
406  }
407
408  .token-badge wui-text {
409    white-space: nowrap;
410  }
411
412  .payment-lifecycle-container {
413    background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
414    border-top-right-radius: ${({borderRadius:e})=>e[6]};
415    border-top-left-radius: ${({borderRadius:e})=>e[6]};
416  }
417
418  .payment-step-badge {
419    padding: ${({spacing:e})=>e[1]} ${({spacing:e})=>e[2]};
420    border-radius: ${({borderRadius:e})=>e[1]};
421  }
422
423  .payment-step-badge.loading {
424    background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
425  }
426
427  .payment-step-badge.error {
428    background-color: ${({tokens:e})=>e.core.backgroundError};
429  }
430
431  .payment-step-badge.success {
432    background-color: ${({tokens:e})=>e.core.backgroundSuccess};
433  }
434
435  .step-icon-container {
436    position: relative;
437    height: 40px;
438    width: 40px;
439    border-radius: ${({borderRadius:e})=>e.round};
440    background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
441  }
442
443  .step-icon-box {
444    position: absolute;
445    right: -4px;
446    bottom: -1px;
447    padding: 2px;
448    border-radius: ${({borderRadius:e})=>e.round};
449    border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
450    background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
451  }
452
453  .step-icon-box.success {
454    background-color: ${({tokens:e})=>e.core.backgroundSuccess};
455  }
456`;var ex=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 eE={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]},eA=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=es.state.paymentAsset,this.quoteStatus=es.state.quoteStatus,this.quote=es.state.quote,this.amount=es.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=r.a.state.activeConnectorIds,this.selectedExchange=es.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(es.subscribeKey("quoteStatus",e=>this.quoteStatus=e),es.subscribeKey("quote",e=>this.quote=e),r.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e),es.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach(e
456=>e())}render(){return(0,a.qy)`
457      <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2">
458        ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()}
459      </wui-flex>
460    `}tokenTemplate(){let e=X(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">
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>`:n?(0,a.qy)`<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>`:(0,a.qy)`
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=${(0,s.J)(c.$.getNetworkImage(i))}
491                class="chain-image"
492                size="mdl"
493              ></wui-image>
494
495              <wui-text variant="lg-regular" color="primary">${e} ${t}</wui-text>
496            </wui-flex>
497          </wui-flex>
498        </wui-flex>
499      </wui-flex>
500    `}paymentTemplate(){return(0,a.qy)`
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(){let e=this.getStepsWithStatus();return(0,a.qy)`
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(e=>this.renderStep(e))}
516        </wui-flex>
517      </wui-flex>
518    `}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)`
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(t)return(0,a.qy)`
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      `;let i=this.quote?.timeInSeconds??0;return(0,a.qy)`
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. ${i} sec</wui-text>
548        </wui-flex>
549
550        <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon>
551      </wui-flex>
552    `}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 A.y.isLowerCaseMatch(e.id.toString(),i.toString())}),t=X(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)`
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">${t}</wui-text>
563            <wui-text variant="lg-regular" color="secondary">${i}</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=${(0,s.J)(c.$.getNetworkImage(e))}
570              size="xs"
571            ></wui-image>
572            <wui-text variant="md-regular" color="secondary">${e?.name}</wui-text>
573          </wui-flex>
574        </wui-flex>
575      </wui-flex>
576    `}renderWallet(){return(0,a.qy)`
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"
583          >${this.selectedExchange?"Exchange":"Wallet"}</wui-text
584        >
585
586        ${this.renderWalletText()}
587      </wui-flex>
588    `}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)`
589        <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
590          <wui-text variant="lg-regular" color="primary">${i}</wui-text>
591          <wui-image src=${(0,s.J)(this.selectedExchange.imageUrl)} size="mdl"></wui-image>
592        </wui-flex>
593      `:(0,a.qy)`
594      <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
595        <wui-text variant="lg-regular" color="primary">
596          ${m.Zv.getTruncateString({string:this.profileName||t||i||"",charsStart:this.profileName?16:4,charsEnd:6*!this.profileName,truncate:this.profileName?"end":"middle"})}
597        </wui-text>
598
599        <wui-image src=${(0,s.J)(e)} size="mdl"></wui-image>
600      </wui-flex>
601    `}getStepsWithStatus(){return"failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus?ew.map(e=>({...e,status:"failed"})):ew.map(e=>{let t=(eE[e.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...e,status:t}})}renderStep({title:e,icon:t,status:i}){return(0,a.qy)`
602      <wui-flex alignItems="center" gap="3">
603        <wui-flex justifyContent="center" alignItems="center" class="step-icon-container">
604          <wui-icon name=${t} color="default" size="mdl"></wui-icon>
605
606          <wui-flex alignItems="center" justifyContent="center" class=${(0,el.H)({"step-icon-box":!0,success:"completed"===i})}>
607            ${this.renderStatusIndicator(i)}
608          </wui-flex>
609        </wui-flex>
610
611        <wui-text variant="md-regular" color="primary">${e}</wui-text>
612      </wui-flex>
613    `}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=es.state.requestId;if(!e||ef.includes(this.quoteStatus))this.stopPolling();else try{await es.fetchQuoteStatus({requestId:e}),ef.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}}};eA.styles=eb,ex([(0,n.wk)()],eA.prototype,"paymentAsset",void 0),ex([(0,n.wk)()],eA.prototype,"quoteStatus",void 0),ex([(0,n.wk)()],eA.prototype,"quote",void 0),ex([(0,n.wk)()],eA.prototype,"amount",void 0),ex([(0,n.wk)()],eA.prototype,"namespace",void 0),ex([(0,n.wk)()],eA.prototype,"caipAddress",void 0),ex([(0,n.wk)()],eA.prototype,"profileName",void 0),ex([(0,n.wk)()],eA.prototype,"activeConnectorIds",void 0),ex([(0,n.wk)()],eA.prototype,"selectedExchange",void 0),eA=ex([(0,m.EM)("w3m-pay-loading-view")],eA),i(46183),i(78027);let ev=(0,a.AH)`
614  :host {
615    display: block;
616  }
617`,eI=class extends a.WF{render(){return(0,a.qy)`
618      <wui-flex flexDirection="column" gap="4">
619        <wui-flex alignItems="center" justifyContent="space-between">
620          <wui-text variant="md-regular" color="secondary">Pay</wui-text>
621          <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
622        </wui-flex>
623
624        <wui-flex alignItems="center" justifyContent="space-between">
625          <wui-text variant="md-regular" color="secondary">Network Fee</wui-text>
626
627          <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
628            <wui-shimmer
629              width="75px"
630              height="16px"
631              borderRadius="4xs"
632              variant="light"
633            ></wui-shimmer>
634
635            <wui-flex alignItems="center" gap="01">
636              <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer>
637              <wui-shimmer
638                width="49px"
639                height="14px"
640                borderRadius="4xs"
641                variant="light"
642              ></wui-shimmer>
643            </wui-flex>
644          </wui-flex>
645        </wui-flex>
646
647        <wui-flex alignItems="center" justifyContent="space-between">
648          <wui-text variant="md-regular" color="secondary">Service Fee</wui-text>
649          <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
650        </wui-flex>
651      </wui-flex>
652    `}};eI.styles=[ev],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}([(0,m.EM)("w3m-pay-fees-skeleton")],eI);let ek=(0,m.AH)`
653  :host {
654    display: block;
655  }
656
657  wui-image {
658    border-radius: ${({borderRadius:e})=>e.round};
659  }
660`;var eN=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 eS=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.quote=es.state.quote,this.unsubscribe.push(es.subscribeKey("quote",e=>this.quote=e))}
660disconnectedCallback(){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)`
661      <wui-flex flexDirection="column" gap="4">
662        <wui-flex alignItems="center" justifyContent="space-between">
663          <wui-text variant="md-regular" color="secondary">Pay</wui-text>
664          <wui-text variant="md-regular" color="primary">
665            ${e} ${this.quote?.origin.currency.metadata.symbol||"Unknown"}
666          </wui-text>
667        </wui-flex>
668
669        ${this.quote&&this.quote.fees.length>0?this.quote.fees.map(e=>this.renderFee(e)):null}
670      </wui-flex>
671    `}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=>A.y.isLowerCaseMatch(t.caipNetworkId,e.currency.network));return(0,a.qy)`
672        <wui-flex alignItems="center" justifyContent="space-between">
673          <wui-text variant="md-regular" color="secondary">${e.label}</wui-text>
674
675          <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
676            <wui-text variant="md-regular" color="primary">
677              ${i} ${e.currency.metadata.symbol||"Unknown"}
678            </wui-text>
679
680            <wui-flex alignItems="center" gap="01">
681              <wui-image
682                src=${(0,s.J)(c.$.getNetworkImage(t))}
683                size="xs"
684              ></wui-image>
685              <wui-text variant="sm-regular" color="secondary">
686                ${t?.name||"Unknown"}
687              </wui-text>
688            </wui-flex>
689          </wui-flex>
690        </wui-flex>
691      `}return(0,a.qy)`
692      <wui-flex alignItems="center" justifyContent="space-between">
693        <wui-text variant="md-regular" color="secondary">${e.label}</wui-text>
694        <wui-text variant="md-regular" color="primary">
695          ${i} ${e.currency.metadata.symbol||"Unknown"}
696        </wui-text>
697      </wui-flex>
698    `}};eS.styles=[ek],eN([(0,n.wk)()],eS.prototype,"quote",void 0),eS=eN([(0,m.EM)("w3m-pay-fees")],eS);let eP=(0,m.AH)`
699  :host {
700    display: block;
701    width: 100%;
702  }
703
704  .disabled-container {
705    padding: ${({spacing:e})=>e[2]};
706    min-height: 168px;
707  }
708
709  wui-icon {
710    width: ${({spacing:e})=>e[8]};
711    height: ${({spacing:e})=>e[8]};
712  }
713
714  wui-flex > wui-text {
715    max-width: 273px;
716  }
717`;var eT=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=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.selectedExchange=es.state.selectedExchange,this.unsubscribe.push(es.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=!!this.selectedExchange;return(0,a.qy)`
718      <wui-flex
719        flexDirection="column"
720        alignItems="center"
721        justifyContent="center"
722        gap="3"
723        class="disabled-container"
724      >
725        <wui-icon name="coins" color="default" size="inherit"></wui-icon>
726
727        <wui-text variant="md-regular" color="primary" align="center">
728          You don't have enough funds to complete this transaction
729        </wui-text>
730
731        ${e?null:(0,a.qy)`<wui-button
732              size="md"
733              variant="neutral-secondary"
734              @click=${this.dispatchConnectOtherWalletEvent.bind(this)}
735              >Connect other wallet</wui-button
736            >`}
737      </wui-flex>
738    `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}};eC.styles=[eP],eT([(0,n.MZ)({type:Array})],eC.prototype,"selectedExchange",void 0),eC=eT([(0,m.EM)("w3m-pay-options-empty")],eC);let e$=(0,m.AH)`
739  :host {
740    display: block;
741    width: 100%;
742  }
743
744  .pay-options-container {
745    max-height: 196px;
746    overflow-y: auto;
747    overflow-x: hidden;
748    scrollbar-width: none;
749  }
750
751  .pay-options-container::-webkit-scrollbar {
752    display: none;
753  }
754
755  .pay-option-container {
756    border-radius: ${({borderRadius:e})=>e[4]};
757    padding: ${({spacing:e})=>e[3]};
758    min-height: 60px;
759  }
760
761  .token-images-container {
762    position: relative;
763    justify-content: center;
764    align-items: center;
765  }
766
767  .chain-image {
768    position: absolute;
769    bottom: -3px;
770    right: -5px;
771    border: 2px solid ${({tokens:e})=>e.theme.foregroundSecondary};
772  }
773`,e_=class extends a.WF{render(){return(0,a.qy)`
774      <wui-flex flexDirection="column" gap="2" class="pay-options-container">
775        ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()}
776      </wui-flex>
777    `}renderOptionEntry(){return(0,a.qy)`
778      <wui-flex
779        alignItems="center"
780        justifyContent="space-between"
781        gap="2"
782        class="pay-option-container"
783      >
784        <wui-flex alignItems="center" gap="2">
785          <wui-flex class="token-images-container">
786            <wui-shimmer
787              width="32px"
788              height="32px"
789              rounded
790              variant="light"
791              class="token-image"
792            ></wui-shimmer>
793            <wui-shimmer
794              width="16px"
795              height="16px"
796              rounded
797              variant="light"
798              class="chain-image"
799            ></wui-shimmer>
800          </wui-flex>
801
802          <wui-flex flexDirection="column" gap="1">
803            <wui-shimmer
804              width="74px"
805              height="16px"
806              borderRadius="4xs"
807              variant="light"
808            ></wui-shimmer>
809            <wui-shimmer
810              width="46px"
811              height="14px"
812              borderRadius="4xs"
813              variant="light"
814            ></wui-shimmer>
815          </wui-flex>
816        </wui-flex>
817      </wui-flex>
818    `}};e_.styles=[e$],e_=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")],e_);let eq=(0,m.AH)`
819  :host {
820    display: block;
821    width: 100%;
822  }
823
824  .pay-options-container {
825    max-height: 196px;
826    overflow-y: auto;
827    overflow-x: hidden;
828    scrollbar-width: none;
829    mask-image: var(--options-mask-image);
830    -webkit-mask-image: var(--options-mask-image);
831  }
832
833  .pay-options-container::-webkit-scrollbar {
834    display: none;
835  }
836
837  .pay-option-container {
838    cursor: pointer;
839    border-radius: ${({borderRadius:e})=>e[4]};
840    padding: ${({spacing:e})=>e[3]};
841    transition: background-color ${({durations:e})=>e.lg}
842      ${({easings:e})=>e["ease-out-power-1"]};
843    will-change: background-color;
844  }
845
846  .token-images-container {
847    position: relative;
848    justify-content: center;
849    align-items: center;
850  }
851
852  .token-image {
853    border-radius: ${({borderRadius:e})=>e.round};
854    width: 32px;
855    height: 32px;
856  }
857
858  .chain-image {
859    position: absolute;
860    width: 16px;
861    height: 16px;
862    bottom: -3px;
863    right: -5px;
864    border-radius: ${({borderRadius:e})=>e.round};
865    border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
866  }
867
868  @media (hover: hover) and (pointer: fine) {
869    .pay-option-container:hover {
870      background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
871    }
872  }
873`;var eO=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 eR=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)`
874      <wui-flex flexDirection="column" gap="2" class="pay-options-container">
875        ${this.options.map(e=>this.payOptionTemplate(e))}
876      </wui-flex>
877    `}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)`
878      <wui-flex
879        alignItems="center"
880        justifyContent="space-between"
881        gap="2"
882        @click=${()=>this.onSelect?.(e)}
883        class="pay-option-container"
884      >
885        <wui-flex alignItems="center" gap="2">
886          <wui-flex class="token-images-container">
887            <wui-image
888              src=${(0,s.J)(i.logoURI)}
889              class="token-image"
890              size="3xl"
891            ></wui-image>
892            <wui-image
893              src=${(0,s.J)(c.$.getNetworkImage(l))}
894              class="chain-image"
895              size="md"
896            ></wui-image>
897          </wui-flex>
898
899          <wui-flex flexDirection="column" gap="1">
900            <wui-text variant="lg-regular" color="primary">${i.symbol}</wui-text>
901            ${m?(0,a.qy)`<wui-text variant="sm-regular" color="secondary">
902                  ${p.round(6).toString()} ${i.symbol}
903                </wui-text>`:null}
904          </wui-flex>
905        </wui-flex>
906
907        ${u===d?(0,a.qy)`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null}
908      </wui-flex>
909    `}handleOptionsListScroll(){let e=this.shadowRoot?.querySelector(".pay-options-container");e&&(e.scrollHeight>300?(e.style.setProperty("--options-mask-image",`linear-gradient(
910          to bottom,
911          rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px,
912          rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px,
913          black 50px,
914          black calc(100% - 50px),
915          rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px),
916          rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100%
917        )`),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")))}};eR.styles=[eq],eO([(0,n.MZ)({type:Array})],eR.prototype,"options",void 0),eO([(0,n.MZ)()],eR.prototype,"selectedPaymentAsset",void 0),eO([(0,n.MZ)()],eR.prototype,"onSelect",void 0),eR=eO([
917(0,m.EM)("w3m-pay-options")],eR);let eU=(0,m.AH)`
918  .payment-methods-container {
919    background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
920    border-top-right-radius: ${({borderRadius:e})=>e[5]};
921    border-top-left-radius: ${({borderRadius:e})=>e[5]};
922  }
923
924  .pay-options-container {
925    background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
926    border-radius: ${({borderRadius:e})=>e[5]};
927    padding: ${({spacing:e})=>e[1]};
928  }
929
930  w3m-tooltip-trigger {
931    display: flex;
932    align-items: center;
933    justify-content: center;
934    max-width: fit-content;
935  }
936
937  wui-image {
938    border-radius: ${({borderRadius:e})=>e.round};
939  }
940
941  w3m-pay-options.disabled {
942    opacity: 0.5;
943    pointer-events: none;
944  }
945`;var 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};let eL={eip155:"ethereum",solana:"solana",bip122:"bitcoin",ton:"ton"},eF={eip155:{icon:eL.eip155,label:"EVM"},solana:{icon:eL.solana,label:"Solana"},bip122:{icon:eL.bip122,label:"Bitcoin"},ton:{icon:eL.ton,label:"Ton"}},eW=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=es.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=es.state.amount,this.recipient=es.state.recipient,this.activeConnectorIds=r.a.state.activeConnectorIds,this.selectedPaymentAsset=es.state.selectedPaymentAsset,this.selectedExchange=es.state.selectedExchange,this.isFetchingQuote=es.state.isFetchingQuote,this.quoteError=es.state.quoteError,this.quote=es.state.quote,this.isFetchingTokenBalances=es.state.isFetchingTokenBalances,this.tokenBalances=es.state.tokenBalances,this.isPaymentInProgress=es.state.isPaymentInProgress,this.exchangeUrlForQuote=es.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(es.subscribeKey("paymentAsset",e=>this.paymentAsset=e)),this.unsubscribe.push(es.subscribeKey("tokenBalances",e=>this.onTokenBalancesChanged(e))),this.unsubscribe.push(es.subscribeKey("isFetchingTokenBalances",e=>this.isFetchingTokenBalances=e)),this.unsubscribe.push(r.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(es.subscribeKey("selectedPaymentAsset",e=>this.selectedPaymentAsset=e)),this.unsubscribe.push(es.subscribeKey("isFetchingQuote",e=>this.isFetchingQuote=e)),this.unsubscribe.push(es.subscribeKey("quoteError",e=>this.quoteError=e)),this.unsubscribe.push(es.subscribeKey("quote",e=>this.quote=e)),this.unsubscribe.push(es.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(es.subscribeKey("recipient",e=>this.recipient=e)),this.unsubscribe.push(es.subscribeKey("isPaymentInProgress",e=>this.isPaymentInProgress=e)),this.unsubscribe.push(es.subscribeKey("selectedExchange",e=>this.selectedExchange=e)),this.unsubscribe.push(es.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(0,a.qy)`
946      <wui-flex flexDirection="column">
947        ${this.profileTemplate()}
948
949        <wui-flex
950          flexDirection="column"
951          gap="4"
952          class="payment-methods-container"
953          .padding=${["4","4","5","4"]}
954        >
955          ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()}
956
957          <wui-flex
958            alignItems="center"
959            justifyContent="space-between"
960            .padding=${["1","0","1","0"]}
961          >
962            <wui-separator></wui-separator>
963          </wui-flex>
964
965          ${this.paymentActionsTemplate()}
966        </wui-flex>
967      </wui-flex>
968    `}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)`
969        <wui-flex
970          .padding=${["4","3","4","3"]}
971          alignItems="center"
972          justifyContent="space-between"
973          gap="2"
974        >
975          <wui-text variant="lg-regular" color="secondary">Paying with</wui-text>
976
977          ${this.quote?(0,a.qy)`<wui-text variant="lg-regular" color="primary">
978                ${f.S.bigNumber(e,{safe:!0}).round(6).toString()}
979                ${this.quote.origin.currency.metadata.symbol}
980              </wui-text>`:(0,a.qy)`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`}
981        </wui-flex>
982      `}let e=x.w.getPlainAddress(this.caipAddress)??"",{name:t,image:i}=this.getWalletProperties({namespace:this.namespace}),{icon:n,label:r}=eF[this.namespace]??{};return(0,a.qy)`
983      <wui-flex
984        .padding=${["4","3","4","3"]}
985        alignItems="center"
986        justifyContent="space-between"
987        gap="2"
988      >
989        <wui-wallet-switch
990          profileName=${(0,s.J)(this.profileName)}
991          address=${(0,s.J)(e)}
992          imageSrc=${(0,s.J)(i)}
993          alt=${(0,s.J)(t)}
994          @click=${this.onConnectOtherWallet.bind(this)}
995          data-testid="wui-wallet-switch"
996        ></wui-wallet-switch>
997
998        <wui-wallet-switch
999          profileName=${(0,s.J)(r)}
1000          address=${(0,s.J)(e)}
1001          icon=${(0,s.J)(n)}
1002          iconSize="xs"
1003          .enableGreenCircle=${!1}
1004          alt=${(0,s.J)(r)}
1005          @click=${this.onConnectOtherWallet.bind(this)}
1006          data-testid="wui-wallet-switch"
1007        ></wui-wallet-switch>
1008      </wui-flex>
1009    `}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 es.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):{};es.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)`
1010      <wui-flex flexDirection="column" gap="2">
1011        <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text>
1012        <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex>
1013      </wui-flex>
1014    `}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
1015        @connectOtherWallet=${this.onConnectOtherWallet.bind(this)}
1016      ></w3m-pay-options-empty>`;let t={disabled:this.isFetchingQuote};return(0,a.qy)`<w3m-pay-options
1017      class=${(0,el.H)(t)}
1018      .options=${e}
1019      .selectedPaymentAsset=${(0,s.J)(this.selectedPaymentAsset)}
1020      .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)}
1021    ></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)`
1022          <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer>
1023        `:(0,a.qy)`<wui-button
1024        size="lg"
1025        fullWidth
1026        variant="accent-secondary"
1027        @click=${this.onPayWithExchange.bind(this)}
1028      >
1029        ${`Continue in ${this.selectedExchange.name}`}
1030
1031        <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon>
1032      </wui-button>`:(0,a.qy)`
1033      <wui-flex alignItems="center" justifyContent="space-between">
1034        <wui-flex flexDirection="column" gap="1">
1035          <wui-text variant="md-regular" color="secondary">Order Total</wui-text>
1036
1037          ${e||t?(0,a.qy)`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:(0,a.qy)`<wui-flex alignItems="center" gap="01">
1038                <wui-text variant="h4-regular" color="primary">${X(i)}</wui-text>
1039
1040                <wui-text variant="lg-regular" color="secondary">
1041                  ${this.quote?.origin.currency.metadata.symbol||"Unknown"}
1042                </wui-text>
1043              </wui-flex>`}
1044        </wui-flex>
1045
1046        ${this.actionButtonTemplate({isLoading:e,isDisabled:t})}
1047      </wui-flex>
1048    `}actionButtonTemplate(e){let t=D(this.quote),{isLoading:i,isDisabled:n}=e,s="Pay";return t.length>1&&0===this.completedTransactionsCount&&(s="Approve"),(0,a.qy)`
1049      <wui-button
1050        size="lg"
1051        variant="accent-primary"
1052        ?loading=${i||this.isPaymentInProgress}
1053        ?disabled=${n||this.isPaymentInProgress}
1054        @click=${()=>{t.length>0?this.onSendTransactions():this.onTransfer()}}
1055      >
1056        ${s}
1057        ${i?null:(0,a.qy)`<wui-icon
1058              name="arrowRight"
1059              color="inherit"
1060              size="sm"
1061              slot="iconRight"
1062            ></wui-icon>`}
1063      </wui-button>
1063
1064    `}getPaymentAssetFromTokenBalances(){return this.namespace?(this.tokenBalances[this.namespace]??[]).map(e=>{try{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(A.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}}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!!A.y.isLowerCaseMatch(e.asset,this.paymentAsset.asset)||!this.selectedExchange||!A.y.isLowerCaseMatch(t.toString(),i.toString())}):[]}onTokenBalancesChanged(e){this.tokenBalances=e;let[t]=this.getPaymentAssetFromTokenBalances();t&&es.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?A.y.isLowerCaseMatch(e,t)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):u.W.close()}}onSelectedPaymentAssetChanged(e){this.isFetchingQuote||es.setSelectedPaymentAsset(e)}async onTransfer(){let e=U(this.quote);if(e){if(!A.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 es.onTransfer({chainNamespace:this.namespace,fromAddress:t,toAddress:e.deposit.receiver,amount:i,paymentAsset:this.selectedPaymentAsset}),es.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=D(this.quote),[a]=D(this.quote,this.completedTransactionsCount);a&&this.namespace&&(await es.onSendTransaction({namespace:this.namespace,transactionStep:a}),this.completedTransactionsCount+=1,this.completedTransactionsCount===i.length&&(es.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=U(this.quote);t&&es.setRequestId(t.requestId),es.initiatePayment(),l.I.push("PayLoading")}}resetAssetsState(){es.setSelectedPaymentAsset(null)}resetQuoteState(){es.resetQuoteState()}};async function eM(e){return es.handleOpenPay(e)}async function eB(e,t=3e5){if(t<=0)throw new k(v.INVALID_PAYMENT_CONFIG,"Timeout must be greater than 0");try{await eM(e)}catch(e){if(e instanceof k)throw e;throw new k(v.UNABLE_TO_INITIATE_PAYMENT,e.message)}return new Promise((e,i)=>{var a;let n=!1,s=setTimeout(()=>{n||(n=!0,c(),i(new k(v.GENERIC_PAYMENT_ERROR,"Payment timeout")))},t);function r(){if(n)return;let t=es.state.currentPayment,i=es.state.error,a=es.state.isPaymentInProgress;if(t?.status==="SUCCESS"){n=!0,c(),clearTimeout(s),e({success:!0,result:t.result});return}if(t?.status==="FAILED"){n=!0,c(),clearTimeout(s),e({success:!1,error:i||"Payment failed"});return}!i||a||t||(n=!0,c(),clearTimeout(s),e({success:!1,error:i}))}let o=eQ("currentPayment",r),c=(a=[o,eQ("error",r),eQ("isPaymentInProgress",r)],()=>
1064{a.forEach(e=>{try{e()}catch{}})});r()})}function ej(){return es.getExchanges()}function ez(){return es.state.currentPayment?.result}function eG(){return es.state.error}function eY(){return es.state.isPaymentInProgress}function eQ(e,t){return es.subscribeKey(e,t)}eW.styles=eU,eD([(0,n.wk)()],eW.prototype,"profileName",void 0),eD([(0,n.wk)()],eW.prototype,"paymentAsset",void 0),eD([(0,n.wk)()],eW.prototype,"namespace",void 0),eD([(0,n.wk)()],eW.prototype,"caipAddress",void 0),eD([(0,n.wk)()],eW.prototype,"amount",void 0),eD([(0,n.wk)()],eW.prototype,"recipient",void 0),eD([(0,n.wk)()],eW.prototype,"activeConnectorIds",void 0),eD([(0,n.wk)()],eW.prototype,"selectedPaymentAsset",void 0),eD([(0,n.wk)()],eW.prototype,"selectedExchange",void 0),eD([(0,n.wk)()],eW.prototype,"isFetchingQuote",void 0),eD([(0,n.wk)()],eW.prototype,"quoteError",void 0),eD([(0,n.wk)()],eW.prototype,"quote",void 0),eD([(0,n.wk)()],eW.prototype,"isFetchingTokenBalances",void 0),eD([(0,n.wk)()],eW.prototype,"tokenBalances",void 0),eD([(0,n.wk)()],eW.prototype,"isPaymentInProgress",void 0),eD([(0,n.wk)()],eW.prototype,"exchangeUrlForQuote",void 0),eD([(0,n.wk)()],eW.prototype,"completedTransactionsCount",void 0),eW=eD([(0,m.EM)("w3m-pay-quote-view")],eW);let eH={network:"eip155:8453",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},eV={network:"eip155:8453",asset:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},eK={network:"eip155:84532",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},eJ={network:"eip155:1",asset:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},eZ={network:"eip155:10",asset:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},eX={network:"eip155:42161",asset:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},e0={network:"eip155:137",asset:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},e1={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},e3={network:"eip155:1",asset:"0xdAC17F958D2ee523a2206206994597C13D831ec7",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},e2={network:"eip155:10",asset:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},e5={network:"eip155:42161",asset:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},e4={network:"eip155:137",asset:"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},e8={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},e6={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"native",metadata:{name:"Solana",symbol:"SOL",decimals:9}}}}]);

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.