admin08077 commited on
Commit
fd015f0
·
verified ·
1 Parent(s): d3738c0

Upload 86 files

Browse files
assets/SwapController-DJdOQ0eQ.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{cK as d,cL as D,cM as p,cN as k,cO as P,cP as m,cQ as I,cR as h,cS as y,cT as T,cU as f,cV as b,cW as A,cX as B,cY as M,cZ as C,c_ as F,c$ as L,d0 as _,d1 as O,d2 as W}from"./index-C-6muS97.js";const g={getGasPriceInEther(n,o){const t=o*n;return Number(t)/1e18},getGasPriceInUSD(n,o,t){const a=g.getGasPriceInEther(o,t);return d.bigNumber(n).times(a).toNumber()},getPriceImpact({sourceTokenAmount:n,sourceTokenPriceInUSD:o,toTokenPriceInUSD:t,toTokenAmount:a}){const i=d.bigNumber(n).times(o),r=d.bigNumber(a).times(t);return i.minus(r).div(i).times(100).toNumber()},getMaxSlippage(n,o){const t=d.bigNumber(n).div(100);return d.multiply(o,t).toNumber()},getProviderFee(n,o=.0085){return d.bigNumber(n).times(o).toString()},isInsufficientNetworkTokenForGas(n,o){const t=o||"0";return d.bigNumber(n).eq(0)?!0:d.bigNumber(d.bigNumber(t)).gt(n)},isInsufficientSourceTokenForSwap(n,o,t){const a=t?.find(r=>r.address===o)?.quantity?.numeric;return d.bigNumber(a||"0").lt(n)}},U=15e4,G=6,l={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:C.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},e=W({...l}),S={state:e,subscribe(n){return O(e,()=>n(e))},subscribeKey(n,o){return _(e,n,o)},getParams(){const n=T.state.activeChain,o=T.getAccountData(n)?.caipAddress??T.state.activeCaipAddress,t=b.getPlainAddress(o),a=F(),i=L.getConnectorId(T.state.activeChain);if(!t)throw new Error("No address found to swap the tokens from.");const r=!e.toToken?.address||!e.toToken?.decimals,c=!e.sourceToken?.address||!e.sourceToken?.decimals||!d.bigNumber(e.sourceTokenAmount).gt(0),u=!e.sourceTokenAmount;return{networkAddress:a,fromAddress:t,fromCaipAddress:o,sourceTokenAddress:e.sourceToken?.address,toTokenAddress:e.toToken?.address,toTokenAmount:e.toTokenAmount,toTokenDecimals:e.toToken?.decimals,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:e.sourceToken?.decimals,invalidToToken:r,invalidSourceToken:c,invalidSourceTokenAmount:u,availableToSwap:o&&!r&&!c&&!u,isAuthConnector:i===m.CONNECTOR_ID.AUTH}},async setSourceToken(n){if(!n){e.sourceToken=n,e.sourceTokenAmount="",e.sourceTokenPriceInUSD=0;return}e.sourceToken=n,await s.setTokenPrice(n.address,"sourceToken")},setSourceTokenAmount(n){e.sourceTokenAmount=n},async setToToken(n){if(!n){e.toToken=n,e.toTokenAmount="",e.toTokenPriceInUSD=0;return}e.toToken=n,await s.setTokenPrice(n.address,"toToken")},setToTokenAmount(n){e.toTokenAmount=n?d.toFixed(n,G):""},async setTokenPrice(n,o){let t=e.tokensPriceMap[n]||0;t||(e.loadingPrices=!0,t=await s.getAddressPrice(n)),o==="sourceToken"?e.sourceTokenPriceInUSD=t:o==="toToken"&&(e.toTokenPriceInUSD=t),e.loadingPrices&&(e.loadingPrices=!1),s.getParams().availableToSwap&&!e.switchingTokens&&s.swapTokens()},async switchTokens(){if(!(e.initializing||!e.initialized||e.switchingTokens)){e.switchingTokens=!0;try{const n=e.toToken?{...e.toToken}:void 0,o=e.sourceToken?{...e.sourceToken}:void 0,t=n&&e.toTokenAmount===""?"1":e.toTokenAmount;s.setSourceTokenAmount(t),s.setToTokenAmount(""),await s.setSourceToken(n),await s.setToToken(o),e.switchingTokens=!1,s.swapTokens()}catch(n){throw e.switchingTokens=!1,n}}},resetState(){e.myTokensWithBalance=l.myTokensWithBalance,e.tokensPriceMap=l.tokensPriceMap,e.initialized=l.initialized,e.initializing=l.initializing,e.switchingTokens=l.switchingTokens,e.sourceToken=l.sourceToken,e.sourceTokenAmount=l.sourceTokenAmount,e.sourceTokenPriceInUSD=l.sourceTokenPriceInUSD,e.toToken=l.toToken,e.toTokenAmount=l.toTokenAmount,e.toTokenPriceInUSD=l.toTokenPriceInUSD,e.networkPrice=l.networkPrice,e.networkTokenSymbol=l.networkTokenSymbol,e.networkBalanceInUSD=l.networkBalanceInUSD,e.inputError=l.inputError},resetValues(){const{networkAddress:n}=s.getParams(),o=e.tokens?.find(t=>t.address===n);s.setSourceToken(o),s.setToToken(void 0)},getApprovalLoadingState(){return e.loadingApprovalTransaction},clearError(){e.transactionError=void 0},async initializeState(){if(!e.initializing){if(e.initializing=!0,!e.initialized)try{await s.fetchTokens(),e.initialized=!0}catch{e.initialized=!1,k.showError("Failed to initialize swap"),p.goBack()}e.initializing=!1}},async fetchTokens(){const{networkAddress:n}=s.getParams();await s.getNetworkTokenPrice(),await s.getMyTokensWithBalance();const o=e.myTokensWithBalance?.find(t=>t.address===n);o&&(e.networkTokenSymbol=o.symbol,s.setSourceToken(o),s.setSourceTokenAmount("0"))},async getTokenList(){const n=T.state.activeCaipNetwork?.caipNetworkId;if(!(e.caipNetworkId===n&&e.tokens))try{e.tokensLoading=!0;const o=await A.getTokenList(n);e.tokens=o,e.caipNetworkId=n,e.popularTokens=o.sort((c,u)=>c.symbol<u.symbol?-1:c.symbol>u.symbol?1:0);const a=(n&&C.SUGGESTED_TOKENS_BY_CHAIN?.[n]||[]).map(c=>o.find(u=>u.symbol===c)).filter(c=>!!c),r=(C.SWAP_SUGGESTED_TOKENS||[]).map(c=>o.find(u=>u.symbol===c)).filter(c=>!!c).filter(c=>!a.some(u=>u.address===c.address));e.suggestedTokens=[...a,...r]}catch{e.tokens=[],e.popularTokens=[],e.suggestedTokens=[]}finally{e.tokensLoading=!1}},async getAddressPrice(n){const o=e.tokensPriceMap[n];if(o)return o;const a=(await f.fetchTokenPrice({addresses:[n]}))?.fungibles||[],r=[...e.tokens||[],...e.myTokensWithBalance||[]]?.find(w=>w.address===n)?.symbol,c=a.find(w=>w.symbol.toLowerCase()===r?.toLowerCase())?.price||0,u=parseFloat(c.toString());return e.tokensPriceMap[n]=u,u},async getNetworkTokenPrice(){const{networkAddress:n}=s.getParams(),t=(await f.fetchTokenPrice({addresses:[n]}).catch(()=>(k.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles?.[0],a=t?.price.toString()||"0";e.tokensPriceMap[n]=parseFloat(a),e.networkTokenSymbol=t?.symbol||"",e.networkPrice=a},async getMyTokensWithBalance(n){const o=await M.getMyTokensWithBalance({forceUpdate:n,caipNetwork:T.state.activeCaipNetwork,address:T.getAccountData()?.address}),t=A.mapBalancesToSwapTokens(o);t&&(await s.getInitialGasPrice(),s.setBalances(t))},setBalances(n){const{networkAddress:o}=s.getParams(),t=T.state.activeCaipNetwork;if(!t)return;const a=n.find(i=>i.address===o);n.forEach(i=>{e.tokensPriceMap[i.address]=i.price||0}),e.myTokensWithBalance=n.filter(i=>i.address.startsWith(t.caipNetworkId)),e.networkBalanceInUSD=a?d.multiply(a.quantity.numeric,a.price).toString():"0"},async getInitialGasPrice(){const n=await A.fetchGasPrice();if(!n)return{gasPrice:null,gasPriceInUSD:null};switch(T.state?.activeCaipNetwork?.chainNamespace){case m.CHAIN.SOLANA:return e.gasFee=n.standard??"0",e.gasPriceInUSD=d.multiply(n.standard,e.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(e.gasFee),gasPriceInUSD:Number(e.gasPriceInUSD)};case m.CHAIN.EVM:default:const o=n.standard??"0",t=BigInt(o),a=BigInt(U),i=g.getGasPriceInUSD(e.networkPrice,a,t);return e.gasFee=o,e.gasPriceInUSD=i,{gasPrice:t,gasPriceInUSD:i}}},async swapTokens(){const n=T.getAccountData()?.address,o=e.sourceToken,t=e.toToken,a=d.bigNumber(e.sourceTokenAmount).gt(0);if(a||s.setToTokenAmount(""),!t||!o||e.loadingPrices||!a||!n)return;e.loadingQuote=!0;const i=d.bigNumber(e.sourceTokenAmount).times(10**o.decimals).round(0).toFixed(0);try{const r=await f.fetchSwapQuote({userAddress:n,from:o.address,to:t.address,gasPrice:e.gasFee,amount:i.toString()});e.loadingQuote=!1;const c=r?.quotes?.[0]?.toAmount;if(!c){B.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const u=d.bigNumber(c).div(10**t.decimals).toString();s.setToTokenAmount(u),s.hasInsufficientToken(e.sourceTokenAmount,o.address)?e.inputError="Insufficient balance":(e.inputError=void 0,s.setTransactionDetails())}catch(r){const c=await A.handleSwapError(r);e.loadingQuote=!1,e.inputError=c||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:n,availableToSwap:o}=s.getParams(),t=e.sourceToken,a=e.toToken;if(!(!n||!o||!t||!a||e.loadingQuote))try{e.loadingBuildTransaction=!0;const i=await A.fetchSwapAllowance({userAddress:n,tokenAddress:t.address,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:t.decimals});let r;return i?r=await s.createSwapTransaction():r=await s.createAllowanceTransaction(),e.loadingBuildTransaction=!1,e.fetchError=!1,r}catch{p.goBack(),k.showError("Failed to check allowance"),e.loadingBuildTransaction=!1,e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:n,sourceTokenAddress:o,toTokenAddress:t}=s.getParams();if(!(!n||!t)){if(!o)throw new Error("createAllowanceTransaction - No source token address found.");try{const a=await f.generateApproveCalldata({from:o,to:t,userAddress:n}),i=b.getPlainAddress(a.tx.from);if(!i)throw new Error("SwapController:createAllowanceTransaction - address is required");const r={data:a.tx.data,to:i,gasPrice:BigInt(a.tx.eip155.gasPrice),value:BigInt(a.tx.value),toAmount:e.toTokenAmount};return e.swapTransaction=void 0,e.approvalTransaction={data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount},{data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount}}catch{p.goBack(),k.showError("Failed to create approval transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}}},async createSwapTransaction(){const{networkAddress:n,fromCaipAddress:o,sourceTokenAmount:t}=s.getParams(),a=e.sourceToken,i=e.toToken;if(!o||!t||!a||!i)return;const r=P.parseUnits(t,a.decimals)?.toString();try{const c=await f.generateSwapCalldata({userAddress:o,from:a.address,to:i.address,amount:r,disableEstimate:!0}),u=a.address===n,w=BigInt(c.tx.eip155.gas),N=BigInt(c.tx.eip155.gasPrice),v=b.getPlainAddress(c.tx.to);if(!v)throw new Error("SwapController:createSwapTransaction - address is required");const E={data:c.tx.data,to:v,gas:w,gasPrice:N,value:BigInt(u?r??"0":"0"),toAmount:e.toTokenAmount};return e.gasPriceInUSD=g.getGasPriceInUSD(e.networkPrice,w,N),e.approvalTransaction=void 0,e.swapTransaction=E,E}catch{p.goBack(),k.showError("Failed to create transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){k.showLoading("Approve limit increase in your wallet"),p.replace("SwapPreview")},async sendTransactionForApproval(n){const{fromAddress:o,isAuthConnector:t}=s.getParams();e.loadingApprovalTransaction=!0,t?p.pushTransactionStack({onSuccess:s.onEmbeddedWalletApprovalSuccess}):k.showLoading("Approve limit increase in your wallet");try{await P.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:m.CHAIN.EVM}),await s.swapTokens(),await s.getTransaction(),e.approvalTransaction=void 0,e.loadingApprovalTransaction=!1}catch(i){const r=i;e.transactionError=r?.displayMessage,e.loadingApprovalTransaction=!1,k.showError(r?.displayMessage||"Transaction error"),I.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:r?.displayMessage||r?.message||"Unknown",network:T.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:s.state.sourceToken?.symbol||"",swapToToken:s.state.toToken?.symbol||"",swapFromAmount:s.state.sourceTokenAmount||"",swapToAmount:s.state.toTokenAmount||"",isSmartAccount:h(m.CHAIN.EVM)===y.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(n){if(!n)return;const{fromAddress:o,toTokenAmount:t,isAuthConnector:a}=s.getParams();e.loadingTransaction=!0;const i=`Swapping ${e.sourceToken?.symbol} to ${d.formatNumberToLocalString(t,3)} ${e.toToken?.symbol}`,r=`Swapped ${e.sourceToken?.symbol} to ${d.formatNumberToLocalString(t,3)} ${e.toToken?.symbol}`;a?p.pushTransactionStack({onSuccess(){p.replace("Account"),k.showLoading(i),S.resetState()}}):k.showLoading("Confirm transaction in your wallet");try{const c=[e.sourceToken?.address,e.toToken?.address].join(","),u=await P.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:m.CHAIN.EVM});return e.loadingTransaction=!1,k.showSuccess(r),I.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:T.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:s.state.sourceToken?.symbol||"",swapToToken:s.state.toToken?.symbol||"",swapFromAmount:s.state.sourceTokenAmount||"",swapToAmount:s.state.toTokenAmount||"",isSmartAccount:h(m.CHAIN.EVM)===y.ACCOUNT_TYPES.SMART_ACCOUNT}}),S.resetState(),a||p.replace("Account"),S.getMyTokensWithBalance(c),u}catch(c){const u=c;e.transactionError=u?.displayMessage,e.loadingTransaction=!1,k.showError(u?.displayMessage||"Transaction error"),I.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:u?.displayMessage||u?.message||"Unknown",network:T.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:s.state.sourceToken?.symbol||"",swapToToken:s.state.toToken?.symbol||"",swapFromAmount:s.state.sourceTokenAmount||"",swapToAmount:s.state.toTokenAmount||"",isSmartAccount:h(m.CHAIN.EVM)===y.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(n,o){return g.isInsufficientSourceTokenForSwap(n,o,e.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:n,toTokenDecimals:o}=s.getParams();!n||!o||(e.gasPriceInUSD=g.getGasPriceInUSD(e.networkPrice,BigInt(e.gasFee),BigInt(U)),e.priceImpact=g.getPriceImpact({sourceTokenAmount:e.sourceTokenAmount,sourceTokenPriceInUSD:e.sourceTokenPriceInUSD,toTokenPriceInUSD:e.toTokenPriceInUSD,toTokenAmount:e.toTokenAmount}),e.maxSlippage=g.getMaxSlippage(e.slippage,e.toTokenAmount),e.providerFee=g.getProviderFee(e.sourceTokenAmount))}},s=D(S);export{s as S};
assets/ccip-DoAXWI68.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{B as p,d8 as y,cl as w,bi as g,bX as k,d9 as L,bb as O,br as R,T as m,bY as E}from"./index-C-6muS97.js";import{l as x,b as M}from"./localBatchGatewayRequest-BpO1N93o.js";class S extends p{constructor({callbackSelector:s,cause:e,data:o,extraData:n,sender:c,urls:t}){super(e.shortMessage||"An error occurred while fetching for an offchain result.",{cause:e,metaMessages:[...e.metaMessages||[],e.metaMessages?.length?"":[],"Offchain Gateway Call:",t&&[" Gateway URL(s):",...t.map(i=>` ${y(i)}`)],` Sender: ${c}`,` Data: ${o}`,` Callback selector: ${s}`,` Extra data: ${n}`].flat(),name:"OffchainLookupError"})}}class $ extends p{constructor({result:s,url:e}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${y(e)}`,`Response: ${w(s)}`],name:"OffchainLookupResponseMalformedError"})}}class q extends p{constructor({sender:s,to:e}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${e}`,`OffchainLookup sender address: ${s}`],name:"OffchainLookupSenderMismatchError"})}}const D="0x556f1830",T={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function B(d,{blockNumber:s,blockTag:e,data:o,to:n}){const{args:c}=g({data:o,abi:[T]}),[t,i,l,a,r]=c,{ccipRead:f}=d,h=f&&typeof f?.request=="function"?f.request:C;try{if(!k(n,t))throw new q({sender:t,to:n});const u=i.includes(x)?await M({data:l,ccipRequest:h}):await h({data:l,sender:t,urls:i}),{data:b}=await L(d,{blockNumber:s,blockTag:e,data:O([a,R([{type:"bytes"},{type:"bytes"}],[u,r])]),to:n});return b}catch(u){throw new S({callbackSelector:a,cause:u,data:o,extraData:r,sender:t,urls:i})}}async function C({data:d,sender:s,urls:e}){let o=new Error("An unknown error occurred.");for(let n=0;n<e.length;n++){const c=e[n],t=c.includes("{data}")?"GET":"POST",i=t==="POST"?{data:d,sender:s}:void 0,l=t==="POST"?{"Content-Type":"application/json"}:{};try{const a=await fetch(c.replace("{sender}",s.toLowerCase()).replace("{data}",d),{body:JSON.stringify(i),headers:l,method:t});let r;if(a.headers.get("Content-Type")?.startsWith("application/json")?r=(await a.json()).data:r=await a.text(),!a.ok){o=new m({body:i,details:r?.error?w(r.error):a.statusText,headers:a.headers,status:a.status,url:c});continue}if(!E(r)){o=new $({result:r,url:c});continue}return r}catch(a){o=new m({body:i,details:a.message,url:c})}}throw o}export{C as ccipRequest,B as offchainLookup,T as offchainLookupAbiItem,D as offchainLookupSignature};
assets/data-capture-BE2wIBb4.js ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cJ as y,cD as $,cE as l,cB as S,cC as x,dr as m,cM as p,cT as f,cN as h,dd as u,cI as D,ds as E,dt as C}from"./index-C-6muS97.js";import{W as R}from"./index-DZaLz_HL.js";import{ReownAuthentication as v}from"./features-BVu6fTqe.js";const _=y`
2
+ .email-sufixes {
3
+ display: flex;
4
+ flex-direction: row;
5
+ gap: var(--wui-spacing-3xs);
6
+ overflow-x: auto;
7
+ max-width: 100%;
8
+ margin-top: var(--wui-spacing-s);
9
+ margin-bottom: calc(-1 * var(--wui-spacing-m));
10
+ padding-bottom: var(--wui-spacing-m);
11
+ margin-left: calc(-1 * var(--wui-spacing-m));
12
+ margin-right: calc(-1 * var(--wui-spacing-m));
13
+ padding-left: var(--wui-spacing-m);
14
+ padding-right: var(--wui-spacing-m);
15
+
16
+ &::-webkit-scrollbar {
17
+ display: none;
18
+ }
19
+ }
20
+ `;var O=function(r,t,i,a){var n=arguments.length,e=n<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,i):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,t,i,a);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(e=(n<3?o(e):n>3?o(t,i,e):o(t,i))||e);return n>3&&e&&Object.defineProperty(t,i,e),e};const I=["@gmail.com","@outlook.com","@yahoo.com","@hotmail.com","@aol.com","@icloud.com","@zoho.com"];let g=class extends ${constructor(){super(...arguments),this.email=""}render(){const t=I.filter(this.filter.bind(this)).map(this.item.bind(this));return t.length===0?null:l`<div class="email-sufixes">${t}</div>`}filter(t){if(!this.email)return!1;const i=this.email.split("@");if(i.length<2)return!0;const a=i.pop();return t.includes(a)&&t!==`@${a}`}item(t){return l`<wui-button variant="neutral" size="sm" @click=${()=>{const a=this.email.split("@");a.length>1&&a.pop();const n=a[0]+t;this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))}}
21
+ >${t}</wui-button
22
+ >`}};g.styles=[_];O([S()],g.prototype,"email",void 0);g=O([x("w3m-email-suffixes-widget")],g);const j=y`
23
+ .recent-emails {
24
+ display: flex;
25
+ flex-direction: column;
26
+ padding: var(--wui-spacing-s) 0;
27
+ border-top: 1px solid var(--wui-color-gray-glass-005);
28
+ border-bottom: 1px solid var(--wui-color-gray-glass-005);
29
+ }
30
+
31
+ .recent-emails-heading {
32
+ margin-bottom: var(--wui-spacing-s);
33
+ }
34
+
35
+ .recent-emails-list-item {
36
+ --wui-color-gray-glass-002: transparent;
37
+ }
38
+ `;var W=function(r,t,i,a){var n=arguments.length,e=n<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,i):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,t,i,a);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(e=(n<3?o(e):n>3?o(t,i,e):o(t,i))||e);return n>3&&e&&Object.defineProperty(t,i,e),e};let w=class extends ${constructor(){super(...arguments),this.emails=[]}render(){return this.emails.length===0?null:l`<div class="recent-emails">
39
+ <wui-text variant="micro-600" color="fg-200" class="recent-emails-heading"
40
+ >Recently used emails</wui-text
41
+ >
42
+ ${this.emails.map(this.item.bind(this))}
43
+ </div>`}item(t){return l`<wui-list-item
44
+ @click=${()=>{this.dispatchEvent(new CustomEvent("select",{detail:t,bubbles:!0,composed:!0}))}}
45
+ ?chevron=${!0}
46
+ icon="mail"
47
+ iconVariant="overlay"
48
+ class="recent-emails-list-item"
49
+ >
50
+ <wui-text variant="paragraph-500" color="fg-100">${t}</wui-text>
51
+ </wui-list-item>`}};w.styles=[j];W([S()],w.prototype,"emails",void 0);w=W([x("w3m-recent-emails-widget")],w);var A=function(r,t,i,a){var n=arguments.length,e=n<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,i):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,t,i,a);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(e=(n<3?o(e):n>3?o(t,i,e):o(t,i))||e);return n>3&&e&&Object.defineProperty(t,i,e),e};let b=class extends R{constructor(){super(...arguments),this.siwx=m.state.siwx,this.onOtpSubmit=async t=>{await this.siwx.confirmEmailOtp({code:t}),p.replace("SIWXSignMessage")},this.onOtpResend=async t=>{const i=f.getAccountData();if(!i?.caipAddress)throw new Error("No account data found");await this.siwx.requestEmailOtp({email:t,account:i.caipAddress})}}connectedCallback(){(!this.siwx||!(this.siwx instanceof v))&&h.showError("ReownAuthentication is not initialized."),super.connectedCallback()}shouldSubmitOnOtpChange(){return this.otp.length===R.OTP_LENGTH}};A([u()],b.prototype,"siwx",void 0);b=A([x("w3m-data-capture-otp-confirm-view")],b);const P=y`
52
+ .hero {
53
+ display: flex;
54
+ flex-direction: column;
55
+ align-items: center;
56
+ justify-content: center;
57
+ gap: var(--wui-spacing-3xs);
58
+
59
+ transition-property: margin, height;
60
+ transition-duration: var(--wui-duration-md);
61
+ transition-timing-function: var(--wui-ease-out-power-1);
62
+ margin-top: -100px;
63
+
64
+ &[data-state='loading'] {
65
+ margin-top: 0px;
66
+ }
67
+
68
+ position: relative;
69
+ &:after {
70
+ content: '';
71
+ position: absolute;
72
+ bottom: 0;
73
+ height: 252px;
74
+ width: 360px;
75
+ background: radial-gradient(
76
+ 96.11% 53.95% at 50% 51.28%,
77
+ transparent 0%,
78
+ color-mix(in srgb, var(--wui-color-bg-100) 5%, transparent) 49%,
79
+ color-mix(in srgb, var(--wui-color-bg-100) 65%, transparent) 99.43%
80
+ );
81
+ }
82
+ }
83
+
84
+ .hero-main-icon {
85
+ width: 176px;
86
+ transition-property: background-color;
87
+ transition-duration: var(--wui-duration-lg);
88
+ transition-timing-function: var(--wui-ease-out-power-1);
89
+
90
+ &[data-state='loading'] {
91
+ width: 56px;
92
+ }
93
+ }
94
+
95
+ .hero-row {
96
+ display: flex;
97
+ flex-direction: row;
98
+ align-items: center;
99
+ justify-content: center;
100
+ gap: var(--wui-spacing-3xs);
101
+ flex-wrap: nowrap;
102
+ min-width: fit-content;
103
+
104
+ &:nth-child(1) {
105
+ transform: translateX(-30px);
106
+ }
107
+
108
+ &:nth-child(2) {
109
+ transform: translateX(30px);
110
+ }
111
+
112
+ &:nth-child(4) {
113
+ transform: translateX(40px);
114
+ }
115
+
116
+ transition-property: height;
117
+ transition-duration: var(--wui-duration-md);
118
+ transition-timing-function: var(--wui-ease-out-power-1);
119
+ height: 68px;
120
+
121
+ &[data-state='loading'] {
122
+ height: 0px;
123
+ }
124
+ }
125
+
126
+ .hero-row-icon {
127
+ opacity: 0.1;
128
+ transition-property: opacity;
129
+ transition-duration: var(--wui-duration-md);
130
+ transition-timing-function: var(--wui-ease-out-power-1);
131
+
132
+ &[data-state='loading'] {
133
+ opacity: 0;
134
+ }
135
+ }
136
+ `;var d=function(r,t,i,a){var n=arguments.length,e=n<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,i):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,t,i,a);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(e=(n<3?o(e):n>3?o(t,i,e):o(t,i))||e);return n>3&&e&&Object.defineProperty(t,i,e),e};let c=class extends ${constructor(){super(...arguments),this.email=p.state.data?.email??f.getAccountData()?.user?.email??"",this.address=f.getAccountData()?.address??"",this.loading=!1,this.appName=m.state.metadata?.name??"AppKit",this.siwx=m.state.siwx,this.isRequired=Array.isArray(m.state.remoteFeatures?.emailCapture)&&m.state.remoteFeatures?.emailCapture.includes("required"),this.recentEmails=this.getRecentEmails()}connectedCallback(){(!this.siwx||!(this.siwx instanceof v))&&h.showError("ReownAuthentication is not initialized. Please contact support."),super.connectedCallback()}firstUpdated(){this.loading=!1,this.recentEmails=this.getRecentEmails(),this.email&&this.onSubmit()}render(){return l`
137
+ <wui-flex flexDirection="column" .padding=${["3xs","m","m","m"]} gap="l">
138
+ ${this.hero()} ${this.paragraph()} ${this.emailInput()} ${this.recentEmailsWidget()}
139
+ ${this.footerActions()}
140
+ </wui-flex>
141
+ `}hero(){return l`
142
+ <div class="hero" data-state=${this.loading?"loading":"default"}>
143
+ ${this.heroRow(["id","mail","wallet","x","solana","qrCode"])}
144
+ ${this.heroRow(["mail","farcaster","wallet","discord","mobile","qrCode"])}
145
+ <div class="hero-row">
146
+ ${this.heroIcon("github")} ${this.heroIcon("bank")}
147
+ <wui-icon-box
148
+ size="xl"
149
+ iconSize="xxl"
150
+ iconColor=${this.loading?"fg-100":"accent-100"}
151
+ backgroundColor=${this.loading?"fg-100":"accent-100"}
152
+ icon=${this.loading?"id":"user"}
153
+ isOpaque
154
+ class="hero-main-icon"
155
+ data-state=${this.loading?"loading":"default"}
156
+ >
157
+ </wui-icon-box>
158
+ ${this.heroIcon("id")} ${this.heroIcon("card")}
159
+ </div>
160
+ ${this.heroRow(["google","id","github","verify","apple","mobile"])}
161
+ </div>
162
+ `}heroRow(t){return l`
163
+ <div class="hero-row" data-state=${this.loading?"loading":"default"}>
164
+ ${t.map(this.heroIcon.bind(this))}
165
+ </div>
166
+ `}heroIcon(t){return l`
167
+ <wui-icon-box
168
+ size="xl"
169
+ iconSize="xxl"
170
+ iconColor="fg-100"
171
+ backgroundColor="fg-100"
172
+ icon=${t}
173
+ data-state=${this.loading?"loading":"default"}
174
+ isOpaque
175
+ class="hero-row-icon"
176
+ >
177
+ </wui-icon-box>
178
+ `}paragraph(){return this.loading?l`
179
+ <wui-text variant="paragraph-400" color="fg-200" align="center"
180
+ >We are verifying your account with email
181
+ <wui-text variant="paragraph-600" color="accent-100">${this.email}</wui-text> and address
182
+ <wui-text variant="paragraph-600" color="fg-100">
183
+ ${D.getTruncateString({string:this.address,charsEnd:4,charsStart:4,truncate:"middle"})} </wui-text
184
+ >, please wait a moment.</wui-text
185
+ >
186
+ `:this.isRequired?l`
187
+ <wui-text variant="paragraph-600" color="fg-100" align="center">
188
+ ${this.appName} requires your email for authentication.
189
+ </wui-text>
190
+ `:l`
191
+ <wui-flex flexDirection="column" gap="xs" alignItems="center">
192
+ <wui-text variant="paragraph-600" color="fg-100" align="center" size>
193
+ ${this.appName} would like to collect your email.
194
+ </wui-text>
195
+
196
+ <wui-text variant="small-400" color="fg-200" align="center">
197
+ Don't worry, it's optional&mdash;you can skip this step.
198
+ </wui-text>
199
+ </wui-flex>
200
+ `}emailInput(){if(this.loading)return null;const t=a=>{a.key==="Enter"&&this.onSubmit()},i=a=>{this.email=a.detail};return l`
201
+ <wui-flex flexDirection="column">
202
+ <wui-email-input
203
+ .value=${this.email}
204
+ .disabled=${this.loading}
205
+ @inputChange=${i}
206
+ @keydown=${t}
207
+ ></wui-email-input>
208
+
209
+ <w3m-email-suffixes-widget
210
+ .email=${this.email}
211
+ @change=${i}
212
+ ></w3m-email-suffixes-widget>
213
+ </wui-flex>
214
+ `}recentEmailsWidget(){if(this.recentEmails.length===0||this.loading)return null;const t=i=>{this.email=i.detail,this.onSubmit()};return l`
215
+ <w3m-recent-emails-widget
216
+ .emails=${this.recentEmails}
217
+ @select=${t}
218
+ ></w3m-recent-emails-widget>
219
+ `}footerActions(){return l`
220
+ <wui-flex flexDirection="row" fullWidth gap="s">
221
+ ${this.isRequired?null:l`<wui-button
222
+ size="lg"
223
+ variant="neutral"
224
+ fullWidth
225
+ .disabled=${this.loading}
226
+ @click=${this.onSkip.bind(this)}
227
+ >Skip this step</wui-button
228
+ >`}
229
+
230
+ <wui-button
231
+ size="lg"
232
+ variant="main"
233
+ type="submit"
234
+ fullWidth
235
+ .disabled=${!this.email||!this.isValidEmail(this.email)}
236
+ .loading=${this.loading}
237
+ @click=${this.onSubmit.bind(this)}
238
+ >
239
+ Continue
240
+ </wui-button>
241
+ </wui-flex>
242
+ `}async onSubmit(){if(!(this.siwx instanceof v)){h.showError("ReownAuthentication is not initialized. Please contact support.");return}const t=f.getActiveCaipAddress();if(!t)throw new Error("Account is not connected.");if(!this.isValidEmail(this.email)){h.showError("Please provide a valid email.");return}try{this.loading=!0;const i=await this.siwx.requestEmailOtp({email:this.email,account:t});this.pushRecentEmail(this.email),i.uuid===null?p.replace("SIWXSignMessage"):p.replace("DataCaptureOtpConfirm",{email:this.email})}catch{h.showError("Failed to send email OTP"),this.loading=!1}}onSkip(){p.replace("SIWXSignMessage")}getRecentEmails(){const t=E.getItem(C.RECENT_EMAILS);return(t?t.split(","):[]).filter(this.isValidEmail.bind(this)).slice(0,3)}pushRecentEmail(t){const i=this.getRecentEmails(),a=Array.from(new Set([t,...i])).slice(0,3);E.setItem(C.RECENT_EMAILS,a.join(","))}isValidEmail(t){return/^\S+@\S+\.\S+$/u.test(t)}};c.styles=[P];d([u()],c.prototype,"email",void 0);d([u()],c.prototype,"address",void 0);d([u()],c.prototype,"loading",void 0);d([u()],c.prototype,"appName",void 0);d([u()],c.prototype,"siwx",void 0);d([u()],c.prototype,"isRequired",void 0);d([u()],c.prototype,"recentEmails",void 0);c=d([x("w3m-data-capture-view")],c);export{b as W3mDataCaptureOtpConfirmView,c as W3mDataCaptureView,g as W3mEmailSuffixesWidget,w as W3mRecentEmailsWidget};
assets/email-C-LD4wEv.js ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cT as S,cO as g,dr as p,cQ as c,du as _,cM as s,cN as f,cV as C,cC as u,cy as D,cD as y,c$ as d,cE as m,dd as E,cJ as $,cF as W,cH as P,dv as N,cP as T}from"./index-C-6muS97.js";import{W as b}from"./index-DZaLz_HL.js";var F=function(a,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,e,t,r);else for(var l=a.length-1;l>=0;l--)(o=a[l])&&(i=(n<3?o(i):n>3?o(e,t,i):o(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};let I=class extends b{constructor(){super(...arguments),this.onOtpSubmit=async e=>{try{if(this.authConnector){const t=S.state.activeChain,r=g.getConnections(t),n=p.state.remoteFeatures?.multiWallet,i=r.length>0;if(await this.authConnector.provider.connectOtp({otp:e}),c.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),t)await g.connectExternal(this.authConnector,t);else throw new Error("Active chain is not set on ChainController");if(p.state.remoteFeatures?.emailCapture)return;if(p.state.siwx){_.close();return}if(i&&n){s.replace("ProfileWallets"),f.showSuccess("New Wallet Added");return}_.close()}}catch(t){throw c.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL",properties:{message:C.parseError(t)}}),t}},this.onOtpResend=async e=>{this.authConnector&&(await this.authConnector.provider.connectEmail({email:e}),c.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}))}}};I=F([u("w3m-email-verify-otp-view")],I);const U=D`
2
+ wui-icon-box {
3
+ height: ${({spacing:a})=>a[16]};
4
+ width: ${({spacing:a})=>a[16]};
5
+ }
6
+ `;var x=function(a,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,e,t,r);else for(var l=a.length-1;l>=0;l--)(o=a[l])&&(i=(n<3?o(i):n>3?o(e,t,i):o(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};let w=class extends y{constructor(){super(),this.email=s.state.data?.email,this.authConnector=d.getAuthConnector(),this.loading=!1,this.listenForDeviceApproval()}render(){if(!this.email)throw new Error("w3m-email-verify-device-view: No email provided");if(!this.authConnector)throw new Error("w3m-email-verify-device-view: No auth connector provided");return m`
7
+ <wui-flex
8
+ flexDirection="column"
9
+ alignItems="center"
10
+ .padding=${["6","3","6","3"]}
11
+ gap="4"
12
+ >
13
+ <wui-icon-box size="xl" color="accent-primary" icon="sealCheck"></wui-icon-box>
14
+
15
+ <wui-flex flexDirection="column" alignItems="center" gap="3">
16
+ <wui-flex flexDirection="column" alignItems="center">
17
+ <wui-text variant="md-regular" color="primary">
18
+ Approve the login link we sent to
19
+ </wui-text>
20
+ <wui-text variant="md-regular" color="primary"><b>${this.email}</b></wui-text>
21
+ </wui-flex>
22
+
23
+ <wui-text variant="sm-regular" color="secondary" align="center">
24
+ The code expires in 20 minutes
25
+ </wui-text>
26
+
27
+ <wui-flex alignItems="center" id="w3m-resend-section" gap="2">
28
+ <wui-text variant="sm-regular" color="primary" align="center">
29
+ Didn't receive it?
30
+ </wui-text>
31
+ <wui-link @click=${this.onResendCode.bind(this)} .disabled=${this.loading}>
32
+ Resend email
33
+ </wui-link>
34
+ </wui-flex>
35
+ </wui-flex>
36
+ </wui-flex>
37
+ `}async listenForDeviceApproval(){if(this.authConnector)try{await this.authConnector.provider.connectDevice(),c.sendEvent({type:"track",event:"DEVICE_REGISTERED_FOR_EMAIL"}),c.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}),s.replace("EmailVerifyOtp",{email:this.email})}catch{s.goBack()}}async onResendCode(){try{if(!this.loading){if(!this.authConnector||!this.email)throw new Error("w3m-email-login-widget: Unable to resend email");this.loading=!0,await this.authConnector.provider.connectEmail({email:this.email}),this.listenForDeviceApproval(),f.showSuccess("Code email resent")}}catch(e){f.showError(e)}finally{this.loading=!1}}};w.styles=U;x([E()],w.prototype,"loading",void 0);w=x([u("w3m-email-verify-device-view")],w);const j=$`
38
+ wui-email-input {
39
+ width: 100%;
40
+ }
41
+
42
+ form {
43
+ width: 100%;
44
+ display: block;
45
+ position: relative;
46
+ }
47
+ `;var O=function(a,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,e,t,r);else for(var l=a.length-1;l>=0;l--)(o=a[l])&&(i=(n<3?o(i):n>3?o(e,t,i):o(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};let h=class extends y{constructor(){super(...arguments),this.formRef=W(),this.initialEmail=s.state.data?.email??"",this.redirectView=s.state.data?.redirectView,this.email="",this.loading=!1}firstUpdated(){this.formRef.value?.addEventListener("keydown",e=>{e.key==="Enter"&&this.onSubmitEmail(e)})}render(){return m`
48
+ <wui-flex flexDirection="column" padding="4" gap="4">
49
+ <form ${P(this.formRef)} @submit=${this.onSubmitEmail.bind(this)}>
50
+ <wui-email-input
51
+ value=${this.initialEmail}
52
+ .disabled=${this.loading}
53
+ @inputChange=${this.onEmailInputChange.bind(this)}
54
+ >
55
+ </wui-email-input>
56
+ <input type="submit" hidden />
57
+ </form>
58
+ ${this.buttonsTemplate()}
59
+ </wui-flex>
60
+ `}onEmailInputChange(e){this.email=e.detail}async onSubmitEmail(e){try{if(this.loading)return;this.loading=!0,e.preventDefault();const t=d.getAuthConnector();if(!t)throw new Error("w3m-update-email-wallet: Auth connector not found");const r=await t.provider.updateEmail({email:this.email});c.sendEvent({type:"track",event:"EMAIL_EDIT"}),r.action==="VERIFY_SECONDARY_OTP"?s.push("UpdateEmailSecondaryOtp",{email:this.initialEmail,newEmail:this.email,redirectView:this.redirectView}):s.push("UpdateEmailPrimaryOtp",{email:this.initialEmail,newEmail:this.email,redirectView:this.redirectView})}catch(t){f.showError(t),this.loading=!1}}buttonsTemplate(){const e=!this.loading&&this.email.length>3&&this.email!==this.initialEmail;return this.redirectView?m`
61
+ <wui-flex gap="3">
62
+ <wui-button size="md" variant="neutral" fullWidth @click=${s.goBack}>
63
+ Cancel
64
+ </wui-button>
65
+
66
+ <wui-button
67
+ size="md"
68
+ variant="accent-primary"
69
+ fullWidth
70
+ @click=${this.onSubmitEmail.bind(this)}
71
+ .disabled=${!e}
72
+ .loading=${this.loading}
73
+ >
74
+ Save
75
+ </wui-button>
76
+ </wui-flex>
77
+ `:m`
78
+ <wui-button
79
+ size="md"
80
+ variant="accent-primary"
81
+ fullWidth
82
+ @click=${this.onSubmitEmail.bind(this)}
83
+ .disabled=${!e}
84
+ .loading=${this.loading}
85
+ >
86
+ Save
87
+ </wui-button>
88
+ `}};h.styles=j;O([E()],h.prototype,"email",void 0);O([E()],h.prototype,"loading",void 0);h=O([u("w3m-update-email-wallet-view")],h);var L=function(a,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,e,t,r);else for(var l=a.length-1;l>=0;l--)(o=a[l])&&(i=(n<3?o(i):n>3?o(e,t,i):o(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};let A=class extends b{constructor(){super(),this.email=s.state.data?.email,this.onOtpSubmit=async e=>{try{this.authConnector&&(await this.authConnector.provider.updateEmailPrimaryOtp({otp:e}),c.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),s.replace("UpdateEmailSecondaryOtp",s.state.data))}catch(t){throw c.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL",properties:{message:C.parseError(t)}}),t}},this.onStartOver=()=>{s.replace("UpdateEmailWallet",s.state.data)}}};A=L([u("w3m-update-email-primary-otp-view")],A);var M=function(a,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,e,t,r);else for(var l=a.length-1;l>=0;l--)(o=a[l])&&(i=(n<3?o(i):n>3?o(e,t,i):o(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};let R=class extends b{constructor(){super(),this.email=s.state.data?.newEmail,this.redirectView=s.state.data?.redirectView,this.onOtpSubmit=async e=>{try{this.authConnector&&(await this.authConnector.provider.updateEmailSecondaryOtp({otp:e}),c.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),this.redirectView&&s.reset(this.redirectView))}catch(t){throw c.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL",properties:{message:C.parseError(t)}}),t}},this.onStartOver=()=>{s.replace("UpdateEmailWallet",s.state.data)}}};R=M([u("w3m-update-email-secondary-otp-view")],R);var V=function(a,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,e,t,r);else for(var l=a.length-1;l>=0;l--)(o=a[l])&&(i=(n<3?o(i):n>3?o(e,t,i):o(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};let v=class extends y{constructor(){super(),this.authConnector=d.getAuthConnector(),this.isEmailEnabled=p.state.remoteFeatures?.email,this.isAuthEnabled=this.checkIfAuthEnabled(d.state.connectors),this.connectors=d.state.connectors,d.subscribeKey("connectors",e=>{this.connectors=e,this.isAuthEnabled=this.checkIfAuthEnabled(this.connectors)})}render(){if(!this.isEmailEnabled)throw new Error("w3m-email-login-view: Email is not enabled");if(!this.isAuthEnabled)throw new Error("w3m-email-login-view: No auth connector provided");return m`<wui-flex flexDirection="column" .padding=${["1","3","3","3"]} gap="4">
89
+ <w3m-email-login-widget></w3m-email-login-widget>
90
+ </wui-flex> `}checkIfAuthEnabled(e){const t=e.filter(n=>n.type===N.CONNECTOR_TYPE_AUTH).map(n=>n.chain);return T.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(n=>t.includes(n))}};V([E()],v.prototype,"connectors",void 0);v=V([u("w3m-email-login-view")],v);export{v as W3mEmailLoginView,b as W3mEmailOtpWidget,w as W3mEmailVerifyDeviceView,I as W3mEmailVerifyOtpView,A as W3mUpdateEmailPrimaryOtpView,R as W3mUpdateEmailSecondaryOtpView,h as W3mUpdateEmailWalletView};
assets/embedded-wallet-BV6kN2zP.js ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cJ as H,cD as g,du as W,dr as K,cE as c,c$ as _,db as V,dD as G,dd as d,cC as w,cy as R,cz as U,cA as Y,cB as l,cZ as N,cT as h,dE as j,cP as k,cR as C,cS as m,cO as L,dF as q,dc as X,cF as Q,dG as v,cV as z,dH as O,cH as Z,cQ as I,cN as J,dI as ee,cM as te}from"./index-C-6muS97.js";const ie=H`
2
+ div {
3
+ width: 100%;
4
+ }
5
+
6
+ [data-ready='false'] {
7
+ transform: scale(1.05);
8
+ }
9
+
10
+ @media (max-width: 430px) {
11
+ [data-ready='false'] {
12
+ transform: translateY(-50px);
13
+ }
14
+ }
15
+ `;var F=function(e,t,i,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};const P=600,M=360,oe=64;let E=class extends g{constructor(){super(),this.bodyObserver=void 0,this.unsubscribe=[],this.iframe=document.getElementById("w3m-iframe"),this.ready=!1,this.unsubscribe.push(W.subscribeKey("open",t=>{t||this.onHideIframe()}),W.subscribeKey("shake",t=>{t?this.iframe.style.animation="w3m-shake 500ms var(--apkt-easings-ease-out-power-2)":this.iframe.style.animation="none"}))}disconnectedCallback(){this.onHideIframe(),this.unsubscribe.forEach(t=>t()),this.bodyObserver?.unobserve(window.document.body)}async firstUpdated(){await this.syncTheme(),this.iframe.style.display="block";const t=this?.renderRoot?.querySelector("div");this.bodyObserver=new ResizeObserver(i=>{const r=i?.[0]?.contentBoxSize?.[0]?.inlineSize;this.iframe.style.height=`${P}px`,t.style.height=`${P}px`,K.state.enableEmbedded?this.updateFrameSizeForEmbeddedMode():r&&r<=430?(this.iframe.style.width="100%",this.iframe.style.left="0px",this.iframe.style.bottom="0px",this.iframe.style.top="unset",this.onShowIframe()):(this.iframe.style.width=`${M}px`,this.iframe.style.left=`calc(50% - ${M/2}px)`,this.iframe.style.top=`calc(50% - ${P/2}px + ${oe/2}px)`,this.iframe.style.bottom="unset",this.onShowIframe())}),this.bodyObserver.observe(window.document.body)}render(){return c`<div data-ready=${this.ready} id="w3m-frame-container"></div>`}onShowIframe(){const t=window.innerWidth<=430;this.ready=!0,this.iframe.style.animation=t?"w3m-iframe-zoom-in-mobile 200ms var(--apkt-easings-ease-out-power-2)":"w3m-iframe-zoom-in 200ms var(--apkt-easings-ease-out-power-2)"}onHideIframe(){this.iframe.style.display="none",this.iframe.style.animation="w3m-iframe-fade-out 200ms var(--apkt-easings-ease-out-power-2)"}async syncTheme(){const t=_.getAuthConnector();if(t){const i=V.getSnapshot().themeMode,n=V.getSnapshot().themeVariables;await t.provider.syncTheme({themeVariables:n,w3mThemeVariables:G(n,i)})}}async updateFrameSizeForEmbeddedMode(){const t=this?.renderRoot?.querySelector("div");await new Promise(n=>{setTimeout(n,300)});const i=this.getBoundingClientRect();t.style.width="100%",this.iframe.style.left=`${i.left}px`,this.iframe.style.top=`${i.top}px`,this.iframe.style.width=`${i.width}px`,this.iframe.style.height=`${i.height}px`,this.onShowIframe()}};E.styles=ie;F([d()],E.prototype,"ready",void 0);E=F([w("w3m-approve-transaction-view")],E);const ne=R`
16
+ a {
17
+ border: none;
18
+ border-radius: ${({borderRadius:e})=>e[20]};
19
+ display: flex;
20
+ flex-direction: row;
21
+ align-items: center;
22
+ padding: ${({spacing:e})=>e[1]};
23
+ transition:
24
+ background-color ${({durations:e})=>e.lg}
25
+ ${({easings:e})=>e["ease-out-power-2"]},
26
+ box-shadow ${({durations:e})=>e.lg}
27
+ ${({easings:e})=>e["ease-out-power-2"]},
28
+ border ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]};
29
+ will-change: background-color, box-shadow, border;
30
+ }
31
+
32
+ /* -- Variants --------------------------------------------------------------- */
33
+ a[data-type='success'] {
34
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
35
+ color: ${({tokens:e})=>e.core.textSuccess};
36
+ }
37
+
38
+ a[data-type='error'] {
39
+ background-color: ${({tokens:e})=>e.core.backgroundError};
40
+ color: ${({tokens:e})=>e.core.textError};
41
+ }
42
+
43
+ a[data-type='warning'] {
44
+ background-color: ${({tokens:e})=>e.core.backgroundWarning};
45
+ color: ${({tokens:e})=>e.core.textWarning};
46
+ }
47
+
48
+ /* -- Sizes --------------------------------------------------------------- */
49
+ a[data-size='sm'] {
50
+ height: 24px;
51
+ }
52
+
53
+ a[data-size='md'] {
54
+ height: 28px;
55
+ }
56
+
57
+ a[data-size='lg'] {
58
+ height: 32px;
59
+ }
60
+
61
+ a[data-size='sm'] > wui-image,
62
+ a[data-size='sm'] > wui-icon {
63
+ width: 16px;
64
+ height: 16px;
65
+ }
66
+
67
+ a[data-size='md'] > wui-image,
68
+ a[data-size='md'] > wui-icon {
69
+ width: 20px;
70
+ height: 20px;
71
+ }
72
+
73
+ a[data-size='lg'] > wui-image,
74
+ a[data-size='lg'] > wui-icon {
75
+ width: 24px;
76
+ height: 24px;
77
+ }
78
+
79
+ wui-text {
80
+ padding-left: ${({spacing:e})=>e[1]};
81
+ padding-right: ${({spacing:e})=>e[1]};
82
+ }
83
+
84
+ wui-image {
85
+ border-radius: ${({borderRadius:e})=>e[3]};
86
+ overflow: hidden;
87
+ user-drag: none;
88
+ user-select: none;
89
+ -moz-user-select: none;
90
+ -webkit-user-drag: none;
91
+ -webkit-user-select: none;
92
+ -ms-user-select: none;
93
+ }
94
+
95
+ /* -- States --------------------------------------------------------------- */
96
+ @media (hover: hover) and (pointer: fine) {
97
+ a[data-type='success']:not(:disabled):hover {
98
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
99
+ box-shadow: 0px 0px 0px 1px ${({tokens:e})=>e.core.borderSuccess};
100
+ }
101
+
102
+ a[data-type='error']:not(:disabled):hover {
103
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
104
+ box-shadow: 0px 0px 0px 1px ${({tokens:e})=>e.core.borderError};
105
+ }
106
+
107
+ a[data-type='warning']:not(:disabled):hover {
108
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
109
+ box-shadow: 0px 0px 0px 1px ${({tokens:e})=>e.core.borderWarning};
110
+ }
111
+ }
112
+
113
+ a[data-type='success']:not(:disabled):focus-visible {
114
+ box-shadow:
115
+ 0px 0px 0px 1px ${({tokens:e})=>e.core.backgroundAccentPrimary},
116
+ 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent020};
117
+ }
118
+
119
+ a[data-type='error']:not(:disabled):focus-visible {
120
+ box-shadow:
121
+ 0px 0px 0px 1px ${({tokens:e})=>e.core.backgroundAccentPrimary},
122
+ 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent020};
123
+ }
124
+
125
+ a[data-type='warning']:not(:disabled):focus-visible {
126
+ box-shadow:
127
+ 0px 0px 0px 1px ${({tokens:e})=>e.core.backgroundAccentPrimary},
128
+ 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent020};
129
+ }
130
+
131
+ a:disabled {
132
+ opacity: 0.5;
133
+ }
134
+ `;var y=function(e,t,i,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};const re={sm:"md-regular",md:"lg-regular",lg:"lg-regular"},se={success:"sealCheck",error:"warning",warning:"exclamationCircle"};let u=class extends g{constructor(){super(...arguments),this.type="success",this.size="md",this.imageSrc=void 0,this.disabled=!1,this.href="",this.text=void 0}render(){return c`
135
+ <a
136
+ rel="noreferrer"
137
+ target="_blank"
138
+ href=${this.href}
139
+ class=${this.disabled?"disabled":""}
140
+ data-type=${this.type}
141
+ data-size=${this.size}
142
+ >
143
+ ${this.imageTemplate()}
144
+ <wui-text variant=${re[this.size]} color="inherit">${this.text}</wui-text>
145
+ </a>
146
+ `}imageTemplate(){return this.imageSrc?c`<wui-image src=${this.imageSrc} size="inherit"></wui-image>`:c`<wui-icon
147
+ name=${se[this.type]}
148
+ weight="fill"
149
+ color="inherit"
150
+ size="inherit"
151
+ class="image-icon"
152
+ ></wui-icon>`}};u.styles=[U,Y,ne];y([l()],u.prototype,"type",void 0);y([l()],u.prototype,"size",void 0);y([l()],u.prototype,"imageSrc",void 0);y([l({type:Boolean})],u.prototype,"disabled",void 0);y([l()],u.prototype,"href",void 0);y([l()],u.prototype,"text",void 0);u=y([w("wui-semantic-chip")],u);var ae=function(e,t,i,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let B=class extends g{render(){return c`
153
+ <wui-flex flexDirection="column" alignItems="center" gap="5" padding="5">
154
+ <wui-text variant="md-regular" color="primary">Follow the instructions on</wui-text>
155
+ <wui-semantic-chip
156
+ icon="externalLink"
157
+ variant="fill"
158
+ text=${N.SECURE_SITE_DASHBOARD}
159
+ href=${N.SECURE_SITE_DASHBOARD}
160
+ imageSrc=${N.SECURE_SITE_FAVICON}
161
+ data-testid="w3m-secure-website-button"
162
+ >
163
+ </wui-semantic-chip>
164
+ <wui-text variant="sm-regular" color="secondary">
165
+ You will have to reconnect for security reasons
166
+ </wui-text>
167
+ </wui-flex>
168
+ `}};B=ae([w("w3m-upgrade-wallet-view")],B);var A=function(e,t,i,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let $=class extends g{constructor(){super(...arguments),this.loading=!1,this.switched=!1,this.text="",this.network=h.state.activeCaipNetwork}render(){return c`
169
+ <wui-flex flexDirection="column" gap="2" .padding=${["6","4","3","4"]}>
170
+ ${this.togglePreferredAccountTypeTemplate()} ${this.toggleSmartAccountVersionTemplate()}
171
+ </wui-flex>
172
+ `}toggleSmartAccountVersionTemplate(){return c`
173
+ <w3m-tooltip-trigger text="Changing the smart account version will reload the page">
174
+ <wui-list-item
175
+ icon=${this.isV6()?"arrowTop":"arrowBottom"}
176
+ ?rounded=${!0}
177
+ ?chevron=${!0}
178
+ data-testid="account-toggle-smart-account-version"
179
+ @click=${this.toggleSmartAccountVersion.bind(this)}
180
+ >
181
+ <wui-text variant="lg-regular" color="primary"
182
+ >Force Smart Account Version ${this.isV6()?"7":"6"}</wui-text
183
+ >
184
+ </wui-list-item>
185
+ </w3m-tooltip-trigger>
186
+ `}isV6(){return(j.get("dapp_smart_account_version")||"v6")==="v6"}toggleSmartAccountVersion(){j.set("dapp_smart_account_version",this.isV6()?"v7":"v6"),typeof window<"u"&&window?.location?.reload()}togglePreferredAccountTypeTemplate(){const t=this.network?.chainNamespace,i=h.checkIfSmartAccountEnabled(),n=_.getConnectorId(t);return!_.getAuthConnector()||n!==k.CONNECTOR_ID.AUTH||!i?null:(this.switched||(this.text=C(t)===m.ACCOUNT_TYPES.SMART_ACCOUNT?"Switch to your EOA":"Switch to your Smart Account"),c`
187
+ <wui-list-item
188
+ icon="swapHorizontal"
189
+ ?rounded=${!0}
190
+ ?chevron=${!0}
191
+ ?loading=${this.loading}
192
+ @click=${this.changePreferredAccountType.bind(this)}
193
+ data-testid="account-toggle-preferred-account-type"
194
+ >
195
+ <wui-text variant="lg-regular" color="primary">${this.text}</wui-text>
196
+ </wui-list-item>
197
+ `)}async changePreferredAccountType(){const t=this.network?.chainNamespace,i=h.checkIfSmartAccountEnabled(),n=C(t)===m.ACCOUNT_TYPES.SMART_ACCOUNT||!i?m.ACCOUNT_TYPES.EOA:m.ACCOUNT_TYPES.SMART_ACCOUNT;_.getAuthConnector()&&(this.loading=!0,await L.setPreferredAccountType(n,t),this.text=n===m.ACCOUNT_TYPES.SMART_ACCOUNT?"Switch to your EOA":"Switch to your Smart Account",this.switched=!0,q.resetSend(),this.loading=!1,this.requestUpdate())}};A([d()],$.prototype,"loading",void 0);A([d()],$.prototype,"switched",void 0);A([d()],$.prototype,"text",void 0);A([d()],$.prototype,"network",void 0);$=A([w("w3m-smart-account-settings-view")],$);const ce=R`
198
+ :host {
199
+ width: 100%;
200
+ }
201
+
202
+ button {
203
+ width: 100%;
204
+ display: flex;
205
+ justify-content: space-between;
206
+ align-items: center;
207
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
208
+ border-radius: ${({borderRadius:e})=>e[4]};
209
+ padding: ${({spacing:e})=>e[4]};
210
+ }
211
+
212
+ .name {
213
+ max-width: 75%;
214
+ overflow: hidden;
215
+ text-overflow: ellipsis;
216
+ white-space: nowrap;
217
+ }
218
+
219
+ @media (hover: hover) and (pointer: fine) {
220
+ button:hover:enabled {
221
+ cursor: pointer;
222
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
223
+ border-radius: ${({borderRadius:e})=>e[6]};
224
+ }
225
+ }
226
+
227
+ button:disabled {
228
+ opacity: 0.5;
229
+ cursor: default;
230
+ }
231
+
232
+ button:focus-visible:enabled {
233
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent040};
234
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
235
+ }
236
+ `;var T=function(e,t,i,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let b=class extends g{constructor(){super(...arguments),this.name="",this.registered=!1,this.loading=!1,this.disabled=!1}render(){return c`
237
+ <button ?disabled=${this.disabled}>
238
+ <wui-text class="name" color="primary" variant="md-regular">${this.name}</wui-text>
239
+ ${this.templateRightContent()}
240
+ </button>
241
+ `}templateRightContent(){return this.loading?c`<wui-loading-spinner size="lg" color="primary"></wui-loading-spinner>`:this.registered?c`<wui-tag variant="info" size="sm">Registered</wui-tag>`:c`<wui-tag variant="success" size="sm">Available</wui-tag>`}};b.styles=[U,Y,ce];T([l()],b.prototype,"name",void 0);T([l({type:Boolean})],b.prototype,"registered",void 0);T([l({type:Boolean})],b.prototype,"loading",void 0);T([l({type:Boolean})],b.prototype,"disabled",void 0);b=T([w("wui-account-name-suggestion-item")],b);const le=R`
242
+ :host {
243
+ position: relative;
244
+ width: 100%;
245
+ display: inline-block;
246
+ }
247
+
248
+ :host([disabled]) {
249
+ opacity: 0.5;
250
+ cursor: not-allowed;
251
+ }
252
+
253
+ .base-name {
254
+ position: absolute;
255
+ right: ${({spacing:e})=>e[4]};
256
+ top: 50%;
257
+ transform: translateY(-50%);
258
+ text-align: right;
259
+ padding: ${({spacing:e})=>e[1]};
260
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
261
+ border-radius: ${({borderRadius:e})=>e[1]};
262
+ }
263
+ `;var S=function(e,t,i,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let f=class extends g{constructor(){super(...arguments),this.disabled=!1,this.loading=!1}render(){return c`
264
+ <wui-input-text
265
+ value=${X(this.value)}
266
+ ?disabled=${this.disabled}
267
+ .value=${this.value||""}
268
+ data-testid="wui-ens-input"
269
+ icon="search"
270
+ inputRightPadding="5xl"
271
+ .onKeyDown=${this.onKeyDown}
272
+ ></wui-input-text>
273
+ `}};f.styles=[U,le];S([l()],f.prototype,"errorMessage",void 0);S([l({type:Boolean})],f.prototype,"disabled",void 0);S([l()],f.prototype,"value",void 0);S([l({type:Boolean})],f.prototype,"loading",void 0);S([l({attribute:!1})],f.prototype,"onKeyDown",void 0);f=S([w("wui-ens-input")],f);const de=R`
274
+ wui-flex {
275
+ width: 100%;
276
+ }
277
+
278
+ .suggestion {
279
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
280
+ border-radius: ${({borderRadius:e})=>e[4]};
281
+ }
282
+
283
+ .suggestion:hover:not(:disabled) {
284
+ cursor: pointer;
285
+ border: none;
286
+ width: 100%;
287
+ display: flex;
288
+ justify-content: space-between;
289
+ align-items: center;
290
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
291
+ border-radius: ${({borderRadius:e})=>e[6]};
292
+ padding: ${({spacing:e})=>e[4]};
293
+ }
294
+
295
+ .suggestion:disabled {
296
+ opacity: 0.5;
297
+ cursor: default;
298
+ }
299
+
300
+ .suggestion:focus-visible:not(:disabled) {
301
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent040};
302
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
303
+ }
304
+
305
+ .suggested-name {
306
+ max-width: 75%;
307
+ overflow: hidden;
308
+ text-overflow: ellipsis;
309
+ white-space: nowrap;
310
+ }
311
+
312
+ form {
313
+ width: 100%;
314
+ position: relative;
315
+ }
316
+
317
+ .input-submit-button,
318
+ .input-loading-spinner {
319
+ position: absolute;
320
+ top: 22px;
321
+ transform: translateY(-50%);
322
+ right: 10px;
323
+ }
324
+ `;var x=function(e,t,i,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let p=class extends g{constructor(){super(),this.formRef=Q(),this.usubscribe=[],this.name="",this.error="",this.loading=v.state.loading,this.suggestions=v.state.suggestions,this.profileName=h.getAccountData()?.profileName,this.onDebouncedNameInputChange=z.debounce(t=>{t.length<4?this.error="Name must be at least 4 characters long":O.isValidReownName(t)?(this.error="",v.getSuggestions(t)):this.error="The value is not a valid username"}),this.usubscribe.push(v.subscribe(t=>{this.suggestions=t.suggestions,this.loading=t.loading}),h.subscribeChainProp("accountState",t=>{this.profileName=t?.profileName,t?.profileName&&(this.error="You already own a name")}))}firstUpdated(){this.formRef.value?.addEventListener("keydown",this.onEnterKey.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.usubscribe.forEach(t=>t()),this.formRef.value?.removeEventListener("keydown",this.onEnterKey.bind(this))}render(){return c`
325
+ <wui-flex
326
+ flexDirection="column"
327
+ alignItems="center"
328
+ gap="4"
329
+ .padding=${["1","3","4","3"]}
330
+ >
331
+ <form ${Z(this.formRef)} @submit=${this.onSubmitName.bind(this)}>
332
+ <wui-ens-input
333
+ @inputChange=${this.onNameInputChange.bind(this)}
334
+ .errorMessage=${this.error}
335
+ .value=${this.name}
336
+ .onKeyDown=${this.onKeyDown.bind(this)}
337
+ >
338
+ </wui-ens-input>
339
+ ${this.submitButtonTemplate()}
340
+ <input type="submit" hidden />
341
+ </form>
342
+ ${this.templateSuggestions()}
343
+ </wui-flex>
344
+ `}submitButtonTemplate(){const t=this.suggestions.find(n=>n.name?.split(".")?.[0]===this.name&&n.registered);if(this.loading)return c`<wui-loading-spinner
345
+ class="input-loading-spinner"
346
+ color="secondary"
347
+ ></wui-loading-spinner>`;const i=`${this.name}${k.WC_NAME_SUFFIX}`;return c`
348
+ <wui-icon-link
349
+ ?disabled=${!!t}
350
+ class="input-submit-button"
351
+ size="sm"
352
+ icon="chevronRight"
353
+ iconColor=${t?"default":"accent-primary"}
354
+ @click=${()=>this.onSubmitName(i)}
355
+ >
356
+ </wui-icon-link>
357
+ `}onNameInputChange(t){const i=O.validateReownName(t.detail||"");this.name=i,this.onDebouncedNameInputChange(i)}onKeyDown(t){t.key.length===1&&!O.isValidReownName(t.key)&&t.preventDefault()}templateSuggestions(){return!this.name||this.name.length<4||this.error?null:c`<wui-flex flexDirection="column" gap="1" alignItems="center">
358
+ ${this.suggestions.map(t=>c`<wui-account-name-suggestion-item
359
+ name=${t.name}
360
+ ?registered=${t.registered}
361
+ ?loading=${this.loading}
362
+ ?disabled=${t.registered||this.loading}
363
+ data-testid="account-name-suggestion"
364
+ @click=${()=>this.onSubmitName(t.name)}
365
+ ></wui-account-name-suggestion-item>`)}
366
+ </wui-flex>`}isAllowedToSubmit(t){const i=t.split(".")?.[0],n=this.suggestions.find(r=>r.name?.split(".")?.[0]===i&&r.registered);return!this.loading&&!this.error&&!this.profileName&&i&&v.validateName(i)&&!n}async onSubmitName(t){try{if(!this.isAllowedToSubmit(t))return;I.sendEvent({type:"track",event:"REGISTER_NAME_INITIATED",properties:{isSmartAccount:C(h.state.activeChain)===m.ACCOUNT_TYPES.SMART_ACCOUNT,ensName:t}}),await v.registerName(t),I.sendEvent({type:"track",event:"REGISTER_NAME_SUCCESS",properties:{isSmartAccount:C(h.state.activeChain)===m.ACCOUNT_TYPES.SMART_ACCOUNT,ensName:t}})}catch(i){J.showError(i.message),I.sendEvent({type:"track",event:"REGISTER_NAME_ERROR",properties:{isSmartAccount:C(h.state.activeChain)===m.ACCOUNT_TYPES.SMART_ACCOUNT,ensName:t,error:z.parseError(i)}})}}onEnterKey(t){if(t.key==="Enter"&&this.name&&this.isAllowedToSubmit(this.name)){const i=`${this.name}${k.WC_NAME_SUFFIX}`;this.onSubmitName(i)}}};p.styles=de;x([l()],p.prototype,"errorMessage",void 0);x([d()],p.prototype,"name",void 0);x([d()],p.prototype,"error",void 0);x([d()],p.prototype,"loading",void 0);x([d()],p.prototype,"suggestions",void 0);x([d()],p.prototype,"profileName",void 0);p=x([w("w3m-register-account-name-view")],p);const ue=H`
367
+ .continue-button-container {
368
+ width: 100%;
369
+ }
370
+ `;var pe=function(e,t,i,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let D=class extends g{render(){return c`
371
+ <wui-flex
372
+ flexDirection="column"
373
+ alignItems="center"
374
+ gap="6"
375
+ .padding=${["0","0","4","0"]}
376
+ >
377
+ ${this.onboardingTemplate()} ${this.buttonsTemplate()}
378
+ <wui-link
379
+ @click=${()=>{z.openHref(ee.URLS.FAQ,"_blank")}}
380
+ >
381
+ Learn more
382
+ <wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon>
383
+ </wui-link>
384
+ </wui-flex>
385
+ `}onboardingTemplate(){return c` <wui-flex
386
+ flexDirection="column"
387
+ gap="6"
388
+ alignItems="center"
389
+ .padding=${["0","6","0","6"]}
390
+ >
391
+ <wui-flex gap="3" alignItems="center" justifyContent="center">
392
+ <wui-icon-box size="xl" color="success" icon="checkmark"></wui-icon-box>
393
+ </wui-flex>
394
+ <wui-flex flexDirection="column" alignItems="center" gap="3">
395
+ <wui-text align="center" variant="md-medium" color="primary">
396
+ Account name chosen successfully
397
+ </wui-text>
398
+ <wui-text align="center" variant="md-regular" color="primary">
399
+ You can now fund your account and trade crypto
400
+ </wui-text>
401
+ </wui-flex>
402
+ </wui-flex>`}buttonsTemplate(){return c`<wui-flex
403
+ .padding=${["0","4","0","4"]}
404
+ gap="3"
405
+ class="continue-button-container"
406
+ >
407
+ <wui-button fullWidth size="lg" borderRadius="xs" @click=${this.redirectToAccount.bind(this)}
408
+ >Let's Go!
409
+ </wui-button>
410
+ </wui-flex>`}redirectToAccount(){te.replace("Account")}};D.styles=ue;D=pe([w("w3m-register-account-name-success-view")],D);export{E as W3mApproveTransactionView,D as W3mRegisterAccountNameSuccess,p as W3mRegisterAccountNameView,$ as W3mSmartAccountSettingsView,B as W3mUpgradeWalletView};
assets/features-BVu6fTqe.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import{cT as l,fv as k,dt as g,fw as S,cP as f,ds as d,cU as A,dw as N}from"./index-C-6muS97.js";class m{constructor(e){this.getNonce=e.getNonce}async createMessage(e){const t={accountAddress:e.accountAddress,chainId:e.chainId,version:"1",domain:typeof document>"u"?"Unknown Domain":document.location.host,uri:typeof document>"u"?"Unknown URI":document.location.href,resources:this.resources,nonce:await this.getNonce(e),issuedAt:this.stringifyDate(new Date),statement:void 0,expirationTime:void 0,notBefore:void 0};return Object.assign(t,{toString:()=>this.stringify(t)})}stringify(e){const t=this.getNetworkName(e.chainId);return[`${e.domain} wants you to sign in with your ${t} account:`,e.accountAddress,e.statement?`
2
+ ${e.statement}
3
+ `:"",`URI: ${e.uri}`,`Version: ${e.version}`,`Chain ID: ${e.chainId}`,`Nonce: ${e.nonce}`,e.issuedAt&&`Issued At: ${e.issuedAt}`,e.expirationTime&&`Expiration Time: ${e.expirationTime}`,e.notBefore&&`Not Before: ${e.notBefore}`,e.requestId&&`Request ID: ${e.requestId}`,e.resources?.length&&e.resources.reduce((s,n)=>`${s}
4
+ - ${n}`,"Resources:")].filter(s=>typeof s=="string").join(`
5
+ `).trim()}getNetworkName(e){const t=l.getAllRequestedCaipNetworks();return k.getNetworkNameByCaipNetworkId(t,e)}stringifyDate(e){return e.toISOString()}}class T{constructor(e={}){this.otpUuid=null,this.listeners={sessionChanged:[]},this.localAuthStorageKey=e.localAuthStorageKey||g.SIWX_AUTH_TOKEN,this.localNonceStorageKey=e.localNonceStorageKey||g.SIWX_NONCE_TOKEN,this.required=e.required??!0,this.messenger=new m({getNonce:this.getNonce.bind(this)})}async createMessage(e){return this.messenger.createMessage(e)}async addSession(e){const t=await this.request({method:"POST",key:"authenticate",body:{data:e.data,message:e.message,signature:e.signature,clientId:this.getClientId(),walletInfo:this.getWalletInfo()},headers:["nonce","otp"]});this.setStorageToken(t.token,this.localAuthStorageKey),this.emit("sessionChanged",e),this.setAppKitAccountUser(p(t.token)),this.otpUuid=null}async getSessions(e,t){try{if(!this.getStorageToken(this.localAuthStorageKey))return[];const s=await this.request({method:"GET",key:"me",query:{},headers:["auth"]});if(!s)return[];const n=s.address.toLowerCase()===t.toLowerCase(),o=s.caip2Network===e;if(!n||!o)return[];const r={data:{accountAddress:s.address,chainId:s.caip2Network},message:"",signature:""};return this.emit("sessionChanged",r),this.setAppKitAccountUser(s),[r]}catch{return[]}}async revokeSession(e,t){return Promise.resolve(this.clearStorageTokens())}async setSessions(e){if(e.length===0)this.clearStorageTokens();else{const t=e.find(s=>s.data.chainId===S()?.caipNetworkId)||e[0];await this.addSession(t)}}getRequired(){return this.required}async getSessionAccount(){if(!this.getStorageToken(this.localAuthStorageKey))throw new Error("Not authenticated");return this.request({method:"GET",key:"me",body:void 0,query:{includeAppKitAccount:!0},headers:["auth"]})}async setSessionAccountMetadata(e=null){if(!this.getStorageToken(this.localAuthStorageKey))throw new Error("Not authenticated");return this.request({method:"PUT",key:"account-metadata",body:{metadata:e},headers:["auth"]})}on(e,t){return this.listeners[e].push(t),()=>{this.listeners[e]=this.listeners[e].filter(s=>s!==t)}}removeAllListeners(){Object.keys(this.listeners).forEach(t=>{this.listeners[t]=[]})}async requestEmailOtp({email:e,account:t}){const s=await this.request({method:"POST",key:"otp",body:{email:e,account:t}});return this.otpUuid=s.uuid,this.messenger.resources=[`email:${e}`],s}confirmEmailOtp({code:e}){return this.request({method:"PUT",key:"otp",body:{code:e},headers:["otp"]})}async request({method:e,key:t,query:s,body:n,headers:o}){const{projectId:r,st:y,sv:w}=this.getSDKProperties(),a=new URL(`${f.W3M_API_URL}/auth/v1/${String(t)}`);a.searchParams.set("projectId",r),a.searchParams.set("st",y),a.searchParams.set("sv",w),s&&Object.entries(s).forEach(([i,h])=>a.searchParams.set(i,String(h)));const c=await fetch(a,{method:e,body:n?JSON.stringify(n):void 0,headers:Array.isArray(o)?o.reduce((i,h)=>{switch(h){case"nonce":i["x-nonce-jwt"]=`Bearer ${this.getStorageToken(this.localNonceStorageKey)}`;break;case"auth":i.Authorization=`Bearer ${this.getStorageToken(this.localAuthStorageKey)}`;break;case"otp":this.otpUuid&&(i["x-otp"]=this.otpUuid);break}return i},{}):void 0});if(!c.ok)throw new Error(await c.text());return c.headers.get("content-type")?.includes("application/json")?c.json():null}getStorageToken(e){return d.getItem(e)}setStorageToken(e,t){d.setItem(t,e)}clearStorageTokens(){this.otpUuid=null,d.removeItem(this.localAuthStorageKey),d.removeItem(this.localNonceStorageKey),this.emit("sessionChanged",void 0)}async getNonce(){const{nonce:e,token:t}=await this.request({method:"GET",key:"nonce"});return this.setStorageToken(t,this.localNonceStorageKey),e}getClientId(){return A.state.clientId}getWalletInfo(){const e=l.getAccountData()?.connectedWalletInfo;if(!e)return;if("social"in e&&"identifier"in e){const o=e.social,r=e.identifier;return{type:"social",social:o,identifier:r}}const{name:t,icon:s}=e;let n="unknown";switch(e.type){case"EXTERNAL":case"INJECTED":case"ANNOUNCED":n="extension";break;case"WALLET_CONNECT":n="walletconnect";break;default:n="unknown"}return{type:n,name:t,icon:s}}getSDKProperties(){return N._getSdkProperties()}emit(e,t){this.listeners[e].forEach(s=>s(t))}setAppKitAccountUser(e){const{email:t}=e;t&&Object.values(f.CHAIN).forEach(s=>{l.setAccountProp("user",{email:t},s)})}}function p(u){const e=u.split(".");if(e.length!==3)throw new Error("Invalid token");const t=e[1];if(typeof t!="string")throw new Error("Invalid token");const s=t.replace(/-/gu,"+").replace(/_/gu,"/"),n=s.padEnd(s.length+(4-s.length%4)%4,"=");return JSON.parse(atob(n))}export{T as ReownAuthentication,m as ReownAuthenticationMessenger};
assets/hashTypedData-BUyxnl-E.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{ck as g,b5 as $,cf as y,bb as l,bZ as c,B as u,cl as z,di as k,c2 as H,bW as j,a0 as A,dj as B,x as N,br as I,cq as v}from"./index-C-6muS97.js";const O=`Ethereum Signed Message:
2
+ `;function W(e){const t=typeof e=="string"?g(e):typeof e.raw=="string"?e.raw:$(e.raw),n=g(`${O}${y(t)}`);return l([n,t])}function Q(e,t){return c(W(e),t)}class C extends u{constructor({domain:t}){super(`Invalid domain "${z(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class R extends u{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class F extends u{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function V(e){const{domain:t,message:n,primaryType:s,types:a}=e,r=(i,d)=>{for(const D of i){const{name:P,type:p}=D,o=d[P],m=p.match(k);if(m&&(typeof o=="number"||typeof o=="bigint")){const[S,f,M]=m;H(o,{signed:f==="int",size:Number.parseInt(M,10)/8})}if(p==="address"&&typeof o=="string"&&!j(o))throw new A({address:o});const h=p.match(B);if(h){const[S,f]=h;if(f&&y(o)!==Number.parseInt(f,10))throw new N({expectedSize:Number.parseInt(f,10),givenSize:y(o)})}const b=a[p];b&&(J(p),r(b,o))}};if(a.EIP712Domain&&t){if(typeof t!="object")throw new C({domain:t});r(a.EIP712Domain,t)}if(s!=="EIP712Domain")if(a[s])r(a[s],n);else throw new R({primaryType:s,types:a})}function q({domain:e}){return[typeof e?.name=="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},(typeof e?.chainId=="number"||typeof e?.chainId=="bigint")&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function J(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new F({type:e})}function U(e){const{domain:t={},message:n,primaryType:s}=e,a={EIP712Domain:q({domain:t}),...e.types};V({domain:t,message:n,primaryType:s,types:a});const r=["0x1901"];return t&&r.push(Z({domain:t,types:a})),s!=="EIP712Domain"&&r.push(x({data:n,primaryType:s,types:a})),c(l(r))}function Z({domain:e,types:t}){return x({data:e,primaryType:"EIP712Domain",types:t})}function x({data:e,primaryType:t,types:n}){const s=T({data:e,primaryType:t,types:n});return c(s)}function T({data:e,primaryType:t,types:n}){const s=[{type:"bytes32"}],a=[G({primaryType:t,types:n})];for(const r of n[t]){const[i,d]=w({types:n,name:r.name,type:r.type,value:e[r.name]});s.push(i),a.push(d)}return I(s,a)}function G({primaryType:e,types:t}){const n=v(K({primaryType:e,types:t}));return c(n)}function K({primaryType:e,types:t}){let n="";const s=E({primaryType:e,types:t});s.delete(e);const a=[e,...Array.from(s).sort()];for(const r of a)n+=`${r}(${t[r].map(({name:i,type:d})=>`${d} ${i}`).join(",")})`;return n}function E({primaryType:e,types:t},n=new Set){const a=e.match(/^\w*/u)?.[0];if(n.has(a)||t[a]===void 0)return n;n.add(a);for(const r of t[a])E({primaryType:r.type,types:t},n);return n}function w({types:e,name:t,type:n,value:s}){if(e[n]!==void 0)return[{type:"bytes32"},c(T({data:s,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},c(s)];if(n==="string")return[{type:"bytes32"},c(v(s))];if(n.lastIndexOf("]")===n.length-1){const a=n.slice(0,n.lastIndexOf("[")),r=s.map(i=>w({name:t,type:a,types:e,value:i}));return[{type:"bytes32"},c(I(r.map(([i])=>i),r.map(([,i])=>i)))]}return[{type:n},s]}export{C as I,R as a,F as b,Q as c,x as d,U as e,q as g,Z as h,O as p,W as t,V as v};
assets/index-BAgbKtO2.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Ka6fShes.js","assets/index-C-6muS97.js","assets/parseSignature-DIfAupLd.js","assets/localBatchGatewayRequest-BpO1N93o.js","assets/secp256k1-BP3xnA4u.js","assets/hashTypedData-BUyxnl-E.js","assets/index-D-BMLSsJ.js","assets/index-My90LZL7.js","assets/index-wM56buvO.js"])))=>i.map(i=>d[i]);
2
+ import{d3 as A,bJ as l,aE as b,d4 as _,c2 as m,aX as y,d5 as C,d6 as v,cx as E}from"./index-C-6muS97.js";import{d7 as k}from"./index-C-6muS97.js";function L(h={}){let p,a,c,o;return A(n=>({id:"baseAccount",name:"Base Account",rdns:"app.base.account",type:"baseAccount",async connect({chainId:e,withCapabilities:t,...i}={}){try{const r=await this.getProvider(),s=e??n.chains[0]?.id;if(!s)throw new _;let{accounts:u,currentChainId:f}=await(async()=>{if(i.isReconnecting)return{accounts:(await r.request({method:"eth_accounts",params:[]})).map(d=>({address:l(d)})),currentChainId:await this.getChainId()};const w=await r.request({method:"wallet_connect",params:[{capabilities:"capabilities"in i&&i.capabilities?i.capabilities:{},chainIds:[m(s),...n.chains.filter(d=>d.id!==s).map(d=>m(d.id))]}]});return{accounts:(await r.request({method:"eth_accounts"})).map(d=>w.accounts.find(P=>P.address===d)??{address:d}).map(d=>({address:l(d.address),capabilities:d.capabilities??{}})),currentChainId:Number(w.chainIds[0])}})();return a||(a=this.onAccountsChanged.bind(this),r.on("accountsChanged",a)),c||(c=this.onChainChanged.bind(this),r.on("chainChanged",c)),o||(o=this.onDisconnect.bind(this),r.on("disconnect",o)),e&&f!==e&&(f=(await this.switchChain({chainId:e}).catch(g=>{if(g.code===y.code)throw g;return{id:f}}))?.id??f),{accounts:t?u:u.map(w=>w.address),chainId:f}}catch(r){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(r.message)?new y(r):r}},async disconnect(){const e=await this.getProvider();a&&(e.removeListener("accountsChanged",a),a=void 0),c&&(e.removeListener("chainChanged",c),c=void 0),o&&(e.removeListener("disconnect",o),o=void 0),e.disconnect()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(t=>l(t))},async getChainId(){const t=await(await this.getProvider()).request({method:"eth_chainId"});return Number(t)},async getProvider(){if(!p){const e=typeof h.preference=="string"?{options:h.preference}:{...h.preference,options:h.preference?.options??"all"},{createBaseAccountSDK:t}=await(()=>{try{return C(()=>import("./index-Ka6fShes.js"),__vite__mapDeps([0,1,2,3,4,5]))}catch{throw new Error('dependency "@base-org/account" not found')}})();p=t({...h,appChainIds:n.chains.map(r=>r.id),preference:e}).getProvider()}return p},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){const i=n.chains.find(s=>s.id===t);if(!i)throw new b(new _);const r=await this.getProvider();try{return await r.request({method:"wallet_switchEthereumChain",params:[{chainId:m(i.id)}]}),i}catch(s){if(s.code===4902)try{let u;e?.blockExplorerUrls?u=e.blockExplorerUrls:u=i.blockExplorers?.default.url?[i.blockExplorers?.default.url]:[];let f;e?.rpcUrls?.length?f=e.rpcUrls:f=[i.rpcUrls.default?.http[0]??""];const w={blockExplorerUrls:u,chainId:m(t),chainName:e?.chainName??i.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??i.nativeCurrency,rpcUrls:f};return await r.request({method:"wallet_addEthereumChain",params:[w]}),i}catch(u){throw new y(u)}throw new b(s)}},onAccountsChanged(e){e.length===0?this.onDisconnect():n.emitter.emit("change",{accounts:e.map(t=>l(t))})},onChainChanged(e){const t=Number(e);n.emitter.emit("change",{chainId:t})},async onDisconnect(e){n.emitter.emit("disconnect");const t=await this.getProvider();a&&(t.removeListener("accountsChanged",a),a=void 0),c&&(t.removeListener("chainChanged",c),c=void 0),o&&(t.removeListener("disconnect",o),o=void 0)}}))}I.type="safe";function I(h={}){const{shimDisconnect:p=!1}=h;let a,c;return A(o=>({id:"safe",name:"Safe",type:I.type,async connect({withCapabilities:n}={}){const e=await this.getProvider();if(!e)throw new v;const t=await this.getAccounts(),i=await this.getChainId();return c||(c=this.onDisconnect.bind(this),e.on("disconnect",c)),p&&await o.storage?.removeItem("safe.disconnected"),{accounts:n?t.map(r=>({address:r,capabilities:{}})):t,chainId:i}},async disconnect(){const n=await this.getProvider();if(!n)throw new v;c&&(n.removeListener("disconnect",c),c=void 0),p&&await o.storage?.setItem("safe.disconnected",!0)},async getAccounts(){const n=await this.getProvider();if(!n)throw new v;return(await n.request({method:"eth_accounts"})).map(l)},async getProvider(){if(typeof window<"u"&&window?.parent!==window){if(!a){const{default:e}=await(()=>{try{return C(()=>import("./index-D-BMLSsJ.js"),__vite__mapDeps([6,7,1,5]))}catch{throw new Error('dependency "@safe-global/safe-apps-sdk" not found')}})(),t=new e(h),i=await E(()=>t.safe.getInfo(),{timeout:h.unstable_getInfoTimeout??10});if(!i)throw new Error("Could not load Safe information");const r=await(async()=>{const s=await(()=>{try{return C(()=>import("./index-wM56buvO.js").then(u=>u.i),__vite__mapDeps([8,1,7]))}catch{throw new Error('dependency "@safe-global/safe-apps-provider" not found')}})();return typeof s.SafeAppProvider!="function"&&typeof s.default.SafeAppProvider=="function"?s.default.SafeAppProvider:s.SafeAppProvider})();a=new r(i,t)}return a}},async getChainId(){const n=await this.getProvider();if(!n)throw new v;return Number(n.chainId)},async isAuthorized(){try{return p&&await o.storage?.getItem("safe.disconnected")?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){o.emitter.emit("disconnect")}}))}export{L as baseAccount,k as injected,I as safe};
assets/index-BnHyc7bS.js ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as d,cz as c,cA as m,cB as r,cC as f,cD as v,cF as y,cG as b,cE as h,cH as g,cI as w}from"./index-C-6muS97.js";const x=d`
2
+ :host {
3
+ position: relative;
4
+ display: inline-block;
5
+ }
6
+
7
+ :host([data-error='true']) > input {
8
+ color: ${({tokens:t})=>t.core.textError};
9
+ }
10
+
11
+ :host([data-error='false']) > input {
12
+ color: ${({tokens:t})=>t.theme.textPrimary};
13
+ }
14
+
15
+ input {
16
+ background: transparent;
17
+ height: auto;
18
+ box-sizing: border-box;
19
+ color: ${({tokens:t})=>t.theme.textPrimary};
20
+ font-feature-settings: 'case' on;
21
+ font-size: ${({textSize:t})=>t.h4};
22
+ caret-color: ${({tokens:t})=>t.core.backgroundAccentPrimary};
23
+ line-height: ${({typography:t})=>t["h4-regular-mono"].lineHeight};
24
+ letter-spacing: ${({typography:t})=>t["h4-regular-mono"].letterSpacing};
25
+ -webkit-appearance: none;
26
+ -moz-appearance: textfield;
27
+ padding: 0px;
28
+ font-family: ${({fontFamily:t})=>t.mono};
29
+ }
30
+
31
+ :host([data-width-variant='auto']) input {
32
+ width: 100%;
33
+ }
34
+
35
+ :host([data-width-variant='fit']) input {
36
+ width: 1ch;
37
+ }
38
+
39
+ .wui-input-amount-fit-mirror {
40
+ position: absolute;
41
+ visibility: hidden;
42
+ white-space: pre;
43
+ font-size: var(--local-font-size);
44
+ line-height: 130%;
45
+ letter-spacing: -1.28px;
46
+ font-family: ${({fontFamily:t})=>t.mono};
47
+ }
48
+
49
+ .wui-input-amount-fit-width {
50
+ display: inline-block;
51
+ position: relative;
52
+ }
53
+
54
+ input::-webkit-outer-spin-button,
55
+ input::-webkit-inner-spin-button {
56
+ -webkit-appearance: none;
57
+ margin: 0;
58
+ }
59
+
60
+ input::placeholder {
61
+ color: ${({tokens:t})=>t.theme.textSecondary};
62
+ }
63
+ `;var a=function(t,e,n,s){var p=arguments.length,o=p<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(l=t[u])&&(o=(p<3?l(o):p>3?l(e,n,o):l(e,n))||o);return p>3&&o&&Object.defineProperty(e,n,o),o};let i=class extends v{constructor(){super(...arguments),this.inputElementRef=y(),this.disabled=!1,this.value="",this.placeholder="0",this.widthVariant="auto",this.maxDecimals=void 0,this.maxIntegers=void 0,this.fontSize="h4",this.error=!1}firstUpdated(){this.resizeInput()}updated(){this.style.setProperty("--local-font-size",b.textSize[this.fontSize]),this.resizeInput()}render(){return this.dataset.widthVariant=this.widthVariant,this.dataset.error=String(this.error),this.inputElementRef?.value&&this.value&&(this.inputElementRef.value.value=this.value),this.widthVariant==="auto"?this.inputTemplate():h`
64
+ <div class="wui-input-amount-fit-width">
65
+ <span class="wui-input-amount-fit-mirror"></span>
66
+ ${this.inputTemplate()}
67
+ </div>
68
+ `}inputTemplate(){return h`<input
69
+ ${g(this.inputElementRef)}
70
+ type="text"
71
+ inputmode="decimal"
72
+ pattern="[0-9,.]*"
73
+ placeholder=${this.placeholder}
74
+ ?disabled=${this.disabled}
75
+ autofocus
76
+ value=${this.value??""}
77
+ @input=${this.dispatchInputChangeEvent.bind(this)}
78
+ />`}dispatchInputChangeEvent(){this.inputElementRef.value&&(this.inputElementRef.value.value=w.maskInput({value:this.inputElementRef.value.value,decimals:this.maxDecimals,integers:this.maxIntegers}),this.dispatchEvent(new CustomEvent("inputChange",{detail:this.inputElementRef.value.value,bubbles:!0,composed:!0})),this.resizeInput())}resizeInput(){if(this.widthVariant==="fit"){const e=this.inputElementRef.value;if(e){const n=e.previousElementSibling;n&&(n.textContent=e.value||"0",e.style.width=`${n.offsetWidth}px`)}}}};i.styles=[c,m,x];a([r({type:Boolean})],i.prototype,"disabled",void 0);a([r({type:String})],i.prototype,"value",void 0);a([r({type:String})],i.prototype,"placeholder",void 0);a([r({type:String})],i.prototype,"widthVariant",void 0);a([r({type:Number})],i.prototype,"maxDecimals",void 0);a([r({type:Number})],i.prototype,"maxIntegers",void 0);a([r({type:String})],i.prototype,"fontSize",void 0);a([r({type:Boolean})],i.prototype,"error",void 0);i=a([f("wui-input-amount")],i);
assets/index-C-6muS97.js ADDED
The diff for this file is too large to render. See raw diff
 
assets/index-D-BMLSsJ.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{r as k}from"./index-My90LZL7.js";import{bt as w}from"./index-C-6muS97.js";import{c as I,e as q}from"./hashTypedData-BUyxnl-E.js";const v=()=>"9.1.0",C=t=>t.toString(16).padStart(2,"0"),R=t=>{const e=new Uint8Array(t/2);return window.crypto.getRandomValues(e),Array.from(e,C).join("")},E=()=>typeof window<"u"?R(10):new Date().getTime().toString(36);class g{}g.makeRequest=(t,e)=>({id:E(),method:t,params:e,env:{sdkVersion:v()}});g.makeResponse=(t,e,s)=>({id:t,success:!0,version:s,data:e});g.makeErrorResponse=(t,e,s)=>({id:t,success:!1,error:e,version:s});var r;(function(t){t.sendTransactions="sendTransactions",t.rpcCall="rpcCall",t.getChainInfo="getChainInfo",t.getSafeInfo="getSafeInfo",t.getTxBySafeTxHash="getTxBySafeTxHash",t.getSafeBalances="getSafeBalances",t.signMessage="signMessage",t.signTypedMessage="signTypedMessage",t.getEnvironmentInfo="getEnvironmentInfo",t.getOffChainSignature="getOffChainSignature",t.requestAddressBook="requestAddressBook",t.wallet_getPermissions="wallet_getPermissions",t.wallet_requestPermissions="wallet_requestPermissions"})(r||(r={}));var f;(function(t){t.requestAddressBook="requestAddressBook"})(f||(f={}));class H{constructor(e=null,s=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:a,data:n,source:i})=>{const o=!n,l=!this.isServer&&i===window.parent,u=typeof n.version<"u"&&parseInt(n.version.split(".")[0]),B=typeof u=="number"&&u>=1;let y=!0;return Array.isArray(this.allowedOrigins)&&(y=this.allowedOrigins.find(P=>P.test(a))!==void 0),!o&&l&&B&&y},this.logIncomingMessage=a=>{console.info(`Safe Apps SDK v1: A message was received from origin ${a.origin}. `,a.data)},this.onParentMessage=a=>{this.isValidMessage(a)&&(this.debugMode&&this.logIncomingMessage(a),this.handleIncomingMessage(a.data))},this.handleIncomingMessage=a=>{const{id:n}=a,i=this.callbacks.get(n);i&&(i(a),this.callbacks.delete(n))},this.send=(a,n)=>{const i=g.makeRequest(a,n);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(i,"*"),new Promise((o,l)=>{this.callbacks.set(i.id,u=>{if(!u.success){l(new Error(u.error));return}o(u)})})},this.allowedOrigins=e,this.debugMode=s,this.isServer||window.addEventListener("message",this.onParentMessage)}}const S=t=>typeof t=="object"&&t!=null&&"domain"in t&&"types"in t&&"message"in t;var m=k();class A{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(r.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const s={message:e};return(await this.communicator.send(r.signMessage,s)).data}async signTypedMessage(e){if(!S(e))throw new Error("Invalid typed data");return(await this.communicator.send(r.signTypedMessage,{typedData:e})).data}async send({txs:e,params:s}){if(!e||!e.length)throw new Error("No transactions were passed");const a={txs:e,params:s};return(await this.communicator.send(r.sendTransactions,a)).data}}const c={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},h={defaultBlockParam:(t="latest")=>t,returnFullTxObjectParam:(t=!1)=>t,blockNumberToHex:t=>Number.isInteger(t)?`0x${t.toString(16)}`:t};class O{constructor(e){this.communicator=e,this.call=this.buildRequest({call:c.eth_call,formatters:[null,h.defaultBlockParam]}),this.getBalance=this.buildRequest({call:c.eth_getBalance,formatters:[null,h.defaultBlockParam]}),this.getCode=this.buildRequest({call:c.eth_getCode,formatters:[null,h.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:c.eth_getStorageAt,formatters:[null,h.blockNumberToHex,h.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:c.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:c.eth_getBlockByHash,formatters:[null,h.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:c.eth_getBlockByNumber,formatters:[h.blockNumberToHex,h.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:c.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:c.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:c.eth_getTransactionCount,formatters:[null,h.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:c.eth_gasPrice}),this.getEstimateGas=s=>this.buildRequest({call:c.eth_estimateGas})([s]),this.setSafeSettings=this.buildRequest({call:c.safe_setSettings})}buildRequest(e){const{call:s,formatters:a}=e;return async n=>{a&&Array.isArray(n)&&a.forEach((l,u)=>{l&&(n[u]=l(n[u]))});const i={call:s,params:n||[]};return(await this.communicator.send(r.rpcCall,i)).data}}}const x="0x1626ba7e",V="0x20c13b0b",p=4001;class d extends Error{constructor(e,s,a){super(e),this.code=s,this.data=a,Object.setPrototypeOf(this,d.prototype)}}class _{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(r.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new d("Permissions request is invalid",p);try{return(await this.communicator.send(r.wallet_requestPermissions,e)).data}catch{throw new d("Permissions rejected",p)}}isPermissionRequestValid(e){return e.every(s=>typeof s=="object"?Object.keys(s).every(a=>!!Object.values(f).includes(a)):!1)}}const b=(t,e)=>e.some(s=>s.parentCapability===t),M=()=>(t,e,s)=>{const a=s.value;return s.value=async function(){const n=new _(this.communicator);let i=await n.getPermissions();if(b(e,i)||(i=await n.requestPermissions([{[e]:{}}])),!b(e,i))throw new d("Permissions rejected",p);return a.apply(this)},s};var j=function(t,e,s,a){var n=arguments.length,i=n<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,s):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,s,a);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(n<3?o(i):n>3?o(e,s,i):o(e,s))||i);return n>3&&i&&Object.defineProperty(e,s,i),i};class T{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(r.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(r.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(r.getSafeBalances,{currency:e})).data}async check1271Signature(e,s="0x"){const a=await this.getInfo(),n=w({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,s]}),i={call:c.eth_call,params:[{to:a.safeAddress,data:n},"latest"]};try{return(await this.communicator.send(r.rpcCall,i)).data.slice(0,10).toLowerCase()===x}catch{return!1}}async check1271SignatureBytes(e,s="0x"){const a=await this.getInfo(),n=w({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,s]}),i={call:c.eth_call,params:[{to:a.safeAddress,data:n},"latest"]};try{return(await this.communicator.send(r.rpcCall,i)).data.slice(0,10).toLowerCase()===V}catch{return!1}}calculateMessageHash(e){return I(e)}calculateTypedMessageHash(e){const s=typeof e.domain.chainId=="object"?e.domain.chainId.toNumber():Number(e.domain.chainId);let a=e.primaryType;if(!a){const n=Object.values(e.types),i=Object.keys(e.types).filter(o=>n.every(l=>l.every(({type:u})=>u.replace("[","").replace("]","")!==o)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");a=i[0]}return q({message:e.message,domain:{...e.domain,chainId:s,verifyingContract:e.domain.verifyingContract,salt:e.domain.salt},types:e.types,primaryType:a})}async getOffChainSignature(e){return(await this.communicator.send(r.getOffChainSignature,e)).data}async isMessageSigned(e,s="0x"){let a;if(typeof e=="string"&&(a=async()=>{const n=this.calculateMessageHash(e);return await this.isMessageHashSigned(n,s)}),S(e)&&(a=async()=>{const n=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(n,s)}),a)return await a();throw new Error("Invalid message type")}async isMessageHashSigned(e,s="0x"){const a=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const n of a)if(await n(e,s))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(r.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(r.requestAddressBook,void 0)).data}}j([M()],T.prototype,"requestAddressBook",null);class F{constructor(e={}){const{allowedDomains:s=null,debug:a=!1}=e;this.communicator=new H(s,a),this.eth=new O(this.communicator),this.txs=new A(this.communicator),this.safe=new T(this.communicator),this.wallet=new _(this.communicator)}}const G=m.Operation,U=m.TokenType,K=m.TransactionStatus,W=m.TransferDirection;export{g as MessageFormatter,r as Methods,G as Operation,c as RPC_CALLS,f as RestrictedMethods,U as TokenType,K as TransactionStatus,W as TransferDirection,F as default,v as getSDKVersion,S as isObjectEIP712TypedData};
assets/index-DO8OnCIX.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{c as r}from"./parseSignature-DIfAupLd.js";import{B as c,E as d,a as E,b as u,F as b,W as l,d as p,e as T,f as m,g,h,i as v,j as y,p as S,l as A,n as f,p as F,k as R,s as I,m as C,o as x,q as N,o as B,z as D}from"./parseSignature-DIfAupLd.js";import{d as o,h as e}from"./index-C-6muS97.js";import{A as U,a as w,b as k,c as H,e as L,f as M,g as z,i as q,j as V,k as O,l as j,m as G,n as W,o as K,p as Z,q as J,r as Q,s as X,t as Y,B as _,u as $,v as aa,w as ra,x as sa,C as oa,y as ea,z as ta,D as na,E as ia,F as ca,G as da,H as Ea,I as ua,J as ba,K as la,L as pa,M as Ta,N as ma,O as ga,P as ha,Q as va,R as ya,S as Sa,T as Aa,U as fa,V as Fa,W as Ra,X as Ia,Y as Ca,Z as xa,_ as Na,$ as Ba,a0 as Da,a1 as Pa,a2 as Ua,a3 as wa,a4 as ka,a5 as Ha,a6 as La,a7 as Ma,a8 as za,a9 as qa,aa as Va,ab as Oa,ac as ja,ad as Ga,ae as Wa,af as Ka,ag as Za,ah as Ja,ai as Qa,aj as Xa,ak as Ya,al as _a,am as $a,an as ar,ao as rr,ap as sr,aq as or,ar as er,as as tr,at as nr,au as ir,av as cr,aw as dr,ax as Er,ay as ur,az as br,aA as lr,aB as pr,aC as Tr,aD as mr,aE as gr,aF as hr,aG as vr,aH as yr,aI as Sr,aJ as Ar,aK as fr,aL as Fr,aM as Rr,aN as Ir,aO as Cr,aP as xr,aQ as Nr,aR as Br,aS as Dr,aT as Pr,aU as Ur,aV as wr,aW as kr,aX as Hr,aY as Lr,aZ as Mr,a_ as zr,a$ as qr,b0 as Vr,b1 as Or,b2 as jr,b3 as Gr,b4 as Wr,b5 as Kr,b6 as Zr,b7 as Jr,b8 as Qr,b9 as Xr,ba as Yr,bb as _r,bc as $r,bd as as,be as rs,bf as ss,bg as os,bh as es,bi as ts,bj as ns,bk as is,bl as cs,bm as ds,bn as Es,bo as us,bp as bs,bq as ls,br as ps,bs as Ts,bt as ms,bu as gs,bv as hs,bw as vs,bx as ys,by as Ss,bz as As,bA as fs,bB as Fs,bC as Rs,bD as Is,bE as Cs,bF as xs,bG as Ns,bH as Bs,bI as Ds,bJ as Ps,bK as Us,bL as ws,bM as ks,bN as Hs,bO as Ls,bN as Ms,bP as zs,bQ as qs,bR as Vs,bS as Os,bT as js,bU as Gs,bV as Ws,bW as Ks,bX as Zs,bY as Js,bZ as Qs,b_ as Xs,b$ as Ys,c0 as _s,c1 as $s,c2 as ao,c3 as ro,c4 as so,c5 as oo,c6 as eo,c7 as to,c8 as no,c9 as io,ca as co,cb as Eo,cc as uo,cd as bo,ce as lo,cf as po,cg as To,ch as mo,ci as go,cj as ho,ck as vo,cl as yo,cm as So,cn as Ao,co as fo,cp as Fo,bM as Ro,bN as Io,cp as Co,bO as xo,bN as No,cq as Bo,cr as Do,cs as Po,ct as Uo,bv as wo,bw as ko,cu as Ho,cv as Lo,cw as Mo,cx as zo}from"./index-C-6muS97.js";import{I as Vo,a as Oo,b as jo,g as Go,h as Wo,c as Ko,d as Zo,e as Jo,p as Qo,t as Xo,v as Yo}from"./hashTypedData-BUyxnl-E.js";import{d as $o,e as ae,a as re}from"./localBatchGatewayRequest-BpO1N93o.js";import{ccipRequest as oe,ccipRequest as ee,offchainLookup as te,offchainLookupAbiItem as ne,offchainLookupSignature as ie}from"./ccip-DoAXWI68.js";import"./secp256k1-BP3xnA4u.js";export{U as AbiConstructorNotFoundError,w as AbiConstructorParamsNotFoundError,k as AbiDecodingDataSizeTooSmallError,H as AbiDecodingZeroDataError,L as AbiEncodingArrayLengthMismatchError,M as AbiEncodingBytesSizeMismatchError,z as AbiEncodingLengthMismatchError,q as AbiErrorInputsNotFoundError,V as AbiErrorNotFoundError,O as AbiErrorSignatureNotFoundError,j as AbiEventNotFoundError,G as AbiEventSignatureEmptyTopicsError,W as AbiEventSignatureNotFoundError,K as AbiFunctionNotFoundError,Z as AbiFunctionOutputsNotFoundError,J as AbiFunctionSignatureNotFoundError,Q as AccountStateConflictError,X as AtomicReadyWalletRejectedUpgradeError,Y as AtomicityNotSupportedError,_ as BaseError,$ as BaseFeeScalarError,aa as BlockNotFoundError,c as BundleFailedError,ra as BundleTooLargeError,sa as BytesSizeMismatchError,oa as CallExecutionError,ea as ChainDisconnectedError,ta as ChainDoesNotSupportContract,na as ChainMismatchError,ia as ChainNotFoundError,ca as CircularReferenceError,da as ClientChainNotConfiguredError,Ea as ContractFunctionExecutionError,ua as ContractFunctionRevertedError,ba as ContractFunctionZeroDataError,la as CounterfactualDeploymentFailedError,pa as DecodeLogDataMismatch,Ta as DecodeLogTopicsMismatch,ma as DuplicateIdError,ga as Eip1559FeesNotSupportedError,d as EnsAvatarInvalidNftUriError,E as EnsAvatarUnsupportedNamespaceError,u as EnsAvatarUriResolutionError,ha as EstimateGasExecutionError,va as ExecutionRevertedError,ya as FeeCapTooHighError,Sa as FeeCapTooLowError,b as FilterTypeNotSupportedError,Aa as HttpRequestError,fa as InsufficientFundsError,Fa as IntegerOutOfRangeError,Ra as InternalRpcError,Ia as IntrinsicGasTooHighError,Ca as IntrinsicGasTooLowError,xa as InvalidAbiDecodingTypeError,Na as InvalidAbiEncodingTypeError,Ba as InvalidAbiTypeParameterError,Da as InvalidAddressError,Pa as InvalidArrayError,Ua as InvalidBytesBooleanError,wa as InvalidChainIdError,ka as InvalidDecimalNumberError,Ha as InvalidDefinitionTypeError,Vo as InvalidDomainError,La as InvalidFunctionModifierError,Ma as InvalidHexBooleanError,za as InvalidInputRpcError,qa as InvalidLegacyVError,Va as InvalidModifierError,Oa as InvalidParameterError,ja as InvalidParamsRpcError,Ga as InvalidParenthesisError,Oo as InvalidPrimaryTypeError,Wa as InvalidRequestRpcError,Ka as InvalidSerializableTransactionError,Za as InvalidSignatureError,Ja as InvalidStorageKeySizeError,Qa as InvalidStructSignatureError,jo as InvalidStructTypeError,Xa as JsonRpcVersionUnsupportedError,Ya as LimitExceededRpcError,_a as MaxFeePerGasTooLowError,$a as MethodNotFoundRpcError,ar as MethodNotSupportedRpcError,rr as NonceMaxValueError,sr as NonceTooHighError,or as NonceTooLowError,er as ParseRpcError,tr as ProviderDisconnectedError,nr as ProviderRpcError,ir as RawContractError,cr as ResourceNotFoundRpcError,dr as ResourceUnavailableRpcError,Er as RpcError,ur as RpcRequestError,br as SizeExceedsPaddingSizeError,lr as SizeOverflowError,pr as SliceOffsetOutOfBoundsError,Tr as SolidityProtectedKeywordError,mr as StateAssignmentConflictError,gr as SwitchChainError,hr as TimeoutError,vr as TipAboveFeeCapError,yr as TransactionExecutionError,Sr as TransactionNotFoundError,Ar as TransactionReceiptNotFoundError,fr as TransactionRejectedRpcError,Fr as TransactionTypeNotSupportedError,Rr as UnauthorizedProviderError,Ir as UnknownBundleIdError,Cr as UnknownNodeError,xr as UnknownRpcError,Nr as UnknownSignatureError,Br as UnknownTypeError,Dr as UnsupportedChainIdError,Pr as UnsupportedNonOptionalCapabilityError,Ur as UnsupportedPackedAbiType,wr as UnsupportedProviderMethodError,kr as UrlRequiredError,Hr as UserRejectedRequestError,l as WaitForCallsStatusTimeoutError,Lr as WaitForTransactionReceiptTimeoutError,Mr as assertCurrentChain,zr as assertRequest,p as assertTransactionEIP1559,T as assertTransactionEIP2930,m as assertTransactionLegacy,qr as blobsToCommitments,Vr as blobsToProofs,Or as boolToBytes,jr as boolToHex,Gr as bytesToBigInt,Wr as bytesToBool,Kr as bytesToHex,Zr as bytesToNumber,Jr as bytesToString,oe as ccipFetch,ee as ccipRequest,Qr as checksumAddress,Xr as commitmentToVersionedHash,Yr as commitmentsToVersionedHashes,_r as concat,$r as concatBytes,as as concatHex,rs as createClient,g as createNonceManager,r as createPublicClient,ss as createTransport,os as custom,es as decodeAbiParameters,ts as decodeErrorResult,ns as decodeEventLog,$o as decodeFunctionData,is as decodeFunctionResult,cs as defineBlock,o as defineChain,ds as defineTransaction,Es as defineTransactionReceipt,us as defineTransactionRequest,bs as deploylessCallViaBytecodeBytecode,ls as deploylessCallViaFactoryBytecode,ps as encodeAbiParameters,Ts as encodeDeployData,ae as encodeErrorResult,h as encodeEventTopics,ms as encodeFunctionData,re as encodeFunctionResult,v as encodePacked,gs as erc20Abi,hs as erc6492SignatureValidatorAbi,vs as erc6492SignatureValidatorByteCode,y as ethAddress,ys as etherUnits,Ss as extendSchema,As as fallback,fs as formatBlock,Fs as formatEther,Rs as formatGwei,Is as formatLog,Cs as formatTransaction,xs as formatTransactionReceipt,Ns as formatTransactionRequest,Bs as formatUnits,Ds as getAbiItem,Ps as getAddress,Us as getChainContractAddress,ws as getContractError,ks as getEventSelector,Hs as getEventSignature,Ls as getFunctionSelector,Ms as getFunctionSignature,zs as getTransactionType,Go as getTypesForEIP712Domain,qs as gweiUnits,Wo as hashDomain,Ko as hashMessage,Zo as hashStruct,Jo as hashTypedData,Vs as hexToBigInt,Os as hexToBool,js as hexToBytes,Gs as hexToNumber,S as hexToSignature,Ws as hexToString,e as http,Ks as isAddress,Zs as isAddressEqual,Js as isHex,Qs as keccak256,A as labelhash,Xs as maxUint16,Ys as maxUint256,_s as multicall3Abi,f as namehash,$s as numberToBytes,ao as numberToHex,te as offchainLookup,ne as offchainLookupAbiItem,ie as offchainLookupSignature,ro as pad,so as padBytes,oo as padHex,eo as parseAbi,to as parseEventLogs,F as parseSignature,no as parseUnits,io as prepareEncodeFunctionData,Qo as presignMessagePrefix,R as publicActions,co as recoverAddress,Eo as recoverPublicKey,uo as rpcTransactionType,I as serializeAccessList,C as serializeErc6492Signature,x as serializeSignature,N as serializeTransaction,bo as sha256,lo as shouldThrow,B as signatureToHex,po as size,To as slice,mo as sliceBytes,go as sliceHex,ho as stringToBytes,vo as stringToHex,yo as stringify,So as toBlobSidecars,Ao as toBlobs,fo as toBytes,Fo as toEventHash,Ro as toEventSelector,Io as toEventSignature,Co as toFunctionHash,xo as toFunctionSelector,No as toFunctionSignature,Bo as toHex,Xo as toPrefixedMessage,Do as toRlp,Po as transactionType,Uo as trim,wo as universalSignatureValidatorAbi,ko as universalSignatureValidatorByteCode,Yo as validateTypedData,Ho as weiUnits,Lo as withCache,Mo as withRetry,zo as withTimeout,D as zeroAddress};
assets/index-DZaLz_HL.js ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as C,cz as T,cA as P,cB as h,cC as b,cD as v,cE as l,cJ as O,dd as d,cI as x,dh as g,cM as S,c$ as $,cV as R,cN as E}from"./index-C-6muS97.js";const L=C`
2
+ :host {
3
+ position: relative;
4
+ display: inline-block;
5
+ }
6
+
7
+ input {
8
+ width: 48px;
9
+ height: 48px;
10
+ background: ${({tokens:i})=>i.theme.foregroundPrimary};
11
+ border-radius: ${({borderRadius:i})=>i[4]};
12
+ border: 1px solid ${({tokens:i})=>i.theme.borderPrimary};
13
+ font-family: ${({fontFamily:i})=>i.regular};
14
+ font-size: ${({textSize:i})=>i.large};
15
+ line-height: 18px;
16
+ letter-spacing: -0.16px;
17
+ text-align: center;
18
+ color: ${({tokens:i})=>i.theme.textPrimary};
19
+ caret-color: ${({tokens:i})=>i.core.textAccentPrimary};
20
+ transition:
21
+ background-color ${({durations:i})=>i.lg}
22
+ ${({easings:i})=>i["ease-out-power-2"]},
23
+ border-color ${({durations:i})=>i.lg}
24
+ ${({easings:i})=>i["ease-out-power-2"]},
25
+ box-shadow ${({durations:i})=>i.lg}
26
+ ${({easings:i})=>i["ease-out-power-2"]};
27
+ will-change: background-color, border-color, box-shadow;
28
+ box-sizing: border-box;
29
+ -webkit-appearance: none;
30
+ -moz-appearance: textfield;
31
+ padding: ${({spacing:i})=>i[4]};
32
+ }
33
+
34
+ input::-webkit-outer-spin-button,
35
+ input::-webkit-inner-spin-button {
36
+ -webkit-appearance: none;
37
+ margin: 0;
38
+ }
39
+
40
+ input[type='number'] {
41
+ -moz-appearance: textfield;
42
+ }
43
+
44
+ input:disabled {
45
+ cursor: not-allowed;
46
+ opacity: 0.5;
47
+ }
48
+
49
+ input:focus-visible:enabled {
50
+ background-color: transparent;
51
+ border: 1px solid ${({tokens:i})=>i.theme.borderSecondary};
52
+ box-shadow: 0px 0px 0px 4px ${({tokens:i})=>i.core.foregroundAccent040};
53
+ }
54
+ `;var y=function(i,t,e,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(o=(s<3?r(o):s>3?r(t,e,o):r(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o};let p=class extends v{constructor(){super(...arguments),this.disabled=!1,this.value=""}render(){return l`<input
55
+ type="number"
56
+ maxlength="1"
57
+ inputmode="numeric"
58
+ autofocus
59
+ ?disabled=${this.disabled}
60
+ value=${this.value}
61
+ /> `}};p.styles=[T,P,L];y([h({type:Boolean})],p.prototype,"disabled",void 0);y([h({type:String})],p.prototype,"value",void 0);p=y([b("wui-input-numeric")],p);const _=O`
62
+ :host {
63
+ position: relative;
64
+ display: block;
65
+ }
66
+ `;var m=function(i,t,e,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(o=(s<3?r(o):s>3?r(t,e,o):r(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o};let c=class extends v{constructor(){super(...arguments),this.length=6,this.otp="",this.values=Array.from({length:this.length}).map(()=>""),this.numerics=[],this.shouldInputBeEnabled=t=>this.values.slice(0,t).every(n=>n!==""),this.handleKeyDown=(t,e)=>{const n=t.target,s=this.getInputElement(n),o=["ArrowLeft","ArrowRight","Shift","Delete"];if(!s)return;o.includes(t.key)&&t.preventDefault();const r=s.selectionStart;switch(t.key){case"ArrowLeft":r&&s.setSelectionRange(r+1,r+1),this.focusInputField("prev",e);break;case"ArrowRight":this.focusInputField("next",e);break;case"Shift":this.focusInputField("next",e);break;case"Delete":s.value===""?this.focusInputField("prev",e):this.updateInput(s,e,"");break;case"Backspace":s.value===""?this.focusInputField("prev",e):this.updateInput(s,e,"");break}},this.focusInputField=(t,e)=>{if(t==="next"){const n=e+1;if(!this.shouldInputBeEnabled(n))return;const s=this.numerics[n<this.length?n:e],o=s?this.getInputElement(s):void 0;o&&(o.disabled=!1,o.focus())}if(t==="prev"){const n=e-1,s=this.numerics[n>-1?n:e],o=s?this.getInputElement(s):void 0;o&&o.focus()}}}firstUpdated(){this.otp&&(this.values=this.otp.split(""));const t=this.shadowRoot?.querySelectorAll("wui-input-numeric");t&&(this.numerics=Array.from(t)),this.numerics[0]?.focus()}render(){return l`
67
+ <wui-flex gap="1" data-testid="wui-otp-input">
68
+ ${Array.from({length:this.length}).map((t,e)=>l`
69
+ <wui-input-numeric
70
+ @input=${n=>this.handleInput(n,e)}
71
+ @click=${n=>this.selectInput(n)}
72
+ @keydown=${n=>this.handleKeyDown(n,e)}
73
+ .disabled=${!this.shouldInputBeEnabled(e)}
74
+ .value=${this.values[e]||""}
75
+ >
76
+ </wui-input-numeric>
77
+ `)}
78
+ </wui-flex>
79
+ `}updateInput(t,e,n){const s=this.numerics[e],o=t||(s?this.getInputElement(s):void 0);o&&(o.value=n,this.values=this.values.map((r,a)=>a===e?n:r))}selectInput(t){const e=t.target;e&&this.getInputElement(e)?.select()}handleInput(t,e){const n=t.target,s=this.getInputElement(n);if(s){const o=s.value;t.inputType==="insertFromPaste"?this.handlePaste(s,o,e):x.isNumber(o)&&t.data?(this.updateInput(s,e,t.data),this.focusInputField("next",e)):this.updateInput(s,e,"")}this.dispatchInputChangeEvent()}handlePaste(t,e,n){const s=e[0];if(s&&x.isNumber(s)){this.updateInput(t,n,s);const r=e.substring(1);if(n+1<this.length&&r.length){const a=this.numerics[n+1],I=a?this.getInputElement(a):void 0;I&&this.handlePaste(I,r,n+1)}else this.focusInputField("next",n)}else this.updateInput(t,n,"")}getInputElement(t){return t.shadowRoot?.querySelector("input")?t.shadowRoot.querySelector("input"):null}dispatchInputChangeEvent(){const t=this.values.join("");this.dispatchEvent(new CustomEvent("inputChange",{detail:t,bubbles:!0,composed:!0}))}};c.styles=[T,_];m([h({type:Number})],c.prototype,"length",void 0);m([h({type:String})],c.prototype,"otp",void 0);m([d()],c.prototype,"values",void 0);c=m([b("wui-otp")],c);const A=O`
80
+ wui-loading-spinner {
81
+ margin: 9px auto;
82
+ }
83
+
84
+ .email-display,
85
+ .email-display wui-text {
86
+ max-width: 100%;
87
+ }
88
+ `;var f=function(i,t,e,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(o=(s<3?r(o):s>3?r(t,e,o):r(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o},w;let u=w=class extends v{firstUpdated(){this.startOTPTimeout()}disconnectedCallback(){clearTimeout(this.OTPTimeout)}constructor(){super(),this.loading=!1,this.timeoutTimeLeft=g.getTimeToNextEmailLogin(),this.error="",this.otp="",this.email=S.state.data?.email,this.authConnector=$.getAuthConnector()}render(){if(!this.email)throw new Error("w3m-email-otp-widget: No email provided");const t=!!this.timeoutTimeLeft,e=this.getFooterLabels(t);return l`
89
+ <wui-flex
90
+ flexDirection="column"
91
+ alignItems="center"
92
+ .padding=${["4","0","4","0"]}
93
+ gap="4"
94
+ >
95
+ <wui-flex
96
+ class="email-display"
97
+ flexDirection="column"
98
+ alignItems="center"
99
+ .padding=${["0","5","0","5"]}
100
+ >
101
+ <wui-text variant="md-regular" color="primary" align="center">
102
+ Enter the code we sent to
103
+ </wui-text>
104
+ <wui-text variant="md-medium" color="primary" lineClamp="1" align="center">
105
+ ${this.email}
106
+ </wui-text>
107
+ </wui-flex>
108
+
109
+ <wui-text variant="sm-regular" color="secondary">The code expires in 20 minutes</wui-text>
110
+
111
+ ${this.loading?l`<wui-loading-spinner size="xl" color="accent-primary"></wui-loading-spinner>`:l` <wui-flex flexDirection="column" alignItems="center" gap="2">
112
+ <wui-otp
113
+ dissabled
114
+ length="6"
115
+ @inputChange=${this.onOtpInputChange.bind(this)}
116
+ .otp=${this.otp}
117
+ ></wui-otp>
118
+ ${this.error?l`
119
+ <wui-text variant="sm-regular" align="center" color="error">
120
+ ${this.error}. Try Again
121
+ </wui-text>
122
+ `:null}
123
+ </wui-flex>`}
124
+
125
+ <wui-flex alignItems="center" gap="2">
126
+ <wui-text variant="sm-regular" color="secondary">${e.title}</wui-text>
127
+ <wui-link @click=${this.onResendCode.bind(this)} .disabled=${t}>
128
+ ${e.action}
129
+ </wui-link>
130
+ </wui-flex>
131
+ </wui-flex>
132
+ `}startOTPTimeout(){this.timeoutTimeLeft=g.getTimeToNextEmailLogin(),this.OTPTimeout=setInterval(()=>{this.timeoutTimeLeft>0?this.timeoutTimeLeft=g.getTimeToNextEmailLogin():clearInterval(this.OTPTimeout)},1e3)}async onOtpInputChange(t){try{this.loading||(this.otp=t.detail,this.shouldSubmitOnOtpChange()&&(this.loading=!0,await this.onOtpSubmit?.(this.otp)))}catch(e){this.error=R.parseError(e),this.loading=!1}}async onResendCode(){try{if(this.onOtpResend){if(!this.loading&&!this.timeoutTimeLeft){if(this.error="",this.otp="",!$.getAuthConnector()||!this.email)throw new Error("w3m-email-otp-widget: Unable to resend email");this.loading=!0,await this.onOtpResend(this.email),this.startOTPTimeout(),E.showSuccess("Code email resent")}}else this.onStartOver&&this.onStartOver()}catch(t){E.showError(t)}finally{this.loading=!1}}getFooterLabels(t){return this.onStartOver?{title:"Something wrong?",action:`Try again ${t?`in ${this.timeoutTimeLeft}s`:""}`}:{title:"Didn't receive it?",action:`Resend ${t?`in ${this.timeoutTimeLeft}s`:"Code"}`}}shouldSubmitOnOtpChange(){return this.authConnector&&this.otp.length===w.OTP_LENGTH}};u.OTP_LENGTH=6;u.styles=A;f([d()],u.prototype,"loading",void 0);f([d()],u.prototype,"timeoutTimeLeft",void 0);f([d()],u.prototype,"error",void 0);u=w=f([b("w3m-email-otp-widget")],u);export{u as W};
assets/index-JLdSXt4Q.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{P as e,A as m,a as d}from"./index-Vh_A-L4_.js";import{W as B,b as G,c as W}from"./index-Vh_A-L4_.js";import"./index-C-6muS97.js";const U=3e5;async function E(t){return e.handleOpenPay(t)}async function p(t,s=U){if(s<=0)throw new m(d.INVALID_PAYMENT_CONFIG,"Timeout must be greater than 0");try{await E(t)}catch(a){throw a instanceof m?a:new m(d.UNABLE_TO_INITIATE_PAYMENT,a.message)}return new Promise((a,y)=>{let n=!1;const i=setTimeout(()=>{n||(n=!0,o(),y(new m(d.GENERIC_PAYMENT_ERROR,"Payment timeout")))},s);function r(){if(n)return;const c=e.state.currentPayment,u=e.state.error,C=e.state.isPaymentInProgress;if(c?.status==="SUCCESS"){n=!0,o(),clearTimeout(i),a({success:!0,result:c.result});return}if(c?.status==="FAILED"){n=!0,o(),clearTimeout(i),a({success:!1,error:u||"Payment failed"});return}u&&!C&&!c&&(n=!0,o(),clearTimeout(i),a({success:!1,error:u}))}const b=l("currentPayment",r),S=l("error",r),D=l("isPaymentInProgress",r),o=P([b,S,D]);r()})}function w(){return e.getExchanges()}function h(){return e.state.currentPayment?.result}function k(){return e.state.error}function g(){return e.state.isPaymentInProgress}function l(t,s){return e.subscribeKey(t,s)}function P(t){return()=>{t.forEach(s=>{try{s()}catch{}})}}const A={network:"eip155:8453",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},I={network:"eip155:8453",asset:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},N={network:"eip155:84532",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},x={network:"eip155:1",asset:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},v={network:"eip155:10",asset:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},F={network:"eip155:42161",asset:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},K={network:"eip155:137",asset:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},R={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},Y={network:"eip155:1",asset:"0xdAC17F958D2ee523a2206206994597C13D831ec7",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},q={network:"eip155:10",asset:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},_={network:"eip155:42161",asset:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},M={network:"eip155:137",asset:"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},O={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},H={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"native",metadata:{name:"Solana",symbol:"SOL",decimals:9}};export{e as PayController,B as W3mPayLoadingView,G as W3mPayQuoteView,W as W3mPayView,F as arbitrumUSDC,_ as arbitrumUSDT,A as baseETH,N as baseSepoliaETH,I as baseUSDC,x as ethereumUSDC,Y as ethereumUSDT,w as getExchanges,g as getIsPaymentInProgress,k as getPayError,h as getPayResult,E as openPay,v as optimismUSDC,q as optimismUSDT,p as pay,K as polygonUSDC,M as polygonUSDT,H as solanaSOL,R as solanaUSDC,O as solanaUSDT};
assets/index-Ka6fShes.js ADDED
The diff for this file is too large to render. See raw diff
 
assets/index-Vh_A-L4_.js ADDED
@@ -0,0 +1,1062 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as U,cz as we,cA as Ne,cB as x,cC as _,cD as C,dc as g,cE as l,cP as I,dR as Pe,cO as T,dS as Se,dT as w,cV as O,dU as Te,dV as N,dr as ie,cK as A,dW as ue,cT as m,da as S,cQ as j,cN as R,cY as ve,du as z,d0 as ke,d1 as _e,d2 as Ce,c$ as P,cM as M,dd as h,cG as $e,cI as Re,dX as ye,cJ as Oe,dL as le}from"./index-C-6muS97.js";const Ue=U`
2
+ :host {
3
+ position: relative;
4
+ }
5
+
6
+ button {
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ background-color: transparent;
11
+ padding: ${({spacing:t})=>t[1]};
12
+ }
13
+
14
+ /* -- Colors --------------------------------------------------- */
15
+ button[data-type='accent'] wui-icon {
16
+ color: ${({tokens:t})=>t.core.iconAccentPrimary};
17
+ }
18
+
19
+ button[data-type='neutral'][data-variant='primary'] wui-icon {
20
+ color: ${({tokens:t})=>t.theme.iconInverse};
21
+ }
22
+
23
+ button[data-type='neutral'][data-variant='secondary'] wui-icon {
24
+ color: ${({tokens:t})=>t.theme.iconDefault};
25
+ }
26
+
27
+ button[data-type='success'] wui-icon {
28
+ color: ${({tokens:t})=>t.core.iconSuccess};
29
+ }
30
+
31
+ button[data-type='error'] wui-icon {
32
+ color: ${({tokens:t})=>t.core.iconError};
33
+ }
34
+
35
+ /* -- Sizes --------------------------------------------------- */
36
+ button[data-size='xs'] {
37
+ width: 16px;
38
+ height: 16px;
39
+
40
+ border-radius: ${({borderRadius:t})=>t[1]};
41
+ }
42
+
43
+ button[data-size='sm'] {
44
+ width: 20px;
45
+ height: 20px;
46
+ border-radius: ${({borderRadius:t})=>t[1]};
47
+ }
48
+
49
+ button[data-size='md'] {
50
+ width: 24px;
51
+ height: 24px;
52
+ border-radius: ${({borderRadius:t})=>t[2]};
53
+ }
54
+
55
+ button[data-size='lg'] {
56
+ width: 28px;
57
+ height: 28px;
58
+ border-radius: ${({borderRadius:t})=>t[2]};
59
+ }
60
+
61
+ button[data-size='xs'] wui-icon {
62
+ width: 8px;
63
+ height: 8px;
64
+ }
65
+
66
+ button[data-size='sm'] wui-icon {
67
+ width: 12px;
68
+ height: 12px;
69
+ }
70
+
71
+ button[data-size='md'] wui-icon {
72
+ width: 16px;
73
+ height: 16px;
74
+ }
75
+
76
+ button[data-size='lg'] wui-icon {
77
+ width: 20px;
78
+ height: 20px;
79
+ }
80
+
81
+ /* -- Hover --------------------------------------------------- */
82
+ @media (hover: hover) {
83
+ button[data-type='accent']:hover:enabled {
84
+ background-color: ${({tokens:t})=>t.core.foregroundAccent010};
85
+ }
86
+
87
+ button[data-variant='primary'][data-type='neutral']:hover:enabled {
88
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
89
+ }
90
+
91
+ button[data-variant='secondary'][data-type='neutral']:hover:enabled {
92
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
93
+ }
94
+
95
+ button[data-type='success']:hover:enabled {
96
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
97
+ }
98
+
99
+ button[data-type='error']:hover:enabled {
100
+ background-color: ${({tokens:t})=>t.core.backgroundError};
101
+ }
102
+ }
103
+
104
+ /* -- Focus --------------------------------------------------- */
105
+ button:focus-visible {
106
+ box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020};
107
+ }
108
+
109
+ /* -- Properties --------------------------------------------------- */
110
+ button[data-full-width='true'] {
111
+ width: 100%;
112
+ }
113
+
114
+ :host([fullWidth]) {
115
+ width: 100%;
116
+ }
117
+
118
+ button[disabled] {
119
+ opacity: 0.5;
120
+ cursor: not-allowed;
121
+ }
122
+ `;var D=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};let v=class extends C{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 l`<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=${g(this.iconSize)}></wui-icon>
130
+ </button>`}};v.styles=[we,Ne,Ue];D([x()],v.prototype,"icon",void 0);D([x()],v.prototype,"variant",void 0);D([x()],v.prototype,"type",void 0);D([x()],v.prototype,"size",void 0);D([x()],v.prototype,"iconSize",void 0);D([x({type:Boolean})],v.prototype,"fullWidth",void 0);D([x({type:Boolean})],v.prototype,"disabled",void 0);v=D([_("wui-icon-button")],v);const d={INVALID_PAYMENT_CONFIG:"INVALID_PAYMENT_CONFIG",INVALID_RECIPIENT:"INVALID_RECIPIENT",INVALID_ASSET:"INVALID_ASSET",INVALID_AMOUNT:"INVALID_AMOUNT",UNKNOWN_ERROR:"UNKNOWN_ERROR",UNABLE_TO_INITIATE_PAYMENT:"UNABLE_TO_INITIATE_PAYMENT",INVALID_CHAIN_NAMESPACE:"INVALID_CHAIN_NAMESPACE",GENERIC_PAYMENT_ERROR:"GENERIC_PAYMENT_ERROR",UNABLE_TO_GET_EXCHANGES:"UNABLE_TO_GET_EXCHANGES",ASSET_NOT_SUPPORTED:"ASSET_NOT_SUPPORTED",UNABLE_TO_GET_PAY_URL:"UNABLE_TO_GET_PAY_URL",UNABLE_TO_GET_BUY_STATUS:"UNABLE_TO_GET_BUY_STATUS",UNABLE_TO_GET_TOKEN_BALANCES:"UNABLE_TO_GET_TOKEN_BALANCES",UNABLE_TO_GET_QUOTE:"UNABLE_TO_GET_QUOTE",UNABLE_TO_GET_QUOTE_STATUS:"UNABLE_TO_GET_QUOTE_STATUS",INVALID_RECIPIENT_ADDRESS_FOR_ASSET:"INVALID_RECIPIENT_ADDRESS_FOR_ASSET"},L={[d.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[d.INVALID_RECIPIENT]:"Invalid recipient address",[d.INVALID_ASSET]:"Invalid asset specified",[d.INVALID_AMOUNT]:"Invalid payment amount",[d.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[d.UNKNOWN_ERROR]:"Unknown payment error occurred",[d.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[d.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[d.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[d.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[d.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[d.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[d.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[d.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[d.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[d.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"};class p extends Error{get message(){return L[this.code]}constructor(e,n){super(L[e]),this.name="AppKitPayError",this.code=e,this.details=n,Error.captureStackTrace&&Error.captureStackTrace(this,p)}}const Le="https://rpc.walletconnect.org/v1/json-rpc",de="reown_test";function qe(){const{chainNamespace:t}=w.parseCaipNetworkId(c.state.paymentAsset.network);if(!O.isAddress(c.state.recipient,t))throw new p(d.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${t}"`)}async function De(t,e,n){if(e!==I.CHAIN.EVM)throw new p(d.INVALID_CHAIN_NAMESPACE);if(!n.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");const s=typeof n.amount=="string"?parseFloat(n.amount):n.amount;if(isNaN(s))throw new p(d.INVALID_PAYMENT_CONFIG);const a=t.metadata?.decimals??18,i=T.parseUnits(s.toString(),a);if(typeof i!="bigint")throw new p(d.GENERIC_PAYMENT_ERROR);return await T.sendTransaction({chainNamespace:e,to:n.recipient,address:n.fromAddress,value:i,data:"0x"})??void 0}async function Fe(t,e){if(!e.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");const n=t.asset,s=e.recipient,a=Number(t.metadata.decimals),i=T.parseUnits(e.amount.toString(),a);if(i===void 0)throw new p(d.GENERIC_PAYMENT_ERROR);return await T.writeContract({fromAddress:e.fromAddress,tokenAddress:n,args:[s,i],method:"transfer",abi:Se.getERC20Abi(n),chainNamespace:I.CHAIN.EVM})??void 0}async function Be(t,e){if(t!==I.CHAIN.SOLANA)throw new p(d.INVALID_CHAIN_NAMESPACE);if(!e.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");const n=typeof e.amount=="string"?parseFloat(e.amount):e.amount;if(isNaN(n)||n<=0)throw new p(d.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!Pe.getProvider(t))throw new p(d.GENERIC_PAYMENT_ERROR,"No Solana provider available.");const a=await T.sendTransaction({chainNamespace:I.CHAIN.SOLANA,to:e.recipient,value:n,tokenMint:e.tokenMint});if(!a)throw new p(d.GENERIC_PAYMENT_ERROR,"Transaction failed.");return a}catch(s){throw s instanceof p?s:new p(d.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${s}`)}}async function We({sourceToken:t,toToken:e,amount:n,recipient:s}){const a=T.parseUnits(n,t.metadata.decimals),i=T.parseUnits(n,e.metadata.decimals);return Promise.resolve({type:te,origin:{amount:a?.toString()??"0",currency:t},destination:{amount:i?.toString()??"0",currency:e},fees:[{id:"service",label:"Service Fee",amount:"0",currency:e}],steps:[{requestId:te,type:"deposit",deposit:{amount:a?.toString()??"0",currency:t.asset,receiver:s}}],timeInSeconds:6})}function ee(t){if(!t)return null;const e=t.steps[0];return!e||e.type!==tt?null:e}function X(t,e=0){if(!t)return[];const n=t.steps.filter(a=>a.type===nt),s=n.filter((a,i)=>i+1>e);return n.length>0&&n.length<3?s:[]}const ae=new Te({baseUrl:O.getApiUrl(),clientId:null});class je extends Error{}function Me(){const t=ie.getSnapshot().projectId;return`${Le}?projectId=${t}`}function re(){const{projectId:t,sdkType:e,sdkVersion:n}=ie.state;return{projectId:t,st:e||"appkit",sv:n||"html-wagmi-4.2.2"}}async function oe(t,e){const n=Me(),{sdkType:s,sdkVersion:a,projectId:i}=ie.getSnapshot(),o={jsonrpc:"2.0",id:1,method:t,params:{...e||{},st:s,sv:a,projectId:i}},b=await(await fetch(n,{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json"}})).json();if(b.error)throw new je(b.error.message);return b}async function pe(t){return(await oe("reown_getExchanges",t)).result}async function he(t){return(await oe("reown_getExchangePayUrl",t)).result}async function ze(t){return(await oe("reown_getExchangeBuyStatus",t)).result}async function Ge(t){const e=A.bigNumber(t.amount).times(10**t.toToken.metadata.decimals).toString(),{chainId:n,chainNamespace:s}=w.parseCaipNetworkId(t.sourceToken.network),{chainId:a,chainNamespace:i}=w.parseCaipNetworkId(t.toToken.network),o=t.sourceToken.asset==="native"?ue(s):t.sourceToken.asset,u=t.toToken.asset==="native"?ue(i):t.toToken.asset;return await ae.post({path:"/appkit/v1/transfers/quote",body:{user:t.address,originChainId:n.toString(),originCurrency:o,destinationChainId:a.toString(),destinationCurrency:u,recipient:t.recipient,amount:e},params:re()})}async function Qe(t){const e=N.isLowerCaseMatch(t.sourceToken.network,t.toToken.network),n=N.isLowerCaseMatch(t.sourceToken.asset,t.toToken.asset);return e&&n?We(t):Ge(t)}async function Ve(t){return await ae.get({path:"/appkit/v1/transfers/status",params:{requestId:t.requestId,...re()}})}async function Ye(t){return await ae.get({path:`/appkit/v1/transfers/assets/exchanges/${t}`,params:re()})}const He=["eip155","solana"],Ke={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}};function J(t,e){const{chainNamespace:n,chainId:s}=w.parseCaipNetworkId(t),a=Ke[n];if(!a)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${n}`);let i=a.native.assetNamespace,o=a.native.assetReference;return e!=="native"&&(i=a.defaultTokenNamespace,o=e),`${`${n}:${s}`}/${i}:${o}`}function Xe(t){const{chainNamespace:e}=w.parseCaipNetworkId(t);return He.includes(e)}function Je(t){const n=m.getAllRequestedCaipNetworks().find(a=>a.caipNetworkId===t.chainId);let s=t.address;if(!n)throw new Error(`Target network not found for balance chainId "${t.chainId}"`);if(N.isLowerCaseMatch(t.symbol,n.nativeCurrency.symbol))s="native";else if(O.isCaipAddress(s)){const{address:a}=w.parseCaipAddress(s);s=a}else if(!s)throw new Error(`Balance address not found for balance symbol "${t.symbol}"`);return{network:n.caipNetworkId,asset:s,metadata:{name:t.name,symbol:t.symbol,decimals:Number(t.quantity.decimals),logoURI:t.iconUrl},amount:t.quantity.numeric}}function Ze(t){return{chainId:t.network,address:`${t.network}:${t.asset}`,symbol:t.metadata.symbol,name:t.metadata.name,iconUrl:t.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:t.metadata.decimals.toString()}}}function Q(t){const e=A.bigNumber(t,{safe:!0});return e.lt(.001)?"<0.001":e.round(4).toString()}function et(t){const n=m.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===t.network);return n?!!n.testnet:!1}const me=0,Z="unknown",te="direct-transfer",tt="deposit",nt="transaction",r=Ce({paymentAsset:{network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},recipient:"0x0",amount:0,isConfigured:!1,error:null,isPaymentInProgress:!1,exchanges:[],isLoading:!1,openInNewTab:!0,redirectUrl:void 0,payWithExchange:void 0,currentPayment:void 0,analyticsSet:!1,paymentId:void 0,choice:"pay",tokenBalances:{[I.CHAIN.EVM]:[],[I.CHAIN.SOLANA]:[]},isFetchingTokenBalances:!1,selectedPaymentAsset:null,quote:void 0,quoteStatus:"waiting",quoteError:null,isFetchingQuote:!1,selectedExchange:void 0,exchangeUrlForQuote:void 0,requestId:void 0}),c={state:r,subscribe(t){return _e(r,()=>t(r))},subscribeKey(t,e){return ke(r,t,e)},async handleOpenPay(t){this.resetState(),this.setPaymentConfig(t),this.initializeAnalytics(),qe(),await this.prepareTokenLogo(),r.isConfigured=!0,j.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:r.exchanges,configuration:{network:r.paymentAsset.network,asset:r.paymentAsset.asset,recipient:r.recipient,amount:r.amount}}}),await z.open({view:"Pay"})},resetState(){r.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},r.recipient="0x0",r.amount=0,r.isConfigured=!1,r.error=null,r.isPaymentInProgress=!1,r.isLoading=!1,r.currentPayment=void 0,r.selectedExchange=void 0,r.exchangeUrlForQuote=void 0,r.requestId=void 0},resetQuoteState(){r.quote=void 0,r.quoteStatus="waiting",r.quoteError=null,r.isFetchingQuote=!1,r.requestId=void 0},setPaymentConfig(t){if(!t.paymentAsset)throw new p(d.INVALID_PAYMENT_CONFIG);try{r.choice=t.choice??"pay",r.paymentAsset=t.paymentAsset,r.recipient=t.recipient,r.amount=t.amount,r.openInNewTab=t.openInNewTab??!0,r.redirectUrl=t.redirectUrl,r.payWithExchange=t.payWithExchange,r.error=null}catch(e){throw new p(d.INVALID_PAYMENT_CONFIG,e.message)}},setSelectedPaymentAsset(t){r.selectedPaymentAsset=t},setSelectedExchange(t){r.selectedExchange=t},setRequestId(t){r.requestId=t},setPaymentInProgress(t){r.isPaymentInProgress=t},getPaymentAsset(){return r.paymentAsset},getExchanges(){return r.exchanges},async fetchExchanges(){try{r.isLoading=!0;const t=await pe({page:me});r.exchanges=t.exchanges.slice(0,2)}catch{throw R.showError(L.UNABLE_TO_GET_EXCHANGES),new p(d.UNABLE_TO_GET_EXCHANGES)}finally{r.isLoading=!1}},async getAvailableExchanges(t){try{const e=t?.asset&&t?.network?J(t.network,t.asset):void 0;return await pe({page:t?.page??me,asset:e,amount:t?.amount?.toString()})}catch{throw new p(d.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(t,e,n=!1){try{const s=Number(e.amount),a=await he({exchangeId:t,asset:J(e.network,e.asset),amount:s.toString(),recipient:`${e.network}:${e.recipient}`});return j.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{source:"pay",exchange:{id:t},configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},headless:n}}),n&&(this.initiatePayment(),j.sendEvent({type:"track",event:"PAY_INITIATED",properties:{source:"pay",paymentId:r.paymentId||Z,configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t}}})),a}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new p(d.ASSET_NOT_SUPPORTED):new Error(s.message)}},async generateExchangeUrlForQuote({exchangeId:t,paymentAsset:e,amount:n,recipient:s}){const a=await he({exchangeId:t,asset:J(e.network,e.asset),amount:n.toString(),recipient:s});r.exchangeSessionId=a.sessionId,r.exchangeUrlForQuote=a.url},async openPayUrl(t,e,n=!1){try{const s=await this.getPayUrl(t.exchangeId,e,n);if(!s)throw new p(d.UNABLE_TO_GET_PAY_URL);const i=t.openInNewTab??!0?"_blank":"_self";return O.openHref(s.url,i),s}catch(s){throw s instanceof p?r.error=s.message:r.error=L.GENERIC_PAYMENT_ERROR,new p(d.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:t,fromAddress:e,toAddress:n,amount:s,paymentAsset:a}){if(r.currentPayment={type:"wallet",status:"IN_PROGRESS"},!r.isPaymentInProgress)try{this.initiatePayment();const o=m.getAllRequestedCaipNetworks().find(b=>b.caipNetworkId===a.network);if(!o)throw new Error("Target network not found");const u=m.state.activeCaipNetwork;switch(N.isLowerCaseMatch(u?.caipNetworkId,o.caipNetworkId)||await m.switchActiveNetwork(o),t){case I.CHAIN.EVM:a.asset==="native"&&(r.currentPayment.result=await De(a,t,{recipient:n,amount:s,fromAddress:e})),a.asset.startsWith("0x")&&(r.currentPayment.result=await Fe(a,{recipient:n,amount:s,fromAddress:e})),r.currentPayment.status="SUCCESS";break;case I.CHAIN.SOLANA:r.currentPayment.result=await Be(t,{recipient:n,amount:s,fromAddress:e,tokenMint:a.asset==="native"?void 0:a.asset}),r.currentPayment.status="SUCCESS";break;default:throw new p(d.INVALID_CHAIN_NAMESPACE)}}catch(i){throw i instanceof p?r.error=i.message:r.error=L.GENERIC_PAYMENT_ERROR,r.currentPayment.status="FAILED",R.showError(r.error),i}finally{r.isPaymentInProgress=!1}},async onSendTransaction(t){try{const{namespace:e,transactionStep:n}=t;c.initiatePayment();const a=m.getAllRequestedCaipNetworks().find(o=>o.caipNetworkId===r.paymentAsset?.network);if(!a)throw new Error("Target network not found");const i=m.state.activeCaipNetwork;if(N.isLowerCaseMatch(i?.caipNetworkId,a.caipNetworkId)||await m.switchActiveNetwork(a),e===I.CHAIN.EVM){const{from:o,to:u,data:b,value:K}=n.transaction;await T.sendTransaction({address:o,to:u,data:b,value:BigInt(K),chainNamespace:e})}else if(e===I.CHAIN.SOLANA){const{instructions:o}=n.transaction;await T.writeSolanaTransaction({instructions:o})}}catch(e){throw e instanceof p?r.error=e.message:r.error=L.GENERIC_PAYMENT_ERROR,R.showError(r.error),e}finally{r.isPaymentInProgress=!1}},getExchangeById(t){return r.exchanges.find(e=>e.id===t)},validatePayConfig(t){const{paymentAsset:e,recipient:n,amount:s}=t;if(!e)throw new p(d.INVALID_PAYMENT_CONFIG);if(!n)throw new p(d.INVALID_RECIPIENT);if(!e.asset)throw new p(d.INVALID_ASSET);if(s==null||s<=0)throw new p(d.INVALID_AMOUNT)},async handlePayWithExchange(t){try{r.currentPayment={type:"exchange",exchangeId:t};const{network:e,asset:n}=r.paymentAsset,s={network:e,asset:n,amount:r.amount,recipient:r.recipient},a=await this.getPayUrl(t,s);if(!a)throw new p(d.UNABLE_TO_INITIATE_PAYMENT);return r.currentPayment.sessionId=a.sessionId,r.currentPayment.status="IN_PROGRESS",r.currentPayment.exchangeId=t,this.initiatePayment(),{url:a.url,openInNewTab:r.openInNewTab}}catch(e){return e instanceof p?r.error=e.message:r.error=L.GENERIC_PAYMENT_ERROR,r.isPaymentInProgress=!1,R.showError(r.error),null}},async getBuyStatus(t,e){try{const n=await ze({sessionId:e,exchangeId:t});return(n.status==="SUCCESS"||n.status==="FAILED")&&j.sendEvent({type:"track",event:n.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:n.status==="FAILED"?O.parseError(r.error):void 0,source:"pay",paymentId:r.paymentId||Z,configuration:{network:r.paymentAsset.network,asset:r.paymentAsset.asset,recipient:r.recipient,amount:r.amount},currentPayment:{type:"exchange",exchangeId:r.currentPayment?.exchangeId,sessionId:r.currentPayment?.sessionId,result:n.txHash}}}),n}catch{throw new p(d.UNABLE_TO_GET_BUY_STATUS)}},async fetchTokensFromEOA({caipAddress:t,caipNetwork:e,namespace:n}){if(!t)return[];const{address:s}=w.parseCaipAddress(t);let a=e;return n===I.CHAIN.EVM&&(a=void 0),await ve.getMyTokensWithBalance({address:s,caipNetwork:a})},async fetchTokensFromExchange(){if(!r.selectedExchange)return[];const t=await Ye(r.selectedExchange.id),e=Object.values(t.assets).flat();return await Promise.all(e.map(async s=>{const a=Ze(s),{chainNamespace:i}=w.parseCaipNetworkId(a.chainId);let o=a.address;if(O.isCaipAddress(o)){const{address:b}=w.parseCaipAddress(o);o=b}const u=await S.getImageByToken(o??"",i).catch(()=>{});return a.iconUrl=u??"",a}))},async fetchTokens({caipAddress:t,caipNetwork:e,namespace:n}){try{r.isFetchingTokenBalances=!0;const i=await(!!r.selectedExchange?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:t,caipNetwork:e,namespace:n}));r.tokenBalances={...r.tokenBalances,[n]:i}}catch(s){const a=s instanceof Error?s.message:"Unable to get token balances";R.showError(a)}finally{r.isFetchingTokenBalances=!1}},async fetchQuote({amount:t,address:e,sourceToken:n,toToken:s,recipient:a}){try{c.resetQuoteState(),r.isFetchingQuote=!0;const i=await Qe({amount:t,address:r.selectedExchange?void 0:e,sourceToken:n,toToken:s,recipient:a});if(r.selectedExchange){const o=ee(i);if(o){const u=`${n.network}:${o.deposit.receiver}`,b=A.formatNumber(o.deposit.amount,{decimals:n.metadata.decimals??0,round:8});await c.generateExchangeUrlForQuote({exchangeId:r.selectedExchange.id,paymentAsset:n,amount:b.toString(),recipient:u})}}r.quote=i}catch(i){let o=L.UNABLE_TO_GET_QUOTE;if(i instanceof Error&&i.cause&&i.cause instanceof Response)try{const u=await i.cause.json();u.error&&typeof u.error=="string"&&(o=u.error)}catch{}throw r.quoteError=o,R.showError(o),new p(d.UNABLE_TO_GET_QUOTE)}finally{r.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:t}){try{if(t===te){const n=r.selectedExchange,s=r.exchangeSessionId;if(n&&s){switch((await this.getBuyStatus(n.id,s)).status){case"IN_PROGRESS":r.quoteStatus="waiting";break;case"SUCCESS":r.quoteStatus="success",r.isPaymentInProgress=!1;break;case"FAILED":r.quoteStatus="failure",r.isPaymentInProgress=!1;break;case"UNKNOWN":r.quoteStatus="waiting";break;default:r.quoteStatus="waiting";break}return}r.quoteStatus="success";return}const{status:e}=await Ve({requestId:t});r.quoteStatus=e}catch{throw r.quoteStatus="failure",new p(d.UNABLE_TO_GET_QUOTE_STATUS)}},initiatePayment(){r.isPaymentInProgress=!0,r.paymentId=crypto.randomUUID()},initializeAnalytics(){r.analyticsSet||(r.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",t=>{if(r.currentPayment?.status&&r.currentPayment.status!=="UNKNOWN"){const e={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[r.currentPayment.status];j.sendEvent({type:"track",event:e,properties:{message:r.currentPayment.status==="FAILED"?O.parseError(r.error):void 0,source:"pay",paymentId:r.paymentId||Z,configuration:{network:r.paymentAsset.network,asset:r.paymentAsset.asset,recipient:r.recipient,amount:r.amount},currentPayment:{type:r.currentPayment.type,exchangeId:r.currentPayment.exchangeId,sessionId:r.currentPayment.sessionId,result:r.currentPayment.result}}})}}))},async prepareTokenLogo(){if(!r.paymentAsset.metadata.logoURI)try{const{chainNamespace:t}=w.parseCaipNetworkId(r.paymentAsset.network),e=await S.getImageByToken(r.paymentAsset.asset,t);r.paymentAsset.metadata.logoURI=e}catch{}}},st=U`
131
+ wui-separator {
132
+ margin: var(--apkt-spacing-3) calc(var(--apkt-spacing-3) * -1) var(--apkt-spacing-2)
133
+ calc(var(--apkt-spacing-3) * -1);
134
+ width: calc(100% + var(--apkt-spacing-3) * 2);
135
+ }
136
+
137
+ .token-display {
138
+ padding: var(--apkt-spacing-3) var(--apkt-spacing-3);
139
+ border-radius: var(--apkt-borderRadius-5);
140
+ background-color: var(--apkt-tokens-theme-backgroundPrimary);
141
+ margin-top: var(--apkt-spacing-3);
142
+ margin-bottom: var(--apkt-spacing-3);
143
+ }
144
+
145
+ .token-display wui-text {
146
+ text-transform: none;
147
+ }
148
+
149
+ wui-loading-spinner {
150
+ padding: var(--apkt-spacing-2);
151
+ }
152
+
153
+ .left-image-container {
154
+ position: relative;
155
+ justify-content: center;
156
+ align-items: center;
157
+ }
158
+
159
+ .token-image {
160
+ border-radius: ${({borderRadius:t})=>t.round};
161
+ width: 40px;
162
+ height: 40px;
163
+ }
164
+
165
+ .chain-image {
166
+ position: absolute;
167
+ width: 20px;
168
+ height: 20px;
169
+ bottom: -3px;
170
+ right: -5px;
171
+ border-radius: ${({borderRadius:t})=>t.round};
172
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
173
+ }
174
+
175
+ .payment-methods-container {
176
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
177
+ border-top-right-radius: ${({borderRadius:t})=>t[8]};
178
+ border-top-left-radius: ${({borderRadius:t})=>t[8]};
179
+ }
180
+ `;var F=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};let k=class extends C{constructor(){super(),this.unsubscribe=[],this.amount=c.state.amount,this.namespace=void 0,this.paymentAsset=c.state.paymentAsset,this.activeConnectorIds=P.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=c.state.exchanges,this.isLoading=c.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(c.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(P.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(c.subscribeKey("exchanges",e=>this.exchanges=e)),this.unsubscribe.push(c.subscribeKey("isLoading",e=>this.isLoading=e)),c.fetchExchanges(),c.setSelectedExchange(void 0)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return l`
181
+ <wui-flex flexDirection="column">
182
+ ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()}
183
+ </wui-flex>
184
+ `}paymentMethodsTemplate(){return l`
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(){const e=m.state.activeChain;this.namespace=e,this.caipAddress=m.getAccountData(e)?.caipAddress,this.unsubscribe.push(m.subscribeChainProp("accountState",n=>{this.caipAddress=n?.caipAddress},e))}paymentDetailsTemplate(){const n=m.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===this.paymentAsset.network);return l`
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
+ ${Q(this.amount||"0")}
199
+ </wui-text>
200
+
201
+ <wui-flex flexDirection="column">
202
+ <wui-text variant="h6-regular" color="secondary">
203
+ ${this.paymentAsset.metadata.symbol||"Unknown"}
204
+ </wui-text>
205
+ <wui-text variant="md-medium" color="secondary"
206
+ >on ${n?.name||"Unknown"}</wui-text
207
+ >
208
+ </wui-flex>
209
+ </wui-flex>
210
+
211
+ <wui-flex class="left-image-container">
212
+ <wui-image
213
+ src=${g(this.paymentAsset.metadata.logoURI)}
214
+ class="token-image"
215
+ ></wui-image>
216
+ <wui-image
217
+ src=${g(S.getNetworkImage(n))}
218
+ class="chain-image"
219
+ ></wui-image>
220
+ </wui-flex>
221
+ </wui-flex>
222
+ `}payWithWalletTemplate(){return Xe(this.paymentAsset.network)?this.caipAddress?this.connectedWalletTemplate():this.disconnectedWalletTemplate():l``}connectedWalletTemplate(){const{name:e,image:n}=this.getWalletProperties({namespace:this.namespace});return l`
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=${g(n)}
234
+ imageSize="3xl"
235
+ >
236
+ <wui-text variant="lg-regular" color="primary">Pay with ${e}</wui-text>
237
+ </wui-list-item>
238
+
239
+ <wui-list-item
240
+ type="secondary"
241
+ icon="power"
242
+ iconColor="error"
243
+ @click=${this.onDisconnect}
244
+ data-testid="disconnect-button"
245
+ ?chevron=${!1}
246
+ boxColor="foregroundSecondary"
247
+ >
248
+ <wui-text variant="lg-regular" color="secondary">Disconnect</wui-text>
249
+ </wui-list-item>
250
+ </wui-flex>
251
+ `}disconnectedWalletTemplate(){return l`<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 l`<wui-flex justifyContent="center" alignItems="center">
264
+ <wui-loading-spinner size="md"></wui-loading-spinner>
265
+ </wui-flex>`;const e=this.exchanges.filter(n=>et(this.paymentAsset)?n.id===de:n.id!==de);return e.length===0?l`<wui-flex justifyContent="center" alignItems="center">
266
+ <wui-text variant="md-medium" color="primary">No exchanges available</wui-text>
267
+ </wui-flex>`:e.map(n=>l`
268
+ <wui-list-item
269
+ type="secondary"
270
+ boxColor="foregroundSecondary"
271
+ @click=${()=>this.onExchangePayment(n)}
272
+ data-testid="exchange-option-${n.id}"
273
+ ?chevron=${!0}
274
+ imageSrc=${g(n.imageUrl)}
275
+ >
276
+ <wui-text flexGrow="1" variant="lg-regular" color="primary">
277
+ Pay with ${n.name}
278
+ </wui-text>
279
+ </wui-list-item>
280
+ `)}templateSeparator(){return l`<wui-separator text="or" bgColor="secondary"></wui-separator>`}async onWalletPayment(){if(!this.namespace)throw new Error("Namespace not found");this.caipAddress?M.push("PayQuote"):(await P.connect(),await z.open({view:"PayQuote"}))}onExchangePayment(e){c.setSelectedExchange(e),M.push("PayQuote")}async onDisconnect(){try{await T.disconnect(),await z.open({view:"Pay"})}catch{console.error("Failed to disconnect"),R.showError("Failed to disconnect")}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=P.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const a=S.getConnectorImage(s);return{name:s.name,image:a}}};k.styles=st;F([h()],k.prototype,"amount",void 0);F([h()],k.prototype,"namespace",void 0);F([h()],k.prototype,"paymentAsset",void 0);F([h()],k.prototype,"activeConnectorIds",void 0);F([h()],k.prototype,"caipAddress",void 0);F([h()],k.prototype,"exchanges",void 0);F([h()],k.prototype,"isLoading",void 0);k=F([_("w3m-pay-view")],k);const it=U`
281
+ :host {
282
+ display: inline-flex;
283
+ align-items: center;
284
+ justify-content: center;
285
+ }
286
+
287
+ .pulse-container {
288
+ position: relative;
289
+ width: var(--pulse-size);
290
+ height: var(--pulse-size);
291
+ display: flex;
292
+ align-items: center;
293
+ justify-content: center;
294
+ }
295
+
296
+ .pulse-rings {
297
+ position: absolute;
298
+ inset: 0;
299
+ pointer-events: none;
300
+ }
301
+
302
+ .pulse-ring {
303
+ position: absolute;
304
+ inset: 0;
305
+ border-radius: 50%;
306
+ border: 2px solid var(--pulse-color);
307
+ opacity: 0;
308
+ animation: pulse var(--pulse-duration, 2s) ease-out infinite;
309
+ }
310
+
311
+ .pulse-content {
312
+ position: relative;
313
+ z-index: 1;
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ }
318
+
319
+ @keyframes pulse {
320
+ 0% {
321
+ transform: scale(0.5);
322
+ opacity: var(--pulse-opacity, 0.3);
323
+ }
324
+ 50% {
325
+ opacity: calc(var(--pulse-opacity, 0.3) * 0.5);
326
+ }
327
+ 100% {
328
+ transform: scale(1.2);
329
+ opacity: 0;
330
+ }
331
+ }
332
+ `;var W=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};const at=3,rt=2,ot=.3,ct="200px",ut={"accent-primary":$e.tokens.core.backgroundAccentPrimary};let q=class extends C{constructor(){super(...arguments),this.rings=at,this.duration=rt,this.opacity=ot,this.size=ct,this.variant="accent-primary"}render(){const e=ut[this.variant];this.style.cssText=`
333
+ --pulse-size: ${this.size};
334
+ --pulse-duration: ${this.duration}s;
335
+ --pulse-color: ${e};
336
+ --pulse-opacity: ${this.opacity};
337
+ `;const n=Array.from({length:this.rings},(s,a)=>this.renderRing(a,this.rings));return l`
338
+ <div class="pulse-container">
339
+ <div class="pulse-rings">${n}</div>
340
+ <div class="pulse-content">
341
+ <slot></slot>
342
+ </div>
343
+ </div>
344
+ `}renderRing(e,n){const a=`animation-delay: ${e/n*this.duration}s;`;return l`<div class="pulse-ring" style=${a}></div>`}};q.styles=[we,it];W([x({type:Number})],q.prototype,"rings",void 0);W([x({type:Number})],q.prototype,"duration",void 0);W([x({type:Number})],q.prototype,"opacity",void 0);W([x()],q.prototype,"size",void 0);W([x()],q.prototype,"variant",void 0);q=W([_("wui-pulse")],q);const ge=[{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"}],fe=["success","submitted","failure","timeout","refund"],lt=U`
345
+ :host {
346
+ display: block;
347
+ height: 100%;
348
+ width: 100%;
349
+ }
350
+
351
+ wui-image {
352
+ border-radius: ${({borderRadius:t})=>t.round};
353
+ }
354
+
355
+ .token-badge-container {
356
+ position: absolute;
357
+ bottom: 6px;
358
+ left: 50%;
359
+ transform: translateX(-50%);
360
+ border-radius: ${({borderRadius:t})=>t[4]};
361
+ z-index: 3;
362
+ min-width: 105px;
363
+ }
364
+
365
+ .token-badge-container.loading {
366
+ background-color: ${({tokens:t})=>t.theme.backgroundPrimary};
367
+ border: 3px solid ${({tokens:t})=>t.theme.backgroundPrimary};
368
+ }
369
+
370
+ .token-badge-container.success {
371
+ background-color: ${({tokens:t})=>t.theme.backgroundPrimary};
372
+ border: 3px solid ${({tokens:t})=>t.theme.backgroundPrimary};
373
+ }
374
+
375
+ .token-image-container {
376
+ position: relative;
377
+ }
378
+
379
+ .token-image {
380
+ border-radius: ${({borderRadius:t})=>t.round};
381
+ width: 64px;
382
+ height: 64px;
383
+ }
384
+
385
+ .token-image.success {
386
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
387
+ }
388
+
389
+ .token-image.error {
390
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
391
+ }
392
+
393
+ .token-image.loading {
394
+ background: ${({colors:t})=>t.accent010};
395
+ }
396
+
397
+ .token-image wui-icon {
398
+ width: 32px;
399
+ height: 32px;
400
+ }
401
+
402
+ .token-badge {
403
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
404
+ border: 1px solid ${({tokens:t})=>t.theme.foregroundSecondary};
405
+ border-radius: ${({borderRadius:t})=>t[4]};
406
+ }
407
+
408
+ .token-badge wui-text {
409
+ white-space: nowrap;
410
+ }
411
+
412
+ .payment-lifecycle-container {
413
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
414
+ border-top-right-radius: ${({borderRadius:t})=>t[6]};
415
+ border-top-left-radius: ${({borderRadius:t})=>t[6]};
416
+ }
417
+
418
+ .payment-step-badge {
419
+ padding: ${({spacing:t})=>t[1]} ${({spacing:t})=>t[2]};
420
+ border-radius: ${({borderRadius:t})=>t[1]};
421
+ }
422
+
423
+ .payment-step-badge.loading {
424
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
425
+ }
426
+
427
+ .payment-step-badge.error {
428
+ background-color: ${({tokens:t})=>t.core.backgroundError};
429
+ }
430
+
431
+ .payment-step-badge.success {
432
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
433
+ }
434
+
435
+ .step-icon-container {
436
+ position: relative;
437
+ height: 40px;
438
+ width: 40px;
439
+ border-radius: ${({borderRadius:t})=>t.round};
440
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
441
+ }
442
+
443
+ .step-icon-box {
444
+ position: absolute;
445
+ right: -4px;
446
+ bottom: -1px;
447
+ padding: 2px;
448
+ border-radius: ${({borderRadius:t})=>t.round};
449
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
450
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
451
+ }
452
+
453
+ .step-icon-box.success {
454
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
455
+ }
456
+ `;var $=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};const dt={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]},pt=3e3;let E=class extends C{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=c.state.paymentAsset,this.quoteStatus=c.state.quoteStatus,this.quote=c.state.quote,this.amount=c.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=P.state.activeConnectorIds,this.selectedExchange=c.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(c.subscribeKey("quoteStatus",e=>this.quoteStatus=e),c.subscribeKey("quote",e=>this.quote=e),P.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e),c.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach(e=>e())}render(){return l`
457
+ <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2">
458
+ ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()}
459
+ </wui-flex>
460
+ `}tokenTemplate(){const e=Q(this.amount||"0"),n=this.paymentAsset.metadata.symbol??"Unknown",a=m.getAllRequestedCaipNetworks().find(u=>u.caipNetworkId===this.paymentAsset.network),i=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund";return this.quoteStatus==="success"||this.quoteStatus==="submitted"?l`<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>`:i?l`<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>`:l`
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=${g(S.getNetworkImage(a))}
491
+ class="chain-image"
492
+ size="mdl"
493
+ ></wui-image>
494
+
495
+ <wui-text variant="lg-regular" color="primary">${e} ${n}</wui-text>
496
+ </wui-flex>
497
+ </wui-flex>
498
+ </wui-flex>
499
+ </wui-flex>
500
+ `}paymentTemplate(){return l`
501
+ <wui-flex flexDirection="column" gap="2" .padding=${["0","6","0","6"]}>
502
+ ${this.renderPayment()}
503
+ <wui-separator></wui-separator>
504
+ ${this.renderWallet()}
505
+ </wui-flex>
506
+ `}paymentLifecycleTemplate(){const e=this.getStepsWithStatus();return l`
507
+ <wui-flex flexDirection="column" padding="4" gap="2" class="payment-lifecycle-container">
508
+ <wui-flex alignItems="center" justifyContent="space-between">
509
+ <wui-text variant="md-regular" color="secondary">PAYMENT CYCLE</wui-text>
510
+
511
+ ${this.renderPaymentCycleBadge()}
512
+ </wui-flex>
513
+
514
+ <wui-flex flexDirection="column" gap="5" .padding=${["2","0","2","0"]}>
515
+ ${e.map(n=>this.renderStep(n))}
516
+ </wui-flex>
517
+ </wui-flex>
518
+ `}renderPaymentCycleBadge(){const e=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund",n=this.quoteStatus==="success"||this.quoteStatus==="submitted";if(e)return l`
519
+ <wui-flex
520
+ justifyContent="center"
521
+ alignItems="center"
522
+ class="payment-step-badge error"
523
+ gap="1"
524
+ >
525
+ <wui-icon name="close" color="error" size="xs"></wui-icon>
526
+ <wui-text variant="sm-regular" color="error">Failed</wui-text>
527
+ </wui-flex>
528
+ `;if(n)return l`
529
+ <wui-flex
530
+ justifyContent="center"
531
+ alignItems="center"
532
+ class="payment-step-badge success"
533
+ gap="1"
534
+ >
535
+ <wui-icon name="checkmark" color="success" size="xs"></wui-icon>
536
+ <wui-text variant="sm-regular" color="success">Completed</wui-text>
537
+ </wui-flex>
538
+ `;const s=this.quote?.timeInSeconds??0;return l`
539
+ <wui-flex alignItems="center" justifyContent="space-between" gap="3">
540
+ <wui-flex
541
+ justifyContent="center"
542
+ alignItems="center"
543
+ class="payment-step-badge loading"
544
+ gap="1"
545
+ >
546
+ <wui-icon name="clock" color="default" size="xs"></wui-icon>
547
+ <wui-text variant="sm-regular" color="primary">Est. ${s} sec</wui-text>
548
+ </wui-flex>
549
+
550
+ <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon>
551
+ </wui-flex>
552
+ `}renderPayment(){const n=m.getAllRequestedCaipNetworks().find(o=>{const u=this.quote?.origin.currency.network;if(!u)return!1;const{chainId:b}=w.parseCaipNetworkId(u);return N.isLowerCaseMatch(o.id.toString(),b.toString())}),s=A.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString(),a=Q(s),i=this.quote?.origin.currency.metadata.symbol??"Unknown";return l`
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">${a}</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=${g(S.getNetworkImage(n))}
570
+ size="xs"
571
+ ></wui-image>
572
+ <wui-text variant="md-regular" color="secondary">${n?.name}</wui-text>
573
+ </wui-flex>
574
+ </wui-flex>
575
+ </wui-flex>
576
+ `}renderWallet(){return l`
577
+ <wui-flex
578
+ alignItems="flex-start"
579
+ justifyContent="space-between"
580
+ .padding=${["3","0","3","0"]}
581
+ >
582
+ <wui-text variant="lg-regular" color="secondary">Wallet</wui-text>
583
+
584
+ ${this.renderWalletText()}
585
+ </wui-flex>
586
+ `}renderWalletText(){const{image:e}=this.getWalletProperties({namespace:this.namespace}),{address:n}=this.caipAddress?w.parseCaipAddress(this.caipAddress):{},s=this.selectedExchange?.name;return this.selectedExchange?l`
587
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
588
+ <wui-text variant="lg-regular" color="primary">${s}</wui-text>
589
+ <wui-image src=${g(this.selectedExchange.imageUrl)} size="mdl"></wui-image>
590
+ </wui-flex>
591
+ `:l`
592
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
593
+ <wui-text variant="lg-regular" color="primary">
594
+ ${Re.getTruncateString({string:this.profileName||n||s||"",charsStart:this.profileName?16:4,charsEnd:this.profileName?0:6,truncate:this.profileName?"end":"middle"})}
595
+ </wui-text>
596
+
597
+ <wui-image src=${g(e)} size="mdl"></wui-image>
598
+ </wui-flex>
599
+ `}getStepsWithStatus(){return this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund"?ge.map(n=>({...n,status:"failed"})):ge.map(n=>{const a=(dt[n.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...n,status:a}})}renderStep({title:e,icon:n,status:s}){return l`
600
+ <wui-flex alignItems="center" gap="3">
601
+ <wui-flex justifyContent="center" alignItems="center" class="step-icon-container">
602
+ <wui-icon name=${n} color="default" size="mdl"></wui-icon>
603
+
604
+ <wui-flex alignItems="center" justifyContent="center" class=${ye({"step-icon-box":!0,success:s==="completed"})}>
605
+ ${this.renderStatusIndicator(s)}
606
+ </wui-flex>
607
+ </wui-flex>
608
+
609
+ <wui-text variant="md-regular" color="primary">${e}</wui-text>
610
+ </wui-flex>
611
+ `}renderStatusIndicator(e){return e==="completed"?l`<wui-icon size="sm" color="success" name="checkmark"></wui-icon>`:e==="failed"?l`<wui-icon size="sm" color="error" name="close"></wui-icon>`:e==="pending"?l`<wui-loading-spinner color="accent-primary" size="sm"></wui-loading-spinner>`:null}startPolling(){this.pollingInterval||(this.fetchQuoteStatus(),this.pollingInterval=setInterval(()=>{this.fetchQuoteStatus()},pt))}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}async fetchQuoteStatus(){const e=c.state.requestId;if(!e||fe.includes(this.quoteStatus))this.stopPolling();else try{await c.fetchQuoteStatus({requestId:e}),fe.includes(this.quoteStatus)&&this.stopPolling()}catch{this.stopPolling()}}initializeNamespace(){const e=m.state.activeChain;this.namespace=e,this.caipAddress=m.getAccountData(e)?.caipAddress,this.profileName=m.getAccountData(e)?.profileName??null,this.unsubscribe.push(m.subscribeChainProp("accountState",n=>{this.caipAddress=n?.caipAddress,this.profileName=n?.profileName??null},e))}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=P.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const a=S.getConnectorImage(s);return{name:s.name,image:a}}};E.styles=lt;$([h()],E.prototype,"paymentAsset",void 0);$([h()],E.prototype,"quoteStatus",void 0);$([h()],E.prototype,"quote",void 0);$([h()],E.prototype,"amount",void 0);$([h()],E.prototype,"namespace",void 0);$([h()],E.prototype,"caipAddress",void 0);$([h()],E.prototype,"profileName",void 0);$([h()],E.prototype,"activeConnectorIds",void 0);$([h()],E.prototype,"selectedExchange",void 0);E=$([_("w3m-pay-loading-view")],E);const ht=Oe`
612
+ :host {
613
+ display: block;
614
+ }
615
+ `;var mt=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};let ne=class extends C{render(){return l`
616
+ <wui-flex flexDirection="column" gap="4">
617
+ <wui-flex alignItems="center" justifyContent="space-between">
618
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
619
+ <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
620
+ </wui-flex>
621
+
622
+ <wui-flex alignItems="center" justifyContent="space-between">
623
+ <wui-text variant="md-regular" color="secondary">Network Fee</wui-text>
624
+
625
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
626
+ <wui-shimmer
627
+ width="75px"
628
+ height="16px"
629
+ borderRadius="4xs"
630
+ variant="light"
631
+ ></wui-shimmer>
632
+
633
+ <wui-flex alignItems="center" gap="01">
634
+ <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer>
635
+ <wui-shimmer
636
+ width="49px"
637
+ height="14px"
638
+ borderRadius="4xs"
639
+ variant="light"
640
+ ></wui-shimmer>
641
+ </wui-flex>
642
+ </wui-flex>
643
+ </wui-flex>
644
+
645
+ <wui-flex alignItems="center" justifyContent="space-between">
646
+ <wui-text variant="md-regular" color="secondary">Service Fee</wui-text>
647
+ <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
648
+ </wui-flex>
649
+ </wui-flex>
650
+ `}};ne.styles=[ht];ne=mt([_("w3m-pay-fees-skeleton")],ne);const gt=U`
651
+ :host {
652
+ display: block;
653
+ }
654
+
655
+ wui-image {
656
+ border-radius: ${({borderRadius:t})=>t.round};
657
+ }
658
+ `;var be=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};let V=class extends C{constructor(){super(),this.unsubscribe=[],this.quote=c.state.quote,this.unsubscribe.push(c.subscribeKey("quote",e=>this.quote=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=A.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0,round:6}).toString();return l`
659
+ <wui-flex flexDirection="column" gap="4">
660
+ <wui-flex alignItems="center" justifyContent="space-between">
661
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
662
+ <wui-text variant="md-regular" color="primary">
663
+ ${e} ${this.quote?.origin.currency.metadata.symbol||"Unknown"}
664
+ </wui-text>
665
+ </wui-flex>
666
+
667
+ ${this.quote&&this.quote.fees.length>0?this.quote.fees.map(n=>this.renderFee(n)):null}
668
+ </wui-flex>
669
+ `}renderFee(e){const n=e.id==="network",s=A.formatNumber(e.amount||"0",{decimals:e.currency.metadata.decimals??0,round:6}).toString();if(n){const i=m.getAllRequestedCaipNetworks().find(o=>N.isLowerCaseMatch(o.caipNetworkId,e.currency.network));return l`
670
+ <wui-flex alignItems="center" justifyContent="space-between">
671
+ <wui-text variant="md-regular" color="secondary">${e.label}</wui-text>
672
+
673
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
674
+ <wui-text variant="md-regular" color="primary">
675
+ ${s} ${e.currency.metadata.symbol||"Unknown"}
676
+ </wui-text>
677
+
678
+ <wui-flex alignItems="center" gap="01">
679
+ <wui-image
680
+ src=${g(S.getNetworkImage(i))}
681
+ size="xs"
682
+ ></wui-image>
683
+ <wui-text variant="sm-regular" color="secondary">
684
+ ${i?.name||"Unknown"}
685
+ </wui-text>
686
+ </wui-flex>
687
+ </wui-flex>
688
+ </wui-flex>
689
+ `}return l`
690
+ <wui-flex alignItems="center" justifyContent="space-between">
691
+ <wui-text variant="md-regular" color="secondary">${e.label}</wui-text>
692
+ <wui-text variant="md-regular" color="primary">
693
+ ${s} ${e.currency.metadata.symbol||"Unknown"}
694
+ </wui-text>
695
+ </wui-flex>
696
+ `}};V.styles=[gt];be([h()],V.prototype,"quote",void 0);V=be([_("w3m-pay-fees")],V);const ft=U`
697
+ :host {
698
+ display: block;
699
+ width: 100%;
700
+ }
701
+
702
+ .disabled-container {
703
+ padding: ${({spacing:t})=>t[2]};
704
+ min-height: 168px;
705
+ }
706
+
707
+ wui-icon {
708
+ width: ${({spacing:t})=>t[8]};
709
+ height: ${({spacing:t})=>t[8]};
710
+ }
711
+
712
+ wui-flex > wui-text {
713
+ max-width: 273px;
714
+ }
715
+ `;var xe=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};let Y=class extends C{constructor(){super(),this.unsubscribe=[],this.selectedExchange=c.state.selectedExchange,this.unsubscribe.push(c.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=!!this.selectedExchange;return l`
716
+ <wui-flex
717
+ flexDirection="column"
718
+ alignItems="center"
719
+ justifyContent="center"
720
+ gap="3"
721
+ class="disabled-container"
722
+ >
723
+ <wui-icon name="coins" color="default" size="inherit"></wui-icon>
724
+
725
+ <wui-text variant="md-regular" color="primary" align="center">
726
+ You don't have enough funds to complete this transaction
727
+ </wui-text>
728
+
729
+ ${e?null:l`<wui-button
730
+ size="md"
731
+ variant="neutral-secondary"
732
+ @click=${this.dispatchConnectOtherWalletEvent.bind(this)}
733
+ >Connect other wallet</wui-button
734
+ >`}
735
+ </wui-flex>
736
+ `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}};Y.styles=[ft];xe([x({type:Array})],Y.prototype,"selectedExchange",void 0);Y=xe([_("w3m-pay-options-empty")],Y);const wt=U`
737
+ :host {
738
+ display: block;
739
+ width: 100%;
740
+ }
741
+
742
+ .pay-options-container {
743
+ max-height: 196px;
744
+ overflow-y: auto;
745
+ overflow-x: hidden;
746
+ scrollbar-width: none;
747
+ }
748
+
749
+ .pay-options-container::-webkit-scrollbar {
750
+ display: none;
751
+ }
752
+
753
+ .pay-option-container {
754
+ border-radius: ${({borderRadius:t})=>t[4]};
755
+ padding: ${({spacing:t})=>t[3]};
756
+ min-height: 60px;
757
+ }
758
+
759
+ .token-images-container {
760
+ position: relative;
761
+ justify-content: center;
762
+ align-items: center;
763
+ }
764
+
765
+ .chain-image {
766
+ position: absolute;
767
+ bottom: -3px;
768
+ right: -5px;
769
+ border: 2px solid ${({tokens:t})=>t.theme.foregroundSecondary};
770
+ }
771
+ `;var yt=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};let se=class extends C{render(){return l`
772
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
773
+ ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()}
774
+ </wui-flex>
775
+ `}renderOptionEntry(){return l`
776
+ <wui-flex
777
+ alignItems="center"
778
+ justifyContent="space-between"
779
+ gap="2"
780
+ class="pay-option-container"
781
+ >
782
+ <wui-flex alignItems="center" gap="2">
783
+ <wui-flex class="token-images-container">
784
+ <wui-shimmer
785
+ width="32px"
786
+ height="32px"
787
+ rounded
788
+ variant="light"
789
+ class="token-image"
790
+ ></wui-shimmer>
791
+ <wui-shimmer
792
+ width="16px"
793
+ height="16px"
794
+ rounded
795
+ variant="light"
796
+ class="chain-image"
797
+ ></wui-shimmer>
798
+ </wui-flex>
799
+
800
+ <wui-flex flexDirection="column" gap="1">
801
+ <wui-shimmer
802
+ width="74px"
803
+ height="16px"
804
+ borderRadius="4xs"
805
+ variant="light"
806
+ ></wui-shimmer>
807
+ <wui-shimmer
808
+ width="46px"
809
+ height="14px"
810
+ borderRadius="4xs"
811
+ variant="light"
812
+ ></wui-shimmer>
813
+ </wui-flex>
814
+ </wui-flex>
815
+ </wui-flex>
816
+ `}};se.styles=[wt];se=yt([_("w3m-pay-options-skeleton")],se);const bt=U`
817
+ :host {
818
+ display: block;
819
+ width: 100%;
820
+ }
821
+
822
+ .pay-options-container {
823
+ max-height: 196px;
824
+ overflow-y: auto;
825
+ overflow-x: hidden;
826
+ scrollbar-width: none;
827
+ mask-image: var(--options-mask-image);
828
+ -webkit-mask-image: var(--options-mask-image);
829
+ }
830
+
831
+ .pay-options-container::-webkit-scrollbar {
832
+ display: none;
833
+ }
834
+
835
+ .pay-option-container {
836
+ cursor: pointer;
837
+ border-radius: ${({borderRadius:t})=>t[4]};
838
+ padding: ${({spacing:t})=>t[3]};
839
+ transition: background-color ${({durations:t})=>t.lg}
840
+ ${({easings:t})=>t["ease-out-power-1"]};
841
+ will-change: background-color;
842
+ }
843
+
844
+ .token-images-container {
845
+ position: relative;
846
+ justify-content: center;
847
+ align-items: center;
848
+ }
849
+
850
+ .token-image {
851
+ border-radius: ${({borderRadius:t})=>t.round};
852
+ width: 32px;
853
+ height: 32px;
854
+ }
855
+
856
+ .chain-image {
857
+ position: absolute;
858
+ width: 16px;
859
+ height: 16px;
860
+ bottom: -3px;
861
+ right: -5px;
862
+ border-radius: ${({borderRadius:t})=>t.round};
863
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
864
+ }
865
+
866
+ @media (hover: hover) and (pointer: fine) {
867
+ .pay-option-container:hover {
868
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
869
+ }
870
+ }
871
+ `;var H=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};const xt=300;let B=class extends C{constructor(){super(),this.unsubscribe=[],this.options=[],this.selectedPaymentAsset=null}disconnectedCallback(){this.unsubscribe.forEach(n=>n()),this.resizeObserver?.disconnect(),this.shadowRoot?.querySelector(".pay-options-container")?.removeEventListener("scroll",this.handleOptionsListScroll.bind(this))}firstUpdated(){const 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 l`
872
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
873
+ ${this.options.map(e=>this.payOptionTemplate(e))}
874
+ </wui-flex>
875
+ `}payOptionTemplate(e){const{network:n,metadata:s,asset:a,amount:i="0"}=e,u=m.getAllRequestedCaipNetworks().find(Ie=>Ie.caipNetworkId===n),b=`${n}:${a}`,K=`${this.selectedPaymentAsset?.network}:${this.selectedPaymentAsset?.asset}`,Ae=b===K,ce=A.bigNumber(i,{safe:!0}),Ee=ce.gt(0);return l`
876
+ <wui-flex
877
+ alignItems="center"
878
+ justifyContent="space-between"
879
+ gap="2"
880
+ @click=${()=>this.onSelect?.(e)}
881
+ class="pay-option-container"
882
+ >
883
+ <wui-flex alignItems="center" gap="2">
884
+ <wui-flex class="token-images-container">
885
+ <wui-image
886
+ src=${g(s.logoURI)}
887
+ class="token-image"
888
+ size="3xl"
889
+ ></wui-image>
890
+ <wui-image
891
+ src=${g(S.getNetworkImage(u))}
892
+ class="chain-image"
893
+ size="md"
894
+ ></wui-image>
895
+ </wui-flex>
896
+
897
+ <wui-flex flexDirection="column" gap="1">
898
+ <wui-text variant="lg-regular" color="primary">${s.symbol}</wui-text>
899
+ ${Ee?l`<wui-text variant="sm-regular" color="secondary">
900
+ ${ce.round(6).toString()} ${s.symbol}
901
+ </wui-text>`:null}
902
+ </wui-flex>
903
+ </wui-flex>
904
+
905
+ ${Ae?l`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null}
906
+ </wui-flex>
907
+ `}handleOptionsListScroll(){const e=this.shadowRoot?.querySelector(".pay-options-container");if(!e)return;e.scrollHeight>xt?(e.style.setProperty("--options-mask-image",`linear-gradient(
908
+ to bottom,
909
+ rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px,
910
+ rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px,
911
+ black 50px,
912
+ black calc(100% - 50px),
913
+ rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px),
914
+ rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100%
915
+ )`),e.style.setProperty("--options-scroll--top-opacity",le.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--options-scroll--bottom-opacity",le.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"))}};B.styles=[bt];H([x({type:Array})],B.prototype,"options",void 0);H([x()],B.prototype,"selectedPaymentAsset",void 0);H([x()],B.prototype,"onSelect",void 0);B=H([_("w3m-pay-options")],B);const At=U`
916
+ .payment-methods-container {
917
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
918
+ border-top-right-radius: ${({borderRadius:t})=>t[5]};
919
+ border-top-left-radius: ${({borderRadius:t})=>t[5]};
920
+ }
921
+
922
+ .pay-options-container {
923
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
924
+ border-radius: ${({borderRadius:t})=>t[5]};
925
+ padding: ${({spacing:t})=>t[1]};
926
+ }
927
+
928
+ w3m-tooltip-trigger {
929
+ display: flex;
930
+ align-items: center;
931
+ justify-content: center;
932
+ max-width: fit-content;
933
+ }
934
+
935
+ wui-image {
936
+ border-radius: ${({borderRadius:t})=>t.round};
937
+ }
938
+
939
+ w3m-pay-options.disabled {
940
+ opacity: 0.5;
941
+ pointer-events: none;
942
+ }
943
+ `;var y=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};const G={eip155:"ethereum",solana:"solana",bip122:"bitcoin",ton:"ton"},Et={eip155:{icon:G.eip155,label:"EVM"},solana:{icon:G.solana,label:"Solana"},bip122:{icon:G.bip122,label:"Bitcoin"},ton:{icon:G.ton,label:"Ton"}};let f=class extends C{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=c.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=c.state.amount,this.recipient=c.state.recipient,this.activeConnectorIds=P.state.activeConnectorIds,this.selectedPaymentAsset=c.state.selectedPaymentAsset,this.selectedExchange=c.state.selectedExchange,this.isFetchingQuote=c.state.isFetchingQuote,this.quoteError=c.state.quoteError,this.quote=c.state.quote,this.isFetchingTokenBalances=c.state.isFetchingTokenBalances,this.tokenBalances=c.state.tokenBalances,this.isPaymentInProgress=c.state.isPaymentInProgress,this.exchangeUrlForQuote=c.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(c.subscribeKey("paymentAsset",e=>this.paymentAsset=e)),this.unsubscribe.push(c.subscribeKey("tokenBalances",e=>this.onTokenBalancesChanged(e))),this.unsubscribe.push(c.subscribeKey("isFetchingTokenBalances",e=>this.isFetchingTokenBalances=e)),this.unsubscribe.push(P.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(c.subscribeKey("selectedPaymentAsset",e=>this.selectedPaymentAsset=e)),this.unsubscribe.push(c.subscribeKey("isFetchingQuote",e=>this.isFetchingQuote=e)),this.unsubscribe.push(c.subscribeKey("quoteError",e=>this.quoteError=e)),this.unsubscribe.push(c.subscribeKey("quote",e=>this.quote=e)),this.unsubscribe.push(c.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(c.subscribeKey("recipient",e=>this.recipient=e)),this.unsubscribe.push(c.subscribeKey("isPaymentInProgress",e=>this.isPaymentInProgress=e)),this.unsubscribe.push(c.subscribeKey("selectedExchange",e=>this.selectedExchange=e)),this.unsubscribe.push(c.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 l`
944
+ <wui-flex flexDirection="column">
945
+ ${this.profileTemplate()}
946
+
947
+ <wui-flex
948
+ flexDirection="column"
949
+ gap="4"
950
+ class="payment-methods-container"
951
+ .padding=${["4","4","5","4"]}
952
+ >
953
+ ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()}
954
+
955
+ <wui-flex
956
+ alignItems="center"
957
+ justifyContent="space-between"
958
+ .padding=${["1","0","1","0"]}
959
+ >
960
+ <wui-separator></wui-separator>
961
+ </wui-flex>
962
+
963
+ ${this.paymentActionsTemplate()}
964
+ </wui-flex>
965
+ </wui-flex>
966
+ `}profileTemplate(){if(this.selectedExchange){const o=A.formatNumber(this.quote?.origin.amount,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return l`
967
+ <wui-flex
968
+ .padding=${["4","3","4","3"]}
969
+ alignItems="center"
970
+ justifyContent="space-between"
971
+ gap="2"
972
+ >
973
+ <wui-text variant="lg-regular" color="secondary">Paying with</wui-text>
974
+
975
+ ${this.quote?l`<wui-text variant="lg-regular" color="primary">
976
+ ${A.bigNumber(o,{safe:!0}).round(6).toString()}
977
+ ${this.quote.origin.currency.metadata.symbol}
978
+ </wui-text>`:l`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`}
979
+ </wui-flex>
980
+ `}const e=O.getPlainAddress(this.caipAddress)??"",{name:n,image:s}=this.getWalletProperties({namespace:this.namespace}),{icon:a,label:i}=Et[this.namespace]??{};return l`
981
+ <wui-flex
982
+ .padding=${["4","3","4","3"]}
983
+ alignItems="center"
984
+ justifyContent="space-between"
985
+ gap="2"
986
+ >
987
+ <wui-wallet-switch
988
+ profileName=${g(this.profileName)}
989
+ address=${g(e)}
990
+ imageSrc=${g(s)}
991
+ alt=${g(n)}
992
+ @click=${this.onConnectOtherWallet.bind(this)}
993
+ data-testid="wui-wallet-switch"
994
+ ></wui-wallet-switch>
995
+
996
+ <wui-wallet-switch
997
+ profileName=${g(i)}
998
+ address=${g(e)}
999
+ icon=${g(a)}
1000
+ iconSize="xs"
1001
+ .enableGreenCircle=${!1}
1002
+ alt=${g(i)}
1003
+ @click=${this.onConnectOtherWallet.bind(this)}
1004
+ data-testid="wui-wallet-switch"
1005
+ ></wui-wallet-switch>
1006
+ </wui-flex>
1007
+ `}initializeNamespace(){const e=m.state.activeChain;this.namespace=e,this.caipAddress=m.getAccountData(e)?.caipAddress,this.profileName=m.getAccountData(e)?.profileName??null,this.unsubscribe.push(m.subscribeChainProp("accountState",n=>this.onAccountStateChanged(n),e))}async fetchTokens(){if(this.namespace){let e;if(this.caipAddress){const{chainId:n,chainNamespace:s}=w.parseCaipAddress(this.caipAddress),a=`${s}:${n}`;e=m.getAllRequestedCaipNetworks().find(o=>o.caipNetworkId===a)}await c.fetchTokens({caipAddress:this.caipAddress,caipNetwork:e,namespace:this.namespace})}}fetchQuote(){if(this.amount&&this.recipient&&this.selectedPaymentAsset&&this.paymentAsset){const{address:e}=this.caipAddress?w.parseCaipAddress(this.caipAddress):{};c.fetchQuote({amount:this.amount.toString(),address:e,sourceToken:this.selectedPaymentAsset,toToken:this.paymentAsset,recipient:this.recipient})}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=P.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const a=S.getConnectorImage(s);return{name:s.name,image:a}}paymentOptionsViewTemplate(){return l`
1008
+ <wui-flex flexDirection="column" gap="2">
1009
+ <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text>
1010
+ <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex>
1011
+ </wui-flex>
1012
+ `}paymentOptionsTemplate(){const e=this.getPaymentAssetFromTokenBalances();if(this.isFetchingTokenBalances)return l`<w3m-pay-options-skeleton></w3m-pay-options-skeleton>`;if(e.length===0)return l`<w3m-pay-options-empty
1013
+ @connectOtherWallet=${this.onConnectOtherWallet.bind(this)}
1014
+ ></w3m-pay-options-empty>`;const n={disabled:this.isFetchingQuote};return l`<w3m-pay-options
1015
+ class=${ye(n)}
1016
+ .options=${e}
1017
+ .selectedPaymentAsset=${g(this.selectedPaymentAsset)}
1018
+ .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)}
1019
+ ></w3m-pay-options>`}amountWithFeeTemplate(){return this.isFetchingQuote||!this.selectedPaymentAsset||this.quoteError?l`<w3m-pay-fees-skeleton></w3m-pay-fees-skeleton>`:l`<w3m-pay-fees></w3m-pay-fees>`}paymentActionsTemplate(){const e=this.isFetchingQuote||this.isFetchingTokenBalances,n=this.isFetchingQuote||this.isFetchingTokenBalances||!this.selectedPaymentAsset||!!this.quoteError,s=A.formatNumber(this.quote?.origin.amount??0,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return this.selectedExchange?e||n?l`
1020
+ <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer>
1021
+ `:l`<wui-button
1022
+ size="lg"
1023
+ fullWidth
1024
+ variant="accent-secondary"
1025
+ @click=${this.onPayWithExchange.bind(this)}
1026
+ >
1027
+ ${`Continue in ${this.selectedExchange.name}`}
1028
+
1029
+ <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon>
1030
+ </wui-button>`:l`
1031
+ <wui-flex alignItems="center" justifyContent="space-between">
1032
+ <wui-flex flexDirection="column" gap="1">
1033
+ <wui-text variant="md-regular" color="secondary">Order Total</wui-text>
1034
+
1035
+ ${e||n?l`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:l`<wui-flex alignItems="center" gap="01">
1036
+ <wui-text variant="h4-regular" color="primary">${Q(s)}</wui-text>
1037
+
1038
+ <wui-text variant="lg-regular" color="secondary">
1039
+ ${this.quote?.origin.currency.metadata.symbol||"Unknown"}
1040
+ </wui-text>
1041
+ </wui-flex>`}
1042
+ </wui-flex>
1043
+
1044
+ ${this.actionButtonTemplate({isLoading:e,isDisabled:n})}
1045
+ </wui-flex>
1046
+ `}actionButtonTemplate(e){const n=X(this.quote),{isLoading:s,isDisabled:a}=e;let i="Pay";return n.length>1&&this.completedTransactionsCount===0&&(i="Approve"),l`
1047
+ <wui-button
1048
+ size="lg"
1049
+ variant="accent-primary"
1050
+ ?loading=${s||this.isPaymentInProgress}
1051
+ ?disabled=${a||this.isPaymentInProgress}
1052
+ @click=${()=>{n.length>0?this.onSendTransactions():this.onTransfer()}}
1053
+ >
1054
+ ${i}
1055
+ ${s?null:l`<wui-icon
1056
+ name="arrowRight"
1057
+ color="inherit"
1058
+ size="sm"
1059
+ slot="iconRight"
1060
+ ></wui-icon>`}
1061
+ </wui-button>
1062
+ `}getPaymentAssetFromTokenBalances(){return this.namespace?(this.tokenBalances[this.namespace]??[]).map(a=>{try{return Je(a)}catch{return null}}).filter(a=>!!a).filter(a=>{const{chainId:i}=w.parseCaipNetworkId(a.network),{chainId:o}=w.parseCaipNetworkId(this.paymentAsset.network);return N.isLowerCaseMatch(a.asset,this.paymentAsset.asset)?!0:this.selectedExchange?!N.isLowerCaseMatch(i.toString(),o.toString()):!0}):[]}onTokenBalancesChanged(e){this.tokenBalances=e;const[n]=this.getPaymentAssetFromTokenBalances();n&&c.setSelectedPaymentAsset(n)}async onConnectOtherWallet(){await P.connect(),await z.open({view:"PayQuote"})}onAccountStateChanged(e){const{address:n}=this.caipAddress?w.parseCaipAddress(this.caipAddress):{};if(this.caipAddress=e?.caipAddress,this.profileName=e?.profileName??null,n){const{address:s}=this.caipAddress?w.parseCaipAddress(this.caipAddress):{};s?N.isLowerCaseMatch(s,n)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):z.close()}}onSelectedPaymentAssetChanged(e){this.isFetchingQuote||c.setSelectedPaymentAsset(e)}async onTransfer(){const e=ee(this.quote);if(e){if(!N.isLowerCaseMatch(this.selectedPaymentAsset?.asset,e.deposit.currency))throw new Error("Quote asset is not the same as the selected payment asset");const s=this.selectedPaymentAsset?.amount??"0",a=A.formatNumber(e.deposit.amount,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!A.bigNumber(s).gte(a)){R.showError("Insufficient funds");return}if(this.quote&&this.selectedPaymentAsset&&this.caipAddress&&this.namespace){const{address:o}=w.parseCaipAddress(this.caipAddress);await c.onTransfer({chainNamespace:this.namespace,fromAddress:o,toAddress:e.deposit.receiver,amount:a,paymentAsset:this.selectedPaymentAsset}),c.setRequestId(e.requestId),M.push("PayLoading")}}}async onSendTransactions(){const e=this.selectedPaymentAsset?.amount??"0",n=A.formatNumber(this.quote?.origin.amount??0,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!A.bigNumber(e).gte(n)){R.showError("Insufficient funds");return}const a=X(this.quote),[i]=X(this.quote,this.completedTransactionsCount);i&&this.namespace&&(await c.onSendTransaction({namespace:this.namespace,transactionStep:i}),this.completedTransactionsCount+=1,this.completedTransactionsCount===a.length&&(c.setRequestId(i.requestId),M.push("PayLoading")))}onPayWithExchange(){if(this.exchangeUrlForQuote){const e=O.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!e)throw new Error("Could not create popup window");e.location.href=this.exchangeUrlForQuote;const n=ee(this.quote);n&&c.setRequestId(n.requestId),c.initiatePayment(),M.push("PayLoading")}}resetAssetsState(){c.setSelectedPaymentAsset(null)}resetQuoteState(){c.resetQuoteState()}};f.styles=At;y([h()],f.prototype,"profileName",void 0);y([h()],f.prototype,"paymentAsset",void 0);y([h()],f.prototype,"namespace",void 0);y([h()],f.prototype,"caipAddress",void 0);y([h()],f.prototype,"amount",void 0);y([h()],f.prototype,"recipient",void 0);y([h()],f.prototype,"activeConnectorIds",void 0);y([h()],f.prototype,"selectedPaymentAsset",void 0);y([h()],f.prototype,"selectedExchange",void 0);y([h()],f.prototype,"isFetchingQuote",void 0);y([h()],f.prototype,"quoteError",void 0);y([h()],f.prototype,"quote",void 0);y([h()],f.prototype,"isFetchingTokenBalances",void 0);y([h()],f.prototype,"tokenBalances",void 0);y([h()],f.prototype,"isPaymentInProgress",void 0);y([h()],f.prototype,"exchangeUrlForQuote",void 0);y([h()],f.prototype,"completedTransactionsCount",void 0);f=y([_("w3m-pay-quote-view")],f);export{p as A,c as P,E as W,d as a,f as b,k as c};
assets/index-ptQq3EiG.js ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as u,cz as g,cA as m,cB as r,cC as p,cD as x,cE as n}from"./index-C-6muS97.js";const b=u`
2
+ button {
3
+ display: block;
4
+ display: flex;
5
+ align-items: center;
6
+ padding: ${({spacing:e})=>e[1]};
7
+ transition: background-color ${({durations:e})=>e.lg}
8
+ ${({easings:e})=>e["ease-out-power-2"]};
9
+ will-change: background-color;
10
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
11
+ border-radius: ${({borderRadius:e})=>e[32]};
12
+ }
13
+
14
+ wui-image {
15
+ border-radius: ${({borderRadius:e})=>e[32]};
16
+ }
17
+
18
+ wui-text {
19
+ padding-left: ${({spacing:e})=>e[1]};
20
+ padding-right: ${({spacing:e})=>e[1]};
21
+ }
22
+
23
+ .left-icon-container {
24
+ width: 24px;
25
+ height: 24px;
26
+ justify-content: center;
27
+ align-items: center;
28
+ }
29
+
30
+ .left-image-container {
31
+ position: relative;
32
+ justify-content: center;
33
+ align-items: center;
34
+ }
35
+
36
+ .chain-image {
37
+ position: absolute;
38
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundPrimary};
39
+ }
40
+
41
+ /* -- Sizes --------------------------------------------------- */
42
+ button[data-size='lg'] {
43
+ height: 32px;
44
+ }
45
+
46
+ button[data-size='md'] {
47
+ height: 28px;
48
+ }
49
+
50
+ button[data-size='sm'] {
51
+ height: 24px;
52
+ }
53
+
54
+ button[data-size='lg'] .token-image {
55
+ width: 24px;
56
+ height: 24px;
57
+ }
58
+
59
+ button[data-size='md'] .token-image {
60
+ width: 20px;
61
+ height: 20px;
62
+ }
63
+
64
+ button[data-size='sm'] .token-image {
65
+ width: 16px;
66
+ height: 16px;
67
+ }
68
+
69
+ button[data-size='lg'] .left-icon-container {
70
+ width: 24px;
71
+ height: 24px;
72
+ }
73
+
74
+ button[data-size='md'] .left-icon-container {
75
+ width: 20px;
76
+ height: 20px;
77
+ }
78
+
79
+ button[data-size='sm'] .left-icon-container {
80
+ width: 16px;
81
+ height: 16px;
82
+ }
83
+
84
+ button[data-size='lg'] .chain-image {
85
+ width: 12px;
86
+ height: 12px;
87
+ bottom: 2px;
88
+ right: -4px;
89
+ }
90
+
91
+ button[data-size='md'] .chain-image {
92
+ width: 10px;
93
+ height: 10px;
94
+ bottom: 2px;
95
+ right: -4px;
96
+ }
97
+
98
+ button[data-size='sm'] .chain-image {
99
+ width: 8px;
100
+ height: 8px;
101
+ bottom: 2px;
102
+ right: -3px;
103
+ }
104
+
105
+ /* -- Focus states --------------------------------------------------- */
106
+ button:focus-visible:enabled {
107
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
108
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent040};
109
+ }
110
+
111
+ /* -- Hover & Active states ----------------------------------------------------------- */
112
+ @media (hover: hover) {
113
+ button:hover:enabled,
114
+ button:active:enabled {
115
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
116
+ }
117
+ }
118
+
119
+ /* -- Disabled states --------------------------------------------------- */
120
+ button:disabled {
121
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
122
+ opacity: 0.5;
123
+ }
124
+ `;var a=function(e,t,s,c){var d=arguments.length,o=d<3?t:c===null?c=Object.getOwnPropertyDescriptor(t,s):c,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,s,c);else for(var h=e.length-1;h>=0;h--)(l=e[h])&&(o=(d<3?l(o):d>3?l(t,s,o):l(t,s))||o);return d>3&&o&&Object.defineProperty(t,s,o),o};const f={lg:"lg-regular",md:"lg-regular",sm:"md-regular"},w={lg:"lg",md:"md",sm:"sm"};let i=class extends x{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.text="",this.loading=!1}render(){return this.loading?n` <wui-flex alignItems="center" gap="01" padding="01">
125
+ <wui-shimmer width="20px" height="20px"></wui-shimmer>
126
+ <wui-shimmer width="32px" height="18px" borderRadius="4xs"></wui-shimmer>
127
+ </wui-flex>`:n`
128
+ <button ?disabled=${this.disabled} data-size=${this.size}>
129
+ ${this.imageTemplate()} ${this.textTemplate()}
130
+ </button>
131
+ `}imageTemplate(){if(this.imageSrc&&this.chainImageSrc)return n`<wui-flex class="left-image-container">
132
+ <wui-image src=${this.imageSrc} class="token-image"></wui-image>
133
+ <wui-image src=${this.chainImageSrc} class="chain-image"></wui-image>
134
+ </wui-flex>`;if(this.imageSrc)return n`<wui-image src=${this.imageSrc} class="token-image"></wui-image>`;const t=w[this.size];return n`<wui-flex class="left-icon-container">
135
+ <wui-icon size=${t} name="networkPlaceholder"></wui-icon>
136
+ </wui-flex>`}textTemplate(){const t=f[this.size];return n`<wui-text color="primary" variant=${t}
137
+ >${this.text}</wui-text
138
+ >`}};i.styles=[g,m,b];a([r()],i.prototype,"size",void 0);a([r()],i.prototype,"imageSrc",void 0);a([r()],i.prototype,"chainImageSrc",void 0);a([r({type:Boolean})],i.prototype,"disabled",void 0);a([r()],i.prototype,"text",void 0);a([r({type:Boolean})],i.prototype,"loading",void 0);i=a([p("wui-token-button")],i);
assets/index-wM56buvO.js ADDED
The diff for this file is too large to render. See raw diff
 
assets/index.web-BAW8ZRnd.js ADDED
@@ -0,0 +1 @@
 
 
1
+ let n;const f=new Array(32).fill(void 0);f.push(void 0,null,!0,!1);function b(e){return f[e]}const T=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});T.decode();let y=null;function d(){return(y===null||y.buffer!==n.memory.buffer)&&(y=new Uint8Array(n.memory.buffer)),y}function h(e,t){return T.decode(d().subarray(e,e+t))}let w=f.length;function M(e){w===f.length&&f.push(f.length+1);const t=w;return w=f[t],f[t]=e,t}let l=0;const j=new TextEncoder("utf-8"),N=typeof j.encodeInto=="function"?function(e,t){return j.encodeInto(e,t)}:function(e,t){const r=j.encode(e);return t.set(r),{read:e.length,written:r.length}};function E(e,t,r){if(r===void 0){const c=j.encode(e),a=t(c.length);return d().subarray(a,a+c.length).set(c),l=c.length,a}let i=e.length,o=t(i);const _=d();let s=0;for(;s<i;s++){const c=e.charCodeAt(s);if(c>127)break;_[o+s]=c}if(s!==i){s!==0&&(e=e.slice(s)),o=r(o,i,i=s+e.length*3);const c=d().subarray(o+s,o+i),a=N(e,c);s+=a.written}return l=s,o}let v=null;function u(){return(v===null||v.buffer!==n.memory.buffer)&&(v=new Int32Array(n.memory.buffer)),v}function U(e){e<36||(f[e]=w,w=e)}function p(e){const t=b(e);return U(e),t}function g(e,t){const r=t(e.length*1);return d().set(e,r/1),l=e.length,r}let k=32;function x(e){if(k==1)throw new Error("out of js stack");return f[--k]=e,k}function S(e,t){return d().subarray(e/1,e/1+t)}function L(e,t){try{const c=n.__wbindgen_add_to_stack_pointer(-16),a=g(e,n.__wbindgen_malloc),W=l;n.compress(c,a,W,x(t));var r=u()[c/4+0],i=u()[c/4+1],o=u()[c/4+2],_=u()[c/4+3];if(_)throw p(o);var s=S(r,i).slice();return n.__wbindgen_free(r,i*1),s}finally{n.__wbindgen_add_to_stack_pointer(16),f[k++]=void 0}}function B(e){try{const s=n.__wbindgen_add_to_stack_pointer(-16),c=g(e,n.__wbindgen_malloc),a=l;n.decompress(s,c,a);var t=u()[s/4+0],r=u()[s/4+1],i=u()[s/4+2],o=u()[s/4+3];if(o)throw p(i);var _=S(t,r).slice();return n.__wbindgen_free(t,r*1),_}finally{n.__wbindgen_add_to_stack_pointer(16)}}function R(e){return e==null}const F=Object.freeze({ResultSuccess:1,1:"ResultSuccess",NeedsMoreInput:2,2:"NeedsMoreInput",NeedsMoreOutput:3,3:"NeedsMoreOutput"});class m{static __wrap(t){const r=Object.create(m.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();n.__wbg_brotlistreamresult_free(t)}get code(){return n.__wbg_get_brotlistreamresult_code(this.ptr)>>>0}set code(t){n.__wbg_set_brotlistreamresult_code(this.ptr,t)}get buf(){try{const o=n.__wbindgen_add_to_stack_pointer(-16);n.__wbg_get_brotlistreamresult_buf(o,this.ptr);var t=u()[o/4+0],r=u()[o/4+1],i=S(t,r).slice();return n.__wbindgen_free(t,r*1),i}finally{n.__wbindgen_add_to_stack_pointer(16)}}set buf(t){const r=g(t,n.__wbindgen_malloc),i=l;n.__wbg_set_brotlistreamresult_buf(this.ptr,r,i)}get input_offset(){return n.__wbg_get_brotlistreamresult_input_offset(this.ptr)>>>0}set input_offset(t){n.__wbg_set_brotlistreamresult_input_offset(this.ptr,t)}}class O{static __wrap(t){const r=Object.create(O.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();n.__wbg_compressstream_free(t)}constructor(t){const r=n.compressstream_new(!R(t),R(t)?0:t);return O.__wrap(r)}compress(t,r){try{const a=n.__wbindgen_add_to_stack_pointer(-16);var i=R(t)?0:g(t,n.__wbindgen_malloc),o=l;n.compressstream_compress(a,this.ptr,i,o,r);var _=u()[a/4+0],s=u()[a/4+1],c=u()[a/4+2];if(c)throw p(s);return m.__wrap(_)}finally{n.__wbindgen_add_to_stack_pointer(16)}}total_out(){return n.compressstream_total_out(this.ptr)>>>0}}class A{static __wrap(t){const r=Object.create(A.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();n.__wbg_decompressstream_free(t)}constructor(){const t=n.decompressstream_new();return A.__wrap(t)}decompress(t,r){try{const s=n.__wbindgen_add_to_stack_pointer(-16),c=g(t,n.__wbindgen_malloc),a=l;n.decompressstream_decompress(s,this.ptr,c,a,r);var i=u()[s/4+0],o=u()[s/4+1],_=u()[s/4+2];if(_)throw p(o);return m.__wrap(i)}finally{n.__wbindgen_add_to_stack_pointer(16)}}total_out(){return n.decompressstream_total_out(this.ptr)>>>0}}async function z(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}const r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{const r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}async function I(e){typeof e>"u"&&(e=new URL("/Demo-/assets/brotli_wasm_bg-NfWIZley.wasm",import.meta.url));const t={};t.wbg={},t.wbg.__wbindgen_is_undefined=function(o){return b(o)===void 0},t.wbg.__wbindgen_is_object=function(o){const _=b(o);return typeof _=="object"&&_!==null},t.wbg.__wbindgen_string_new=function(o,_){const s=h(o,_);return M(s)},t.wbg.__wbindgen_error_new=function(o,_){const s=new Error(h(o,_));return M(s)},t.wbg.__wbindgen_json_serialize=function(o,_){const s=b(_),c=JSON.stringify(s===void 0?null:s),a=E(c,n.__wbindgen_malloc,n.__wbindgen_realloc),W=l;u()[o/4+1]=W,u()[o/4+0]=a},t.wbg.__wbg_new_693216e109162396=function(){const o=new Error;return M(o)},t.wbg.__wbg_stack_0ddaca5d1abfb52f=function(o,_){const s=b(_).stack,c=E(s,n.__wbindgen_malloc,n.__wbindgen_realloc),a=l;u()[o/4+1]=a,u()[o/4+0]=c},t.wbg.__wbg_error_09919627ac0992f5=function(o,_){try{console.error(h(o,_))}finally{n.__wbindgen_free(o,_)}},t.wbg.__wbindgen_object_drop_ref=function(o){p(o)},t.wbg.__wbindgen_throw=function(o,_){throw new Error(h(o,_))},(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:r,module:i}=await z(await e,t);return n=r.exports,I.__wbindgen_wasm_module=i,n}const C=Object.freeze(Object.defineProperty({__proto__:null,BrotliStreamResult:m,BrotliStreamResultCode:F,CompressStream:O,DecompressStream:A,compress:L,decompress:B,default:I},Symbol.toStringTag,{value:"Module"})),D=I().then(()=>C);export{D as default};
assets/localBatchGatewayRequest-BpO1N93o.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{cg as l,bO as p,de as w,q as y,bh as A,bI as g,j as b,i as F,br as E,bd as N,o as h,p as P,a1 as I,df as f,dg as R}from"./index-C-6muS97.js";function q(n){const{abi:r,data:a}=n,e=l(a,0,4),t=r.find(o=>o.type==="function"&&e===p(w(o)));if(!t)throw new y(e,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:t.name,args:"inputs"in t&&t.inputs&&t.inputs.length>0?A(t.inputs,l(a,4)):void 0}}const u="/docs/contract/encodeErrorResult";function m(n){const{abi:r,errorName:a,args:e}=n;let t=r[0];if(a){const c=g({abi:r,args:e,name:a});if(!c)throw new b(a,{docsPath:u});t=c}if(t.type!=="error")throw new b(void 0,{docsPath:u});const o=w(t),s=p(o);let i="0x";if(e&&e.length>0){if(!t.inputs)throw new F(t.name,{docsPath:u});i=E(t.inputs,e)}return N([s,i])}const d="/docs/contract/encodeFunctionResult";function x(n){const{abi:r,functionName:a,result:e}=n;let t=r[0];if(a){const s=g({abi:r,name:a});if(!s)throw new h(a,{docsPath:d});t=s}if(t.type!=="function")throw new h(void 0,{docsPath:d});if(!t.outputs)throw new P(t.name,{docsPath:d});const o=(()=>{if(t.outputs.length===0)return[];if(t.outputs.length===1)return[e];if(Array.isArray(e))return e;throw new I(e)})();return E(t.outputs,o)}const G="x-batch-gateway:true";async function H(n){const{data:r,ccipRequest:a}=n,{args:[e]}=q({abi:f,data:r}),t=[],o=[];return await Promise.all(e.map(async(s,i)=>{try{o[i]=s.urls.includes(G)?await H({data:s.data,ccipRequest:a}):await a(s),t[i]=!1}catch(c){t[i]=!0,o[i]=M(c)}})),x({abi:f,functionName:"query",result:[t,o]})}function M(n){return n.name==="HttpRequestError"&&n.status?m({abi:f,errorName:"HttpError",args:[n.status,n.shortMessage]}):m({abi:[R],errorName:"Error",args:["shortMessage"in n?n.shortMessage:n.message]})}export{x as a,H as b,q as d,m as e,G as l};
assets/onramp-BkY5dF5j.js ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as O,cD as b,dJ as c,dK as C,dz as T,dr as j,dc as m,cE as u,du as $,dd as l,cC as g,cB as p,cT as I,da as E,cM as D,cV as W,cQ as z,cR as N,cS as V,cO as K,db as M,cN as B}from"./index-C-6muS97.js";const q=O`
2
+ :host > wui-grid {
3
+ max-height: 360px;
4
+ overflow: auto;
5
+ }
6
+
7
+ wui-flex {
8
+ transition: opacity ${({easings:t})=>t["ease-out-power-1"]}
9
+ ${({durations:t})=>t.md};
10
+ will-change: opacity;
11
+ }
12
+
13
+ wui-grid::-webkit-scrollbar {
14
+ display: none;
15
+ }
16
+
17
+ wui-flex.disabled {
18
+ opacity: 0.3;
19
+ pointer-events: none;
20
+ user-select: none;
21
+ }
22
+ `;var A=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};let k=class extends b{constructor(){super(),this.unsubscribe=[],this.selectedCurrency=c.state.paymentCurrency,this.currencies=c.state.paymentCurrencies,this.currencyImages=C.state.currencyImages,this.checked=T.state.isLegalCheckboxChecked,this.unsubscribe.push(c.subscribe(e=>{this.selectedCurrency=e.paymentCurrency,this.currencies=e.paymentCurrencies}),C.subscribeKey("currencyImages",e=>this.currencyImages=e),T.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const{termsConditionsUrl:e,privacyPolicyUrl:r}=j.state,n=j.state.features?.legalCheckbox,o=!!(e||r)&&!!n&&!this.checked;return u`
23
+ <w3m-legal-checkbox></w3m-legal-checkbox>
24
+ <wui-flex
25
+ flexDirection="column"
26
+ .padding=${["0","3","3","3"]}
27
+ gap="2"
28
+ class=${m(o?"disabled":void 0)}
29
+ >
30
+ ${this.currenciesTemplate(o)}
31
+ </wui-flex>
32
+ `}currenciesTemplate(e=!1){return this.currencies.map(r=>u`
33
+ <wui-list-item
34
+ imageSrc=${m(this.currencyImages?.[r.id])}
35
+ @click=${()=>this.selectCurrency(r)}
36
+ variant="image"
37
+ tabIdx=${m(e?-1:void 0)}
38
+ >
39
+ <wui-text variant="md-medium" color="primary">${r.id}</wui-text>
40
+ </wui-list-item>
41
+ `)}selectCurrency(e){e&&(c.setPaymentCurrency(e),$.close())}};k.styles=q;A([l()],k.prototype,"selectedCurrency",void 0);A([l()],k.prototype,"currencies",void 0);A([l()],k.prototype,"currencyImages",void 0);A([l()],k.prototype,"checked",void 0);k=A([g("w3m-onramp-fiat-select-view")],k);const F=O`
42
+ button {
43
+ padding: ${({spacing:t})=>t[3]};
44
+ border-radius: ${({borderRadius:t})=>t[4]};
45
+ border: none;
46
+ outline: none;
47
+ background-color: ${({tokens:t})=>t.core.glass010};
48
+ width: 100%;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: flex-start;
52
+ gap: ${({spacing:t})=>t[3]};
53
+ transition: background-color ${({easings:t})=>t["ease-out-power-1"]}
54
+ ${({durations:t})=>t.md};
55
+ will-change: background-color;
56
+ cursor: pointer;
57
+ }
58
+
59
+ button:hover {
60
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
61
+ }
62
+
63
+ .provider-image {
64
+ width: ${({spacing:t})=>t[10]};
65
+ min-width: ${({spacing:t})=>t[10]};
66
+ height: ${({spacing:t})=>t[10]};
67
+ border-radius: calc(
68
+ ${({borderRadius:t})=>t[4]} - calc(${({spacing:t})=>t[3]} / 2)
69
+ );
70
+ position: relative;
71
+ overflow: hidden;
72
+ }
73
+
74
+ .network-icon {
75
+ width: ${({spacing:t})=>t[3]};
76
+ height: ${({spacing:t})=>t[3]};
77
+ border-radius: calc(${({spacing:t})=>t[3]} / 2);
78
+ overflow: hidden;
79
+ box-shadow:
80
+ 0 0 0 3px ${({tokens:t})=>t.theme.foregroundPrimary},
81
+ 0 0 0 3px ${({tokens:t})=>t.theme.backgroundPrimary};
82
+ transition: box-shadow ${({easings:t})=>t["ease-out-power-1"]}
83
+ ${({durations:t})=>t.md};
84
+ will-change: box-shadow;
85
+ }
86
+
87
+ button:hover .network-icon {
88
+ box-shadow:
89
+ 0 0 0 3px ${({tokens:t})=>t.core.glass010},
90
+ 0 0 0 3px ${({tokens:t})=>t.theme.backgroundPrimary};
91
+ }
92
+ `;var v=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};let h=class extends b{constructor(){super(...arguments),this.disabled=!1,this.color="inherit",this.label="",this.feeRange="",this.loading=!1,this.onClick=null}render(){return u`
93
+ <button ?disabled=${this.disabled} @click=${this.onClick} ontouchstart>
94
+ <wui-visual name=${m(this.name)} class="provider-image"></wui-visual>
95
+ <wui-flex flexDirection="column" gap="01">
96
+ <wui-text variant="md-regular" color="primary">${this.label}</wui-text>
97
+ <wui-flex alignItems="center" justifyContent="flex-start" gap="4">
98
+ <wui-text variant="sm-medium" color="primary">
99
+ <wui-text variant="sm-regular" color="secondary">Fees</wui-text>
100
+ ${this.feeRange}
101
+ </wui-text>
102
+ <wui-flex gap="2">
103
+ <wui-icon name="bank" size="sm" color="default"></wui-icon>
104
+ <wui-icon name="card" size="sm" color="default"></wui-icon>
105
+ </wui-flex>
106
+ ${this.networksTemplate()}
107
+ </wui-flex>
108
+ </wui-flex>
109
+ ${this.loading?u`<wui-loading-spinner color="secondary" size="md"></wui-loading-spinner>`:u`<wui-icon name="chevronRight" color="default" size="sm"></wui-icon>`}
110
+ </button>
111
+ `}networksTemplate(){const r=I.getAllRequestedCaipNetworks()?.filter(n=>n?.assets?.imageId)?.slice(0,5);return u`
112
+ <wui-flex class="networks">
113
+ ${r?.map(n=>u`
114
+ <wui-flex class="network-icon">
115
+ <wui-image src=${m(E.getNetworkImage(n))}></wui-image>
116
+ </wui-flex>
117
+ `)}
118
+ </wui-flex>
119
+ `}};h.styles=[F];v([p({type:Boolean})],h.prototype,"disabled",void 0);v([p()],h.prototype,"color",void 0);v([p()],h.prototype,"name",void 0);v([p()],h.prototype,"label",void 0);v([p()],h.prototype,"feeRange",void 0);v([p({type:Boolean})],h.prototype,"loading",void 0);v([p()],h.prototype,"onClick",void 0);h=v([g("w3m-onramp-provider-item")],h);var L=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};let U=class extends b{constructor(){super(),this.unsubscribe=[],this.providers=c.state.providers,this.unsubscribe.push(c.subscribeKey("providers",e=>{this.providers=e}))}render(){return u`
120
+ <wui-flex flexDirection="column" .padding=${["0","3","3","3"]} gap="2">
121
+ ${this.onRampProvidersTemplate()}
122
+ </wui-flex>
123
+ `}onRampProvidersTemplate(){return this.providers.filter(e=>e.supportedChains.includes(I.state.activeChain??"eip155")).map(e=>u`
124
+ <w3m-onramp-provider-item
125
+ label=${e.label}
126
+ name=${e.name}
127
+ feeRange=${e.feeRange}
128
+ @click=${()=>{this.onClickProvider(e)}}
129
+ ?disabled=${!e.url}
130
+ data-testid=${`onramp-provider-${e.name}`}
131
+ ></w3m-onramp-provider-item>
132
+ `)}onClickProvider(e){c.setSelectedProvider(e),D.push("BuyInProgress"),W.openHref(c.state.selectedProvider?.url||e.url,"popupWindow","width=600,height=800,scrollbars=yes"),z.sendEvent({type:"track",event:"SELECT_BUY_PROVIDER",properties:{provider:e.name,isSmartAccount:N(I.state.activeChain)===V.ACCOUNT_TYPES.SMART_ACCOUNT}})}};L([l()],U.prototype,"providers",void 0);U=L([g("w3m-onramp-providers-view")],U);const Y=O`
133
+ :host > wui-grid {
134
+ max-height: 360px;
135
+ overflow: auto;
136
+ }
137
+
138
+ wui-flex {
139
+ transition: opacity ${({easings:t})=>t["ease-out-power-1"]}
140
+ ${({durations:t})=>t.md};
141
+ will-change: opacity;
142
+ }
143
+
144
+ wui-grid::-webkit-scrollbar {
145
+ display: none;
146
+ }
147
+
148
+ wui-flex.disabled {
149
+ opacity: 0.3;
150
+ pointer-events: none;
151
+ user-select: none;
152
+ }
153
+ `;var _=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};let P=class extends b{constructor(){super(),this.unsubscribe=[],this.selectedCurrency=c.state.purchaseCurrencies,this.tokens=c.state.purchaseCurrencies,this.tokenImages=C.state.tokenImages,this.checked=T.state.isLegalCheckboxChecked,this.unsubscribe.push(c.subscribe(e=>{this.selectedCurrency=e.purchaseCurrencies,this.tokens=e.purchaseCurrencies}),C.subscribeKey("tokenImages",e=>this.tokenImages=e),T.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const{termsConditionsUrl:e,privacyPolicyUrl:r}=j.state,n=j.state.features?.legalCheckbox,o=!!(e||r)&&!!n&&!this.checked;return u`
154
+ <w3m-legal-checkbox></w3m-legal-checkbox>
155
+ <wui-flex
156
+ flexDirection="column"
157
+ .padding=${["0","3","3","3"]}
158
+ gap="2"
159
+ class=${m(o?"disabled":void 0)}
160
+ >
161
+ ${this.currenciesTemplate(o)}
162
+ </wui-flex>
163
+ `}currenciesTemplate(e=!1){return this.tokens.map(r=>u`
164
+ <wui-list-item
165
+ imageSrc=${m(this.tokenImages?.[r.symbol])}
166
+ @click=${()=>this.selectToken(r)}
167
+ variant="image"
168
+ tabIdx=${m(e?-1:void 0)}
169
+ >
170
+ <wui-flex gap="1" alignItems="center">
171
+ <wui-text variant="md-medium" color="primary">${r.name}</wui-text>
172
+ <wui-text variant="sm-regular" color="secondary">${r.symbol}</wui-text>
173
+ </wui-flex>
174
+ </wui-list-item>
175
+ `)}selectToken(e){e&&(c.setPurchaseCurrency(e),$.close())}};P.styles=Y;_([l()],P.prototype,"selectedCurrency",void 0);_([l()],P.prototype,"tokens",void 0);_([l()],P.prototype,"tokenImages",void 0);_([l()],P.prototype,"checked",void 0);P=_([g("w3m-onramp-token-select-view")],P);const Q=O`
176
+ @keyframes shake {
177
+ 0% {
178
+ transform: translateX(0);
179
+ }
180
+ 25% {
181
+ transform: translateX(3px);
182
+ }
183
+ 50% {
184
+ transform: translateX(-3px);
185
+ }
186
+ 75% {
187
+ transform: translateX(3px);
188
+ }
189
+ 100% {
190
+ transform: translateX(0);
191
+ }
192
+ }
193
+
194
+ wui-flex:first-child:not(:only-child) {
195
+ position: relative;
196
+ }
197
+
198
+ wui-loading-thumbnail {
199
+ position: absolute;
200
+ }
201
+
202
+ wui-visual {
203
+ border-radius: calc(
204
+ ${({borderRadius:t})=>t[1]} * 9 - ${({borderRadius:t})=>t[3]}
205
+ );
206
+ position: relative;
207
+ overflow: hidden;
208
+ }
209
+
210
+ wui-icon-box {
211
+ position: absolute;
212
+ right: calc(${({spacing:t})=>t[1]} * -1);
213
+ bottom: calc(${({spacing:t})=>t[1]} * -1);
214
+ opacity: 0;
215
+ transform: scale(0.5);
216
+ transition:
217
+ opacity ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]},
218
+ transform ${({durations:t})=>t.lg}
219
+ ${({easings:t})=>t["ease-out-power-2"]};
220
+ will-change: opacity, transform;
221
+ }
222
+
223
+ wui-text[align='center'] {
224
+ width: 100%;
225
+ padding: 0px ${({spacing:t})=>t[4]};
226
+ }
227
+
228
+ [data-error='true'] wui-icon-box {
229
+ opacity: 1;
230
+ transform: scale(1);
231
+ }
232
+
233
+ [data-error='true'] > wui-flex:first-child {
234
+ animation: shake 250ms ${({easings:t})=>t["ease-out-power-2"]} both;
235
+ }
236
+
237
+ [data-retry='false'] wui-link {
238
+ display: none;
239
+ }
240
+
241
+ [data-retry='true'] wui-link {
242
+ display: block;
243
+ opacity: 1;
244
+ }
245
+
246
+ wui-link {
247
+ padding: ${({spacing:t})=>t["01"]} ${({spacing:t})=>t[2]};
248
+ }
249
+ `;var y=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};let d=class extends b{constructor(){super(),this.unsubscribe=[],this.selectedOnRampProvider=c.state.selectedProvider,this.uri=K.state.wcUri,this.ready=!1,this.showRetry=!1,this.buffering=!1,this.error=!1,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push(c.subscribeKey("selectedProvider",e=>{this.selectedOnRampProvider=e}))}disconnectedCallback(){this.intervalId&&clearInterval(this.intervalId)}render(){let e="Continue in external window";this.error?e="Buy failed":this.selectedOnRampProvider&&(e=`Buy in ${this.selectedOnRampProvider?.label}`);const r=this.error?"Buy can be declined from your side or due to and error on the provider app":"We’ll notify you once your Buy is processed";return u`
250
+ <wui-flex
251
+ data-error=${m(this.error)}
252
+ data-retry=${this.showRetry}
253
+ flexDirection="column"
254
+ alignItems="center"
255
+ .padding=${["10","5","5","5"]}
256
+ gap="5"
257
+ >
258
+ <wui-flex justifyContent="center" alignItems="center">
259
+ <wui-visual
260
+ name=${m(this.selectedOnRampProvider?.name)}
261
+ size="lg"
262
+ class="provider-image"
263
+ >
264
+ </wui-visual>
265
+
266
+ ${this.error?null:this.loaderTemplate()}
267
+
268
+ <wui-icon-box
269
+ color="error"
270
+ icon="close"
271
+ size="sm"
272
+ border
273
+ borderColor="wui-color-bg-125"
274
+ ></wui-icon-box>
275
+ </wui-flex>
276
+
277
+ <wui-flex
278
+ flexDirection="column"
279
+ alignItems="center"
280
+ gap="2"
281
+ .padding=${["4","0","0","0"]}
282
+ >
283
+ <wui-text variant="md-medium" color=${this.error?"error":"primary"}>
284
+ ${e}
285
+ </wui-text>
286
+ <wui-text align="center" variant="sm-medium" color="secondary">${r}</wui-text>
287
+ </wui-flex>
288
+
289
+ ${this.error?this.tryAgainTemplate():null}
290
+ </wui-flex>
291
+
292
+ <wui-flex .padding=${["0","5","5","5"]} justifyContent="center">
293
+ <wui-link @click=${this.onCopyUri} color="secondary">
294
+ <wui-icon size="sm" color="default" slot="iconLeft" name="copy"></wui-icon>
295
+ Copy link
296
+ </wui-link>
297
+ </wui-flex>
298
+ `}onTryAgain(){this.selectedOnRampProvider&&(this.error=!1,W.openHref(this.selectedOnRampProvider.url,"popupWindow","width=600,height=800,scrollbars=yes"))}tryAgainTemplate(){return this.selectedOnRampProvider?.url?u`<wui-button size="md" variant="accent" @click=${this.onTryAgain.bind(this)}>
299
+ <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
300
+ Try again
301
+ </wui-button>`:null}loaderTemplate(){const e=M.state.themeVariables["--w3m-border-radius-master"],r=e?parseInt(e.replace("px",""),10):4;return u`<wui-loading-thumbnail radius=${r*9}></wui-loading-thumbnail>`}onCopyUri(){if(!this.selectedOnRampProvider?.url){B.showError("No link found"),D.goBack();return}try{W.copyToClopboard(this.selectedOnRampProvider.url),B.showSuccess("Link copied")}catch{B.showError("Failed to copy")}}};d.styles=Q;y([l()],d.prototype,"intervalId",void 0);y([l()],d.prototype,"selectedOnRampProvider",void 0);y([l()],d.prototype,"uri",void 0);y([l()],d.prototype,"ready",void 0);y([l()],d.prototype,"showRetry",void 0);y([l()],d.prototype,"buffering",void 0);y([l()],d.prototype,"error",void 0);y([p({type:Boolean})],d.prototype,"isMobile",void 0);y([p()],d.prototype,"onRetry",void 0);d=y([g("w3m-buy-in-progress-view")],d);var X=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};let S=class extends b{render(){return u`
302
+ <wui-flex
303
+ flexDirection="column"
304
+ .padding=${["6","10","5","10"]}
305
+ alignItems="center"
306
+ gap="5"
307
+ >
308
+ <wui-visual name="onrampCard"></wui-visual>
309
+ <wui-flex flexDirection="column" gap="2" alignItems="center">
310
+ <wui-text align="center" variant="md-medium" color="primary">
311
+ Quickly and easily buy digital assets!
312
+ </wui-text>
313
+ <wui-text align="center" variant="sm-regular" color="secondary">
314
+ Simply select your preferred onramp provider and add digital assets to your account
315
+ using your credit card or bank transfer
316
+ </wui-text>
317
+ </wui-flex>
318
+ <wui-button @click=${D.goBack}>
319
+ <wui-icon size="sm" color="inherit" name="add" slot="iconLeft"></wui-icon>
320
+ Buy
321
+ </wui-button>
322
+ </wui-flex>
323
+ `}};S=X([g("w3m-what-is-a-buy-view")],S);const H=O`
324
+ :host {
325
+ width: 100%;
326
+ }
327
+
328
+ wui-loading-spinner {
329
+ position: absolute;
330
+ top: 50%;
331
+ right: 20px;
332
+ transform: translateY(-50%);
333
+ }
334
+
335
+ .currency-container {
336
+ position: absolute;
337
+ top: 50%;
338
+ transform: translateY(-50%);
339
+ right: ${({spacing:t})=>t[2]};
340
+ height: 40px;
341
+ padding: ${({spacing:t})=>t[2]} ${({spacing:t})=>t[2]}
342
+ ${({spacing:t})=>t[2]} ${({spacing:t})=>t[2]};
343
+ min-width: 95px;
344
+ border-radius: ${({borderRadius:t})=>t.round};
345
+ border: 1px solid ${({tokens:t})=>t.theme.foregroundPrimary};
346
+ background: ${({tokens:t})=>t.theme.foregroundPrimary};
347
+ cursor: pointer;
348
+ }
349
+
350
+ .currency-container > wui-image {
351
+ height: 24px;
352
+ width: 24px;
353
+ border-radius: 50%;
354
+ }
355
+ `;var R=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};let w=class extends b{constructor(){super(),this.unsubscribe=[],this.type="Token",this.value=0,this.currencies=[],this.selectedCurrency=this.currencies?.[0],this.currencyImages=C.state.currencyImages,this.tokenImages=C.state.tokenImages,this.unsubscribe.push(c.subscribeKey("purchaseCurrency",e=>{!e||this.type==="Fiat"||(this.selectedCurrency=this.formatPurchaseCurrency(e))}),c.subscribeKey("paymentCurrency",e=>{!e||this.type==="Token"||(this.selectedCurrency=this.formatPaymentCurrency(e))}),c.subscribe(e=>{this.type==="Fiat"?this.currencies=e.purchaseCurrencies.map(this.formatPurchaseCurrency):this.currencies=e.paymentCurrencies.map(this.formatPaymentCurrency)}),C.subscribe(e=>{this.currencyImages={...e.currencyImages},this.tokenImages={...e.tokenImages}}))}firstUpdated(){c.getAvailableCurrencies()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.selectedCurrency?.symbol||"",r=this.currencyImages[e]||this.tokenImages[e];return u`<wui-input-text type="number" size="lg" value=${this.value}>
356
+ ${this.selectedCurrency?u` <wui-flex
357
+ class="currency-container"
358
+ justifyContent="space-between"
359
+ alignItems="center"
360
+ gap="1"
361
+ @click=${()=>$.open({view:`OnRamp${this.type}Select`})}
362
+ >
363
+ <wui-image src=${m(r)}></wui-image>
364
+ <wui-text color="primary">${this.selectedCurrency.symbol}</wui-text>
365
+ </wui-flex>`:u`<wui-loading-spinner></wui-loading-spinner>`}
366
+ </wui-input-text>`}formatPaymentCurrency(e){return{name:e.id,symbol:e.id}}formatPurchaseCurrency(e){return{name:e.name,symbol:e.symbol}}};w.styles=H;R([p({type:String})],w.prototype,"type",void 0);R([p({type:Number})],w.prototype,"value",void 0);R([l()],w.prototype,"currencies",void 0);R([l()],w.prototype,"selectedCurrency",void 0);R([l()],w.prototype,"currencyImages",void 0);R([l()],w.prototype,"tokenImages",void 0);w=R([g("w3m-onramp-input")],w);const G=O`
367
+ :host > wui-flex {
368
+ width: 100%;
369
+ max-width: 360px;
370
+ }
371
+
372
+ :host > wui-flex > wui-flex {
373
+ border-radius: ${({borderRadius:t})=>t[8]};
374
+ width: 100%;
375
+ }
376
+
377
+ .amounts-container {
378
+ width: 100%;
379
+ }
380
+ `;var x=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};const J={USD:"$",EUR:"€",GBP:"£"},Z=[100,250,500,1e3];let f=class extends b{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.caipAddress=I.state.activeCaipAddress,this.loading=$.state.loading,this.paymentCurrency=c.state.paymentCurrency,this.paymentAmount=c.state.paymentAmount,this.purchaseAmount=c.state.purchaseAmount,this.quoteLoading=c.state.quotesLoading,this.unsubscribe.push(I.subscribeKey("activeCaipAddress",e=>this.caipAddress=e),$.subscribeKey("loading",e=>{this.loading=e}),c.subscribe(e=>{this.paymentCurrency=e.paymentCurrency,this.paymentAmount=e.paymentAmount,this.purchaseAmount=e.purchaseAmount,this.quoteLoading=e.quotesLoading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return u`
381
+ <wui-flex flexDirection="column" justifyContent="center" alignItems="center">
382
+ <wui-flex flexDirection="column" alignItems="center" gap="2">
383
+ <w3m-onramp-input
384
+ type="Fiat"
385
+ @inputChange=${this.onPaymentAmountChange.bind(this)}
386
+ .value=${this.paymentAmount||0}
387
+ ></w3m-onramp-input>
388
+ <w3m-onramp-input
389
+ type="Token"
390
+ .value=${this.purchaseAmount||0}
391
+ .loading=${this.quoteLoading}
392
+ ></w3m-onramp-input>
393
+ <wui-flex justifyContent="space-evenly" class="amounts-container" gap="2">
394
+ ${Z.map(e=>u`<wui-button
395
+ variant=${this.paymentAmount===e?"accent-secondary":"neutral-secondary"}
396
+ size="md"
397
+ textVariant="md-medium"
398
+ fullWidth
399
+ @click=${()=>this.selectPresetAmount(e)}
400
+ >${`${J[this.paymentCurrency?.id||"USD"]} ${e}`}</wui-button
401
+ >`)}
402
+ </wui-flex>
403
+ ${this.templateButton()}
404
+ </wui-flex>
405
+ </wui-flex>
406
+ `}templateButton(){return this.caipAddress?u`<wui-button
407
+ @click=${this.getQuotes.bind(this)}
408
+ variant="accent-primary"
409
+ fullWidth
410
+ size="lg"
411
+ borderRadius="xs"
412
+ >
413
+ Get quotes
414
+ </wui-button>`:u`<wui-button
415
+ @click=${this.openModal.bind(this)}
416
+ variant="accent"
417
+ fullWidth
418
+ size="lg"
419
+ borderRadius="xs"
420
+ >
421
+ Connect wallet
422
+ </wui-button>`}getQuotes(){this.loading||$.open({view:"OnRampProviders"})}openModal(){$.open({view:"Connect"})}async onPaymentAmountChange(e){c.setPaymentAmount(Number(e.detail)),await c.getQuote()}async selectPresetAmount(e){c.setPaymentAmount(e),await c.getQuote()}};f.styles=G;x([p({type:Boolean})],f.prototype,"disabled",void 0);x([l()],f.prototype,"caipAddress",void 0);x([l()],f.prototype,"loading",void 0);x([l()],f.prototype,"paymentCurrency",void 0);x([l()],f.prototype,"paymentAmount",void 0);x([l()],f.prototype,"purchaseAmount",void 0);x([l()],f.prototype,"quoteLoading",void 0);f=x([g("w3m-onramp-widget")],f);export{d as W3mBuyInProgressView,U as W3mOnRampProvidersView,k as W3mOnrampFiatSelectView,P as W3mOnrampTokensView,f as W3mOnrampWidget,S as W3mWhatIsABuyView};
assets/parseSignature-DIfAupLd.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import{B as _,I as St,bY as Jt,b5 as de,co as Kt,bZ as Ae,cj as le,bb as Yt,bK as Se,bt as W,dY as Bt,cq as pe,dZ as Qt,d_ as I,d$ as M,bk as Be,ct as re,e0 as Tt,e1 as cr,a_ as Xt,c2 as m,bG as en,e2 as ur,e3 as fr,e4 as ve,e5 as et,bI as tn,l as Rt,de as lr,bM as dr,br as nn,e6 as rn,bL as tt,bU as he,bD as J,c7 as sn,g as pr,bd as Z,bW as Q,a0 as ie,c3 as Me,ck as hr,b2 as mr,di as yr,dj as br,x as gr,e7 as wr,aU as vr,a3 as Te,b$ as nt,R as rt,aG as xr,e8 as Pr,cf as Er,cg as $r,e9 as Ir,ea as Ar,eb as kr,ah as Sr,bP as Br,cr as se,a$ as Tr,ba as Rr,b0 as Nr,cm as Cr,a9 as zr,bX as st,ec as Fr,bJ as an,ed as Or,ee as _r,ef as on,eg as G,eh as Lr,ei as at,ej as D,ek as O,el as T,em as cn,en as A,eo as un,ep as Mr,eq as R,er as fn,es as Ur,et as j,eu as jr,ev as Dr,ew as Vr,ex as Hr,ey as qr,ez as me,eA as ln,eB as Gr,eC as ye,eD as it,eE as Ie,eF as Nt,eG as Wr,bT as dn,eH as Re,eI as pn,eJ as Zr,eK as Jr,c as Kr,au as Yr,bA as Qr,eL as Xr,aO as es,bR as ae,bp as ts,d9 as ot,ca as ns,c0 as rs,eM as ss,eN as hn,bv as Ct,bs as as,bw as is,C as os,bS as cs,H as us,cl as be,eO as ge,eP as Ne,eQ as fe,eR as ct,a8 as mn,eS as ut,bj as yn,L as bn,M as gn,eT as fs,ci as zt,eU as ls,cw as ds,bF as ps,eV as hs,eW as ms,eX as ys,eY as bs,eZ as gs,e_ as ws,e$ as vs,f0 as xs,f1 as Ps,f2 as Es,f3 as $s,f4 as Is,f5 as As,f6 as ks,f7 as Ss,f8 as Bs,be as Ts}from"./index-C-6muS97.js";import{l as ft}from"./localBatchGatewayRequest-BpO1N93o.js";import{secp256k1 as wn}from"./secp256k1-BP3xnA4u.js";import{c as vn,e as Rs}from"./hashTypedData-BUyxnl-E.js";function lt(e){if(!(e instanceof _))return!1;const t=e.walk(n=>n instanceof St);return t instanceof St?t.data?.errorName==="HttpError"||t.data?.errorName==="ResolverError"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ReverseAddressMismatch"||t.data?.errorName==="UnsupportedResolverProfile":!1}function xn(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Jt(t)?t:null}function Ve(e){let t=new Uint8Array(32).fill(0);if(!e)return de(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const s=xn(n[r]),a=s?Kt(s):Ae(le(n[r]),"bytes");t=Ae(Yt([t,a]),"bytes")}return de(t)}function Ns(e){return`[${e.slice(2)}]`}function Cs(e){const t=new Uint8Array(32).fill(0);return e?xn(e)||Ae(le(e)):de(t)}function dt(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(le(t).byteLength+2);let r=0;const s=t.split(".");for(let a=0;a<s.length;a++){let i=le(s[a]);i.byteLength>255&&(i=le(Ns(Cs(s[a])))),n[r]=i.length,n.set(i,r+1),r+=i.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function zs(e,t){const{blockNumber:n,blockTag:r,coinType:s,name:a,gatewayUrls:i,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Se({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),f=c?.ensTlds;if(f&&!f.some(d=>a.endsWith(d)))return null;const l=s!=null?[Ve(a),BigInt(s)]:[Ve(a)];try{const d=W({abi:Bt,functionName:"addr",args:l}),p={address:u,abi:Qt,functionName:"resolveWithGateways",args:[pe(dt(a)),d,i??[ft]],blockNumber:n,blockTag:r},g=await I(e,M,"readContract")(p);if(g[0]==="0x")return null;const h=Be({abi:Bt,args:l,functionName:"addr",data:g[0]});return h==="0x"||re(h)==="0x00"?null:h}catch(d){if(o)throw d;if(lt(d))return null;throw d}}class Fs extends _{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class ue extends _{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class pt extends _{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Os extends _{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const _s=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Ls=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,Ms=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Us=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function js(e){try{const t=await fetch(e,{method:"HEAD"});return t.status===200?t.headers.get("content-type")?.startsWith("image/"):!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Ft(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Pn({uri:e,gatewayUrls:t}){const n=Ms.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Ft(t?.ipfs,"https://ipfs.io"),s=Ft(t?.arweave,"https://arweave.net"),a=e.match(_s),{protocol:i,subpath:o,target:c,subtarget:u=""}=a?.groups||{},f=i==="ipns:/"||o==="ipns/",l=i==="ipfs:/"||o==="ipfs/"||Ls.test(e);if(e.startsWith("http")&&!f&&!l){let p=e;return t?.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((f||l)&&c)return{uri:`${r}/${f?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&c)return{uri:`${s}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(Us,"");if(d.startsWith("<svg")&&(d=`data:image/svg+xml;base64,${btoa(d)}`),d.startsWith("data:")||d.startsWith("{"))return{uri:d,isOnChain:!0,isEncoded:!1};throw new pt({uri:e})}function En(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Fs({data:e});return e.image||e.image_url||e.image_data}async function Ds({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(s=>s.json());return await ht({gatewayUrls:e,uri:En(n)})}catch{throw new pt({uri:t})}}async function ht({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Pn({uri:t,gatewayUrls:e});if(r||await js(n))return n;throw new pt({uri:t})}function Vs(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=t.split("/"),[a,i]=n.split(":"),[o,c]=r.split(":");if(!a||a.toLowerCase()!=="eip155")throw new ue({reason:"Only EIP-155 supported"});if(!i)throw new ue({reason:"Chain ID not found"});if(!c)throw new ue({reason:"Contract address not found"});if(!s)throw new ue({reason:"Token ID not found"});if(!o)throw new ue({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:o.toLowerCase(),contractAddress:c,tokenID:s}}async function Hs(e,{nft:t}){if(t.namespace==="erc721")return M(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return M(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Os({namespace:t.namespace})}async function qs(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Gs(e,{gatewayUrls:t,record:n}):ht({uri:n,gatewayUrls:t})}async function Gs(e,{gatewayUrls:t,record:n}){const r=Vs(n),s=await Hs(e,{nft:r}),{uri:a,isOnChain:i,isEncoded:o}=Pn({uri:s,gatewayUrls:t});if(i&&(a.includes("data:application/json;base64,")||a.startsWith("{"))){const u=o?atob(a.replace("data:application/json;base64,","")):a,f=JSON.parse(u);return ht({uri:En(f),gatewayUrls:t})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),Ds({gatewayUrls:t,uri:a.replace(/(?:0x)?{id}/,c)})}async function $n(e,t){const{blockNumber:n,blockTag:r,key:s,name:a,gatewayUrls:i,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Se({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),f=c?.ensTlds;if(f&&!f.some(l=>a.endsWith(l)))return null;try{const l={address:u,abi:Qt,args:[pe(dt(a)),W({abi:Tt,functionName:"text",args:[Ve(a),s]}),i??[ft]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},p=await I(e,M,"readContract")(l);if(p[0]==="0x")return null;const y=Be({abi:Tt,functionName:"text",data:p[0]});return y===""?null:y}catch(l){if(o)throw l;if(lt(l))return null;throw l}}async function Ws(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:a,strict:i,universalResolverAddress:o}){const c=await I(e,$n,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:s,universalResolverAddress:o,gatewayUrls:a,strict:i});if(!c)return null;try{return await qs(e,{record:c,gatewayUrls:r})}catch{return null}}async function Zs(e,t){const{address:n,blockNumber:r,blockTag:s,coinType:a=60n,gatewayUrls:i,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Se({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const f={address:u,abi:cr,args:[n,a,i??[ft]],functionName:"reverseWithGateways",blockNumber:r,blockTag:s},l=I(e,M,"readContract"),[d]=await l(f);return d||null}catch(f){if(o)throw f;if(lt(f))return null;throw f}}async function Js(e,t){const{blockNumber:n,blockTag:r,name:s}=t,{chain:a}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Se({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),o=a?.ensTlds;if(o&&!o.some(u=>s.endsWith(u)))throw new Error(`${s} is not a valid ENS TLD (${o?.join(", ")}) for chain "${a.name}" (id: ${a.id}).`);const[c]=await I(e,M,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[pe(dt(s))],blockNumber:n,blockTag:r});return c}async function In(e,t){const{account:n=e.account,blockNumber:r,blockTag:s="latest",blobs:a,data:i,gas:o,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:f,maxPriorityFeePerGas:l,to:d,value:p,...y}=t,g=n?ve(n):void 0;try{Xt(t);const w=(typeof r=="bigint"?m(r):void 0)||s,v=e.chain?.formatters?.transactionRequest?.format,P=(v||en)({...ur(y,{format:v}),account:g,blobs:a,data:i,gas:o,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:f,maxPriorityFeePerGas:l,to:d,value:p},"createAccessList"),k=await e.request({method:"eth_createAccessList",params:[P,w]});return{accessList:k.accessList,gasUsed:BigInt(k.gasUsed)}}catch(h){throw fr(h,{...t,account:g,chain:e.chain})}}async function Ks(e){const t=et(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}class Ys extends _{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const Ot="/docs/contract/encodeEventTopics";function xe(e){const{abi:t,eventName:n,args:r}=e;let s=t[0];if(n){const c=tn({abi:t,name:n});if(!c)throw new Rt(n,{docsPath:Ot});s=c}if(s.type!=="event")throw new Rt(void 0,{docsPath:Ot});const a=lr(s),i=dr(a);let o=[];if(r&&"inputs"in s){const c=s.inputs?.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?c?.map(f=>r[f.name])??[]:[];u.length>0&&(o=c?.map((f,l)=>Array.isArray(u[l])?u[l].map((d,p)=>_t({param:f,value:u[l][p]})):typeof u[l]<"u"&&u[l]!==null?_t({param:f,value:u[l]}):null)??[])}return[i,...o]}function _t({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ae(Kt(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Ys(e.type);return nn([e],[t])}async function An(e,t){const{address:n,abi:r,args:s,eventName:a,fromBlock:i,strict:o,toBlock:c}=t,u=et(e,{method:"eth_newFilter"}),f=a?xe({abi:r,args:s,eventName:a}):void 0,l=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?m(i):i,toBlock:typeof c=="bigint"?m(c):c,topics:f}]});return{abi:r,args:s,eventName:a,id:l,request:u(l),strict:!!o,type:"event"}}async function kn(e,{address:t,args:n,event:r,events:s,fromBlock:a,strict:i,toBlock:o}={}){const c=s??(r?[r]:void 0),u=et(e,{method:"eth_newFilter"});let f=[];c&&(f=[c.flatMap(p=>xe({abi:[p],eventName:p.name,args:n}))],r&&(f=f[0]));const l=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof a=="bigint"?m(a):a,toBlock:typeof o=="bigint"?m(o):o,...f.length?{topics:f}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:a,id:l,request:u(l),strict:!!i,toBlock:o,type:"event"}}async function Qs(e,t){const{abi:n,address:r,args:s,functionName:a,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,...o}=t,c=W({abi:n,args:s,functionName:a});try{return await I(e,rn,"estimateGas")({data:`${c}${i?i.replace("0x",""):""}`,to:r,...o})}catch(u){const f=o.account?ve(o.account):void 0;throw tt(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:a,sender:f?.address})}}async function Xs(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function ea(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?m(n):void 0;let a;return t?a=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):a=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]},{dedupe:!!s}),he(a)}async function He(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?m(n):void 0,a=await e.request({method:"eth_getCode",params:[t,s||r]},{dedupe:!!s});if(a!=="0x")return a}async function mt(e,{address:t,blockHash:n,fromBlock:r,toBlock:s,event:a,events:i,args:o,strict:c}={}){const u=c??!1,f=i??(a?[a]:void 0);let l=[];f&&(l=[f.flatMap(g=>xe({abi:[g],eventName:g.name,args:i?void 0:o}))],a&&(l=l[0]));let d;n?d=await e.request({method:"eth_getLogs",params:[{address:t,topics:l,blockHash:n}]}):d=await e.request({method:"eth_getLogs",params:[{address:t,topics:l,fromBlock:typeof r=="bigint"?m(r):r,toBlock:typeof s=="bigint"?m(s):s}]});const p=d.map(y=>J(y));return f?sn({abi:f,args:o,logs:p,strict:u}):p}async function Sn(e,t){const{abi:n,address:r,args:s,blockHash:a,eventName:i,fromBlock:o,toBlock:c,strict:u}=t,f=i?tn({abi:n,name:i}):void 0,l=f?void 0:n.filter(d=>d.type==="event");return I(e,mt,"getLogs")({address:r,args:s,blockHash:a,event:f,events:l,fromBlock:o,toBlock:c,strict:u})}class ta extends _{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function na(e,t){const{address:n,factory:r,factoryData:s}=t;try{const[a,i,o,c,u,f,l]=await I(e,M,"readContract")({abi:ra,address:n,functionName:"eip712Domain",factory:r,factoryData:s});return{domain:{name:i,version:o,chainId:Number(c),verifyingContract:u,salt:f},extensions:l,fields:a}}catch(a){const i=a;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new ta({address:n}):i}}const ra=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function sa(e){return{baseFeePerGas:e.baseFeePerGas.map(t=>BigInt(t)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map(t=>t.map(n=>BigInt(n)))}}async function aa(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const a=typeof n=="bigint"?m(n):void 0,i=await e.request({method:"eth_feeHistory",params:[m(t),a||r,s]},{dedupe:!!a});return sa(i)}async function ia(e,{filter:t}){const n=t.strict??!1,s=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(a=>J(a));return t.abi?sn({abi:t.abi,logs:s,strict:n}):s}function Qo(e,t){if(e.length!==t.length)throw new pr({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],a=t[r];n.push(Bn(s,a))}return Z(n)}function Bn(e,t,n=!1){if(e==="address"){const i=t;if(!Q(i))throw new ie({address:i});return Me(i.toLowerCase(),{size:n?32:null})}if(e==="string")return hr(t);if(e==="bytes")return t;if(e==="bool")return Me(mr(t),{size:n?32:1});const r=e.match(yr);if(r){const[i,o,c="256"]=r,u=Number.parseInt(c,10)/8;return m(t,{size:n?32:u,signed:o==="int"})}const s=e.match(br);if(s){const[i,o]=s;if(Number.parseInt(o,10)!==(t.length-2)/2)throw new gr({expectedSize:Number.parseInt(o,10),givenSize:(t.length-2)/2});return Me(t,{dir:"right",size:n?32:null})}const a=e.match(wr);if(a&&Array.isArray(t)){const[i,o]=a,c=[];for(let u=0;u<t.length;u++)c.push(Bn(o,t[u],!0));return c.length===0?"0x":Z(c)}throw new vr(e)}function oa(e){const{authorizationList:t}=e;if(t)for(const n of t){const{chainId:r}=n,s=n.address;if(!Q(s))throw new ie({address:s});if(r<0)throw new Te({chainId:r})}yt(e)}function ca(e){const{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new Pr;for(const n of t){const r=Er(n),s=he($r(n,0,1));if(r!==32)throw new Ir({hash:n,size:r});if(s!==Ar)throw new kr({hash:n,version:s})}}yt(e)}function yt(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:s}=e;if(t<=0)throw new Te({chainId:t});if(s&&!Q(s))throw new ie({address:s});if(r&&r>nt)throw new rt({maxFeePerGas:r});if(n&&r&&n>r)throw new xr({maxFeePerGas:r,maxPriorityFeePerGas:n})}function ua(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:s,to:a}=e;if(t<=0)throw new Te({chainId:t});if(a&&!Q(a))throw new ie({address:a});if(n||s)throw new _("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(r&&r>nt)throw new rt({maxFeePerGas:r})}function fa(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:s,to:a}=e;if(a&&!Q(a))throw new ie({address:a});if(typeof t<"u"&&t<=0)throw new Te({chainId:t});if(n||s)throw new _("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(r&&r>nt)throw new rt({maxFeePerGas:r})}function Ce(e){if(!e||e.length===0)return[];const t=[];for(let n=0;n<e.length;n++){const{address:r,storageKeys:s}=e[n];for(let a=0;a<s.length;a++)if(s[a].length-2!==64)throw new Sr({storageKey:s[a]});if(!Q(r,{strict:!1}))throw new ie({address:r});t.push([r,s])}return t}function Xo(e,t){const n=Br(e);return n==="eip1559"?pa(e,t):n==="eip2930"?ha(e,t):n==="eip4844"?da(e,t):n==="eip7702"?la(e,t):ma(e,t)}function la(e,t){const{authorizationList:n,chainId:r,gas:s,nonce:a,to:i,value:o,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:f,data:l}=e;oa(e);const d=Ce(f),p=ya(n);return Z(["0x04",se([m(r),a?m(a):"0x",u?m(u):"0x",c?m(c):"0x",s?m(s):"0x",i??"0x",o?m(o):"0x",l??"0x",d,p,...Pe(e,t)])])}function da(e,t){const{chainId:n,gas:r,nonce:s,to:a,value:i,maxFeePerBlobGas:o,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:f,data:l}=e;ca(e);let d=e.blobVersionedHashes,p=e.sidecars;if(e.blobs&&(typeof d>"u"||typeof p>"u")){const b=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map($=>de($)),P=e.kzg,k=Tr({blobs:b,kzg:P});if(typeof d>"u"&&(d=Rr({commitments:k})),typeof p>"u"){const $=Nr({blobs:b,commitments:k,kzg:P});p=Cr({blobs:b,commitments:k,proofs:$})}}const y=Ce(f),g=[m(n),s?m(s):"0x",u?m(u):"0x",c?m(c):"0x",r?m(r):"0x",a??"0x",i?m(i):"0x",l??"0x",y,o?m(o):"0x",d??[],...Pe(e,t)],h=[],w=[],v=[];if(p)for(let b=0;b<p.length;b++){const{blob:P,commitment:k,proof:$}=p[b];h.push(P),w.push(k),v.push($)}return Z(["0x03",p?se([g,h,w,v]):se(g)])}function pa(e,t){const{chainId:n,gas:r,nonce:s,to:a,value:i,maxFeePerGas:o,maxPriorityFeePerGas:c,accessList:u,data:f}=e;yt(e);const l=Ce(u),d=[m(n),s?m(s):"0x",c?m(c):"0x",o?m(o):"0x",r?m(r):"0x",a??"0x",i?m(i):"0x",f??"0x",l,...Pe(e,t)];return Z(["0x02",se(d)])}function ha(e,t){const{chainId:n,gas:r,data:s,nonce:a,to:i,value:o,accessList:c,gasPrice:u}=e;ua(e);const f=Ce(c),l=[m(n),a?m(a):"0x",u?m(u):"0x",r?m(r):"0x",i??"0x",o?m(o):"0x",s??"0x",f,...Pe(e,t)];return Z(["0x01",se(l)])}function ma(e,t){const{chainId:n=0,gas:r,data:s,nonce:a,to:i,value:o,gasPrice:c}=e;fa(e);let u=[a?m(a):"0x",c?m(c):"0x",r?m(r):"0x",i??"0x",o?m(o):"0x",s??"0x"];if(t){const f=(()=>{if(t.v>=35n)return(t.v-35n)/2n>0?t.v:27n+(t.v===35n?0n:1n);if(n>0)return BigInt(n*2)+BigInt(35n+t.v-27n);const p=27n+(t.v===27n?0n:1n);if(t.v!==p)throw new zr({v:t.v});return p})(),l=re(t.r),d=re(t.s);u=[...u,m(f),l==="0x00"?"0x":l,d==="0x00"?"0x":d]}else n>0&&(u=[...u,m(n),"0x","0x"]);return se(u)}function Pe(e,t){const n=t??e,{v:r,yParity:s}=n;if(typeof n.r>"u")return[];if(typeof n.s>"u")return[];if(typeof r>"u"&&typeof s>"u")return[];const a=re(n.r),i=re(n.s);return[typeof s=="number"?s?m(1):"0x":r===0n?"0x":r===1n?m(1):r===27n?"0x":m(1),a==="0x00"?"0x":a,i==="0x00"?"0x":i]}function ya(e){if(!e||e.length===0)return[];const t=[];for(const n of e){const{chainId:r,nonce:s,...a}=n,i=n.address;t.push([r?pe(r):"0x",i,s?pe(s):"0x",...Pe({},a)])}return t}async function ba({address:e,authorization:t,signature:n}){return st(an(e),await Fr({authorization:t,signature:n}))}function ec(e){const{source:t}=e,n=new Map,r=new Or(8192),s=new Map,a=({address:i,chainId:o})=>`${i}.${o}`;return{async consume({address:i,chainId:o,client:c}){const u=a({address:i,chainId:o}),f=this.get({address:i,chainId:o,client:c});this.increment({address:i,chainId:o});const l=await f;return await t.set({address:i,chainId:o},l),r.set(u,l),l},async increment({address:i,chainId:o}){const c=a({address:i,chainId:o}),u=n.get(c)??0;n.set(c,u+1)},async get({address:i,chainId:o,client:c}){const u=a({address:i,chainId:o});let f=s.get(u);return f||(f=(async()=>{try{const d=await t.get({address:i,chainId:o,client:c}),p=r.get(u)??0;return p>0&&d<=p?p+1:(r.delete(u),d)}finally{this.reset({address:i,chainId:o})}})(),s.set(u,f)),(n.get(u)??0)+await f},reset({address:i,chainId:o}){const c=a({address:i,chainId:o});n.delete(c),s.delete(c)}}}const ga="0x6492649264926492649264926492649264926492649264926492649264926492",wa="1.2.3";class N extends Error{constructor(t,n={}){const r=n.cause instanceof N?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof N&&n.cause.docsPath||n.docsPath,a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${wa}`].join(`
2
+ `);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=t}}function H(e,t){return e.exec(t)?.groups}const Tn=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Rn=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Nn=/^\(.+?\).*?$/,Lt=/^tuple(?<array>(\[(\d*)\])*)$/;function qe(e){let t=e.type;if(Lt.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const a=e.components[s];t+=qe(a),s<n-1&&(t+=", ")}const r=H(Lt,e.type);return t+=`)${r?.array||""}`,qe({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function ee(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=qe(s),r!==n-1&&(t+=", ")}return t}function Ge(e){return e.type==="function"?`function ${e.name}(${ee(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${ee(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${ee(e.inputs)})`:e.type==="error"?`error ${e.name}(${ee(e.inputs)})`:e.type==="constructor"?`constructor(${ee(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Cn=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function va(e){return Cn.test(e)}function xa(e){return H(Cn,e)}const zn=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Pa(e){return zn.test(e)}function Ea(e){return H(zn,e)}const Fn=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function $a(e){return Fn.test(e)}function Ia(e){return H(Fn,e)}const On=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function bt(e){return On.test(e)}function Aa(e){return H(On,e)}const _n=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function ka(e){return _n.test(e)}function Sa(e){return H(_n,e)}const Ln=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Ba(e){return Ln.test(e)}function Ta(e){return H(Ln,e)}const Ra=/^receive\(\) external payable$/;function Na(e){return Ra.test(e)}const Mt=new Set(["memory","indexed","storage","calldata"]),Ca=new Set(["indexed"]),We=new Set(["calldata","memory","storage"]);class za extends N{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Fa extends N{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Oa extends N{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class _a extends N{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class La extends N{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Ma extends N{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Ua extends N{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class ja extends N{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Da extends N{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class oe extends N{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Va extends N{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Ha extends N{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class qa extends N{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Ga extends N{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Wa(e,t,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let a="";for(const i of s[1])a+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${s[0]}{${a}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const Ue=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Ut(e,t={}){if($a(e))return Za(e,t);if(Pa(e))return Ja(e,t);if(va(e))return Ka(e,t);if(ka(e))return Ya(e,t);if(Ba(e))return Qa(e);if(Na(e))return{type:"receive",stateMutability:"payable"};throw new Va({signature:e})}function Za(e,t={}){const n=Ia(e);if(!n)throw new oe({signature:e,type:"function"});const r=F(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(V(r[o],{modifiers:We,structs:t,type:"function"}));const i=[];if(n.returns){const o=F(n.returns),c=o.length;for(let u=0;u<c;u++)i.push(V(o[u],{modifiers:We,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:i}}function Ja(e,t={}){const n=Ea(e);if(!n)throw new oe({signature:e,type:"event"});const r=F(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(V(r[i],{modifiers:Ca,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function Ka(e,t={}){const n=xa(e);if(!n)throw new oe({signature:e,type:"error"});const r=F(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(V(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:s}}function Ya(e,t={}){const n=Sa(e);if(!n)throw new oe({signature:e,type:"constructor"});const r=F(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(V(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function Qa(e){const t=Ta(e);if(!t)throw new oe({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Xa=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ei=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ti=/^u?int$/;function V(e,t){const n=Wa(e,t?.type,t?.structs);if(Ue.has(n))return Ue.get(n);const r=Nn.test(e),s=H(r?ei:Xa,e);if(!s)throw new La({param:e});if(s.name&&ri(s.name))throw new Ma({param:e,name:s.name});const a=s.name?{name:s.name}:{},i=s.modifier==="indexed"?{indexed:!0}:{},o=t?.structs??{};let c,u={};if(r){c="tuple";const l=F(s.type),d=[],p=l.length;for(let y=0;y<p;y++)d.push(V(l[y],{structs:o}));u={components:d}}else if(s.type in o)c="tuple",u={components:o[s.type]};else if(ti.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,t?.type!=="struct"&&!Mn(c))throw new Oa({type:c});if(s.modifier){if(!t?.modifiers?.has?.(s.modifier))throw new Ua({param:e,type:t?.type,modifier:s.modifier});if(We.has(s.modifier)&&!si(c,!!s.array))throw new ja({param:e,type:t?.type,modifier:s.modifier})}const f={type:`${c}${s.array??""}`,...a,...i,...u};return Ue.set(n,f),f}function F(e,t=[],n="",r=0){const s=e.trim().length;for(let a=0;a<s;a++){const i=e[a],o=e.slice(a+1);switch(i){case",":return r===0?F(o,[...t,n.trim()]):F(o,t,`${n}${i}`,r);case"(":return F(o,t,`${n}${i}`,r+1);case")":return F(o,t,`${n}${i}`,r-1);default:return F(o,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Ga({current:n,depth:r});return t.push(n.trim()),t}function Mn(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Tn.test(e)||Rn.test(e)}const ni=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function ri(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Tn.test(e)||Rn.test(e)||ni.test(e)}function si(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Un(e){const t={},n=e.length;for(let i=0;i<n;i++){const o=e[i];if(!bt(o))continue;const c=Aa(o);if(!c)throw new oe({signature:o,type:"struct"});const u=c.properties.split(";"),f=[],l=u.length;for(let d=0;d<l;d++){const y=u[d].trim();if(!y)continue;const g=V(y,{type:"struct"});f.push(g)}if(!f.length)throw new Ha({signature:o});t[c.name]=f}const r={},s=Object.entries(t),a=s.length;for(let i=0;i<a;i++){const[o,c]=s[i];r[o]=jn(c,t)}return r}const ai=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function jn(e=[],t={},n=new Set){const r=[],s=e.length;for(let a=0;a<s;a++){const i=e[a];if(Nn.test(i.type))r.push(i);else{const c=H(ai,i.type);if(!c?.type)throw new Da({abiParameter:i});const{array:u,type:f}=c;if(f in t){if(n.has(f))throw new qa({type:f});r.push({...i,type:`tuple${u??""}`,components:jn(t[f],t,new Set([...n,f]))})}else if(Mn(f))r.push(i);else throw new Fa({type:f})}}return r}function jt(e){let t;if(typeof e=="string")t=Ut(e);else{const n=Un(e),r=e.length;for(let s=0;s<r;s++){const a=e[s];if(!bt(a)){t=Ut(a,n);break}}}if(!t)throw new za({signature:e});return t}function Dt(e){const t=[];if(typeof e=="string"){const n=F(e),r=n.length;for(let s=0;s<r;s++)t.push(V(n[s],{modifiers:Mt}))}else{const n=Un(e),r=e.length;for(let s=0;s<r;s++){const a=e[s];if(bt(a))continue;const i=F(a),o=i.length;for(let c=0;c<o;c++)t.push(V(i[c],{modifiers:Mt,structs:n}))}}if(t.length===0)throw new _a({params:e});return t}class ii extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const oi={checksum:new ii(8192)},je=oi.checksum;function gt(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=_r(on(e));return n==="Bytes"?r:G(r)}function tc(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Lr(on(e));return n==="Bytes"?r:G(r)}function nc(e){return at(e)&&D(e)===32}function Dn(e,t={}){const{compressed:n}=t,{prefix:r,x:s,y:a}=e;if(n===!1||typeof s=="bigint"&&typeof a=="bigint"){if(r!==4)throw new Vt({prefix:r,cause:new li});return}if(n===!0||typeof s=="bigint"&&typeof a>"u"){if(r!==3&&r!==2)throw new Vt({prefix:r,cause:new fi});return}throw new ui({publicKey:e})}function rc(e){const t=(()=>{if(at(e))return Vn(e);if(Mr(e))return ci(e);const{prefix:n,x:r,y:s}=e;return typeof r=="bigint"&&typeof s=="bigint"?{prefix:n??4,x:r,y:s}:{prefix:n,x:r}})();return Dn(t),t}function ci(e){return Vn(G(e))}function Vn(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new di({publicKey:e});if(e.length===130){const r=BigInt(R(e,0,32)),s=BigInt(R(e,32,64));return{prefix:4,x:r,y:s}}if(e.length===132){const r=Number(R(e,0,1)),s=BigInt(R(e,1,33)),a=BigInt(R(e,33,65));return{prefix:r,x:s,y:a}}const t=Number(R(e,0,1)),n=BigInt(R(e,1,33));return{prefix:t,x:n}}function sc(e,t={}){return cn(Hn(e,t))}function Hn(e,t={}){Dn(e);const{prefix:n,x:r,y:s}=e,{includePrefix:a=!0}=t;return O(a?T(n,{size:1}):"0x",T(r,{size:32}),typeof s=="bigint"?T(s,{size:32}):"0x")}class ui extends A{constructor({publicKey:t}){super(`Value \`${un(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class Vt extends A{constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class fi extends A{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class li extends A{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let di=class extends A{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${D(fn(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const pi=/^0x[a-fA-F0-9]{40}$/;function K(e,t={}){const{strict:n=!0}=t;if(!pi.test(e))throw new Ht({address:e,cause:new mi});if(n){if(e.toLowerCase()===e)return;if(wt(e)!==e)throw new Ht({address:e,cause:new yi})}}function wt(e){if(je.has(e))return je.get(e);K(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=gt(Ur(t),{as:"Bytes"}),r=t.split("");for(let a=0;a<40;a+=2)n[a>>1]>>4>=8&&r[a]&&(r[a]=r[a].toUpperCase()),(n[a>>1]&15)>=8&&r[a+1]&&(r[a+1]=r[a+1].toUpperCase());const s=`0x${r.join("")}`;return je.set(e,s),s}function hi(e,t={}){const{checksum:n=!1}=t;return K(e),n?wt(e):e}function ic(e,t={}){const n=gt(`0x${Hn(e).slice(4)}`).substring(26);return hi(`0x${n}`,t)}function oc(e,t){return K(e,{strict:!1}),K(t,{strict:!1}),e.toLowerCase()===t.toLowerCase()}function Ze(e,t={}){const{strict:n=!0}=t??{};try{return K(e,{strict:n}),!0}catch{return!1}}class Ht extends A{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class mi extends A{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class yi extends A{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const bi=/^(.*)\[([0-9]*)\]$/,gi=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,qn=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,qt=2n**256n-1n;function ne(e,t,n){const{checksumAddress:r,staticPosition:s}=n,a=Pt(t.type);if(a){const[i,o]=a;return vi(e,{...t,type:o},{checksumAddress:r,length:i,staticPosition:s})}if(t.type==="tuple")return $i(e,t,{checksumAddress:r,staticPosition:s});if(t.type==="address")return wi(e,{checksum:r});if(t.type==="bool")return xi(e);if(t.type.startsWith("bytes"))return Pi(e,t,{staticPosition:s});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Ei(e,t);if(t.type==="string")return Ii(e,{staticPosition:s});throw new $t(t.type)}const Gt=32,Je=32;function wi(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(a=>n?wt(a):a)(G(jr(r,-20))),32]}function vi(e,t,n){const{checksumAddress:r,length:s,staticPosition:a}=n;if(!s){const c=j(e.readBytes(Je)),u=a+c,f=u+Gt;e.setPosition(u);const l=j(e.readBytes(Gt)),d=we(t);let p=0;const y=[];for(let g=0;g<l;++g){e.setPosition(f+(d?g*32:p));const[h,w]=ne(e,t,{checksumAddress:r,staticPosition:f});p+=w,y.push(h)}return e.setPosition(a+32),[y,32]}if(we(t)){const c=j(e.readBytes(Je)),u=a+c,f=[];for(let l=0;l<s;++l){e.setPosition(u+l*32);const[d]=ne(e,t,{checksumAddress:r,staticPosition:u});f.push(d)}return e.setPosition(a+32),[f,32]}let i=0;const o=[];for(let c=0;c<s;++c){const[u,f]=ne(e,t,{checksumAddress:r,staticPosition:a+i});i+=f,o.push(u)}return[o,i]}function xi(e){return[Dr(e.readBytes(32),{size:32}),32]}function Pi(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const i=j(e.readBytes(32));e.setPosition(n+i);const o=j(e.readBytes(32));if(o===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(o);return e.setPosition(n+32),[G(c),32]}return[G(e.readBytes(Number.parseInt(s,10),32)),32]}function Ei(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?Vr(s,{signed:n}):j(s,{signed:n}),32]}function $i(e,t,n){const{checksumAddress:r,staticPosition:s}=n,a=t.components.length===0||t.components.some(({name:c})=>!c),i=a?[]:{};let o=0;if(we(t)){const c=j(e.readBytes(Je)),u=s+c;for(let f=0;f<t.components.length;++f){const l=t.components[f];e.setPosition(u+o);const[d,p]=ne(e,l,{checksumAddress:r,staticPosition:u});o+=p,i[a?f:l?.name]=d}return e.setPosition(s+32),[i,32]}for(let c=0;c<t.components.length;++c){const u=t.components[c],[f,l]=ne(e,u,{checksumAddress:r,staticPosition:s});i[a?c:u?.name]=f,o+=l}return[i,o]}function Ii(e,{staticPosition:t}){const n=j(e.readBytes(32)),r=t+n;e.setPosition(r);const s=j(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const a=e.readBytes(s,32),i=Hr(qr(a));return e.setPosition(t+32),[i,32]}function Ai({checksumAddress:e,parameters:t,values:n}){const r=[];for(let s=0;s<t.length;s++)r.push(vt({checksumAddress:e,parameter:t[s],value:n[s]}));return r}function vt({checksumAddress:e=!1,parameter:t,value:n}){const r=t,s=Pt(r.type);if(s){const[a,i]=s;return Si(n,{checksumAddress:e,length:a,parameter:{...r,type:i}})}if(r.type==="tuple")return Ci(n,{checksumAddress:e,parameter:r});if(r.type==="address")return ki(n,{checksum:e});if(r.type==="bool")return Ti(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const a=r.type.startsWith("int"),[,,i="256"]=qn.exec(r.type)??[];return Ri(n,{signed:a,size:Number(i)})}if(r.type.startsWith("bytes"))return Bi(n,{type:r.type});if(r.type==="string")return Ni(n);throw new $t(r.type)}function xt(e){let t=0;for(let a=0;a<e.length;a++){const{dynamic:i,encoded:o}=e[a];i?t+=32:t+=D(o)}const n=[],r=[];let s=0;for(let a=0;a<e.length;a++){const{dynamic:i,encoded:o}=e[a];i?(n.push(T(t+s,{size:32})),r.push(o),s+=D(o)):n.push(o)}return O(...n,...r)}function ki(e,t){const{checksum:n=!1}=t;return K(e,{strict:n}),{dynamic:!1,encoded:me(e.toLowerCase())}}function Si(e,t){const{checksumAddress:n,length:r,parameter:s}=t,a=r===null;if(!Array.isArray(e))throw new Di(e);if(!a&&e.length!==r)throw new ji({expectedLength:r,givenLength:e.length,type:`${s.type}[${r}]`});let i=!1;const o=[];for(let c=0;c<e.length;c++){const u=vt({checksumAddress:n,parameter:s,value:e[c]});u.dynamic&&(i=!0),o.push(u)}if(a||i){const c=xt(o);if(a){const u=T(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?O(u,c):u}}if(i)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:O(...o.map(({encoded:c})=>c))}}function Bi(e,{type:t}){const[,n]=t.split("bytes"),r=D(e);if(!n){let s=e;return r%32!==0&&(s=ye(s,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:O(me(T(r,{size:32})),s)}}if(r!==Number.parseInt(n,10))throw new Wn({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:ye(e)}}function Ti(e){if(typeof e!="boolean")throw new A(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:me(ln(e))}}function Ri(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new Gr({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:T(e,{size:32,signed:t})}}function Ni(e){const t=it(e),n=Math.ceil(D(t)/32),r=[];for(let s=0;s<n;s++)r.push(ye(R(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:O(ye(T(D(t),{size:32})),...r)}}function Ci(e,t){const{checksumAddress:n,parameter:r}=t;let s=!1;const a=[];for(let i=0;i<r.components.length;i++){const o=r.components[i],c=Array.isArray(e)?i:o.name,u=vt({checksumAddress:n,parameter:o,value:e[c]});a.push(u),u.dynamic&&(s=!0)}return{dynamic:s,encoded:s?xt(a):O(...a.map(({encoded:i})=>i))}}function Pt(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function we(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(we);const n=Pt(e.type);return!!(n&&we({...e,type:n[1]}))}const zi={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new _i({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Oi({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Wt({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Wt({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Fi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(zi);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Wt extends A{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Oi extends A{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class _i extends A{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function Li(e,t,n={}){const{as:r="Array",checksumAddress:s=!1}=n,a=typeof t=="string"?cn(t):t,i=Fi(a);if(Ie(a)===0&&e.length>0)throw new Ui;if(Ie(a)&&Ie(a)<32)throw new Mi({data:typeof t=="string"?t:G(t),parameters:e,size:Ie(a)});let o=0;const c=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const f=e[u];i.setPosition(o);const[l,d]=ne(i,f,{checksumAddress:s,staticPosition:0});o+=d,r==="Array"?c.push(l):c[f.name??u]=l}return c}function Et(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Zn({expectedLength:e.length,givenLength:t.length});const s=Ai({checksumAddress:r,parameters:e,values:t}),a=xt(s);return a.length===0?"0x":a}function Ke(e,t){if(e.length!==t.length)throw new Zn({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],a=t[r];n.push(Ke.encode(s,a))}return O(...n)}(function(e){function t(n,r,s=!1){if(n==="address"){const c=r;return K(c),me(c.toLowerCase(),s?32:0)}if(n==="string")return it(r);if(n==="bytes")return r;if(n==="bool")return me(ln(r),s?32:1);const a=n.match(qn);if(a){const[c,u,f="256"]=a,l=Number.parseInt(f,10)/8;return T(r,{size:s?32:l,signed:u==="int"})}const i=n.match(gi);if(i){const[c,u]=i;if(Number.parseInt(u,10)!==(r.length-2)/2)throw new Wn({expectedSize:Number.parseInt(u,10),value:r});return ye(r,s?32:0)}const o=n.match(bi);if(o&&Array.isArray(r)){const[c,u]=o,f=[];for(let l=0;l<r.length;l++)f.push(t(u,r[l],!0));return f.length===0?"0x":O(...f)}throw new $t(n)}e.encode=t})(Ke||(Ke={}));function Gn(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?Dt(e):e}class Mi extends A{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${ee(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Ui extends A{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class ji extends A{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class Wn extends A{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${D(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Zn extends A{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
3
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Di extends A{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class $t extends A{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function It(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new De({signature:e});if(typeof e.s>"u")throw new De({signature:e});if(n&&typeof e.yParity>"u")throw new De({signature:e});if(e.r<0n||e.r>qt)throw new Ki({value:e.r});if(e.s<0n||e.s>qt)throw new Yi({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new ze({value:e.yParity})}function Vi(e){return Jn(G(e))}function Jn(e){if(e.length!==130&&e.length!==132)throw new Ji({signature:e});const t=BigInt(R(e,0,32)),n=BigInt(R(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return At(s)}catch{throw new ze({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function Hi(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return Kn(e)}function Kn(e){const t=typeof e=="string"?Jn(e):e instanceof Uint8Array?Vi(e):typeof e.r=="string"?Gi(e):e.v?qi(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return It(t),t}function qi(e){return{r:e.r,s:e.s,yParity:At(e.v)}}function Gi(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=At(n)),typeof r!="number")throw new ze({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function cc(e){const[t,n,r]=e;return Kn({r:n==="0x"?0n:BigInt(n),s:r==="0x"?0n:BigInt(r),yParity:t==="0x"?0:Number(t)})}function uc(e){It(e);const t=e.r,n=e.s;return O(T(t,{size:32}),T(n,{size:32}),typeof e.yParity=="number"?T(Zi(e.yParity),{size:1}):"0x")}function Wi(e){const{r:t,s:n,yParity:r}=e;return{r:T(t,{size:32}),s:T(n,{size:32}),yParity:r===0?"0x0":"0x1"}}function fc(e){const{r:t,s:n,yParity:r}=e;return[r?"0x01":"0x",t===0n?"0x":Nt(T(t)),n===0n?"0x":Nt(T(n))]}function At(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new Qi({value:e})}function Zi(e){if(e===0)return 27;if(e===1)return 28;throw new ze({value:e})}class Ji extends A{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${D(fn(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class De extends A{constructor({signature:t}){super(`Signature \`${un(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class Ki extends A{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class Yi extends A{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class ze extends A{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class Qi extends A{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function Xi(e,t={}){return typeof e.chainId=="string"?Yn(e):{...e,...t.signature}}function Yn(e){const{address:t,chainId:n,nonce:r}=e,s=Hi(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...s}}function lc(e){return e.map(Yn)}function eo(e){const{address:t,chainId:n,nonce:r,...s}=e;return{address:t,chainId:T(n),nonce:T(r),...Wi(s)}}function dc(e){return e.map(eo)}const to="0x8010801080108010801080108010801080108010801080108010801080108010",no=Gn("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function Qn(e){if(typeof e=="string"){if(R(e,-32)!==to)throw new ao(e)}else It(e.authorization)}function ro(e){Qn(e);const t=Wr(R(e,-64,-32)),n=R(e,-t-64,-64),r=R(e,0,-t-64),[s,a,i]=Li(no,n);return{authorization:Xi({address:s.delegation,chainId:Number(s.chainId),nonce:s.nonce,yParity:s.yParity,r:s.r,s:s.s}),signature:r,...i&&i!=="0x"?{data:i,to:a}:{}}}function so(e){try{return Qn(e),!0}catch{return!1}}let ao=class extends A{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};function hc(e){const{address:t,data:n,signature:r,to:s="hex"}=e,a=Z([nn([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),ga]);return s==="hex"?a:dn(a)}function io(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function oo(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?he(e.nonce):void 0,storageProof:e.storageProof?io(e.storageProof):void 0}}async function co(e,{address:t,blockNumber:n,blockTag:r,storageKeys:s}){const a=r??"latest",i=n!==void 0?m(n):void 0,o=await e.request({method:"eth_getProof",params:[t,s,i||a]});return oo(o)}async function uo(e,{address:t,blockNumber:n,blockTag:r="latest",slot:s}){const a=n!==void 0?m(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,s,a||r]})}async function fo(e,{hash:t,transactionReceipt:n}){const[r,s]=await Promise.all([I(e,Re,"getBlockNumber")({}),t?I(e,pn,"getTransaction")({hash:t}):void 0]),a=n?.blockNumber||s?.blockNumber;return a?r-a+1n:0n}async function Ye(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:s,returnFullTransactions:a,traceTransfers:i,validation:o}=t;try{const c=[];for(const d of s){const p=d.blockOverrides?Zr(d.blockOverrides):void 0,y=d.calls.map(h=>{const w=h,v=w.account?ve(w.account):void 0,b=w.abi?W(w):w.data,P={...w,account:v,data:w.dataSuffix?Yt([b||"0x",w.dataSuffix]):b,from:w.from??v?.address};return Xt(P),en(P)}),g=d.stateOverrides?Jr(d.stateOverrides):void 0;c.push({blockOverrides:p,calls:y,stateOverrides:g})}const f=(typeof n=="bigint"?m(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:a,traceTransfers:i,validation:o},f]})).map((d,p)=>({...Qr(d),calls:d.calls.map((y,g)=>{const{abi:h,args:w,functionName:v,to:b}=s[p].calls[g],P=y.error?.data??y.returnData,k=BigInt(y.gasUsed),$=y.logs?.map(B=>J(B)),E=y.status==="0x1"?"success":"failure",S=h&&E==="success"&&P!=="0x"?Be({abi:h,data:P,functionName:v}):null,C=(()=>{if(E==="success")return;let B;if(y.error?.data==="0x"?B=new Kr:y.error&&(B=new Yr(y.error)),!!B)return tt(B,{abi:h??[],address:b??"0x",args:w,functionName:v??"<unknown>"})})();return{data:P,gasUsed:k,logs:$,status:E,...E==="success"?{result:S}:{error:C}}})}))}catch(c){const u=c,f=Xr(u,{});throw f instanceof es?u:f}}function Qe(e){let t=!0,n="",r=0,s="",a=!1;for(let i=0;i<e.length;i++){const o=e[i];if(["(",")",","].includes(o)&&(t=!0),o==="("&&r++,o===")"&&r--,!!t){if(r===0){if(o===" "&&["event","function","error",""].includes(s))s="";else if(s+=o,o===")"){a=!0;break}continue}if(o===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=o,n+=o}}if(!a)throw new A("Unable to normalize signature.");return s}function Xe(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Ze(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,a)=>Xe(Object.values(e)[a],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>Xe(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Xn(e,t,n){for(const r in e){const s=e[r],a=t[r];if(s.type==="tuple"&&a.type==="tuple"&&"components"in s&&"components"in a)return Xn(s.components,a.components,n[r]);const i=[s.type,a.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?Ze(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Ze(n[r],{strict:!1}):!1)return i}}function er(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?jt(e):e;return{...r,...n?{hash:te(r)}:{}}}function Fe(e,t,n){const{args:r=[],prepare:s=!0}=n??{},a=at(t,{strict:!1}),i=e.filter(u=>a?u.type==="function"||u.type==="error"?tr(u)===R(t,0,4):u.type==="event"?te(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new ke({name:t});if(i.length===1)return{...i[0],...s?{hash:te(i[0])}:{}};let o;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...s?{hash:te(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in u&&u.inputs[d];return p?Xe(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=Xn(u.inputs,o.inputs,r);if(l)throw new po({abiItem:u,type:l[0]},{abiItem:o,type:l[1]})}o=u}}const c=(()=>{if(o)return o;const[u,...f]=i;return{...u,overloads:f}})();if(!c)throw new ke({name:t});return{...c,...s?{hash:te(c)}:{}}}function tr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Fe(n,r)}return e[0]})();return R(te(t),0,4)}function lo(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,s]=e;return Fe(r,s)}return e[0]})(),n=typeof t=="string"?t:Ge(t);return Qe(n)}function te(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Fe(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:gt(it(lo(t)))}class po extends A{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Qe(Ge(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Qe(Ge(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class ke extends A{constructor({name:t,data:n,type:r="item"}){const s=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${s} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function ho(...e){const[t,n]=(()=>{if(Array.isArray(e[0])){const[a,i]=e;return[yo(a),i]}return e})(),{bytecode:r,args:s}=n;return O(r,t.inputs?.length&&s?.length?Et(t.inputs,s):"0x")}function mo(e){return er(e)}function yo(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new ke({name:"constructor"});return t}function bo(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[u,f,l]=e;return[Zt(u,f,{args:l}),l]}const[o,c]=e;return[o,c]})(),{overloads:r}=t,s=r?Zt([t,...r],t.name,{args:n}):t,a=go(s),i=n.length>0?Et(s.inputs,n):void 0;return i?O(a,i):a}function X(e,t={}){return er(e,t)}function Zt(e,t,n){const r=Fe(e,t,n);if(r.type!=="function")throw new ke({name:t,type:"function"});return r}function go(e){return tr(e)}const wo="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",L="0x0000000000000000000000000000000000000000",vo="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function xo(e,t){const{blockNumber:n,blockTag:r,calls:s,stateOverrides:a,traceAssetChanges:i,traceTransfers:o,validation:c}=t,u=t.account?ve(t.account):void 0;if(i&&!u)throw new _("`account` is required when `traceAssetChanges` is true");const f=u?ho(mo("constructor(bytes, bytes)"),{bytecode:ts,args:[vo,bo(X("function getBalance(address)"),[u.address])]}):void 0,l=i?await Promise.all(t.calls.map(async x=>{if(!x.data&&!x.abi)return;const{accessList:z}=await In(e,{account:u.address,...x,data:x.abi?W(x):x.data});return z.map(({address:ce,storageKeys:$e})=>$e.length>0?ce:null)})).then(x=>x.flat().filter(Boolean)):[],d=await Ye(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:f}],stateOverrides:a},{calls:l.map((x,z)=>({abi:[X("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:x,from:L,nonce:z})),stateOverrides:[{address:L,nonce:0}]}]:[],{calls:[...s,{}].map(x=>({...x,from:u?.address})),stateOverrides:a},...i?[{calls:[{data:f}]},{calls:l.map((x,z)=>({abi:[X("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:x,from:L,nonce:z})),stateOverrides:[{address:L,nonce:0}]},{calls:l.map((x,z)=>({to:x,abi:[X("function decimals() returns (uint256)")],functionName:"decimals",from:L,nonce:z})),stateOverrides:[{address:L,nonce:0}]},{calls:l.map((x,z)=>({to:x,abi:[X("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:L,nonce:z})),stateOverrides:[{address:L,nonce:0}]},{calls:l.map((x,z)=>({to:x,abi:[X("function symbol() returns (string)")],functionName:"symbol",from:L,nonce:z})),stateOverrides:[{address:L,nonce:0}]}]:[]],traceTransfers:o,validation:c}),p=i?d[2]:d[0],[y,g,,h,w,v,b,P]=i?d:[],{calls:k,...$}=p,E=k.slice(0,-1)??[],S=y?.calls??[],C=g?.calls??[],B=[...S,...C].map(x=>x.status==="success"?ae(x.data):null),q=h?.calls??[],U=w?.calls??[],_e=[...q,...U].map(x=>x.status==="success"?ae(x.data):null),Ee=(v?.calls??[]).map(x=>x.status==="success"?x.result:null),rr=(P?.calls??[]).map(x=>x.status==="success"?x.result:null),sr=(b?.calls??[]).map(x=>x.status==="success"?x.result:null),Le=[];for(const[x,z]of _e.entries()){const ce=B[x];if(typeof z!="bigint"||typeof ce!="bigint")continue;const $e=Ee[x-1],ar=rr[x-1],ir=sr[x-1],kt=x===0?{address:wo,decimals:18,symbol:"ETH"}:{address:l[x-1],decimals:ir||$e?Number($e??1):void 0,symbol:ar??void 0};Le.some(or=>or.token.address===kt.address)||Le.push({token:kt,value:{pre:ce,post:z,diff:z-ce}})}return{assetChanges:Le,block:$,results:E}}async function Po(e,t){const{abi:n,address:r,args:s,functionName:a,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,...o}=t,c=o.account?ve(o.account):e.account,u=W({abi:n,args:s,functionName:a});try{const{data:f}=await I(e,ot,"call")({batch:!1,data:`${u}${i?i.replace("0x",""):""}`,to:r,...o,account:c}),l=Be({abi:n,args:s,functionName:a,data:f||"0x"}),d=n.filter(p=>"name"in p&&p.name===t.functionName);return{result:l,request:{abi:d,address:r,args:s,dataSuffix:i,functionName:a,...o,account:c}}}catch(f){throw tt(f,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:a,sender:c?.address})}}const nr="0x6492649264926492649264926492649264926492649264926492649264926492";function Eo(e){if(R(e,-32)!==nr)throw new Ao(e)}function $o(e){const{data:t,signature:n,to:r}=e;return O(Et(Gn("address, bytes, bytes"),[r,t,n]),nr)}function Io(e){try{return Eo(e),!0}catch{return!1}}class Ao extends A{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function ko({r:e,s:t,to:n="hex",v:r,yParity:s}){const a=(()=>{if(s===0||s===1)return s;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new wn.Signature(ae(e),ae(t)).toCompactHex()}${a===0?"1b":"1c"}`;return n==="hex"?i:dn(i)}async function Oe(e,t){const{address:n,chain:r=e.chain,hash:s,erc6492VerifierAddress:a=t.universalSignatureVerifierAddress??r?.contracts?.erc6492Verifier?.address,multicallAddress:i=t.multicallAddress??r?.contracts?.multicall3?.address}=t;if(r?.verifyHash)return await r.verifyHash(e,t);const o=(()=>{const c=t.signature;return Jt(c)?c:typeof c=="object"&&"r"in c&&"s"in c?ko(c):de(c)})();try{return so(o)?await So(e,{...t,multicallAddress:i,signature:o}):await Bo(e,{...t,verifierAddress:a,signature:o})}catch(c){try{if(st(an(n),await ns({hash:s,signature:o})))return!0}catch{}if(c instanceof Y)return!1;throw c}}async function So(e,t){const{address:n,blockNumber:r,blockTag:s,hash:a,multicallAddress:i}=t,{authorization:o,data:c,signature:u,to:f}=ro(t.signature);if(await He(e,{address:n,blockNumber:r,blockTag:s})===Z(["0xef0100",o.address]))return await To(e,{address:n,blockNumber:r,blockTag:s,hash:a,signature:u});const d={address:o.address,chainId:Number(o.chainId),nonce:Number(o.nonce),r:m(o.r,{size:32}),s:m(o.s,{size:32}),yParity:o.yParity};if(!await ba({address:n,authorization:d}))throw new Y;const y=await I(e,M,"readContract")({...i?{address:i}:{code:ss},authorizationList:[d],abi:rs,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:f??n,callData:c}]:[],{allowFailure:!0,target:n,callData:W({abi:hn,functionName:"isValidSignature",args:[a,u]})}]]});if(y[y.length-1]?.returnData?.startsWith("0x1626ba7e"))return!0;throw new Y}async function Bo(e,t){const{address:n,factory:r,factoryData:s,hash:a,signature:i,verifierAddress:o,...c}=t,u=await(async()=>!r&&!s||Io(i)?i:$o({data:s,signature:i,to:r}))(),f=o?{to:o,data:W({abi:Ct,functionName:"isValidSig",args:[n,a,u]}),...c}:{data:as({abi:Ct,args:[n,a,u],bytecode:is}),...c},{data:l}=await I(e,ot,"call")(f).catch(d=>{throw d instanceof os?new Y:d});if(cs(l??"0x0"))return!0;throw new Y}async function To(e,t){const{address:n,blockNumber:r,blockTag:s,hash:a,signature:i}=t;if((await I(e,M,"readContract")({address:n,abi:hn,args:[a,i],blockNumber:r,blockTag:s,functionName:"isValidSignature"}).catch(c=>{throw c instanceof us?new Y:c})).startsWith("0x1626ba7e"))return!0;throw new Y}class Y extends Error{}async function Ro(e,{address:t,message:n,factory:r,factoryData:s,signature:a,...i}){const o=vn(n);return I(e,Oe,"verifyHash")({address:t,factory:r,factoryData:s,hash:o,signature:a,...i})}async function No(e,t){const{address:n,factory:r,factoryData:s,signature:a,message:i,primaryType:o,types:c,domain:u,...f}=t,l=Rs({message:i,primaryType:o,types:c,domain:u});return I(e,Oe,"verifyHash")({address:n,factory:r,factoryData:s,hash:l,signature:a,...f})}function Co(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:s,onError:a,includeTransactions:i,poll:o,pollingInterval:c=e.pollingInterval}){const u=typeof o<"u"?o:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),f=i??!1;let l;return u?(()=>{const y=be(["watchBlocks",e.uid,t,n,r,f,c]);return ge(y,{onBlock:s,onError:a},g=>Ne(async()=>{try{const h=await I(e,fe,"getBlock")({blockTag:t,includeTransactions:f});if(h.number!==null&&l?.number!=null){if(h.number===l.number)return;if(h.number-l.number>1&&n)for(let w=l?.number+1n;w<h.number;w++){const v=await I(e,fe,"getBlock")({blockNumber:w,includeTransactions:f});g.onBlock(v,l),l=v}}(l?.number==null||t==="pending"&&h?.number==null||h.number!==null&&h.number>l.number)&&(g.onBlock(h,l),l=h)}catch(h){g.onError?.(h)}},{emitOnBegin:r,interval:c}))})():(()=>{let y=!0,g=!0,h=()=>y=!1;return(async()=>{try{r&&I(e,fe,"getBlock")({blockTag:t,includeTransactions:f}).then(b=>{y&&g&&(s(b,void 0),g=!1)}).catch(a);const w=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(P=>P.config.type==="webSocket"||P.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),{unsubscribe:v}=await w.subscribe({params:["newHeads"],async onData(b){if(!y)return;const P=await I(e,fe,"getBlock")({blockNumber:b.result?.number,includeTransactions:f}).catch(()=>{});y&&(s(P,l),g=!1,l=P)},onError(b){a?.(b)}});h=v,y||h()}catch(w){a?.(w)}})(),()=>h()})()}function zo(e,t){const{abi:n,address:r,args:s,batch:a=!0,eventName:i,fromBlock:o,onError:c,onLogs:u,poll:f,pollingInterval:l=e.pollingInterval,strict:d}=t;return(typeof f<"u"?f:typeof o=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const h=d??!1,w=be(["watchContractEvent",r,s,a,e.uid,i,l,h,o]);return ge(w,{onLogs:u,onError:c},v=>{let b;o!==void 0&&(b=o-1n);let P,k=!1;const $=Ne(async()=>{if(!k){try{P=await I(e,An,"createContractEventFilter")({abi:n,address:r,args:s,eventName:i,strict:h,fromBlock:o})}catch{}k=!0;return}try{let E;if(P)E=await I(e,ct,"getFilterChanges")({filter:P});else{const S=await I(e,Re,"getBlockNumber")({});b&&b<S?E=await I(e,Sn,"getContractEvents")({abi:n,address:r,args:s,eventName:i,fromBlock:b+1n,toBlock:S,strict:h}):E=[],b=S}if(E.length===0)return;if(a)v.onLogs(E);else for(const S of E)v.onLogs([S])}catch(E){P&&E instanceof mn&&(k=!1),v.onError?.(E)}},{emitOnBegin:!0,interval:l});return async()=>{P&&await I(e,ut,"uninstallFilter")({filter:P}),$()}})})():(()=>{const h=d??!1,w=be(["watchContractEvent",r,s,a,e.uid,i,l,h]);let v=!0,b=()=>v=!1;return ge(w,{onLogs:u,onError:c},P=>((async()=>{try{const k=(()=>{if(e.transport.type==="fallback"){const S=e.transport.transports.find(C=>C.config.type==="webSocket"||C.config.type==="ipc");return S?S.value:e.transport}return e.transport})(),$=i?xe({abi:n,eventName:i,args:s}):[],{unsubscribe:E}=await k.subscribe({params:["logs",{address:r,topics:$}],onData(S){if(!v)return;const C=S.result;try{const{eventName:B,args:q}=yn({abi:n,data:C.data,topics:C.topics,strict:d}),U=J(C,{args:q,eventName:B});P.onLogs([U])}catch(B){let q,U;if(B instanceof bn||B instanceof gn){if(d)return;q=B.abiItem.name,U=B.abiItem.inputs?.some(Ee=>!("name"in Ee&&Ee.name))}const _e=J(C,{args:U?[]:{},eventName:q});P.onLogs([_e])}},onError(S){P.onError?.(S)}});b=E,v||b()}catch(k){c?.(k)}})(),()=>b()))})()}function Fo(e,{address:t,args:n,batch:r=!0,event:s,events:a,fromBlock:i,onError:o,onLogs:c,poll:u,pollingInterval:f=e.pollingInterval,strict:l}){const d=typeof u<"u"?u:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),p=l??!1;return d?(()=>{const h=be(["watchEvent",t,n,r,e.uid,s,f,i]);return ge(h,{onLogs:c,onError:o},w=>{let v;i!==void 0&&(v=i-1n);let b,P=!1;const k=Ne(async()=>{if(!P){try{b=await I(e,kn,"createEventFilter")({address:t,args:n,event:s,events:a,strict:p,fromBlock:i})}catch{}P=!0;return}try{let $;if(b)$=await I(e,ct,"getFilterChanges")({filter:b});else{const E=await I(e,Re,"getBlockNumber")({});v&&v!==E?$=await I(e,mt,"getLogs")({address:t,args:n,event:s,events:a,fromBlock:v+1n,toBlock:E}):$=[],v=E}if($.length===0)return;if(r)w.onLogs($);else for(const E of $)w.onLogs([E])}catch($){b&&$ instanceof mn&&(P=!1),w.onError?.($)}},{emitOnBegin:!0,interval:f});return async()=>{b&&await I(e,ut,"uninstallFilter")({filter:b}),k()}})})():(()=>{let h=!0,w=()=>h=!1;return(async()=>{try{const v=(()=>{if(e.transport.type==="fallback"){const $=e.transport.transports.find(E=>E.config.type==="webSocket"||E.config.type==="ipc");return $?$.value:e.transport}return e.transport})(),b=a??(s?[s]:void 0);let P=[];b&&(P=[b.flatMap(E=>xe({abi:[E],eventName:E.name,args:n}))],s&&(P=P[0]));const{unsubscribe:k}=await v.subscribe({params:["logs",{address:t,topics:P}],onData($){if(!h)return;const E=$.result;try{const{eventName:S,args:C}=yn({abi:b??[],data:E.data,topics:E.topics,strict:p}),B=J(E,{args:C,eventName:S});c([B])}catch(S){let C,B;if(S instanceof bn||S instanceof gn){if(l)return;C=S.abiItem.name,B=S.abiItem.inputs?.some(U=>!("name"in U&&U.name))}const q=J(E,{args:B?[]:{},eventName:C});c([q])}},onError($){o?.($)}});w=k,h||w()}catch(v){o?.(v)}})(),()=>w()})()}const Oo="0x5792579257925792579257925792579257925792579257925792579257925792",_o=m(0,{size:32});async function Lo(e,t){async function n(f){if(f.endsWith(Oo.slice(2))){const d=re(zt(f,-64,-32)),p=zt(f,0,-64).slice(2).match(/.{1,64}/g),y=await Promise.all(p.map(h=>_o.slice(2)!==h?e.request({method:"eth_getTransactionReceipt",params:[`0x${h}`]},{dedupe:!0}):void 0)),g=y.some(h=>h===null)?100:y.every(h=>h?.status==="0x1")?200:y.every(h=>h?.status==="0x0")?500:600;return{atomic:!1,chainId:he(d),receipts:y.filter(Boolean),status:g,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[f]})}const{atomic:r=!1,chainId:s,receipts:a,version:i="2.0.0",...o}=await n(t.id),[c,u]=(()=>{const f=o.status;return f>=100&&f<200?["pending",f]:f>=200&&f<300?["success",f]:f>=300&&f<700?["failure",f]:f==="CONFIRMED"?["success",200]:f==="PENDING"?["pending",100]:[void 0,f]})();return{...o,atomic:r,chainId:s?he(s):void 0,receipts:a?.map(f=>({...f,blockNumber:ae(f.blockNumber),gasUsed:ae(f.gasUsed),status:fs[f.status]}))??[],statusCode:u,status:c,version:i}}class Mo extends _{constructor(t){super(`Call bundle failed with status: ${t.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=t}}async function mc(e,t){const{id:n,pollingInterval:r=e.pollingInterval,status:s=({statusCode:g})=>g===200||g>=300,retryCount:a=4,retryDelay:i=({count:g})=>~~(1<<g)*200,timeout:o=6e4,throwOnFailure:c=!1}=t,u=be(["waitForCallsStatus",e.uid,n]),{promise:f,resolve:l,reject:d}=ls();let p;const y=ge(u,{resolve:l,reject:d},g=>{const h=Ne(async()=>{const w=v=>{clearTimeout(p),h(),v(),y()};try{const v=await ds(async()=>{const b=await I(e,Lo,"getCallsStatus")({id:n});if(c&&b.status==="failure")throw new Mo(b);return b},{retryCount:a,delay:i});if(!s(v))return;w(()=>g.resolve(v))}catch(v){w(()=>g.reject(v))}},{interval:r,emitOnBegin:!0});return h});return p=o?setTimeout(()=>{y(),clearTimeout(p),d(new Uo({id:n}))},o):void 0,await f}class Uo extends _{constructor({id:t}){super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}async function jo(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){const s=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,m(r)]:[t]},{retryCount:0}),i=(e.chain?.formatters?.transactionReceipt?.format||ps)(s);if(i.status==="reverted"&&n)throw new hs({receipt:i});return i}function Do(e){const{scheme:t,statement:n,...r}=e.match(Vo)?.groups??{},{chainId:s,expirationTime:a,issuedAt:i,notBefore:o,requestId:c,...u}=e.match(Ho)?.groups??{},f=e.split("Resources:")[1]?.split(`
4
+ - `).slice(1);return{...r,...u,...s?{chainId:Number(s)}:{},...a?{expirationTime:new Date(a)}:{},...i?{issuedAt:new Date(i)}:{},...o?{notBefore:new Date(o)}:{},...c?{requestId:c}:{},...f?{resources:f}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const Vo=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,Ho=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function qo(e){const{address:t,domain:n,message:r,nonce:s,scheme:a,time:i=new Date}=e;if(n&&r.domain!==n||s&&r.nonce!==s||a&&r.scheme!==a||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||!Q(r.address,{strict:!1})||t&&!st(r.address,t))return!1}catch{return!1}return!0}async function Go(e,t){const{address:n,domain:r,message:s,nonce:a,scheme:i,signature:o,time:c=new Date,...u}=t,f=Do(s);if(!f.address||!qo({address:n,domain:r,message:f,nonce:a,scheme:i,time:c}))return!1;const d=vn(s);return Oe(e,{address:f.address,hash:d,signature:o,...u})}function Wo(e){return{call:t=>ot(e,t),createAccessList:t=>In(e,t),createBlockFilter:()=>Ks(e),createContractEventFilter:t=>An(e,t),createEventFilter:t=>kn(e,t),createPendingTransactionFilter:()=>Bs(e),estimateContractGas:t=>Qs(e,t),estimateGas:t=>rn(e,t),getBalance:t=>Ss(e,t),getBlobBaseFee:()=>Xs(e),getBlock:t=>fe(e,t),getBlockNumber:t=>Re(e,t),getBlockTransactionCount:t=>ea(e,t),getBytecode:t=>He(e,t),getChainId:()=>ks(e),getCode:t=>He(e,t),getContractEvents:t=>Sn(e,t),getEip712Domain:t=>na(e,t),getEnsAddress:t=>zs(e,t),getEnsAvatar:t=>Ws(e,t),getEnsName:t=>Zs(e,t),getEnsResolver:t=>Js(e,t),getEnsText:t=>$n(e,t),getFeeHistory:t=>aa(e,t),estimateFeesPerGas:t=>As(e,t),getFilterChanges:t=>ct(e,t),getFilterLogs:t=>ia(e,t),getGasPrice:()=>Is(e),getLogs:t=>mt(e,t),getProof:t=>co(e,t),estimateMaxPriorityFeePerGas:t=>$s(e,t),fillTransaction:t=>Es(e,t),getStorageAt:t=>uo(e,t),getTransaction:t=>pn(e,t),getTransactionConfirmations:t=>fo(e,t),getTransactionCount:t=>Ps(e,t),getTransactionReceipt:t=>xs(e,t),multicall:t=>vs(e,t),prepareTransactionRequest:t=>ws(e,t),readContract:t=>M(e,t),sendRawTransaction:t=>gs(e,t),sendRawTransactionSync:t=>jo(e,t),simulate:t=>Ye(e,t),simulateBlocks:t=>Ye(e,t),simulateCalls:t=>xo(e,t),simulateContract:t=>Po(e,t),verifyHash:t=>Oe(e,t),verifyMessage:t=>Ro(e,t),verifySiweMessage:t=>Go(e,t),verifyTypedData:t=>No(e,t),uninstallFilter:t=>ut(e,t),waitForTransactionReceipt:t=>bs(e,t),watchBlocks:t=>Co(e,t),watchBlockNumber:t=>ys(e,t),watchContractEvent:t=>zo(e,t),watchEvent:t=>Fo(e,t),watchPendingTransactions:t=>ms(e,t)}}function yc(e){const{key:t="public",name:n="Public Client"}=e;return Ts({...e,key:t,name:n,type:"publicClient"}).extend(Wo)}function bc(e){const{r:t,s:n}=wn.Signature.fromCompact(e.slice(2,130)),r=+`0x${e.slice(130)}`,[s,a]=(()=>{if(r===0||r===1)return[void 0,r];if(r===27)return[BigInt(r),0];if(r===28)return[BigInt(r),1];throw new Error("Invalid yParityOrV value")})();return typeof s<"u"?{r:m(t,{size:32}),s:m(n,{size:32}),v:s,yParity:a}:{r:m(t,{size:32}),s:m(n,{size:32}),yParity:a}}export{tc as A,Mo as B,Jn as C,It as D,ue as E,Ys as F,Gi as G,uc as H,Wi as I,K as J,Hi as K,lc as L,Zi as M,dc as N,nc as O,Kn as P,gt as Q,fc as R,Ze as S,cc as T,He as U,Oe as V,Uo as W,mc as X,Os as a,pt as b,yc as c,yt as d,ua as e,fa as f,ec as g,xe as h,Qo as i,wo as j,Wo as k,Cs as l,hc as m,Ve as n,ko as o,bc as p,Xo as q,Fi as r,Ce as s,oc as t,sc as u,ic as v,rc as w,Pe as x,Hn as y,L as z};
assets/pay-with-exchange-tKaAMbs9.js ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as A,cz as D,cA as z,cB as p,cC as $,cD as v,cE as c,dc as P,cT as y,dq as o,cM as f,da as E,cN as b,cO as _,dd as d,cV as S}from"./index-C-6muS97.js";import"./index-BnHyc7bS.js";const T=A`
2
+ button {
3
+ border: none;
4
+ border-radius: ${({borderRadius:t})=>t[20]};
5
+ display: flex;
6
+ flex-direction: row;
7
+ align-items: center;
8
+ padding: ${({spacing:t})=>t[1]};
9
+ transition:
10
+ background-color ${({durations:t})=>t.lg}
11
+ ${({easings:t})=>t["ease-out-power-2"]},
12
+ box-shadow ${({durations:t})=>t.lg}
13
+ ${({easings:t})=>t["ease-out-power-2"]};
14
+ will-change: background-color, box-shadow;
15
+ }
16
+
17
+ /* -- Variants --------------------------------------------------------------- */
18
+ button[data-type='accent'] {
19
+ background-color: ${({tokens:t})=>t.core.backgroundAccentPrimary};
20
+ color: ${({tokens:t})=>t.theme.textPrimary};
21
+ }
22
+
23
+ button[data-type='neutral'] {
24
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
25
+ color: ${({tokens:t})=>t.theme.textPrimary};
26
+ }
27
+
28
+ /* -- Sizes --------------------------------------------------------------- */
29
+ button[data-size='sm'] {
30
+ height: 24px;
31
+ }
32
+
33
+ button[data-size='md'] {
34
+ height: 28px;
35
+ }
36
+
37
+ button[data-size='lg'] {
38
+ height: 32px;
39
+ }
40
+
41
+ button[data-size='sm'] > wui-image,
42
+ button[data-size='sm'] > wui-icon {
43
+ width: 16px;
44
+ height: 16px;
45
+ }
46
+
47
+ button[data-size='md'] > wui-image,
48
+ button[data-size='md'] > wui-icon {
49
+ width: 20px;
50
+ height: 20px;
51
+ }
52
+
53
+ button[data-size='lg'] > wui-image,
54
+ button[data-size='lg'] > wui-icon {
55
+ width: 24px;
56
+ height: 24px;
57
+ }
58
+
59
+ wui-text {
60
+ padding-left: ${({spacing:t})=>t[1]};
61
+ padding-right: ${({spacing:t})=>t[1]};
62
+ }
63
+
64
+ wui-image {
65
+ border-radius: ${({borderRadius:t})=>t[3]};
66
+ overflow: hidden;
67
+ user-drag: none;
68
+ user-select: none;
69
+ -moz-user-select: none;
70
+ -webkit-user-drag: none;
71
+ -webkit-user-select: none;
72
+ -ms-user-select: none;
73
+ }
74
+
75
+ /* -- States --------------------------------------------------------------- */
76
+ @media (hover: hover) and (pointer: fine) {
77
+ button[data-type='accent']:not(:disabled):hover {
78
+ background-color: ${({tokens:t})=>t.core.foregroundAccent060};
79
+ }
80
+
81
+ button[data-type='neutral']:not(:disabled):hover {
82
+ background-color: ${({tokens:t})=>t.theme.foregroundTertiary};
83
+ }
84
+ }
85
+
86
+ button[data-type='accent']:not(:disabled):focus-visible,
87
+ button[data-type='accent']:not(:disabled):active {
88
+ box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020};
89
+ }
90
+
91
+ button[data-type='neutral']:not(:disabled):focus-visible,
92
+ button[data-type='neutral']:not(:disabled):active {
93
+ box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020};
94
+ }
95
+
96
+ button:disabled {
97
+ opacity: 0.5;
98
+ }
99
+ `;var g=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(i=(a<3?r(i):a>3?r(e,n,i):r(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};const L={sm:"sm-regular",md:"md-regular",lg:"lg-regular"};let h=class extends v{constructor(){super(...arguments),this.type="accent",this.size="md",this.imageSrc="",this.disabled=!1,this.leftIcon=void 0,this.rightIcon=void 0,this.text=""}render(){return c`
100
+ <button ?disabled=${this.disabled} data-type=${this.type} data-size=${this.size}>
101
+ ${this.imageSrc?c`<wui-image src=${this.imageSrc}></wui-image>`:null}
102
+ ${this.leftIcon?c`<wui-icon name=${this.leftIcon} color="inherit" size="inherit"></wui-icon>`:null}
103
+ <wui-text variant=${L[this.size]} color="inherit">${this.text}</wui-text>
104
+ ${this.rightIcon?c`<wui-icon name=${this.rightIcon} color="inherit" size="inherit"></wui-icon>`:null}
105
+ </button>
106
+ `}};h.styles=[D,z,T];g([p()],h.prototype,"type",void 0);g([p()],h.prototype,"size",void 0);g([p()],h.prototype,"imageSrc",void 0);g([p({type:Boolean})],h.prototype,"disabled",void 0);g([p()],h.prototype,"leftIcon",void 0);g([p()],h.prototype,"rightIcon",void 0);g([p()],h.prototype,"text",void 0);h=g([$("wui-chip-button")],h);var I=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(i=(a<3?r(i):a>3?r(e,n,i):r(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};let w=class extends v{constructor(){super(...arguments),this.maxDecimals=void 0,this.maxIntegers=void 0}render(){return c`
107
+ <wui-flex alignItems="center" gap="1">
108
+ <wui-input-amount
109
+ widthVariant="fit"
110
+ fontSize="h2"
111
+ .maxDecimals=${P(this.maxDecimals)}
112
+ .maxIntegers=${P(this.maxIntegers)}
113
+ .value=${this.amount?String(this.amount):""}
114
+ ></wui-input-amount>
115
+ <wui-text variant="md-regular" color="secondary">USD</wui-text>
116
+ </wui-flex>
117
+ `}};I([p({type:Number})],w.prototype,"amount",void 0);I([p({type:Number})],w.prototype,"maxDecimals",void 0);I([p({type:Number})],w.prototype,"maxIntegers",void 0);w=I([$("w3m-fund-input")],w);const R=A`
118
+ .amount-input-container {
119
+ border-radius: ${({borderRadius:t})=>t[6]};
120
+ border-top-right-radius: 0;
121
+ border-top-left-radius: 0;
122
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
123
+ padding: ${({spacing:t})=>t[1]};
124
+ }
125
+
126
+ .container {
127
+ border-radius: 30px;
128
+ }
129
+ `;var m=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(i=(a<3?r(i):a>3?r(e,n,i):r(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};const C=[10,50,100],j=6,N=10;let l=class extends v{constructor(){super(),this.unsubscribe=[],this.network=y.state.activeCaipNetwork,this.exchanges=o.state.exchanges,this.isLoading=o.state.isLoading,this.amount=o.state.amount,this.tokenAmount=o.state.tokenAmount,this.priceLoading=o.state.priceLoading,this.isPaymentInProgress=o.state.isPaymentInProgress,this.currentPayment=o.state.currentPayment,this.paymentId=o.state.paymentId,this.paymentAsset=o.state.paymentAsset,this.unsubscribe.push(y.subscribeKey("activeCaipNetwork",e=>{this.network=e,this.setDefaultPaymentAsset()}),o.subscribe(e=>{this.exchanges=e.exchanges,this.isLoading=e.isLoading,this.amount=e.amount,this.tokenAmount=e.tokenAmount,this.priceLoading=e.priceLoading,this.paymentId=e.paymentId,this.isPaymentInProgress=e.isPaymentInProgress,this.currentPayment=e.currentPayment,this.paymentAsset=e.paymentAsset,e.isPaymentInProgress&&e.currentPayment?.exchangeId&&e.currentPayment?.sessionId&&e.paymentId&&this.handlePaymentInProgress()}))}disconnectedCallback(){this.unsubscribe.forEach(n=>n()),o.state.isPaymentInProgress||o.reset()}async firstUpdated(){await this.getPaymentAssets(),this.paymentAsset||await this.setDefaultPaymentAsset(),o.setAmount(C[0]),await o.fetchExchanges()}render(){return c`
130
+ <wui-flex flexDirection="column" class="container">
131
+ ${this.amountInputTemplate()} ${this.exchangesTemplate()}
132
+ </wui-flex>
133
+ `}exchangesLoadingTemplate(){return Array.from({length:2}).map(()=>c`<wui-shimmer width="100%" height="65px" borderRadius="xxs"></wui-shimmer>`)}_exchangesTemplate(){return this.exchanges.length>0?this.exchanges.map(e=>c`<wui-list-item
134
+ @click=${()=>this.onExchangeClick(e)}
135
+ chevron
136
+ variant="image"
137
+ imageSrc=${e.imageUrl}
138
+ ?loading=${this.isLoading}
139
+ >
140
+ <wui-text variant="md-regular" color="primary">
141
+ Deposit from ${e.name}
142
+ </wui-text>
143
+ </wui-list-item>`):c`<wui-flex flexDirection="column" alignItems="center" gap="4" padding="4">
144
+ <wui-text variant="lg-medium" align="center" color="primary">
145
+ No exchanges support this asset on this network
146
+ </wui-text>
147
+ </wui-flex>`}exchangesTemplate(){return c`<wui-flex
148
+ flexDirection="column"
149
+ gap="2"
150
+ .padding=${["3","3","3","3"]}
151
+ class="exchanges-container"
152
+ >
153
+ ${this.isLoading?this.exchangesLoadingTemplate():this._exchangesTemplate()}
154
+ </wui-flex>`}amountInputTemplate(){return c`
155
+ <wui-flex
156
+ flexDirection="column"
157
+ .padding=${["0","3","3","3"]}
158
+ class="amount-input-container"
159
+ >
160
+ <wui-flex
161
+ justifyContent="space-between"
162
+ alignItems="center"
163
+ .margin=${["0","0","6","0"]}
164
+ >
165
+ <wui-text variant="md-medium" color="secondary">Asset</wui-text>
166
+ <wui-token-button
167
+ data-testid="deposit-from-exchange-asset-button"
168
+ flexDirection="row-reverse"
169
+ text=${this.paymentAsset?.metadata.symbol||""}
170
+ imageSrc=${this.paymentAsset?.metadata.iconUrl||""}
171
+ @click=${()=>f.push("PayWithExchangeSelectAsset")}
172
+ size="lg"
173
+ .chainImageSrc=${P(E.getNetworkImage(this.network))}
174
+ >
175
+ </wui-token-button>
176
+ </wui-flex>
177
+ <wui-flex
178
+ flexDirection="column"
179
+ alignItems="center"
180
+ justifyContent="center"
181
+ .margin=${["0","0","4","0"]}
182
+ >
183
+ <w3m-fund-input
184
+ @inputChange=${this.onAmountChange.bind(this)}
185
+ .amount=${this.amount}
186
+ .maxDecimals=${j}
187
+ .maxIntegers=${N}
188
+ >
189
+ </w3m-fund-input>
190
+ ${this.tokenAmountTemplate()}
191
+ </wui-flex>
192
+ <wui-flex justifyContent="center" gap="2">
193
+ ${C.map(e=>c`<wui-chip-button
194
+ @click=${()=>o.setAmount(e)}
195
+ type="neutral"
196
+ size="lg"
197
+ text=${`$${e}`}
198
+ ></wui-chip-button>`)}
199
+ </wui-flex>
200
+ </wui-flex>
201
+ `}tokenAmountTemplate(){return this.priceLoading?c`<wui-shimmer
202
+ width="65px"
203
+ height="20px"
204
+ borderRadius="xxs"
205
+ variant="light"
206
+ ></wui-shimmer>`:c`
207
+ <wui-text variant="md-regular" color="secondary">
208
+ ${this.tokenAmount.toFixed(4)} ${this.paymentAsset?.metadata.symbol}
209
+ </wui-text>
210
+ `}async onExchangeClick(e){if(!this.amount){b.showError("Please enter an amount");return}await o.handlePayWithExchange(e.id)}handlePaymentInProgress(){const e=y.state.activeChain,{redirectView:n="Account"}=f.state.data??{};this.isPaymentInProgress&&this.currentPayment?.exchangeId&&this.currentPayment?.sessionId&&this.paymentId&&(o.waitUntilComplete({exchangeId:this.currentPayment.exchangeId,sessionId:this.currentPayment.sessionId,paymentId:this.paymentId}).then(s=>{s.status==="SUCCESS"?(b.showSuccess("Deposit completed"),o.reset(),e&&(y.fetchTokenBalance(),_.updateBalance(e)),f.replace("Transactions")):s.status==="FAILED"&&b.showError("Deposit failed")}),b.showLoading("Deposit in progress..."),f.replace(n))}onAmountChange({detail:e}){o.setAmount(e?Number(e):null)}async getPaymentAssets(){this.network&&await o.getAssetsForNetwork(this.network.caipNetworkId)}async setDefaultPaymentAsset(){if(this.network){const e=await o.getAssetsForNetwork(this.network.caipNetworkId);e[0]&&o.setPaymentAsset(e[0])}}};l.styles=R;m([d()],l.prototype,"network",void 0);m([d()],l.prototype,"exchanges",void 0);m([d()],l.prototype,"isLoading",void 0);m([d()],l.prototype,"amount",void 0);m([d()],l.prototype,"tokenAmount",void 0);m([d()],l.prototype,"priceLoading",void 0);m([d()],l.prototype,"isPaymentInProgress",void 0);m([d()],l.prototype,"currentPayment",void 0);m([d()],l.prototype,"paymentId",void 0);m([d()],l.prototype,"paymentAsset",void 0);l=m([$("w3m-deposit-from-exchange-view")],l);const O=A`
211
+ .contentContainer {
212
+ height: 440px;
213
+ overflow: scroll;
214
+ scrollbar-width: none;
215
+ }
216
+
217
+ .contentContainer::-webkit-scrollbar {
218
+ display: none;
219
+ }
220
+
221
+ wui-icon-box {
222
+ width: 40px;
223
+ height: 40px;
224
+ border-radius: ${({borderRadius:t})=>t[3]};
225
+ }
226
+ `;var k=function(t,e,n,s){var a=arguments.length,i=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,s);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(i=(a<3?r(i):a>3?r(e,n,i):r(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i};let x=class extends v{constructor(){super(),this.unsubscribe=[],this.assets=o.state.assets,this.search="",this.onDebouncedSearch=S.debounce(e=>{this.search=e}),this.unsubscribe.push(o.subscribe(e=>{this.assets=e.assets}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return c`
227
+ <wui-flex flexDirection="column">
228
+ ${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
229
+ </wui-flex>
230
+ `}templateSearchInput(){return c`
231
+ <wui-flex gap="2" padding="3">
232
+ <wui-input-text
233
+ @inputChange=${this.onInputChange.bind(this)}
234
+ class="network-search-input"
235
+ size="sm"
236
+ placeholder="Search token"
237
+ icon="search"
238
+ ></wui-input-text>
239
+ </wui-flex>
240
+ `}templateTokens(){const e=this.assets.filter(s=>s.metadata.name.toLowerCase().includes(this.search.toLowerCase())),n=e.length>0;return c`
241
+ <wui-flex
242
+ class="contentContainer"
243
+ flexDirection="column"
244
+ .padding=${["0","3","0","3"]}
245
+ >
246
+ <wui-flex justifyContent="flex-start" .padding=${["4","3","3","3"]}>
247
+ <wui-text variant="md-medium" color="secondary">Available tokens</wui-text>
248
+ </wui-flex>
249
+ <wui-flex flexDirection="column" gap="2">
250
+ ${n?e.map(s=>c`<wui-list-item
251
+ .imageSrc=${s.metadata.iconUrl}
252
+ ?clickable=${!0}
253
+ @click=${this.handleTokenClick.bind(this,s)}
254
+ >
255
+ <wui-text variant="md-medium" color="primary">${s.metadata.name}</wui-text>
256
+ <wui-text variant="md-regular" color="secondary"
257
+ >${s.metadata.symbol}</wui-text
258
+ >
259
+ </wui-list-item>`):c`<wui-flex
260
+ .padding=${["20","0","0","0"]}
261
+ alignItems="center"
262
+ flexDirection="column"
263
+ gap="4"
264
+ >
265
+ <wui-icon-box icon="coinPlaceholder" color="default" size="lg"></wui-icon-box>
266
+ <wui-flex
267
+ class="textContent"
268
+ gap="2"
269
+ flexDirection="column"
270
+ justifyContent="center"
271
+ >
272
+ <wui-text variant="lg-medium" align="center" color="primary">
273
+ No tokens found
274
+ </wui-text>
275
+ </wui-flex>
276
+ <wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
277
+ </wui-flex>`}
278
+ </wui-flex>
279
+ </wui-flex>
280
+ `}onBuyClick(){f.push("OnRampProviders")}onInputChange(e){this.onDebouncedSearch(e.detail)}handleTokenClick(e){o.setPaymentAsset(e),f.goBack()}};x.styles=O;k([d()],x.prototype,"assets",void 0);k([d()],x.prototype,"search",void 0);x=k([$("w3m-deposit-from-exchange-select-asset-view")],x);export{x as W3mDepositFromExchangeSelectAssetView,l as W3mDepositFromExchangeView};
assets/receive-CaBNeahz.js ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as g,cz as v,cA as $,cB as k,cC as y,cD as x,cE as l,cT as c,cN as p,da as m,db as h,cI as C,dc as N,cR as R,cS as A,cM as S,cV as I,dd as f}from"./index-C-6muS97.js";const T=g`
2
+ button {
3
+ width: 100%;
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: space-between;
7
+ gap: ${({spacing:e})=>e[4]};
8
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
9
+ border-radius: ${({borderRadius:e})=>e[3]};
10
+ border: none;
11
+ padding: ${({spacing:e})=>e[3]};
12
+ transition: background-color ${({durations:e})=>e.lg}
13
+ ${({easings:e})=>e["ease-out-power-2"]};
14
+ will-change: background-color;
15
+ }
16
+
17
+ /* -- Hover & Active states ----------------------------------------------------------- */
18
+ button:hover:enabled,
19
+ button:active:enabled {
20
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
21
+ }
22
+
23
+ wui-text {
24
+ flex: 1;
25
+ color: ${({tokens:e})=>e.theme.textSecondary};
26
+ }
27
+
28
+ wui-flex {
29
+ width: auto;
30
+ display: flex;
31
+ align-items: center;
32
+ gap: ${({spacing:e})=>e["01"]};
33
+ }
34
+
35
+ wui-icon {
36
+ color: ${({tokens:e})=>e.theme.iconDefault};
37
+ }
38
+
39
+ .network-icon {
40
+ position: relative;
41
+ width: 20px;
42
+ height: 20px;
43
+ border-radius: ${({borderRadius:e})=>e[4]};
44
+ overflow: hidden;
45
+ margin-left: -8px;
46
+ }
47
+
48
+ .network-icon:first-child {
49
+ margin-left: 0px;
50
+ }
51
+
52
+ .network-icon:after {
53
+ position: absolute;
54
+ inset: 0;
55
+ content: '';
56
+ display: block;
57
+ height: 100%;
58
+ width: 100%;
59
+ border-radius: ${({borderRadius:e})=>e[4]};
60
+ box-shadow: inset 0 0 0 1px ${({tokens:e})=>e.core.glass010};
61
+ }
62
+ `;var b=function(e,t,o,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(i=(s<3?n(i):s>3?n(t,o,i):n(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};let d=class extends x{constructor(){super(...arguments),this.networkImages=[""],this.text=""}render(){return l`
63
+ <button>
64
+ <wui-text variant="md-regular" color="inherit">${this.text}</wui-text>
65
+ <wui-flex>
66
+ ${this.networksTemplate()}
67
+ <wui-icon name="chevronRight" size="sm" color="inherit"></wui-icon>
68
+ </wui-flex>
69
+ </button>
70
+ `}networksTemplate(){const t=this.networkImages.slice(0,5);return l` <wui-flex class="networks">
71
+ ${t?.map(o=>l` <wui-flex class="network-icon"> <wui-image src=${o}></wui-image> </wui-flex>`)}
72
+ </wui-flex>`}};d.styles=[v,$,T];b([k({type:Array})],d.prototype,"networkImages",void 0);b([k()],d.prototype,"text",void 0);d=b([y("wui-compatible-network")],d);const E=g`
73
+ wui-compatible-network {
74
+ margin-top: ${({spacing:e})=>e[4]};
75
+ width: 100%;
76
+ }
77
+
78
+ wui-qr-code {
79
+ width: unset !important;
80
+ height: unset !important;
81
+ }
82
+
83
+ wui-icon {
84
+ align-items: normal;
85
+ }
86
+ `;var w=function(e,t,o,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(i=(s<3?n(i):s>3?n(t,o,i):n(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};let u=class extends x{constructor(){super(),this.unsubscribe=[],this.address=c.getAccountData()?.address,this.profileName=c.getAccountData()?.profileName,this.network=c.state.activeCaipNetwork,this.unsubscribe.push(c.subscribeChainProp("accountState",t=>{t?(this.address=t.address,this.profileName=t.profileName):p.showError("Account not found")}),c.subscribeKey("activeCaipNetwork",t=>{t?.id&&(this.network=t)}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){if(!this.address)throw new Error("w3m-wallet-receive-view: No account provided");const t=m.getNetworkImage(this.network);return l` <wui-flex
87
+ flexDirection="column"
88
+ .padding=${["0","4","4","4"]}
89
+ alignItems="center"
90
+ >
91
+ <wui-chip-button
92
+ data-testid="receive-address-copy-button"
93
+ @click=${this.onCopyClick.bind(this)}
94
+ text=${C.getTruncateString({string:this.profileName||this.address||"",charsStart:this.profileName?18:4,charsEnd:this.profileName?0:4,truncate:this.profileName?"end":"middle"})}
95
+ icon="copy"
96
+ size="sm"
97
+ imageSrc=${t||""}
98
+ variant="gray"
99
+ ></wui-chip-button>
100
+ <wui-flex
101
+ flexDirection="column"
102
+ .padding=${["4","0","0","0"]}
103
+ alignItems="center"
104
+ gap="4"
105
+ >
106
+ <wui-qr-code
107
+ size=${232}
108
+ theme=${h.state.themeMode}
109
+ uri=${this.address}
110
+ ?arenaClear=${!0}
111
+ color=${N(h.state.themeVariables["--apkt-qr-color"]??h.state.themeVariables["--w3m-qr-color"])}
112
+ data-testid="wui-qr-code"
113
+ ></wui-qr-code>
114
+ <wui-text variant="lg-regular" color="primary" align="center">
115
+ Copy your address or scan this QR code
116
+ </wui-text>
117
+ <wui-button @click=${this.onCopyClick.bind(this)} size="sm" variant="neutral-secondary">
118
+ <wui-icon slot="iconLeft" size="sm" color="inherit" name="copy"></wui-icon>
119
+ <wui-text variant="md-regular" color="inherit">Copy address</wui-text>
120
+ </wui-button>
121
+ </wui-flex>
122
+ ${this.networkTemplate()}
123
+ </wui-flex>`}networkTemplate(){const t=c.getAllRequestedCaipNetworks(),o=c.checkIfSmartAccountEnabled(),r=c.state.activeCaipNetwork,s=t.filter(a=>a?.chainNamespace===r?.chainNamespace);if(R(r?.chainNamespace)===A.ACCOUNT_TYPES.SMART_ACCOUNT&&o)return r?l`<wui-compatible-network
124
+ @click=${this.onReceiveClick.bind(this)}
125
+ text="Only receive assets on this network"
126
+ .networkImages=${[m.getNetworkImage(r)??""]}
127
+ ></wui-compatible-network>`:null;const n=(s?.filter(a=>a?.assets?.imageId)?.slice(0,5)).map(m.getNetworkImage).filter(Boolean);return l`<wui-compatible-network
128
+ @click=${this.onReceiveClick.bind(this)}
129
+ text="Only receive assets on these networks"
130
+ .networkImages=${n}
131
+ ></wui-compatible-network>`}onReceiveClick(){S.push("WalletCompatibleNetworks")}onCopyClick(){try{this.address&&(I.copyToClopboard(this.address),p.showSuccess("Address copied"))}catch{p.showError("Failed to copy")}}};u.styles=E;w([f()],u.prototype,"address",void 0);w([f()],u.prototype,"profileName",void 0);w([f()],u.prototype,"network",void 0);u=w([y("w3m-wallet-receive-view")],u);export{u as W3mWalletReceiveView};
assets/secp256k1-BP3xnA4u.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{dk as ce,dl as ae,dm as le,dn as ue,dp as de}from"./index-C-6muS97.js";const zt=BigInt(0),It=BigInt(1);function lt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Tt(e){if(!lt(e))throw new Error("Uint8Array expected")}function ct(e,n){if(typeof n!="boolean")throw new Error(e+" boolean expected, got "+n)}function dt(e){const n=e.toString(16);return n.length&1?"0"+n:n}function $t(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?zt:BigInt("0x"+e)}const Wt=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",he=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function at(e){if(Tt(e),Wt)return e.toHex();let n="";for(let t=0;t<e.length;t++)n+=he[e[t]];return n}const D={_0:48,_9:57,A:65,F:70,a:97,f:102};function kt(e){if(e>=D._0&&e<=D._9)return e-D._0;if(e>=D.A&&e<=D.F)return e-(D.A-10);if(e>=D.a&&e<=D.f)return e-(D.a-10)}function ht(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Wt)return Uint8Array.fromHex(e);const n=e.length,t=n/2;if(n%2)throw new Error("hex string expected, got unpadded hex of length "+n);const r=new Uint8Array(t);for(let i=0,s=0;i<t;i++,s+=2){const a=kt(e.charCodeAt(s)),u=kt(e.charCodeAt(s+1));if(a===void 0||u===void 0){const o=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+o+'" at index '+s)}r[i]=a*16+u}return r}function et(e){return $t(at(e))}function Dt(e){return Tt(e),$t(at(Uint8Array.from(e).reverse()))}function ut(e,n){return ht(e.toString(16).padStart(n*2,"0"))}function Gt(e,n){return ut(e,n).reverse()}function K(e,n,t){let r;if(typeof n=="string")try{r=ht(n)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(lt(n))r=Uint8Array.from(n);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof t=="number"&&i!==t)throw new Error(e+" of length "+t+" expected, got "+i);return r}function wt(...e){let n=0;for(let r=0;r<e.length;r++){const i=e[r];Tt(i),n+=i.length}const t=new Uint8Array(n);for(let r=0,i=0;r<e.length;r++){const s=e[r];t.set(s,i),i+=s.length}return t}const Et=e=>typeof e=="bigint"&&zt<=e;function Ut(e,n,t){return Et(e)&&Et(n)&&Et(t)&&n<=e&&e<t}function it(e,n,t,r){if(!Ut(n,t,r))throw new Error("expected valid "+e+": "+t+" <= n < "+r+", got "+n)}function we(e){let n;for(n=0;e>zt;e>>=It,n+=1);return n}const gt=e=>(It<<BigInt(e))-It,bt=e=>new Uint8Array(e),Ct=e=>Uint8Array.from(e);function ge(e,n,t){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof n!="number"||n<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=bt(e),i=bt(e),s=0;const a=()=>{r.fill(1),i.fill(0),s=0},u=(...A)=>t(i,r,...A),o=(A=bt(0))=>{i=u(Ct([0]),A),r=u(),A.length!==0&&(i=u(Ct([1]),A),r=u())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let A=0;const I=[];for(;A<n;){r=u();const z=r.slice();I.push(z),A+=r.length}return wt(...I)};return(A,I)=>{a(),o(A);let z;for(;!(z=I(d()));)o();return a(),z}}const me={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||lt(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,n)=>n.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function mt(e,n,t={}){const r=(i,s,a)=>{const u=me[s];if(typeof u!="function")throw new Error("invalid validator function");const o=e[i];if(!(a&&o===void 0)&&!u(o,e))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+o)};for(const[i,s]of Object.entries(n))r(i,s,!1);for(const[i,s]of Object.entries(t))r(i,s,!0);return e}function Vt(e){const n=new WeakMap;return(t,...r)=>{const i=n.get(t);if(i!==void 0)return i;const s=e(t,...r);return n.set(t,s),s}}const Y=BigInt(0),V=BigInt(1),tt=BigInt(2),pe=BigInt(3),Xt=BigInt(4),Ft=BigInt(5),Qt=BigInt(8);function M(e,n){const t=e%n;return t>=Y?t:n+t}function j(e,n,t){let r=e;for(;n-- >Y;)r*=r,r%=t;return r}function Ot(e,n){if(e===Y)throw new Error("invert: expected non-zero number");if(n<=Y)throw new Error("invert: expected positive modulus, got "+n);let t=M(e,n),r=n,i=Y,s=V;for(;t!==Y;){const u=r/t,o=r%t,d=i-s*u;r=t,t=o,i=s,s=d}if(r!==V)throw new Error("invert: does not exist");return M(i,n)}function Jt(e,n){const t=(e.ORDER+V)/Xt,r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}function ye(e,n){const t=(e.ORDER-Ft)/Qt,r=e.mul(n,tt),i=e.pow(r,t),s=e.mul(n,i),a=e.mul(e.mul(s,tt),i),u=e.mul(s,e.sub(a,e.ONE));if(!e.eql(e.sqr(u),n))throw new Error("Cannot find square root");return u}function Ee(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let n=e-V,t=0;for(;n%tt===Y;)n/=tt,t++;let r=tt;const i=Lt(e);for(;Ht(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return Jt;let s=i.pow(r,n);const a=(n+V)/tt;return function(o,d){if(o.is0(d))return d;if(Ht(o,d)!==1)throw new Error("Cannot find square root");let m=t,A=o.mul(o.ONE,s),I=o.pow(d,n),z=o.pow(d,a);for(;!o.eql(I,o.ONE);){if(o.is0(I))return o.ZERO;let T=1,g=o.sqr(I);for(;!o.eql(g,o.ONE);)if(T++,g=o.sqr(g),T===m)throw new Error("Cannot find square root");const k=V<<BigInt(m-T-1),U=o.pow(A,k);m=T,A=o.sqr(U),I=o.mul(I,A),z=o.mul(z,U)}return z}}function be(e){return e%Xt===pe?Jt:e%Qt===Ft?ye:Ee(e)}const Be=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ve(e){const n={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=Be.reduce((r,i)=>(r[i]="function",r),n);return mt(e,t)}function xe(e,n,t){if(t<Y)throw new Error("invalid exponent, negatives unsupported");if(t===Y)return e.ONE;if(t===V)return n;let r=e.ONE,i=n;for(;t>Y;)t&V&&(r=e.mul(r,i)),i=e.sqr(i),t>>=V;return r}function te(e,n,t=!1){const r=new Array(n.length).fill(t?e.ZERO:void 0),i=n.reduce((a,u,o)=>e.is0(u)?a:(r[o]=a,e.mul(a,u)),e.ONE),s=e.inv(i);return n.reduceRight((a,u,o)=>e.is0(u)?a:(r[o]=e.mul(a,r[o]),e.mul(a,u)),s),r}function Ht(e,n){const t=(e.ORDER-V)/tt,r=e.pow(n,t),i=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),a=e.eql(r,e.neg(e.ONE));if(!i&&!s&&!a)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function ee(e,n){n!==void 0&&ce(n);const t=n!==void 0?n:e.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function Lt(e,n,t=!1,r={}){if(e<=Y)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:s}=ee(e,n);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let a;const u=Object.freeze({ORDER:e,isLE:t,BITS:i,BYTES:s,MASK:gt(i),ZERO:Y,ONE:V,create:o=>M(o,e),isValid:o=>{if(typeof o!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof o);return Y<=o&&o<e},is0:o=>o===Y,isOdd:o=>(o&V)===V,neg:o=>M(-o,e),eql:(o,d)=>o===d,sqr:o=>M(o*o,e),add:(o,d)=>M(o+d,e),sub:(o,d)=>M(o-d,e),mul:(o,d)=>M(o*d,e),pow:(o,d)=>xe(u,o,d),div:(o,d)=>M(o*Ot(d,e),e),sqrN:o=>o*o,addN:(o,d)=>o+d,subN:(o,d)=>o-d,mulN:(o,d)=>o*d,inv:o=>Ot(o,e),sqrt:r.sqrt||(o=>(a||(a=be(e)),a(u,o))),toBytes:o=>t?Gt(o,s):ut(o,s),fromBytes:o=>{if(o.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+o.length);return t?Dt(o):et(o)},invertBatch:o=>te(u,o),cmov:(o,d,m)=>m?d:o});return Object.freeze(u)}function ne(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const n=e.toString(2).length;return Math.ceil(n/8)}function re(e){const n=ne(e);return n+Math.ceil(n/2)}function Se(e,n,t=!1){const r=e.length,i=ne(n),s=re(n);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const a=t?Dt(e):et(e),u=M(a,n-V)+V;return t?Gt(u,i):ut(u,i)}const Mt=BigInt(0),qt=BigInt(1);function Bt(e,n){const t=n.negate();return e?t:n}function oe(e,n){if(!Number.isSafeInteger(e)||e<=0||e>n)throw new Error("invalid window size, expected [1.."+n+"], got W="+e)}function vt(e,n){oe(e,n);const t=Math.ceil(n/e)+1,r=2**(e-1),i=2**e,s=gt(e),a=BigInt(e);return{windows:t,windowSize:r,mask:s,maxNumber:i,shiftBy:a}}function Yt(e,n,t){const{windowSize:r,mask:i,maxNumber:s,shiftBy:a}=t;let u=Number(e&i),o=e>>a;u>r&&(u-=s,o+=qt);const d=n*r,m=d+Math.abs(u)-1,A=u===0,I=u<0,z=n%2!==0;return{nextN:o,offset:m,isZero:A,isNeg:I,isNegF:z,offsetF:d}}function Ae(e,n){if(!Array.isArray(e))throw new Error("array expected");e.forEach((t,r)=>{if(!(t instanceof n))throw new Error("invalid point at index "+r)})}function Ne(e,n){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((t,r)=>{if(!n.isValid(t))throw new Error("invalid scalar at index "+r)})}const xt=new WeakMap,ie=new WeakMap;function St(e){return ie.get(e)||1}function Ie(e,n){return{constTimeNegate:Bt,hasPrecomputes(t){return St(t)!==1},unsafeLadder(t,r,i=e.ZERO){let s=t;for(;r>Mt;)r&qt&&(i=i.add(s)),s=s.double(),r>>=qt;return i},precomputeWindow(t,r){const{windows:i,windowSize:s}=vt(r,n),a=[];let u=t,o=u;for(let d=0;d<i;d++){o=u,a.push(o);for(let m=1;m<s;m++)o=o.add(u),a.push(o);u=o.double()}return a},wNAF(t,r,i){let s=e.ZERO,a=e.BASE;const u=vt(t,n);for(let o=0;o<u.windows;o++){const{nextN:d,offset:m,isZero:A,isNeg:I,isNegF:z,offsetF:T}=Yt(i,o,u);i=d,A?a=a.add(Bt(z,r[T])):s=s.add(Bt(I,r[m]))}return{p:s,f:a}},wNAFUnsafe(t,r,i,s=e.ZERO){const a=vt(t,n);for(let u=0;u<a.windows&&i!==Mt;u++){const{nextN:o,offset:d,isZero:m,isNeg:A}=Yt(i,u,a);if(i=o,!m){const I=r[d];s=s.add(A?I.negate():I)}}return s},getPrecomputes(t,r,i){let s=xt.get(r);return s||(s=this.precomputeWindow(r,t),t!==1&&xt.set(r,i(s))),s},wNAFCached(t,r,i){const s=St(t);return this.wNAF(s,this.getPrecomputes(s,t,i),r)},wNAFCachedUnsafe(t,r,i,s){const a=St(t);return a===1?this.unsafeLadder(t,r,s):this.wNAFUnsafe(a,this.getPrecomputes(a,t,i),r,s)},setWindowSize(t,r){oe(r,n),ie.set(t,r),xt.delete(t)}}}function Oe(e,n,t,r){Ae(t,e),Ne(r,n);const i=t.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const a=e.ZERO,u=we(BigInt(i));let o=1;u>12?o=u-3:u>4?o=u-2:u>0&&(o=2);const d=gt(o),m=new Array(Number(d)+1).fill(a),A=Math.floor((n.BITS-1)/o)*o;let I=a;for(let z=A;z>=0;z-=o){m.fill(a);for(let g=0;g<s;g++){const k=r[g],U=Number(k>>BigInt(z)&d);m[U]=m[U].add(t[g])}let T=a;for(let g=m.length-1,k=a;g>0;g--)k=k.add(m[g]),T=T.add(k);if(I=I.add(T),z!==0)for(let g=0;g<o;g++)I=I.double()}return I}function se(e){return ve(e.Fp),mt(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ee(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function jt(e){e.lowS!==void 0&&ct("lowS",e.lowS),e.prehash!==void 0&&ct("prehash",e.prehash)}function qe(e){const n=se(e);mt(n,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:t,Fp:r,a:i}=n;if(t){if(!r.eql(i,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...n})}class Re extends Error{constructor(n=""){super(n)}}const G={Err:Re,_tlv:{encode:(e,n)=>{const{Err:t}=G;if(e<0||e>256)throw new t("tlv.encode: wrong tag");if(n.length&1)throw new t("tlv.encode: unpadded data");const r=n.length/2,i=dt(r);if(i.length/2&128)throw new t("tlv.encode: long form length too big");const s=r>127?dt(i.length/2|128):"";return dt(e)+s+i+n},decode(e,n){const{Err:t}=G;let r=0;if(e<0||e>256)throw new t("tlv.encode: wrong tag");if(n.length<2||n[r++]!==e)throw new t("tlv.decode: wrong tlv");const i=n[r++],s=!!(i&128);let a=0;if(!s)a=i;else{const o=i&127;if(!o)throw new t("tlv.decode(long): indefinite length not supported");if(o>4)throw new t("tlv.decode(long): byte length is too big");const d=n.subarray(r,r+o);if(d.length!==o)throw new t("tlv.decode: length bytes not complete");if(d[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const m of d)a=a<<8|m;if(r+=o,a<128)throw new t("tlv.decode(long): not minimal encoding")}const u=n.subarray(r,r+a);if(u.length!==a)throw new t("tlv.decode: wrong value length");return{v:u,l:n.subarray(r+a)}}},_int:{encode(e){const{Err:n}=G;if(e<X)throw new n("integer: negative integers are not allowed");let t=dt(e);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new n("unexpected DER parsing assertion: unpadded hex");return t},decode(e){const{Err:n}=G;if(e[0]&128)throw new n("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new n("invalid signature integer: unnecessary leading zero");return et(e)}},toSig(e){const{Err:n,_int:t,_tlv:r}=G,i=K("signature",e),{v:s,l:a}=r.decode(48,i);if(a.length)throw new n("invalid signature: left bytes after parsing");const{v:u,l:o}=r.decode(2,s),{v:d,l:m}=r.decode(2,o);if(m.length)throw new n("invalid signature: left bytes after parsing");return{r:t.decode(u),s:t.decode(d)}},hexFromSig(e){const{_tlv:n,_int:t}=G,r=n.encode(2,t.encode(e.r)),i=n.encode(2,t.encode(e.s)),s=r+i;return n.encode(48,s)}};function At(e,n){return at(ut(e,n))}const X=BigInt(0),L=BigInt(1);BigInt(2);const Nt=BigInt(3),Ze=BigInt(4);function ze(e){const n=qe(e),{Fp:t}=n,r=Lt(n.n,n.nBitLength),i=n.toBytes||((x,f,h)=>{const p=f.toAffine();return wt(Uint8Array.from([4]),t.toBytes(p.x),t.toBytes(p.y))}),s=n.fromBytes||(x=>{const f=x.subarray(1),h=t.fromBytes(f.subarray(0,t.BYTES)),p=t.fromBytes(f.subarray(t.BYTES,2*t.BYTES));return{x:h,y:p}});function a(x){const{a:f,b:h}=n,p=t.sqr(x),B=t.mul(p,x);return t.add(t.add(B,t.mul(x,f)),h)}function u(x,f){const h=t.sqr(f),p=a(x);return t.eql(h,p)}if(!u(n.Gx,n.Gy))throw new Error("bad curve params: generator point");const o=t.mul(t.pow(n.a,Nt),Ze),d=t.mul(t.sqr(n.b),BigInt(27));if(t.is0(t.add(o,d)))throw new Error("bad curve params: a or b");function m(x){return Ut(x,L,n.n)}function A(x){const{allowedPrivateKeyLengths:f,nByteLength:h,wrapPrivateKey:p,n:B}=n;if(f&&typeof x!="bigint"){if(lt(x)&&(x=at(x)),typeof x!="string"||!f.includes(x.length))throw new Error("invalid private key");x=x.padStart(h*2,"0")}let O;try{O=typeof x=="bigint"?x:et(K("private key",x,h))}catch{throw new Error("invalid private key, expected hex or "+h+" bytes, got "+typeof x)}return p&&(O=M(O,B)),it("private key",O,L,B),O}function I(x){if(!(x instanceof g))throw new Error("ProjectivePoint expected")}const z=Vt((x,f)=>{const{px:h,py:p,pz:B}=x;if(t.eql(B,t.ONE))return{x:h,y:p};const O=x.is0();f==null&&(f=O?t.ONE:t.inv(B));const R=t.mul(h,f),q=t.mul(p,f),y=t.mul(B,f);if(O)return{x:t.ZERO,y:t.ZERO};if(!t.eql(y,t.ONE))throw new Error("invZ was invalid");return{x:R,y:q}}),T=Vt(x=>{if(x.is0()){if(n.allowInfinityPoint&&!t.is0(x.py))return;throw new Error("bad point: ZERO")}const{x:f,y:h}=x.toAffine();if(!t.isValid(f)||!t.isValid(h))throw new Error("bad point: x or y not FE");if(!u(f,h))throw new Error("bad point: equation left != right");if(!x.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class g{constructor(f,h,p){if(f==null||!t.isValid(f))throw new Error("x required");if(h==null||!t.isValid(h)||t.is0(h))throw new Error("y required");if(p==null||!t.isValid(p))throw new Error("z required");this.px=f,this.py=h,this.pz=p,Object.freeze(this)}static fromAffine(f){const{x:h,y:p}=f||{};if(!f||!t.isValid(h)||!t.isValid(p))throw new Error("invalid affine point");if(f instanceof g)throw new Error("projective point not allowed");const B=O=>t.eql(O,t.ZERO);return B(h)&&B(p)?g.ZERO:new g(h,p,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(f){const h=te(t,f.map(p=>p.pz));return f.map((p,B)=>p.toAffine(h[B])).map(g.fromAffine)}static fromHex(f){const h=g.fromAffine(s(K("pointHex",f)));return h.assertValidity(),h}static fromPrivateKey(f){return g.BASE.multiply(A(f))}static msm(f,h){return Oe(g,r,f,h)}_setWindowSize(f){$.setWindowSize(this,f)}assertValidity(){T(this)}hasEvenY(){const{y:f}=this.toAffine();if(t.isOdd)return!t.isOdd(f);throw new Error("Field doesn't support isOdd")}equals(f){I(f);const{px:h,py:p,pz:B}=this,{px:O,py:R,pz:q}=f,y=t.eql(t.mul(h,q),t.mul(O,B)),N=t.eql(t.mul(p,q),t.mul(R,B));return y&&N}negate(){return new g(this.px,t.neg(this.py),this.pz)}double(){const{a:f,b:h}=n,p=t.mul(h,Nt),{px:B,py:O,pz:R}=this;let q=t.ZERO,y=t.ZERO,N=t.ZERO,E=t.mul(B,B),_=t.mul(O,O),l=t.mul(R,R),c=t.mul(B,O);return c=t.add(c,c),N=t.mul(B,R),N=t.add(N,N),q=t.mul(f,N),y=t.mul(p,l),y=t.add(q,y),q=t.sub(_,y),y=t.add(_,y),y=t.mul(q,y),q=t.mul(c,q),N=t.mul(p,N),l=t.mul(f,l),c=t.sub(E,l),c=t.mul(f,c),c=t.add(c,N),N=t.add(E,E),E=t.add(N,E),E=t.add(E,l),E=t.mul(E,c),y=t.add(y,E),l=t.mul(O,R),l=t.add(l,l),E=t.mul(l,c),q=t.sub(q,E),N=t.mul(l,_),N=t.add(N,N),N=t.add(N,N),new g(q,y,N)}add(f){I(f);const{px:h,py:p,pz:B}=this,{px:O,py:R,pz:q}=f;let y=t.ZERO,N=t.ZERO,E=t.ZERO;const _=n.a,l=t.mul(n.b,Nt);let c=t.mul(h,O),w=t.mul(p,R),S=t.mul(B,q),b=t.add(h,p),v=t.add(O,R);b=t.mul(b,v),v=t.add(c,w),b=t.sub(b,v),v=t.add(h,B);let Z=t.add(O,q);return v=t.mul(v,Z),Z=t.add(c,S),v=t.sub(v,Z),Z=t.add(p,B),y=t.add(R,q),Z=t.mul(Z,y),y=t.add(w,S),Z=t.sub(Z,y),E=t.mul(_,v),y=t.mul(l,S),E=t.add(y,E),y=t.sub(w,E),E=t.add(w,E),N=t.mul(y,E),w=t.add(c,c),w=t.add(w,c),S=t.mul(_,S),v=t.mul(l,v),w=t.add(w,S),S=t.sub(c,S),S=t.mul(_,S),v=t.add(v,S),c=t.mul(w,v),N=t.add(N,c),c=t.mul(Z,v),y=t.mul(b,y),y=t.sub(y,c),c=t.mul(b,w),E=t.mul(Z,E),E=t.add(E,c),new g(y,N,E)}subtract(f){return this.add(f.negate())}is0(){return this.equals(g.ZERO)}wNAF(f){return $.wNAFCached(this,f,g.normalizeZ)}multiplyUnsafe(f){const{endo:h,n:p}=n;it("scalar",f,X,p);const B=g.ZERO;if(f===X)return B;if(this.is0()||f===L)return this;if(!h||$.hasPrecomputes(this))return $.wNAFCachedUnsafe(this,f,g.normalizeZ);let{k1neg:O,k1:R,k2neg:q,k2:y}=h.splitScalar(f),N=B,E=B,_=this;for(;R>X||y>X;)R&L&&(N=N.add(_)),y&L&&(E=E.add(_)),_=_.double(),R>>=L,y>>=L;return O&&(N=N.negate()),q&&(E=E.negate()),E=new g(t.mul(E.px,h.beta),E.py,E.pz),N.add(E)}multiply(f){const{endo:h,n:p}=n;it("scalar",f,L,p);let B,O;if(h){const{k1neg:R,k1:q,k2neg:y,k2:N}=h.splitScalar(f);let{p:E,f:_}=this.wNAF(q),{p:l,f:c}=this.wNAF(N);E=$.constTimeNegate(R,E),l=$.constTimeNegate(y,l),l=new g(t.mul(l.px,h.beta),l.py,l.pz),B=E.add(l),O=_.add(c)}else{const{p:R,f:q}=this.wNAF(f);B=R,O=q}return g.normalizeZ([B,O])[0]}multiplyAndAddUnsafe(f,h,p){const B=g.BASE,O=(q,y)=>y===X||y===L||!q.equals(B)?q.multiplyUnsafe(y):q.multiply(y),R=O(this,h).add(O(f,p));return R.is0()?void 0:R}toAffine(f){return z(this,f)}isTorsionFree(){const{h:f,isTorsionFree:h}=n;if(f===L)return!0;if(h)return h(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:f,clearCofactor:h}=n;return f===L?this:h?h(g,this):this.multiplyUnsafe(n.h)}toRawBytes(f=!0){return ct("isCompressed",f),this.assertValidity(),i(g,this,f)}toHex(f=!0){return ct("isCompressed",f),at(this.toRawBytes(f))}}g.BASE=new g(n.Gx,n.Gy,t.ONE),g.ZERO=new g(t.ZERO,t.ONE,t.ZERO);const{endo:k,nBitLength:U}=n,$=Ie(g,k?Math.ceil(U/2):U);return{CURVE:n,ProjectivePoint:g,normPrivateKeyToScalar:A,weierstrassEquation:a,isWithinCurveOrder:m}}function Te(e){const n=se(e);return mt(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}function Ue(e){const n=Te(e),{Fp:t,n:r,nByteLength:i,nBitLength:s}=n,a=t.BYTES+1,u=2*t.BYTES+1;function o(l){return M(l,r)}function d(l){return Ot(l,r)}const{ProjectivePoint:m,normPrivateKeyToScalar:A,weierstrassEquation:I,isWithinCurveOrder:z}=ze({...n,toBytes(l,c,w){const S=c.toAffine(),b=t.toBytes(S.x),v=wt;return ct("isCompressed",w),w?v(Uint8Array.from([c.hasEvenY()?2:3]),b):v(Uint8Array.from([4]),b,t.toBytes(S.y))},fromBytes(l){const c=l.length,w=l[0],S=l.subarray(1);if(c===a&&(w===2||w===3)){const b=et(S);if(!Ut(b,L,t.ORDER))throw new Error("Point is not on curve");const v=I(b);let Z;try{Z=t.sqrt(v)}catch(P){const H=P instanceof Error?": "+P.message:"";throw new Error("Point is not on curve"+H)}const C=(Z&L)===L;return(w&1)===1!==C&&(Z=t.neg(Z)),{x:b,y:Z}}else if(c===u&&w===4){const b=t.fromBytes(S.subarray(0,t.BYTES)),v=t.fromBytes(S.subarray(t.BYTES,2*t.BYTES));return{x:b,y:v}}else{const b=a,v=u;throw new Error("invalid Point, expected length of "+b+", or uncompressed "+v+", got "+c)}}});function T(l){const c=r>>L;return l>c}function g(l){return T(l)?o(-l):l}const k=(l,c,w)=>et(l.slice(c,w));class U{constructor(c,w,S){it("r",c,L,r),it("s",w,L,r),this.r=c,this.s=w,S!=null&&(this.recovery=S),Object.freeze(this)}static fromCompact(c){const w=i;return c=K("compactSignature",c,w*2),new U(k(c,0,w),k(c,w,2*w))}static fromDER(c){const{r:w,s:S}=G.toSig(K("DER",c));return new U(w,S)}assertValidity(){}addRecoveryBit(c){return new U(this.r,this.s,c)}recoverPublicKey(c){const{r:w,s:S,recovery:b}=this,v=B(K("msgHash",c));if(b==null||![0,1,2,3].includes(b))throw new Error("recovery id invalid");const Z=b===2||b===3?w+n.n:w;if(Z>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const C=(b&1)===0?"02":"03",W=m.fromHex(C+At(Z,t.BYTES)),P=d(Z),H=o(-v*P),nt=o(S*P),F=m.BASE.multiplyAndAddUnsafe(W,H,nt);if(!F)throw new Error("point at infinify");return F.assertValidity(),F}hasHighS(){return T(this.s)}normalizeS(){return this.hasHighS()?new U(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return ht(this.toDERHex())}toDERHex(){return G.hexFromSig(this)}toCompactRawBytes(){return ht(this.toCompactHex())}toCompactHex(){const c=i;return At(this.r,c)+At(this.s,c)}}const $={isValidPrivateKey(l){try{return A(l),!0}catch{return!1}},normPrivateKeyToScalar:A,randomPrivateKey:()=>{const l=re(n.n);return Se(n.randomBytes(l),n.n)},precompute(l=8,c=m.BASE){return c._setWindowSize(l),c.multiply(BigInt(3)),c}};function x(l,c=!0){return m.fromPrivateKey(l).toRawBytes(c)}function f(l){if(typeof l=="bigint")return!1;if(l instanceof m)return!0;const w=K("key",l).length,S=t.BYTES,b=S+1,v=2*S+1;if(!(n.allowedPrivateKeyLengths||i===b))return w===b||w===v}function h(l,c,w=!0){if(f(l)===!0)throw new Error("first arg must be private key");if(f(c)===!1)throw new Error("second arg must be public key");return m.fromHex(c).multiply(A(l)).toRawBytes(w)}const p=n.bits2int||function(l){if(l.length>8192)throw new Error("input is too large");const c=et(l),w=l.length*8-s;return w>0?c>>BigInt(w):c},B=n.bits2int_modN||function(l){return o(p(l))},O=gt(s);function R(l){return it("num < 2^"+s,l,X,O),ut(l,i)}function q(l,c,w=y){if(["recovered","canonical"].some(Q=>Q in w))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:b}=n;let{lowS:v,prehash:Z,extraEntropy:C}=w;v==null&&(v=!0),l=K("msgHash",l),jt(w),Z&&(l=K("prehashed msgHash",S(l)));const W=B(l),P=A(c),H=[R(P),R(W)];if(C!=null&&C!==!1){const Q=C===!0?b(t.BYTES):C;H.push(K("extraEntropy",Q))}const nt=wt(...H),F=W;function pt(Q){const rt=p(Q);if(!z(rt))return;const yt=d(rt),st=m.BASE.multiply(rt).toAffine(),J=o(st.x);if(J===X)return;const ft=o(yt*o(F+J*P));if(ft===X)return;let ot=(st.x===J?0:2)|Number(st.y&L),_t=ft;return v&&T(ft)&&(_t=g(ft),ot^=1),new U(J,_t,ot)}return{seed:nt,k2sig:pt}}const y={lowS:n.lowS,prehash:!1},N={lowS:n.lowS,prehash:!1};function E(l,c,w=y){const{seed:S,k2sig:b}=q(l,c,w),v=n;return ge(v.hash.outputLen,v.nByteLength,v.hmac)(S,b)}m.BASE._setWindowSize(8);function _(l,c,w,S=N){const b=l;c=K("msgHash",c),w=K("publicKey",w);const{lowS:v,prehash:Z,format:C}=S;if(jt(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(C!==void 0&&C!=="compact"&&C!=="der")throw new Error("format must be compact or der");const W=typeof b=="string"||lt(b),P=!W&&!C&&typeof b=="object"&&b!==null&&typeof b.r=="bigint"&&typeof b.s=="bigint";if(!W&&!P)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let H,nt;try{if(P&&(H=new U(b.r,b.s)),W){try{C!=="compact"&&(H=U.fromDER(b))}catch(ot){if(!(ot instanceof G.Err))throw ot}!H&&C!=="der"&&(H=U.fromCompact(b))}nt=m.fromHex(w)}catch{return!1}if(!H||v&&H.hasHighS())return!1;Z&&(c=n.hash(c));const{r:F,s:pt}=H,Q=B(c),rt=d(pt),yt=o(Q*rt),st=o(F*rt),J=m.BASE.multiplyAndAddUnsafe(nt,yt,st)?.toAffine();return J?o(J.x)===F:!1}return{CURVE:n,getPublicKey:x,getSharedSecret:h,sign:E,verify:_,ProjectivePoint:m,Signature:U,utils:$}}function Le(e){return{hash:e,hmac:(n,...t)=>le(e,n,ue(...t)),randomBytes:ae}}function _e(e,n){const t=r=>Ue({...e,...Le(r)});return{...t(n),create:t}}const fe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Kt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ke=BigInt(0),Ce=BigInt(1),Rt=BigInt(2),Pt=(e,n)=>(e+n/Rt)/n;function Ve(e){const n=fe,t=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),a=BigInt(23),u=BigInt(44),o=BigInt(88),d=e*e*e%n,m=d*d*e%n,A=j(m,t,n)*m%n,I=j(A,t,n)*m%n,z=j(I,Rt,n)*d%n,T=j(z,i,n)*z%n,g=j(T,s,n)*T%n,k=j(g,u,n)*g%n,U=j(k,o,n)*k%n,$=j(U,u,n)*g%n,x=j($,t,n)*m%n,f=j(x,a,n)*T%n,h=j(f,r,n)*d%n,p=j(h,Rt,n);if(!Zt.eql(Zt.sqr(p),e))throw new Error("Cannot find square root");return p}const Zt=Lt(fe,void 0,void 0,{sqrt:Ve}),Me=_e({a:ke,b:BigInt(7),Fp:Zt,n:Kt,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const n=Kt,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ce*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,a=BigInt("0x100000000000000000000000000000000"),u=Pt(s*e,n),o=Pt(-r*e,n);let d=M(e-u*t-o*i,n),m=M(-u*r-o*s,n);const A=d>a,I=m>a;if(A&&(d=n-d),I&&(m=n-m),d>a||m>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:A,k1:d,k2neg:I,k2:m}}}},de);export{Me as secp256k1};
assets/send-DpLLU5D-.js ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as x,cB as d,dd as u,cC as b,cD as v,cF as F,cV as D,cT as g,cO as j,dF as l,cE as c,cH as z,cM as h,cK as H,cI as R,du as q,cN as y,cZ as G,cY as Z,da as K,cz as Y,cA as J,dc as X,dM as L,dN as M,cQ as ee}from"./index-C-6muS97.js";import"./index-BnHyc7bS.js";import"./index-ptQq3EiG.js";import{S as Q}from"./SwapController-DJdOQ0eQ.js";const te=x`
2
+ :host {
3
+ width: 100%;
4
+ height: 100px;
5
+ border-radius: ${({borderRadius:e})=>e[5]};
6
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundPrimary};
7
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
8
+ transition: background-color ${({durations:e})=>e.lg}
9
+ ${({easings:e})=>e["ease-out-power-1"]};
10
+ will-change: background-color;
11
+ position: relative;
12
+ }
13
+
14
+ :host(:hover) {
15
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
16
+ }
17
+
18
+ wui-flex {
19
+ width: 100%;
20
+ height: fit-content;
21
+ }
22
+
23
+ wui-button {
24
+ display: ruby;
25
+ color: ${({tokens:e})=>e.theme.textPrimary};
26
+ margin: 0 ${({spacing:e})=>e[2]};
27
+ }
28
+
29
+ .instruction {
30
+ position: absolute;
31
+ top: 50%;
32
+ transform: translateY(-50%);
33
+ z-index: 2;
34
+ }
35
+
36
+ .paste {
37
+ display: inline-flex;
38
+ }
39
+
40
+ textarea {
41
+ background: transparent;
42
+ width: 100%;
43
+ font-family: ${({fontFamily:e})=>e.regular};
44
+ font-style: normal;
45
+ font-size: ${({textSize:e})=>e.large};
46
+ font-weight: ${({fontWeight:e})=>e.regular};
47
+ line-height: ${({typography:e})=>e["lg-regular"].lineHeight};
48
+ letter-spacing: ${({typography:e})=>e["lg-regular"].letterSpacing};
49
+ color: ${({tokens:e})=>e.theme.textPrimary};
50
+ caret-color: ${({tokens:e})=>e.core.backgroundAccentPrimary};
51
+ box-sizing: border-box;
52
+ -webkit-appearance: none;
53
+ -moz-appearance: textfield;
54
+ padding: 0px;
55
+ border: none;
56
+ outline: none;
57
+ appearance: none;
58
+ resize: none;
59
+ overflow: hidden;
60
+ }
61
+ `;var E=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};let $=class extends v{constructor(){super(...arguments),this.inputElementRef=F(),this.instructionElementRef=F(),this.readOnly=!1,this.instructionHidden=!!this.value,this.pasting=!1,this.onDebouncedSearch=D.debounce(async t=>{if(!t.length){this.setReceiverAddress("");return}const n=g.state.activeChain;if(D.isAddress(t,n)){this.setReceiverAddress(t);return}try{const o=await j.getEnsAddress(t);if(o){l.setReceiverProfileName(t),l.setReceiverAddress(o);const i=await j.getEnsAvatar(t);l.setReceiverProfileImageUrl(i||void 0)}}catch{this.setReceiverAddress(t)}finally{l.setLoading(!1)}})}firstUpdated(){this.value&&(this.instructionHidden=!0),this.checkHidden()}render(){return this.readOnly?c` <wui-flex
62
+ flexDirection="column"
63
+ justifyContent="center"
64
+ gap="01"
65
+ .padding=${["8","4","5","4"]}
66
+ >
67
+ <textarea
68
+ spellcheck="false"
69
+ ?disabled=${!0}
70
+ autocomplete="off"
71
+ .value=${this.value??""}
72
+ >
73
+ ${this.value??""}</textarea
74
+ >
75
+ </wui-flex>`:c` <wui-flex
76
+ @click=${this.onBoxClick.bind(this)}
77
+ flexDirection="column"
78
+ justifyContent="center"
79
+ gap="01"
80
+ .padding=${["8","4","5","4"]}
81
+ >
82
+ <wui-text
83
+ ${z(this.instructionElementRef)}
84
+ class="instruction"
85
+ color="secondary"
86
+ variant="md-medium"
87
+ >
88
+ Type or
89
+ <wui-button
90
+ class="paste"
91
+ size="md"
92
+ variant="neutral-secondary"
93
+ iconLeft="copy"
94
+ @click=${this.onPasteClick.bind(this)}
95
+ >
96
+ <wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
97
+ Paste
98
+ </wui-button>
99
+ address
100
+ </wui-text>
101
+ <textarea
102
+ spellcheck="false"
103
+ ?disabled=${!this.instructionHidden}
104
+ ${z(this.inputElementRef)}
105
+ @input=${this.onInputChange.bind(this)}
106
+ @blur=${this.onBlur.bind(this)}
107
+ .value=${this.value??""}
108
+ autocomplete="off"
109
+ >
110
+ ${this.value??""}</textarea
111
+ >
112
+ </wui-flex>`}async focusInput(){this.instructionElementRef.value&&(this.instructionHidden=!0,await this.toggleInstructionFocus(!1),this.instructionElementRef.value.style.pointerEvents="none",this.inputElementRef.value?.focus(),this.inputElementRef.value&&(this.inputElementRef.value.selectionStart=this.inputElementRef.value.selectionEnd=this.inputElementRef.value.value.length))}async focusInstruction(){this.instructionElementRef.value&&(this.instructionHidden=!1,await this.toggleInstructionFocus(!0),this.instructionElementRef.value.style.pointerEvents="auto",this.inputElementRef.value?.blur())}async toggleInstructionFocus(t){this.instructionElementRef.value&&await this.instructionElementRef.value.animate([{opacity:t?0:1},{opacity:t?1:0}],{duration:100,easing:"ease",fill:"forwards"}).finished}onBoxClick(){!this.value&&!this.instructionHidden&&this.focusInput()}onBlur(){!this.value&&this.instructionHidden&&!this.pasting&&this.focusInstruction()}checkHidden(){this.instructionHidden&&this.focusInput()}async onPasteClick(){this.pasting=!0;const t=await navigator.clipboard.readText();l.setReceiverAddress(t),this.focusInput()}onInputChange(t){const n=t.target;this.pasting=!1,this.value=t.target?.value,n.value&&!this.instructionHidden&&this.focusInput(),l.setLoading(!0),this.onDebouncedSearch(n.value)}setReceiverAddress(t){l.setReceiverAddress(t),l.setReceiverProfileName(void 0),l.setReceiverProfileImageUrl(void 0),l.setLoading(!1)}};$.styles=te;E([d()],$.prototype,"value",void 0);E([d({type:Boolean})],$.prototype,"readOnly",void 0);E([u()],$.prototype,"instructionHidden",void 0);E([u()],$.prototype,"pasting",void 0);$=E([b("w3m-input-address")],$);const ie=x`
113
+ :host {
114
+ width: 100%;
115
+ height: 100px;
116
+ border-radius: ${({borderRadius:e})=>e[5]};
117
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundPrimary};
118
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
119
+ transition: background-color ${({durations:e})=>e.lg}
120
+ ${({easings:e})=>e["ease-out-power-1"]};
121
+ will-change: background-color;
122
+ transition: all ${({easings:e})=>e["ease-out-power-1"]}
123
+ ${({durations:e})=>e.lg};
124
+ }
125
+
126
+ :host(:hover) {
127
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
128
+ }
129
+
130
+ wui-flex {
131
+ width: 100%;
132
+ height: fit-content;
133
+ }
134
+
135
+ wui-button {
136
+ width: 100%;
137
+ display: flex;
138
+ justify-content: flex-end;
139
+ }
140
+
141
+ wui-input-amount {
142
+ mask-image: linear-gradient(
143
+ 270deg,
144
+ transparent 0px,
145
+ transparent 8px,
146
+ black 24px,
147
+ black 25px,
148
+ black 32px,
149
+ black 100%
150
+ );
151
+ }
152
+
153
+ .totalValue {
154
+ width: 100%;
155
+ }
156
+ `;var P=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};let A=class extends v{constructor(){super(...arguments),this.readOnly=!1,this.isInsufficientBalance=!1}render(){const t=this.readOnly||!this.token;return c` <wui-flex
157
+ flexDirection="column"
158
+ gap="01"
159
+ .padding=${["5","3","4","3"]}
160
+ >
161
+ <wui-flex alignItems="center">
162
+ <wui-input-amount
163
+ @inputChange=${this.onInputChange.bind(this)}
164
+ ?disabled=${t}
165
+ .value=${this.sendTokenAmount?String(this.sendTokenAmount):""}
166
+ ?error=${!!this.isInsufficientBalance}
167
+ ></wui-input-amount>
168
+ ${this.buttonTemplate()}
169
+ </wui-flex>
170
+ ${this.bottomTemplate()}
171
+ </wui-flex>`}buttonTemplate(){return this.token?c`<wui-token-button
172
+ text=${this.token.symbol}
173
+ imageSrc=${this.token.iconUrl}
174
+ @click=${this.handleSelectButtonClick.bind(this)}
175
+ >
176
+ </wui-token-button>`:c`<wui-button
177
+ size="md"
178
+ variant="neutral-secondary"
179
+ @click=${this.handleSelectButtonClick.bind(this)}
180
+ >Select token</wui-button
181
+ >`}handleSelectButtonClick(){this.readOnly||h.push("WalletSendSelectToken")}sendValueTemplate(){if(!this.readOnly&&this.token&&this.sendTokenAmount){const n=this.token.price*this.sendTokenAmount;return c`<wui-text class="totalValue" variant="sm-regular" color="secondary"
182
+ >${n?`$${H.formatNumberToLocalString(n,2)}`:"Incorrect value"}</wui-text
183
+ >`}return null}maxAmountTemplate(){return this.token?c` <wui-text variant="sm-regular" color="secondary">
184
+ ${R.roundNumber(Number(this.token.quantity.numeric),6,5)}
185
+ </wui-text>`:null}actionTemplate(){return this.token?c`<wui-link @click=${this.onMaxClick.bind(this)}>Max</wui-link>`:null}bottomTemplate(){return this.readOnly?null:c`<wui-flex alignItems="center" justifyContent="space-between">
186
+ ${this.sendValueTemplate()}
187
+ <wui-flex alignItems="center" gap="01" justifyContent="flex-end">
188
+ ${this.maxAmountTemplate()} ${this.actionTemplate()}
189
+ </wui-flex>
190
+ </wui-flex>`}onInputChange(t){l.setTokenAmount(t.detail)}onMaxClick(){if(this.token){const t=H.bigNumber(this.token.quantity.numeric);l.setTokenAmount(Number(t.toFixed(20)))}}};A.styles=ie;P([d({type:Object})],A.prototype,"token",void 0);P([d({type:Boolean})],A.prototype,"readOnly",void 0);P([d({type:Number})],A.prototype,"sendTokenAmount",void 0);P([d({type:Boolean})],A.prototype,"isInsufficientBalance",void 0);A=P([b("w3m-input-token")],A);const ne=x`
191
+ :host {
192
+ display: block;
193
+ }
194
+
195
+ wui-flex {
196
+ position: relative;
197
+ }
198
+
199
+ wui-icon-box {
200
+ width: 32px;
201
+ height: 32px;
202
+ border-radius: ${({borderRadius:e})=>e[10]} !important;
203
+ border: 4px solid ${({tokens:e})=>e.theme.backgroundPrimary};
204
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
205
+ position: absolute;
206
+ top: 50%;
207
+ left: 50%;
208
+ transform: translate(-50%, -50%);
209
+ z-index: 3;
210
+ }
211
+
212
+ wui-button {
213
+ --local-border-radius: ${({borderRadius:e})=>e[4]} !important;
214
+ }
215
+
216
+ .inputContainer {
217
+ height: fit-content;
218
+ }
219
+ `;var w=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};const p={INSUFFICIENT_FUNDS:"Insufficient Funds",INCORRECT_VALUE:"Incorrect Value",INVALID_ADDRESS:"Invalid Address",ADD_ADDRESS:"Add Address",ADD_AMOUNT:"Add Amount",SELECT_TOKEN:"Select Token",PREVIEW_SEND:"Preview Send"};let f=class extends v{constructor(){super(),this.unsubscribe=[],this.isTryingToChooseDifferentWallet=!1,this.token=l.state.token,this.sendTokenAmount=l.state.sendTokenAmount,this.receiverAddress=l.state.receiverAddress,this.receiverProfileName=l.state.receiverProfileName,this.loading=l.state.loading,this.params=h.state.data?.send,this.caipAddress=g.getAccountData()?.caipAddress,this.message=p.PREVIEW_SEND,this.disconnecting=!1,this.token&&!this.params&&(this.fetchBalances(),this.fetchNetworkPrice());const t=g.subscribeKey("activeCaipAddress",n=>{!n&&this.isTryingToChooseDifferentWallet&&(this.isTryingToChooseDifferentWallet=!1,q.open({view:"Connect",data:{redirectView:"WalletSend"}}).catch(()=>null),t())});this.unsubscribe.push(g.subscribeAccountStateProp("caipAddress",n=>{this.caipAddress=n}),l.subscribe(n=>{this.token=n.token,this.sendTokenAmount=n.sendTokenAmount,this.receiverAddress=n.receiverAddress,this.receiverProfileName=n.receiverProfileName,this.loading=n.loading}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}async firstUpdated(){await this.handleSendParameters()}render(){this.getMessage();const t=!!this.params;return c` <wui-flex flexDirection="column" .padding=${["0","4","4","4"]}>
220
+ <wui-flex class="inputContainer" gap="2" flexDirection="column">
221
+ <w3m-input-token
222
+ .token=${this.token}
223
+ .sendTokenAmount=${this.sendTokenAmount}
224
+ ?readOnly=${t}
225
+ ?isInsufficientBalance=${this.message===p.INSUFFICIENT_FUNDS}
226
+ ></w3m-input-token>
227
+ <wui-icon-box size="md" variant="secondary" icon="arrowBottom"></wui-icon-box>
228
+ <w3m-input-address
229
+ ?readOnly=${t}
230
+ .value=${this.receiverProfileName?this.receiverProfileName:this.receiverAddress}
231
+ ></w3m-input-address>
232
+ </wui-flex>
233
+ ${this.buttonTemplate()}
234
+ </wui-flex>`}async fetchBalances(){await l.fetchTokenBalance(),l.fetchNetworkBalance()}async fetchNetworkPrice(){await Q.getNetworkTokenPrice()}onButtonClick(){h.push("WalletSendPreview",{send:this.params})}onFundWalletClick(){h.push("FundWallet",{redirectView:"WalletSend"})}async onConnectDifferentWalletClick(){try{this.isTryingToChooseDifferentWallet=!0,this.disconnecting=!0,await j.disconnect()}finally{this.disconnecting=!1}}getMessage(){this.message=p.PREVIEW_SEND,this.receiverAddress&&!D.isAddress(this.receiverAddress,g.state.activeChain)&&(this.message=p.INVALID_ADDRESS),this.receiverAddress||(this.message=p.ADD_ADDRESS),this.sendTokenAmount&&this.token&&this.sendTokenAmount>Number(this.token.quantity.numeric)&&(this.message=p.INSUFFICIENT_FUNDS),this.sendTokenAmount||(this.message=p.ADD_AMOUNT),this.sendTokenAmount&&this.token?.price&&(this.sendTokenAmount*this.token.price||(this.message=p.INCORRECT_VALUE)),this.token||(this.message=p.SELECT_TOKEN)}buttonTemplate(){const t=!this.message.startsWith(p.PREVIEW_SEND),n=this.message===p.INSUFFICIENT_FUNDS,r=!!this.params;return n&&!r?c`
235
+ <wui-flex .margin=${["4","0","0","0"]} flexDirection="column" gap="4">
236
+ <wui-button
237
+ @click=${this.onFundWalletClick.bind(this)}
238
+ size="lg"
239
+ variant="accent-secondary"
240
+ fullWidth
241
+ >
242
+ Fund Wallet
243
+ </wui-button>
244
+
245
+ <wui-separator data-testid="wui-separator" text="or"></wui-separator>
246
+
247
+ <wui-button
248
+ @click=${this.onConnectDifferentWalletClick.bind(this)}
249
+ size="lg"
250
+ variant="neutral-secondary"
251
+ fullWidth
252
+ ?loading=${this.disconnecting}
253
+ >
254
+ Connect a different wallet
255
+ </wui-button>
256
+ </wui-flex>
257
+ `:c`<wui-flex .margin=${["4","0","0","0"]}>
258
+ <wui-button
259
+ @click=${this.onButtonClick.bind(this)}
260
+ ?disabled=${t}
261
+ size="lg"
262
+ variant="accent-primary"
263
+ ?loading=${this.loading}
264
+ fullWidth
265
+ >
266
+ ${this.message}
267
+ </wui-button>
268
+ </wui-flex>`}async handleSendParameters(){if(this.loading=!0,!this.params){this.loading=!1;return}const t=Number(this.params.amount);if(isNaN(t)){y.showError("Invalid amount"),this.loading=!1;return}const{namespace:n,chainId:r,assetAddress:o}=this.params;if(!G.SEND_PARAMS_SUPPORTED_CHAINS.includes(n)){y.showError(`Chain "${n}" is not supported for send parameters`),this.loading=!1;return}const i=g.getCaipNetworkById(r,n);if(!i){y.showError(`Network with id "${r}" not found`),this.loading=!1;return}try{const{balance:s,name:a,symbol:W,decimals:V}=await Z.fetchERC20Balance({caipAddress:this.caipAddress,assetAddress:o,caipNetwork:i});if(!a||!W||!V||!s){y.showError("Token not found");return}l.setToken({name:a,symbol:W,chainId:i.id.toString(),address:`${i.chainNamespace}:${i.id}:${o}`,value:0,price:0,quantity:{decimals:V.toString(),numeric:s.toString()},iconUrl:K.getTokenImage(W)??""}),l.setTokenAmount(t),l.setReceiverAddress(this.params.to)}catch(s){console.error("Failed to load token information:",s),y.showError("Failed to load token information")}finally{this.loading=!1}}};f.styles=ne;w([u()],f.prototype,"token",void 0);w([u()],f.prototype,"sendTokenAmount",void 0);w([u()],f.prototype,"receiverAddress",void 0);w([u()],f.prototype,"receiverProfileName",void 0);w([u()],f.prototype,"loading",void 0);w([u()],f.prototype,"params",void 0);w([u()],f.prototype,"caipAddress",void 0);w([u()],f.prototype,"message",void 0);w([u()],f.prototype,"disconnecting",void 0);f=w([b("w3m-wallet-send-view")],f);const re=x`
269
+ .contentContainer {
270
+ height: 440px;
271
+ overflow: scroll;
272
+ scrollbar-width: none;
273
+ }
274
+
275
+ .contentContainer::-webkit-scrollbar {
276
+ display: none;
277
+ }
278
+
279
+ wui-icon-box {
280
+ width: 40px;
281
+ height: 40px;
282
+ border-radius: ${({borderRadius:e})=>e[3]};
283
+ }
284
+ `;var I=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};let C=class extends v{constructor(){super(),this.unsubscribe=[],this.tokenBalances=l.state.tokenBalances,this.search="",this.onDebouncedSearch=D.debounce(t=>{this.search=t}),this.fetchBalancesAndNetworkPrice(),this.unsubscribe.push(l.subscribe(t=>{this.tokenBalances=t.tokenBalances}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){return c`
285
+ <wui-flex flexDirection="column">
286
+ ${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
287
+ </wui-flex>
288
+ `}async fetchBalancesAndNetworkPrice(){(!this.tokenBalances||this.tokenBalances?.length===0)&&(await this.fetchBalances(),await this.fetchNetworkPrice())}async fetchBalances(){await l.fetchTokenBalance(),l.fetchNetworkBalance()}async fetchNetworkPrice(){await Q.getNetworkTokenPrice()}templateSearchInput(){return c`
289
+ <wui-flex gap="2" padding="3">
290
+ <wui-input-text
291
+ @inputChange=${this.onInputChange.bind(this)}
292
+ class="network-search-input"
293
+ size="sm"
294
+ placeholder="Search token"
295
+ icon="search"
296
+ ></wui-input-text>
297
+ </wui-flex>
298
+ `}templateTokens(){return this.tokens=this.tokenBalances?.filter(t=>t.chainId===g.state.activeCaipNetwork?.caipNetworkId),this.search?this.filteredTokens=this.tokenBalances?.filter(t=>t.name.toLowerCase().includes(this.search.toLowerCase())):this.filteredTokens=this.tokens,c`
299
+ <wui-flex
300
+ class="contentContainer"
301
+ flexDirection="column"
302
+ .padding=${["0","3","0","3"]}
303
+ >
304
+ <wui-flex justifyContent="flex-start" .padding=${["4","3","3","3"]}>
305
+ <wui-text variant="md-medium" color="secondary">Your tokens</wui-text>
306
+ </wui-flex>
307
+ <wui-flex flexDirection="column" gap="2">
308
+ ${this.filteredTokens&&this.filteredTokens.length>0?this.filteredTokens.map(t=>c`<wui-list-token
309
+ @click=${this.handleTokenClick.bind(this,t)}
310
+ ?clickable=${!0}
311
+ tokenName=${t.name}
312
+ tokenImageUrl=${t.iconUrl}
313
+ tokenAmount=${t.quantity.numeric}
314
+ tokenValue=${t.value}
315
+ tokenCurrency=${t.symbol}
316
+ ></wui-list-token>`):c`<wui-flex
317
+ .padding=${["20","0","0","0"]}
318
+ alignItems="center"
319
+ flexDirection="column"
320
+ gap="4"
321
+ >
322
+ <wui-icon-box icon="coinPlaceholder" color="default" size="lg"></wui-icon-box>
323
+ <wui-flex
324
+ class="textContent"
325
+ gap="2"
326
+ flexDirection="column"
327
+ justifyContent="center"
328
+ flexDirection="column"
329
+ >
330
+ <wui-text variant="lg-medium" align="center" color="primary">
331
+ No tokens found
332
+ </wui-text>
333
+ <wui-text variant="lg-regular" align="center" color="secondary">
334
+ Your tokens will appear here
335
+ </wui-text>
336
+ </wui-flex>
337
+ <wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
338
+ </wui-flex>`}
339
+ </wui-flex>
340
+ </wui-flex>
341
+ `}onBuyClick(){h.push("OnRampProviders")}onInputChange(t){this.onDebouncedSearch(t.detail)}handleTokenClick(t){l.setToken(t),l.setTokenAmount(void 0),h.goBack()}};C.styles=re;I([u()],C.prototype,"tokenBalances",void 0);I([u()],C.prototype,"tokens",void 0);I([u()],C.prototype,"filteredTokens",void 0);I([u()],C.prototype,"search",void 0);C=I([b("w3m-wallet-send-select-token-view")],C);const oe=x`
342
+ :host {
343
+ height: 32px;
344
+ display: flex;
345
+ align-items: center;
346
+ gap: ${({spacing:e})=>e[1]};
347
+ border-radius: ${({borderRadius:e})=>e[32]};
348
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
349
+ padding: ${({spacing:e})=>e[1]};
350
+ padding-left: ${({spacing:e})=>e[2]};
351
+ }
352
+
353
+ wui-avatar,
354
+ wui-image {
355
+ width: 24px;
356
+ height: 24px;
357
+ border-radius: ${({borderRadius:e})=>e[16]};
358
+ }
359
+
360
+ wui-icon {
361
+ border-radius: ${({borderRadius:e})=>e[16]};
362
+ }
363
+ `;var _=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};let T=class extends v{constructor(){super(...arguments),this.text=""}render(){return c`<wui-text variant="lg-regular" color="primary">${this.text}</wui-text>
364
+ ${this.imageTemplate()}`}imageTemplate(){return this.address?c`<wui-avatar address=${this.address} .imageSrc=${this.imageSrc}></wui-avatar>`:this.imageSrc?c`<wui-image src=${this.imageSrc}></wui-image>`:c`<wui-icon size="lg" color="inverse" name="networkPlaceholder"></wui-icon>`}};T.styles=[Y,J,oe];_([d({type:String})],T.prototype,"text",void 0);_([d({type:String})],T.prototype,"address",void 0);_([d({type:String})],T.prototype,"imageSrc",void 0);T=_([b("wui-preview-item")],T);const se=x`
365
+ :host {
366
+ display: flex;
367
+ padding: ${({spacing:e})=>e[4]} ${({spacing:e})=>e[3]};
368
+ width: 100%;
369
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
370
+ border-radius: ${({borderRadius:e})=>e[4]};
371
+ }
372
+
373
+ wui-image {
374
+ width: 20px;
375
+ height: 20px;
376
+ border-radius: ${({borderRadius:e})=>e[16]};
377
+ }
378
+
379
+ wui-icon {
380
+ width: 20px;
381
+ height: 20px;
382
+ }
383
+ `;var O=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};let S=class extends v{constructor(){super(...arguments),this.imageSrc=void 0,this.textTitle="",this.textValue=void 0}render(){return c`
384
+ <wui-flex justifyContent="space-between" alignItems="center">
385
+ <wui-text variant="lg-regular" color="primary"> ${this.textTitle} </wui-text>
386
+ ${this.templateContent()}
387
+ </wui-flex>
388
+ `}templateContent(){return this.imageSrc?c`<wui-image src=${this.imageSrc} alt=${this.textTitle}></wui-image>`:this.textValue?c` <wui-text variant="md-regular" color="secondary"> ${this.textValue} </wui-text>`:c`<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`}};S.styles=[Y,J,se];O([d()],S.prototype,"imageSrc",void 0);O([d()],S.prototype,"textTitle",void 0);O([d()],S.prototype,"textValue",void 0);S=O([b("wui-list-content")],S);const ae=x`
389
+ :host {
390
+ display: flex;
391
+ width: auto;
392
+ flex-direction: column;
393
+ gap: ${({spacing:e})=>e[1]};
394
+ border-radius: ${({borderRadius:e})=>e[5]};
395
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
396
+ padding: ${({spacing:e})=>e[3]} ${({spacing:e})=>e[2]}
397
+ ${({spacing:e})=>e[2]} ${({spacing:e})=>e[2]};
398
+ }
399
+
400
+ wui-list-content {
401
+ width: -webkit-fill-available !important;
402
+ }
403
+
404
+ wui-text {
405
+ padding: 0 ${({spacing:e})=>e[2]};
406
+ }
407
+
408
+ wui-flex {
409
+ margin-top: ${({spacing:e})=>e[2]};
410
+ }
411
+
412
+ .network {
413
+ cursor: pointer;
414
+ transition: background-color ${({durations:e})=>e.lg}
415
+ ${({easings:e})=>e["ease-out-power-1"]};
416
+ will-change: background-color;
417
+ }
418
+
419
+ .network:focus-visible {
420
+ border: 1px solid ${({tokens:e})=>e.core.textAccentPrimary};
421
+ background-color: ${({tokens:e})=>e.core.glass010};
422
+ -webkit-box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent010};
423
+ -moz-box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent010};
424
+ box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent010};
425
+ }
426
+
427
+ .network:hover {
428
+ background-color: ${({tokens:e})=>e.core.glass010};
429
+ }
430
+
431
+ .network:active {
432
+ background-color: ${({tokens:e})=>e.core.glass010};
433
+ }
434
+ `;var B=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};let N=class extends v{constructor(){super(...arguments),this.params=h.state.data?.send}render(){return c` <wui-text variant="sm-regular" color="secondary">Details</wui-text>
435
+ <wui-flex flexDirection="column" gap="1">
436
+ <wui-list-content
437
+ textTitle="Address"
438
+ textValue=${R.getTruncateString({string:this.receiverAddress??"",charsStart:4,charsEnd:4,truncate:"middle"})}
439
+ >
440
+ </wui-list-content>
441
+ ${this.networkTemplate()}
442
+ </wui-flex>`}networkTemplate(){return this.caipNetwork?.name?c` <wui-list-content
443
+ @click=${()=>this.onNetworkClick(this.caipNetwork)}
444
+ class="network"
445
+ textTitle="Network"
446
+ imageSrc=${X(K.getNetworkImage(this.caipNetwork))}
447
+ ></wui-list-content>`:null}onNetworkClick(t){t&&!this.params&&h.push("Networks",{network:t})}};N.styles=ae;B([d()],N.prototype,"receiverAddress",void 0);B([d({type:Object})],N.prototype,"caipNetwork",void 0);B([u()],N.prototype,"params",void 0);N=B([b("w3m-wallet-send-details")],N);const le=x`
448
+ wui-avatar,
449
+ wui-image {
450
+ display: ruby;
451
+ width: 32px;
452
+ height: 32px;
453
+ border-radius: ${({borderRadius:e})=>e[20]};
454
+ }
455
+
456
+ .sendButton {
457
+ width: 70%;
458
+ --local-width: 100% !important;
459
+ --local-border-radius: ${({borderRadius:e})=>e[4]} !important;
460
+ }
461
+
462
+ .cancelButton {
463
+ width: 30%;
464
+ --local-width: 100% !important;
465
+ --local-border-radius: ${({borderRadius:e})=>e[4]} !important;
466
+ }
467
+ `;var k=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};let m=class extends v{constructor(){super(),this.unsubscribe=[],this.token=l.state.token,this.sendTokenAmount=l.state.sendTokenAmount,this.receiverAddress=l.state.receiverAddress,this.receiverProfileName=l.state.receiverProfileName,this.receiverProfileImageUrl=l.state.receiverProfileImageUrl,this.caipNetwork=g.state.activeCaipNetwork,this.loading=l.state.loading,this.params=h.state.data?.send,this.unsubscribe.push(l.subscribe(t=>{this.token=t.token,this.sendTokenAmount=t.sendTokenAmount,this.receiverAddress=t.receiverAddress,this.receiverProfileName=t.receiverProfileName,this.receiverProfileImageUrl=t.receiverProfileImageUrl,this.loading=t.loading}),g.subscribeKey("activeCaipNetwork",t=>this.caipNetwork=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){return c` <wui-flex flexDirection="column" .padding=${["0","4","4","4"]}>
468
+ <wui-flex gap="2" flexDirection="column" .padding=${["0","2","0","2"]}>
469
+ <wui-flex alignItems="center" justifyContent="space-between">
470
+ <wui-flex flexDirection="column" gap="01">
471
+ <wui-text variant="sm-regular" color="secondary">Send</wui-text>
472
+ ${this.sendValueTemplate()}
473
+ </wui-flex>
474
+ <wui-preview-item
475
+ text="${this.sendTokenAmount?R.roundNumber(this.sendTokenAmount,6,5):"unknown"} ${this.token?.symbol}"
476
+ .imageSrc=${this.token?.iconUrl}
477
+ ></wui-preview-item>
478
+ </wui-flex>
479
+ <wui-flex>
480
+ <wui-icon color="default" size="md" name="arrowBottom"></wui-icon>
481
+ </wui-flex>
482
+ <wui-flex alignItems="center" justifyContent="space-between">
483
+ <wui-text variant="sm-regular" color="secondary">To</wui-text>
484
+ <wui-preview-item
485
+ text="${this.receiverProfileName?R.getTruncateString({string:this.receiverProfileName,charsStart:20,charsEnd:0,truncate:"end"}):R.getTruncateString({string:this.receiverAddress?this.receiverAddress:"",charsStart:4,charsEnd:4,truncate:"middle"})}"
486
+ address=${this.receiverAddress??""}
487
+ .imageSrc=${this.receiverProfileImageUrl??void 0}
488
+ .isAddress=${!0}
489
+ ></wui-preview-item>
490
+ </wui-flex>
491
+ </wui-flex>
492
+ <wui-flex flexDirection="column" .padding=${["6","0","0","0"]}>
493
+ <w3m-wallet-send-details
494
+ .caipNetwork=${this.caipNetwork}
495
+ .receiverAddress=${this.receiverAddress}
496
+ ></w3m-wallet-send-details>
497
+ <wui-flex justifyContent="center" gap="1" .padding=${["3","0","0","0"]}>
498
+ <wui-icon size="sm" color="default" name="warningCircle"></wui-icon>
499
+ <wui-text variant="sm-regular" color="secondary">Review transaction carefully</wui-text>
500
+ </wui-flex>
501
+ <wui-flex justifyContent="center" gap="3" .padding=${["4","0","0","0"]}>
502
+ <wui-button
503
+ class="cancelButton"
504
+ @click=${this.onCancelClick.bind(this)}
505
+ size="lg"
506
+ variant="neutral-secondary"
507
+ >
508
+ Cancel
509
+ </wui-button>
510
+ <wui-button
511
+ class="sendButton"
512
+ @click=${this.onSendClick.bind(this)}
513
+ size="lg"
514
+ variant="accent-primary"
515
+ .loading=${this.loading}
516
+ >
517
+ Send
518
+ </wui-button>
519
+ </wui-flex>
520
+ </wui-flex></wui-flex
521
+ >`}sendValueTemplate(){if(!this.params&&this.token&&this.sendTokenAmount){const n=this.token.price*this.sendTokenAmount;return c`<wui-text variant="md-regular" color="primary"
522
+ >$${n.toFixed(2)}</wui-text
523
+ >`}return null}async onSendClick(){if(!this.sendTokenAmount||!this.receiverAddress){y.showError("Please enter a valid amount and receiver address");return}try{await l.sendToken(),this.params?h.reset("WalletSendConfirmed"):(y.showSuccess("Transaction started"),h.replace("Account"))}catch(t){let n="Failed to send transaction";const r=t instanceof L&&t.originalName===M.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST,o=t instanceof L&&t.originalName===M.PROVIDER_RPC_ERROR_NAME.SEND_TRANSACTION_ERROR;(r||o)&&(n=t.message),ee.sendEvent({type:"track",event:r?"SEND_REJECTED":"SEND_ERROR",properties:l.getSdkEventProperties(t)}),y.showError(n)}}onCancelClick(){h.goBack()}};m.styles=le;k([u()],m.prototype,"token",void 0);k([u()],m.prototype,"sendTokenAmount",void 0);k([u()],m.prototype,"receiverAddress",void 0);k([u()],m.prototype,"receiverProfileName",void 0);k([u()],m.prototype,"receiverProfileImageUrl",void 0);k([u()],m.prototype,"caipNetwork",void 0);k([u()],m.prototype,"loading",void 0);k([u()],m.prototype,"params",void 0);m=k([b("w3m-wallet-send-preview-view")],m);const ce=x`
524
+ .icon-box {
525
+ width: 64px;
526
+ height: 64px;
527
+ border-radius: 16px;
528
+ background-color: ${({spacing:e})=>e[16]};
529
+ border: 8px solid ${({tokens:e})=>e.theme.borderPrimary};
530
+ border-radius: ${({borderRadius:e})=>e.round};
531
+ }
532
+ `;var ue=function(e,t,n,r){var o=arguments.length,i=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};let U=class extends v{constructor(){super(),this.unsubscribe=[],this.unsubscribe.push()}render(){return c`
533
+ <wui-flex
534
+ flexDirection="column"
535
+ alignItems="center"
536
+ gap="4"
537
+ .padding="${["1","3","4","3"]}"
538
+ >
539
+ <wui-flex justifyContent="center" alignItems="center" class="icon-box">
540
+ <wui-icon size="xxl" color="success" name="checkmark"></wui-icon>
541
+ </wui-flex>
542
+
543
+ <wui-text variant="h6-medium" color="primary">You successfully sent asset</wui-text>
544
+
545
+ <wui-button
546
+ fullWidth
547
+ @click=${this.onCloseClick.bind(this)}
548
+ size="lg"
549
+ variant="neutral-secondary"
550
+ >
551
+ Close
552
+ </wui-button>
553
+ </wui-flex>
554
+ `}onCloseClick(){q.close()}};U.styles=ce;U=ue([b("w3m-send-confirmed-view")],U);export{U as W3mSendConfirmedView,C as W3mSendSelectTokenView,m as W3mWalletSendPreviewView,f as W3mWalletSendView};
assets/socials-CTFD7hbk.js ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as L,cB as k,dd as l,cC as O,cD as _,c$ as E,dr as h,dw as W,cM as f,cZ as T,cE as c,dx as F,cV as v,dy as D,cX as N,dz as R,dc as $,cT as d,cO as S,dA as M,cQ as u,dB as A,cN as C,dC as j,du as I,db as x}from"./index-C-6muS97.js";const z=L`
2
+ :host {
3
+ margin-top: ${({spacing:t})=>t[1]};
4
+ }
5
+ wui-separator {
6
+ margin: ${({spacing:t})=>t[3]} calc(${({spacing:t})=>t[3]} * -1)
7
+ ${({spacing:t})=>t[2]} calc(${({spacing:t})=>t[3]} * -1);
8
+ width: calc(100% + ${({spacing:t})=>t[3]} * 2);
9
+ }
10
+ `;var g=function(t,e,i,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o};let p=class extends _{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=E.state.connectors,this.authConnector=this.connectors.find(e=>e.type==="AUTH"),this.remoteFeatures=h.state.remoteFeatures,this.isPwaLoading=!1,this.hasExceededUsageLimit=W.state.plan.hasExceededUsageLimit,this.unsubscribe.push(E.subscribeKey("connectors",e=>{this.connectors=e,this.authConnector=this.connectors.find(i=>i.type==="AUTH")}),h.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}connectedCallback(){super.connectedCallback(),this.handlePwaFrameLoad()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.remoteFeatures?.socials||[];const i=!!this.authConnector,r=e?.length,s=f.state.view==="ConnectSocials";return(!i||!r)&&!s?null:(s&&!r&&(e=T.DEFAULT_SOCIALS),c` <wui-flex flexDirection="column" gap="2">
11
+ ${e.map(o=>c`<wui-list-social
12
+ @click=${()=>{this.onSocialClick(o)}}
13
+ data-testid=${`social-selector-${o}`}
14
+ name=${o}
15
+ logo=${o}
16
+ ?disabled=${this.isPwaLoading}
17
+ ></wui-list-social>`)}
18
+ </wui-flex>`)}async onSocialClick(e){if(this.hasExceededUsageLimit){f.push("UsageExceeded");return}e&&await F(e)}async handlePwaFrameLoad(){if(v.isPWA()){this.isPwaLoading=!0;try{this.authConnector?.provider instanceof D&&await this.authConnector.provider.init()}catch(e){N.open({displayMessage:"Error loading embedded wallet in PWA",debugMessage:e.message},"error")}finally{this.isPwaLoading=!1}}}};p.styles=z;g([k()],p.prototype,"tabIdx",void 0);g([l()],p.prototype,"connectors",void 0);g([l()],p.prototype,"authConnector",void 0);g([l()],p.prototype,"remoteFeatures",void 0);g([l()],p.prototype,"isPwaLoading",void 0);g([l()],p.prototype,"hasExceededUsageLimit",void 0);p=g([O("w3m-social-login-list")],p);const q=L`
19
+ wui-flex {
20
+ max-height: clamp(360px, 540px, 80vh);
21
+ overflow: scroll;
22
+ scrollbar-width: none;
23
+ transition: opacity ${({durations:t})=>t.md}
24
+ ${({easings:t})=>t["ease-out-power-1"]};
25
+ will-change: opacity;
26
+ }
27
+
28
+ wui-flex::-webkit-scrollbar {
29
+ display: none;
30
+ }
31
+
32
+ wui-flex.disabled {
33
+ opacity: 0.3;
34
+ pointer-events: none;
35
+ user-select: none;
36
+ }
37
+ `;var U=function(t,e,i,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o};let P=class extends _{constructor(){super(),this.unsubscribe=[],this.checked=R.state.isLegalCheckboxChecked,this.unsubscribe.push(R.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const{termsConditionsUrl:e,privacyPolicyUrl:i}=h.state,r=h.state.features?.legalCheckbox,n=!!(e||i)&&!!r&&!this.checked,a=n?-1:void 0;return c`
38
+ <w3m-legal-checkbox></w3m-legal-checkbox>
39
+ <wui-flex
40
+ flexDirection="column"
41
+ .padding=${["0","3","3","3"]}
42
+ gap="01"
43
+ class=${$(n?"disabled":void 0)}
44
+ >
45
+ <w3m-social-login-list tabIdx=${$(a)}></w3m-social-login-list>
46
+ </wui-flex>
47
+ `}};P.styles=q;U([l()],P.prototype,"checked",void 0);P=U([O("w3m-connect-socials-view")],P);const B=L`
48
+ wui-logo {
49
+ width: 80px;
50
+ height: 80px;
51
+ border-radius: ${({borderRadius:t})=>t[8]};
52
+ }
53
+ @keyframes shake {
54
+ 0% {
55
+ transform: translateX(0);
56
+ }
57
+ 25% {
58
+ transform: translateX(3px);
59
+ }
60
+ 50% {
61
+ transform: translateX(-3px);
62
+ }
63
+ 75% {
64
+ transform: translateX(3px);
65
+ }
66
+ 100% {
67
+ transform: translateX(0);
68
+ }
69
+ }
70
+ wui-flex:first-child:not(:only-child) {
71
+ position: relative;
72
+ }
73
+ wui-loading-thumbnail {
74
+ position: absolute;
75
+ }
76
+ wui-icon-box {
77
+ position: absolute;
78
+ right: calc(${({spacing:t})=>t[1]} * -1);
79
+ bottom: calc(${({spacing:t})=>t[1]} * -1);
80
+ opacity: 0;
81
+ transform: scale(0.5);
82
+ transition: all ${({easings:t})=>t["ease-out-power-2"]}
83
+ ${({durations:t})=>t.lg};
84
+ }
85
+ wui-text[align='center'] {
86
+ width: 100%;
87
+ padding: 0px ${({spacing:t})=>t[4]};
88
+ }
89
+ [data-error='true'] wui-icon-box {
90
+ opacity: 1;
91
+ transform: scale(1);
92
+ }
93
+ [data-error='true'] > wui-flex:first-child {
94
+ animation: shake 250ms ${({easings:t})=>t["ease-out-power-2"]} both;
95
+ }
96
+ .capitalize {
97
+ text-transform: capitalize;
98
+ }
99
+ `;var b=function(t,e,i,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o};let m=class extends _{constructor(){super(),this.unsubscribe=[],this.socialProvider=d.getAccountData()?.socialProvider,this.socialWindow=d.getAccountData()?.socialWindow,this.error=!1,this.connecting=!1,this.message="Connect in the provider window",this.remoteFeatures=h.state.remoteFeatures,this.address=d.getAccountData()?.address,this.connectionsByNamespace=S.getConnections(d.state.activeChain),this.hasMultipleConnections=this.connectionsByNamespace.length>0,this.authConnector=E.getAuthConnector(),this.handleSocialConnection=async i=>{if(i.data?.resultUri)if(i.origin===M.SECURE_SITE_ORIGIN){window.removeEventListener("message",this.handleSocialConnection,!1);try{if(this.authConnector&&!this.connecting){this.connecting=!0;const r=this.parseURLError(i.data.resultUri);if(r){this.handleSocialError(r);return}this.closeSocialWindow(),this.updateMessage();const s=i.data.resultUri;this.socialProvider&&u.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:this.socialProvider}}),await S.connectExternal({id:this.authConnector.id,type:this.authConnector.type,socialUri:s},this.authConnector.chain),this.socialProvider&&(A.setConnectedSocialProvider(this.socialProvider),u.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider}}))}}catch(r){this.error=!0,this.updateMessage(),this.socialProvider&&u.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider,message:v.parseError(r)}})}}else f.goBack(),C.showError("Untrusted Origin"),this.socialProvider&&u.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider,message:"Untrusted Origin"}})},j.EmbeddedWalletAbortController.signal.addEventListener("abort",()=>{this.closeSocialWindow()}),this.unsubscribe.push(d.subscribeChainProp("accountState",i=>{if(i&&(this.socialProvider=i.socialProvider,i.socialWindow&&(this.socialWindow=i.socialWindow),i.address)){const r=this.remoteFeatures?.multiWallet;i.address!==this.address&&(this.hasMultipleConnections&&r?(f.replace("ProfileWallets"),C.showSuccess("New Wallet Added"),this.address=i.address):(I.state.open||h.state.enableEmbedded)&&I.close())}}),h.subscribeKey("remoteFeatures",i=>{this.remoteFeatures=i})),this.authConnector&&this.connectSocial()}disconnectedCallback(){this.unsubscribe.forEach(i=>i()),window.removeEventListener("message",this.handleSocialConnection,!1),!d.state.activeCaipAddress&&this.socialProvider&&!this.connecting&&u.sendEvent({type:"track",event:"SOCIAL_LOGIN_CANCELED",properties:{provider:this.socialProvider}}),this.closeSocialWindow()}render(){return c`
100
+ <wui-flex
101
+ data-error=${$(this.error)}
102
+ flexDirection="column"
103
+ alignItems="center"
104
+ .padding=${["10","5","5","5"]}
105
+ gap="6"
106
+ >
107
+ <wui-flex justifyContent="center" alignItems="center">
108
+ <wui-logo logo=${$(this.socialProvider)}></wui-logo>
109
+ ${this.error?null:this.loaderTemplate()}
110
+ <wui-icon-box color="error" icon="close" size="sm"></wui-icon-box>
111
+ </wui-flex>
112
+ <wui-flex flexDirection="column" alignItems="center" gap="2">
113
+ <wui-text align="center" variant="lg-medium" color="primary"
114
+ >Log in with
115
+ <span class="capitalize">${this.socialProvider??"Social"}</span></wui-text
116
+ >
117
+ <wui-text align="center" variant="lg-regular" color=${this.error?"error":"secondary"}
118
+ >${this.message}</wui-text
119
+ ></wui-flex
120
+ >
121
+ </wui-flex>
122
+ `}loaderTemplate(){const e=x.state.themeVariables["--w3m-border-radius-master"],i=e?parseInt(e.replace("px",""),10):4;return c`<wui-loading-thumbnail radius=${i*9}></wui-loading-thumbnail>`}parseURLError(e){try{const i="error=",r=e.indexOf(i);return r===-1?null:e.substring(r+i.length)}catch{return null}}connectSocial(){const e=setInterval(()=>{this.socialWindow?.closed&&(!this.connecting&&f.state.view==="ConnectingSocial"&&f.goBack(),clearInterval(e))},1e3);window.addEventListener("message",this.handleSocialConnection,!1)}updateMessage(){this.error?this.message="Something went wrong":this.connecting?this.message="Retrieving user data":this.message="Connect in the provider window"}handleSocialError(e){this.error=!0,this.updateMessage(),this.socialProvider&&u.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider,message:e}}),this.closeSocialWindow()}closeSocialWindow(){this.socialWindow&&(this.socialWindow.close(),d.setAccountProp("socialWindow",void 0,d.state.activeChain))}};m.styles=B;b([l()],m.prototype,"socialProvider",void 0);b([l()],m.prototype,"socialWindow",void 0);b([l()],m.prototype,"error",void 0);b([l()],m.prototype,"connecting",void 0);b([l()],m.prototype,"message",void 0);b([l()],m.prototype,"remoteFeatures",void 0);m=b([O("w3m-connecting-social-view")],m);const V=L`
123
+ wui-shimmer {
124
+ width: 100%;
125
+ aspect-ratio: 1 / 1;
126
+ border-radius: ${({borderRadius:t})=>t[4]};
127
+ }
128
+
129
+ wui-qr-code {
130
+ opacity: 0;
131
+ animation-duration: ${({durations:t})=>t.xl};
132
+ animation-timing-function: ${({easings:t})=>t["ease-out-power-2"]};
133
+ animation-name: fade-in;
134
+ animation-fill-mode: forwards;
135
+ }
136
+
137
+ wui-logo {
138
+ width: 80px;
139
+ height: 80px;
140
+ border-radius: ${({borderRadius:t})=>t[8]};
141
+ }
142
+
143
+ wui-flex:first-child:not(:only-child) {
144
+ position: relative;
145
+ }
146
+
147
+ wui-loading-thumbnail {
148
+ position: absolute;
149
+ }
150
+
151
+ wui-icon-box {
152
+ position: absolute;
153
+ right: calc(${({spacing:t})=>t[1]} * -1);
154
+ bottom: calc(${({spacing:t})=>t[1]} * -1);
155
+ opacity: 0;
156
+ transform: scale(0.5);
157
+ transition:
158
+ opacity ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]},
159
+ transform ${({durations:t})=>t.lg}
160
+ ${({easings:t})=>t["ease-out-power-2"]};
161
+ will-change: opacity, transform;
162
+ }
163
+
164
+ @keyframes fade-in {
165
+ from {
166
+ opacity: 0;
167
+ }
168
+ to {
169
+ opacity: 1;
170
+ }
171
+ }
172
+ `;var y=function(t,e,i,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o};let w=class extends _{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.socialProvider=d.getAccountData()?.socialProvider,this.uri=d.getAccountData()?.farcasterUrl,this.ready=!1,this.loading=!1,this.remoteFeatures=h.state.remoteFeatures,this.authConnector=E.getAuthConnector(),this.forceUpdate=()=>{this.requestUpdate()},this.unsubscribe.push(d.subscribeChainProp("accountState",e=>{this.socialProvider=e?.socialProvider,this.uri=e?.farcasterUrl,this.connectFarcaster()}),h.subscribeKey("remoteFeatures",e=>{this.remoteFeatures=e})),window.addEventListener("resize",this.forceUpdate)}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.timeout),window.removeEventListener("resize",this.forceUpdate),!d.state.activeCaipAddress&&this.socialProvider&&(this.uri||this.loading)&&u.sendEvent({type:"track",event:"SOCIAL_LOGIN_CANCELED",properties:{provider:this.socialProvider}})}render(){return this.onRenderProxy(),c`${this.platformTemplate()}`}platformTemplate(){return v.isMobile()?c`${this.mobileTemplate()}`:c`${this.desktopTemplate()}`}desktopTemplate(){return this.loading?c`${this.loadingTemplate()}`:c`${this.qrTemplate()}`}qrTemplate(){return c` <wui-flex
173
+ flexDirection="column"
174
+ alignItems="center"
175
+ .padding=${["0","5","5","5"]}
176
+ gap="5"
177
+ >
178
+ <wui-shimmer width="100%"> ${this.qrCodeTemplate()} </wui-shimmer>
179
+
180
+ <wui-text variant="lg-medium" color="primary"> Scan this QR Code with your phone </wui-text>
181
+ ${this.copyTemplate()}
182
+ </wui-flex>`}loadingTemplate(){return c`
183
+ <wui-flex
184
+ flexDirection="column"
185
+ alignItems="center"
186
+ .padding=${["5","5","5","5"]}
187
+ gap="5"
188
+ >
189
+ <wui-flex justifyContent="center" alignItems="center">
190
+ <wui-logo logo="farcaster"></wui-logo>
191
+ ${this.loaderTemplate()}
192
+ <wui-icon-box color="error" icon="close" size="sm"></wui-icon-box>
193
+ </wui-flex>
194
+ <wui-flex flexDirection="column" alignItems="center" gap="2">
195
+ <wui-text align="center" variant="md-medium" color="primary">
196
+ Loading user data
197
+ </wui-text>
198
+ <wui-text align="center" variant="sm-regular" color="secondary">
199
+ Please wait a moment while we load your data.
200
+ </wui-text>
201
+ </wui-flex>
202
+ </wui-flex>
203
+ `}mobileTemplate(){return c` <wui-flex
204
+ flexDirection="column"
205
+ alignItems="center"
206
+ .padding=${["10","5","5","5"]}
207
+ gap="5"
208
+ >
209
+ <wui-flex justifyContent="center" alignItems="center">
210
+ <wui-logo logo="farcaster"></wui-logo>
211
+ ${this.loaderTemplate()}
212
+ <wui-icon-box
213
+ color="error"
214
+ icon="close"
215
+ size="sm"
216
+ ></wui-icon-box>
217
+ </wui-flex>
218
+ <wui-flex flexDirection="column" alignItems="center" gap="2">
219
+ <wui-text align="center" variant="md-medium" color="primary"
220
+ >Continue in Farcaster</span></wui-text
221
+ >
222
+ <wui-text align="center" variant="sm-regular" color="secondary"
223
+ >Accept connection request in the app</wui-text
224
+ ></wui-flex
225
+ >
226
+ ${this.mobileLinkTemplate()}
227
+ </wui-flex>`}loaderTemplate(){const e=x.state.themeVariables["--w3m-border-radius-master"],i=e?parseInt(e.replace("px",""),10):4;return c`<wui-loading-thumbnail radius=${i*9}></wui-loading-thumbnail>`}async connectFarcaster(){if(this.authConnector)try{await this.authConnector?.provider.connectFarcaster(),this.socialProvider&&(A.setConnectedSocialProvider(this.socialProvider),u.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:this.socialProvider}})),this.loading=!0;const i=S.getConnections(this.authConnector.chain).length>0;await S.connectExternal(this.authConnector,this.authConnector.chain);const r=this.remoteFeatures?.multiWallet;this.socialProvider&&u.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider}}),this.loading=!1,i&&r?(f.replace("ProfileWallets"),C.showSuccess("New Wallet Added")):I.close()}catch(e){this.socialProvider&&u.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider,message:v.parseError(e)}}),f.goBack(),C.showError(e)}}mobileLinkTemplate(){return c`<wui-button
228
+ size="md"
229
+ ?loading=${this.loading}
230
+ ?disabled=${!this.uri||this.loading}
231
+ @click=${()=>{this.uri&&v.openHref(this.uri,"_blank")}}
232
+ >
233
+ Open farcaster</wui-button
234
+ >`}onRenderProxy(){!this.ready&&this.uri&&(this.timeout=setTimeout(()=>{this.ready=!0},200))}qrCodeTemplate(){if(!this.uri||!this.ready)return null;const e=this.getBoundingClientRect().width-40,i=x.state.themeVariables["--apkt-qr-color"]??x.state.themeVariables["--w3m-qr-color"];return c` <wui-qr-code
235
+ size=${e}
236
+ theme=${x.state.themeMode}
237
+ uri=${this.uri}
238
+ ?farcaster=${!0}
239
+ data-testid="wui-qr-code"
240
+ color=${$(i)}
241
+ ></wui-qr-code>`}copyTemplate(){const e=!this.uri||!this.ready;return c`<wui-button
242
+ .disabled=${e}
243
+ @click=${this.onCopyUri}
244
+ variant="neutral-secondary"
245
+ size="sm"
246
+ data-testid="copy-wc2-uri"
247
+ >
248
+ <wui-icon size="sm" color="default" slot="iconRight" name="copy"></wui-icon>
249
+ Copy link
250
+ </wui-button>`}onCopyUri(){try{this.uri&&(v.copyToClopboard(this.uri),C.showSuccess("Link copied"))}catch{C.showError("Failed to copy")}}};w.styles=V;y([l()],w.prototype,"socialProvider",void 0);y([l()],w.prototype,"uri",void 0);y([l()],w.prototype,"ready",void 0);y([l()],w.prototype,"loading",void 0);y([l()],w.prototype,"remoteFeatures",void 0);w=y([O("w3m-connecting-farcaster-view")],w);export{P as W3mConnectSocialsView,w as W3mConnectingFarcasterView,m as W3mConnectingSocialView};
assets/swaps-DEpZuVrQ.js ADDED
@@ -0,0 +1,1050 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cy as P,dd as l,cB as w,cC as I,cD as A,cT as v,cK as h,cE as u,cZ as z,cQ as N,cM as $,cV as M,du as K,cR as F,cS as Q,cz as O,cA as q,dL as L}from"./index-C-6muS97.js";import{S as r}from"./SwapController-DJdOQ0eQ.js";import"./index-ptQq3EiG.js";const H={numericInputKeyDown(e,t,o){const n=["Backspace","Meta","Ctrl","a","A","c","C","x","X","v","V","ArrowLeft","ArrowRight","Tab"],s=e.metaKey||e.ctrlKey,i=e.key,a=i.toLocaleLowerCase(),c=a==="a",C=a==="c",V=a==="v",W=a==="x",E=i===",",_=i===".",R=i>="0"&&i<="9";!s&&(c||C||V||W)&&e.preventDefault(),t==="0"&&!E&&!_&&i==="0"&&e.preventDefault(),t==="0"&&R&&(o(i),e.preventDefault()),(E||_)&&(t||(o("0."),e.preventDefault()),(t?.includes(".")||t?.includes(","))&&e.preventDefault()),!R&&!n.includes(i)&&!_&&!E&&e.preventDefault()}},G=P`
2
+ :host {
3
+ width: 100%;
4
+ }
5
+
6
+ .details-container > wui-flex {
7
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
8
+ border-radius: ${({borderRadius:e})=>e[3]};
9
+ width: 100%;
10
+ }
11
+
12
+ .details-container > wui-flex > button {
13
+ border: none;
14
+ background: none;
15
+ padding: ${({spacing:e})=>e[3]};
16
+ border-radius: ${({borderRadius:e})=>e[3]};
17
+ cursor: pointer;
18
+ }
19
+
20
+ .details-content-container {
21
+ padding: ${({spacing:e})=>e[2]};
22
+ padding-top: 0px;
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ }
27
+
28
+ .details-content-container > wui-flex {
29
+ width: 100%;
30
+ }
31
+
32
+ .details-row {
33
+ width: 100%;
34
+ padding: ${({spacing:e})=>e[3]};
35
+ padding-left: ${({spacing:e})=>e[3]};
36
+ padding-right: ${({spacing:e})=>e[2]};
37
+ border-radius: calc(
38
+ ${({borderRadius:e})=>e[1]} + ${({borderRadius:e})=>e[1]}
39
+ );
40
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
41
+ }
42
+
43
+ .details-row-title {
44
+ white-space: nowrap;
45
+ }
46
+
47
+ .details-row.provider-free-row {
48
+ padding-right: ${({spacing:e})=>e[2]};
49
+ }
50
+ `;var x=function(e,t,o,n){var s=arguments.length,i=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(s<3?a(i):s>3?a(t,o,i):a(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};const Y=z.CONVERT_SLIPPAGE_TOLERANCE;let g=class extends A{constructor(){super(),this.unsubscribe=[],this.networkName=v.state.activeCaipNetwork?.name,this.detailsOpen=!1,this.sourceToken=r.state.sourceToken,this.toToken=r.state.toToken,this.toTokenAmount=r.state.toTokenAmount,this.sourceTokenPriceInUSD=r.state.sourceTokenPriceInUSD,this.toTokenPriceInUSD=r.state.toTokenPriceInUSD,this.priceImpact=r.state.priceImpact,this.maxSlippage=r.state.maxSlippage,this.networkTokenSymbol=r.state.networkTokenSymbol,this.inputError=r.state.inputError,this.unsubscribe.push(r.subscribe(t=>{this.sourceToken=t.sourceToken,this.toToken=t.toToken,this.toTokenAmount=t.toTokenAmount,this.priceImpact=t.priceImpact,this.maxSlippage=t.maxSlippage,this.sourceTokenPriceInUSD=t.sourceTokenPriceInUSD,this.toTokenPriceInUSD=t.toTokenPriceInUSD,this.inputError=t.inputError}))}render(){const t=this.toTokenAmount&&this.maxSlippage?h.bigNumber(this.toTokenAmount).minus(this.maxSlippage).toString():null;if(!this.sourceToken||!this.toToken||this.inputError)return null;const o=this.sourceTokenPriceInUSD&&this.toTokenPriceInUSD?1/this.toTokenPriceInUSD*this.sourceTokenPriceInUSD:0;return u`
51
+ <wui-flex flexDirection="column" alignItems="center" gap="01" class="details-container">
52
+ <wui-flex flexDirection="column">
53
+ <button @click=${this.toggleDetails.bind(this)}>
54
+ <wui-flex justifyContent="space-between" .padding=${["0","2","0","2"]}>
55
+ <wui-flex justifyContent="flex-start" flexGrow="1" gap="2">
56
+ <wui-text variant="sm-regular" color="primary">
57
+ 1 ${this.sourceToken.symbol} =
58
+ ${h.formatNumberToLocalString(o,3)}
59
+ ${this.toToken.symbol}
60
+ </wui-text>
61
+ <wui-text variant="sm-regular" color="secondary">
62
+ $${h.formatNumberToLocalString(this.sourceTokenPriceInUSD)}
63
+ </wui-text>
64
+ </wui-flex>
65
+ <wui-icon name="chevronBottom"></wui-icon>
66
+ </wui-flex>
67
+ </button>
68
+ ${this.detailsOpen?u`
69
+ <wui-flex flexDirection="column" gap="2" class="details-content-container">
70
+ ${this.priceImpact?u` <wui-flex flexDirection="column" gap="2">
71
+ <wui-flex
72
+ justifyContent="space-between"
73
+ alignItems="center"
74
+ class="details-row"
75
+ >
76
+ <wui-flex alignItems="center" gap="2">
77
+ <wui-text
78
+ class="details-row-title"
79
+ variant="sm-regular"
80
+ color="secondary"
81
+ >
82
+ Price impact
83
+ </wui-text>
84
+ <w3m-tooltip-trigger
85
+ text="Price impact reflects the change in market price due to your trade"
86
+ >
87
+ <wui-icon size="sm" color="default" name="info"></wui-icon>
88
+ </w3m-tooltip-trigger>
89
+ </wui-flex>
90
+ <wui-flex>
91
+ <wui-text variant="sm-regular" color="secondary">
92
+ ${h.formatNumberToLocalString(this.priceImpact,3)}%
93
+ </wui-text>
94
+ </wui-flex>
95
+ </wui-flex>
96
+ </wui-flex>`:null}
97
+ ${this.maxSlippage&&this.sourceToken.symbol?u`<wui-flex flexDirection="column" gap="2">
98
+ <wui-flex
99
+ justifyContent="space-between"
100
+ alignItems="center"
101
+ class="details-row"
102
+ >
103
+ <wui-flex alignItems="center" gap="2">
104
+ <wui-text
105
+ class="details-row-title"
106
+ variant="sm-regular"
107
+ color="secondary"
108
+ >
109
+ Max. slippage
110
+ </wui-text>
111
+ <w3m-tooltip-trigger
112
+ text=${`Max slippage sets the minimum amount you must receive for the transaction to proceed. ${t?`Transaction will be reversed if you receive less than ${h.formatNumberToLocalString(t,6)} ${this.toToken.symbol} due to price changes.`:""}`}
113
+ >
114
+ <wui-icon size="sm" color="default" name="info"></wui-icon>
115
+ </w3m-tooltip-trigger>
116
+ </wui-flex>
117
+ <wui-flex>
118
+ <wui-text variant="sm-regular" color="secondary">
119
+ ${h.formatNumberToLocalString(this.maxSlippage,6)}
120
+ ${this.toToken.symbol} ${Y}%
121
+ </wui-text>
122
+ </wui-flex>
123
+ </wui-flex>
124
+ </wui-flex>`:null}
125
+ <wui-flex flexDirection="column" gap="2">
126
+ <wui-flex
127
+ justifyContent="space-between"
128
+ alignItems="center"
129
+ class="details-row provider-free-row"
130
+ >
131
+ <wui-flex alignItems="center" gap="2">
132
+ <wui-text class="details-row-title" variant="sm-regular" color="secondary">
133
+ Provider fee
134
+ </wui-text>
135
+ </wui-flex>
136
+ <wui-flex>
137
+ <wui-text variant="sm-regular" color="secondary">0.85%</wui-text>
138
+ </wui-flex>
139
+ </wui-flex>
140
+ </wui-flex>
141
+ </wui-flex>
142
+ `:null}
143
+ </wui-flex>
144
+ </wui-flex>
145
+ `}toggleDetails(){this.detailsOpen=!this.detailsOpen}};g.styles=[G];x([l()],g.prototype,"networkName",void 0);x([w()],g.prototype,"detailsOpen",void 0);x([l()],g.prototype,"sourceToken",void 0);x([l()],g.prototype,"toToken",void 0);x([l()],g.prototype,"toTokenAmount",void 0);x([l()],g.prototype,"sourceTokenPriceInUSD",void 0);x([l()],g.prototype,"toTokenPriceInUSD",void 0);x([l()],g.prototype,"priceImpact",void 0);x([l()],g.prototype,"maxSlippage",void 0);x([l()],g.prototype,"networkTokenSymbol",void 0);x([l()],g.prototype,"inputError",void 0);g=x([I("w3m-swap-details")],g);const Z=P`
146
+ :host {
147
+ width: 100%;
148
+ }
149
+
150
+ :host > wui-flex {
151
+ display: flex;
152
+ flex-direction: row;
153
+ justify-content: space-between;
154
+ align-items: center;
155
+ border-radius: ${({borderRadius:e})=>e[5]};
156
+ padding: ${({spacing:e})=>e[5]};
157
+ padding-right: ${({spacing:e})=>e[3]};
158
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
159
+ box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.theme.foregroundPrimary};
160
+ width: 100%;
161
+ height: 100px;
162
+ box-sizing: border-box;
163
+ position: relative;
164
+ }
165
+
166
+ wui-shimmer.market-value {
167
+ opacity: 0;
168
+ }
169
+
170
+ :host > wui-flex > svg.input_mask {
171
+ position: absolute;
172
+ inset: 0;
173
+ z-index: 5;
174
+ }
175
+
176
+ :host wui-flex .input_mask__border,
177
+ :host wui-flex .input_mask__background {
178
+ transition: fill ${({durations:e})=>e.md}
179
+ ${({easings:e})=>e["ease-out-power-1"]};
180
+ will-change: fill;
181
+ }
182
+
183
+ :host wui-flex .input_mask__border {
184
+ fill: ${({tokens:e})=>e.core.glass010};
185
+ }
186
+
187
+ :host wui-flex .input_mask__background {
188
+ fill: ${({tokens:e})=>e.theme.foregroundPrimary};
189
+ }
190
+ `;var B=function(e,t,o,n){var s=arguments.length,i=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(s<3?a(i):s>3?a(t,o,i):a(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};let U=class extends A{constructor(){super(...arguments),this.target="sourceToken"}render(){return u`
191
+ <wui-flex class justifyContent="space-between">
192
+ <wui-flex
193
+ flex="1"
194
+ flexDirection="column"
195
+ alignItems="flex-start"
196
+ justifyContent="center"
197
+ class="swap-input"
198
+ gap="1"
199
+ >
200
+ <wui-shimmer width="80px" height="40px" rounded variant="light"></wui-shimmer>
201
+ </wui-flex>
202
+ ${this.templateTokenSelectButton()}
203
+ </wui-flex>
204
+ `}templateTokenSelectButton(){return u`
205
+ <wui-flex
206
+ class="swap-token-button"
207
+ flexDirection="column"
208
+ alignItems="flex-end"
209
+ justifyContent="center"
210
+ gap="1"
211
+ >
212
+ <wui-shimmer width="80px" height="40px" rounded variant="light"></wui-shimmer>
213
+ </wui-flex>
214
+ `}};U.styles=[Z];B([w()],U.prototype,"target",void 0);U=B([I("w3m-swap-input-skeleton")],U);const X=P`
215
+ :host > wui-flex {
216
+ display: flex;
217
+ flex-direction: row;
218
+ justify-content: space-between;
219
+ align-items: center;
220
+ border-radius: ${({borderRadius:e})=>e[5]};
221
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
222
+ padding: ${({spacing:e})=>e[5]};
223
+ padding-right: ${({spacing:e})=>e[3]};
224
+ width: 100%;
225
+ height: 100px;
226
+ box-sizing: border-box;
227
+ box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.theme.foregroundPrimary};
228
+ position: relative;
229
+ transition: box-shadow ${({easings:e})=>e["ease-out-power-1"]}
230
+ ${({durations:e})=>e.lg};
231
+ will-change: background-color;
232
+ }
233
+
234
+ :host wui-flex.focus {
235
+ box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.core.glass010};
236
+ }
237
+
238
+ :host > wui-flex .swap-input,
239
+ :host > wui-flex .swap-token-button {
240
+ z-index: 10;
241
+ }
242
+
243
+ :host > wui-flex .swap-input {
244
+ -webkit-mask-image: linear-gradient(
245
+ 270deg,
246
+ transparent 0px,
247
+ transparent 8px,
248
+ black 24px,
249
+ black 25px,
250
+ black 32px,
251
+ black 100%
252
+ );
253
+ mask-image: linear-gradient(
254
+ 270deg,
255
+ transparent 0px,
256
+ transparent 8px,
257
+ black 24px,
258
+ black 25px,
259
+ black 32px,
260
+ black 100%
261
+ );
262
+ }
263
+
264
+ :host > wui-flex .swap-input input {
265
+ background: none;
266
+ border: none;
267
+ height: 42px;
268
+ width: 100%;
269
+ font-size: 32px;
270
+ font-style: normal;
271
+ font-weight: 400;
272
+ line-height: 130%;
273
+ letter-spacing: -1.28px;
274
+ outline: none;
275
+ caret-color: ${({tokens:e})=>e.core.textAccentPrimary};
276
+ color: ${({tokens:e})=>e.theme.textPrimary};
277
+ padding: 0px;
278
+ }
279
+
280
+ :host > wui-flex .swap-input input:focus-visible {
281
+ outline: none;
282
+ }
283
+
284
+ :host > wui-flex .swap-input input::-webkit-outer-spin-button,
285
+ :host > wui-flex .swap-input input::-webkit-inner-spin-button {
286
+ -webkit-appearance: none;
287
+ margin: 0;
288
+ }
289
+
290
+ .max-value-button {
291
+ background-color: transparent;
292
+ border: none;
293
+ cursor: pointer;
294
+ color: ${({tokens:e})=>e.core.glass010};
295
+ padding-left: 0px;
296
+ }
297
+
298
+ .market-value {
299
+ min-height: 18px;
300
+ }
301
+ `;var T=function(e,t,o,n){var s=arguments.length,i=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(s<3?a(i):s>3?a(t,o,i):a(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};const J=5e-5;let k=class extends A{constructor(){super(...arguments),this.focused=!1,this.price=0,this.target="sourceToken",this.onSetAmount=null,this.onSetMaxValue=null}render(){const t=this.marketValue||"0",o=h.bigNumber(t).gt("0");return u`
302
+ <wui-flex
303
+ class="${this.focused?"focus":""}"
304
+ justifyContent="space-between"
305
+ alignItems="center"
306
+ >
307
+ <wui-flex
308
+ flex="1"
309
+ flexDirection="column"
310
+ alignItems="flex-start"
311
+ justifyContent="center"
312
+ class="swap-input"
313
+ >
314
+ <input
315
+ data-testid="swap-input-${this.target}"
316
+ @focusin=${()=>this.onFocusChange(!0)}
317
+ @focusout=${()=>this.onFocusChange(!1)}
318
+ ?disabled=${this.disabled}
319
+ value=${this.value||""}
320
+ @input=${this.dispatchInputChangeEvent}
321
+ @keydown=${this.handleKeydown}
322
+ placeholder="0"
323
+ type="text"
324
+ inputmode="decimal"
325
+ pattern="[0-9,.]*"
326
+ />
327
+ <wui-text class="market-value" variant="sm-regular" color="secondary">
328
+ ${o?`$${h.formatNumberToLocalString(this.marketValue,2)}`:null}
329
+ </wui-text>
330
+ </wui-flex>
331
+ ${this.templateTokenSelectButton()}
332
+ </wui-flex>
333
+ `}handleKeydown(t){return H.numericInputKeyDown(t,this.value,o=>this.onSetAmount?.(this.target,o))}dispatchInputChangeEvent(t){if(!this.onSetAmount)return;const o=t.target.value.replace(/[^0-9.]/gu,"");o===","||o==="."?this.onSetAmount(this.target,"0."):o.endsWith(",")?this.onSetAmount(this.target,o.replace(",",".")):this.onSetAmount(this.target,o)}setMaxValueToInput(){this.onSetMaxValue?.(this.target,this.balance)}templateTokenSelectButton(){return this.token?u`
334
+ <wui-flex
335
+ class="swap-token-button"
336
+ flexDirection="column"
337
+ alignItems="flex-end"
338
+ justifyContent="center"
339
+ gap="1"
340
+ >
341
+ <wui-token-button
342
+ data-testid="swap-input-token-${this.target}"
343
+ text=${this.token.symbol}
344
+ imageSrc=${this.token.logoUri}
345
+ @click=${this.onSelectToken.bind(this)}
346
+ >
347
+ </wui-token-button>
348
+ <wui-flex alignItems="center" gap="1"> ${this.tokenBalanceTemplate()} </wui-flex>
349
+ </wui-flex>
350
+ `:u` <wui-button
351
+ data-testid="swap-select-token-button-${this.target}"
352
+ class="swap-token-button"
353
+ size="md"
354
+ variant="neutral-secondary"
355
+ @click=${this.onSelectToken.bind(this)}
356
+ >
357
+ Select token
358
+ </wui-button>`}tokenBalanceTemplate(){const t=h.multiply(this.balance,this.price),o=t?t?.gt(J):!1;return u`
359
+ ${o?u`<wui-text variant="sm-regular" color="secondary">
360
+ ${h.formatNumberToLocalString(this.balance,2)}
361
+ </wui-text>`:null}
362
+ ${this.target==="sourceToken"?this.tokenActionButtonTemplate(o):null}
363
+ `}tokenActionButtonTemplate(t){return t?u` <button class="max-value-button" @click=${this.setMaxValueToInput.bind(this)}>
364
+ <wui-text color="accent-primary" variant="sm-medium">Max</wui-text>
365
+ </button>`:u` <button class="max-value-button" @click=${this.onBuyToken.bind(this)}>
366
+ <wui-text color="accent-primary" variant="sm-medium">Buy</wui-text>
367
+ </button>`}onFocusChange(t){this.focused=t}onSelectToken(){N.sendEvent({type:"track",event:"CLICK_SELECT_TOKEN_TO_SWAP"}),$.push("SwapSelectToken",{target:this.target})}onBuyToken(){$.push("OnRampProviders")}};k.styles=[X];T([w()],k.prototype,"focused",void 0);T([w()],k.prototype,"balance",void 0);T([w()],k.prototype,"value",void 0);T([w()],k.prototype,"price",void 0);T([w()],k.prototype,"marketValue",void 0);T([w()],k.prototype,"disabled",void 0);T([w()],k.prototype,"target",void 0);T([w()],k.prototype,"token",void 0);T([w()],k.prototype,"onSetAmount",void 0);T([w()],k.prototype,"onSetMaxValue",void 0);k=T([I("w3m-swap-input")],k);const ee=P`
368
+ :host > wui-flex:first-child {
369
+ overflow-y: auto;
370
+ overflow-x: hidden;
371
+ scrollbar-width: none;
372
+ }
373
+
374
+ :host > wui-flex:first-child::-webkit-scrollbar {
375
+ display: none;
376
+ }
377
+
378
+ wui-loading-hexagon {
379
+ position: absolute;
380
+ }
381
+
382
+ .action-button {
383
+ width: 100%;
384
+ border-radius: ${({borderRadius:e})=>e[4]};
385
+ }
386
+
387
+ .action-button:disabled {
388
+ border-color: 1px solid ${({tokens:e})=>e.core.glass010};
389
+ }
390
+
391
+ .swap-inputs-container {
392
+ position: relative;
393
+ }
394
+
395
+ wui-icon-box {
396
+ width: 32px;
397
+ height: 32px;
398
+ border-radius: ${({borderRadius:e})=>e[10]} !important;
399
+ border: 4px solid ${({tokens:e})=>e.theme.backgroundPrimary};
400
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
401
+ position: absolute;
402
+ top: 50%;
403
+ left: 50%;
404
+ transform: translate(-50%, -50%);
405
+ z-index: 3;
406
+ }
407
+
408
+ .replace-tokens-button-container {
409
+ display: flex;
410
+ justify-content: center;
411
+ align-items: center;
412
+ position: absolute;
413
+ top: 50%;
414
+ left: 50%;
415
+ transform: translate(-50%, -50%);
416
+ gap: ${({spacing:e})=>e[2]};
417
+ border-radius: ${({borderRadius:e})=>e[4]};
418
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
419
+ padding: ${({spacing:e})=>e[2]};
420
+ }
421
+
422
+ .details-container > wui-flex {
423
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
424
+ border-radius: ${({borderRadius:e})=>e[3]};
425
+ width: 100%;
426
+ }
427
+
428
+ .details-container > wui-flex > button {
429
+ border: none;
430
+ background: none;
431
+ padding: ${({spacing:e})=>e[3]};
432
+ border-radius: ${({borderRadius:e})=>e[3]};
433
+ transition: background ${({durations:e})=>e.lg}
434
+ ${({easings:e})=>e["ease-out-power-2"]};
435
+ will-change: background;
436
+ }
437
+
438
+ .details-container > wui-flex > button:hover {
439
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
440
+ }
441
+
442
+ .details-content-container {
443
+ padding: ${({spacing:e})=>e[2]};
444
+ display: flex;
445
+ align-items: center;
446
+ justify-content: center;
447
+ }
448
+
449
+ .details-content-container > wui-flex {
450
+ width: 100%;
451
+ }
452
+
453
+ .details-row {
454
+ width: 100%;
455
+ padding: ${({spacing:e})=>e[3]} ${({spacing:e})=>e[5]};
456
+ border-radius: ${({borderRadius:e})=>e[3]};
457
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
458
+ }
459
+ `;var m=function(e,t,o,n){var s=arguments.length,i=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(s<3?a(i):s>3?a(t,o,i):a(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};let p=class extends A{subscribe({resetSwapState:t,initializeSwapState:o}){return()=>{v.subscribeKey("activeCaipNetwork",n=>this.onCaipNetworkChange({newCaipNetwork:n,resetSwapState:t,initializeSwapState:o})),v.subscribeChainProp("accountState",n=>{this.onCaipAddressChange({newCaipAddress:n?.caipAddress,resetSwapState:t,initializeSwapState:o})})}}constructor(){super(),this.unsubscribe=[],this.initialParams=$.state.data?.swap,this.detailsOpen=!1,this.caipAddress=v.getAccountData()?.caipAddress,this.caipNetworkId=v.state.activeCaipNetwork?.caipNetworkId,this.initialized=r.state.initialized,this.loadingQuote=r.state.loadingQuote,this.loadingPrices=r.state.loadingPrices,this.loadingTransaction=r.state.loadingTransaction,this.sourceToken=r.state.sourceToken,this.sourceTokenAmount=r.state.sourceTokenAmount,this.sourceTokenPriceInUSD=r.state.sourceTokenPriceInUSD,this.toToken=r.state.toToken,this.toTokenAmount=r.state.toTokenAmount,this.toTokenPriceInUSD=r.state.toTokenPriceInUSD,this.inputError=r.state.inputError,this.fetchError=r.state.fetchError,this.lastTokenPriceUpdate=0,this.minTokenPriceUpdateInterval=1e4,this.visibilityChangeHandler=()=>{document?.hidden?(clearInterval(this.interval),this.interval=void 0):this.startTokenPriceInterval()},this.startTokenPriceInterval=()=>{this.interval&&Date.now()-this.lastTokenPriceUpdate<this.minTokenPriceUpdateInterval||(this.lastTokenPriceUpdate&&Date.now()-this.lastTokenPriceUpdate>this.minTokenPriceUpdateInterval&&this.fetchTokensAndValues(),clearInterval(this.interval),this.interval=setInterval(()=>{this.fetchTokensAndValues()},this.minTokenPriceUpdateInterval))},this.watchTokensAndValues=()=>{!this.sourceToken||!this.toToken||(this.subscribeToVisibilityChange(),this.startTokenPriceInterval())},this.onDebouncedGetSwapCalldata=M.debounce(async()=>{await r.swapTokens()},200),this.subscribe({resetSwapState:!0,initializeSwapState:!1})(),this.unsubscribe.push(this.subscribe({resetSwapState:!1,initializeSwapState:!0}),K.subscribeKey("open",t=>{t||r.resetState()}),$.subscribeKey("view",t=>{t.includes("Swap")||r.resetValues()}),r.subscribe(t=>{this.initialized=t.initialized,this.loadingQuote=t.loadingQuote,this.loadingPrices=t.loadingPrices,this.loadingTransaction=t.loadingTransaction,this.sourceToken=t.sourceToken,this.sourceTokenAmount=t.sourceTokenAmount,this.sourceTokenPriceInUSD=t.sourceTokenPriceInUSD,this.toToken=t.toToken,this.toTokenAmount=t.toTokenAmount,this.toTokenPriceInUSD=t.toTokenPriceInUSD,this.inputError=t.inputError,this.fetchError=t.fetchError,t.sourceToken&&t.toToken&&this.watchTokensAndValues()}))}async firstUpdated(){r.initializeState(),this.watchTokensAndValues(),await this.handleSwapParameters()}disconnectedCallback(){this.unsubscribe.forEach(t=>t?.()),clearInterval(this.interval),document?.removeEventListener("visibilitychange",this.visibilityChangeHandler)}render(){return u`
460
+ <wui-flex flexDirection="column" .padding=${["0","4","4","4"]} gap="3">
461
+ ${this.initialized?this.templateSwap():this.templateLoading()}
462
+ </wui-flex>
463
+ `}subscribeToVisibilityChange(){document?.removeEventListener("visibilitychange",this.visibilityChangeHandler),document?.addEventListener("visibilitychange",this.visibilityChangeHandler)}fetchTokensAndValues(){r.getNetworkTokenPrice(),r.getMyTokensWithBalance(),r.swapTokens(),this.lastTokenPriceUpdate=Date.now()}templateSwap(){return u`
464
+ <wui-flex flexDirection="column" gap="3">
465
+ <wui-flex flexDirection="column" alignItems="center" gap="2" class="swap-inputs-container">
466
+ ${this.templateTokenInput("sourceToken",this.sourceToken)}
467
+ ${this.templateTokenInput("toToken",this.toToken)} ${this.templateReplaceTokensButton()}
468
+ </wui-flex>
469
+ ${this.templateDetails()} ${this.templateActionButton()}
470
+ </wui-flex>
471
+ `}actionButtonLabel(){const t=!this.sourceTokenAmount||this.sourceTokenAmount==="0";return this.fetchError?"Swap":!this.sourceToken||!this.toToken?"Select token":t?"Enter amount":this.inputError?this.inputError:"Review swap"}templateReplaceTokensButton(){return u`
472
+ <wui-flex class="replace-tokens-button-container">
473
+ <wui-icon-box
474
+ @click=${this.onSwitchTokens.bind(this)}
475
+ icon="recycleHorizontal"
476
+ size="md"
477
+ variant="default"
478
+ ></wui-icon-box>
479
+ </wui-flex>
480
+ `}templateLoading(){return u`
481
+ <wui-flex flexDirection="column" gap="4">
482
+ <wui-flex flexDirection="column" alignItems="center" gap="2" class="swap-inputs-container">
483
+ <w3m-swap-input-skeleton target="sourceToken"></w3m-swap-input-skeleton>
484
+ <w3m-swap-input-skeleton target="toToken"></w3m-swap-input-skeleton>
485
+ ${this.templateReplaceTokensButton()}
486
+ </wui-flex>
487
+ ${this.templateActionButton()}
488
+ </wui-flex>
489
+ `}templateTokenInput(t,o){const n=r.state.myTokensWithBalance?.find(c=>c?.address===o?.address),s=t==="toToken"?this.toTokenAmount:this.sourceTokenAmount,i=t==="toToken"?this.toTokenPriceInUSD:this.sourceTokenPriceInUSD,a=h.parseLocalStringToNumber(s)*i;return u`<w3m-swap-input
490
+ .value=${t==="toToken"?this.toTokenAmount:this.sourceTokenAmount}
491
+ .disabled=${t==="toToken"}
492
+ .onSetAmount=${this.handleChangeAmount.bind(this)}
493
+ target=${t}
494
+ .token=${o}
495
+ .balance=${n?.quantity?.numeric}
496
+ .price=${n?.price}
497
+ .marketValue=${a}
498
+ .onSetMaxValue=${this.onSetMaxValue.bind(this)}
499
+ ></w3m-swap-input>`}onSetMaxValue(t,o){const n=h.bigNumber(o||"0");this.handleChangeAmount(t,n.gt(0)?n.toFixed(20):"0")}templateDetails(){return!this.sourceToken||!this.toToken||this.inputError?null:u`<w3m-swap-details .detailsOpen=${this.detailsOpen}></w3m-swap-details>`}handleChangeAmount(t,o){r.clearError(),t==="sourceToken"?r.setSourceTokenAmount(o):r.setToTokenAmount(o),this.onDebouncedGetSwapCalldata()}templateActionButton(){const t=!this.toToken||!this.sourceToken,o=!this.sourceTokenAmount||this.sourceTokenAmount==="0",n=this.loadingQuote||this.loadingPrices||this.loadingTransaction,s=n||t||o||this.inputError;return u` <wui-flex gap="2">
500
+ <wui-button
501
+ data-testid="swap-action-button"
502
+ class="action-button"
503
+ fullWidth
504
+ size="lg"
505
+ borderRadius="xs"
506
+ variant="accent-primary"
507
+ ?loading=${!!n}
508
+ ?disabled=${!!s}
509
+ @click=${this.onSwapPreview.bind(this)}
510
+ >
511
+ ${this.actionButtonLabel()}
512
+ </wui-button>
513
+ </wui-flex>`}async onSwitchTokens(){await r.switchTokens()}async onSwapPreview(){this.fetchError&&await r.swapTokens(),N.sendEvent({type:"track",event:"INITIATE_SWAP",properties:{network:this.caipNetworkId||"",swapFromToken:this.sourceToken?.symbol||"",swapToToken:this.toToken?.symbol||"",swapFromAmount:this.sourceTokenAmount||"",swapToAmount:this.toTokenAmount||"",isSmartAccount:F(v.state.activeChain)===Q.ACCOUNT_TYPES.SMART_ACCOUNT}}),$.push("SwapPreview")}async handleSwapParameters(){this.initialParams&&(r.state.initialized||await new Promise(o=>{const n=r.subscribeKey("initialized",s=>{s&&(n?.(),o())})}),await this.setSwapParameters(this.initialParams))}async setSwapParameters({amount:t,fromToken:o,toToken:n}){(!r.state.tokens||!r.state.myTokensWithBalance)&&await new Promise(a=>{const c=r.subscribeKey("myTokensWithBalance",C=>{C&&C.length>0&&(c?.(),a())});setTimeout(()=>{c?.(),a()},5e3)});const s=[...r.state.tokens||[],...r.state.myTokensWithBalance||[]];if(o){const i=s.find(a=>a.symbol.toLowerCase()===o.toLowerCase());i&&r.setSourceToken(i)}if(n){const i=s.find(a=>a.symbol.toLowerCase()===n.toLowerCase());i&&r.setToToken(i)}t&&!isNaN(Number(t))&&r.setSourceTokenAmount(t)}onCaipAddressChange({newCaipAddress:t,resetSwapState:o,initializeSwapState:n}){this.caipAddress!==t&&(this.caipAddress=t,o&&r.resetState(),n&&r.initializeState())}onCaipNetworkChange({newCaipNetwork:t,resetSwapState:o,initializeSwapState:n}){this.caipNetworkId!==t?.caipNetworkId&&(this.caipNetworkId=t?.caipNetworkId,o&&r.resetState(),n&&r.initializeState())}};p.styles=ee;m([w({type:Object})],p.prototype,"initialParams",void 0);m([l()],p.prototype,"interval",void 0);m([l()],p.prototype,"detailsOpen",void 0);m([l()],p.prototype,"caipAddress",void 0);m([l()],p.prototype,"caipNetworkId",void 0);m([l()],p.prototype,"initialized",void 0);m([l()],p.prototype,"loadingQuote",void 0);m([l()],p.prototype,"loadingPrices",void 0);m([l()],p.prototype,"loadingTransaction",void 0);m([l()],p.prototype,"sourceToken",void 0);m([l()],p.prototype,"sourceTokenAmount",void 0);m([l()],p.prototype,"sourceTokenPriceInUSD",void 0);m([l()],p.prototype,"toToken",void 0);m([l()],p.prototype,"toTokenAmount",void 0);m([l()],p.prototype,"toTokenPriceInUSD",void 0);m([l()],p.prototype,"inputError",void 0);m([l()],p.prototype,"fetchError",void 0);m([l()],p.prototype,"lastTokenPriceUpdate",void 0);p=m([I("w3m-swap-view")],p);const te=P`
514
+ :host > wui-flex:first-child {
515
+ overflow-y: auto;
516
+ overflow-x: hidden;
517
+ scrollbar-width: none;
518
+ }
519
+
520
+ :host > wui-flex:first-child::-webkit-scrollbar {
521
+ display: none;
522
+ }
523
+
524
+ .preview-container,
525
+ .details-container {
526
+ width: 100%;
527
+ }
528
+
529
+ .token-image {
530
+ width: 24px;
531
+ height: 24px;
532
+ box-shadow: 0 0 0 2px ${({tokens:e})=>e.core.glass010};
533
+ border-radius: 12px;
534
+ }
535
+
536
+ wui-loading-hexagon {
537
+ position: absolute;
538
+ }
539
+
540
+ .token-item {
541
+ display: flex;
542
+ align-items: center;
543
+ justify-content: center;
544
+ gap: ${({spacing:e})=>e[2]};
545
+ padding: ${({spacing:e})=>e[2]};
546
+ height: 40px;
547
+ border: none;
548
+ border-radius: 80px;
549
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
550
+ box-shadow: inset 0 0 0 1px ${({tokens:e})=>e.theme.foregroundPrimary};
551
+ cursor: pointer;
552
+ transition: background ${({durations:e})=>e.lg}
553
+ ${({easings:e})=>e["ease-out-power-2"]};
554
+ will-change: background;
555
+ }
556
+
557
+ .token-item:hover {
558
+ background: ${({tokens:e})=>e.core.glass010};
559
+ }
560
+
561
+ .preview-token-details-container {
562
+ width: 100%;
563
+ }
564
+
565
+ .details-row {
566
+ width: 100%;
567
+ padding: ${({spacing:e})=>e[3]} ${({spacing:e})=>e[5]};
568
+ border-radius: ${({borderRadius:e})=>e[3]};
569
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
570
+ }
571
+
572
+ .action-buttons-container {
573
+ width: 100%;
574
+ gap: ${({spacing:e})=>e[2]};
575
+ }
576
+
577
+ .action-buttons-container > button {
578
+ display: flex;
579
+ align-items: center;
580
+ justify-content: center;
581
+ background: transparent;
582
+ height: 48px;
583
+ border-radius: ${({borderRadius:e})=>e[4]};
584
+ border: none;
585
+ box-shadow: inset 0 0 0 1px ${({tokens:e})=>e.core.glass010};
586
+ }
587
+
588
+ .action-buttons-container > button:disabled {
589
+ opacity: 0.8;
590
+ cursor: not-allowed;
591
+ }
592
+
593
+ .action-button > wui-loading-spinner {
594
+ display: inline-block;
595
+ }
596
+
597
+ .cancel-button:hover,
598
+ .action-button:hover {
599
+ cursor: pointer;
600
+ }
601
+
602
+ .action-buttons-container > wui-button.cancel-button {
603
+ flex: 2;
604
+ }
605
+
606
+ .action-buttons-container > wui-button.action-button {
607
+ flex: 4;
608
+ }
609
+
610
+ .action-buttons-container > button.action-button > wui-text {
611
+ color: white;
612
+ }
613
+
614
+ .details-container > wui-flex {
615
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
616
+ border-radius: ${({borderRadius:e})=>e[3]};
617
+ width: 100%;
618
+ }
619
+
620
+ .details-container > wui-flex > button {
621
+ border: none;
622
+ background: none;
623
+ padding: ${({spacing:e})=>e[3]};
624
+ border-radius: ${({borderRadius:e})=>e[3]};
625
+ transition: background ${({durations:e})=>e.lg}
626
+ ${({easings:e})=>e["ease-out-power-2"]};
627
+ will-change: background;
628
+ }
629
+
630
+ .details-container > wui-flex > button:hover {
631
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
632
+ }
633
+
634
+ .details-content-container {
635
+ padding: ${({spacing:e})=>e[2]};
636
+ display: flex;
637
+ align-items: center;
638
+ justify-content: center;
639
+ }
640
+
641
+ .details-content-container > wui-flex {
642
+ width: 100%;
643
+ }
644
+
645
+ .details-row {
646
+ width: 100%;
647
+ padding: ${({spacing:e})=>e[3]} ${({spacing:e})=>e[5]};
648
+ border-radius: ${({borderRadius:e})=>e[3]};
649
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
650
+ }
651
+ `;var f=function(e,t,o,n){var s=arguments.length,i=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(s<3?a(i):s>3?a(t,o,i):a(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};let d=class extends A{constructor(){super(),this.unsubscribe=[],this.detailsOpen=!0,this.approvalTransaction=r.state.approvalTransaction,this.swapTransaction=r.state.swapTransaction,this.sourceToken=r.state.sourceToken,this.sourceTokenAmount=r.state.sourceTokenAmount??"",this.sourceTokenPriceInUSD=r.state.sourceTokenPriceInUSD,this.balanceSymbol=v.getAccountData()?.balanceSymbol,this.toToken=r.state.toToken,this.toTokenAmount=r.state.toTokenAmount??"",this.toTokenPriceInUSD=r.state.toTokenPriceInUSD,this.caipNetwork=v.state.activeCaipNetwork,this.inputError=r.state.inputError,this.loadingQuote=r.state.loadingQuote,this.loadingApprovalTransaction=r.state.loadingApprovalTransaction,this.loadingBuildTransaction=r.state.loadingBuildTransaction,this.loadingTransaction=r.state.loadingTransaction,this.unsubscribe.push(v.subscribeChainProp("accountState",t=>{t?.balanceSymbol!==this.balanceSymbol&&$.goBack()}),v.subscribeKey("activeCaipNetwork",t=>{this.caipNetwork!==t&&(this.caipNetwork=t)}),r.subscribe(t=>{this.approvalTransaction=t.approvalTransaction,this.swapTransaction=t.swapTransaction,this.sourceToken=t.sourceToken,this.toToken=t.toToken,this.toTokenPriceInUSD=t.toTokenPriceInUSD,this.sourceTokenAmount=t.sourceTokenAmount??"",this.toTokenAmount=t.toTokenAmount??"",this.inputError=t.inputError,t.inputError&&$.goBack(),this.loadingQuote=t.loadingQuote,this.loadingApprovalTransaction=t.loadingApprovalTransaction,this.loadingBuildTransaction=t.loadingBuildTransaction,this.loadingTransaction=t.loadingTransaction}))}firstUpdated(){r.getTransaction(),this.refreshTransaction()}disconnectedCallback(){this.unsubscribe.forEach(t=>t?.()),clearInterval(this.interval)}render(){return u`
652
+ <wui-flex flexDirection="column" .padding=${["0","4","4","4"]} gap="3">
653
+ ${this.templateSwap()}
654
+ </wui-flex>
655
+ `}refreshTransaction(){this.interval=setInterval(()=>{r.getApprovalLoadingState()||r.getTransaction()},1e4)}templateSwap(){const t=`${h.formatNumberToLocalString(parseFloat(this.sourceTokenAmount))} ${this.sourceToken?.symbol}`,o=`${h.formatNumberToLocalString(parseFloat(this.toTokenAmount))} ${this.toToken?.symbol}`,n=parseFloat(this.sourceTokenAmount)*this.sourceTokenPriceInUSD,s=parseFloat(this.toTokenAmount)*this.toTokenPriceInUSD,i=h.formatNumberToLocalString(n),a=h.formatNumberToLocalString(s),c=this.loadingQuote||this.loadingBuildTransaction||this.loadingTransaction||this.loadingApprovalTransaction;return u`
656
+ <wui-flex flexDirection="column" alignItems="center" gap="4">
657
+ <wui-flex class="preview-container" flexDirection="column" alignItems="flex-start" gap="4">
658
+ <wui-flex
659
+ class="preview-token-details-container"
660
+ alignItems="center"
661
+ justifyContent="space-between"
662
+ gap="4"
663
+ >
664
+ <wui-flex flexDirection="column" alignItems="flex-start" gap="01">
665
+ <wui-text variant="sm-regular" color="secondary">Send</wui-text>
666
+ <wui-text variant="md-regular" color="primary">$${i}</wui-text>
667
+ </wui-flex>
668
+ <wui-token-button
669
+ flexDirection="row-reverse"
670
+ text=${t}
671
+ imageSrc=${this.sourceToken?.logoUri}
672
+ >
673
+ </wui-token-button>
674
+ </wui-flex>
675
+ <wui-icon name="recycleHorizontal" color="default" size="md"></wui-icon>
676
+ <wui-flex
677
+ class="preview-token-details-container"
678
+ alignItems="center"
679
+ justifyContent="space-between"
680
+ gap="4"
681
+ >
682
+ <wui-flex flexDirection="column" alignItems="flex-start" gap="01">
683
+ <wui-text variant="sm-regular" color="secondary">Receive</wui-text>
684
+ <wui-text variant="md-regular" color="primary">$${a}</wui-text>
685
+ </wui-flex>
686
+ <wui-token-button
687
+ flexDirection="row-reverse"
688
+ text=${o}
689
+ imageSrc=${this.toToken?.logoUri}
690
+ >
691
+ </wui-token-button>
692
+ </wui-flex>
693
+ </wui-flex>
694
+
695
+ ${this.templateDetails()}
696
+
697
+ <wui-flex flexDirection="row" alignItems="center" justifyContent="center" gap="2">
698
+ <wui-icon size="sm" color="default" name="info"></wui-icon>
699
+ <wui-text variant="sm-regular" color="secondary">Review transaction carefully</wui-text>
700
+ </wui-flex>
701
+
702
+ <wui-flex
703
+ class="action-buttons-container"
704
+ flexDirection="row"
705
+ alignItems="center"
706
+ justifyContent="space-between"
707
+ gap="2"
708
+ >
709
+ <wui-button
710
+ class="cancel-button"
711
+ fullWidth
712
+ size="lg"
713
+ borderRadius="xs"
714
+ variant="neutral-secondary"
715
+ @click=${this.onCancelTransaction.bind(this)}
716
+ >
717
+ <wui-text variant="md-medium" color="secondary">Cancel</wui-text>
718
+ </wui-button>
719
+ <wui-button
720
+ class="action-button"
721
+ fullWidth
722
+ size="lg"
723
+ borderRadius="xs"
724
+ variant="accent-primary"
725
+ ?loading=${c}
726
+ ?disabled=${c}
727
+ @click=${this.onSendTransaction.bind(this)}
728
+ >
729
+ <wui-text variant="md-medium" color="invert"> ${this.actionButtonLabel()} </wui-text>
730
+ </wui-button>
731
+ </wui-flex>
732
+ </wui-flex>
733
+ `}templateDetails(){return!this.sourceToken||!this.toToken||this.inputError?null:u`<w3m-swap-details .detailsOpen=${this.detailsOpen}></w3m-swap-details>`}actionButtonLabel(){return this.loadingApprovalTransaction?"Approving...":this.approvalTransaction?"Approve":"Swap"}onCancelTransaction(){$.goBack()}onSendTransaction(){this.approvalTransaction?r.sendTransactionForApproval(this.approvalTransaction):r.sendTransactionForSwap(this.swapTransaction)}};d.styles=te;f([l()],d.prototype,"interval",void 0);f([l()],d.prototype,"detailsOpen",void 0);f([l()],d.prototype,"approvalTransaction",void 0);f([l()],d.prototype,"swapTransaction",void 0);f([l()],d.prototype,"sourceToken",void 0);f([l()],d.prototype,"sourceTokenAmount",void 0);f([l()],d.prototype,"sourceTokenPriceInUSD",void 0);f([l()],d.prototype,"balanceSymbol",void 0);f([l()],d.prototype,"toToken",void 0);f([l()],d.prototype,"toTokenAmount",void 0);f([l()],d.prototype,"toTokenPriceInUSD",void 0);f([l()],d.prototype,"caipNetwork",void 0);f([l()],d.prototype,"inputError",void 0);f([l()],d.prototype,"loadingQuote",void 0);f([l()],d.prototype,"loadingApprovalTransaction",void 0);f([l()],d.prototype,"loadingBuildTransaction",void 0);f([l()],d.prototype,"loadingTransaction",void 0);d=f([I("w3m-swap-preview-view")],d);const oe=P`
734
+ :host {
735
+ width: 100%;
736
+ height: 60px;
737
+ min-height: 60px;
738
+ }
739
+
740
+ :host > wui-flex {
741
+ cursor: pointer;
742
+ height: 100%;
743
+ display: flex;
744
+ column-gap: ${({spacing:e})=>e[3]};
745
+ padding: ${({spacing:e})=>e[2]};
746
+ padding-right: ${({spacing:e})=>e[4]};
747
+ width: 100%;
748
+ background-color: transparent;
749
+ border-radius: ${({borderRadius:e})=>e[4]};
750
+ color: ${({tokens:e})=>e.theme.foregroundSecondary};
751
+ transition:
752
+ background-color ${({durations:e})=>e.lg}
753
+ ${({easings:e})=>e["ease-out-power-2"]},
754
+ opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]};
755
+ will-change: background-color, opacity;
756
+ }
757
+
758
+ @media (hover: hover) and (pointer: fine) {
759
+ :host > wui-flex:hover {
760
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
761
+ }
762
+
763
+ :host > wui-flex:active {
764
+ background-color: ${({tokens:e})=>e.core.glass010};
765
+ }
766
+ }
767
+
768
+ :host([disabled]) > wui-flex {
769
+ opacity: 0.6;
770
+ }
771
+
772
+ :host([disabled]) > wui-flex:hover {
773
+ background-color: transparent;
774
+ }
775
+
776
+ :host > wui-flex > wui-flex {
777
+ flex: 1;
778
+ }
779
+
780
+ :host > wui-flex > wui-image,
781
+ :host > wui-flex > .token-item-image-placeholder {
782
+ width: 40px;
783
+ max-width: 40px;
784
+ height: 40px;
785
+ border-radius: ${({borderRadius:e})=>e[20]};
786
+ position: relative;
787
+ }
788
+
789
+ :host > wui-flex > .token-item-image-placeholder {
790
+ display: flex;
791
+ align-items: center;
792
+ justify-content: center;
793
+ }
794
+
795
+ :host > wui-flex > wui-image::after,
796
+ :host > wui-flex > .token-item-image-placeholder::after {
797
+ position: absolute;
798
+ content: '';
799
+ inset: 0;
800
+ box-shadow: inset 0 0 0 1px ${({tokens:e})=>e.core.glass010};
801
+ border-radius: ${({borderRadius:e})=>e[8]};
802
+ }
803
+
804
+ button > wui-icon-box[data-variant='square-blue'] {
805
+ border-radius: ${({borderRadius:e})=>e[2]};
806
+ position: relative;
807
+ border: none;
808
+ width: 36px;
809
+ height: 36px;
810
+ }
811
+ `;var D=function(e,t,o,n){var s=arguments.length,i=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(s<3?a(i):s>3?a(t,o,i):a(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};let S=class extends A{constructor(){super(),this.observer=new IntersectionObserver(()=>{}),this.imageSrc=void 0,this.name=void 0,this.symbol=void 0,this.price=void 0,this.amount=void 0,this.visible=!1,this.imageError=!1,this.observer=new IntersectionObserver(t=>{t.forEach(o=>{o.isIntersecting?this.visible=!0:this.visible=!1})},{threshold:.1})}firstUpdated(){this.observer.observe(this)}disconnectedCallback(){this.observer.disconnect()}render(){if(!this.visible)return null;const t=this.amount&&this.price?h.multiply(this.price,this.amount)?.toFixed(3):null;return u`
812
+ <wui-flex alignItems="center">
813
+ ${this.visualTemplate()}
814
+ <wui-flex flexDirection="column" gap="1">
815
+ <wui-flex justifyContent="space-between">
816
+ <wui-text variant="md-medium" color="primary" lineClamp="1">${this.name}</wui-text>
817
+ ${t?u`
818
+ <wui-text variant="md-medium" color="primary">
819
+ $${h.formatNumberToLocalString(t,3)}
820
+ </wui-text>
821
+ `:null}
822
+ </wui-flex>
823
+ <wui-flex justifyContent="space-between">
824
+ <wui-text variant="sm-regular" color="secondary" lineClamp="1">${this.symbol}</wui-text>
825
+ ${this.amount?u`<wui-text variant="sm-regular" color="secondary">
826
+ ${h.formatNumberToLocalString(this.amount,5)}
827
+ </wui-text>`:null}
828
+ </wui-flex>
829
+ </wui-flex>
830
+ </wui-flex>
831
+ `}visualTemplate(){return this.imageError?u`<wui-flex class="token-item-image-placeholder">
832
+ <wui-icon name="image" color="inherit"></wui-icon>
833
+ </wui-flex>`:this.imageSrc?u`<wui-image
834
+ width="40"
835
+ height="40"
836
+ src=${this.imageSrc}
837
+ @onLoadError=${this.imageLoadError}
838
+ ></wui-image>`:null}imageLoadError(){this.imageError=!0}};S.styles=[O,q,oe];D([w()],S.prototype,"imageSrc",void 0);D([w()],S.prototype,"name",void 0);D([w()],S.prototype,"symbol",void 0);D([w()],S.prototype,"price",void 0);D([w()],S.prototype,"amount",void 0);D([l()],S.prototype,"visible",void 0);D([l()],S.prototype,"imageError",void 0);S=D([I("wui-token-list-item")],S);const ie=P`
839
+ :host {
840
+ width: 100%;
841
+ }
842
+
843
+ :host > wui-flex {
844
+ cursor: pointer;
845
+ height: 100%;
846
+ width: 100%;
847
+ display: flex;
848
+ column-gap: ${({spacing:e})=>e[3]};
849
+ padding: ${({spacing:e})=>e[2]};
850
+ padding-right: ${({spacing:e})=>e[4]};
851
+ }
852
+
853
+ wui-flex {
854
+ display: flex;
855
+ flex: 1;
856
+ }
857
+ `;var ne=function(e,t,o,n){var s=arguments.length,i=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(s<3?a(i):s>3?a(t,o,i):a(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};let j=class extends A{render(){return u`
858
+ <wui-flex alignItems="center">
859
+ <wui-shimmer width="40px" height="40px"></wui-shimmer>
860
+ <wui-flex flexDirection="column" gap="1">
861
+ <wui-shimmer width="72px" height="16px" borderRadius="4xs"></wui-shimmer>
862
+ <wui-shimmer width="148px" height="14px" borderRadius="4xs"></wui-shimmer>
863
+ </wui-flex>
864
+ <wui-flex flexDirection="column" gap="1" alignItems="flex-end">
865
+ <wui-shimmer width="24px" height="12px" borderRadius="4xs"></wui-shimmer>
866
+ <wui-shimmer width="32px" height="12px" borderRadius="4xs"></wui-shimmer>
867
+ </wui-flex>
868
+ </wui-flex>
869
+ `}};j.styles=[O,ie];j=ne([I("wui-token-list-item-loader")],j);const re=P`
870
+ :host {
871
+ --tokens-scroll--top-opacity: 0;
872
+ --tokens-scroll--bottom-opacity: 1;
873
+ --suggested-tokens-scroll--left-opacity: 0;
874
+ --suggested-tokens-scroll--right-opacity: 1;
875
+ }
876
+
877
+ :host > wui-flex:first-child {
878
+ overflow-y: hidden;
879
+ overflow-x: hidden;
880
+ scrollbar-width: none;
881
+ scrollbar-height: none;
882
+ }
883
+
884
+ :host > wui-flex:first-child::-webkit-scrollbar {
885
+ display: none;
886
+ }
887
+
888
+ wui-loading-hexagon {
889
+ position: absolute;
890
+ }
891
+
892
+ .suggested-tokens-container {
893
+ overflow-x: auto;
894
+ mask-image: linear-gradient(
895
+ to right,
896
+ rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 0px,
897
+ rgba(200, 200, 200, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 1px,
898
+ black 50px,
899
+ black 90px,
900
+ black calc(100% - 90px),
901
+ black calc(100% - 50px),
902
+ rgba(155, 155, 155, calc(1 - var(--suggested-tokens-scroll--right-opacity))) calc(100% - 1px),
903
+ rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--right-opacity))) 100%
904
+ );
905
+ }
906
+
907
+ .suggested-tokens-container::-webkit-scrollbar {
908
+ display: none;
909
+ }
910
+
911
+ .tokens-container {
912
+ border-top: 1px solid ${({tokens:e})=>e.core.glass010};
913
+ height: 100%;
914
+ max-height: 390px;
915
+ }
916
+
917
+ .tokens {
918
+ width: 100%;
919
+ overflow-y: auto;
920
+ mask-image: linear-gradient(
921
+ to bottom,
922
+ rgba(0, 0, 0, calc(1 - var(--tokens-scroll--top-opacity))) 0px,
923
+ rgba(200, 200, 200, calc(1 - var(--tokens-scroll--top-opacity))) 1px,
924
+ black 50px,
925
+ black 90px,
926
+ black calc(100% - 90px),
927
+ black calc(100% - 50px),
928
+ rgba(155, 155, 155, calc(1 - var(--tokens-scroll--bottom-opacity))) calc(100% - 1px),
929
+ rgba(0, 0, 0, calc(1 - var(--tokens-scroll--bottom-opacity))) 100%
930
+ );
931
+ }
932
+
933
+ .network-search-input,
934
+ .select-network-button {
935
+ height: 40px;
936
+ }
937
+
938
+ .select-network-button {
939
+ border: none;
940
+ display: flex;
941
+ flex-direction: row;
942
+ align-items: center;
943
+ justify-content: center;
944
+ gap: ${({spacing:e})=>e[2]};
945
+ box-shadow: inset 0 0 0 1px ${({tokens:e})=>e.core.glass010};
946
+ background-color: transparent;
947
+ border-radius: ${({borderRadius:e})=>e[3]};
948
+ padding: ${({spacing:e})=>e[2]};
949
+ align-items: center;
950
+ transition: background-color ${({durations:e})=>e.lg}
951
+ ${({easings:e})=>e["ease-out-power-2"]};
952
+ will-change: background-color;
953
+ }
954
+
955
+ .select-network-button:hover {
956
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
957
+ }
958
+
959
+ .select-network-button > wui-image {
960
+ width: 26px;
961
+ height: 26px;
962
+ border-radius: ${({borderRadius:e})=>e[4]};
963
+ box-shadow: inset 0 0 0 1px ${({tokens:e})=>e.core.glass010};
964
+ }
965
+ `;var y=function(e,t,o,n){var s=arguments.length,i=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(s<3?a(i):s>3?a(t,o,i):a(t,o))||i);return s>3&&i&&Object.defineProperty(t,o,i),i};let b=class extends A{constructor(){super(),this.unsubscribe=[],this.targetToken=$.state.data?.target,this.sourceToken=r.state.sourceToken,this.sourceTokenAmount=r.state.sourceTokenAmount,this.toToken=r.state.toToken,this.myTokensWithBalance=r.state.myTokensWithBalance,this.popularTokens=r.state.popularTokens,this.suggestedTokens=r.state.suggestedTokens,this.tokensLoading=r.state.tokensLoading,this.searchValue="",this.unsubscribe.push(r.subscribe(t=>{this.sourceToken=t.sourceToken,this.toToken=t.toToken,this.myTokensWithBalance=t.myTokensWithBalance,this.popularTokens=t.popularTokens,this.suggestedTokens=t.suggestedTokens,this.tokensLoading=t.tokensLoading}))}async firstUpdated(){await r.getTokenList()}updated(){this.renderRoot?.querySelector(".suggested-tokens-container")?.addEventListener("scroll",this.handleSuggestedTokensScroll.bind(this)),this.renderRoot?.querySelector(".tokens")?.addEventListener("scroll",this.handleTokenListScroll.bind(this))}disconnectedCallback(){super.disconnectedCallback();const t=this.renderRoot?.querySelector(".suggested-tokens-container"),o=this.renderRoot?.querySelector(".tokens");t?.removeEventListener("scroll",this.handleSuggestedTokensScroll.bind(this)),o?.removeEventListener("scroll",this.handleTokenListScroll.bind(this)),clearInterval(this.interval)}render(){return u`
966
+ <wui-flex flexDirection="column" gap="3">
967
+ ${this.templateSearchInput()} ${this.templateSuggestedTokens()} ${this.templateTokens()}
968
+ </wui-flex>
969
+ `}onSelectToken(t){this.targetToken==="sourceToken"?r.setSourceToken(t):(r.setToToken(t),this.sourceToken&&this.sourceTokenAmount&&r.swapTokens()),$.goBack()}templateSearchInput(){return u`
970
+ <wui-flex .padding=${["1","3","0","3"]} gap="2">
971
+ <wui-input-text
972
+ data-testid="swap-select-token-search-input"
973
+ class="network-search-input"
974
+ size="sm"
975
+ placeholder="Search token"
976
+ icon="search"
977
+ .value=${this.searchValue}
978
+ @inputChange=${this.onSearchInputChange.bind(this)}
979
+ ></wui-input-text>
980
+ </wui-flex>
981
+ `}templateMyTokens(){const t=this.myTokensWithBalance?Object.values(this.myTokensWithBalance):[],o=this.filterTokensWithText(t,this.searchValue);return o?.length>0?u`<wui-flex justifyContent="flex-start" padding="2">
982
+ <wui-text variant="md-medium" color="secondary">Your tokens</wui-text>
983
+ </wui-flex>
984
+ ${o.map(n=>{const s=n.symbol===this.sourceToken?.symbol||n.symbol===this.toToken?.symbol;return u`
985
+ <wui-token-list-item
986
+ data-testid="swap-select-token-item-${n.symbol}"
987
+ name=${n.name}
988
+ ?disabled=${s}
989
+ symbol=${n.symbol}
990
+ price=${n?.price}
991
+ amount=${n?.quantity?.numeric}
992
+ imageSrc=${n.logoUri}
993
+ @click=${()=>{s||this.onSelectToken(n)}}
994
+ >
995
+ </wui-token-list-item>
996
+ `})}`:null}templateAllTokens(){const t=this.popularTokens?this.popularTokens:[],o=this.filterTokensWithText(t,this.searchValue);return this.tokensLoading?u`
997
+ <wui-token-list-item-loader></wui-token-list-item-loader>
998
+ <wui-token-list-item-loader></wui-token-list-item-loader>
999
+ <wui-token-list-item-loader></wui-token-list-item-loader>
1000
+ <wui-token-list-item-loader></wui-token-list-item-loader>
1001
+ <wui-token-list-item-loader></wui-token-list-item-loader>
1002
+ `:o?.length>0?u`
1003
+ ${o.map(n=>u`
1004
+ <wui-token-list-item
1005
+ data-testid="swap-select-token-item-${n.symbol}"
1006
+ name=${n.name}
1007
+ symbol=${n.symbol}
1008
+ imageSrc=${n.logoUri}
1009
+ @click=${()=>this.onSelectToken(n)}
1010
+ >
1011
+ </wui-token-list-item>
1012
+ `)}
1013
+ `:null}templateTokens(){return u`
1014
+ <wui-flex class="tokens-container">
1015
+ <wui-flex class="tokens" .padding=${["0","2","2","2"]} flexDirection="column">
1016
+ ${this.templateMyTokens()}
1017
+ <wui-flex justifyContent="flex-start" padding="3">
1018
+ <wui-text variant="md-medium" color="secondary">Tokens</wui-text>
1019
+ </wui-flex>
1020
+ ${this.templateAllTokens()}
1021
+ </wui-flex>
1022
+ </wui-flex>
1023
+ `}templateSuggestedTokens(){const t=this.suggestedTokens?this.suggestedTokens.slice(0,8):null;return this.tokensLoading?u`
1024
+ <wui-flex
1025
+ class="suggested-tokens-container"
1026
+ .padding=${["0","3","0","3"]}
1027
+ gap="2"
1028
+ >
1029
+ <wui-token-button loading></wui-token-button>
1030
+ <wui-token-button loading></wui-token-button>
1031
+ <wui-token-button loading></wui-token-button>
1032
+ <wui-token-button loading></wui-token-button>
1033
+ <wui-token-button loading></wui-token-button>
1034
+ </wui-flex>
1035
+ `:t?u`
1036
+ <wui-flex
1037
+ class="suggested-tokens-container"
1038
+ .padding=${["0","3","0","3"]}
1039
+ gap="2"
1040
+ >
1041
+ ${t.map(o=>u`
1042
+ <wui-token-button
1043
+ text=${o.symbol}
1044
+ imageSrc=${o.logoUri}
1045
+ @click=${()=>this.onSelectToken(o)}
1046
+ >
1047
+ </wui-token-button>
1048
+ `)}
1049
+ </wui-flex>
1050
+ `:null}onSearchInputChange(t){this.searchValue=t.detail}handleSuggestedTokensScroll(){const t=this.renderRoot?.querySelector(".suggested-tokens-container");t&&(t.style.setProperty("--suggested-tokens-scroll--left-opacity",L.interpolate([0,100],[0,1],t.scrollLeft).toString()),t.style.setProperty("--suggested-tokens-scroll--right-opacity",L.interpolate([0,100],[0,1],t.scrollWidth-t.scrollLeft-t.offsetWidth).toString()))}handleTokenListScroll(){const t=this.renderRoot?.querySelector(".tokens");t&&(t.style.setProperty("--tokens-scroll--top-opacity",L.interpolate([0,100],[0,1],t.scrollTop).toString()),t.style.setProperty("--tokens-scroll--bottom-opacity",L.interpolate([0,100],[0,1],t.scrollHeight-t.scrollTop-t.offsetHeight).toString()))}filterTokensWithText(t,o){return t.filter(n=>`${n.symbol} ${n.name} ${n.address}`.toLowerCase().includes(o.toLowerCase())).sort((n,s)=>{const i=`${n.symbol} ${n.name} ${n.address}`.toLowerCase(),a=`${s.symbol} ${s.name} ${s.address}`.toLowerCase(),c=i.indexOf(o.toLowerCase()),C=a.indexOf(o.toLowerCase());return c-C})}};b.styles=re;y([l()],b.prototype,"interval",void 0);y([l()],b.prototype,"targetToken",void 0);y([l()],b.prototype,"sourceToken",void 0);y([l()],b.prototype,"sourceTokenAmount",void 0);y([l()],b.prototype,"toToken",void 0);y([l()],b.prototype,"myTokensWithBalance",void 0);y([l()],b.prototype,"popularTokens",void 0);y([l()],b.prototype,"suggestedTokens",void 0);y([l()],b.prototype,"tokensLoading",void 0);y([l()],b.prototype,"searchValue",void 0);b=y([I("w3m-swap-select-token-view")],b);export{d as W3mSwapPreviewView,b as W3mSwapSelectTokenView,p as W3mSwapView};
assets/transactions-B2LQEvLq.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{cJ as f,cD as a,cE as d,cC as u}from"./index-C-6muS97.js";const w=f`
2
+ :host > wui-flex:first-child {
3
+ height: 500px;
4
+ overflow-y: auto;
5
+ overflow-x: hidden;
6
+ scrollbar-width: none;
7
+ }
8
+
9
+ :host > wui-flex:first-child::-webkit-scrollbar {
10
+ display: none;
11
+ }
12
+ `;var p=function(n,t,i,l){var o=arguments.length,e=o<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,i):l,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(n,t,i,l);else for(var r=n.length-1;r>=0;r--)(c=n[r])&&(e=(o<3?c(e):o>3?c(t,i,e):c(t,i))||e);return o>3&&e&&Object.defineProperty(t,i,e),e};let s=class extends a{render(){return d`
13
+ <wui-flex flexDirection="column" .padding=${["0","3","3","3"]} gap="3">
14
+ <w3m-activity-list page="activity"></w3m-activity-list>
15
+ </wui-flex>
16
+ `}};s.styles=w;s=p([u("w3m-transactions-view")],s);export{s as W3mTransactionsView};
assets/w3m-modal-CASfxb2Y.js ADDED
@@ -0,0 +1,891 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{du as x,dO as te,cM as c,cO as ne,cy as g,cz as j,cC as m,cD as b,cE as d,cB as l,dc as k,cX as z,dd as u,cA as se,cT as f,cG as D,da as L,dK as le,dA as V,cQ as U,dr as R,c$ as F,cJ as ce,cN as A,dw as T,dH as q,db as de,cI as ie,dP as ue,dQ as he}from"./index-C-6muS97.js";import{P as _}from"./index-Vh_A-L4_.js";import{S as pe}from"./SwapController-DJdOQ0eQ.js";const oe={isUnsupportedChainView(){return c.state.view==="UnsupportedChain"||c.state.view==="SwitchNetwork"&&c.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){x.shake();return}if(await te.isSIWXCloseDisabled()){x.shake();return}(c.state.view==="DataCapture"||c.state.view==="DataCaptureOtpConfirm")&&ne.disconnect(),x.close()}},me=g`
2
+ :host {
3
+ display: block;
4
+ border-radius: clamp(0px, ${({borderRadius:e})=>e[8]}, 44px);
5
+ box-shadow: 0 0 0 1px ${({tokens:e})=>e.theme.foregroundPrimary};
6
+ overflow: hidden;
7
+ }
8
+ `;var fe=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};let K=class extends b{render(){return d`<slot></slot>`}};K.styles=[j,me];K=fe([m("wui-card")],K);const we=g`
9
+ :host {
10
+ width: 100%;
11
+ }
12
+
13
+ :host > wui-flex {
14
+ width: 100%;
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ gap: ${({spacing:e})=>e[2]};
19
+ padding: ${({spacing:e})=>e[3]};
20
+ border-radius: ${({borderRadius:e})=>e[6]};
21
+ border: 1px solid ${({tokens:e})=>e.theme.borderPrimary};
22
+ box-sizing: border-box;
23
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
24
+ box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.25);
25
+ color: ${({tokens:e})=>e.theme.textPrimary};
26
+ }
27
+
28
+ :host > wui-flex[data-type='info'] {
29
+ .icon-box {
30
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
31
+
32
+ wui-icon {
33
+ color: ${({tokens:e})=>e.theme.iconDefault};
34
+ }
35
+ }
36
+ }
37
+ :host > wui-flex[data-type='success'] {
38
+ .icon-box {
39
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
40
+
41
+ wui-icon {
42
+ color: ${({tokens:e})=>e.core.borderSuccess};
43
+ }
44
+ }
45
+ }
46
+ :host > wui-flex[data-type='warning'] {
47
+ .icon-box {
48
+ background-color: ${({tokens:e})=>e.core.backgroundWarning};
49
+
50
+ wui-icon {
51
+ color: ${({tokens:e})=>e.core.borderWarning};
52
+ }
53
+ }
54
+ }
55
+ :host > wui-flex[data-type='error'] {
56
+ .icon-box {
57
+ background-color: ${({tokens:e})=>e.core.backgroundError};
58
+
59
+ wui-icon {
60
+ color: ${({tokens:e})=>e.core.borderError};
61
+ }
62
+ }
63
+ }
64
+
65
+ wui-flex {
66
+ width: 100%;
67
+ }
68
+
69
+ wui-text {
70
+ word-break: break-word;
71
+ flex: 1;
72
+ }
73
+
74
+ .close {
75
+ cursor: pointer;
76
+ color: ${({tokens:e})=>e.theme.iconDefault};
77
+ }
78
+
79
+ .icon-box {
80
+ height: 40px;
81
+ width: 40px;
82
+ border-radius: ${({borderRadius:e})=>e[2]};
83
+ background-color: var(--local-icon-bg-value);
84
+ }
85
+ `;var X=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};const be={info:"info",success:"checkmark",warning:"warningCircle",error:"warning"};let O=class extends b{constructor(){super(...arguments),this.message="",this.type="info"}render(){return d`
86
+ <wui-flex
87
+ data-type=${k(this.type)}
88
+ flexDirection="row"
89
+ justifyContent="space-between"
90
+ alignItems="center"
91
+ gap="2"
92
+ >
93
+ <wui-flex columnGap="2" flexDirection="row" alignItems="center">
94
+ <wui-flex
95
+ flexDirection="row"
96
+ alignItems="center"
97
+ justifyContent="center"
98
+ class="icon-box"
99
+ >
100
+ <wui-icon color="inherit" size="md" name=${be[this.type]}></wui-icon>
101
+ </wui-flex>
102
+ <wui-text variant="md-medium" color="inherit" data-testid="wui-alertbar-text"
103
+ >${this.message}</wui-text
104
+ >
105
+ </wui-flex>
106
+ <wui-icon
107
+ class="close"
108
+ color="inherit"
109
+ size="sm"
110
+ name="close"
111
+ @click=${this.onClose}
112
+ ></wui-icon>
113
+ </wui-flex>
114
+ `}onClose(){z.close()}};O.styles=[j,we];X([l()],O.prototype,"message",void 0);X([l()],O.prototype,"type",void 0);O=X([m("wui-alertbar")],O);const ge=g`
115
+ :host {
116
+ display: block;
117
+ position: absolute;
118
+ top: ${({spacing:e})=>e[3]};
119
+ left: ${({spacing:e})=>e[4]};
120
+ right: ${({spacing:e})=>e[4]};
121
+ opacity: 0;
122
+ pointer-events: none;
123
+ }
124
+ `;var re=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};const ye={info:{backgroundColor:"fg-350",iconColor:"fg-325",icon:"info"},success:{backgroundColor:"success-glass-reown-020",iconColor:"success-125",icon:"checkmark"},warning:{backgroundColor:"warning-glass-reown-020",iconColor:"warning-100",icon:"warningCircle"},error:{backgroundColor:"error-glass-reown-020",iconColor:"error-125",icon:"warning"}};let H=class extends b{constructor(){super(),this.unsubscribe=[],this.open=z.state.open,this.onOpen(!0),this.unsubscribe.push(z.subscribeKey("open",t=>{this.open=t,this.onOpen(!1)}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const{message:t,variant:i}=z.state,r=ye[i];return d`
125
+ <wui-alertbar
126
+ message=${t}
127
+ backgroundColor=${r?.backgroundColor}
128
+ iconColor=${r?.iconColor}
129
+ icon=${r?.icon}
130
+ type=${i}
131
+ ></wui-alertbar>
132
+ `}onOpen(t){this.open?(this.animate([{opacity:0,transform:"scale(0.85)"},{opacity:1,transform:"scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: auto"):t||(this.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: none")}};H.styles=ge;re([u()],H.prototype,"open",void 0);H=re([m("w3m-alertbar")],H);const ve=g`
133
+ button {
134
+ display: block;
135
+ display: flex;
136
+ align-items: center;
137
+ padding: ${({spacing:e})=>e[1]};
138
+ transition: background-color ${({durations:e})=>e.lg}
139
+ ${({easings:e})=>e["ease-out-power-2"]};
140
+ will-change: background-color;
141
+ border-radius: ${({borderRadius:e})=>e[32]};
142
+ }
143
+
144
+ wui-image {
145
+ border-radius: 100%;
146
+ }
147
+
148
+ wui-text {
149
+ padding-left: ${({spacing:e})=>e[1]};
150
+ }
151
+
152
+ .left-icon-container,
153
+ .right-icon-container {
154
+ width: 24px;
155
+ height: 24px;
156
+ justify-content: center;
157
+ align-items: center;
158
+ }
159
+
160
+ wui-icon {
161
+ color: ${({tokens:e})=>e.theme.iconDefault};
162
+ }
163
+
164
+ /* -- Sizes --------------------------------------------------- */
165
+ button[data-size='lg'] {
166
+ height: 32px;
167
+ }
168
+
169
+ button[data-size='md'] {
170
+ height: 28px;
171
+ }
172
+
173
+ button[data-size='sm'] {
174
+ height: 24px;
175
+ }
176
+
177
+ button[data-size='lg'] wui-image {
178
+ width: 24px;
179
+ height: 24px;
180
+ }
181
+
182
+ button[data-size='md'] wui-image {
183
+ width: 20px;
184
+ height: 20px;
185
+ }
186
+
187
+ button[data-size='sm'] wui-image {
188
+ width: 16px;
189
+ height: 16px;
190
+ }
191
+
192
+ button[data-size='lg'] .left-icon-container {
193
+ width: 24px;
194
+ height: 24px;
195
+ }
196
+
197
+ button[data-size='md'] .left-icon-container {
198
+ width: 20px;
199
+ height: 20px;
200
+ }
201
+
202
+ button[data-size='sm'] .left-icon-container {
203
+ width: 16px;
204
+ height: 16px;
205
+ }
206
+
207
+ /* -- Variants --------------------------------------------------------- */
208
+ button[data-type='filled-dropdown'] {
209
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
210
+ }
211
+
212
+ button[data-type='text-dropdown'] {
213
+ background-color: transparent;
214
+ }
215
+
216
+ /* -- Focus states --------------------------------------------------- */
217
+ button:focus-visible:enabled {
218
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
219
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent040};
220
+ }
221
+
222
+ /* -- Hover & Active states ----------------------------------------------------------- */
223
+ @media (hover: hover) and (pointer: fine) {
224
+ button:hover:enabled,
225
+ button:active:enabled {
226
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
227
+ }
228
+ }
229
+
230
+ /* -- Disabled states --------------------------------------------------- */
231
+ button:disabled {
232
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
233
+ opacity: 0.5;
234
+ }
235
+ `;var E=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};const xe={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},ke={lg:"lg",md:"md",sm:"sm"};let W=class extends b{constructor(){super(...arguments),this.imageSrc="",this.text="",this.size="lg",this.type="text-dropdown",this.disabled=!1}render(){return d`<button ?disabled=${this.disabled} data-size=${this.size} data-type=${this.type}>
236
+ ${this.imageTemplate()} ${this.textTemplate()}
237
+ <wui-flex class="right-icon-container">
238
+ <wui-icon name="chevronBottom"></wui-icon>
239
+ </wui-flex>
240
+ </button>`}textTemplate(){const t=xe[this.size];return this.text?d`<wui-text color="primary" variant=${t}>${this.text}</wui-text>`:null}imageTemplate(){if(this.imageSrc)return d`<wui-image src=${this.imageSrc} alt="select visual"></wui-image>`;const t=ke[this.size];return d` <wui-flex class="left-icon-container">
241
+ <wui-icon size=${t} name="networkPlaceholder"></wui-icon>
242
+ </wui-flex>`}};W.styles=[j,se,ve];E([l()],W.prototype,"imageSrc",void 0);E([l()],W.prototype,"text",void 0);E([l()],W.prototype,"size",void 0);E([l()],W.prototype,"type",void 0);E([l({type:Boolean})],W.prototype,"disabled",void 0);W=E([m("wui-select")],W);const Ce=g`
243
+ wui-image {
244
+ border-radius: ${({borderRadius:e})=>e.round};
245
+ }
246
+
247
+ .transfers-badge {
248
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
249
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary};
250
+ border-radius: ${({borderRadius:e})=>e[4]};
251
+ }
252
+ `;var Y=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};let P=class extends b{constructor(){super(),this.unsubscribe=[],this.paymentAsset=_.state.paymentAsset,this.amount=_.state.amount,this.unsubscribe.push(_.subscribeKey("paymentAsset",t=>{this.paymentAsset=t}),_.subscribeKey("amount",t=>{this.amount=t}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const i=f.getAllRequestedCaipNetworks().find(r=>r.caipNetworkId===this.paymentAsset.network);return d`<wui-flex
253
+ alignItems="center"
254
+ gap="1"
255
+ .padding=${["1","2","1","1"]}
256
+ class="transfers-badge"
257
+ >
258
+ <wui-image src=${k(this.paymentAsset.metadata.logoURI)} size="xl"></wui-image>
259
+ <wui-text variant="lg-regular" color="primary">
260
+ ${this.amount} ${this.paymentAsset.metadata.symbol}
261
+ </wui-text>
262
+ <wui-text variant="sm-regular" color="secondary">
263
+ on ${i?.name??"Unknown"}
264
+ </wui-text>
265
+ </wui-flex>`}};P.styles=[Ce];Y([l()],P.prototype,"paymentAsset",void 0);Y([l()],P.prototype,"amount",void 0);P=Y([m("w3m-pay-header")],P);const $e=g`
266
+ :host {
267
+ height: 60px;
268
+ }
269
+
270
+ :host > wui-flex {
271
+ box-sizing: border-box;
272
+ background-color: var(--local-header-background-color);
273
+ }
274
+
275
+ wui-text {
276
+ background-color: var(--local-header-background-color);
277
+ }
278
+
279
+ wui-flex.w3m-header-title {
280
+ transform: translateY(0);
281
+ opacity: 1;
282
+ }
283
+
284
+ wui-flex.w3m-header-title[view-direction='prev'] {
285
+ animation:
286
+ slide-down-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]},
287
+ slide-down-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]};
288
+ animation-delay: 0ms, 200ms;
289
+ }
290
+
291
+ wui-flex.w3m-header-title[view-direction='next'] {
292
+ animation:
293
+ slide-up-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]},
294
+ slide-up-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]};
295
+ animation-delay: 0ms, 200ms;
296
+ }
297
+
298
+ wui-icon-button[data-hidden='true'] {
299
+ opacity: 0 !important;
300
+ pointer-events: none;
301
+ }
302
+
303
+ @keyframes slide-up-out {
304
+ from {
305
+ transform: translateY(0px);
306
+ opacity: 1;
307
+ }
308
+ to {
309
+ transform: translateY(3px);
310
+ opacity: 0;
311
+ }
312
+ }
313
+
314
+ @keyframes slide-up-in {
315
+ from {
316
+ transform: translateY(-3px);
317
+ opacity: 0;
318
+ }
319
+ to {
320
+ transform: translateY(0);
321
+ opacity: 1;
322
+ }
323
+ }
324
+
325
+ @keyframes slide-down-out {
326
+ from {
327
+ transform: translateY(0px);
328
+ opacity: 1;
329
+ }
330
+ to {
331
+ transform: translateY(-3px);
332
+ opacity: 0;
333
+ }
334
+ }
335
+
336
+ @keyframes slide-down-in {
337
+ from {
338
+ transform: translateY(3px);
339
+ opacity: 0;
340
+ }
341
+ to {
342
+ transform: translateY(0);
343
+ opacity: 1;
344
+ }
345
+ }
346
+ `;var I=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};const Se=["SmartSessionList"],We={PayWithExchange:D.tokens.theme.foregroundPrimary};function Q(){const e=c.state.data?.connector?.name,t=c.state.data?.wallet?.name,i=c.state.data?.network?.name,r=t??e,a=F.getConnectors(),o=a.length===1&&a[0]?.id==="w3m-email",n=f.getAccountData()?.socialProvider,s=n?n.charAt(0).toUpperCase()+n.slice(1):"Connect Social";return{Connect:`Connect ${o?"Email":""} Wallet`,Create:"Create Wallet",ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",UsageExceeded:"Usage Exceeded",ConnectingExternal:r??"Connect Wallet",ConnectingWalletConnect:r??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview Convert",Downloads:r?`Get ${r}`:"Downloads",EmailLogin:"Email Login",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a Wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Pay:"How you pay",ProfileWallets:"Wallets",SwitchNetwork:i??"Switch Network",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade Your Wallet",UpdateEmailWallet:"Edit Email",UpdateEmailPrimaryOtp:"Confirm Current Email",UpdateEmailSecondaryOtp:"Confirm New Email",WhatIsABuy:"What is Buy?",RegisterAccountName:"Choose Name",RegisterAccountNameSuccess:"",WalletReceive:"Receive",WalletCompatibleNetworks:"Compatible Networks",Swap:"Swap",SwapSelectToken:"Select Token",SwapPreview:"Preview Swap",WalletSend:"Send",WalletSendPreview:"Review Send",WalletSendSelectToken:"Select Token",WalletSendConfirmed:"Confirmed",WhatIsANetwork:"What is a network?",WhatIsAWallet:"What is a Wallet?",ConnectWallets:"Connect Wallet",ConnectSocials:"All Socials",ConnectingSocial:s,ConnectingMultiChain:"Select Chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch Chain",SmartSessionCreated:void 0,SmartSessionList:"Smart Sessions",SIWXSignMessage:"Sign In",PayLoading:"Processing payment...",PayQuote:"Payment Quote",DataCapture:"Profile",DataCaptureOtpConfirm:"Confirm Email",FundWallet:"Fund Wallet",PayWithExchange:"Deposit from Exchange",PayWithExchangeSelectAsset:"Select Asset",SmartAccountSettings:"Smart Account Settings"}}let C=class extends b{constructor(){super(),this.unsubscribe=[],this.heading=Q()[c.state.view],this.network=f.state.activeCaipNetwork,this.networkImage=L.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=c.state.view,this.viewDirection="",this.unsubscribe.push(le.subscribeNetworkImages(()=>{this.networkImage=L.getNetworkImage(this.network)}),c.subscribeKey("view",t=>{setTimeout(()=>{this.view=t,this.heading=Q()[t]},V.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()}),f.subscribeKey("activeCaipNetwork",t=>{this.network=t,this.networkImage=L.getNetworkImage(this.network)}))}disconnectCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=We[c.state.view]??D.tokens.theme.backgroundPrimary;return this.style.setProperty("--local-header-background-color",t),d`
347
+ <wui-flex
348
+ .padding=${["0","4","0","4"]}
349
+ justifyContent="space-between"
350
+ alignItems="center"
351
+ >
352
+ ${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()}
353
+ </wui-flex>
354
+ `}onWalletHelp(){U.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),c.push("WhatIsAWallet")}async onClose(){await oe.safeClose()}rightHeaderTemplate(){const t=R?.state?.features?.smartSessions;return c.state.view!=="Account"||!t?this.closeButtonTemplate():d`<wui-flex>
355
+ <wui-icon-button
356
+ icon="clock"
357
+ size="lg"
358
+ iconSize="lg"
359
+ type="neutral"
360
+ variant="primary"
361
+ @click=${()=>c.push("SmartSessionList")}
362
+ data-testid="w3m-header-smart-sessions"
363
+ ></wui-icon-button>
364
+ ${this.closeButtonTemplate()}
365
+ </wui-flex> `}closeButtonTemplate(){return d`
366
+ <wui-icon-button
367
+ icon="close"
368
+ size="lg"
369
+ type="neutral"
370
+ variant="primary"
371
+ iconSize="lg"
372
+ @click=${this.onClose.bind(this)}
373
+ data-testid="w3m-header-close"
374
+ ></wui-icon-button>
375
+ `}titleTemplate(){if(this.view==="PayQuote")return d`<w3m-pay-header></w3m-pay-header>`;const t=Se.includes(this.view);return d`
376
+ <wui-flex
377
+ view-direction="${this.viewDirection}"
378
+ class="w3m-header-title"
379
+ alignItems="center"
380
+ gap="2"
381
+ >
382
+ <wui-text
383
+ display="inline"
384
+ variant="lg-regular"
385
+ color="primary"
386
+ data-testid="w3m-header-text"
387
+ >
388
+ ${this.heading}
389
+ </wui-text>
390
+ ${t?d`<wui-tag variant="accent" size="md">Beta</wui-tag>`:null}
391
+ </wui-flex>
392
+ `}leftHeaderTemplate(){const{view:t}=c.state,i=t==="Connect",r=R.state.enableEmbedded,a=t==="ApproveTransaction",o=t==="ConnectingSiwe",n=t==="Account",s=R.state.enableNetworkSwitch,v=a||o||i&&r;return n&&s?d`<wui-select
393
+ id="dynamic"
394
+ data-testid="w3m-account-select-network"
395
+ active-network=${k(this.network?.name)}
396
+ @click=${this.onNetworks.bind(this)}
397
+ imageSrc=${k(this.networkImage)}
398
+ ></wui-select>`:this.showBack&&!v?d`<wui-icon-button
399
+ data-testid="header-back"
400
+ id="dynamic"
401
+ icon="chevronLeft"
402
+ size="lg"
403
+ iconSize="lg"
404
+ type="neutral"
405
+ variant="primary"
406
+ @click=${this.onGoBack.bind(this)}
407
+ ></wui-icon-button>`:d`<wui-icon-button
408
+ data-hidden=${!i}
409
+ id="dynamic"
410
+ icon="helpCircle"
411
+ size="lg"
412
+ iconSize="lg"
413
+ type="neutral"
414
+ variant="primary"
415
+ @click=${this.onWalletHelp.bind(this)}
416
+ ></wui-icon-button>`}onNetworks(){this.isAllowedNetworkSwitch()&&(U.sendEvent({type:"track",event:"CLICK_NETWORKS"}),c.push("Networks"))}isAllowedNetworkSwitch(){const t=f.getAllRequestedCaipNetworks(),i=t?t.length>1:!1,r=t?.find(({id:a})=>a===this.network?.id);return i||!r}onViewChange(){const{history:t}=c.state;let i=V.VIEW_DIRECTION.Next;t.length<this.prevHistoryLength&&(i=V.VIEW_DIRECTION.Prev),this.prevHistoryLength=t.length,this.viewDirection=i}async onHistoryChange(){const{history:t}=c.state,i=this.shadowRoot?.querySelector("#dynamic");t.length>1&&!this.showBack&&i?(await i.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,i.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):t.length<=1&&this.showBack&&i&&(await i.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,i.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){c.goBack()}};C.styles=$e;I([u()],C.prototype,"heading",void 0);I([u()],C.prototype,"network",void 0);I([u()],C.prototype,"networkImage",void 0);I([u()],C.prototype,"showBack",void 0);I([u()],C.prototype,"prevHistoryLength",void 0);I([u()],C.prototype,"view",void 0);I([u()],C.prototype,"viewDirection",void 0);C=I([m("w3m-header")],C);const Ie=g`
417
+ :host {
418
+ display: flex;
419
+ align-items: center;
420
+ gap: ${({spacing:e})=>e[1]};
421
+ padding: ${({spacing:e})=>e[2]} ${({spacing:e})=>e[3]}
422
+ ${({spacing:e})=>e[2]} ${({spacing:e})=>e[2]};
423
+ border-radius: ${({borderRadius:e})=>e[20]};
424
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
425
+ box-shadow:
426
+ 0px 0px 8px 0px rgba(0, 0, 0, 0.1),
427
+ inset 0 0 0 1px ${({tokens:e})=>e.theme.borderPrimary};
428
+ max-width: 320px;
429
+ }
430
+
431
+ wui-icon-box {
432
+ border-radius: ${({borderRadius:e})=>e.round} !important;
433
+ overflow: hidden;
434
+ }
435
+
436
+ wui-loading-spinner {
437
+ padding: ${({spacing:e})=>e[1]};
438
+ background-color: ${({tokens:e})=>e.core.foregroundAccent010};
439
+ border-radius: ${({borderRadius:e})=>e.round} !important;
440
+ }
441
+ `;var G=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};let N=class extends b{constructor(){super(...arguments),this.message="",this.variant="success"}render(){return d`
442
+ ${this.templateIcon()}
443
+ <wui-text variant="lg-regular" color="primary" data-testid="wui-snackbar-message"
444
+ >${this.message}</wui-text
445
+ >
446
+ `}templateIcon(){const t={success:"success",error:"error",warning:"warning",info:"default"},i={success:"checkmark",error:"warning",warning:"warningCircle",info:"info"};return this.variant==="loading"?d`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:d`<wui-icon-box
447
+ size="md"
448
+ color=${t[this.variant]}
449
+ icon=${i[this.variant]}
450
+ ></wui-icon-box>`}};N.styles=[j,Ie];G([l()],N.prototype,"message",void 0);G([l()],N.prototype,"variant",void 0);N=G([m("wui-snackbar")],N);const Re=ce`
451
+ :host {
452
+ display: block;
453
+ position: absolute;
454
+ opacity: 0;
455
+ pointer-events: none;
456
+ top: 11px;
457
+ left: 50%;
458
+ width: max-content;
459
+ }
460
+ `;var ae=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};let B=class extends b{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=A.state.open,this.unsubscribe.push(A.subscribeKey("open",t=>{this.open=t,this.onOpen()}))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach(t=>t())}render(){const{message:t,variant:i}=A.state;return d` <wui-snackbar message=${t} variant=${i}></wui-snackbar> `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),A.state.autoClose&&(this.timeout=setTimeout(()=>A.hide(),2500))):this.animate([{opacity:1,transform:"translateX(-50%) scale(1)"},{opacity:0,transform:"translateX(-50%) scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"})}};B.styles=Re;ae([u()],B.prototype,"open",void 0);B=ae([m("w3m-snackbar")],B);const Ae=g`
461
+ :host {
462
+ z-index: ${({tokens:e})=>e.core.zIndex};
463
+ display: block;
464
+ backface-visibility: hidden;
465
+ will-change: opacity;
466
+ position: fixed;
467
+ top: 0;
468
+ left: 0;
469
+ right: 0;
470
+ bottom: 0;
471
+ pointer-events: none;
472
+ opacity: 0;
473
+ background-color: ${({tokens:e})=>e.theme.overlay};
474
+ backdrop-filter: blur(0px);
475
+ transition:
476
+ opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
477
+ backdrop-filter ${({durations:e})=>e.lg}
478
+ ${({easings:e})=>e["ease-out-power-2"]};
479
+ will-change: opacity;
480
+ }
481
+
482
+ :host(.open) {
483
+ opacity: 1;
484
+ backdrop-filter: blur(8px);
485
+ }
486
+
487
+ :host(.appkit-modal) {
488
+ position: relative;
489
+ pointer-events: unset;
490
+ background: none;
491
+ width: 100%;
492
+ opacity: 1;
493
+ }
494
+
495
+ wui-card {
496
+ max-width: var(--apkt-modal-width);
497
+ width: 100%;
498
+ position: relative;
499
+ outline: none;
500
+ transform: translateY(4px);
501
+ box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05);
502
+ transition:
503
+ transform ${({durations:e})=>e.lg}
504
+ ${({easings:e})=>e["ease-out-power-2"]},
505
+ border-radius ${({durations:e})=>e.lg}
506
+ ${({easings:e})=>e["ease-out-power-1"]},
507
+ background-color ${({durations:e})=>e.lg}
508
+ ${({easings:e})=>e["ease-out-power-1"]},
509
+ box-shadow ${({durations:e})=>e.lg}
510
+ ${({easings:e})=>e["ease-out-power-1"]};
511
+ will-change: border-radius, background-color, transform, box-shadow;
512
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
513
+ padding: var(--local-modal-padding);
514
+ box-sizing: border-box;
515
+ }
516
+
517
+ :host(.open) wui-card {
518
+ transform: translateY(0px);
519
+ }
520
+
521
+ wui-card::before {
522
+ z-index: 1;
523
+ pointer-events: none;
524
+ content: '';
525
+ position: absolute;
526
+ inset: 0;
527
+ border-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
528
+ transition: box-shadow ${({durations:e})=>e.lg}
529
+ ${({easings:e})=>e["ease-out-power-2"]};
530
+ transition-delay: ${({durations:e})=>e.md};
531
+ will-change: box-shadow;
532
+ }
533
+
534
+ :host([data-mobile-fullscreen='true']) wui-card::before {
535
+ border-radius: 0px;
536
+ }
537
+
538
+ :host([data-border='true']) wui-card::before {
539
+ box-shadow: inset 0px 0px 0px 4px ${({tokens:e})=>e.theme.foregroundSecondary};
540
+ }
541
+
542
+ :host([data-border='false']) wui-card::before {
543
+ box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.theme.borderPrimaryDark};
544
+ }
545
+
546
+ :host([data-border='true']) wui-card {
547
+ animation:
548
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
549
+ card-background-border var(--apkt-duration-dynamic)
550
+ ${({easings:e})=>e["ease-out-power-2"]};
551
+ animation-fill-mode: backwards, both;
552
+ animation-delay: var(--apkt-duration-dynamic);
553
+ }
554
+
555
+ :host([data-border='false']) wui-card {
556
+ animation:
557
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
558
+ card-background-default var(--apkt-duration-dynamic)
559
+ ${({easings:e})=>e["ease-out-power-2"]};
560
+ animation-fill-mode: backwards, both;
561
+ animation-delay: 0s;
562
+ }
563
+
564
+ :host(.appkit-modal) wui-card {
565
+ max-width: var(--apkt-modal-width);
566
+ }
567
+
568
+ wui-card[shake='true'] {
569
+ animation:
570
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
571
+ w3m-shake ${({durations:e})=>e.xl}
572
+ ${({easings:e})=>e["ease-out-power-2"]};
573
+ }
574
+
575
+ wui-flex {
576
+ overflow-x: hidden;
577
+ overflow-y: auto;
578
+ display: flex;
579
+ align-items: center;
580
+ justify-content: center;
581
+ width: 100%;
582
+ height: 100%;
583
+ }
584
+
585
+ @media (max-height: 700px) and (min-width: 431px) {
586
+ wui-flex {
587
+ align-items: flex-start;
588
+ }
589
+
590
+ wui-card {
591
+ margin: var(--apkt-spacing-6) 0px;
592
+ }
593
+ }
594
+
595
+ @media (max-width: 430px) {
596
+ :host([data-mobile-fullscreen='true']) {
597
+ height: 100dvh;
598
+ }
599
+ :host([data-mobile-fullscreen='true']) wui-flex {
600
+ align-items: stretch;
601
+ }
602
+ :host([data-mobile-fullscreen='true']) wui-card {
603
+ max-width: 100%;
604
+ height: 100%;
605
+ border-radius: 0;
606
+ border: none;
607
+ }
608
+ :host(:not([data-mobile-fullscreen='true'])) wui-flex {
609
+ align-items: flex-end;
610
+ }
611
+
612
+ :host(:not([data-mobile-fullscreen='true'])) wui-card {
613
+ max-width: 100%;
614
+ border-bottom: none;
615
+ }
616
+
617
+ :host(:not([data-mobile-fullscreen='true'])) wui-card[data-embedded='true'] {
618
+ border-bottom-left-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
619
+ border-bottom-right-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
620
+ }
621
+
622
+ :host(:not([data-mobile-fullscreen='true'])) wui-card:not([data-embedded='true']) {
623
+ border-bottom-left-radius: 0px;
624
+ border-bottom-right-radius: 0px;
625
+ }
626
+
627
+ wui-card[shake='true'] {
628
+ animation: w3m-shake 0.5s ${({easings:e})=>e["ease-out-power-2"]};
629
+ }
630
+ }
631
+
632
+ @keyframes fade-in {
633
+ 0% {
634
+ transform: scale(0.99) translateY(4px);
635
+ }
636
+ 100% {
637
+ transform: scale(1) translateY(0);
638
+ }
639
+ }
640
+
641
+ @keyframes w3m-shake {
642
+ 0% {
643
+ transform: scale(1) rotate(0deg);
644
+ }
645
+ 20% {
646
+ transform: scale(1) rotate(-1deg);
647
+ }
648
+ 40% {
649
+ transform: scale(1) rotate(1.5deg);
650
+ }
651
+ 60% {
652
+ transform: scale(1) rotate(-1.5deg);
653
+ }
654
+ 80% {
655
+ transform: scale(1) rotate(1deg);
656
+ }
657
+ 100% {
658
+ transform: scale(1) rotate(0deg);
659
+ }
660
+ }
661
+
662
+ @keyframes card-background-border {
663
+ from {
664
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
665
+ }
666
+ to {
667
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
668
+ }
669
+ }
670
+
671
+ @keyframes card-background-default {
672
+ from {
673
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
674
+ }
675
+ to {
676
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
677
+ }
678
+ }
679
+ `;var $=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};const Z="scroll-lock",Ee={PayWithExchange:"0",PayWithExchangeSelectAsset:"0",Pay:"0",PayQuote:"0",PayLoading:"0"};class y extends b{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=R.state.enableEmbedded,this.open=x.state.open,this.caipAddress=f.state.activeCaipAddress,this.caipNetwork=f.state.activeCaipNetwork,this.shake=x.state.shake,this.filterByNamespace=F.state.filterByNamespace,this.padding=D.spacing[1],this.mobileFullScreen=R.state.enableMobileFullScreen,this.initializeTheming(),T.prefetchAnalyticsConfig(),this.unsubscribe.push(x.subscribeKey("open",t=>t?this.onOpen():this.onClose()),x.subscribeKey("shake",t=>this.shake=t),f.subscribeKey("activeCaipNetwork",t=>this.onNewNetwork(t)),f.subscribeKey("activeCaipAddress",t=>this.onNewAddress(t)),R.subscribeKey("enableEmbedded",t=>this.enableEmbedded=t),F.subscribeKey("filterByNamespace",t=>{this.filterByNamespace!==t&&!f.getAccountData(t)?.caipAddress&&(T.fetchRecommendedWallets(),this.filterByNamespace=t)}),c.subscribeKey("view",()=>{this.dataset.border=q.hasFooter()?"true":"false",this.padding=Ee[c.state.view]??D.spacing[1]}))}firstUpdated(){if(this.dataset.border=q.hasFooter()?"true":"false",this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),this.caipAddress){if(this.enableEmbedded){x.close(),this.prefetch();return}this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}disconnectedCallback(){this.unsubscribe.forEach(t=>t()),this.onRemoveKeyboardListener()}render(){return this.style.setProperty("--local-modal-padding",this.padding),this.enableEmbedded?d`${this.contentTemplate()}
680
+ <w3m-tooltip></w3m-tooltip> `:this.open?d`
681
+ <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
682
+ ${this.contentTemplate()}
683
+ </wui-flex>
684
+ <w3m-tooltip></w3m-tooltip>
685
+ `:null}contentTemplate(){return d` <wui-card
686
+ shake="${this.shake}"
687
+ data-embedded="${k(this.enableEmbedded)}"
688
+ role="alertdialog"
689
+ aria-modal="true"
690
+ tabindex="0"
691
+ data-testid="w3m-modal-card"
692
+ >
693
+ <w3m-header></w3m-header>
694
+ <w3m-router></w3m-router>
695
+ <w3m-footer></w3m-footer>
696
+ <w3m-snackbar></w3m-snackbar>
697
+ <w3m-alertbar></w3m-alertbar>
698
+ </wui-card>`}async onOverlayClick(t){if(t.target===t.currentTarget){if(this.mobileFullScreen)return;await this.handleClose()}}async handleClose(){await oe.safeClose()}initializeTheming(){const{themeVariables:t,themeMode:i}=de.state,r=ie.getColorTheme(i);ue(t,r)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),A.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const t=document.createElement("style");t.dataset.w3m=Z,t.textContent=`
699
+ body {
700
+ touch-action: none;
701
+ overflow: hidden;
702
+ overscroll-behavior: contain;
703
+ }
704
+ w3m-modal {
705
+ pointer-events: auto;
706
+ }
707
+ `,document.head.appendChild(t)}onScrollUnlock(){const t=document.head.querySelector(`style[data-w3m="${Z}"]`);t&&t.remove()}onAddKeyboardListener(){this.abortController=new AbortController;const t=this.shadowRoot?.querySelector("wui-card");t?.focus(),window.addEventListener("keydown",i=>{if(i.key==="Escape")this.handleClose();else if(i.key==="Tab"){const{tagName:r}=i.target;r&&!r.includes("W3M-")&&!r.includes("WUI-")&&t?.focus()}},this.abortController)}onRemoveKeyboardListener(){this.abortController?.abort(),this.abortController=void 0}async onNewAddress(t){const i=f.state.isSwitchingNamespace,r=c.state.view==="ProfileWallets";!t&&!i&&!r&&x.close(),await te.initializeIfEnabled(t),this.caipAddress=t,f.setIsSwitchingNamespace(!1)}onNewNetwork(t){const r=this.caipNetwork?.caipNetworkId?.toString(),a=t?.caipNetworkId?.toString(),o=r!==a,n=c.state.view==="UnsupportedChain",s=x.state.open;let v=!1;this.enableEmbedded&&c.state.view==="SwitchNetwork"&&(v=!0),o&&pe.resetState(),s&&n&&(v=!0),v&&c.state.view!=="SIWXSignMessage"&&c.goBack(),this.caipNetwork=t}prefetch(){this.hasPrefetched||(T.prefetch(),T.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}}y.styles=Ae;$([l({type:Boolean})],y.prototype,"enableEmbedded",void 0);$([u()],y.prototype,"open",void 0);$([u()],y.prototype,"caipAddress",void 0);$([u()],y.prototype,"caipNetwork",void 0);$([u()],y.prototype,"shake",void 0);$([u()],y.prototype,"filterByNamespace",void 0);$([u()],y.prototype,"padding",void 0);$([u()],y.prototype,"mobileFullScreen",void 0);let J=class extends y{};J=$([m("w3m-modal")],J);let ee=class extends y{};ee=$([m("appkit-modal")],ee);const Oe=g`
708
+ .icon-box {
709
+ width: 64px;
710
+ height: 64px;
711
+ border-radius: ${({borderRadius:e})=>e[5]};
712
+ background-color: ${({colors:e})=>e.semanticError010};
713
+ }
714
+ `;var Pe=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};let M=class extends b{constructor(){super()}render(){return d`
715
+ <wui-flex
716
+ flexDirection="column"
717
+ alignItems="center"
718
+ gap="4"
719
+ .padding="${["1","3","4","3"]}"
720
+ >
721
+ <wui-flex justifyContent="center" alignItems="center" class="icon-box">
722
+ <wui-icon size="xxl" color="error" name="warningCircle"></wui-icon>
723
+ </wui-flex>
724
+
725
+ <wui-text variant="lg-medium" color="primary" align="center">
726
+ The app isn't responding as expected
727
+ </wui-text>
728
+ <wui-text variant="md-regular" color="secondary" align="center">
729
+ Try again or reach out to the app team for help.
730
+ </wui-text>
731
+
732
+ <wui-button
733
+ variant="neutral-secondary"
734
+ size="md"
735
+ @click=${this.onTryAgainClick.bind(this)}
736
+ data-testid="w3m-usage-exceeded-button"
737
+ >
738
+ <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
739
+ Try Again
740
+ </wui-button>
741
+ </wui-flex>
742
+ `}onTryAgainClick(){c.goBack()}};M.styles=Oe;M=Pe([m("w3m-usage-exceeded-view")],M);const Ne=g`
743
+ :host {
744
+ width: 100%;
745
+ }
746
+ `;var p=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};let h=class extends b{constructor(){super(...arguments),this.hasImpressionSent=!1,this.walletImages=[],this.imageSrc="",this.name="",this.size="md",this.tabIdx=void 0,this.disabled=!1,this.showAllWallets=!1,this.loading=!1,this.loadingSpinnerColor="accent-100",this.rdnsId="",this.displayIndex=void 0,this.walletRank=void 0,this.namespaces=[]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.cleanupIntersectionObserver()}updated(t){super.updated(t),(t.has("name")||t.has("imageSrc")||t.has("walletRank"))&&(this.hasImpressionSent=!1),t.has("walletRank")&&this.walletRank&&!this.intersectionObserver&&this.setupIntersectionObserver()}setupIntersectionObserver(){this.intersectionObserver=new IntersectionObserver(t=>{t.forEach(i=>{i.isIntersecting&&!this.loading&&!this.hasImpressionSent&&this.sendImpressionEvent()})},{threshold:.1}),this.intersectionObserver.observe(this)}cleanupIntersectionObserver(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=void 0)}sendImpressionEvent(){!this.name||this.hasImpressionSent||!this.walletRank||(this.hasImpressionSent=!0,(this.rdnsId||this.name)&&U.sendWalletImpressionEvent({name:this.name,walletRank:this.walletRank,rdnsId:this.rdnsId,view:c.state.view,displayIndex:this.displayIndex}))}handleGetWalletNamespaces(){return Object.keys(he.state.adapters).length>1?this.namespaces:[]}render(){return d`
747
+ <wui-list-wallet
748
+ .walletImages=${this.walletImages}
749
+ imageSrc=${k(this.imageSrc)}
750
+ name=${this.name}
751
+ size=${k(this.size)}
752
+ tagLabel=${k(this.tagLabel)}
753
+ .tagVariant=${this.tagVariant}
754
+ .walletIcon=${this.walletIcon}
755
+ .tabIdx=${this.tabIdx}
756
+ .disabled=${this.disabled}
757
+ .showAllWallets=${this.showAllWallets}
758
+ .loading=${this.loading}
759
+ loadingSpinnerColor=${this.loadingSpinnerColor}
760
+ .namespaces=${this.handleGetWalletNamespaces()}
761
+ ></wui-list-wallet>
762
+ `}};h.styles=Ne;p([l({type:Array})],h.prototype,"walletImages",void 0);p([l()],h.prototype,"imageSrc",void 0);p([l()],h.prototype,"name",void 0);p([l()],h.prototype,"size",void 0);p([l()],h.prototype,"tagLabel",void 0);p([l()],h.prototype,"tagVariant",void 0);p([l()],h.prototype,"walletIcon",void 0);p([l()],h.prototype,"tabIdx",void 0);p([l({type:Boolean})],h.prototype,"disabled",void 0);p([l({type:Boolean})],h.prototype,"showAllWallets",void 0);p([l({type:Boolean})],h.prototype,"loading",void 0);p([l({type:String})],h.prototype,"loadingSpinnerColor",void 0);p([l()],h.prototype,"rdnsId",void 0);p([l()],h.prototype,"displayIndex",void 0);p([l()],h.prototype,"walletRank",void 0);p([l({type:Array})],h.prototype,"namespaces",void 0);h=p([m("w3m-list-wallet")],h);const Te=g`
763
+ :host {
764
+ --local-duration-height: 0s;
765
+ --local-duration: ${({durations:e})=>e.lg};
766
+ --local-transition: ${({easings:e})=>e["ease-out-power-2"]};
767
+ }
768
+
769
+ .container {
770
+ display: block;
771
+ overflow: hidden;
772
+ overflow: hidden;
773
+ position: relative;
774
+ height: var(--local-container-height);
775
+ transition: height var(--local-duration-height) var(--local-transition);
776
+ will-change: height, padding-bottom;
777
+ }
778
+
779
+ .container[data-mobile-fullscreen='true'] {
780
+ overflow: scroll;
781
+ }
782
+
783
+ .page {
784
+ position: absolute;
785
+ top: 0;
786
+ left: 0;
787
+ right: 0;
788
+ width: 100%;
789
+ height: auto;
790
+ width: inherit;
791
+ box-sizing: border-box;
792
+ display: flex;
793
+ flex-direction: column;
794
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
795
+ border-bottom-left-radius: var(--local-border-bottom-radius);
796
+ border-bottom-right-radius: var(--local-border-bottom-radius);
797
+ transition: border-bottom-left-radius var(--local-duration) var(--local-transition);
798
+ }
799
+
800
+ .page[data-mobile-fullscreen='true'] {
801
+ height: 100%;
802
+ }
803
+
804
+ .page-content {
805
+ display: flex;
806
+ flex-direction: column;
807
+ min-height: 100%;
808
+ }
809
+
810
+ .footer {
811
+ height: var(--apkt-footer-height);
812
+ }
813
+
814
+ div.page[view-direction^='prev-'] .page-content {
815
+ animation:
816
+ slide-left-out var(--local-duration) forwards var(--local-transition),
817
+ slide-left-in var(--local-duration) forwards var(--local-transition);
818
+ animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg});
819
+ }
820
+
821
+ div.page[view-direction^='next-'] .page-content {
822
+ animation:
823
+ slide-right-out var(--local-duration) forwards var(--local-transition),
824
+ slide-right-in var(--local-duration) forwards var(--local-transition);
825
+ animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg});
826
+ }
827
+
828
+ @keyframes slide-left-out {
829
+ from {
830
+ transform: translateX(0px) scale(1);
831
+ opacity: 1;
832
+ filter: blur(0px);
833
+ }
834
+ to {
835
+ transform: translateX(8px) scale(0.99);
836
+ opacity: 0;
837
+ filter: blur(4px);
838
+ }
839
+ }
840
+
841
+ @keyframes slide-left-in {
842
+ from {
843
+ transform: translateX(-8px) scale(0.99);
844
+ opacity: 0;
845
+ filter: blur(4px);
846
+ }
847
+ to {
848
+ transform: translateX(0) translateY(0) scale(1);
849
+ opacity: 1;
850
+ filter: blur(0px);
851
+ }
852
+ }
853
+
854
+ @keyframes slide-right-out {
855
+ from {
856
+ transform: translateX(0px) scale(1);
857
+ opacity: 1;
858
+ filter: blur(0px);
859
+ }
860
+ to {
861
+ transform: translateX(-8px) scale(0.99);
862
+ opacity: 0;
863
+ filter: blur(4px);
864
+ }
865
+ }
866
+
867
+ @keyframes slide-right-in {
868
+ from {
869
+ transform: translateX(8px) scale(0.99);
870
+ opacity: 0;
871
+ filter: blur(4px);
872
+ }
873
+ to {
874
+ transform: translateX(0) translateY(0) scale(1);
875
+ opacity: 1;
876
+ filter: blur(0px);
877
+ }
878
+ }
879
+ `;var S=function(e,t,i,r){var a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,i,o):n(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o};const _e=60;let w=class extends b{constructor(){super(...arguments),this.resizeObserver=void 0,this.transitionDuration="0.15s",this.transitionFunction="",this.history="",this.view="",this.setView=void 0,this.viewDirection="",this.historyState="",this.previousHeight="0px",this.mobileFullScreen=R.state.enableMobileFullScreen,this.onViewportResize=()=>{this.updateContainerHeight()}}updated(t){if(t.has("history")){const i=this.history;this.historyState!==""&&this.historyState!==i&&this.onViewChange(i)}t.has("transitionDuration")&&this.style.setProperty("--local-duration",this.transitionDuration),t.has("transitionFunction")&&this.style.setProperty("--local-transition",this.transitionFunction)}firstUpdated(){this.transitionFunction&&this.style.setProperty("--local-transition",this.transitionFunction),this.style.setProperty("--local-duration",this.transitionDuration),this.historyState=this.history,this.resizeObserver=new ResizeObserver(t=>{for(const i of t)if(i.target===this.getWrapper()){let r=i.contentRect.height;const a=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");if(this.mobileFullScreen){const o=window.visualViewport?.height||window.innerHeight,n=this.getHeaderHeight();r=o-n-a,this.style.setProperty("--local-border-bottom-radius","0px")}else r=r+a,this.style.setProperty("--local-border-bottom-radius",a?"var(--apkt-borderRadius-5)":"0px");this.style.setProperty("--local-container-height",`${r}px`),this.previousHeight!=="0px"&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${r}px`}}),this.resizeObserver.observe(this.getWrapper()),this.updateContainerHeight(),window.addEventListener("resize",this.onViewportResize),window.visualViewport?.addEventListener("resize",this.onViewportResize)}disconnectedCallback(){const t=this.getWrapper();t&&this.resizeObserver&&this.resizeObserver.unobserve(t),window.removeEventListener("resize",this.onViewportResize),window.visualViewport?.removeEventListener("resize",this.onViewportResize)}render(){return d`
880
+ <div class="container" data-mobile-fullscreen="${k(this.mobileFullScreen)}">
881
+ <div
882
+ class="page"
883
+ data-mobile-fullscreen="${k(this.mobileFullScreen)}"
884
+ view-direction="${this.viewDirection}"
885
+ >
886
+ <div class="page-content">
887
+ <slot></slot>
888
+ </div>
889
+ </div>
890
+ </div>
891
+ `}onViewChange(t){const i=t.split(",").filter(Boolean),r=this.historyState.split(",").filter(Boolean),a=r.length,o=i.length,n=i[i.length-1]||"",s=ie.cssDurationToNumber(this.transitionDuration);let v="";o>a?v="next":o<a?v="prev":o===a&&i[o-1]!==r[a-1]&&(v="next"),this.viewDirection=`${v}-${n}`,setTimeout(()=>{this.historyState=t,this.setView?.(n)},s),setTimeout(()=>{this.viewDirection=""},s*2)}getWrapper(){return this.shadowRoot?.querySelector("div.page")}updateContainerHeight(){const t=this.getWrapper();if(!t)return;const i=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");let r=0;if(this.mobileFullScreen){const a=window.visualViewport?.height||window.innerHeight,o=this.getHeaderHeight();r=a-o-i,this.style.setProperty("--local-border-bottom-radius","0px")}else r=t.getBoundingClientRect().height+i,this.style.setProperty("--local-border-bottom-radius",i?"var(--apkt-borderRadius-5)":"0px");this.style.setProperty("--local-container-height",`${r}px`),this.previousHeight!=="0px"&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${r}px`}getHeaderHeight(){return _e}};w.styles=[Te];S([l({type:String})],w.prototype,"transitionDuration",void 0);S([l({type:String})],w.prototype,"transitionFunction",void 0);S([l({type:String})],w.prototype,"history",void 0);S([l({type:String})],w.prototype,"view",void 0);S([l({attribute:!1})],w.prototype,"setView",void 0);S([u()],w.prototype,"viewDirection",void 0);S([u()],w.prototype,"historyState",void 0);S([u()],w.prototype,"previousHeight",void 0);S([u()],w.prototype,"mobileFullScreen",void 0);w=S([m("w3m-router-container")],w);export{ee as AppKitModal,h as W3mListWallet,J as W3mModal,y as W3mModalBase,w as W3mRouterContainer,M as W3mUsageExceededView};