@imtbl/sdk 1.45.7 → 1.45.8-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/{BridgeWidget-64c347f2.js → BridgeWidget-71bff744.js} +1 -1
  3. package/dist/browser/checkout/{OnRampWidget-422f0deb.js → OnRampWidget-46fe907f.js} +1 -1
  4. package/dist/browser/checkout/{SaleWidget-db0a4da8.js → SaleWidget-033701bb.js} +1 -1
  5. package/dist/browser/checkout/{SpendingCapHero-e05cde66.js → SpendingCapHero-140d6190.js} +1 -1
  6. package/dist/browser/checkout/{SwapWidget-e433536e.js → SwapWidget-ed9dac16.js} +1 -1
  7. package/dist/browser/checkout/{TopUpView-e2509396.js → TopUpView-1ee8b40b.js} +1 -1
  8. package/dist/browser/checkout/{WalletWidget-e977ad55.js → WalletWidget-384ebef3.js} +1 -1
  9. package/dist/browser/checkout/{auto-track-4d0daee8.js → auto-track-9b783917.js} +1 -1
  10. package/dist/browser/checkout/{balance-697e25e1.js → balance-014b0b9b.js} +1 -1
  11. package/dist/browser/checkout/{index-5f876d53.js → index-025c2664.js} +1 -1
  12. package/dist/browser/checkout/{index-f28c8046.js → index-2c33ea6e.js} +1 -1
  13. package/dist/browser/checkout/{index-33d10388.js → index-48317d33.js} +2 -2
  14. package/dist/browser/checkout/index-74eb20b3.js +1 -0
  15. package/dist/browser/checkout/{index-2b1e0855.js → index-a3287251.js} +1 -1
  16. package/dist/browser/checkout/{index-6cfa4a78.js → index-c9345ba9.js} +1 -1
  17. package/dist/browser/checkout/{index-24dea9a2.js → index-ea648d72.js} +1 -1
  18. package/dist/browser/checkout/{index-7be33d6b.js → index-fa9a3407.js} +1 -1
  19. package/dist/browser/checkout/{index.umd-0d0184c5.js → index.umd-f925be7c.js} +1 -1
  20. package/dist/browser/checkout/{retry-2ec883f6.js → retry-f9fd4fab.js} +1 -1
  21. package/dist/browser/checkout/sdk.js +5 -5
  22. package/dist/browser/checkout/widgets-esm.js +1 -1
  23. package/dist/browser/checkout/widgets.js +1 -1
  24. package/dist/checkout.js +4 -4
  25. package/dist/config.js +1 -1
  26. package/dist/index.browser.js +4 -4
  27. package/dist/index.browser.js.map +1 -1
  28. package/dist/index.cjs +9 -9
  29. package/dist/index.js +9 -9
  30. package/dist/minting_backend.js +2 -2
  31. package/dist/orderbook.js +1 -1
  32. package/dist/passport.js +6 -6
  33. package/dist/webhook.js +1 -1
  34. package/dist/x.js +3 -3
  35. package/package.json +2 -2
  36. package/dist/browser/checkout/index-0b6090b7.js +0 -1
@@ -1 +1 @@
1
- import{at as t,cn as e,co as n,cp as o,cq as i,cr as r,cs as s,r as a,z as c,bG as l,j as u,n as d,M as f,a as m,l as h,V as E,E as p,t as g,bZ as S,$ as v,H as _,o as w,a3 as A,I,p as T,F as b}from"./index-33d10388.js";const C=new e(n),O={},y=t.from(0),R=t.from(-1);function x(t,n,o,i){const r={fault:n,operation:o};return void 0!==i&&(r.value=i),C.throwError(t,e.errors.NUMERIC_FAULT,r)}let N="0";for(;N.length<256;)N+=N;function P(e){if("number"!=typeof e)try{e=t.from(e).toNumber()}catch(t){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+N.substring(0,e):C.throwArgumentError("invalid decimal size","decimals",e)}function F(e,n){null==n&&(n=0);const o=P(n),i=(e=t.from(e)).lt(y);i&&(e=e.mul(R));let r=e.mod(o).toString();for(;r.length<o.length-1;)r="0"+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(o).toString();return e=1===o.length?s:s+"."+r,i&&(e="-"+e),e}function L(e,n){null==n&&(n=0);const o=P(n);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||C.throwArgumentError("invalid decimal value","value",e);const i="-"===e.substring(0,1);i&&(e=e.substring(1)),"."===e&&C.throwArgumentError("missing value","value",e);const r=e.split(".");r.length>2&&C.throwArgumentError("too many decimal points","value",e);let s=r[0],a=r[1];for(s||(s="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>o.length-1&&x("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<o.length-1;)a+="0";const c=t.from(s),l=t.from(a);let u=c.mul(o).add(l);return i&&(u=u.mul(R)),u}class U{constructor(t,n,o,i){t!==O&&C.throwError("cannot use FixedFormat constructor; use FixedFormat.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=n,this.width=o,this.decimals=i,this.name=(n?"":"u")+"fixed"+String(o)+"x"+String(i),this._multiplier=P(i),Object.freeze(this)}static from(t){if(t instanceof U)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,n=128,o=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||C.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],n=parseInt(i[2]),o=parseInt(i[3])}else if(t){const i=(e,n,o)=>null==t[e]?o:(typeof t[e]!==n&&C.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),o=i("decimals","number",o)}return n%8&&C.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),o>80&&C.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new U(O,e,n,o)}}class k{constructor(t,n,o,i){t!==O&&C.throwError("cannot use FixedNumber constructor; use FixedNumber.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=o,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&C.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=k.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(W.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=k.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(W.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&C.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=k.from("1"+N.substring(0,t),this.format),o=D.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&C.throwArgumentError("invalid byte width","width",e);const n=t.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return o(n,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return k.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||i(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),k.fromString(F(t,e),U.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=U.from(e),i=L(t,n.decimals);!n.signed&&i.lt(y)&&x("unsigned value cannot be negative","overflow","value",t);let r=null;n.signed?r=i.toTwos(n.width).toHexString():(r=i.toHexString(),r=o(r,n.width/8));const s=F(i,n.decimals);return new k(O,r,s,n)}static fromBytes(e,n){null==n&&(n="fixed");const o=U.from(n);if(r(e).length>o.width/8)throw new Error("overflow");let i=t.from(e);o.signed&&(i=i.fromTwos(o.width));const s=i.toTwos((o.signed?0:1)+o.width).toHexString(),a=F(i,o.decimals);return new k(O,s,a,o)}static from(t,n){if("string"==typeof t)return k.fromString(t,n);if(s(t))return k.fromBytes(t,n);try{return k.fromValue(t,0,n)}catch(t){if(t.code!==e.errors.INVALID_ARGUMENT)throw t}return C.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const W=k.from(1),D=k.from("0.5"),B=new e("units/5.7.0"),V=["wei","kwei","mwei","gwei","szabo","finney","ether"];function M(t,e){if("string"==typeof e){const t=V.indexOf(e);-1!==t&&(e=3*t)}return F(t,null!=e?e:18)}function $(t,e){if("string"!=typeof t&&B.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=V.indexOf(e);-1!==t&&(e=3*t)}return L(t,null!=e?e:18)}function G(t){return $(t,18)}var K;!function(t){t.USD="usd"}(K||(K={}));const H={cryptoFiat:null,fiatSymbol:K.USD,tokenSymbols:[],conversions:new Map};var Y;!function(t){t.SET_CRYPTO_FIAT="SET_CRYPTO_FIAT",t.SET_FIAT_SYMBOL="SET_FIAT_SYMBOL",t.SET_TOKEN_SYMBOLS="SET_TOKEN_SYMBOLS",t.SET_CONVERSIONS="SET_CONVERSIONS"}(Y||(Y={}));const z=a.createContext({cryptoFiatState:H,cryptoFiatDispatch:()=>{}}),j=(t,e)=>{switch(e.payload.type){case Y.SET_CRYPTO_FIAT:return{...t,cryptoFiat:e.payload.cryptoFiat};case Y.SET_FIAT_SYMBOL:return{...t,fiatSymbol:e.payload.fiatSymbol};case Y.SET_TOKEN_SYMBOLS:return{...t,tokenSymbols:e.payload.tokenSymbols};case Y.SET_CONVERSIONS:return{...t,conversions:e.payload.conversions};default:return t}};var q;!function(t){t.SWAP="SWAP",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL",t.PRICE_SURGE="PRICE_SURGE",t.APPROVE_ERC20="APPROVE_ERC20_SWAP"}(q||(q={}));class X{baseConfig;constructor({baseConfig:t}){this.baseConfig=t}}const J={[c.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[c.PRODUCTION]:"https://checkout-api.immutable.com"};class Z{coinsCache;overridesCache;config;constructor(t){this.coinsCache=null,this.overridesCache=null,this.config=t.baseConfig}urlWithPath(t){return J[this.config.environment]+t}async fetchOverrides(){if(null!==this.overridesCache)return;const t=this.urlWithPath("/v1/fiat/coins/overrides"),e=await l.get(t);if(200!==e.status)throw new Error(`Error fetching coins overrides: ${e.status} ${e.statusText}`);this.overridesCache=new Map(Object.entries(e.data))}async fetchCoins(){if(null!==this.coinsCache)return;await this.fetchOverrides();const t=this.urlWithPath("/v1/fiat/coins/all"),e=await l.get(t);if(200!==e.status)throw new Error(`Error fetching coins list: ${e.status} ${e.statusText}`);const{data:n}=e;this.coinsCache=new Map;for(const t of n){const e=this.overridesCache.get(t.symbol.toLowerCase());this.coinsCache.set(t.symbol.toLowerCase(),e||t.id.toLowerCase())}}async convert({tokenSymbols:t,fiatSymbols:e=[]}){if(!t||0===t.length)throw new Error("Error missing token symbols to convert");const n=e.filter((t=>""!==t));0===n.length&&n.push("usd"),await this.fetchCoins();const o=t.map((t=>this.coinsCache.get(t.toLowerCase()))).filter((t=>""!==t&&void 0!==t)).join(","),i=n.join(",").toLowerCase(),r=this.urlWithPath(`/v1/fiat/conversion?ids=${o}&currencies=${i}`),s=await l.get(r);if(200!==s.status)throw new Error(`Error fetching prices: ${s.status} ${s.statusText}`);const{data:a}=s,c={};for(const e of t){const t=e.toLowerCase(),n=this.coinsCache.get(t);c[t]={},n&&(c[t]=a[n]||{})}return c}}const Q=async(t,e,n)=>{try{if(0===n.length)return new Map;return((t,e)=>{const n=new Map;for(const o in t){const i=t[o][e];void 0!==i&&n.set(o,i)}return n})(await t.convert({tokenSymbols:n,fiatSymbols:[e]}),e)}catch(t){return new Map}},tt=["ETH","IMX"];function et({environment:t,children:e}){const[n,o]=a.useReducer(j,H),{cryptoFiat:i,fiatSymbol:r,tokenSymbols:s}=n;return a.useEffect((()=>{o({payload:{type:Y.SET_CRYPTO_FIAT,cryptoFiat:new Z(new X({baseConfig:{environment:t}}))}})}),[]),a.useEffect((()=>{i&&r&&(async()=>{const t=await Q(i,r,[...new Set([...s,...tt])]);o({payload:{type:Y.SET_CONVERSIONS,conversions:t}})})()}),[i,s,r]),u(z.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:o},children:e})}var nt;!function(t){t.WALLET_NETWORK_SELECTION="WALLET_NETWORK_SELECTION",t.BRIDGE_FORM="BRIDGE_FORM",t.BRIDGE_REVIEW="BRIDGE_REVIEW",t.IN_PROGRESS="IN_PROGRESS",t.BRIDGE_FAILURE="BRIDGE_FAILURE",t.APPROVE_TRANSACTION="APPROVE_TRANSACTION",t.TRANSACTIONS="TRANSACTIONS",t.CLAIM_WITHDRAWAL="CLAIM_WITHDRAWAL",t.CLAIM_WITHDRAWAL_IN_PROGRESS="CLAIM_WITHDRAWAL_IN_PROGRESS",t.CLAIM_WITHDRAWAL_SUCCESS="CLAIM_WITHDRAWAL_SUCCESS",t.CLAIM_WITHDRAWAL_FAILURE="CLAIM_WITHDRAWAL_FAILURE"}(nt||(nt={}));const ot=(t,e,n)=>{const o=a.useRef(!1);a.useEffect((()=>{o.current||("function"!=typeof e||e())&&(t(),o.current=!0)}),n||[])};const it=(t,e)=>{const{fees:n,token:o}=t;if(void 0===n.totalFees)return"-.--";if(void 0===o)return"-.--";const i=((t,e,n)=>{let o=-1;if(t&&e){const i=M(t,e.decimals),r=n.get(e.symbol.toLocaleLowerCase());if(r){const t=parseFloat(i);if(Number.isNaN(t))return o;o=t*r}}return o})(n.totalFees,o,e);return i<0?"-.--":function(t){if(t<0)return"-.--";const e=t.toString();if(e.includes("e")||0===t)return"0.00";if(t<.01)for(let n=0;n<e.length;n++)if("0"!==e[n]&&"."!==e[n])return t.toFixed(n-1);return t.toFixed(2)}(i)};var rt;function st({testId:t,icon:e,iconVariant:n,intentIcon:o,heading:i,caption:r,onClick:s,renderFeeFunction:a,isDisabled:c}){return u(m,{testId:"top-up-view",sx:{paddingY:"1px"},children:d(f,{testId:`menu-item-${t}`,size:"small",emphasized:!0,onClick:c?void 0:s,sx:c?{opacity:"0.5",cursor:"not-allowed"}:{},children:[u(f.Icon,{icon:e,variant:n}),u(f.Label,{size:"medium",children:i}),u(f.IntentIcon,{icon:o}),d(f.Caption,{testId:`menu-item-caption-${t}`,children:[r,u("br",{}),c?"":a("-.--",!1)]})]})})}!function(t){t.ONRAMP="ONRAMP",t.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL"}(rt||(rt={}));const at={[c.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[c.PRODUCTION]:"https://toolkit.immutable.com"};function ct({widgetEvent:t,checkout:e,provider:n,showOnrampOption:o,showSwapOption:i,showBridgeOption:r,tokenAddress:s,amount:l,analytics:f,onCloseButtonClick:C,onBackButtonClick:O,heading:y,subheading:R}){const{t:x}=h(),{userJourney:N}=f,{viewDispatch:P}=a.useContext(E),{cryptoFiatState:F,cryptoFiatDispatch:L}=a.useContext(z),{conversions:U,fiatSymbol:k}=F,W=e?.config.environment??c.SANDBOX,{eventTargetState:{eventTarget:D}}=a.useContext(p),[B,V]=a.useState("-.--"),[,M]=a.useState("-.--"),[$,G]=a.useState(!0),K=y?x(...y):x("views.TOP_UP_VIEW.header.title"),H=R?x(...R):null,{page:j,track:X}=g();ot((()=>{j({userJourney:N,screen:"TopUp"})})),a.useEffect((()=>{L&&L({payload:{type:Y.SET_TOKEN_SYMBOLS,tokenSymbols:tt}})}),[L]),a.useEffect((()=>{e&&(async()=>{const t=await e.gasEstimate({gasEstimateType:S.BRIDGE_TO_L2}),n=await it(t,U);M(n)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{const t=(t=>{const{minPercentage:e,maxPercentage:n}=t;return void 0===e||void 0===n?"-.--":`${e}% to ${n}`})(await e.getExchangeFeeEstimate());V(t)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{G(await e.isSwapAvailable())})()}),[void 0!==e]);const J=(t,e,n="Button")=>{X({userJourney:N,screen:"TopUp",control:t,controlType:n,extras:e})},Z=()=>{if(t===I.IMTBL_ONRAMP_WIDGET_EVENT){const e={tokenAddress:"",amount:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:rt.ONRAMP,data:e}}}),void J("OnRamp",{...e,widgetEvent:t})}const e={tokenAddress:s??"",amount:l??""};b.sendRequestOnrampEvent(D,t,e),J("OnRamp",{...e,widgetEvent:t})},Q=t=>u(m,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:t}),et=[{testId:"onramp",icon:"BankCard",iconVariant:"bold",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.debit",onClickEvent:Z,fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.debit.subcaption")} ≈ ${B}%`),isAvailable:!0,isEnabled:o},{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.credit",onClickEvent:Z,fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.credit.subcaption")} ≈ ${B}%`),isAvailable:!0,isEnabled:o},{testId:"advanced",icon:"Minting",iconVariant:"bold",intentIcon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const e=at[W];J("AdvancedOptions",{...{tokenAddress:s??"",amount:l??""},widgetEvent:t}),window.open(`${e}/squid-bridge/`,"_blank")},fee:()=>Q(""),isAvailable:!0,isEnabled:!0},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(t===I.IMTBL_SWAP_WIDGET_EVENT){const e={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:q.SWAP,data:e}}}),void J("Swap",{...e,widgetEvent:t})}const e={fromTokenAddress:"",toTokenAddress:s??"",amount:""};b.sendRequestSwapEvent(D,t,e),J("Swap",{...e,widgetEvent:t})},fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${k.toUpperCase()}`),isAvailable:$,isEnabled:i},{testId:"bridge",icon:"ArrowForward",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(t===I.IMTBL_BRIDGE_WIDGET_EVENT){const e={fromTokenAddress:"",fromAmount:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:nt.WALLET_NETWORK_SELECTION,data:e}}}),void J("Bridge",{...e,widgetEvent:t})}const e={tokenAddress:"",amount:""};b.sendRequestBridgeEvent(D,t,e),J("Bridge",{...e,widgetEvent:t})},fee:()=>Q(""),isAvailable:!0,isEnabled:r}];return u(A,{header:u(v,{onBackButtonClick:O,onCloseButtonClick:C,showBack:!0}),children:d(m,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[u(_,{size:"small",children:K}),H&&u(w,{size:"small",sx:{color:"base.color.text.body.secondary"},children:H}),u(m,{sx:{paddingY:"base.spacing.x4"},children:et.sort(((t,e)=>Number(e.isAvailable)-Number(t.isAvailable))).map((t=>t.isEnabled&&u(st,{testId:t.testId,icon:t.icon,iconVariant:t.iconVariant,intentIcon:t.intentIcon,heading:x(`${t.textConfigKey}.heading`),caption:t.isAvailable?x(`${t.textConfigKey}.caption`):x(`${t.textConfigKey}.disabledCaption`),onClick:t.onClickEvent,renderFeeFunction:t.fee,isDisabled:!t.isAvailable},x(`${t.textConfigKey}.heading`).toLowerCase())))})]})})}export{nt as B,z as C,rt as O,q as S,ct as T,Y as a,et as b,G as c,M as f,$ as p,ot as u};
1
+ import{at as t,cn as e,co as n,cp as o,cq as i,cr as r,cs as s,r as a,z as c,bG as l,j as u,n as d,M as f,a as m,l as h,V as E,E as p,t as g,bZ as S,$ as v,H as _,o as w,a3 as A,I,p as T,F as b}from"./index-48317d33.js";const C=new e(n),O={},y=t.from(0),R=t.from(-1);function x(t,n,o,i){const r={fault:n,operation:o};return void 0!==i&&(r.value=i),C.throwError(t,e.errors.NUMERIC_FAULT,r)}let N="0";for(;N.length<256;)N+=N;function P(e){if("number"!=typeof e)try{e=t.from(e).toNumber()}catch(t){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+N.substring(0,e):C.throwArgumentError("invalid decimal size","decimals",e)}function F(e,n){null==n&&(n=0);const o=P(n),i=(e=t.from(e)).lt(y);i&&(e=e.mul(R));let r=e.mod(o).toString();for(;r.length<o.length-1;)r="0"+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(o).toString();return e=1===o.length?s:s+"."+r,i&&(e="-"+e),e}function L(e,n){null==n&&(n=0);const o=P(n);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||C.throwArgumentError("invalid decimal value","value",e);const i="-"===e.substring(0,1);i&&(e=e.substring(1)),"."===e&&C.throwArgumentError("missing value","value",e);const r=e.split(".");r.length>2&&C.throwArgumentError("too many decimal points","value",e);let s=r[0],a=r[1];for(s||(s="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>o.length-1&&x("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<o.length-1;)a+="0";const c=t.from(s),l=t.from(a);let u=c.mul(o).add(l);return i&&(u=u.mul(R)),u}class U{constructor(t,n,o,i){t!==O&&C.throwError("cannot use FixedFormat constructor; use FixedFormat.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=n,this.width=o,this.decimals=i,this.name=(n?"":"u")+"fixed"+String(o)+"x"+String(i),this._multiplier=P(i),Object.freeze(this)}static from(t){if(t instanceof U)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,n=128,o=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||C.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],n=parseInt(i[2]),o=parseInt(i[3])}else if(t){const i=(e,n,o)=>null==t[e]?o:(typeof t[e]!==n&&C.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),o=i("decimals","number",o)}return n%8&&C.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),o>80&&C.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new U(O,e,n,o)}}class k{constructor(t,n,o,i){t!==O&&C.throwError("cannot use FixedNumber constructor; use FixedNumber.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=o,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&C.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=k.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(W.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=k.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(W.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&C.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=k.from("1"+N.substring(0,t),this.format),o=D.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&C.throwArgumentError("invalid byte width","width",e);const n=t.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return o(n,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return k.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||i(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),k.fromString(F(t,e),U.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=U.from(e),i=L(t,n.decimals);!n.signed&&i.lt(y)&&x("unsigned value cannot be negative","overflow","value",t);let r=null;n.signed?r=i.toTwos(n.width).toHexString():(r=i.toHexString(),r=o(r,n.width/8));const s=F(i,n.decimals);return new k(O,r,s,n)}static fromBytes(e,n){null==n&&(n="fixed");const o=U.from(n);if(r(e).length>o.width/8)throw new Error("overflow");let i=t.from(e);o.signed&&(i=i.fromTwos(o.width));const s=i.toTwos((o.signed?0:1)+o.width).toHexString(),a=F(i,o.decimals);return new k(O,s,a,o)}static from(t,n){if("string"==typeof t)return k.fromString(t,n);if(s(t))return k.fromBytes(t,n);try{return k.fromValue(t,0,n)}catch(t){if(t.code!==e.errors.INVALID_ARGUMENT)throw t}return C.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const W=k.from(1),D=k.from("0.5"),B=new e("units/5.7.0"),V=["wei","kwei","mwei","gwei","szabo","finney","ether"];function M(t,e){if("string"==typeof e){const t=V.indexOf(e);-1!==t&&(e=3*t)}return F(t,null!=e?e:18)}function $(t,e){if("string"!=typeof t&&B.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=V.indexOf(e);-1!==t&&(e=3*t)}return L(t,null!=e?e:18)}function G(t){return $(t,18)}var K;!function(t){t.USD="usd"}(K||(K={}));const H={cryptoFiat:null,fiatSymbol:K.USD,tokenSymbols:[],conversions:new Map};var Y;!function(t){t.SET_CRYPTO_FIAT="SET_CRYPTO_FIAT",t.SET_FIAT_SYMBOL="SET_FIAT_SYMBOL",t.SET_TOKEN_SYMBOLS="SET_TOKEN_SYMBOLS",t.SET_CONVERSIONS="SET_CONVERSIONS"}(Y||(Y={}));const z=a.createContext({cryptoFiatState:H,cryptoFiatDispatch:()=>{}}),j=(t,e)=>{switch(e.payload.type){case Y.SET_CRYPTO_FIAT:return{...t,cryptoFiat:e.payload.cryptoFiat};case Y.SET_FIAT_SYMBOL:return{...t,fiatSymbol:e.payload.fiatSymbol};case Y.SET_TOKEN_SYMBOLS:return{...t,tokenSymbols:e.payload.tokenSymbols};case Y.SET_CONVERSIONS:return{...t,conversions:e.payload.conversions};default:return t}};var q;!function(t){t.SWAP="SWAP",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL",t.PRICE_SURGE="PRICE_SURGE",t.APPROVE_ERC20="APPROVE_ERC20_SWAP"}(q||(q={}));class X{baseConfig;constructor({baseConfig:t}){this.baseConfig=t}}const J={[c.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[c.PRODUCTION]:"https://checkout-api.immutable.com"};class Z{coinsCache;overridesCache;config;constructor(t){this.coinsCache=null,this.overridesCache=null,this.config=t.baseConfig}urlWithPath(t){return J[this.config.environment]+t}async fetchOverrides(){if(null!==this.overridesCache)return;const t=this.urlWithPath("/v1/fiat/coins/overrides"),e=await l.get(t);if(200!==e.status)throw new Error(`Error fetching coins overrides: ${e.status} ${e.statusText}`);this.overridesCache=new Map(Object.entries(e.data))}async fetchCoins(){if(null!==this.coinsCache)return;await this.fetchOverrides();const t=this.urlWithPath("/v1/fiat/coins/all"),e=await l.get(t);if(200!==e.status)throw new Error(`Error fetching coins list: ${e.status} ${e.statusText}`);const{data:n}=e;this.coinsCache=new Map;for(const t of n){const e=this.overridesCache.get(t.symbol.toLowerCase());this.coinsCache.set(t.symbol.toLowerCase(),e||t.id.toLowerCase())}}async convert({tokenSymbols:t,fiatSymbols:e=[]}){if(!t||0===t.length)throw new Error("Error missing token symbols to convert");const n=e.filter((t=>""!==t));0===n.length&&n.push("usd"),await this.fetchCoins();const o=t.map((t=>this.coinsCache.get(t.toLowerCase()))).filter((t=>""!==t&&void 0!==t)).join(","),i=n.join(",").toLowerCase(),r=this.urlWithPath(`/v1/fiat/conversion?ids=${o}&currencies=${i}`),s=await l.get(r);if(200!==s.status)throw new Error(`Error fetching prices: ${s.status} ${s.statusText}`);const{data:a}=s,c={};for(const e of t){const t=e.toLowerCase(),n=this.coinsCache.get(t);c[t]={},n&&(c[t]=a[n]||{})}return c}}const Q=async(t,e,n)=>{try{if(0===n.length)return new Map;return((t,e)=>{const n=new Map;for(const o in t){const i=t[o][e];void 0!==i&&n.set(o,i)}return n})(await t.convert({tokenSymbols:n,fiatSymbols:[e]}),e)}catch(t){return new Map}},tt=["ETH","IMX"];function et({environment:t,children:e}){const[n,o]=a.useReducer(j,H),{cryptoFiat:i,fiatSymbol:r,tokenSymbols:s}=n;return a.useEffect((()=>{o({payload:{type:Y.SET_CRYPTO_FIAT,cryptoFiat:new Z(new X({baseConfig:{environment:t}}))}})}),[]),a.useEffect((()=>{i&&r&&(async()=>{const t=await Q(i,r,[...new Set([...s,...tt])]);o({payload:{type:Y.SET_CONVERSIONS,conversions:t}})})()}),[i,s,r]),u(z.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:o},children:e})}var nt;!function(t){t.WALLET_NETWORK_SELECTION="WALLET_NETWORK_SELECTION",t.BRIDGE_FORM="BRIDGE_FORM",t.BRIDGE_REVIEW="BRIDGE_REVIEW",t.IN_PROGRESS="IN_PROGRESS",t.BRIDGE_FAILURE="BRIDGE_FAILURE",t.APPROVE_TRANSACTION="APPROVE_TRANSACTION",t.TRANSACTIONS="TRANSACTIONS",t.CLAIM_WITHDRAWAL="CLAIM_WITHDRAWAL",t.CLAIM_WITHDRAWAL_IN_PROGRESS="CLAIM_WITHDRAWAL_IN_PROGRESS",t.CLAIM_WITHDRAWAL_SUCCESS="CLAIM_WITHDRAWAL_SUCCESS",t.CLAIM_WITHDRAWAL_FAILURE="CLAIM_WITHDRAWAL_FAILURE"}(nt||(nt={}));const ot=(t,e,n)=>{const o=a.useRef(!1);a.useEffect((()=>{o.current||("function"!=typeof e||e())&&(t(),o.current=!0)}),n||[])};const it=(t,e)=>{const{fees:n,token:o}=t;if(void 0===n.totalFees)return"-.--";if(void 0===o)return"-.--";const i=((t,e,n)=>{let o=-1;if(t&&e){const i=M(t,e.decimals),r=n.get(e.symbol.toLocaleLowerCase());if(r){const t=parseFloat(i);if(Number.isNaN(t))return o;o=t*r}}return o})(n.totalFees,o,e);return i<0?"-.--":function(t){if(t<0)return"-.--";const e=t.toString();if(e.includes("e")||0===t)return"0.00";if(t<.01)for(let n=0;n<e.length;n++)if("0"!==e[n]&&"."!==e[n])return t.toFixed(n-1);return t.toFixed(2)}(i)};var rt;function st({testId:t,icon:e,iconVariant:n,intentIcon:o,heading:i,caption:r,onClick:s,renderFeeFunction:a,isDisabled:c}){return u(m,{testId:"top-up-view",sx:{paddingY:"1px"},children:d(f,{testId:`menu-item-${t}`,size:"small",emphasized:!0,onClick:c?void 0:s,sx:c?{opacity:"0.5",cursor:"not-allowed"}:{},children:[u(f.Icon,{icon:e,variant:n}),u(f.Label,{size:"medium",children:i}),u(f.IntentIcon,{icon:o}),d(f.Caption,{testId:`menu-item-caption-${t}`,children:[r,u("br",{}),c?"":a("-.--",!1)]})]})})}!function(t){t.ONRAMP="ONRAMP",t.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL"}(rt||(rt={}));const at={[c.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[c.PRODUCTION]:"https://toolkit.immutable.com"};function ct({widgetEvent:t,checkout:e,provider:n,showOnrampOption:o,showSwapOption:i,showBridgeOption:r,tokenAddress:s,amount:l,analytics:f,onCloseButtonClick:C,onBackButtonClick:O,heading:y,subheading:R}){const{t:x}=h(),{userJourney:N}=f,{viewDispatch:P}=a.useContext(E),{cryptoFiatState:F,cryptoFiatDispatch:L}=a.useContext(z),{conversions:U,fiatSymbol:k}=F,W=e?.config.environment??c.SANDBOX,{eventTargetState:{eventTarget:D}}=a.useContext(p),[B,V]=a.useState("-.--"),[,M]=a.useState("-.--"),[$,G]=a.useState(!0),K=y?x(...y):x("views.TOP_UP_VIEW.header.title"),H=R?x(...R):null,{page:j,track:X}=g();ot((()=>{j({userJourney:N,screen:"TopUp"})})),a.useEffect((()=>{L&&L({payload:{type:Y.SET_TOKEN_SYMBOLS,tokenSymbols:tt}})}),[L]),a.useEffect((()=>{e&&(async()=>{const t=await e.gasEstimate({gasEstimateType:S.BRIDGE_TO_L2}),n=await it(t,U);M(n)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{const t=(t=>{const{minPercentage:e,maxPercentage:n}=t;return void 0===e||void 0===n?"-.--":`${e}% to ${n}`})(await e.getExchangeFeeEstimate());V(t)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{G(await e.isSwapAvailable())})()}),[void 0!==e]);const J=(t,e,n="Button")=>{X({userJourney:N,screen:"TopUp",control:t,controlType:n,extras:e})},Z=()=>{if(t===I.IMTBL_ONRAMP_WIDGET_EVENT){const e={tokenAddress:"",amount:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:rt.ONRAMP,data:e}}}),void J("OnRamp",{...e,widgetEvent:t})}const e={tokenAddress:s??"",amount:l??""};b.sendRequestOnrampEvent(D,t,e),J("OnRamp",{...e,widgetEvent:t})},Q=t=>u(m,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:t}),et=[{testId:"onramp",icon:"BankCard",iconVariant:"bold",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.debit",onClickEvent:Z,fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.debit.subcaption")} ≈ ${B}%`),isAvailable:!0,isEnabled:o},{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.credit",onClickEvent:Z,fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.credit.subcaption")} ≈ ${B}%`),isAvailable:!0,isEnabled:o},{testId:"advanced",icon:"Minting",iconVariant:"bold",intentIcon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const e=at[W];J("AdvancedOptions",{...{tokenAddress:s??"",amount:l??""},widgetEvent:t}),window.open(`${e}/squid-bridge/`,"_blank")},fee:()=>Q(""),isAvailable:!0,isEnabled:!0},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(t===I.IMTBL_SWAP_WIDGET_EVENT){const e={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:q.SWAP,data:e}}}),void J("Swap",{...e,widgetEvent:t})}const e={fromTokenAddress:"",toTokenAddress:s??"",amount:""};b.sendRequestSwapEvent(D,t,e),J("Swap",{...e,widgetEvent:t})},fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${k.toUpperCase()}`),isAvailable:$,isEnabled:i},{testId:"bridge",icon:"ArrowForward",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(t===I.IMTBL_BRIDGE_WIDGET_EVENT){const e={fromTokenAddress:"",fromAmount:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:nt.WALLET_NETWORK_SELECTION,data:e}}}),void J("Bridge",{...e,widgetEvent:t})}const e={tokenAddress:"",amount:""};b.sendRequestBridgeEvent(D,t,e),J("Bridge",{...e,widgetEvent:t})},fee:()=>Q(""),isAvailable:!0,isEnabled:r}];return u(A,{header:u(v,{onBackButtonClick:O,onCloseButtonClick:C,showBack:!0}),children:d(m,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[u(_,{size:"small",children:K}),H&&u(w,{size:"small",sx:{color:"base.color.text.body.secondary"},children:H}),u(m,{sx:{paddingY:"base.spacing.x4"},children:et.sort(((t,e)=>Number(e.isAvailable)-Number(t.isAvailable))).map((t=>t.isEnabled&&u(st,{testId:t.testId,icon:t.icon,iconVariant:t.iconVariant,intentIcon:t.intentIcon,heading:x(`${t.textConfigKey}.heading`),caption:t.isAvailable?x(`${t.textConfigKey}.caption`):x(`${t.textConfigKey}.disabledCaption`),onClick:t.onClickEvent,renderFeeFunction:t.fee,isDisabled:!t.isAvailable},x(`${t.textConfigKey}.heading`).toLowerCase())))})]})})}export{nt as B,z as C,rt as O,q as S,ct as T,Y as a,et as b,G as c,M as f,$ as p,ot as u};
@@ -1 +1 @@
1
- import{B as e,_ as t,u as n,g as o,D as a,m as s,r,f as i,j as l,i as c,S as d,a as p,b as L,c as u,s as h,C,d as b,e as k,h as f,k as m,T as w,l as g,V as y,n as E,o as S,p as T,q as v,t as x,v as A,E as I,w as O,x as M,y as W,z as _,M as N,H as B,A as F,U as P,F as j,I as D,Z,G as R,J as z,K as U,L as V,N as G,O as $,P as H,Q as J,R as K,W as X,X as Y,Y as q,$ as Q,a0 as ee,a1 as te,a2 as ne,a3 as oe,a4 as ae,a5 as se,a6 as re,a7 as ie,a8 as le,a9 as ce,aa as de,ab as pe,ac as Le,ad as ue,ae as he,af as Ce,ag as be,ah as ke,ai as fe,aj as me,ak as we}from"./index-33d10388.js";import{C as ge,a as ye,b as Ee,T as Se}from"./TopUpView-e2509396.js";import{T as Te,r as ve,u as xe}from"./retry-2ec883f6.js";var Ae={justifyContent:"stretch",bg:"base.color.translucent.standard.100",position:"relative",d:"flex",w:"100%"};function Ie(e){var t=e.size,n=e.theme,o=/large|medium/.test(t)?n.base.spacing.x2:n.base.spacing.x1;return{gap:o,padding:o,borderRadius:/large|medium/.test(t)?n.base.borderRadius.x8:n.base.borderRadius.x4}}var Oe=function(e){var t=e.size,n=e.theme;return L({size:t,theme:n,renderSxAtSize:Ie})},Me={flex:1,paddingX:"base.spacing.x4",transitionProperty:"background, color, box-shadow",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","& > span":{textAlign:"left",whiteSpace:"nowrap"},"&.HorizontalMenuButton, &.HorizontalMenuButtCon":{"&:hover:not([disabled])::before":{content:"unset"},"&:hover:not([disabled])":{bg:"base.color.translucent.emphasis.200",boxShadow:function(e){var t=e.base;return"inset 0 0 0 ".concat(t.border.size[100]," ").concat(t.color.translucent.standard[1e3])}},"&:active:not([disabled])":{bg:"base.color.translucent.emphasis.100"},"&.selected":{bg:"base.color.translucent.inverse.500"},"&.selected, &:active:not([disabled])":{boxShadow:function(e){var t=e.base;return"inset 0 0 0 ".concat(t.border.size[200]," ").concat(t.color.translucent.standard[1e3])}}}};function We(e){var t=e.size,n=e.theme;return{borderRadius:/large|medium/.test(t)?n.base.borderRadius.x4:n.base.spacing.x2}}var _e=function(e){var t=e.size,n=e.theme;return L({size:t,theme:n,renderSxAtSize:We})},Ne=["sx","size","selected","className"];function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pe(i){var c=i.sx,d=void 0===c?{}:c,p=i.size,L=void 0===p?"medium":p,b=i.selected,k=i.className,f=t(i,Ne),m=n(),w=o(L,a,u),g=r.useMemo((function(){return s(Me,We({size:w,theme:m}),_e({size:L,theme:m}),h(d,"base.color.translucent.emphasis.100"),d)}),[d,w,L,m]);return l(C,{children:function(t){var n=t.cx;return l(e,Fe(Fe({},f),{},{size:L,variant:"tertiary",sx:g,className:n(k,"HorizontalMenuButtCon",{selected:b})}))}})}Pe.displayName="HorizontalMenuButtCon",Pe.SvgIcon=e.SvgIcon;var je=["children","sx","size","selected","className"];function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Re(e){var i=e.children,c=e.sx,d=void 0===c?{}:c,p=e.size,L=void 0===p?"medium":p,k=e.selected,f=e.className,m=t(e,je),w=n(),g=o(L,a,u),y=r.useMemo((function(){return s(Me,We({size:g,theme:w}),_e({size:L,theme:w}),h(d,"base.color.translucent.emphasis.100"),d)}),[d,g,L,w]);return l(C,{children:function(e){var t=e.cx;return l(b,Ze(Ze({},m),{},{size:L,variant:"tertiary",className:t(f,"HorizontalMenuButton",{selected:k}),sx:y,children:i}))}})}Re.displayName="HorizontalMenuButton",Re.Icon=k,Re.Logo=f;var ze=["children","sx","size","className"];function Ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(e){var L=e.children,h=e.sx,C=void 0===h?{}:h,b=e.size,k=void 0===b?"medium":b,f=e.className,m=t(e,ze),w=n(),g=o(k,a,u),y=s(Ae,Ie({size:g,theme:w}),Oe({size:k,theme:w}),C),E=r.useMemo((function(){return i(L)}),[L]);return l(p,Ve(Ve({},m),{},{sx:y,className:"".concat(null!=f?f:""," HorizontalMenu"),children:r.Children.map(E,(function(e){return c(e,Pe)||c(e,Re)?l(d,{size:e.props.size?e.props.size:k,children:e}):e}))}))}Ge.displayName="HorizontalMenu",Ge.Button=Re,Ge.ButtCon=Pe;const $e={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var He;!function(e){e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_SUPPORTED_TOP_UPS="SUPPORTED_TOP_UPS"}(He||(He={}));const Je=r.createContext({walletState:$e,walletDispatch:()=>{}});Je.displayName="WalletContext";const Ke=(e,t)=>{switch(t.payload.type){case He.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case He.SET_NETWORK:return{...e,network:t.payload.network};case He.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case He.SET_SUPPORTED_TOP_UPS:return{...e,supportedTopUps:{isSwapEnabled:t.payload.supportedTopUps.isSwapEnabled??!0,isOnRampEnabled:t.payload.supportedTopUps.isOnRampEnabled??!0,isBridgeEnabled:t.payload.supportedTopUps.isBridgeEnabled??!0,isSwapAvailable:t.payload.supportedTopUps.isSwapAvailable??!0}};default:return e}},Xe=async(e,t)=>{const n=await e.getTokenAllowList({type:w.ALL,chainId:t}),o=new Set;return n.tokens.forEach((e=>{o.add(e.symbol)})),Array.from(o)},Ye={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},qe={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},Qe={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var et;function tt(t){const{t:n}=g(),{viewDispatch:o}=r.useContext(y),{totalBalance:a,loading:s}=t;return E(p,{sx:Ye,children:[E(p,{sx:qe,children:[l(S,{size:"medium",children:n("views.WALLET_BALANCES.totalTokenBalance.heading")}),l(p,{sx:{pl:"base.spacing.x1"},children:l(e,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:Qe,onClick:()=>o({payload:{type:T.UPDATE_VIEW,view:{type:et.COIN_INFO}}})})})]}),E(p,{sx:qe,children:[l(S,{testId:"total-token-balance-value",weight:"bold",shimmer:s?1:0,shimmerSx:{minw:"100px"},children:n("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!s&&E(S,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",a.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(et||(et={}));const nt=e=>({display:e?"":"none"});function ot({balanceInfo:e,theme:t,bridgeToL2OnClick:n}){const{connectLoaderState:o}=r.useContext(v),{track:a}=x(),{checkout:s,provider:i}=o,c=`≈ USD $${A(e.fiatAmount)}`,{walletState:d}=r.useContext(Je),{supportedTopUps:p,network:L}=d,[u,h]=r.useState(),[C,b]=r.useState(),[k,f]=r.useState(),{eventTargetState:{eventTarget:m}}=r.useContext(I),[g,y]=r.useState([]),S=O(i);r.useEffect((()=>{(async()=>{if(!s)return;const e=await s.getTokenAllowList({type:w.ONRAMP,chainId:M(s.config)});y(e.tokens)})()}),[s]),r.useEffect((()=>{if(!L||!p||!s)return;const e=L.chainId===M(s.config)&&(p?.isOnRampEnabled??!0);h(e);const t=(L.chainId===W(s.config)||L.chainId===M(s.config))&&(p?.isBridgeEnabled??!0);b(t);const n=L.chainId===M(s.config)&&(p?.isSwapEnabled??!0)&&(p?.isSwapAvailable??!0);f(n)}),[L,p,s,S]);const T=r.useMemo((()=>Boolean(u&&g.length>0&&g.find((t=>t.address?.toLowerCase()===e.address?.toLowerCase())))),[u,g]);return E(N,{testId:`balance-item-${e.symbol}`,emphasized:!0,children:[l(N.FramedImage,{use:l(Te,{theme:t,src:e.icon,name:e.symbol,environment:s?.config.environment??_.PRODUCTION}),circularFrame:!0}),l(N.Label,{children:e.symbol}),l(N.Caption,{children:e.description}),l(N.PriceDisplay,{testId:`balance-item-${e.symbol}`,use:l(B,{size:"xSmall"}),price:F(e.balance),fiatAmount:c}),(u||k||C)&&E(N.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}})},children:[E(N,{testId:"balance-item-add-option",sx:nt(T),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),j.sendRequestOnrampEvent(m,D.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e.address??"",amount:""})},children:[l(N.Icon,{icon:"Add"}),l(N.Label,{children:`Add ${e.symbol}`})]}),E(N,{testId:"balance-item-swap-option",sx:nt(k),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),j.sendRequestSwapEvent(m,D.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:e.address??"",toTokenAddress:"",amount:""})},children:[l(N.Icon,{icon:"Exchange"}),l(N.Label,{children:`Swap ${e.symbol}`})]}),E(N,{testId:"balance-item-move-option",sx:nt(C),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),n(e.address)},children:[l(N.Icon,{icon:"Minting"}),l(N.Label,{children:`Move ${e.symbol}`})]})]})]})}const at={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},st={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},rt=e=>e.filter((e=>e.balance!==Z||R(e.address)));function it({balanceInfoItems:e,theme:t,bridgeToL2OnClick:n}){const{t:o}=g(),a=rt(e);return E(p,{sx:at,children:[0===a.length&&l(p,{sx:st,children:l(S,{testId:"no-tokens-found",children:o("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),a.map((e=>l(ot,{balanceInfo:e,bridgeToL2OnClick:n,theme:t},e.id)))]})}const lt={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},ct={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},dt={fontWeight:"base.text.caption.small.bold.fontWeight"},pt=e=>({width:"22px",filter:e?void 0:"grayscale(1)"}),Lt={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function ut(){const{t:e}=g(),{connectLoaderState:t}=r.useContext(v),{eventTargetState:{eventTarget:n}}=r.useContext(I),{checkout:o,provider:a}=t,{viewDispatch:s}=r.useContext(y),{walletState:i,walletDispatch:c}=r.useContext(Je),{network:d}=i,[L,u]=r.useState([]),{track:h}=x(),C=r.useCallback((async e=>{if(o&&a&&d&&d.chainId!==e){h({userJourney:P.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await o.switchNetwork({provider:a,chainId:e});z(n,t.provider,t.network)}catch(e){e.type===U.USER_REJECTED_REQUEST_ERROR||s({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:e}}})}}}),[o,a,d,c,s]);return r.useEffect((()=>{(async()=>{if(o){const e=await o.getNetworkAllowList({type:G.ALL});u(e?.networks??[])}else u([])})()}),[o]),E(p,{testId:"network-menu",sx:lt,children:[l(S,{testId:"network-heading",size:"medium",sx:Lt,children:e("views.WALLET_BALANCES.networkStatus.heading")}),l(Ge,{children:o&&L?.sort(((e,t)=>$(e,t,o.config))).map((e=>E(Ge.Button,{testId:`${e.name}-network-button`,sx:e.chainId===d?.chainId?ct:dt,size:"small",onClick:()=>C(e.chainId),children:[l(H,{sx:pt(e.chainId===d?.chainId),use:l("img",{src:J(o?.config.environment,e.chainId),alt:e.name})}),e.name]},e.chainId)))})]})}const ht={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},Ct={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},bt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},kt=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},ft=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,mt=(e,t,n)=>t.map((t=>({id:ft(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:q(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function wt({balancesLoading:t,theme:n,showNetworkMenu:o}){const{t:a}=g(),{connectLoaderState:s}=r.useContext(v),{checkout:i,provider:c}=s,{cryptoFiatState:d,cryptoFiatDispatch:L}=r.useContext(ge),{walletState:u}=r.useContext(Je),{eventTargetState:{eventTarget:h}}=r.useContext(I),{viewDispatch:C}=r.useContext(y),[b,k]=r.useState(0),{network:f,supportedTopUps:m,tokenBalances:w}=u,{conversions:S}=d,A=!O(c)&&o,{track:W,page:_}=x(),B=r.useMemo((()=>mt(f?.chainId,w,S)),[w,S,f?.chainId]);r.useEffect((()=>{_({userJourney:P.WALLET,screen:"WalletBalances"})}),[]),r.useEffect((()=>{(async()=>{if(!i)return;if(!L)return;if(!f)return;const e=await Xe(i,f.chainId);L({payload:{type:ye.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[i,L,f?.chainId]),r.useEffect((()=>{let e=0;B.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),k(e)}),[B]);const F=r.useMemo((()=>!(!i||!f)&&(f.chainId===M(i.config)&&Boolean(m?.isBridgeEnabled||m?.isSwapEnabled||m?.isOnRampEnabled))),[i,f,m]);return l(oe,{testId:"wallet-balances",header:l(Q,{title:a("views.WALLET_BALANCES.header.title"),rightActions:l(e,{icon:"SettingsCog",sx:ee(),iconVariant:"bold",onClick:()=>{W({userJourney:P.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),C({payload:{type:T.UPDATE_VIEW,view:{type:et.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>te(h)}),footer:l(ne,{}),children:E(p,{sx:ht,children:[E(p,{sx:Ct,children:[A&&l(ut,{}),l(tt,{totalBalance:b,loading:t}),E(p,{sx:kt(A,F),children:[t&&E(p,{sx:bt,children:[l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!t&&l(it,{balanceInfoItems:B,bridgeToL2OnClick:e=>{j.sendRequestBridgeEvent(h,D.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:n})]})]}),F&&E(N,{testId:"add-coins",emphasized:!0,onClick:()=>{W({userJourney:P.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),C({payload:{type:T.UPDATE_VIEW,view:{type:V.TOP_UP_VIEW}}})},children:[l(N.FramedIcon,{icon:"Add"}),l(N.Label,{children:a("views.WALLET_BALANCES.addCoins")})]})]})})}function gt(e){switch(e){case ae.METAMASK:return"MetaMaskSymbol";case ae.PASSPORT:return"PassportSymbolOutlined";case"walletconnect":return"WalletConnectSymbol";default:return"MetaMaskSymbol"}}const yt={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"},Et={fill:"base.color.fixed.black.1000"};function St({provider:t,showL1Warning:n,setShowL1Warning:o}){const[a,s]=r.useState(""),[i,c]=r.useState(!1),{t:d}=g(),{track:p}=x(),L=r.useMemo((()=>O(t)&&!n?"ShowPassword":i?"Tick":"CopyText"),[t,n,i]);r.useEffect((()=>{t&&""===a&&(async()=>{const e=await t.getSigner().getAddress();s(e)})()}),[t,a]);return E(N,{testId:"wallet-address",emphasized:!0,size:"medium",children:[l(N.FramedLogo,{logo:gt(se(t)),sx:{backgroundColor:"base.color.translucent.standard.200"}}),l(e,{variant:"tertiary",iconVariant:"bold",size:"small",icon:L,iconSx:{...i?Et:{}},onClick:async()=>{a&&"CopyText"===L?(p({userJourney:P.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(a),c(!0),setTimeout((()=>c(!1)),1e3)):"ShowPassword"===L&&o(!0)},sx:{cursor:"pointer",...i?yt:{}}}),l(N.Label,{children:d("views.SETTINGS.walletAddress.label")}),l(N.Caption,{testId:"wallet-address",children:re(a)})]})}const Tt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},vt={marginTop:"32px"};function xt(){return l(p,{testId:"transfer-assets-l1-warning-hero",sx:{display:"flex",justifyContent:"center",padding:"base.spacing.x4"},children:l(p,{children:E("svg",{xmlns:"http://www.w3.org/2000/svg",width:"135",height:"137",viewBox:"0 0 135 137",fill:"none",children:[l("path",{d:"M76.2361 65.9046L76.5095 17.3023C76.5157 15.9172 76.0711 14.9946 75.3435 14.6207C74.0964 13.9799 72.9093 14.4957 71.4798 15.3728L29.2306 41.5137L28.3702 98.7706L76.2398 65.9035L76.2361 65.9046Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M85.4571 126.862L85.791 76.8509C85.8102 74.0184 83.742 70.6325 81.1983 69.3267L47.8586 51.3375C46.7068 50.7462 45.739 49.8676 45.0526 48.788L43.4726 46.3043C42.7862 45.2247 41.8184 44.3461 40.6665 43.7548L36.2848 41.5054L31.2783 42.6987L30.909 101.567C30.9861 102.57 31.6727 103.52 32.9446 104.173L80.2378 129.343L81.6163 131.639L84.2802 129.667L84.2754 129.664C85.0031 129.123 85.4546 128.164 85.4632 126.862L85.4571 126.862Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M83.1421 78.7933C83.1612 75.96 81.0925 72.5732 78.5483 71.267L30.2174 45.562C28.8517 44.8609 28.1628 43.8191 28.1721 42.7358L27.7773 103.281C27.8544 104.284 28.5413 105.234 29.8134 105.887L78.1443 131.592C80.6909 132.9 82.7889 131.652 82.8068 128.821L83.1408 78.7956L83.1421 78.7933Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M36.8699 42.6587C36.8641 43.5432 35.5341 44.2721 33.9017 44.2823C32.2694 44.2925 30.9508 43.5854 30.9555 42.6973C30.9602 41.8091 32.2913 41.0838 33.9237 41.0736C34.7155 41.0681 35.4328 41.2334 35.963 41.5055C36.5244 41.7937 36.8726 42.2027 36.8699 42.6587Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M35.2866 42.6695C35.284 43.0802 34.6673 43.4179 33.9096 43.4227C33.1519 43.4276 32.5394 43.098 32.5419 42.6874C32.5445 42.2767 33.1612 41.939 33.9189 41.9342C34.2856 41.9315 34.6182 42.0084 34.8653 42.1352C35.1268 42.2695 35.288 42.4582 35.2853 42.6719L35.2866 42.6695Z",fill:"black"}),l("path",{d:"M70.9275 14.9238L29.4561 40.1902C28.389 40.9925 27.8611 41.9567 27.8526 42.8886C27.8526 42.8886 27.6951 44.5777 29.8905 45.7049C32.0859 46.832 34.8391 48.2668 34.8391 48.2668L36.1919 47.4119L31.26 44.8586C29.3491 43.8775 28.9381 42.1986 30.6697 40.8949L72.2083 15.5784C73.3784 14.6992 74.4371 14.4968 75.1905 14.8835C75.1905 14.8835 72.8927 13.4441 70.9288 14.9215L70.9275 14.9238Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M81.0605 110.741L83.1092 111.399L85.7093 118.337L85.7797 107.796L81.2805 106.491L81.0605 110.741Z",fill:"black"}),l("path",{d:"M83.1104 113.492C83.1312 110.487 84.073 109.095 87.3742 109.652C89.1483 109.952 90.9444 109.879 92.6948 109.428L96.5484 108.436C99.8885 107.577 102.639 104.113 102.664 100.741C102.686 97.3675 99.9706 95.3116 96.6329 96.1724L91.9518 97.3781C90.3645 97.7883 88.6894 97.6786 87.181 97.0768C84.1103 95.8485 83.2401 94.5701 83.2615 91.3841L81.2915 93.3582L74.7155 111.72L83.1115 113.496L83.1104 113.492Z",fill:"#F3F3F3"}),l("path",{d:"M83.1053 113.501C83.1261 110.496 84.0681 109.104 87.3701 109.661C89.1445 109.961 90.9411 109.888 92.6918 109.437L96.5463 108.445C99.8871 107.585 102.638 104.12 102.663 100.747C102.685 97.3736 99.9692 95.3172 96.6308 96.1782L91.9487 97.3841C90.361 97.7944 88.6855 97.6847 87.1768 97.0828C84.1055 95.8542 83.2351 94.5755 83.2564 91.3888",stroke:"black",strokeWidth:"1.33831",strokeMiterlimit:"10"}),l("path",{d:"M100.563 99.4451C99.4403 98.3218 97.1152 98.7714 95.3661 100.45C93.6171 102.129 93.1092 104.399 94.2323 105.522L94.7567 106.048L101.088 99.9711L100.563 99.4451Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M99.9733 105.056C101.727 103.381 102.236 101.114 101.111 99.9926C99.986 98.8713 97.6528 99.3204 95.8996 100.996C94.1464 102.671 93.637 104.938 94.762 106.059C95.8869 107.18 98.2201 106.731 99.9733 105.056Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M51.6986 91.7452C50.6642 91.2142 49.827 89.8416 49.8336 88.6901L49.9893 65.7522C49.9984 64.6019 50.8483 64.0955 51.8828 64.6265L72.5076 75.205C73.542 75.736 74.3793 77.1086 74.3726 78.2601L74.2169 101.198C74.2079 102.348 73.3579 102.855 72.3235 102.324L51.6986 91.7452Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M52.7617 91.0867C51.7272 90.5557 50.89 89.1831 50.8966 88.0315L51.0523 65.0931C51.0553 64.8339 51.101 64.6088 51.1799 64.4189C50.4902 64.3771 49.9962 64.8783 49.9906 65.7516L49.8349 88.69C49.8259 89.8403 50.6655 91.2142 51.7 91.7452L72.3252 102.324C73.1244 102.734 73.8145 102.522 74.0887 101.871C73.8709 101.859 73.6341 101.792 73.3845 101.664L52.7593 91.0855L52.7617 91.0867Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M66.9055 85.8915L66.8883 88.4023L64.3853 87.1169L61.8847 85.8328L59.3817 84.5474L57.6065 83.6358C57.2078 83.4311 56.8773 83.5922 56.875 83.9917L56.8689 85.042C56.8653 85.4439 57.1906 85.9418 57.5917 86.1478L59.3669 87.0594L61.8699 88.3448L61.8577 90.1235C61.8541 90.5254 62.1807 91.0209 62.5818 91.2269L63.6292 91.7647C64.0279 91.9695 64.3584 91.8083 64.362 91.4064L64.3742 89.6277L66.8772 90.9131L68.6523 91.8247C69.0511 92.0295 69.3829 91.8659 69.3852 91.4664L69.3974 89.6877L69.4095 87.909C69.4131 87.5071 69.0866 87.0116 68.6854 86.8056L66.9103 85.894L66.9055 85.8915Z",fill:"white"}),l("path",{d:"M59.3703 79.5438L59.3581 81.3271C59.3569 81.7313 59.6802 82.2293 60.0844 82.4371L61.862 83.3511L64.3662 84.6386L66.8728 85.9274L66.8862 84.1416C66.8874 83.7374 66.5641 83.2394 66.16 83.0316L64.3823 82.1176L61.8781 80.8301L59.3716 79.5414L59.3703 79.5438Z",fill:"white"}),l("path",{d:"M62.6235 73.7033C62.2248 73.4985 61.8943 73.6597 61.892 74.0592L61.8798 75.8379L59.3768 74.5525L57.6016 73.641C57.2029 73.4362 56.8724 73.5973 56.8688 73.9992L56.8566 75.7779L56.8445 77.5566C56.8409 77.9585 57.1674 78.4541 57.5686 78.6601L59.3437 79.5717L59.3609 77.0609L61.8639 78.3463L64.3645 79.6304L66.8675 80.9157L68.6426 81.8273C69.0414 82.0321 69.3719 81.8709 69.3755 81.469L69.3827 80.4224C69.3838 80.0193 69.061 79.5226 68.6598 79.3166L66.8847 78.405L64.3817 77.1197L64.3938 75.341C64.3974 74.9391 64.0709 74.4435 63.6697 74.2375L62.6224 73.6997L62.6235 73.7033Z",fill:"white"}),l("path",{d:"M46.8192 101.66L46.8314 99.6311C46.838 98.841 46.2586 97.8985 45.551 97.5353L42.5478 95.9937L42.5679 93.0481C42.5746 92.258 41.9976 91.3167 41.2875 90.9523L38.7449 89.6471C38.3611 89.4501 38.0161 89.4638 37.7758 89.6403L36.4656 90.6093L37.4387 91.7024L37.4277 93.3685L34.4246 91.827C34.0408 91.63 33.6957 91.6437 33.4554 91.8201L32.1452 92.7891L33.1181 93.8094L33.113 94.6306C33.1063 95.4207 33.6858 96.3632 34.3934 96.7264L37.3965 98.268L37.3764 101.214C37.3698 102.004 37.9468 102.945 38.6568 103.309L39.7002 103.845L40.8571 105.593L42.1673 104.624C42.3691 104.473 42.4965 104.205 42.4976 103.842L42.5177 100.897L44.2088 101.765L45.1822 103.415L46.4924 102.446C46.6966 102.297 46.8216 102.028 46.8227 101.665L46.8192 101.66Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M45.514 102.623L45.5261 100.594C45.5327 99.8036 44.9532 98.8609 44.2455 98.4977L41.2419 96.9558L41.262 94.0097C41.2674 93.2219 40.6916 92.2781 39.9815 91.9135L37.4385 90.6082C36.7284 90.2437 36.1455 90.5927 36.1388 91.3829L36.1187 94.329L33.1151 92.7872C32.405 92.4227 31.8184 92.7728 31.8154 93.5619L31.8033 95.5912C31.7967 96.3815 32.3762 97.3241 33.0839 97.6874L36.0875 99.2293L36.0673 102.175C36.0607 102.966 36.6378 103.907 37.3479 104.272L39.8909 105.577C40.601 105.941 41.1839 105.592 41.1906 104.802L41.2107 101.856L44.2143 103.398C44.9244 103.762 45.511 103.412 45.514 102.623Z",fill:"white",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M55.4177 54.343L85.7278 37.2672L70.5728 15.9224L55.4177 54.343Z",fill:"#FF637F",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M55.4176 54.3431L51.6289 52.2086L66.7839 13.7881L70.5727 15.9226L55.4176 54.3431Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M69.1528 25.261L71.9944 23.6602V34.3325L69.1528 35.9334V25.261Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M69.1528 38.0676L71.9944 36.4667V39.6684L69.1528 41.2693V38.0676Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}function At({provider:t,showL1Warning:n,setShowL1Warning:o}){const{t:a}=g();return l(ie,{size:"full",visible:n,showHeaderBar:!1,children:E(ie.Content,{children:[l(e,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>o(!1)}),l(xt,{}),E(p,{sx:{px:"base.spacing.x6"},children:[l(B,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:a("views.SETTINGS.transferAssetsL1Warning.heading")}),l(S,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:a("views.SETTINGS.transferAssetsL1Warning.body")}),l(St,{provider:t,showL1Warning:n,setShowL1Warning:o})]})]})})}function It({showDisconnectButton:e}){const[t,n]=r.useState(!1),{t:o}=g(),{connectLoaderState:a}=r.useContext(v),{provider:s}=a,{eventTargetState:{eventTarget:i}}=r.useContext(I),{ethereumProvider:c}=le(),{page:d}=x();r.useEffect((()=>{d({userJourney:P.WALLET,screen:"Settings"})}),[]);return E(oe,{testId:"wallet-balances",header:l(Q,{showBack:!0,title:o("views.SETTINGS.header.title"),onCloseButtonClick:()=>te(i)}),footer:l(ne,{}),children:[E(p,{sx:Tt,children:[l(St,{provider:s,showL1Warning:t,setShowL1Warning:n}),e&&l(b,{testId:"disconnect-button",variant:"secondary",sx:vt,onClick:()=>{(async()=>{if(de(s))try{if(s.provider?.session){const e=s.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>c?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await s.provider.disconnect()}if(c){const e=c?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>c?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await c.disconnect()}}catch(e){console.error(e)}})().then((()=>{ce(i)}))},children:o("views.SETTINGS.disconnectButton.label")})]}),l(At,{provider:s,showL1Warning:t,setShowL1Warning:n})]})}function Ot(){return l(p,{sx:{...pe,background:"base.color.translucent.emphasis.100"},children:l(p,{sx:{...Le,...ue},children:E("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l("path",{d:"M213 120C132.857 120 65.7181 139.009 1 175.641V211H431V178.515C365.165 140.107 295.216 120 213 120Z",fill:"url(#paint0_linear_4525_125520)"}),l("path",{d:"M428.5 210.5H383C383 123 114 113.5 236 120.5C333.6 126.1 405 163.833 428.5 182V210.5Z",fill:"#2D0034",fillOpacity:"0.2"}),l("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),l("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),l("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),l("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),l("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),l("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),l("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),l("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),l("path",{d:"M2.97844e-07 176.149C62.5366 139.802 135.143 119 212.584 119C292.029 119 366.384 140.892 430 179",stroke:"black"}),l("path",{d:"M70.97 142.773C76.3142 146.15 87.6289 137.839 96.242 124.208C104.855 110.578 107.505 96.7911 102.161 93.414C96.8167 90.037 85.5021 98.3487 76.889 111.979C68.2758 125.609 65.6258 139.396 70.97 142.773Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M76.8602 112.001C79.353 108.055 82.0686 104.564 84.8088 101.664L94.3989 126.977C86.0698 138.949 75.925 145.933 70.9515 142.793C65.6033 139.413 68.2536 125.631 76.8692 111.994L76.8602 112.001Z",fill:"black"}),l("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M98.2141 120.884C99.3274 118.901 100.309 116.925 101.153 115.003L108.025 119.342C107.181 121.264 106.2 123.233 105.085 125.224L98.2141 120.884Z",fill:"#F191FA"}),l("path",{d:"M102.311 112.191C104.156 107.325 105.052 102.898 104.877 99.4899L111.748 103.829C111.923 107.238 111.035 111.665 109.182 116.531L102.311 112.191Z",fill:"black"}),l("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M341.833 142.899C353.278 131.542 356.039 115.768 348 107.668C339.962 99.5669 324.167 102.207 312.723 113.564C301.278 124.921 298.517 140.695 306.555 148.795C314.594 156.896 330.388 154.256 341.833 142.899Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M344.451 139.969C345.913 138.216 347.189 136.39 348.264 134.524L352.416 138.709C351.341 140.575 350.065 142.4 348.603 144.153L344.451 139.969Z",fill:"#D8EFF4"}),l("path",{d:"M349.72 131.746C352.022 126.818 352.967 121.785 352.442 117.302L356.594 121.486C357.119 125.97 356.174 131.002 353.872 135.93L349.72 131.746Z",fill:"black"}),l("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M155.769 157.057C169.703 165.169 185.654 163.751 191.396 153.888C197.138 144.026 190.497 129.454 176.563 121.342C162.629 113.229 146.679 114.648 140.937 124.51C135.195 134.373 141.836 148.944 155.769 157.057Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M159.278 158.826C161.349 159.785 163.443 160.544 165.524 161.099L162.558 166.193C160.477 165.639 158.383 164.879 156.311 163.921L159.278 158.826Z",fill:"#D8EFF4"}),l("path",{d:"M168.585 161.786C173.941 162.733 179.047 162.342 183.241 160.674L180.275 165.768C176.08 167.436 170.975 167.827 165.619 166.88L168.585 161.786Z",fill:"black"}),l("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M234.03 133.525C249.631 129.452 260.983 121.192 259.386 115.075C257.79 108.959 243.848 107.301 228.248 111.374C212.647 115.446 201.294 123.706 202.891 129.823C204.488 135.94 218.429 137.597 234.03 133.525Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M237.663 132.44C239.836 131.754 241.896 130.986 243.826 130.154L245.878 138.014C243.948 138.838 241.888 139.606 239.715 140.3L237.663 132.44Z",fill:"#F191FA"}),l("path",{d:"M246.588 128.896C251.257 126.601 254.941 123.976 257.13 121.367L259.182 129.227C256.985 131.836 253.309 134.461 248.64 136.756L246.588 128.896Z",fill:"black"}),l("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M189.995 60.1335C175.063 54.0502 161.025 53.8648 158.64 59.7194C156.255 65.5739 166.426 75.2515 181.358 81.3348C196.29 87.418 210.328 87.6034 212.713 81.7488C215.098 75.8943 204.927 66.2167 189.995 60.1335Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M185.032 82.6694C187.186 83.4191 189.294 84.0389 191.339 84.5366L188.275 92.0629C186.23 91.5652 184.122 90.9454 181.968 90.1957L185.032 82.6694Z",fill:"#96DAF4"}),l("path",{d:"M194.301 85.1776C199.418 86.1391 203.932 86.2438 207.256 85.4671L204.192 92.9934C200.868 93.762 196.353 93.6654 191.237 92.7038L194.301 85.1776Z",fill:"black"}),l("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M331.022 121.427C326.722 126.062 313.654 120.93 301.833 109.965C290.012 99 283.915 86.3538 288.214 81.719C292.513 77.0841 305.581 82.2158 317.402 93.1808C329.223 104.146 335.321 116.792 331.022 121.427Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M317.436 93.1948C314.014 90.0206 310.494 87.3431 307.102 85.2426L304.325 112.168C315.446 121.604 327.043 125.752 331.044 121.441C335.347 116.803 329.25 104.162 317.425 93.1905L317.436 93.1948Z",fill:"black"}),l("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M299.075 107.258C297.49 105.627 296.034 103.969 294.725 102.327L289.197 108.284C290.506 109.926 291.959 111.577 293.546 113.215L299.075 107.258Z",fill:"#F191FA"}),l("path",{d:"M292.885 99.9066C289.854 95.6761 287.853 91.6272 287.147 88.2883L281.619 94.2451C282.324 97.584 284.318 101.636 287.357 105.863L292.885 99.9066Z",fill:"black"}),l("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("defs",{children:E("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[l("stop",{stopColor:"#AD48BA"}),l("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function Mt(){const{t:e}=g(),{connectLoaderState:{provider:t}}=r.useContext(v),n=O(t),{page:o}=x();return r.useEffect((()=>{o({userJourney:P.WALLET,screen:"CoinInfo"})}),[]),E(oe,{testId:"coin-info",header:l(Q,{showBack:!0,transparent:!0}),footer:l(ne,{}),heroContent:l(Ot,{}),floatHeader:!0,children:[!n&&l(he,{heading:e("views.COIN_INFO.metamask.heading"),children:e("views.COIN_INFO.metamask.body")}),n&&E(he,{heading:e("views.COIN_INFO.passport.heading"),children:[e("views.COIN_INFO.passport.body1"),l(be,{onClick:()=>window.open(Ce),children:e("views.COIN_INFO.passport.linkText")}),e("views.COIN_INFO.passport.body2")]})]})}const Wt=({checkout:e,provider:t,refreshCallback:n,errorCallback:o})=>{const[a,s]=r.useState(!0),i=r.useCallback((async(a=!1)=>{if(e&&t)try{const o=await e.getNetworkInfo({provider:t});if(!o.isSupported)return;a||s(!0);const r=await(async(e,t,n)=>{if(!e||!t||!n)return[];const o=await t.getSigner().getAddress(),a=await ve((()=>e.getAllBalances({provider:t,walletAddress:o,chainId:n})),K);return a?X(e.config,a.balances,n).map((t=>({...t,token:{...t.token,icon:Y(e.config.environment,R(t.token.address)?t.token.symbol:t.token.address??"")}}))):[]})(e,t,o.chainId);a||s(!1),n(r)}catch(e){K.nonRetryable(e)&&o(e),a||s(!1)}}),[e,t]);return xe((()=>i(!0)),3e4),{balancesLoading:a,refreshBalances:i}};function _t(e){const{t:t}=g(),n=t("views.ERROR_VIEW.actionText"),o=t("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:a}}=r.useContext(I),{config:{environment:s,isOnRampEnabled:i,isSwapEnabled:c,isBridgeEnabled:d,theme:p},walletConfig:{showDisconnectButton:L,showNetworkMenu:u}}=e,{connectLoaderState:{checkout:h,provider:C}}=r.useContext(v),[b,k]=r.useReducer(ke,{...fe,history:[]}),[f,m]=r.useReducer(Ke,{...$e,walletConfig:{showDisconnectButton:L,showNetworkMenu:u}}),w=r.useMemo((()=>({walletState:f,walletDispatch:m})),[f,m]),S=r.useMemo((()=>({viewState:b,viewDispatch:k})),[b,k]),{balancesLoading:x,refreshBalances:A}=Wt({checkout:h,provider:C,refreshCallback:e=>{m({payload:{type:He.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),k({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});r.useEffect((()=>{(async()=>{if(!h)return;let e;try{e=await h.isSwapAvailable()}catch(t){e=!1}m({payload:{type:He.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:d,isSwapEnabled:c,isOnRampEnabled:i,isSwapAvailable:e}}})})()}),[d,c,i,s]);const O=async()=>{if(h&&C)try{const e=await h.getNetworkInfo({provider:C});if(!e.isSupported)return;A(),k({payload:{type:T.UPDATE_VIEW,view:{type:et.WALLET_BALANCES}}}),m({payload:{type:He.SET_NETWORK,network:e}})}catch(e){console.error(e),k({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:e}}})}};r.useEffect((()=>{h&&C&&O()}),[h,C]);return l(y.Provider,{value:S,children:l(Ee,{environment:s,children:E(Je.Provider,{value:w,children:[b.view.type===V.LOADING_VIEW&&l(me,{loadingText:o}),b.view.type===et.WALLET_BALANCES&&l(wt,{balancesLoading:x,theme:p,showNetworkMenu:u}),b.view.type===et.SETTINGS&&l(It,{showDisconnectButton:L}),b.view.type===et.COIN_INFO&&l(Mt,{}),b.view.type===V.ERROR_VIEW&&l(we,{actionText:n,onActionClick:async()=>{k({payload:{type:T.UPDATE_VIEW,view:{type:et.WALLET_BALANCES}}}),await O()},onCloseClick:()=>te(a)}),b.view.type===V.TOP_UP_VIEW&&l(Se,{analytics:{userJourney:P.WALLET},widgetEvent:D.IMTBL_WALLET_WIDGET_EVENT,checkout:h,provider:C,showOnrampOption:i,showSwapOption:c,showBridgeOption:d,onCloseButtonClick:()=>te(a)})]})})})}export{_t as default};
1
+ import{B as e,_ as t,u as n,g as o,D as a,m as s,r,f as i,j as l,i as c,S as d,a as p,b as L,c as u,s as h,C,d as b,e as k,h as f,k as m,T as w,l as g,V as y,n as E,o as S,p as T,q as v,t as x,v as A,E as I,w as O,x as M,y as W,z as _,M as N,H as B,A as F,U as P,F as j,I as D,Z,G as R,J as z,K as U,L as V,N as G,O as $,P as H,Q as J,R as K,W as X,X as Y,Y as q,$ as Q,a0 as ee,a1 as te,a2 as ne,a3 as oe,a4 as ae,a5 as se,a6 as re,a7 as ie,a8 as le,a9 as ce,aa as de,ab as pe,ac as Le,ad as ue,ae as he,af as Ce,ag as be,ah as ke,ai as fe,aj as me,ak as we}from"./index-48317d33.js";import{C as ge,a as ye,b as Ee,T as Se}from"./TopUpView-1ee8b40b.js";import{T as Te,r as ve,u as xe}from"./retry-f9fd4fab.js";var Ae={justifyContent:"stretch",bg:"base.color.translucent.standard.100",position:"relative",d:"flex",w:"100%"};function Ie(e){var t=e.size,n=e.theme,o=/large|medium/.test(t)?n.base.spacing.x2:n.base.spacing.x1;return{gap:o,padding:o,borderRadius:/large|medium/.test(t)?n.base.borderRadius.x8:n.base.borderRadius.x4}}var Oe=function(e){var t=e.size,n=e.theme;return L({size:t,theme:n,renderSxAtSize:Ie})},Me={flex:1,paddingX:"base.spacing.x4",transitionProperty:"background, color, box-shadow",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","& > span":{textAlign:"left",whiteSpace:"nowrap"},"&.HorizontalMenuButton, &.HorizontalMenuButtCon":{"&:hover:not([disabled])::before":{content:"unset"},"&:hover:not([disabled])":{bg:"base.color.translucent.emphasis.200",boxShadow:function(e){var t=e.base;return"inset 0 0 0 ".concat(t.border.size[100]," ").concat(t.color.translucent.standard[1e3])}},"&:active:not([disabled])":{bg:"base.color.translucent.emphasis.100"},"&.selected":{bg:"base.color.translucent.inverse.500"},"&.selected, &:active:not([disabled])":{boxShadow:function(e){var t=e.base;return"inset 0 0 0 ".concat(t.border.size[200]," ").concat(t.color.translucent.standard[1e3])}}}};function We(e){var t=e.size,n=e.theme;return{borderRadius:/large|medium/.test(t)?n.base.borderRadius.x4:n.base.spacing.x2}}var _e=function(e){var t=e.size,n=e.theme;return L({size:t,theme:n,renderSxAtSize:We})},Ne=["sx","size","selected","className"];function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pe(i){var c=i.sx,d=void 0===c?{}:c,p=i.size,L=void 0===p?"medium":p,b=i.selected,k=i.className,f=t(i,Ne),m=n(),w=o(L,a,u),g=r.useMemo((function(){return s(Me,We({size:w,theme:m}),_e({size:L,theme:m}),h(d,"base.color.translucent.emphasis.100"),d)}),[d,w,L,m]);return l(C,{children:function(t){var n=t.cx;return l(e,Fe(Fe({},f),{},{size:L,variant:"tertiary",sx:g,className:n(k,"HorizontalMenuButtCon",{selected:b})}))}})}Pe.displayName="HorizontalMenuButtCon",Pe.SvgIcon=e.SvgIcon;var je=["children","sx","size","selected","className"];function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Re(e){var i=e.children,c=e.sx,d=void 0===c?{}:c,p=e.size,L=void 0===p?"medium":p,k=e.selected,f=e.className,m=t(e,je),w=n(),g=o(L,a,u),y=r.useMemo((function(){return s(Me,We({size:g,theme:w}),_e({size:L,theme:w}),h(d,"base.color.translucent.emphasis.100"),d)}),[d,g,L,w]);return l(C,{children:function(e){var t=e.cx;return l(b,Ze(Ze({},m),{},{size:L,variant:"tertiary",className:t(f,"HorizontalMenuButton",{selected:k}),sx:y,children:i}))}})}Re.displayName="HorizontalMenuButton",Re.Icon=k,Re.Logo=f;var ze=["children","sx","size","className"];function Ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(e){var L=e.children,h=e.sx,C=void 0===h?{}:h,b=e.size,k=void 0===b?"medium":b,f=e.className,m=t(e,ze),w=n(),g=o(k,a,u),y=s(Ae,Ie({size:g,theme:w}),Oe({size:k,theme:w}),C),E=r.useMemo((function(){return i(L)}),[L]);return l(p,Ve(Ve({},m),{},{sx:y,className:"".concat(null!=f?f:""," HorizontalMenu"),children:r.Children.map(E,(function(e){return c(e,Pe)||c(e,Re)?l(d,{size:e.props.size?e.props.size:k,children:e}):e}))}))}Ge.displayName="HorizontalMenu",Ge.Button=Re,Ge.ButtCon=Pe;const $e={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var He;!function(e){e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_SUPPORTED_TOP_UPS="SUPPORTED_TOP_UPS"}(He||(He={}));const Je=r.createContext({walletState:$e,walletDispatch:()=>{}});Je.displayName="WalletContext";const Ke=(e,t)=>{switch(t.payload.type){case He.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case He.SET_NETWORK:return{...e,network:t.payload.network};case He.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case He.SET_SUPPORTED_TOP_UPS:return{...e,supportedTopUps:{isSwapEnabled:t.payload.supportedTopUps.isSwapEnabled??!0,isOnRampEnabled:t.payload.supportedTopUps.isOnRampEnabled??!0,isBridgeEnabled:t.payload.supportedTopUps.isBridgeEnabled??!0,isSwapAvailable:t.payload.supportedTopUps.isSwapAvailable??!0}};default:return e}},Xe=async(e,t)=>{const n=await e.getTokenAllowList({type:w.ALL,chainId:t}),o=new Set;return n.tokens.forEach((e=>{o.add(e.symbol)})),Array.from(o)},Ye={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},qe={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},Qe={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var et;function tt(t){const{t:n}=g(),{viewDispatch:o}=r.useContext(y),{totalBalance:a,loading:s}=t;return E(p,{sx:Ye,children:[E(p,{sx:qe,children:[l(S,{size:"medium",children:n("views.WALLET_BALANCES.totalTokenBalance.heading")}),l(p,{sx:{pl:"base.spacing.x1"},children:l(e,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:Qe,onClick:()=>o({payload:{type:T.UPDATE_VIEW,view:{type:et.COIN_INFO}}})})})]}),E(p,{sx:qe,children:[l(S,{testId:"total-token-balance-value",weight:"bold",shimmer:s?1:0,shimmerSx:{minw:"100px"},children:n("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!s&&E(S,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",a.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(et||(et={}));const nt=e=>({display:e?"":"none"});function ot({balanceInfo:e,theme:t,bridgeToL2OnClick:n}){const{connectLoaderState:o}=r.useContext(v),{track:a}=x(),{checkout:s,provider:i}=o,c=`≈ USD $${A(e.fiatAmount)}`,{walletState:d}=r.useContext(Je),{supportedTopUps:p,network:L}=d,[u,h]=r.useState(),[C,b]=r.useState(),[k,f]=r.useState(),{eventTargetState:{eventTarget:m}}=r.useContext(I),[g,y]=r.useState([]),S=O(i);r.useEffect((()=>{(async()=>{if(!s)return;const e=await s.getTokenAllowList({type:w.ONRAMP,chainId:M(s.config)});y(e.tokens)})()}),[s]),r.useEffect((()=>{if(!L||!p||!s)return;const e=L.chainId===M(s.config)&&(p?.isOnRampEnabled??!0);h(e);const t=(L.chainId===W(s.config)||L.chainId===M(s.config))&&(p?.isBridgeEnabled??!0);b(t);const n=L.chainId===M(s.config)&&(p?.isSwapEnabled??!0)&&(p?.isSwapAvailable??!0);f(n)}),[L,p,s,S]);const T=r.useMemo((()=>Boolean(u&&g.length>0&&g.find((t=>t.address?.toLowerCase()===e.address?.toLowerCase())))),[u,g]);return E(N,{testId:`balance-item-${e.symbol}`,emphasized:!0,children:[l(N.FramedImage,{use:l(Te,{theme:t,src:e.icon,name:e.symbol,environment:s?.config.environment??_.PRODUCTION}),circularFrame:!0}),l(N.Label,{children:e.symbol}),l(N.Caption,{children:e.description}),l(N.PriceDisplay,{testId:`balance-item-${e.symbol}`,use:l(B,{size:"xSmall"}),price:F(e.balance),fiatAmount:c}),(u||k||C)&&E(N.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}})},children:[E(N,{testId:"balance-item-add-option",sx:nt(T),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),j.sendRequestOnrampEvent(m,D.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e.address??"",amount:""})},children:[l(N.Icon,{icon:"Add"}),l(N.Label,{children:`Add ${e.symbol}`})]}),E(N,{testId:"balance-item-swap-option",sx:nt(k),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),j.sendRequestSwapEvent(m,D.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:e.address??"",toTokenAddress:"",amount:""})},children:[l(N.Icon,{icon:"Exchange"}),l(N.Label,{children:`Swap ${e.symbol}`})]}),E(N,{testId:"balance-item-move-option",sx:nt(C),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),n(e.address)},children:[l(N.Icon,{icon:"Minting"}),l(N.Label,{children:`Move ${e.symbol}`})]})]})]})}const at={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},st={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},rt=e=>e.filter((e=>e.balance!==Z||R(e.address)));function it({balanceInfoItems:e,theme:t,bridgeToL2OnClick:n}){const{t:o}=g(),a=rt(e);return E(p,{sx:at,children:[0===a.length&&l(p,{sx:st,children:l(S,{testId:"no-tokens-found",children:o("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),a.map((e=>l(ot,{balanceInfo:e,bridgeToL2OnClick:n,theme:t},e.id)))]})}const lt={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},ct={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},dt={fontWeight:"base.text.caption.small.bold.fontWeight"},pt=e=>({width:"22px",filter:e?void 0:"grayscale(1)"}),Lt={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function ut(){const{t:e}=g(),{connectLoaderState:t}=r.useContext(v),{eventTargetState:{eventTarget:n}}=r.useContext(I),{checkout:o,provider:a}=t,{viewDispatch:s}=r.useContext(y),{walletState:i,walletDispatch:c}=r.useContext(Je),{network:d}=i,[L,u]=r.useState([]),{track:h}=x(),C=r.useCallback((async e=>{if(o&&a&&d&&d.chainId!==e){h({userJourney:P.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await o.switchNetwork({provider:a,chainId:e});z(n,t.provider,t.network)}catch(e){e.type===U.USER_REJECTED_REQUEST_ERROR||s({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:e}}})}}}),[o,a,d,c,s]);return r.useEffect((()=>{(async()=>{if(o){const e=await o.getNetworkAllowList({type:G.ALL});u(e?.networks??[])}else u([])})()}),[o]),E(p,{testId:"network-menu",sx:lt,children:[l(S,{testId:"network-heading",size:"medium",sx:Lt,children:e("views.WALLET_BALANCES.networkStatus.heading")}),l(Ge,{children:o&&L?.sort(((e,t)=>$(e,t,o.config))).map((e=>E(Ge.Button,{testId:`${e.name}-network-button`,sx:e.chainId===d?.chainId?ct:dt,size:"small",onClick:()=>C(e.chainId),children:[l(H,{sx:pt(e.chainId===d?.chainId),use:l("img",{src:J(o?.config.environment,e.chainId),alt:e.name})}),e.name]},e.chainId)))})]})}const ht={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},Ct={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},bt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},kt=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},ft=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,mt=(e,t,n)=>t.map((t=>({id:ft(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:q(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function wt({balancesLoading:t,theme:n,showNetworkMenu:o}){const{t:a}=g(),{connectLoaderState:s}=r.useContext(v),{checkout:i,provider:c}=s,{cryptoFiatState:d,cryptoFiatDispatch:L}=r.useContext(ge),{walletState:u}=r.useContext(Je),{eventTargetState:{eventTarget:h}}=r.useContext(I),{viewDispatch:C}=r.useContext(y),[b,k]=r.useState(0),{network:f,supportedTopUps:m,tokenBalances:w}=u,{conversions:S}=d,A=!O(c)&&o,{track:W,page:_}=x(),B=r.useMemo((()=>mt(f?.chainId,w,S)),[w,S,f?.chainId]);r.useEffect((()=>{_({userJourney:P.WALLET,screen:"WalletBalances"})}),[]),r.useEffect((()=>{(async()=>{if(!i)return;if(!L)return;if(!f)return;const e=await Xe(i,f.chainId);L({payload:{type:ye.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[i,L,f?.chainId]),r.useEffect((()=>{let e=0;B.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),k(e)}),[B]);const F=r.useMemo((()=>!(!i||!f)&&(f.chainId===M(i.config)&&Boolean(m?.isBridgeEnabled||m?.isSwapEnabled||m?.isOnRampEnabled))),[i,f,m]);return l(oe,{testId:"wallet-balances",header:l(Q,{title:a("views.WALLET_BALANCES.header.title"),rightActions:l(e,{icon:"SettingsCog",sx:ee(),iconVariant:"bold",onClick:()=>{W({userJourney:P.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),C({payload:{type:T.UPDATE_VIEW,view:{type:et.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>te(h)}),footer:l(ne,{}),children:E(p,{sx:ht,children:[E(p,{sx:Ct,children:[A&&l(ut,{}),l(tt,{totalBalance:b,loading:t}),E(p,{sx:kt(A,F),children:[t&&E(p,{sx:bt,children:[l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!t&&l(it,{balanceInfoItems:B,bridgeToL2OnClick:e=>{j.sendRequestBridgeEvent(h,D.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:n})]})]}),F&&E(N,{testId:"add-coins",emphasized:!0,onClick:()=>{W({userJourney:P.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),C({payload:{type:T.UPDATE_VIEW,view:{type:V.TOP_UP_VIEW}}})},children:[l(N.FramedIcon,{icon:"Add"}),l(N.Label,{children:a("views.WALLET_BALANCES.addCoins")})]})]})})}function gt(e){switch(e){case ae.METAMASK:return"MetaMaskSymbol";case ae.PASSPORT:return"PassportSymbolOutlined";case"walletconnect":return"WalletConnectSymbol";default:return"MetaMaskSymbol"}}const yt={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"},Et={fill:"base.color.fixed.black.1000"};function St({provider:t,showL1Warning:n,setShowL1Warning:o}){const[a,s]=r.useState(""),[i,c]=r.useState(!1),{t:d}=g(),{track:p}=x(),L=r.useMemo((()=>O(t)&&!n?"ShowPassword":i?"Tick":"CopyText"),[t,n,i]);r.useEffect((()=>{t&&""===a&&(async()=>{const e=await t.getSigner().getAddress();s(e)})()}),[t,a]);return E(N,{testId:"wallet-address",emphasized:!0,size:"medium",children:[l(N.FramedLogo,{logo:gt(se(t)),sx:{backgroundColor:"base.color.translucent.standard.200"}}),l(e,{variant:"tertiary",iconVariant:"bold",size:"small",icon:L,iconSx:{...i?Et:{}},onClick:async()=>{a&&"CopyText"===L?(p({userJourney:P.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(a),c(!0),setTimeout((()=>c(!1)),1e3)):"ShowPassword"===L&&o(!0)},sx:{cursor:"pointer",...i?yt:{}}}),l(N.Label,{children:d("views.SETTINGS.walletAddress.label")}),l(N.Caption,{testId:"wallet-address",children:re(a)})]})}const Tt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},vt={marginTop:"32px"};function xt(){return l(p,{testId:"transfer-assets-l1-warning-hero",sx:{display:"flex",justifyContent:"center",padding:"base.spacing.x4"},children:l(p,{children:E("svg",{xmlns:"http://www.w3.org/2000/svg",width:"135",height:"137",viewBox:"0 0 135 137",fill:"none",children:[l("path",{d:"M76.2361 65.9046L76.5095 17.3023C76.5157 15.9172 76.0711 14.9946 75.3435 14.6207C74.0964 13.9799 72.9093 14.4957 71.4798 15.3728L29.2306 41.5137L28.3702 98.7706L76.2398 65.9035L76.2361 65.9046Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M85.4571 126.862L85.791 76.8509C85.8102 74.0184 83.742 70.6325 81.1983 69.3267L47.8586 51.3375C46.7068 50.7462 45.739 49.8676 45.0526 48.788L43.4726 46.3043C42.7862 45.2247 41.8184 44.3461 40.6665 43.7548L36.2848 41.5054L31.2783 42.6987L30.909 101.567C30.9861 102.57 31.6727 103.52 32.9446 104.173L80.2378 129.343L81.6163 131.639L84.2802 129.667L84.2754 129.664C85.0031 129.123 85.4546 128.164 85.4632 126.862L85.4571 126.862Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M83.1421 78.7933C83.1612 75.96 81.0925 72.5732 78.5483 71.267L30.2174 45.562C28.8517 44.8609 28.1628 43.8191 28.1721 42.7358L27.7773 103.281C27.8544 104.284 28.5413 105.234 29.8134 105.887L78.1443 131.592C80.6909 132.9 82.7889 131.652 82.8068 128.821L83.1408 78.7956L83.1421 78.7933Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M36.8699 42.6587C36.8641 43.5432 35.5341 44.2721 33.9017 44.2823C32.2694 44.2925 30.9508 43.5854 30.9555 42.6973C30.9602 41.8091 32.2913 41.0838 33.9237 41.0736C34.7155 41.0681 35.4328 41.2334 35.963 41.5055C36.5244 41.7937 36.8726 42.2027 36.8699 42.6587Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M35.2866 42.6695C35.284 43.0802 34.6673 43.4179 33.9096 43.4227C33.1519 43.4276 32.5394 43.098 32.5419 42.6874C32.5445 42.2767 33.1612 41.939 33.9189 41.9342C34.2856 41.9315 34.6182 42.0084 34.8653 42.1352C35.1268 42.2695 35.288 42.4582 35.2853 42.6719L35.2866 42.6695Z",fill:"black"}),l("path",{d:"M70.9275 14.9238L29.4561 40.1902C28.389 40.9925 27.8611 41.9567 27.8526 42.8886C27.8526 42.8886 27.6951 44.5777 29.8905 45.7049C32.0859 46.832 34.8391 48.2668 34.8391 48.2668L36.1919 47.4119L31.26 44.8586C29.3491 43.8775 28.9381 42.1986 30.6697 40.8949L72.2083 15.5784C73.3784 14.6992 74.4371 14.4968 75.1905 14.8835C75.1905 14.8835 72.8927 13.4441 70.9288 14.9215L70.9275 14.9238Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M81.0605 110.741L83.1092 111.399L85.7093 118.337L85.7797 107.796L81.2805 106.491L81.0605 110.741Z",fill:"black"}),l("path",{d:"M83.1104 113.492C83.1312 110.487 84.073 109.095 87.3742 109.652C89.1483 109.952 90.9444 109.879 92.6948 109.428L96.5484 108.436C99.8885 107.577 102.639 104.113 102.664 100.741C102.686 97.3675 99.9706 95.3116 96.6329 96.1724L91.9518 97.3781C90.3645 97.7883 88.6894 97.6786 87.181 97.0768C84.1103 95.8485 83.2401 94.5701 83.2615 91.3841L81.2915 93.3582L74.7155 111.72L83.1115 113.496L83.1104 113.492Z",fill:"#F3F3F3"}),l("path",{d:"M83.1053 113.501C83.1261 110.496 84.0681 109.104 87.3701 109.661C89.1445 109.961 90.9411 109.888 92.6918 109.437L96.5463 108.445C99.8871 107.585 102.638 104.12 102.663 100.747C102.685 97.3736 99.9692 95.3172 96.6308 96.1782L91.9487 97.3841C90.361 97.7944 88.6855 97.6847 87.1768 97.0828C84.1055 95.8542 83.2351 94.5755 83.2564 91.3888",stroke:"black",strokeWidth:"1.33831",strokeMiterlimit:"10"}),l("path",{d:"M100.563 99.4451C99.4403 98.3218 97.1152 98.7714 95.3661 100.45C93.6171 102.129 93.1092 104.399 94.2323 105.522L94.7567 106.048L101.088 99.9711L100.563 99.4451Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M99.9733 105.056C101.727 103.381 102.236 101.114 101.111 99.9926C99.986 98.8713 97.6528 99.3204 95.8996 100.996C94.1464 102.671 93.637 104.938 94.762 106.059C95.8869 107.18 98.2201 106.731 99.9733 105.056Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M51.6986 91.7452C50.6642 91.2142 49.827 89.8416 49.8336 88.6901L49.9893 65.7522C49.9984 64.6019 50.8483 64.0955 51.8828 64.6265L72.5076 75.205C73.542 75.736 74.3793 77.1086 74.3726 78.2601L74.2169 101.198C74.2079 102.348 73.3579 102.855 72.3235 102.324L51.6986 91.7452Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M52.7617 91.0867C51.7272 90.5557 50.89 89.1831 50.8966 88.0315L51.0523 65.0931C51.0553 64.8339 51.101 64.6088 51.1799 64.4189C50.4902 64.3771 49.9962 64.8783 49.9906 65.7516L49.8349 88.69C49.8259 89.8403 50.6655 91.2142 51.7 91.7452L72.3252 102.324C73.1244 102.734 73.8145 102.522 74.0887 101.871C73.8709 101.859 73.6341 101.792 73.3845 101.664L52.7593 91.0855L52.7617 91.0867Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M66.9055 85.8915L66.8883 88.4023L64.3853 87.1169L61.8847 85.8328L59.3817 84.5474L57.6065 83.6358C57.2078 83.4311 56.8773 83.5922 56.875 83.9917L56.8689 85.042C56.8653 85.4439 57.1906 85.9418 57.5917 86.1478L59.3669 87.0594L61.8699 88.3448L61.8577 90.1235C61.8541 90.5254 62.1807 91.0209 62.5818 91.2269L63.6292 91.7647C64.0279 91.9695 64.3584 91.8083 64.362 91.4064L64.3742 89.6277L66.8772 90.9131L68.6523 91.8247C69.0511 92.0295 69.3829 91.8659 69.3852 91.4664L69.3974 89.6877L69.4095 87.909C69.4131 87.5071 69.0866 87.0116 68.6854 86.8056L66.9103 85.894L66.9055 85.8915Z",fill:"white"}),l("path",{d:"M59.3703 79.5438L59.3581 81.3271C59.3569 81.7313 59.6802 82.2293 60.0844 82.4371L61.862 83.3511L64.3662 84.6386L66.8728 85.9274L66.8862 84.1416C66.8874 83.7374 66.5641 83.2394 66.16 83.0316L64.3823 82.1176L61.8781 80.8301L59.3716 79.5414L59.3703 79.5438Z",fill:"white"}),l("path",{d:"M62.6235 73.7033C62.2248 73.4985 61.8943 73.6597 61.892 74.0592L61.8798 75.8379L59.3768 74.5525L57.6016 73.641C57.2029 73.4362 56.8724 73.5973 56.8688 73.9992L56.8566 75.7779L56.8445 77.5566C56.8409 77.9585 57.1674 78.4541 57.5686 78.6601L59.3437 79.5717L59.3609 77.0609L61.8639 78.3463L64.3645 79.6304L66.8675 80.9157L68.6426 81.8273C69.0414 82.0321 69.3719 81.8709 69.3755 81.469L69.3827 80.4224C69.3838 80.0193 69.061 79.5226 68.6598 79.3166L66.8847 78.405L64.3817 77.1197L64.3938 75.341C64.3974 74.9391 64.0709 74.4435 63.6697 74.2375L62.6224 73.6997L62.6235 73.7033Z",fill:"white"}),l("path",{d:"M46.8192 101.66L46.8314 99.6311C46.838 98.841 46.2586 97.8985 45.551 97.5353L42.5478 95.9937L42.5679 93.0481C42.5746 92.258 41.9976 91.3167 41.2875 90.9523L38.7449 89.6471C38.3611 89.4501 38.0161 89.4638 37.7758 89.6403L36.4656 90.6093L37.4387 91.7024L37.4277 93.3685L34.4246 91.827C34.0408 91.63 33.6957 91.6437 33.4554 91.8201L32.1452 92.7891L33.1181 93.8094L33.113 94.6306C33.1063 95.4207 33.6858 96.3632 34.3934 96.7264L37.3965 98.268L37.3764 101.214C37.3698 102.004 37.9468 102.945 38.6568 103.309L39.7002 103.845L40.8571 105.593L42.1673 104.624C42.3691 104.473 42.4965 104.205 42.4976 103.842L42.5177 100.897L44.2088 101.765L45.1822 103.415L46.4924 102.446C46.6966 102.297 46.8216 102.028 46.8227 101.665L46.8192 101.66Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M45.514 102.623L45.5261 100.594C45.5327 99.8036 44.9532 98.8609 44.2455 98.4977L41.2419 96.9558L41.262 94.0097C41.2674 93.2219 40.6916 92.2781 39.9815 91.9135L37.4385 90.6082C36.7284 90.2437 36.1455 90.5927 36.1388 91.3829L36.1187 94.329L33.1151 92.7872C32.405 92.4227 31.8184 92.7728 31.8154 93.5619L31.8033 95.5912C31.7967 96.3815 32.3762 97.3241 33.0839 97.6874L36.0875 99.2293L36.0673 102.175C36.0607 102.966 36.6378 103.907 37.3479 104.272L39.8909 105.577C40.601 105.941 41.1839 105.592 41.1906 104.802L41.2107 101.856L44.2143 103.398C44.9244 103.762 45.511 103.412 45.514 102.623Z",fill:"white",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M55.4177 54.343L85.7278 37.2672L70.5728 15.9224L55.4177 54.343Z",fill:"#FF637F",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M55.4176 54.3431L51.6289 52.2086L66.7839 13.7881L70.5727 15.9226L55.4176 54.3431Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M69.1528 25.261L71.9944 23.6602V34.3325L69.1528 35.9334V25.261Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M69.1528 38.0676L71.9944 36.4667V39.6684L69.1528 41.2693V38.0676Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}function At({provider:t,showL1Warning:n,setShowL1Warning:o}){const{t:a}=g();return l(ie,{size:"full",visible:n,showHeaderBar:!1,children:E(ie.Content,{children:[l(e,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>o(!1)}),l(xt,{}),E(p,{sx:{px:"base.spacing.x6"},children:[l(B,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:a("views.SETTINGS.transferAssetsL1Warning.heading")}),l(S,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:a("views.SETTINGS.transferAssetsL1Warning.body")}),l(St,{provider:t,showL1Warning:n,setShowL1Warning:o})]})]})})}function It({showDisconnectButton:e}){const[t,n]=r.useState(!1),{t:o}=g(),{connectLoaderState:a}=r.useContext(v),{provider:s}=a,{eventTargetState:{eventTarget:i}}=r.useContext(I),{ethereumProvider:c}=le(),{page:d}=x();r.useEffect((()=>{d({userJourney:P.WALLET,screen:"Settings"})}),[]);return E(oe,{testId:"wallet-balances",header:l(Q,{showBack:!0,title:o("views.SETTINGS.header.title"),onCloseButtonClick:()=>te(i)}),footer:l(ne,{}),children:[E(p,{sx:Tt,children:[l(St,{provider:s,showL1Warning:t,setShowL1Warning:n}),e&&l(b,{testId:"disconnect-button",variant:"secondary",sx:vt,onClick:()=>{(async()=>{if(de(s))try{if(s.provider?.session){const e=s.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>c?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await s.provider.disconnect()}if(c){const e=c?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>c?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await c.disconnect()}}catch(e){console.error(e)}})().then((()=>{ce(i)}))},children:o("views.SETTINGS.disconnectButton.label")})]}),l(At,{provider:s,showL1Warning:t,setShowL1Warning:n})]})}function Ot(){return l(p,{sx:{...pe,background:"base.color.translucent.emphasis.100"},children:l(p,{sx:{...Le,...ue},children:E("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l("path",{d:"M213 120C132.857 120 65.7181 139.009 1 175.641V211H431V178.515C365.165 140.107 295.216 120 213 120Z",fill:"url(#paint0_linear_4525_125520)"}),l("path",{d:"M428.5 210.5H383C383 123 114 113.5 236 120.5C333.6 126.1 405 163.833 428.5 182V210.5Z",fill:"#2D0034",fillOpacity:"0.2"}),l("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),l("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),l("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),l("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),l("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),l("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),l("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),l("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),l("path",{d:"M2.97844e-07 176.149C62.5366 139.802 135.143 119 212.584 119C292.029 119 366.384 140.892 430 179",stroke:"black"}),l("path",{d:"M70.97 142.773C76.3142 146.15 87.6289 137.839 96.242 124.208C104.855 110.578 107.505 96.7911 102.161 93.414C96.8167 90.037 85.5021 98.3487 76.889 111.979C68.2758 125.609 65.6258 139.396 70.97 142.773Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M76.8602 112.001C79.353 108.055 82.0686 104.564 84.8088 101.664L94.3989 126.977C86.0698 138.949 75.925 145.933 70.9515 142.793C65.6033 139.413 68.2536 125.631 76.8692 111.994L76.8602 112.001Z",fill:"black"}),l("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M98.2141 120.884C99.3274 118.901 100.309 116.925 101.153 115.003L108.025 119.342C107.181 121.264 106.2 123.233 105.085 125.224L98.2141 120.884Z",fill:"#F191FA"}),l("path",{d:"M102.311 112.191C104.156 107.325 105.052 102.898 104.877 99.4899L111.748 103.829C111.923 107.238 111.035 111.665 109.182 116.531L102.311 112.191Z",fill:"black"}),l("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M341.833 142.899C353.278 131.542 356.039 115.768 348 107.668C339.962 99.5669 324.167 102.207 312.723 113.564C301.278 124.921 298.517 140.695 306.555 148.795C314.594 156.896 330.388 154.256 341.833 142.899Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M344.451 139.969C345.913 138.216 347.189 136.39 348.264 134.524L352.416 138.709C351.341 140.575 350.065 142.4 348.603 144.153L344.451 139.969Z",fill:"#D8EFF4"}),l("path",{d:"M349.72 131.746C352.022 126.818 352.967 121.785 352.442 117.302L356.594 121.486C357.119 125.97 356.174 131.002 353.872 135.93L349.72 131.746Z",fill:"black"}),l("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M155.769 157.057C169.703 165.169 185.654 163.751 191.396 153.888C197.138 144.026 190.497 129.454 176.563 121.342C162.629 113.229 146.679 114.648 140.937 124.51C135.195 134.373 141.836 148.944 155.769 157.057Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M159.278 158.826C161.349 159.785 163.443 160.544 165.524 161.099L162.558 166.193C160.477 165.639 158.383 164.879 156.311 163.921L159.278 158.826Z",fill:"#D8EFF4"}),l("path",{d:"M168.585 161.786C173.941 162.733 179.047 162.342 183.241 160.674L180.275 165.768C176.08 167.436 170.975 167.827 165.619 166.88L168.585 161.786Z",fill:"black"}),l("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M234.03 133.525C249.631 129.452 260.983 121.192 259.386 115.075C257.79 108.959 243.848 107.301 228.248 111.374C212.647 115.446 201.294 123.706 202.891 129.823C204.488 135.94 218.429 137.597 234.03 133.525Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M237.663 132.44C239.836 131.754 241.896 130.986 243.826 130.154L245.878 138.014C243.948 138.838 241.888 139.606 239.715 140.3L237.663 132.44Z",fill:"#F191FA"}),l("path",{d:"M246.588 128.896C251.257 126.601 254.941 123.976 257.13 121.367L259.182 129.227C256.985 131.836 253.309 134.461 248.64 136.756L246.588 128.896Z",fill:"black"}),l("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M189.995 60.1335C175.063 54.0502 161.025 53.8648 158.64 59.7194C156.255 65.5739 166.426 75.2515 181.358 81.3348C196.29 87.418 210.328 87.6034 212.713 81.7488C215.098 75.8943 204.927 66.2167 189.995 60.1335Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M185.032 82.6694C187.186 83.4191 189.294 84.0389 191.339 84.5366L188.275 92.0629C186.23 91.5652 184.122 90.9454 181.968 90.1957L185.032 82.6694Z",fill:"#96DAF4"}),l("path",{d:"M194.301 85.1776C199.418 86.1391 203.932 86.2438 207.256 85.4671L204.192 92.9934C200.868 93.762 196.353 93.6654 191.237 92.7038L194.301 85.1776Z",fill:"black"}),l("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M331.022 121.427C326.722 126.062 313.654 120.93 301.833 109.965C290.012 99 283.915 86.3538 288.214 81.719C292.513 77.0841 305.581 82.2158 317.402 93.1808C329.223 104.146 335.321 116.792 331.022 121.427Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M317.436 93.1948C314.014 90.0206 310.494 87.3431 307.102 85.2426L304.325 112.168C315.446 121.604 327.043 125.752 331.044 121.441C335.347 116.803 329.25 104.162 317.425 93.1905L317.436 93.1948Z",fill:"black"}),l("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M299.075 107.258C297.49 105.627 296.034 103.969 294.725 102.327L289.197 108.284C290.506 109.926 291.959 111.577 293.546 113.215L299.075 107.258Z",fill:"#F191FA"}),l("path",{d:"M292.885 99.9066C289.854 95.6761 287.853 91.6272 287.147 88.2883L281.619 94.2451C282.324 97.584 284.318 101.636 287.357 105.863L292.885 99.9066Z",fill:"black"}),l("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),l("defs",{children:E("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[l("stop",{stopColor:"#AD48BA"}),l("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function Mt(){const{t:e}=g(),{connectLoaderState:{provider:t}}=r.useContext(v),n=O(t),{page:o}=x();return r.useEffect((()=>{o({userJourney:P.WALLET,screen:"CoinInfo"})}),[]),E(oe,{testId:"coin-info",header:l(Q,{showBack:!0,transparent:!0}),footer:l(ne,{}),heroContent:l(Ot,{}),floatHeader:!0,children:[!n&&l(he,{heading:e("views.COIN_INFO.metamask.heading"),children:e("views.COIN_INFO.metamask.body")}),n&&E(he,{heading:e("views.COIN_INFO.passport.heading"),children:[e("views.COIN_INFO.passport.body1"),l(be,{onClick:()=>window.open(Ce),children:e("views.COIN_INFO.passport.linkText")}),e("views.COIN_INFO.passport.body2")]})]})}const Wt=({checkout:e,provider:t,refreshCallback:n,errorCallback:o})=>{const[a,s]=r.useState(!0),i=r.useCallback((async(a=!1)=>{if(e&&t)try{const o=await e.getNetworkInfo({provider:t});if(!o.isSupported)return;a||s(!0);const r=await(async(e,t,n)=>{if(!e||!t||!n)return[];const o=await t.getSigner().getAddress(),a=await ve((()=>e.getAllBalances({provider:t,walletAddress:o,chainId:n})),K);return a?X(e.config,a.balances,n).map((t=>({...t,token:{...t.token,icon:Y(e.config.environment,R(t.token.address)?t.token.symbol:t.token.address??"")}}))):[]})(e,t,o.chainId);a||s(!1),n(r)}catch(e){K.nonRetryable(e)&&o(e),a||s(!1)}}),[e,t]);return xe((()=>i(!0)),3e4),{balancesLoading:a,refreshBalances:i}};function _t(e){const{t:t}=g(),n=t("views.ERROR_VIEW.actionText"),o=t("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:a}}=r.useContext(I),{config:{environment:s,isOnRampEnabled:i,isSwapEnabled:c,isBridgeEnabled:d,theme:p},walletConfig:{showDisconnectButton:L,showNetworkMenu:u}}=e,{connectLoaderState:{checkout:h,provider:C}}=r.useContext(v),[b,k]=r.useReducer(ke,{...fe,history:[]}),[f,m]=r.useReducer(Ke,{...$e,walletConfig:{showDisconnectButton:L,showNetworkMenu:u}}),w=r.useMemo((()=>({walletState:f,walletDispatch:m})),[f,m]),S=r.useMemo((()=>({viewState:b,viewDispatch:k})),[b,k]),{balancesLoading:x,refreshBalances:A}=Wt({checkout:h,provider:C,refreshCallback:e=>{m({payload:{type:He.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),k({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});r.useEffect((()=>{(async()=>{if(!h)return;let e;try{e=await h.isSwapAvailable()}catch(t){e=!1}m({payload:{type:He.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:d,isSwapEnabled:c,isOnRampEnabled:i,isSwapAvailable:e}}})})()}),[d,c,i,s]);const O=async()=>{if(h&&C)try{const e=await h.getNetworkInfo({provider:C});if(!e.isSupported)return;A(),k({payload:{type:T.UPDATE_VIEW,view:{type:et.WALLET_BALANCES}}}),m({payload:{type:He.SET_NETWORK,network:e}})}catch(e){console.error(e),k({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:e}}})}};r.useEffect((()=>{h&&C&&O()}),[h,C]);return l(y.Provider,{value:S,children:l(Ee,{environment:s,children:E(Je.Provider,{value:w,children:[b.view.type===V.LOADING_VIEW&&l(me,{loadingText:o}),b.view.type===et.WALLET_BALANCES&&l(wt,{balancesLoading:x,theme:p,showNetworkMenu:u}),b.view.type===et.SETTINGS&&l(It,{showDisconnectButton:L}),b.view.type===et.COIN_INFO&&l(Mt,{}),b.view.type===V.ERROR_VIEW&&l(we,{actionText:n,onActionClick:async()=>{k({payload:{type:T.UPDATE_VIEW,view:{type:et.WALLET_BALANCES}}}),await O()},onCloseClick:()=>te(a)}),b.view.type===V.TOP_UP_VIEW&&l(Se,{analytics:{userJourney:P.WALLET},widgetEvent:D.IMTBL_WALLET_WIDGET_EVENT,checkout:h,provider:C,showOnrampOption:i,showSwapOption:c,showBridgeOption:d,onCloseButtonClick:()=>te(a)})]})})})}export{_t as default};
@@ -1 +1 @@
1
- import{cY as t}from"./index-33d10388.js";function n(n,e,r,o){var i=this;return n?((n instanceof Element?[n]:"toArray"in n?n.toArray():n).forEach((function(n){n.addEventListener("click",(function(u){var c,a,s=e instanceof Function?e(n):e,f=r instanceof Function?r(n):r,l=n.getAttribute("href")||n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("xlink:href")||(null===(c=n.getElementsByTagName("a")[0])||void 0===c?void 0:c.getAttribute("href")),h=t(i.track(s,f,null!=o?o:{}),null!==(a=i.settings.timeout)&&void 0!==a?a:500);(function(t,n){return!("_blank"!==t.target||!n)})(n,l)||function(t){var n=t;return!!(n.ctrlKey||n.shiftKey||n.metaKey||n.button&&1==n.button)}(u)||l&&(u.preventDefault?u.preventDefault():u.returnValue=!1,h.catch(console.error).then((function(){window.location.href=l})).catch(console.error))}),!1)})),this):this}function e(n,e,r,o){var i=this;return n?(n instanceof HTMLFormElement&&(n=[n]),n.forEach((function(n){if(!(n instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var u=function(u){var c;u.preventDefault?u.preventDefault():u.returnValue=!1;var a=e instanceof Function?e(n):e,s=r instanceof Function?r(n):r;t(i.track(a,s,null!=o?o:{}),null!==(c=i.settings.timeout)&&void 0!==c?c:500).catch(console.error).then((function(){n.submit()})).catch(console.error)},c=window.jQuery||window.Zepto;c?c(n).submit(u):n.addEventListener("submit",u,!1)})),this):this}export{e as form,n as link};
1
+ import{cY as t}from"./index-48317d33.js";function n(n,e,r,o){var i=this;return n?((n instanceof Element?[n]:"toArray"in n?n.toArray():n).forEach((function(n){n.addEventListener("click",(function(u){var c,a,s=e instanceof Function?e(n):e,f=r instanceof Function?r(n):r,l=n.getAttribute("href")||n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("xlink:href")||(null===(c=n.getElementsByTagName("a")[0])||void 0===c?void 0:c.getAttribute("href")),h=t(i.track(s,f,null!=o?o:{}),null!==(a=i.settings.timeout)&&void 0!==a?a:500);(function(t,n){return!("_blank"!==t.target||!n)})(n,l)||function(t){var n=t;return!!(n.ctrlKey||n.shiftKey||n.metaKey||n.button&&1==n.button)}(u)||l&&(u.preventDefault?u.preventDefault():u.returnValue=!1,h.catch(console.error).then((function(){window.location.href=l})).catch(console.error))}),!1)})),this):this}function e(n,e,r,o){var i=this;return n?(n instanceof HTMLFormElement&&(n=[n]),n.forEach((function(n){if(!(n instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var u=function(u){var c;u.preventDefault?u.preventDefault():u.returnValue=!1;var a=e instanceof Function?e(n):e,s=r instanceof Function?r(n):r;t(i.track(a,s,null!=o?o:{}),null!==(c=i.settings.timeout)&&void 0!==c?c:500).catch(console.error).then((function(){n.submit()})).catch(console.error)},c=window.jQuery||window.Zepto;c?c(n).submit(u):n.addEventListener("submit",u,!1)})),this):this}export{e as form,n as link};
@@ -1 +1 @@
1
- import{ca as e,j as t,aI as n,_ as r,u as a,r as i,cb as o,cc as s,m as l,n as c,cd as d,B as p,S as h,ce as u,a as b,aN as g,C as m,k as f,cf as L,f as k,cg as x,i as C,aP as w,l as v,b8 as y,z as O,bW as I,y as j,aa as M,bX as E,bd as H,H as S,o as A,d as D,a2 as P,a7 as B,M as F,ch as T,ci as Z,b7 as z,cj as W,ck as N,aD as _,A as $,v as R,bI as V,cl as Q,ab as X,ac as q,ad as G,bh as K,X as U,G as Y,R as J}from"./index-33d10388.js";import{T as ee,r as te}from"./retry-2ec883f6.js";function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ae=function(e){return{brad:"base.borderRadius.x4",overflow:"hidden",transitionProperty:"background-color",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","&.emphasized":{bgc:"base.color.translucent.emphasis.100"},"&.expanded":{bgc:"base.color.translucent.emphasis.100"},"&.emphasized.expanded":{bgc:"base.color.translucent.emphasis.200"},"&:hover":{bgc:"base.color.translucent.emphasis.200"},"&.emphasized:hover":{bgc:"base.color.translucent.emphasis.300"},"&:hover .ButtCon":re({},L("small",e,!1)["&:hover:not([disabled])"])}},ie=re(re({},e),{},{alignItems:"flex-start",justifyContent:"space-between",gap:"base.spacing.x4",position:"relative",px:"base.spacing.x3",py:"base.spacing.x4",minh:"base.spacing.x16"}),oe={position:"absolute",top:"base.spacing.x4"},se={overflow:"visible",bg:"transparent",maxh:"unset",boxShadow:"unset",brad:"unset",p:"0"},le={mb:"base.spacing.x10",px:"base.spacing.x3","& .Divider:first-of-type":{mb:"base.spacing.x4"}},ce=["children","className","sx","chevronSide"];function de(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?de(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e){var n=e.children,a=e.className,o=e.sx,s=void 0===o?{}:o,c=e.chevronSide,d=void 0===c?"left":c,p=r(e,ce),u=i.useMemo((function(){return k(n)}),[n]);return t(g,pe(pe({},p),{},{className:"".concat(null!=a?a:""," AccordionExpandedContent"),sx:l(le,pe({},x("left"===d?"pl":"pr",s,"base.spacing.x15")),s),children:i.Children.map(u,(function(e){return i.isValidElement(e)&&C(e,w)?t(h,{size:"xSmall",children:e}):e}))}))}he.displayName="Accordion.ExpandedContent";var ue=["children","direction","gap","rc"],be=["sx","alignItems","className"],ge=["alignItems","className","sx"];function me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Le(e){var n=e.children,a=e.direction,i=void 0===a?"column":a,o=e.gap,s=void 0===o?"0px":o,l=e.rc,c=void 0===l?t("span",{}):l,d=r(e,ue);return t(g,fe(fe({},d),{},{direction:i,gap:s,rc:c,children:n}))}function ke(e){var n=e.sx,a=void 0===n?{}:n,i=e.alignItems,o=void 0===i?"flex-start":i,s=e.className,c=r(e,be);return t(Le,fe(fe({},c),{},{alignItems:o,sx:l({flex:1,textAlign:"left"},a),className:"".concat(null!=s?s:""," AccordionTargetLeftSlot")}))}function xe(e){var n=e.alignItems,a=void 0===n?"flex-end":n,i=e.className,o=e.sx,s=void 0===o?{}:o,c=r(e,ge);return t(Le,fe(fe({},c),{},{alignItems:a,sx:l({textAlign:"right"},s),className:"".concat(null!=i?i:""," AccordionTargetRightSlot")}))}ke.displayName="Accordion.TargetLeftSlot",xe.displayName="Accordion.TargetRightSlot";var Ce=["emphasized","expanded","defaultExpanded","children","gap","alignItems","className","onExpandChange","chevronSide","sx","rc","targetClickOveride","testId"];function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ye(e){var f=ve(ve({},e),{},"expanded"in e?{defaultExpanded:void 0}:{expanded:void 0}),L=f.emphasized,k=f.expanded,x=f.defaultExpanded,C=f.children,w=f.gap,v=void 0===w?"0":w,y=f.alignItems,O=void 0===y?"stretch":y,I=f.className,j=f.onExpandChange,M=f.chevronSide,E=void 0===M?"left":M,H=f.sx,S=void 0===H?{}:H,A=f.rc,D=void 0===A?t(n.div,{}):A,P=f.targetClickOveride,B=f.testId,F=void 0===B?"Accordion":B,T=r(f,Ce),Z=a(),z=Z.base,W=i.useState(x),N=o(W,2),_=N[0],$=N[1],R=null!=k?k:_,V=s(C,ke),Q=s(C,xe),X=s(C,he),q=i.useCallback((function(){void 0===k?$((function(e){return null==j||j(!e),!e})):null==j||j(!k)}),[k,j]),G=i.useMemo((function(){var e,t;return l(ae(Z),null!==(e=null===(t=Z.components)||void 0===t||null===(t=t.Accordion)||void 0===t?void 0:t.sxOverride)&&void 0!==e?e:{},S)}),[S,Z]);return t(m,{children:function(e){var r=e.cx;return c(g,ve(ve({},T),{},{className:"".concat(null!=I?I:""," Accordion ").concat(r({emphasized:L,expanded:R})),gap:v,alignItems:O,rc:D,sx:G,testId:F,children:[c(d,{sx:l(ie,ve({},"left"===E?{pl:"base.spacing.x15"}:{pr:"base.spacing.x15"})),onClick:P||q,testId:"".concat(F,"__clickableArea"),children:[t(p,{rc:t("span",{}),icon:R?"ChevronCollapse":"ChevronExpand",variant:"tertiary",size:"small",testId:"".concat(F,"__clickableArea__chevron"),sx:l(oe,ve({},"left"===E?{left:"base.spacing.x3"}:{right:"base.spacing.x3"})),className:"Accordion__ButtCon"}),t(h,{testId:"".concat(F,"__clickableArea__targetLeft"),children:V}),Q&&t(h,{testId:"".concat(F,"__clickableArea__targetRight"),children:Q})]}),t(u,{children:Boolean(X)&&R?t(b,{sx:se,rc:t(n.div,{initial:{opacity:0,height:0,overflow:"hidden",y:-16},animate:{height:"auto",opacity:1,y:0,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden",y:-16},transition:{duration:z.motion.normal.fast.jsDuration,ease:z.motion.normal.fast.jsEase}}),children:t(h,{chevronSide:E,testId:"".concat(F,"__expandedContent"),children:X})}):null})]}))}})}function Oe({visible:e,targetChainId:n,provider:r,checkout:a,onCloseDrawer:o,onNetworkSwitch:s}){const{t:l}=v(),d=y(a.config.environment??O.PRODUCTION,"/switchnetworkethereum.svg"),h=y(a.config.environment??O.PRODUCTION,"/switchnetworkzkevm.svg"),u=I(n),g=n===j(a.config),m=i.useCallback((async()=>{if(!a)return;const e=await a.switchNetwork({provider:r,chainId:n});s&&s(e.provider)}),[a,r,s,n]),f=M(r),L=i.useMemo((()=>f?r.provider?.session?.peer?.metadata?.name:""),[r,f]),k=i.useMemo((()=>L?.toLowerCase().includes("metamask")),[L]),x=i.useMemo((()=>E(r)?"MetaMask wallet":f&&L?L:"wallet"),[r,f,L]),C=f&&k;return i.useEffect((()=>{(new Image).src=d;(new Image).src=h}),[]),t(B,{size:"threeQuarter",visible:e,onCloseDrawer:o,showHeaderBar:!1,children:c(B.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[t(H,{use:t("img",{src:g?d:h,alt:l("drawers.networkSwitch.heading",{wallet:x})})}),t(p,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:o}),c(b,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[t(S,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.heading",{wallet:x})}),C&&t(A,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.manualSwitch.body",{chain:u})}),!C&&t(A,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.controlledSwitch.body",{chain:u})})]}),c(b,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!C&&t(D,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:m,children:l("drawers.networkSwitch.switchButton",{chain:u})}),t(P,{})]})]})})}function Ie({onClick:e,icon:n,name:r,symbol:a,balance:i,defaultTokenImage:o,testId:s,id:l}){const{t:d}=v();return c(F,{testId:`${s}-coin-selector__option-${l}`,emphasized:!0,size:"small",onClick:e,children:[t(F.FramedImage,{circularFrame:!0,use:t(ee,{src:n,name:r,defaultImage:o})}),t(F.Label,{children:r}),t(F.Caption,{children:a}),i&&t(F.PriceDisplay,{fiatAmount:`${d("drawers.coinSelector.option.fiatPricePrefix")}${i.formattedFiatAmount}`,price:i.formattedAmount})]})}ye.displayName="Accordion",ye.TargetLeftSlot=ke,ye.TargetRightSlot=xe,ye.ExpandedContent=he;const je={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},Me={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function Ee({heading:e,options:n,defaultTokenImage:r,optionsLoading:a,children:i,onCloseDrawer:o,visible:s}){const{t:l}=v();return c(B,{headerBarTitle:e,size:"full",onCloseDrawer:o,visible:s,children:[t(B.Target,{children:i}),t(B.Content,{children:c(b,{sx:je,children:[a&&0===n.length&&c(b,{sx:Me,children:[t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!a&&0===n.length&&t(A,{sx:{padding:"base.spacing.x4"},children:l("drawers.coinSelector.noCoins")}),!a&&n.map((({onClick:e,icon:n,name:a,symbol:i,balance:o,id:s,testId:l})=>t(Ie,{id:s,testId:l,onClick:e,icon:n,name:a,symbol:i,balance:o,defaultTokenImage:r},`${i}-${a}`)))]})})]})}function He({testId:e,options:n,optionsLoading:r,subtext:a,onSelectChange:o,textAlign:s,errorMessage:l,disabled:d,selectedOption:p,coinSelectorHeading:h,defaultTokenImage:u,environment:g=O.PRODUCTION,theme:m=z.DARK}){const[f,L]=i.useState(!1),k=i.useMemo((()=>n.map((t=>({...t,testId:e,onClick:()=>{o(t.id),L(!1)}})))),[n,o,L]),x=n?.find((e=>e.id===p))??p;return c(b,{children:[t(Ee,{heading:h,options:k,defaultTokenImage:u,optionsLoading:r??!1,visible:f,onCloseDrawer:()=>L(!1)}),t(Z,{testId:`${e}-select-control`,textAlign:s??"left",subtext:l?void 0:a,isErrored:!!l,errorMessage:l,children:t(T,{testId:`${e}-select`,size:"large",defaultLabel:"Select token",targetClickOveride:()=>L(!0),selectedOption:(()=>{if(p&&0!==n.length&&n.find((e=>e.id===p)))return p})(),sx:{minw:"170px"},children:x&&c(T.Option,{optionKey:x.id,testId:x.testId,disabled:d,children:[!x.icon&&t(T.Option.Icon,{icon:"Coins",variant:"bold"}),x.icon&&t(T.Option.FramedImage,{use:t(ee,{environment:g,theme:m,src:x.icon,name:x.name}),circularFrame:!0,sx:{background:"base.color.translucent.standard.100"}}),t(T.Option.Label,{children:x.symbol})]},x.id)})})]})}function Se({testId:e,value:n,placeholder:r,errorMessage:a,validator:i,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:l,onTextInputEnter:c,textAlign:d,type:p,subtext:h,maxButtonClick:u,disabled:b,inputMode:g}){return t(Z,{testId:`${e}-text-control`,textAlign:d??"left",subtext:a?void 0:h,isErrored:!!a,errorMessage:a,sx:{width:"100%"},children:t(W,{testId:`${e}-text`,onChange:e=>((e,t)=>{let n=e.target.value;"number"===p&&"."===n&&(n="0."),i(n)?o(n):o(t??"")})(e,n),sizeVariant:"large",value:n,inputMode:g,validationStatus:a?"error":"success",placeholder:r,onBlur:e=>{if(!s)return;const t=e.target.value;i(t)&&s(t)},onFocus:e=>{if(!l)return;const t=e.target.value;i(t)&&l(t)},onKeyDown:e=>{c&&"Enter"===e.key&&c()},disabled:b,hideClearValueButton:!0,sx:{minWidth:"100%"},children:u&&t(W.Button,{testId:`${e}-max-button`,onClick:u,disabled:b,children:"max"})})})}const Ae={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},De={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},Pe={display:"flex",width:"100%"},Be=e=>({width:"65%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),Fe={width:"35%"},Te={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function Ze({boldLabel:e,label:n,amount:r,fiatAmount:a,tokenSymbol:i,prefix:o=""}){const s=n.toLowerCase().replace(" ","-");return c(b,{sx:Pe,testId:`fee-item-${s}`,children:[t(A,{sx:Be(e),children:n}),t(N,{testId:s,sx:Fe,price:`${o}${i} ${r}`,fiatAmount:a})]})}function ze({fees:e,children:n,visible:r,onCloseDrawer:a,totalFiatAmount:i,totalAmount:o,tokenSymbol:s,loading:l=!1}){const{t:d}=v();return c(B,{headerBarTitle:d("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:a,visible:r,children:[t(B.Target,{children:n}),c(B.Content,{testId:"fees-breakdown-content",sx:Ae,children:[c(b,{sx:De,children:[l&&c(b,{sx:Te,children:[t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!l&&e.map((({label:e,amount:n,fiatAmount:r,prefix:a,token:i})=>t(Ze,{label:e,amount:n,fiatAmount:r,tokenSymbol:i.symbol??s,prefix:a},e))),o&&c(_,{children:[t(w,{size:"xSmall"}),t(Ze,{label:d("drawers.feesBreakdown.total"),amount:$(o),fiatAmount:i?`≈ ${d("drawers.feesBreakdown.fees.fiatPricePrefix")}${i}`:R("0"),tokenSymbol:s,boldLabel:!0},d("drawers.feesBreakdown.total"))]})]}),t(P,{})]})]})}const We={backgroundColor:"base.color.translucent.emphasis.100"},Ne={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function _e({gasFeeValue:e,gasFeeToken:n,gasFeeFiatValue:r,fees:a,onFeesClick:o,loading:s,sx:l}){const[d,p]=i.useState(!1),{t:h}=v();if(!e&&!s)return null;const u=R($(e)),g=n?.symbol;return c(_,{children:[c(ye,{targetClickOveride:()=>{p(!0),o?.()},sx:{...We,paddingBottom:"base.spacing.x2",...l},children:[t(ye.TargetLeftSlot,{children:t(A,{size:"medium",sx:Ne,children:h("drawers.feesBreakdown.heading")})}),c(ye.TargetRightSlot,{children:[s&&t(b,{sx:{width:"218px",position:"relative"},children:t(b,{sx:{display:"block",position:"absolute",top:"-15px",width:"100%",height:"68px",WebkitMaskPosition:"right center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",WebkitMaskImage:'url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="196" height="96"><path d="M182.85 55.2Q181.65 54 180 54h-56q-1.7 0-2.85 1.2Q120 56.35 120 58v4q0 1.7 1.15 2.85Q122.3 66 124 66h56q1.65 0 2.85-1.15Q184 63.7 184 62v-4q0-1.65-1.15-2.8m0-22Q181.65 32 180 32H68q-1.7 0-2.85 1.2Q64 34.35 64 36v8q0 1.7 1.15 2.85Q66.3 48 68 48h112q1.65 0 2.85-1.15Q184 45.7 184 44v-8q0-1.65-1.15-2.8Z" id="a"/></svg>\')'},rc:t("span",{}),children:t(V,{rc:t("span",{})})})}),!s&&t(N,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`≈ ${h("drawers.feesBreakdown.fees.fiatPricePrefix")}${r}`,price:`~ ${g} ${R($(u))}`})]})]}),t(ze,{tokenSymbol:g??"",fees:a,visible:d,loading:s,onCloseDrawer:()=>p(!1)})]})}const $e={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},Re={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},Ve={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},Qe={width:"100%",height:"64px"};function Xe({onCloseDrawer:e,visible:n,showHeaderBar:r,onRetry:a}){const{t:i}=v();return t(B,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:n,showHeaderBar:r,children:t(B.Content,{children:c(b,{sx:$e,children:[t(Q,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),c(S,{size:"small",sx:Re,testId:"transaction-rejected-heading",children:[i("drawers.transactionFailed.content.heading1"),t("br",{}),i("drawers.transactionFailed.content.heading2")]}),c(A,{sx:Re,children:[i("drawers.transactionFailed.content.body1"),t("br",{}),i("drawers.transactionFailed.content.body2")]}),c(b,{sx:Ve,children:[t(D,{sx:Qe,variant:"tertiary",onClick:a,children:i("drawers.transactionFailed.buttons.retry")}),t(D,{sx:Qe,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:i("drawers.transactionFailed.buttons.cancel")})]})]})})})}function qe(){return t(b,{testId:"wallet-approve-hero",sx:{...X,background:"base.color.translucent.emphasis.100"},children:t(b,{sx:{...q,...G},children:c("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M227.517 171.325L182.178 85.6034C181.033 83.4446 179.583 82.3652 178.156 82.3652C175.711 82.3652 174.322 84.1157 172.863 86.6218L137.285 164.056L183.689 253.776L227.522 171.32L227.517 171.325Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M226.841 137.597C228.497 133.997 228.338 128.188 226.484 124.682L197.866 70.5767C196.012 67.0757 193.14 67.1508 191.484 70.7503L164.936 128.427L168.399 134.936L165.396 141.464L168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992L165.846 154.52L169.3 161.048L166.287 167.562L187.922 208.465C189.776 211.966 192.648 211.891 194.304 208.292L226.845 137.597H226.841Z",fill:"#F191FA"}),t("path",{d:"M168.85 147.992L165.396 141.464L168.399 134.936L164.936 128.427L191.484 70.7503C193.14 67.1508 196.012 67.0757 197.866 70.5767L226.484 124.682C228.338 128.188 228.497 133.997 226.841 137.597H226.845L194.304 208.292C192.648 211.891 189.776 211.966 187.922 208.465L166.287 167.562L169.3 161.048L165.846 154.52L168.85 147.992ZM168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992Z",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),t("path",{d:"M203.136 132.773C202.484 134.19 201.353 134.223 200.621 132.843L196.101 124.297C195.369 122.917 195.308 120.627 195.961 119.21L200.621 109.082C201.273 107.665 202.404 107.632 203.136 109.012L207.656 117.558C208.388 118.938 208.449 121.228 207.796 122.645L203.136 132.773Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M206.22 114.837L204.68 118.183C204.174 119.286 203.291 119.309 202.724 118.234L199.345 111.852",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M197.542 127.015L199.058 123.716C199.565 122.613 200.447 122.589 201.015 123.664L204.394 130.046",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M293.369 250.453L252.263 172.733C249.936 168.331 243.957 164.731 238.982 164.731H173.769C171.516 164.731 169.306 164.14 167.358 163.014L162.876 160.423C160.929 159.297 158.718 158.706 156.466 158.706H147.896L141.237 164.534L189.659 256C190.612 257.493 192.452 258.417 194.939 258.417L287.456 258.445L291.473 260.904L293.904 255.733H293.895C294.556 254.315 294.449 252.471 293.379 250.448L293.369 250.453Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),t("path",{d:"M249.832 177.908C247.505 173.506 241.526 169.907 236.551 169.907L142.025 169.878C139.355 169.878 137.436 168.813 136.549 167.128L186.313 261.185C187.266 262.677 189.105 263.602 191.592 263.602L286.118 263.63C291.098 263.63 293.266 260.03 290.938 255.633L249.832 177.913V177.908Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M255.328 198.77L245.041 179.313C243.581 176.548 240.235 174.042 237.161 174.042L143.555 173.93",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M188.64 259.548L282.448 259.558C285.569 259.558 286.418 257.577 285.198 255.264L276.103 238.064",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M150.238 159.776C150.965 161.151 149.539 163.338 147.051 164.652C144.564 165.966 141.96 165.919 141.227 164.539C140.495 163.159 141.927 160.977 144.414 159.663C145.62 159.025 146.854 158.71 147.891 158.71C148.99 158.71 149.863 159.067 150.238 159.776Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M147.826 161.052C148.164 161.69 147.502 162.704 146.348 163.314C145.193 163.924 143.983 163.9 143.645 163.262C143.307 162.624 143.969 161.61 145.123 161C145.681 160.705 146.254 160.559 146.737 160.559C147.249 160.559 147.652 160.723 147.826 161.057V161.052Z",fill:"black"}),t("path",{d:"M171.652 85.828L136.755 161.652C135.788 163.75 135.784 165.669 136.549 167.124C136.549 167.124 137.717 169.874 142.025 169.874C146.333 169.874 151.754 169.907 151.754 169.907L153.115 167.5L143.419 167.467C139.669 167.467 137.637 165.186 139.205 161.779L174.163 85.8233C175.223 83.5238 176.678 82.3646 178.156 82.3646C178.156 82.3646 173.431 81.961 171.652 85.8233V85.828Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),t("path",{d:"M274.968 235.918C272.495 231.239 272.777 228.33 278.296 226.565C281.262 225.617 283.951 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.049 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495L255.399 206.127L271.073 235.923H274.973L274.968 235.918Z",fill:"#EBE9E9"}),t("path",{d:"M274.968 235.918C272.495 231.239 272.776 228.33 278.295 226.565C281.261 225.617 283.95 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.048 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),t("path",{d:"M289.926 200.125C287.265 199.276 284.074 201.829 282.793 205.832C281.512 209.835 282.629 213.768 285.29 214.617L286.533 215.016L291.17 200.524L289.926 200.125Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M293.683 209.321C294.963 205.319 293.846 201.386 291.187 200.535C288.528 199.685 285.335 202.239 284.055 206.241C282.775 210.242 283.892 214.176 286.551 215.026C289.21 215.877 292.403 213.322 293.683 209.321Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M213.26 224.182C211.237 224.182 208.816 222.722 207.868 220.934L189.021 185.301C188.077 183.513 188.955 182.053 190.978 182.053L231.3 182.039C233.322 182.039 235.744 183.499 236.692 185.287L255.539 220.92C256.482 222.708 255.604 224.168 253.582 224.168L213.26 224.182Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M214.334 222.319C212.312 222.319 209.89 220.859 208.942 219.071L190.095 183.438C189.884 183.034 189.767 182.649 189.729 182.292C188.64 182.776 188.302 183.944 189.02 185.301L207.867 220.934C208.811 222.722 211.237 224.182 213.26 224.182L253.582 224.168C255.144 224.168 256.022 223.29 255.9 222.065C255.557 222.22 255.14 222.305 254.652 222.305L214.33 222.319H214.334Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M231.586 203.083L233.646 206.978H228.756H223.871H218.981H215.513C214.733 206.978 214.363 207.489 214.691 208.109L215.555 209.737C215.883 210.361 216.794 210.873 217.577 210.873H221.046H225.936L227.395 213.632C227.724 214.256 228.634 214.763 229.418 214.763H231.464C232.243 214.763 232.614 214.252 232.285 213.628L230.826 210.868H235.716H239.184C239.963 210.868 240.334 210.352 240.005 209.732L238.546 206.973L237.086 204.214C236.758 203.589 235.847 203.083 235.063 203.083H231.595H231.586Z",fill:"#F191FA"}),t("path",{d:"M214.855 199.191L216.315 201.951C216.648 202.575 217.554 203.086 218.342 203.086H221.81H226.696H231.586L230.126 200.322C229.793 199.698 228.887 199.187 228.099 199.187H224.631H219.746H214.855V199.191Z",fill:"#F191FA"}),t("path",{d:"M214.986 187.501C214.207 187.501 213.837 188.013 214.165 188.632L215.625 191.392H210.735H207.266C206.487 191.392 206.117 191.903 206.445 192.527L207.905 195.287L209.364 198.046C209.693 198.671 210.603 199.177 211.387 199.177H214.855L212.795 195.282H217.685H222.57H227.46H230.928C231.707 195.282 232.078 194.771 231.75 194.147L230.891 192.523C230.558 191.899 229.652 191.387 228.868 191.387H225.4H220.51L219.051 188.628C218.722 188.003 217.812 187.497 217.028 187.497H214.982L214.986 187.501Z",fill:"#F191FA"}),t("path",{d:"M214.098 243.795L212.428 240.641C211.78 239.412 210.109 238.412 208.725 238.412H202.849L200.428 233.832C199.78 232.602 198.114 231.603 196.725 231.603H191.751C191 231.603 190.483 231.898 190.263 232.363L189.066 234.906L191.464 235.826L192.835 238.417H186.959C186.208 238.417 185.692 238.712 185.471 239.177L184.275 241.721L186.612 242.528L187.288 243.804C187.935 245.034 189.606 246.033 190.99 246.033H196.866L199.287 250.614C199.935 251.843 201.601 252.843 202.99 252.843H205.032L208.256 254.631L209.452 252.087C209.635 251.693 209.607 251.177 209.307 250.614L206.885 246.033H210.194L213.057 247.817L214.253 245.273C214.441 244.879 214.408 244.363 214.108 243.8L214.098 243.795Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.529 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.529 234.146H190.554C189.165 234.146 188.564 235.151 189.212 236.38L191.634 240.961H185.758C184.369 240.961 183.763 241.97 184.416 243.195L186.086 246.348C186.734 247.578 188.405 248.577 189.789 248.577H195.665L198.086 253.158C198.734 254.387 200.4 255.387 201.789 255.387H206.764C208.153 255.387 208.753 254.383 208.106 253.153L205.684 248.573H211.56C212.949 248.573 213.554 247.564 212.902 246.339Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.528 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.528 234.146H190.554",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),t("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),t("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),t("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),t("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),t("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),t("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),t("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}const Ge=async({checkout:e,provider:t,allowTokenListType:n,chainId:r,allowZero:a=!1,retryPolicy:i=J})=>{const o=r||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),l=await te((()=>e.getAllBalances({provider:t,walletAddress:s,chainId:o})),{...i});if(void 0===l)return;const c=await e.getTokenAllowList({chainId:o,type:n}),d=new Map;c.tokens.forEach((e=>d.set(e.address?.toLowerCase()||K,!0)));const p=l.balances.filter((e=>!(e.balance.lte(0)&&!a)&&d.get(e.token.address?.toLowerCase()||K))).map((t=>({...t,token:{...t.token,icon:U(e.config.environment,Y(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return c.tokens=c.tokens.map((t=>({...t,icon:U(e.config.environment,Y(t.address)?t.symbol:t.address??"")}))),{allowList:c,allowedBalances:p}};export{ye as A,_e as F,Oe as N,He as S,Se as T,qe as W,Xe as a,Ge as g};
1
+ import{ca as e,j as t,aI as n,_ as r,u as a,r as i,cb as o,cc as s,m as l,n as c,cd as d,B as p,S as h,ce as u,a as b,aN as g,C as m,k as f,cf as L,f as k,cg as x,i as C,aP as w,l as v,b8 as y,z as O,bW as I,y as j,aa as M,bX as E,bd as H,H as S,o as A,d as D,a2 as P,a7 as B,M as F,ch as T,ci as Z,b7 as z,cj as W,ck as N,aD as _,A as $,v as R,bI as V,cl as Q,ab as X,ac as q,ad as G,bh as K,X as U,G as Y,R as J}from"./index-48317d33.js";import{T as ee,r as te}from"./retry-f9fd4fab.js";function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ae=function(e){return{brad:"base.borderRadius.x4",overflow:"hidden",transitionProperty:"background-color",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","&.emphasized":{bgc:"base.color.translucent.emphasis.100"},"&.expanded":{bgc:"base.color.translucent.emphasis.100"},"&.emphasized.expanded":{bgc:"base.color.translucent.emphasis.200"},"&:hover":{bgc:"base.color.translucent.emphasis.200"},"&.emphasized:hover":{bgc:"base.color.translucent.emphasis.300"},"&:hover .ButtCon":re({},L("small",e,!1)["&:hover:not([disabled])"])}},ie=re(re({},e),{},{alignItems:"flex-start",justifyContent:"space-between",gap:"base.spacing.x4",position:"relative",px:"base.spacing.x3",py:"base.spacing.x4",minh:"base.spacing.x16"}),oe={position:"absolute",top:"base.spacing.x4"},se={overflow:"visible",bg:"transparent",maxh:"unset",boxShadow:"unset",brad:"unset",p:"0"},le={mb:"base.spacing.x10",px:"base.spacing.x3","& .Divider:first-of-type":{mb:"base.spacing.x4"}},ce=["children","className","sx","chevronSide"];function de(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?de(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e){var n=e.children,a=e.className,o=e.sx,s=void 0===o?{}:o,c=e.chevronSide,d=void 0===c?"left":c,p=r(e,ce),u=i.useMemo((function(){return k(n)}),[n]);return t(g,pe(pe({},p),{},{className:"".concat(null!=a?a:""," AccordionExpandedContent"),sx:l(le,pe({},x("left"===d?"pl":"pr",s,"base.spacing.x15")),s),children:i.Children.map(u,(function(e){return i.isValidElement(e)&&C(e,w)?t(h,{size:"xSmall",children:e}):e}))}))}he.displayName="Accordion.ExpandedContent";var ue=["children","direction","gap","rc"],be=["sx","alignItems","className"],ge=["alignItems","className","sx"];function me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Le(e){var n=e.children,a=e.direction,i=void 0===a?"column":a,o=e.gap,s=void 0===o?"0px":o,l=e.rc,c=void 0===l?t("span",{}):l,d=r(e,ue);return t(g,fe(fe({},d),{},{direction:i,gap:s,rc:c,children:n}))}function ke(e){var n=e.sx,a=void 0===n?{}:n,i=e.alignItems,o=void 0===i?"flex-start":i,s=e.className,c=r(e,be);return t(Le,fe(fe({},c),{},{alignItems:o,sx:l({flex:1,textAlign:"left"},a),className:"".concat(null!=s?s:""," AccordionTargetLeftSlot")}))}function xe(e){var n=e.alignItems,a=void 0===n?"flex-end":n,i=e.className,o=e.sx,s=void 0===o?{}:o,c=r(e,ge);return t(Le,fe(fe({},c),{},{alignItems:a,sx:l({textAlign:"right"},s),className:"".concat(null!=i?i:""," AccordionTargetRightSlot")}))}ke.displayName="Accordion.TargetLeftSlot",xe.displayName="Accordion.TargetRightSlot";var Ce=["emphasized","expanded","defaultExpanded","children","gap","alignItems","className","onExpandChange","chevronSide","sx","rc","targetClickOveride","testId"];function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ye(e){var f=ve(ve({},e),{},"expanded"in e?{defaultExpanded:void 0}:{expanded:void 0}),L=f.emphasized,k=f.expanded,x=f.defaultExpanded,C=f.children,w=f.gap,v=void 0===w?"0":w,y=f.alignItems,O=void 0===y?"stretch":y,I=f.className,j=f.onExpandChange,M=f.chevronSide,E=void 0===M?"left":M,H=f.sx,S=void 0===H?{}:H,A=f.rc,D=void 0===A?t(n.div,{}):A,P=f.targetClickOveride,B=f.testId,F=void 0===B?"Accordion":B,T=r(f,Ce),Z=a(),z=Z.base,W=i.useState(x),N=o(W,2),_=N[0],$=N[1],R=null!=k?k:_,V=s(C,ke),Q=s(C,xe),X=s(C,he),q=i.useCallback((function(){void 0===k?$((function(e){return null==j||j(!e),!e})):null==j||j(!k)}),[k,j]),G=i.useMemo((function(){var e,t;return l(ae(Z),null!==(e=null===(t=Z.components)||void 0===t||null===(t=t.Accordion)||void 0===t?void 0:t.sxOverride)&&void 0!==e?e:{},S)}),[S,Z]);return t(m,{children:function(e){var r=e.cx;return c(g,ve(ve({},T),{},{className:"".concat(null!=I?I:""," Accordion ").concat(r({emphasized:L,expanded:R})),gap:v,alignItems:O,rc:D,sx:G,testId:F,children:[c(d,{sx:l(ie,ve({},"left"===E?{pl:"base.spacing.x15"}:{pr:"base.spacing.x15"})),onClick:P||q,testId:"".concat(F,"__clickableArea"),children:[t(p,{rc:t("span",{}),icon:R?"ChevronCollapse":"ChevronExpand",variant:"tertiary",size:"small",testId:"".concat(F,"__clickableArea__chevron"),sx:l(oe,ve({},"left"===E?{left:"base.spacing.x3"}:{right:"base.spacing.x3"})),className:"Accordion__ButtCon"}),t(h,{testId:"".concat(F,"__clickableArea__targetLeft"),children:V}),Q&&t(h,{testId:"".concat(F,"__clickableArea__targetRight"),children:Q})]}),t(u,{children:Boolean(X)&&R?t(b,{sx:se,rc:t(n.div,{initial:{opacity:0,height:0,overflow:"hidden",y:-16},animate:{height:"auto",opacity:1,y:0,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden",y:-16},transition:{duration:z.motion.normal.fast.jsDuration,ease:z.motion.normal.fast.jsEase}}),children:t(h,{chevronSide:E,testId:"".concat(F,"__expandedContent"),children:X})}):null})]}))}})}function Oe({visible:e,targetChainId:n,provider:r,checkout:a,onCloseDrawer:o,onNetworkSwitch:s}){const{t:l}=v(),d=y(a.config.environment??O.PRODUCTION,"/switchnetworkethereum.svg"),h=y(a.config.environment??O.PRODUCTION,"/switchnetworkzkevm.svg"),u=I(n),g=n===j(a.config),m=i.useCallback((async()=>{if(!a)return;const e=await a.switchNetwork({provider:r,chainId:n});s&&s(e.provider)}),[a,r,s,n]),f=M(r),L=i.useMemo((()=>f?r.provider?.session?.peer?.metadata?.name:""),[r,f]),k=i.useMemo((()=>L?.toLowerCase().includes("metamask")),[L]),x=i.useMemo((()=>E(r)?"MetaMask wallet":f&&L?L:"wallet"),[r,f,L]),C=f&&k;return i.useEffect((()=>{(new Image).src=d;(new Image).src=h}),[]),t(B,{size:"threeQuarter",visible:e,onCloseDrawer:o,showHeaderBar:!1,children:c(B.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[t(H,{use:t("img",{src:g?d:h,alt:l("drawers.networkSwitch.heading",{wallet:x})})}),t(p,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:o}),c(b,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[t(S,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.heading",{wallet:x})}),C&&t(A,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.manualSwitch.body",{chain:u})}),!C&&t(A,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.controlledSwitch.body",{chain:u})})]}),c(b,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!C&&t(D,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:m,children:l("drawers.networkSwitch.switchButton",{chain:u})}),t(P,{})]})]})})}function Ie({onClick:e,icon:n,name:r,symbol:a,balance:i,defaultTokenImage:o,testId:s,id:l}){const{t:d}=v();return c(F,{testId:`${s}-coin-selector__option-${l}`,emphasized:!0,size:"small",onClick:e,children:[t(F.FramedImage,{circularFrame:!0,use:t(ee,{src:n,name:r,defaultImage:o})}),t(F.Label,{children:r}),t(F.Caption,{children:a}),i&&t(F.PriceDisplay,{fiatAmount:`${d("drawers.coinSelector.option.fiatPricePrefix")}${i.formattedFiatAmount}`,price:i.formattedAmount})]})}ye.displayName="Accordion",ye.TargetLeftSlot=ke,ye.TargetRightSlot=xe,ye.ExpandedContent=he;const je={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},Me={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function Ee({heading:e,options:n,defaultTokenImage:r,optionsLoading:a,children:i,onCloseDrawer:o,visible:s}){const{t:l}=v();return c(B,{headerBarTitle:e,size:"full",onCloseDrawer:o,visible:s,children:[t(B.Target,{children:i}),t(B.Content,{children:c(b,{sx:je,children:[a&&0===n.length&&c(b,{sx:Me,children:[t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!a&&0===n.length&&t(A,{sx:{padding:"base.spacing.x4"},children:l("drawers.coinSelector.noCoins")}),!a&&n.map((({onClick:e,icon:n,name:a,symbol:i,balance:o,id:s,testId:l})=>t(Ie,{id:s,testId:l,onClick:e,icon:n,name:a,symbol:i,balance:o,defaultTokenImage:r},`${i}-${a}`)))]})})]})}function He({testId:e,options:n,optionsLoading:r,subtext:a,onSelectChange:o,textAlign:s,errorMessage:l,disabled:d,selectedOption:p,coinSelectorHeading:h,defaultTokenImage:u,environment:g=O.PRODUCTION,theme:m=z.DARK}){const[f,L]=i.useState(!1),k=i.useMemo((()=>n.map((t=>({...t,testId:e,onClick:()=>{o(t.id),L(!1)}})))),[n,o,L]),x=n?.find((e=>e.id===p))??p;return c(b,{children:[t(Ee,{heading:h,options:k,defaultTokenImage:u,optionsLoading:r??!1,visible:f,onCloseDrawer:()=>L(!1)}),t(Z,{testId:`${e}-select-control`,textAlign:s??"left",subtext:l?void 0:a,isErrored:!!l,errorMessage:l,children:t(T,{testId:`${e}-select`,size:"large",defaultLabel:"Select token",targetClickOveride:()=>L(!0),selectedOption:(()=>{if(p&&0!==n.length&&n.find((e=>e.id===p)))return p})(),sx:{minw:"170px"},children:x&&c(T.Option,{optionKey:x.id,testId:x.testId,disabled:d,children:[!x.icon&&t(T.Option.Icon,{icon:"Coins",variant:"bold"}),x.icon&&t(T.Option.FramedImage,{use:t(ee,{environment:g,theme:m,src:x.icon,name:x.name}),circularFrame:!0,sx:{background:"base.color.translucent.standard.100"}}),t(T.Option.Label,{children:x.symbol})]},x.id)})})]})}function Se({testId:e,value:n,placeholder:r,errorMessage:a,validator:i,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:l,onTextInputEnter:c,textAlign:d,type:p,subtext:h,maxButtonClick:u,disabled:b,inputMode:g}){return t(Z,{testId:`${e}-text-control`,textAlign:d??"left",subtext:a?void 0:h,isErrored:!!a,errorMessage:a,sx:{width:"100%"},children:t(W,{testId:`${e}-text`,onChange:e=>((e,t)=>{let n=e.target.value;"number"===p&&"."===n&&(n="0."),i(n)?o(n):o(t??"")})(e,n),sizeVariant:"large",value:n,inputMode:g,validationStatus:a?"error":"success",placeholder:r,onBlur:e=>{if(!s)return;const t=e.target.value;i(t)&&s(t)},onFocus:e=>{if(!l)return;const t=e.target.value;i(t)&&l(t)},onKeyDown:e=>{c&&"Enter"===e.key&&c()},disabled:b,hideClearValueButton:!0,sx:{minWidth:"100%"},children:u&&t(W.Button,{testId:`${e}-max-button`,onClick:u,disabled:b,children:"max"})})})}const Ae={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},De={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},Pe={display:"flex",width:"100%"},Be=e=>({width:"65%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),Fe={width:"35%"},Te={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function Ze({boldLabel:e,label:n,amount:r,fiatAmount:a,tokenSymbol:i,prefix:o=""}){const s=n.toLowerCase().replace(" ","-");return c(b,{sx:Pe,testId:`fee-item-${s}`,children:[t(A,{sx:Be(e),children:n}),t(N,{testId:s,sx:Fe,price:`${o}${i} ${r}`,fiatAmount:a})]})}function ze({fees:e,children:n,visible:r,onCloseDrawer:a,totalFiatAmount:i,totalAmount:o,tokenSymbol:s,loading:l=!1}){const{t:d}=v();return c(B,{headerBarTitle:d("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:a,visible:r,children:[t(B.Target,{children:n}),c(B.Content,{testId:"fees-breakdown-content",sx:Ae,children:[c(b,{sx:De,children:[l&&c(b,{sx:Te,children:[t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),t(F,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!l&&e.map((({label:e,amount:n,fiatAmount:r,prefix:a,token:i})=>t(Ze,{label:e,amount:n,fiatAmount:r,tokenSymbol:i.symbol??s,prefix:a},e))),o&&c(_,{children:[t(w,{size:"xSmall"}),t(Ze,{label:d("drawers.feesBreakdown.total"),amount:$(o),fiatAmount:i?`≈ ${d("drawers.feesBreakdown.fees.fiatPricePrefix")}${i}`:R("0"),tokenSymbol:s,boldLabel:!0},d("drawers.feesBreakdown.total"))]})]}),t(P,{})]})]})}const We={backgroundColor:"base.color.translucent.emphasis.100"},Ne={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function _e({gasFeeValue:e,gasFeeToken:n,gasFeeFiatValue:r,fees:a,onFeesClick:o,loading:s,sx:l}){const[d,p]=i.useState(!1),{t:h}=v();if(!e&&!s)return null;const u=R($(e)),g=n?.symbol;return c(_,{children:[c(ye,{targetClickOveride:()=>{p(!0),o?.()},sx:{...We,paddingBottom:"base.spacing.x2",...l},children:[t(ye.TargetLeftSlot,{children:t(A,{size:"medium",sx:Ne,children:h("drawers.feesBreakdown.heading")})}),c(ye.TargetRightSlot,{children:[s&&t(b,{sx:{width:"218px",position:"relative"},children:t(b,{sx:{display:"block",position:"absolute",top:"-15px",width:"100%",height:"68px",WebkitMaskPosition:"right center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",WebkitMaskImage:'url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="196" height="96"><path d="M182.85 55.2Q181.65 54 180 54h-56q-1.7 0-2.85 1.2Q120 56.35 120 58v4q0 1.7 1.15 2.85Q122.3 66 124 66h56q1.65 0 2.85-1.15Q184 63.7 184 62v-4q0-1.65-1.15-2.8m0-22Q181.65 32 180 32H68q-1.7 0-2.85 1.2Q64 34.35 64 36v8q0 1.7 1.15 2.85Q66.3 48 68 48h112q1.65 0 2.85-1.15Q184 45.7 184 44v-8q0-1.65-1.15-2.8Z" id="a"/></svg>\')'},rc:t("span",{}),children:t(V,{rc:t("span",{})})})}),!s&&t(N,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`≈ ${h("drawers.feesBreakdown.fees.fiatPricePrefix")}${r}`,price:`~ ${g} ${R($(u))}`})]})]}),t(ze,{tokenSymbol:g??"",fees:a,visible:d,loading:s,onCloseDrawer:()=>p(!1)})]})}const $e={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},Re={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},Ve={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},Qe={width:"100%",height:"64px"};function Xe({onCloseDrawer:e,visible:n,showHeaderBar:r,onRetry:a}){const{t:i}=v();return t(B,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:n,showHeaderBar:r,children:t(B.Content,{children:c(b,{sx:$e,children:[t(Q,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),c(S,{size:"small",sx:Re,testId:"transaction-rejected-heading",children:[i("drawers.transactionFailed.content.heading1"),t("br",{}),i("drawers.transactionFailed.content.heading2")]}),c(A,{sx:Re,children:[i("drawers.transactionFailed.content.body1"),t("br",{}),i("drawers.transactionFailed.content.body2")]}),c(b,{sx:Ve,children:[t(D,{sx:Qe,variant:"tertiary",onClick:a,children:i("drawers.transactionFailed.buttons.retry")}),t(D,{sx:Qe,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:i("drawers.transactionFailed.buttons.cancel")})]})]})})})}function qe(){return t(b,{testId:"wallet-approve-hero",sx:{...X,background:"base.color.translucent.emphasis.100"},children:t(b,{sx:{...q,...G},children:c("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M227.517 171.325L182.178 85.6034C181.033 83.4446 179.583 82.3652 178.156 82.3652C175.711 82.3652 174.322 84.1157 172.863 86.6218L137.285 164.056L183.689 253.776L227.522 171.32L227.517 171.325Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M226.841 137.597C228.497 133.997 228.338 128.188 226.484 124.682L197.866 70.5767C196.012 67.0757 193.14 67.1508 191.484 70.7503L164.936 128.427L168.399 134.936L165.396 141.464L168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992L165.846 154.52L169.3 161.048L166.287 167.562L187.922 208.465C189.776 211.966 192.648 211.891 194.304 208.292L226.845 137.597H226.841Z",fill:"#F191FA"}),t("path",{d:"M168.85 147.992L165.396 141.464L168.399 134.936L164.936 128.427L191.484 70.7503C193.14 67.1508 196.012 67.0757 197.866 70.5767L226.484 124.682C228.338 128.188 228.497 133.997 226.841 137.597H226.845L194.304 208.292C192.648 211.891 189.776 211.966 187.922 208.465L166.287 167.562L169.3 161.048L165.846 154.52L168.85 147.992ZM168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992Z",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),t("path",{d:"M203.136 132.773C202.484 134.19 201.353 134.223 200.621 132.843L196.101 124.297C195.369 122.917 195.308 120.627 195.961 119.21L200.621 109.082C201.273 107.665 202.404 107.632 203.136 109.012L207.656 117.558C208.388 118.938 208.449 121.228 207.796 122.645L203.136 132.773Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M206.22 114.837L204.68 118.183C204.174 119.286 203.291 119.309 202.724 118.234L199.345 111.852",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M197.542 127.015L199.058 123.716C199.565 122.613 200.447 122.589 201.015 123.664L204.394 130.046",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M293.369 250.453L252.263 172.733C249.936 168.331 243.957 164.731 238.982 164.731H173.769C171.516 164.731 169.306 164.14 167.358 163.014L162.876 160.423C160.929 159.297 158.718 158.706 156.466 158.706H147.896L141.237 164.534L189.659 256C190.612 257.493 192.452 258.417 194.939 258.417L287.456 258.445L291.473 260.904L293.904 255.733H293.895C294.556 254.315 294.449 252.471 293.379 250.448L293.369 250.453Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),t("path",{d:"M249.832 177.908C247.505 173.506 241.526 169.907 236.551 169.907L142.025 169.878C139.355 169.878 137.436 168.813 136.549 167.128L186.313 261.185C187.266 262.677 189.105 263.602 191.592 263.602L286.118 263.63C291.098 263.63 293.266 260.03 290.938 255.633L249.832 177.913V177.908Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M255.328 198.77L245.041 179.313C243.581 176.548 240.235 174.042 237.161 174.042L143.555 173.93",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M188.64 259.548L282.448 259.558C285.569 259.558 286.418 257.577 285.198 255.264L276.103 238.064",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M150.238 159.776C150.965 161.151 149.539 163.338 147.051 164.652C144.564 165.966 141.96 165.919 141.227 164.539C140.495 163.159 141.927 160.977 144.414 159.663C145.62 159.025 146.854 158.71 147.891 158.71C148.99 158.71 149.863 159.067 150.238 159.776Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M147.826 161.052C148.164 161.69 147.502 162.704 146.348 163.314C145.193 163.924 143.983 163.9 143.645 163.262C143.307 162.624 143.969 161.61 145.123 161C145.681 160.705 146.254 160.559 146.737 160.559C147.249 160.559 147.652 160.723 147.826 161.057V161.052Z",fill:"black"}),t("path",{d:"M171.652 85.828L136.755 161.652C135.788 163.75 135.784 165.669 136.549 167.124C136.549 167.124 137.717 169.874 142.025 169.874C146.333 169.874 151.754 169.907 151.754 169.907L153.115 167.5L143.419 167.467C139.669 167.467 137.637 165.186 139.205 161.779L174.163 85.8233C175.223 83.5238 176.678 82.3646 178.156 82.3646C178.156 82.3646 173.431 81.961 171.652 85.8233V85.828Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),t("path",{d:"M274.968 235.918C272.495 231.239 272.777 228.33 278.296 226.565C281.262 225.617 283.951 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.049 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495L255.399 206.127L271.073 235.923H274.973L274.968 235.918Z",fill:"#EBE9E9"}),t("path",{d:"M274.968 235.918C272.495 231.239 272.776 228.33 278.295 226.565C281.261 225.617 283.95 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.048 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),t("path",{d:"M289.926 200.125C287.265 199.276 284.074 201.829 282.793 205.832C281.512 209.835 282.629 213.768 285.29 214.617L286.533 215.016L291.17 200.524L289.926 200.125Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M293.683 209.321C294.963 205.319 293.846 201.386 291.187 200.535C288.528 199.685 285.335 202.239 284.055 206.241C282.775 210.242 283.892 214.176 286.551 215.026C289.21 215.877 292.403 213.322 293.683 209.321Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M213.26 224.182C211.237 224.182 208.816 222.722 207.868 220.934L189.021 185.301C188.077 183.513 188.955 182.053 190.978 182.053L231.3 182.039C233.322 182.039 235.744 183.499 236.692 185.287L255.539 220.92C256.482 222.708 255.604 224.168 253.582 224.168L213.26 224.182Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M214.334 222.319C212.312 222.319 209.89 220.859 208.942 219.071L190.095 183.438C189.884 183.034 189.767 182.649 189.729 182.292C188.64 182.776 188.302 183.944 189.02 185.301L207.867 220.934C208.811 222.722 211.237 224.182 213.26 224.182L253.582 224.168C255.144 224.168 256.022 223.29 255.9 222.065C255.557 222.22 255.14 222.305 254.652 222.305L214.33 222.319H214.334Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M231.586 203.083L233.646 206.978H228.756H223.871H218.981H215.513C214.733 206.978 214.363 207.489 214.691 208.109L215.555 209.737C215.883 210.361 216.794 210.873 217.577 210.873H221.046H225.936L227.395 213.632C227.724 214.256 228.634 214.763 229.418 214.763H231.464C232.243 214.763 232.614 214.252 232.285 213.628L230.826 210.868H235.716H239.184C239.963 210.868 240.334 210.352 240.005 209.732L238.546 206.973L237.086 204.214C236.758 203.589 235.847 203.083 235.063 203.083H231.595H231.586Z",fill:"#F191FA"}),t("path",{d:"M214.855 199.191L216.315 201.951C216.648 202.575 217.554 203.086 218.342 203.086H221.81H226.696H231.586L230.126 200.322C229.793 199.698 228.887 199.187 228.099 199.187H224.631H219.746H214.855V199.191Z",fill:"#F191FA"}),t("path",{d:"M214.986 187.501C214.207 187.501 213.837 188.013 214.165 188.632L215.625 191.392H210.735H207.266C206.487 191.392 206.117 191.903 206.445 192.527L207.905 195.287L209.364 198.046C209.693 198.671 210.603 199.177 211.387 199.177H214.855L212.795 195.282H217.685H222.57H227.46H230.928C231.707 195.282 232.078 194.771 231.75 194.147L230.891 192.523C230.558 191.899 229.652 191.387 228.868 191.387H225.4H220.51L219.051 188.628C218.722 188.003 217.812 187.497 217.028 187.497H214.982L214.986 187.501Z",fill:"#F191FA"}),t("path",{d:"M214.098 243.795L212.428 240.641C211.78 239.412 210.109 238.412 208.725 238.412H202.849L200.428 233.832C199.78 232.602 198.114 231.603 196.725 231.603H191.751C191 231.603 190.483 231.898 190.263 232.363L189.066 234.906L191.464 235.826L192.835 238.417H186.959C186.208 238.417 185.692 238.712 185.471 239.177L184.275 241.721L186.612 242.528L187.288 243.804C187.935 245.034 189.606 246.033 190.99 246.033H196.866L199.287 250.614C199.935 251.843 201.601 252.843 202.99 252.843H205.032L208.256 254.631L209.452 252.087C209.635 251.693 209.607 251.177 209.307 250.614L206.885 246.033H210.194L213.057 247.817L214.253 245.273C214.441 244.879 214.408 244.363 214.108 243.8L214.098 243.795Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.529 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.529 234.146H190.554C189.165 234.146 188.564 235.151 189.212 236.38L191.634 240.961H185.758C184.369 240.961 183.763 241.97 184.416 243.195L186.086 246.348C186.734 247.578 188.405 248.577 189.789 248.577H195.665L198.086 253.158C198.734 254.387 200.4 255.387 201.789 255.387H206.764C208.153 255.387 208.753 254.383 208.106 253.153L205.684 248.573H211.56C212.949 248.573 213.554 247.564 212.902 246.339Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.528 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.528 234.146H190.554",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),t("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),t("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),t("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),t("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),t("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),t("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),t("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}const Ge=async({checkout:e,provider:t,allowTokenListType:n,chainId:r,allowZero:a=!1,retryPolicy:i=J})=>{const o=r||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),l=await te((()=>e.getAllBalances({provider:t,walletAddress:s,chainId:o})),{...i});if(void 0===l)return;const c=await e.getTokenAllowList({chainId:o,type:n}),d=new Map;c.tokens.forEach((e=>d.set(e.address?.toLowerCase()||K,!0)));const p=l.balances.filter((e=>!(e.balance.lte(0)&&!a)&&d.get(e.token.address?.toLowerCase()||K))).map((t=>({...t,token:{...t.token,icon:U(e.config.environment,Y(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return c.tokens=c.tokens.map((t=>({...t,icon:U(e.config.environment,Y(t.address)?t.symbol:t.address??"")}))),{allowList:c,allowedBalances:p}};export{ye as A,_e as F,Oe as N,He as S,Se as T,qe as W,Xe as a,Ge as g};
@@ -1,4 +1,4 @@
1
- import{ct as t,cu as e,cv as r,cw as o,cx as n,cy as i,cz as a,cA as l,cB as s}from"./index-33d10388.js";
1
+ import{ct as t,cu as e,cv as r,cw as o,cx as n,cy as i,cz as a,cA as l,cB as s}from"./index-48317d33.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
@@ -1 +1 @@
1
- import{cE as e,cF as t,cP as r,cH as n,cG as a}from"./index-33d10388.js";function c(c,i,s){var o;return e(this,void 0,void 0,(function(){var l,u,d,f,m=this;return t(this,(function(v){switch(v.label){case 0:return r()?[2,[]]:(l=n(),u=null!==(o=i.enabledMiddleware)&&void 0!==o?o:{},d=Object.entries(u).filter((function(e){return e[0],e[1]})).map((function(e){return e[0]})),f=d.map((function(r){return e(m,void 0,void 0,(function(){var e,n,i,o;return t(this,(function(t){switch(t.label){case 0:e=r.replace("@segment/",""),n=e,s&&(n=btoa(e).replace(/=/g,"")),i="".concat(l,"/middleware/").concat(n,"/latest/").concat(n,".js.gz"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,a(i)];case 2:return t.sent(),[2,window["".concat(e,"Middleware")]];case 3:return o=t.sent(),c.log("error",o),c.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}}))}))})),[4,Promise.all(f)]);case 1:return[2,v.sent().filter(Boolean)]}}))}))}export{c as remoteMiddlewares};
1
+ import{cE as e,cF as t,cP as r,cH as n,cG as a}from"./index-48317d33.js";function c(c,i,s){var o;return e(this,void 0,void 0,(function(){var l,u,d,f,m=this;return t(this,(function(v){switch(v.label){case 0:return r()?[2,[]]:(l=n(),u=null!==(o=i.enabledMiddleware)&&void 0!==o?o:{},d=Object.entries(u).filter((function(e){return e[0],e[1]})).map((function(e){return e[0]})),f=d.map((function(r){return e(m,void 0,void 0,(function(){var e,n,i,o;return t(this,(function(t){switch(t.label){case 0:e=r.replace("@segment/",""),n=e,s&&(n=btoa(e).replace(/=/g,"")),i="".concat(l,"/middleware/").concat(n,"/latest/").concat(n,".js.gz"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,a(i)];case 2:return t.sent(),[2,window["".concat(e,"Middleware")]];case 3:return o=t.sent(),c.log("error",o),c.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}}))}))})),[4,Promise.all(f)]);case 1:return[2,v.sent().filter(Boolean)]}}))}))}export{c as remoteMiddlewares};