@vechain/vechain-kit 2.4.2 → 3.0.0-rc.1
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.
- package/dist/AccountModal-CK-qcPlQ.js +1 -0
- package/dist/AccountModal-ChuVFqPc.js +20 -0
- package/dist/AccountModal-ChuVFqPc.js.map +1 -0
- package/dist/AccountModal-DNK0IbiE.cjs +1 -0
- package/dist/AccountModal-DjAS4w6z.cjs +20 -0
- package/dist/AccountModal-DjAS4w6z.cjs.map +1 -0
- package/dist/BaseModal-CWAI9-Bi.js +2 -0
- package/dist/BaseModal-CWAI9-Bi.js.map +1 -0
- package/dist/BaseModal-yevRjczw.cjs +2 -0
- package/dist/BaseModal-yevRjczw.cjs.map +1 -0
- package/dist/ConnectModal-BXbiUwnz.js +1 -0
- package/dist/ConnectModal-C50EF9gE.js +2 -0
- package/dist/ConnectModal-C50EF9gE.js.map +1 -0
- package/dist/ConnectModal-CvkkVALe.cjs +1 -0
- package/dist/ConnectModal-DmIkWb1i.cjs +2 -0
- package/dist/ConnectModal-DmIkWb1i.cjs.map +1 -0
- package/dist/DisconnectConfirmContent-B4qahKqQ.cjs +2 -0
- package/dist/DisconnectConfirmContent-B4qahKqQ.cjs.map +1 -0
- package/dist/DisconnectConfirmContent-C9qLnI-m.js +2 -0
- package/dist/DisconnectConfirmContent-C9qLnI-m.js.map +1 -0
- package/dist/LegalDocumentsModal-5sNOrJI9.js +1 -0
- package/dist/LegalDocumentsModal-aWgfKwIL.js +2 -0
- package/dist/LegalDocumentsModal-aWgfKwIL.js.map +1 -0
- package/dist/LegalDocumentsModal-fnhM40y6.cjs +2 -0
- package/dist/LegalDocumentsModal-fnhM40y6.cjs.map +1 -0
- package/dist/LegalDocumentsModal-g54lP0U7.cjs +1 -0
- package/dist/PrivyCrossAppProvider-B6oIXeWL.js +2 -0
- package/dist/PrivyCrossAppProvider-B6oIXeWL.js.map +1 -0
- package/dist/PrivyCrossAppProvider-C6aL4Qor.cjs +1 -0
- package/dist/PrivyCrossAppProvider-Ccu2yH99.js +1 -0
- package/dist/PrivyCrossAppProvider-DSuzrbqs.cjs +2 -0
- package/dist/PrivyCrossAppProvider-DSuzrbqs.cjs.map +1 -0
- package/dist/PrivyWalletProvider-BkqWSj75.cjs +2 -0
- package/dist/PrivyWalletProvider-BkqWSj75.cjs.map +1 -0
- package/dist/PrivyWalletProvider-DToo_u0W.js +2 -0
- package/dist/PrivyWalletProvider-DToo_u0W.js.map +1 -0
- package/dist/ShareButtons-B92JZp47.js +2 -0
- package/dist/ShareButtons-B92JZp47.js.map +1 -0
- package/dist/ShareButtons-CRMNerbz.cjs +2 -0
- package/dist/ShareButtons-CRMNerbz.cjs.map +1 -0
- package/dist/UpgradeSmartAccountModal-BAzmVxeJ.js +2 -0
- package/dist/UpgradeSmartAccountModal-BAzmVxeJ.js.map +1 -0
- package/dist/UpgradeSmartAccountModal-BGjTzYAm.cjs +1 -0
- package/dist/UpgradeSmartAccountModal-CpZo27Uk.js +1 -0
- package/dist/UpgradeSmartAccountModal-IMcihO0d.cjs +2 -0
- package/dist/UpgradeSmartAccountModal-IMcihO0d.cjs.map +1 -0
- package/dist/VechainKitThemeProvider-BM5258oA.cjs +75 -0
- package/dist/VechainKitThemeProvider-BM5258oA.cjs.map +1 -0
- package/dist/VechainKitThemeProvider-Di9a04Es.js +75 -0
- package/dist/VechainKitThemeProvider-Di9a04Es.js.map +1 -0
- package/dist/assets/index.cjs +1 -1
- package/dist/assets/index.d.cts +1 -1
- package/dist/assets/{index.d.mts → index.d.ts} +1 -1
- package/dist/assets/index.js +1 -0
- package/dist/{assets-BL24r-Yp.mjs → assets-CXk1qRDd.js} +5 -5
- package/dist/assets-CXk1qRDd.js.map +1 -0
- package/dist/{assets-DNJsQD7_.cjs → assets-YPd7adzM.cjs} +7 -7
- package/dist/assets-YPd7adzM.cjs.map +1 -0
- package/dist/chunk-DjWAcSYV.cjs +1 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +6 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +1 -0
- package/dist/components-QKLypcU1.cjs +2 -0
- package/dist/components-QKLypcU1.cjs.map +1 -0
- package/dist/components-k36uDisW.js +2 -0
- package/dist/components-k36uDisW.js.map +1 -0
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.d.cts +6 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks-C8eXQYIN.cjs +8 -0
- package/dist/hooks-C8eXQYIN.cjs.map +1 -0
- package/dist/hooks-DuTew9oP.js +8 -0
- package/dist/hooks-DuTew9oP.js.map +1 -0
- package/dist/{index-CpRbZET6.d.mts → index-BGQS0a81.d.ts} +564 -1581
- package/dist/index-BGQS0a81.d.ts.map +1 -0
- package/dist/index-Bqw0Cz5n.d.cts +587 -0
- package/dist/index-Bqw0Cz5n.d.cts.map +1 -0
- package/dist/index-BugHmddr.d.ts +587 -0
- package/dist/index-BugHmddr.d.ts.map +1 -0
- package/dist/{index-D4rz985m.d.cts → index-C8wbz8af.d.cts} +561 -1578
- package/dist/index-C8wbz8af.d.cts.map +1 -0
- package/dist/{index-CWViOs1U.d.mts → index-COoeacay.d.ts} +5 -5
- package/dist/index-COoeacay.d.ts.map +1 -0
- package/dist/{index-u3CPquCV.d.cts → index-CmGg4iaS.d.cts} +4 -4
- package/dist/{index-CWViOs1U.d.mts.map → index-CmGg4iaS.d.cts.map} +1 -1
- package/dist/index-DI_IPiLX.d.ts +324 -0
- package/dist/index-DI_IPiLX.d.ts.map +1 -0
- package/dist/index-DVxlUr9t.d.cts +324 -0
- package/dist/index-DVxlUr9t.d.cts.map +1 -0
- package/dist/index.cjs +1 -221
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -0
- package/dist/network-Cs9YqDJ1.d.cts +536 -0
- package/dist/network-Cs9YqDJ1.d.cts.map +1 -0
- package/dist/network-yA5VWcPq.d.ts +536 -0
- package/dist/network-yA5VWcPq.d.ts.map +1 -0
- package/dist/providers/index.cjs +1 -0
- package/dist/providers/index.d.cts +3 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +1 -0
- package/dist/providers-DImdr6Kk.cjs +124 -0
- package/dist/providers-DImdr6Kk.cjs.map +1 -0
- package/dist/providers-kA0lotaM.js +124 -0
- package/dist/providers-kA0lotaM.js.map +1 -0
- package/dist/ssrUtils-C_5ZY26i.cjs +2 -0
- package/dist/ssrUtils-C_5ZY26i.cjs.map +1 -0
- package/dist/ssrUtils-DSwxhTtm.js +2 -0
- package/dist/ssrUtils-DSwxhTtm.js.map +1 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils-B2Eg9TD3.js +2 -0
- package/dist/utils-B2Eg9TD3.js.map +1 -0
- package/dist/utils-jW13BhAb.cjs +2 -0
- package/dist/utils-jW13BhAb.cjs.map +1 -0
- package/package.json +46 -9
- package/dist/assets/index.mjs +0 -1
- package/dist/assets-BL24r-Yp.mjs.map +0 -1
- package/dist/assets-DNJsQD7_.cjs.map +0 -1
- package/dist/index-CpRbZET6.d.mts.map +0 -1
- package/dist/index-D4rz985m.d.cts.map +0 -1
- package/dist/index-u3CPquCV.d.cts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -3
- package/dist/index.mjs +0 -221
- package/dist/index.mjs.map +0 -1
- package/dist/utils/index.d.mts +0 -3
- package/dist/utils/index.mjs +0 -1
- package/dist/utils-BQ9mZctf.cjs +0 -2
- package/dist/utils-BQ9mZctf.cjs.map +0 -1
- package/dist/utils-BxZj2QIg.mjs +0 -2
- package/dist/utils-BxZj2QIg.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./VechainKitThemeProvider-Di9a04Es.js";import"./utils-B2Eg9TD3.js";import"./assets-CXk1qRDd.js";import"./ssrUtils-DSwxhTtm.js";import"./PrivyWalletProvider-DToo_u0W.js";import"./PrivyCrossAppProvider-B6oIXeWL.js";import"./hooks-DuTew9oP.js";import{t as e}from"./DisconnectConfirmContent-C9qLnI-m.js";import{A as t,C as n,D as r,E as i,O as a,S as o,T as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,j as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E,v as D,w as O,x as k,y as A}from"./AccountModal-ChuVFqPc.js";import{c as j,l as M,o as N,s as P}from"./components-k36uDisW.js";import"./BaseModal-CWAI9-Bi.js";import"./ShareButtons-B92JZp47.js";export{T as AccountModal};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{a as e,r as t,u as n}from"./VechainKitThemeProvider-Di9a04Es.js";import{$ as r,C as i,D as a,G as o,Q as s,U as c,W as l,Z as u,ct as d,g as f,k as p,o as m,rt as h,st as g,v as _,x as v,y}from"./utils-B2Eg9TD3.js";import{C as b,K as x,c as S,i as ee,k as C,y as w}from"./assets-CXk1qRDd.js";import{d as te,t as T}from"./ssrUtils-DSwxhTtm.js";import{D as E,E as D,L as O,O as k,P as ne,R as re,S as ie,T as A,U as j,_ as ae,it as oe,j as se,k as ce,ot as le,tt as ue,v as de,y as fe}from"./PrivyWalletProvider-DToo_u0W.js";import{B as pe,Bt as me,Cn as he,D as ge,En as _e,Jn as ve,Kn as ye,Rt as be,S as xe,Vt as Se,Wn as Ce,Xn as we,Yt as Te,Zn as Ee,_ as M,_n as De,c as Oe,dr as ke,er as Ae,fn as je,gn as Me,h as Ne,hn as Pe,hr as Fe,in as Ie,l as Le,lr as Re,mn as ze,mr as Be,nn as Ve,nr as He,ot as Ue,pn as We,q as Ge,rn as Ke,rt as qe,tn as Je,ut as Ye,vn as Xe,zn as Ze,zt as Qe}from"./hooks-DuTew9oP.js";import{n as N,t as $e}from"./DisconnectConfirmContent-C9qLnI-m.js";import{n as P,t as et}from"./BaseModal-CWAI9-Bi.js";import{n as tt,t as nt}from"./ShareButtons-B92JZp47.js";import F,{useCallback as rt,useEffect as it,useMemo as I,useRef as at,useState as L}from"react";import{Accordion as ot,AccordionButton as st,AccordionItem as ct,AccordionPanel as lt,Alert as ut,AlertDescription as dt,AlertIcon as ft,AlertTitle as pt,Badge as mt,Box as R,Button as z,Card as ht,CardBody as gt,Center as _t,Circle as vt,Collapse as yt,Container as bt,Divider as xt,Flex as St,FormControl as Ct,FormLabel as wt,Grid as Tt,GridItem as Et,HStack as B,Heading as Dt,Icon as V,IconButton as Ot,Image as kt,Input as At,InputGroup as jt,InputLeftElement as Mt,InputRightElement as Nt,Link as Pt,List as Ft,ListItem as It,ModalBody as H,ModalCloseButton as U,ModalFooter as W,ModalHeader as G,Select as Lt,Skeleton as Rt,Spinner as zt,Switch as Bt,Tag as Vt,Text as K,Textarea as Ht,Tooltip as Ut,VStack as q,Wrap as Wt,WrapItem as Gt,useClipboard as Kt,useColorModeValue as qt,useDisclosure as Jt,useToken as J}from"@chakra-ui/react";import{Fragment as Y,jsx as X,jsxs as Z}from"react/jsx-runtime";import{parseEther as Yt}from"ethers";import{useTranslation as Q}from"react-i18next";import{useQueryClient as Xt}from"@tanstack/react-query";import{useMfaEnrollment as Zt,usePrivy as Qt}from"@privy-io/react-auth";import{IERC20__factory as $t}from"@vechain/vechain-contract-types";import{decodeEventLog as en,formatEther as tn,formatUnits as nn,parseUnits as rn,zeroAddress as an}from"viem";import{keyframes as on}from"@emotion/react";import{LuArchive as sn,LuArrowDown as cn,LuArrowDownToLine as ln,LuArrowLeftRight as un,LuArrowRight as dn,LuArrowUp as fn,LuArrowUpFromLine as pn,LuBell as mn,LuBookmark as hn,LuBookmarkCheck as gn,LuCamera as _n,LuCheck as vn,LuChevronDown as yn,LuChevronRight as bn,LuChevronUp as xn,LuCircleAlert as Sn,LuCircleCheck as Cn,LuCircleHelp as wn,LuCircleX as Tn,LuCopy as En,LuDollarSign as Dn,LuExternalLink as On,LuFileText as kn,LuFingerprint as An,LuFuel as jn,LuGavel as Mn,LuGithub as Nn,LuGlobe as Pn,LuGripVertical as Fn,LuKey as In,LuLanguages as Ln,LuLayoutGrid as Rn,LuLogOut as zn,LuMail as Bn,LuMinus as Vn,LuPencil as Hn,LuPhone as Un,LuPlus as Wn,LuRefreshCw as Gn,LuSearch as Kn,LuSettings2 as qn,LuShield as Jn,LuShieldCheck as Yn,LuSlash as Xn,LuSquareUser as Zn,LuTrash2 as Qn,LuUnlink as $n,LuUserCog as er,LuWallet as tr,LuWalletCards as nr}from"react-icons/lu";import{FcGoogle as rr}from"react-icons/fc";import{FaXTwitter as ir}from"react-icons/fa6";import{GoEye as ar,GoEyeClosed as or}from"react-icons/go";import{useForm as sr}from"react-hook-form";import{ens_normalize as cr}from"@adraffy/ens-normalize";import{QRCode as lr}from"react-qrcode-logo";import{SiFarcaster as ur}from"react-icons/si";import{FaApple as dr,FaDiscord as fr,FaInstagram as pr,FaLinkedin as mr,FaSpotify as hr,FaTelegram as gr,FaTiktok as _r}from"react-icons/fa";const vr=({wallet:e,label:t,style:n,showHumanAddress:r=!0,setCurrentContent:i,onLogout:a})=>{let{t:o}=Q(),[s,c]=L(!1),[u,d]=L(!1),f=J(`colors`,`vechain-kit-text-primary`),p=J(`colors`,`vechain-kit-text-secondary`),m=qt(`#ebebeb`,`#ffffff0a`),h=qt(`#ffffff`,`transparent`),g=async(e,t)=>{await T(e)&&(t(!0),setTimeout(()=>{t(!1)},2e3))},_=()=>{i&&(e?.domain?i({type:`choose-name-search`,props:{name:``,setCurrentContent:i,initialContentSource:`profile`}}):i({type:`choose-name`,props:{setCurrentContent:i,initialContentSource:`profile`,onBack:()=>i(`profile`)}}))};return X(q,{w:`full`,justifyContent:`center`,...n,children:Z(q,{w:`full`,spacing:4,children:[t&&X(K,{fontSize:`sm`,color:p,children:t}),Z(q,{spacing:2,w:`full`,children:[e?.domain&&Z(B,{w:`full`,spacing:3,px:4,py:2,borderWidth:1,borderColor:m,borderRadius:`md`,bg:h,children:[X(V,{as:Zn,color:p}),X(K,{flex:1,fontSize:`sm`,fontWeight:`700`,color:f,noOfLines:1,children:u?o(`Copied!`):e.domain}),Z(B,{spacing:2,children:[i&&X(Ot,{icon:X(Hn,{}),height:`30px`,borderRadius:`5px`,variant:`vechainKitSecondary`,onClick:_,"aria-label":`Edit domain`}),X(Ot,{icon:X(u?vn:En,{}),height:`30px`,borderRadius:`5px`,variant:`vechainKitSecondary`,onClick:()=>g(e.domain||``,d),"aria-label":`Copy domain`})]})]}),Z(B,{w:`full`,spacing:3,px:4,py:2,borderWidth:1,borderColor:m,borderRadius:`md`,bg:h,children:[X(V,{as:tr,color:p}),X(K,{flex:1,fontSize:`sm`,fontWeight:`700`,color:f,noOfLines:1,children:s?o(`Copied!`):r?l(e?.address??``,8,7):e?.address}),Z(B,{spacing:2,children:[X(Ot,{icon:X(zn,{}),onClick:()=>i?.({type:`disconnect-confirm`,props:{onDisconnect:()=>a?.(),onBack:()=>i?.(`profile`)}}),variant:`vechainKitSecondary`,height:`30px`,w:`30px`,borderRadius:`5px`,"aria-label":`Copy address`}),X(Ot,{icon:X(s?vn:En,{}),onClick:()=>g(e?.address??``,c),variant:`vechainKitSecondary`,height:`30px`,w:`30px`,borderRadius:`5px`,"aria-label":`Copy address`})]})]})]})]})})};var yr=`3.0.0-rc.1`,br={"@adraffy/ens-normalize":`^1.11.0`,"@chakra-ui/react":`^2.8.2`,"@emotion/styled":`^11.14.1`,"@privy-io/cross-app-connect":`0.2.2`,"@privy-io/react-auth":`2.24.0`,"@solana/web3.js":`^1.98.0`,"@tanstack/react-query":`^5.64.2`,"@tanstack/react-query-devtools":`^5.64.1`,"@vechain/contract-getters":`1.0.4`,"@vechain/dapp-kit-react":`2.1.0-rc.5`,"@vechain/picasso":`^2.1.1`,"@vechain/vechain-contract-types":`1.6.0-rc`,"@wagmi/core":`^2.17.2`,"bignumber.js":`^9.1.2`,"browser-image-compression":`^2.0.2`,dotenv:`^16.4.7`,ethers:`^6.13.5`,"framer-motion":`^11.15.0`,i18next:`^24.2.1`,"i18next-browser-languagedetector":`^8.0.2`,net:`^1.0.2`,process:`^0.11.10`,react:`^18.2.0`,"react-device-detect":`^2.2.3`,"react-hook-form":`^7.54.2`,"react-i18next":`^15.4.0`,"react-icons":`^5.4.0`,"react-qrcode-logo":`^3.0.0`,vaul:`^1.1.2`,viem:`^2.29.3`,wagmi:`^2.15.4`},xr={"@chakra-ui/react":`^2.8.2`,"@emotion/react":`^11.0.0`,"@emotion/styled":`^11.0.0`,"@tanstack/react-query":`^5.64.2`,"@vechain/dapp-kit-react":`2.1.0-rc.5`,"framer-motion":`^11.0.0`,react:`^18.0.0`,"react-dom":`^18.0.0`};const Sr=({symbol:e,amount:t,currencyValue:n,currentCurrency:i,isDisabled:a,onClick:o,...c})=>{let l=J(`colors`,`vechain-kit-text-primary`),u=J(`colors`,`vechain-kit-text-secondary`),[d]=fe(de.SHOW_ASSETS,!0);return Z(z,{height:`72px`,variant:`ghost`,justifyContent:`space-between`,isDisabled:a,p:4,w:`100%`,_disabled:{cursor:`not-allowed`,opacity:.5},onClick:o,"data-testid":`asset-${e}`,...c,children:[Z(B,{children:[r[e]?F.cloneElement(r[e],{boxSize:`24px`,borderRadius:`full`}):X(kt,{src:s[e],alt:`${e} logo`,boxSize:`24px`,borderRadius:`full`,fallback:X(R,{boxSize:`24px`,borderRadius:`full`,bg:`whiteAlpha.200`,display:`flex`,alignItems:`center`,justifyContent:`center`,children:X(K,{fontSize:`10px`,fontWeight:`bold`,color:l,children:e.slice(0,3)})})}),X(K,{color:l,children:e})]}),Z(q,{align:`flex-end`,spacing:0,children:[Z(K,{color:l,children:[d?t.toLocaleString(void 0,{maximumFractionDigits:2}):`*`.repeat(4),` `]}),X(K,{fontSize:`sm`,color:u,"data-testid":`${e}-balance`,children:d?De(n,{currency:i}):`*`.repeat(4)})]})]})},Cr=({address:e,domain:t,imageSrc:n,imageAlt:r=`Account`,hideAddress:i=!1,balance:a,tokenAddress:o})=>{let{t:s}=Q(),c=J(`colors`,`vechain-kit-text-primary`),u=J(`colors`,`vechain-kit-text-secondary`),d=J(`colors`,`vechain-kit-card`),{isLoading:f}=We({address:e}),{tokens:p,isLoading:m}=ze({address:e}),h=I(()=>o?p.find(e=>e.address===o):null,[p,o]),g=I(()=>a===void 0?h?Number(h.balance):0:a,[a,h]),_=h?.symbol||``;return f||m?Z(B,{minH:`50px`,justify:`space-between`,p:4,borderRadius:`2xl`,bg:d,children:[Z(B,{children:[X(Rt,{boxSize:`40px`,borderRadius:`full`}),Z(q,{align:`start`,spacing:0,children:[X(Rt,{height:`16px`,width:`120px`,borderRadius:`md`}),!i&&X(Rt,{mt:2,height:`12px`,width:`100px`,borderRadius:`md`})]})]}),Z(q,{justify:`flex-start`,align:`flex-end`,spacing:0,mr:2,children:[X(K,{fontSize:`sm`,fontWeight:`medium`,color:c,children:s(`Balance`)}),X(Rt,{height:`12px`,width:`80px`,borderRadius:`md`})]})]}):Z(B,{minH:`50px`,justify:`space-between`,p:4,borderRadius:`2xl`,bg:d,children:[Z(B,{children:[X(kt,{src:n,alt:r,boxSize:`40px`,borderRadius:`full`,objectFit:`cover`}),X(q,{align:`start`,spacing:0,children:t?Z(Y,{children:[X(K,{fontWeight:`medium`,fontSize:`sm`,color:c,children:t}),!i&&X(K,{fontSize:`xs`,color:u,children:l(e,6,4)})]}):X(K,{fontWeight:`medium`,fontSize:`sm`,color:c,children:l(e,6,4)})})]}),Z(q,{justify:`flex-start`,align:`flex-end`,spacing:0,mr:2,children:[X(K,{fontSize:`sm`,fontWeight:`medium`,color:c,children:s(`Balance`)}),Z(K,{fontSize:`xs`,color:u,children:[g.toLocaleString(void 0,{maximumFractionDigits:2}),_&&` ${_}`]})]})]})},wr=({children:e,...t})=>(pe(),X(q,{...t,children:e})),Tr=({wallet:e,props:t})=>{let n=at(e?.image),r=at(e?.address);return it(()=>{r.current!==e?.address&&(n.current=e?.image,r.current=e?.address)},[e?.address]),it(()=>{e?.image&&!e.isLoadingMetadata&&(n.current=e.image)},[e?.image,e?.isLoadingMetadata]),!t?.src&&!e?.image&&!n.current||e?.isLoadingMetadata?X(Rt,{rounded:`full`,width:t?.width,height:t?.height}):X(kt,{src:t?.src||e?.image||n.current,alt:t?.alt||e?.domain,objectFit:`cover`,rounded:`full`,...t})},Er=({isOpen:e,onClose:t,selectedToken:n,onTokenSelect:i,availableTokens:a,tokenEstimations:o,walletAddress:s})=>{let{t:c}=Q(),{balances:l}=he(s),[d,f]=F.useState(n),[p,m]=F.useState(!1),h=J(`colors`,`vechain-kit-text-primary`),g=J(`colors`,`vechain-kit-text-secondary`),_=J(`colors`,`vechain-kit-text-tertiary`),y=J(`colors`,`vechain-kit-error`),b=e=>e?_:`transparent`,x=e=>e?h:`transparent`;F.useEffect(()=>{e&&(f(n),m(!1))},[e,n]);let S=()=>{i(d,p),t()},ee=e=>{let t=l.find(t=>t.symbol===e);return t?Number(t.balance).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):`0.00`},C=e=>{let t=l.find(t=>t.symbol===e),n=o[e];return!t||!n?!1:Number(t.balance)<n.cost};return Z(et,{isOpen:e,onClose:t,size:`sm`,children:[Z(G,{children:[X(K,{fontSize:`lg`,fontWeight:`semibold`,color:h,children:c(`Fee token`)}),X(K,{fontSize:`sm`,fontWeight:`normal`,color:g,mt:1,children:c(`Select the token to pay the fee with`)})]}),X(H,{children:Z(q,{spacing:2,align:`stretch`,children:[a.map(e=>{let t=u[e],n=d===e,i=o[e]||{cost:0,loading:!0},a=C(e);return X(R,{cursor:a?`not-allowed`:`pointer`,bg:b(n),border:`1px`,borderColor:x(n),borderRadius:`md`,p:3,transition:`all 0.2s ease`,_hover:{backgroundColor:a?b(n):g&&`#ffffff12`,borderColor:a?x(n):g},opacity:a?.5:1,onClick:()=>!a&&f(e),children:Z(B,{spacing:3,justify:`space-between`,children:[Z(B,{spacing:3,flex:1,children:[F.cloneElement(r[e],{boxSize:`36px`,borderRadius:`full`}),Z(q,{align:`start`,spacing:0,children:[X(K,{fontWeight:`medium`,color:h,children:t.symbol}),Z(K,{fontSize:`xs`,color:g,children:[c(`Balance`),`:`,` `,ee(e)]}),a&&X(K,{fontSize:`xs`,color:y,children:c(`Insufficient balance`)})]})]}),X(q,{align:`end`,spacing:0,children:i.loading?X(Rt,{height:`16px`,width:`60px`}):Z(Y,{children:[X(K,{fontSize:`sm`,fontWeight:`semibold`,color:h,children:v(i.cost,2)}),X(K,{fontSize:`xs`,color:g,children:t.symbol})]})})]})},e)}),d!==n&&Z(Ct,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,children:[X(wt,{htmlFor:`remember-choice`,mb:`0`,fontSize:`sm`,color:h,children:c(`Use this token for future transactions`)}),X(Bt,{id:`remember-choice`,isChecked:p,onChange:e=>m(e.target.checked),color:h})]})]})}),X(W,{children:Z(q,{spacing:3,w:`full`,children:[X(z,{variant:`vechainKitPrimary`,onClick:S,isDisabled:C(d),children:c(`Apply`)}),X(z,{variant:`ghost`,width:`full`,onClick:t,children:c(`Cancel`)})]})})]})},Dr=({estimation:e,isLoading:t,isLoadingTransaction:i,onTokenChange:a,clauses:o=[],userSelectedToken:s})=>{let{t:c}=Q(),{feeDelegation:l}=n(),{connection:d,account:f}=A(),{preferences:p,reorderTokenPriority:m}=ae(),{isOpen:h,onOpen:g,onClose:_}=Jt(),y=J(`colors`,`vechain-kit-text-primary`),b=J(`colors`,`vechain-kit-text-secondary`),[x,S]=L(()=>{let e={};return p.availableGasTokens.forEach(t=>{e[t]={cost:0,loading:!0}}),e}),{data:ee,isLoading:C}=Oe({clauses:o,tokens:p.availableGasTokens,enabled:o.length>0});it(()=>{!C&&ee&&S(ee)},[ee,C]),it(()=>{e&&S(t=>({...t,[e.usedToken]:{cost:e.transactionCost||0,loading:!1}}))},[e]),it(()=>{C&&S(p.availableGasTokens.reduce((e,t)=>(e[t]={cost:0,loading:!0},e),{}))},[C,p.availableGasTokens]);let w=rt((t,n)=>{n&&m([t,...p.tokenPriority.filter(e=>e!==t)]),a&&t!==e?.usedToken&&a(t)},[e,a,m,p.tokenPriority]);if(l?.delegatorUrl||d.isConnectedWithDappKit||p.availableGasTokens.length===0)return null;let{balances:te}=he(f?.address??``),T=e=>{let t=te.find(t=>t.symbol===e),n=x[e];return!t||!n||n.loading?!0:Number(t.balance)<n.cost},E=e?.usedToken,D=p.availableGasTokens,O;E?O=E:s&&D.includes(s)?O=s:(O=D.find(e=>x[e]&&!x[e].loading&&!T(e)),O||(O=D.find(e=>x[e]&&!x[e].loading)),O||(O=D[0]));let k=O?x[O]:void 0,ne=E&&e?.transactionCost?e.transactionCost:k?.cost||0,re=O?u[O]:void 0;return Z(Y,{children:[X(xt,{mt:3}),Z(B,{mt:3,w:`full`,justifyContent:`start`,alignItems:`center`,children:[Z(q,{align:`start`,spacing:0,w:`full`,children:[X(K,{fontSize:`sm`,fontWeight:`light`,textAlign:`left`,w:`full`,color:b,children:c(`Fee`)}),X(B,{align:`start`,justifyContent:`space-between`,spacing:0,w:`full`,children:X(B,{justifyContent:`flex-start`,w:`full`,children:t||!E&&(!k||k.loading)||!re?Z(Y,{children:[X(Rt,{height:`16px`,width:`120px`,borderRadius:`md`}),X(Rt,{height:`16px`,width:`60px`,borderRadius:`md`})]}):Z(Y,{children:[Z(K,{color:y,fontSize:`sm`,fontWeight:`semibold`,children:[v(ne,2),` `,re.symbol]}),Z(K,{color:b,fontSize:`xs`,children:[`≈`,` $`,(ne*.01).toFixed(2)]})]})})})]}),Z(z,{onClick:g,variant:`outline`,size:`sm`,borderRadius:`full`,px:6,disabled:i,color:b,borderColor:b,_hover:{bg:b},leftIcon:F.cloneElement(r[O||p.availableGasTokens[0]],{boxSize:`20px`,borderRadius:`full`}),children:[X(K,{fontSize:`sm`,fontWeight:`semibold`,children:O||p.availableGasTokens[0]}),X(V,{as:yn,boxSize:5,color:b})]})]}),X(Er,{isOpen:h,onClose:_,selectedToken:O||p.availableGasTokens[0],onTokenSelect:w,availableTokens:p.availableGasTokens,tokenEstimations:x,walletAddress:f?.address??``})]})},Or=on`
|
|
2
|
+
from {
|
|
3
|
+
transform: translateY(-100%);
|
|
4
|
+
opacity: 0;
|
|
5
|
+
}
|
|
6
|
+
to {
|
|
7
|
+
transform: translateY(0);
|
|
8
|
+
opacity: 1;
|
|
9
|
+
}
|
|
10
|
+
`,kr=on`
|
|
11
|
+
from {
|
|
12
|
+
transform: translateY(0);
|
|
13
|
+
opacity: 1;
|
|
14
|
+
}
|
|
15
|
+
to {
|
|
16
|
+
transform: translateY(-100%);
|
|
17
|
+
opacity: 0;
|
|
18
|
+
}
|
|
19
|
+
`,Ar=({message:e,duration:t=2e3,onClose:n})=>{let[r,i]=L(!0),a=J(`colors`,`vechain-kit-text-primary`),o=qt(`#f0f9ff`,`#0000009e`),s=qt(`#bfdbfe`,`#3b3b3b`),c=J(`colors`,`vechain-kit-primary`);return it(()=>{let e=setTimeout(()=>{i(!1),setTimeout(()=>{n?.()},300)},t);return()=>clearTimeout(e)},[t,n]),X(R,{position:`absolute`,w:`fit-content`,margin:`auto`,animation:`${r?Or:kr} 0.3s ease-in-out`,zIndex:10,children:X(R,{bg:o,borderWidth:1,borderColor:s,borderRadius:`md`,px:4,py:3,mx:4,mt:2,children:Z(B,{spacing:3,align:`center`,children:[X(V,{as:vn,boxSize:5,color:c,flexShrink:0}),X(K,{fontSize:`sm`,fontWeight:`500`,color:a,flex:1,children:e})]})})})},jr=({showFeedback:e=!1})=>{let{t}=Q(),[n,r]=L(!1);return it(()=>{r(!!e)},[e]),n?X(Ar,{message:t(`Account Changed`),duration:2e3,onClose:()=>{r(!1)}}):null},$=({leftIcon:e,rightIcon:t,title:n,onClick:r,leftImage:i,hide:a=!1,showComingSoon:o=!1,backgroundColor:s,_hover:c,isDisabled:l=!1,stacked:u=!1,isLoading:d,loadingText:f,style:p,extraContent:m,dataTestId:h,variant:g=`actionButton`})=>{let{t:_}=Q();return X(z,{variant:g===`actionButton`?`vechainKitSecondary`:g,py:u?0:2,minHeight:`50px`,height:`fit-content`,p:0,onClick:r,display:a?`none`:`flex`,isDisabled:o||l,isLoading:d,loadingText:f,bgColor:s,_hover:c,"data-testid":h,...p,children:Z(B,{w:`full`,justify:`space-between`,alignItems:`center`,children:[X(R,{minW:`40px`,h:`20px`,children:i?X(kt,{src:i,w:`30px`,h:`30px`,borderRadius:`full`,alt:`left-image`,alignSelf:`end`,objectFit:`cover`}):X(V,{as:e,fontSize:`20px`,h:`full`,alignContent:`center`})}),X(q,{textAlign:`left`,w:`full`,flex:1,justifyContent:`flex-start`,alignItems:`flex-start`,children:Z(B,{justify:`flex-start`,alignItems:`baseline`,children:[X(K,{fontSize:`sm`,fontWeight:`400`,children:n}),o&&X(Vt,{size:`sm`,colorScheme:`red`,children:_(`Coming Soon!`)}),m]})}),t&&X(q,{minW:`40px`,justifyContent:`flex-end`,children:X(V,{as:t,fontSize:`20px`,opacity:.5})})]})})},Mr=({wallet:e,setCurrentContent:t,size:n=`md`,onClick:r,onClose:i,mt:a,style:s})=>{let{t:c}=Q(),{connection:u}=A(),{switchWallet:d,isSwitching:f,isInAppBrowser:p}=Ve(),{isSwitchWalletEnabled:m}=O(),[h,g]=L(!1),_=async()=>{await T(e?.domain??e?.address??``)&&(g(!0),setTimeout(()=>{g(!1)},2e3))},v=()=>{p?d():t?.({type:`select-wallet`,props:{setCurrentContent:t,onClose:i,returnTo:`main`,onLogoutSuccess:i}})};return Z(B,{mt:a,w:`full`,...s,justifyContent:`flex-start`,alignItems:`center`,children:[X(z,{w:`full`,h:12,"aria-label":`Wallet`,onClick:r,variant:`vechainKitSecondary`,p:3,"data-testid":`profile-button`,children:Z(B,{spacing:2,align:`center`,justifyContent:`space-between`,w:`full`,children:[Z(B,{spacing:2,justifyContent:`flex-start`,children:[X(Tr,{wallet:e,props:{width:7,height:7}}),X(K,{fontSize:n,fontWeight:`500`,children:h?c(`Copied!`):o(e?.domain??``,22,0)||l(e?.address??``,6,4)})]}),X(V,{boxSize:5,as:bn,cursor:`pointer`,opacity:.5})]})}),u.isInAppBrowser&&m||!u.isInAppBrowser&&u.isConnectedWithDappKit?X(Ot,{"aria-label":`Switch wallet`,icon:X(V,{as:un}),onClick:v,w:`60px`,h:12,variant:`vechainKitSecondary`,p:3,isLoading:f,isDisabled:f,"data-testid":`switch-wallet-button`}):X(Ot,{"aria-label":`Copy address`,icon:X(V,{as:h?vn:En}),onClick:_,w:`60px`,h:12,variant:`vechainKitSecondary`,p:3})]})},Nr=({address:e,maxIcons:t=3,iconSize:i=20,ml:a=0,style:o,iconsGap:c=0,rightIcon:l,showNoAssetsWarning:u=!1,onClick:d})=>{let{t:f}=Q(),{tokensWithBalance:p}=ze({address:e}),{darkMode:m}=n(),h=J(`colors`,`vechain-kit-text-secondary`),g=c<1?`-${i/2}px`:`${c}px`,_=p.slice(0,t),v=p.length-t;return!e||p.length===0&&!u?null:Z(B,{spacing:0,ml:a,...o,onClick:d,children:[Z(B,{spacing:0,children:[_.map((e,t)=>X(vt,{ml:t>0?g:`0`,zIndex:t,size:`${i}px`,borderRadius:`full`,bg:m?`gray.100`:`gray.600`,border:`2px solid #00000024`,alignItems:`center`,justifyContent:`center`,children:r[e.symbol]?F.cloneElement(r[e.symbol],{width:`${i*.8}px`,height:`${i*.8}px`,rounded:`full`}):s[e.symbol]?X(kt,{src:s[e.symbol],alt:`${e.symbol} logo`,width:`${i*.8}px`,height:`${i*.8}px`,rounded:`full`}):X(K,{fontSize:`${i*.4}px`,fontWeight:`bold`,color:m?`black`:`white`,children:e.symbol.slice(0,3)})},e.symbol)),v>0&&X(vt,{ml:g,zIndex:_.length,size:`${i}px`,borderRadius:`full`,bg:m?`gray.100`:`gray.700`,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`2px solid`,children:Z(K,{fontSize:`${i*.4}px`,fontWeight:`bold`,color:m?`black`:`white`,children:[`+`,v]})}),p.length===0&&u&&X(K,{fontSize:`sm`,color:h,fontWeight:`700`,children:f(`No assets`)})]}),l]})},Pr=({mb:e,mt:t,onAssetsClick:n})=>{let{t:r}=Q(),{account:i}=A(),{formattedBalance:a,isLoading:o}=We({address:i?.address??``}),{refresh:s}=Ke(),[c,l]=L(!1),u=J(`colors`,`vechain-kit-text-secondary`),d=async()=>{l(!0),await s(),setTimeout(()=>{l(!1)},1500)},[f,p]=fe(de.SHOW_ASSETS,!0);return Z(q,{w:`full`,justifyContent:`start`,spacing:1,mt:t,mb:e,children:[Z(B,{w:`full`,justifyContent:`space-between`,alignItems:`center`,spacing:0,role:`group`,children:[X(Dt,{size:`xs`,fontWeight:`800`,color:u,textTransform:`uppercase`,letterSpacing:1.2,ml:`5px`,children:r(`Assets`)}),Z(B,{spacing:0,alignItems:`center`,children:[X(Ot,{"aria-label":`Refresh balances`,variant:`ghost`,size:`sm`,opacity:.5,_hover:{opacity:.8},onClick:d,icon:X(V,{as:Gn,boxSize:4}),isLoading:o||c,sx:{"& > span.chakra-button__spinner":{width:`16px`,height:`16px`,position:`absolute`}}}),X(Ot,{"aria-label":`Show/hide assets`,variant:`ghost`,size:`sm`,opacity:.5,_hover:{opacity:.8},onClick:()=>p(!f),icon:X(V,{as:f?ar:or,boxSize:4})})]})]}),X(z,{onClick:n,h:`fit-content`,variant:`vechainKitSecondary`,children:Z(q,{spacing:2,w:`full`,justifyContent:`flex-start`,alignItems:`flex-start`,mt:4,mb:4,children:[X(Dt,{size:`2xl`,fontWeight:`700`,children:f?a:a[0]+`*`.repeat(a.slice(1).length)}),X(B,{w:`full`,justifyContent:`flex-start`,"data-testid":`all-assets-button`,mt:2,children:X(Nr,{style:{width:`100%`,justifyContent:`space-between`},maxIcons:10,iconSize:26,iconsGap:3,address:i?.address??``,showNoAssetsWarning:!0,rightIcon:X(V,{as:bn,boxSize:5,opacity:.5,marginLeft:2})})})]})})]})},Fr=[{icon:pn,label:`Send`,onClick:e=>e({type:`send-token`,props:{setCurrentContent:e}}),isDisabled:e=>!e},{icon:un,label:`Swap`,onClick:e=>{e(`swap-token`)},isDisabled:e=>!e},{icon:ln,label:`Receive`,onClick:e=>{e(`receive-token`)}}],Ir=({icon:e,label:t,onClick:n,isDisabled:r,showRedDot:i})=>{let{t:a}=Q();return X(Ot,{variant:`vechainKitSecondary`,h:`80px`,w:`full`,"aria-label":t,isDisabled:r,p:3,icon:Z(q,{spacing:4,children:[X(V,{as:e,boxSize:5,opacity:.9}),Z(B,{p:0,alignItems:`baseline`,spacing:1,children:[X(K,{fontSize:`sm`,fontWeight:`600`,"data-testid":`${t.toLowerCase()}-button-label`,children:a(t,t)}),i&&X(R,{minWidth:`8px`,height:`8px`,bg:`red.500`,borderRadius:`full`,display:`flex`,alignItems:`center`,justifyContent:`center`})]})]}),onClick:n})},Lr=({mt:e,setCurrentContent:t})=>{let{account:n,smartAccount:r,connectedWallet:i,connection:a}=A(),{hasAnyBalance:o}=We({address:n?.address??``}),{data:s}=ge(r?.address??``,i?.address??``,3),c=a.isConnectedWithPrivy&&s;return X(Tt,{templateColumns:`repeat(3, 1fr)`,gap:2,w:`full`,mt:e,children:Fr.map(e=>X(Ir,{icon:e.icon,label:e.label,onClick:()=>e.onClick(t),isDisabled:e.isDisabled?.(o),showRedDot:c&&e.label===`Settings`},e.label))})},Rr=({setCurrentContent:e})=>{let{t}=Q(),n=J(`colors`,`vechain-kit-text-primary`),r=J(`colors`,`vechain-kit-text-secondary`);return X(ht,{w:`full`,variant:`featureAnnouncement`,overflow:`hidden`,onClick:()=>{e({type:`choose-name`,props:{setCurrentContent:e,onBack:()=>e(`profile`),initialContentSource:`profile`}})},cursor:`pointer`,_hover:{opacity:.8},children:X(gt,{p:4,children:X(B,{justify:`space-between`,align:`flex-start`,spacing:3,children:Z(q,{align:`flex-start`,spacing:1,children:[Z(B,{spacing:2,children:[X(K,{fontSize:`sm`,fontWeight:`400`,color:n,children:t(`Claim your vet domain!`)}),X(Vt,{size:`sm`,colorScheme:`red`,children:t(`New`)})]}),X(K,{fontSize:`xs`,color:r,children:t(`Say goodbye to 0x addresses, claim your .veworld.vet subdomain now for free!`)})]})})})})},zr=()=>{let{t:e}=Q();return X(ut,{status:`warning`,fontSize:`xs`,borderRadius:`xl`,p:2,children:X(q,{spacing:1,align:`stretch`,w:`full`,children:Z(B,{spacing:2,align:`flex-start`,children:[X(ft,{boxSize:4,mt:`10px`}),X(K,{w:`full`,children:e(`A .vet domain is required to customize your profile. Choose an account name to get started.`)})]})})})},Br=({setCurrentContent:e,wallet:t,onClose:r,switchFeedback:i})=>{let{t:a}=Q(),{network:o}=n(),{isolatedView:s}=Ue();return Z(wr,{children:[Z(P,{children:[!s&&X(N,{onClick:()=>{e(`profile`)}}),Z(G,{children:[a(`Wallet`),o?.type!==`main`&&X(Vt,{size:`xs`,colorScheme:`orange`,fontSize:`2xs`,p:1,ml:1,textTransform:`uppercase`,children:`${o?.type}`})]}),X(U,{})]}),X(H,{w:`full`,children:Z(q,{w:`full`,overflow:`hidden`,justifyContent:`flex-start`,spacing:8,children:[X(jr,{showFeedback:i?.showFeedback}),X(Mr,{style:{justifyContent:`flex-start`},onClick:()=>{e(`profile`)},setCurrentContent:e,onClose:r,wallet:t}),X(Pr,{onAssetsClick:()=>{e(`assets`)}}),X(Lr,{setCurrentContent:e})]})}),X(W,{pt:0})]})},Vr=({onSelectToken:e,onBack:t,showAllTokens:r=!1})=>{let{t:i}=Q(),{darkMode:a}=n(),{currentCurrency:o}=Pe(),s=J(`colors`,`vechain-kit-text-primary`),c=J(`colors`,`vechain-kit-text-secondary`),l=J(`colors`,`vechain-kit-text-tertiary`),{account:u}=A(),{tokensWithBalance:d,sortedTokens:f}=ze({address:u?.address??``}),[p,m]=L(``),h=I(()=>{if(r){let e=f.filter(e=>Number(e.balance)>0),t=[...f.filter(e=>Number(e.balance)===0)].sort((e,t)=>e.symbol.localeCompare(t.symbol));return[...e,...t]}return d},[r,f,d]).filter(({symbol:e})=>e.toLowerCase().includes(p.toLowerCase()));return Z(Y,{children:[Z(P,{children:[X(G,{children:i(`Select Token`)}),X(N,{onClick:t}),X(U,{})]}),X(bt,{h:[`540px`,`auto`],p:0,children:X(H,{children:Z(q,{spacing:4,align:`stretch`,children:[Z(jt,{size:`lg`,children:[X(At,{placeholder:`Search token`,bg:a?`vechain-kit-overlay`:`vechain-kit-card`,borderRadius:`xl`,height:`56px`,pl:12,value:p,onChange:e=>m(e.target.value),"data-testid":`search-token-input`}),X(Mt,{h:`56px`,w:`56px`,pl:4,children:X(Kn,{color:l})})]}),X(K,{fontSize:`lg`,fontWeight:`semibold`,color:s,mt:4,children:i(r?`All tokens`:`Your tokens`)}),h.length===0?Z(q,{spacing:2,py:8,children:[X(V,{as:Xn,boxSize:12,color:l}),X(K,{fontSize:`lg`,color:s,children:i(`No tokens found`)}),X(K,{fontSize:`md`,color:c,children:i(`Try searching with a different term`)})]}):X(q,{spacing:2,align:`stretch`,children:h.map(t=>X(Sr,{symbol:t.symbol,amount:Number(t.balance),currencyValue:t.valueInCurrency,currentCurrency:o,onClick:()=>e(t)},t.address))})]})})}),X(W,{pt:0})]})},Hr=({setCurrentContent:e,preselectedToken:t,initialAmount:i=``,initialToAddressOrDomain:a=``,onBack:o=()=>e(`main`)})=>{let{t:c}=Q(),{darkMode:l,feeDelegation:u}=n(),{currentCurrency:d}=Pe(),f=J(`colors`,`vechain-kit-text-primary`),p=J(`colors`,`vechain-kit-text-secondary`),m=J(`colors`,`vechain-kit-text-tertiary`),h=J(`colors`,`vechain-kit-error`),g=J(`colors`,`vechain-kit-card`),{exchangeRates:_}=Xe(),{account:v}=A(),{isolatedView:y}=Ue(),{tokensWithBalance:b}=ze({address:v?.address??``}),[x,S]=L(t??b[0]??null),[ee,C]=L(!1);it(()=>{!t&&!x&&b.length>0&&S(b[0])},[b,t,x]);let{register:w,watch:te,setValue:T,setError:E,formState:{errors:D,isValid:O},handleSubmit:k}=sr({defaultValues:{amount:i,toAddressOrDomain:a},mode:`onChange`}),{toAddressOrDomain:re,amount:ie}=te(),j=at(x);it(()=>{j.current&&x&&j.current.address!==x.address&&T(`amount`,``),j.current=x},[x,T]);let ae=I(()=>x?De(Me(Number(ie)*x.priceUsd,d,_),{currency:d}):``,[ie,x,d,_]),{data:oe,isLoading:se}=ne(re),ce=()=>{x&&T(`amount`,x.balance)},le=()=>{o()},ue=async t=>{if(x){if(!(oe?.isValidAddressOrDomain&&(!oe?.domain||oe?.domain&&oe?.isPrimaryDomain))){E(`toAddressOrDomain`,{type:`manual`,message:c(`Invalid address or domain`)});return}if(x){let e=Yt(t.amount),n=u?.b3trTransfers?.minAmountInEther;if(x.symbol===`B3TR`&&typeof n==`number`&&n>0)try{if(e<Yt(String(n))){E(`amount`,{type:`manual`,message:c(`Minimum {{symbol}} transfer is {{min}}`,{symbol:x.symbol,min:n})});return}}catch{}if(e>Yt(x.balance)){E(`amount`,{type:`manual`,message:c(`Insufficient {{symbol}} balance`,{symbol:x.symbol})});return}}e({type:`send-token-summary`,props:{toAddressOrDomain:t.toAddressOrDomain,resolvedDomain:oe?.domain,resolvedAddress:oe?.address,amount:t.amount,selectedToken:x,formattedTotalAmount:ae,setCurrentContent:e}})}};return ee?X(Vr,{setCurrentContent:e,onSelectToken:e=>{S(e),C(!1)},onBack:()=>{C(!1)}}):Z(Y,{children:[Z(P,{children:[X(G,{children:c(`Send`)}),!y&&X(N,{onClick:le}),X(U,{})]}),X(H,{children:Z(q,{spacing:2,align:`stretch`,position:`relative`,children:[Z(B,{justify:`space-between`,children:[X(K,{fontSize:`md`,fontWeight:`bold`,color:f,children:c(`Amount`)}),Z(K,{cursor:`pointer`,_hover:{color:p,textDecoration:`underline`},onClick:ce,noOfLines:1,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`sm`,fontWeight:`medium`,color:p,children:[c(`Balance`),`:`,` `,Number(x?.balance??0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})]}),X(R,{p:4,borderRadius:`2xl`,bg:g,children:X(q,{align:`stretch`,spacing:2,children:Z(Ct,{isInvalid:!!D.amount,children:[Z(B,{justify:`space-between`,children:[X(At,{...w(`amount`,{required:c(`Amount is required`),pattern:{value:/^\d*\.?\d*$/,message:c(`Please enter a valid number`)},validate:e=>{if(!e)return!0;let t=parseFloat(e);if(isNaN(t))return c(`Please enter a valid number`);let n=u?.b3trTransfers?.minAmountInEther;return x?.symbol===`B3TR`&&typeof n==`number`&&n>0&&t<n?c(`Minimum {{symbol}} transfer is {{min}}`,{symbol:x.symbol,min:n}):!0}}),onChange:e=>{let t=e.target.value.trim();e.target.value=t,T(`amount`,t,{shouldValidate:!0})},placeholder:`0`,variant:`unstyled`,fontSize:`4xl`,fontWeight:`bold`,"data-testid":`tx-amount-input`,type:`number`,inputMode:`decimal`,color:f}),x?Z(z,{variant:`outline`,size:`sm`,borderRadius:`full`,px:6,color:p,borderColor:p,_hover:{bg:l?`whiteAlpha.300`:`blackAlpha.300`},onClick:()=>C(!0),leftIcon:r[x.symbol]?F.cloneElement(r[x.symbol],{boxSize:`20px`,borderRadius:`full`}):X(kt,{src:s[x.symbol],alt:`${x.symbol} logo`,boxSize:`20px`,borderRadius:`full`,fallback:X(R,{boxSize:`20px`,borderRadius:`full`,bg:`whiteAlpha.200`,display:`flex`,alignItems:`center`,justifyContent:`center`,children:X(K,{fontSize:`8px`,fontWeight:`bold`,color:f,children:x.symbol.slice(0,3)})})}),children:[x.symbol,X(V,{as:yn,boxSize:5,color:p})]}):Z(z,{variant:`outline`,size:`sm`,borderRadius:`full`,px:6,color:p,borderColor:p,_hover:{bg:l?`whiteAlpha.300`:`blackAlpha.300`,color:m},onClick:()=>C(!0),children:[c(`Select token`),X(V,{as:yn,boxSize:5,color:p})]})]}),x&&X(B,{spacing:1,fontSize:`sm`,justifyContent:`space-between`,color:p,children:Z(K,{color:p,children:[`≈ `,ae]})}),D.amount&&X(K,{color:`#ef4444`,fontSize:`sm`,mt:1,"data-testid":`amount-error-msg`,children:D.amount.message})]})})}),X(B,{justify:`space-between`,mt:2,children:X(K,{fontSize:`md`,fontWeight:`bold`,color:f,children:c(`To`)})}),X(R,{borderRadius:`2xl`,bg:g,children:X(q,{align:`stretch`,spacing:2,p:4,width:`100%`,children:Z(Ct,{isInvalid:!!D.toAddressOrDomain,children:[X(At,{...w(`toAddressOrDomain`,{required:c(`Address is required`)}),onChange:e=>{let t=e.target.value.trim(),n=t.includes(`.`)?cr(t):t;e.target.value=n,T(`toAddressOrDomain`,n,{shouldValidate:!0})},placeholder:c(`Type the receiver address or domain`),_placeholder:{fontSize:`md`,fontWeight:`normal`},fontSize:`lg`,fontWeight:`bold`,color:f,variant:`unstyled`,"data-testid":`tx-address-input`}),D.toAddressOrDomain&&X(K,{color:h,fontSize:`sm`,"data-testid":`address-error-msg`,children:D.toAddressOrDomain.message})]})})})]})}),X(W,{children:X(z,{variant:`vechainKitPrimary`,isDisabled:!x||!O,isLoading:se,onClick:k(ue),"data-testid":`send-button`,children:c(x?`Send`:`Select Token`)})})]})},Ur=({setCurrentContent:e,toAddressOrDomain:t,resolvedDomain:r,resolvedAddress:i,amount:a,selectedToken:o,formattedTotalAmount:s})=>{let{t:l}=Q(),{account:u,connection:d,connectedWallet:f}=A(),{data:p}=ce(i??``),{network:m,feeDelegation:h}=n(),{preferences:g}=ae(),{isolatedView:_,closeAccountModal:v}=Ue(),y=J(`colors`,`vechain-kit-text-primary`),b=J(`colors`,`vechain-kit-text-secondary`),{data:x}=ge(u?.address??``,f?.address??``,3),{open:S}=Ye(),ee=I(()=>p||c(i||t),[p,m.type,i,t]),C=async()=>{if(x){S();return}try{o.symbol===`VET`?await ne():await te()}catch(e){console.error(l(`Transaction failed:`),e)}},w=F.useCallback(t=>{e({type:`successful-operation`,props:{setCurrentContent:e,txId:t,title:l(`Transaction successful`),onDone:()=>{_?v():e(`main`)},showSocialButtons:!0}})},[e,l,_,v]),{sendTransaction:te,txReceipt:T,error:E,isWaitingForWalletConfirmation:D,isTransactionPending:O,clauses:k}=M({fromAddress:u?.address??``,receiverAddress:i||t,amount:a,tokenAddress:o.address,tokenName:o.symbol,onError:e=>{he(e??``)}}),{sendTransaction:ne,txReceipt:re,error:ie,isWaitingForWalletConfirmation:j,isTransactionPending:oe,clauses:se}=Ne({fromAddress:u?.address??``,receiverAddress:i||t,amount:a,onError:e=>{he(e??``)}}),le=F.useCallback(()=>o.symbol===`VET`?re:T,[o.symbol,re,T]),ue=D||j,de=ue||O||oe,[fe,pe]=F.useState(!1);F.useEffect(()=>{let e=le();if(!e||e.reverted||fe||de)return;let t=e.meta.txID;t&&(pe(!0),w(t))},[le,fe,de,w]),F.useEffect(()=>{de&&pe(!1)},[de]);let me=()=>{e({type:`send-token`,props:{setCurrentContent:e,preselectedToken:o,initialAmount:a,initialToAddressOrDomain:t}})},he=e=>{console.error(`Transaction failed:`,e)},[_e,ve]=F.useState(null),[ye,be]=F.useState(null),xe=g.availableGasTokens.length>0&&(d.isConnectedWithPrivy||d.isConnectedWithVeChain)&&!h?.delegatorUrl,{data:Se,isLoading:Ce,error:we,refetch:Te}=Le({clauses:o.symbol===`VET`?se:k,tokens:_e?[_e]:g.availableGasTokens,sendingAmount:a,sendingTokenSymbol:o.symbol,enabled:xe&&!!h?.genericDelegatorUrl}),Ee=Se?.usedToken,De=(Ce||!Se)&&d.isConnectedWithPrivy&&!h?.delegatorUrl,Oe=F.useCallback(e=>{ve(e),be(e),setTimeout(()=>Te(),100)},[Te]),ke=!!Ee&&!we;return F.useEffect(()=>{we&&_e&&ve(null)},[we,_e]),Z(Y,{children:[Z(P,{children:[X(G,{children:`Send`}),X(N,{isDisabled:de,onClick:me}),X(U,{isDisabled:de})]}),X(H,{children:X(q,{spacing:6,align:`stretch`,w:`full`,children:Z(q,{spacing:4,w:`full`,children:[Z(R,{w:`full`,children:[X(K,{fontSize:`sm`,mb:2,color:b,children:l(`From`)}),X(Cr,{address:u?.address??``,domain:u?.domain,imageSrc:u?.image??``,imageAlt:`From account`,balance:Number(o.balance),tokenAddress:o.address})]}),Z(R,{w:`full`,children:[X(K,{fontSize:`sm`,mb:2,color:b,children:l(`To`)}),X(Cr,{address:i||t,domain:r,imageSrc:ee??``,imageAlt:`To account`,tokenAddress:o.address})]}),d.isConnectedWithPrivy&&X(Dr,{estimation:Se,isLoading:Ce,isLoadingTransaction:de,onTokenChange:Oe,clauses:o.symbol===`VET`?se:k,userSelectedToken:ye}),Z(q,{spacing:0,w:`full`,justifyContent:`flex-start`,children:[X(K,{fontSize:`sm`,fontWeight:`light`,textAlign:`left`,w:`full`,color:b,children:l(`Amount`)}),Z(B,{justifyContent:`flex-start`,w:`full`,children:[Z(K,{fontSize:`xl`,fontWeight:`semibold`,textAlign:`left`,"data-testid":`send-summary-amount`,color:y,children:[Number(a).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}),` `,o.symbol]}),Z(K,{color:b,children:[`≈ `,s]})]})]})]})})}),X(W,{children:X(tt,{transactionError:o.symbol===`VET`?ie:E,isSubmitting:de,isTxWaitingConfirmation:ue,onConfirm:C,transactionPendingText:l(`Sending...`),txReceipt:le(),buttonText:l(`Confirm`),isDisabled:de||De,gasEstimationError:we,hasEnoughGasBalance:ke,isLoadingGasEstimation:Ce,showGasEstimationError:!h?.delegatorUrl&&d.isConnectedWithPrivy,context:`send`})})]})},Wr=({setCurrentContent:e})=>{let{t}=Q(),{account:n}=A(),{isolatedView:r}=Ue(),i=J(`colors`,`vechain-kit-text-primary`),a=J(`colors`,`vechain-kit-text-secondary`);return Z(Y,{children:[Z(P,{children:[X(G,{children:t(`Receive`)}),!r&&X(N,{onClick:()=>e(`main`)}),X(U,{})]}),Z(bt,{maxW:`container.lg`,children:[X(H,{children:Z(q,{spacing:4,align:`center`,w:`full`,children:[X(lr,{value:n?.address??``,size:200,removeQrCodeBehindLogo:!0,eyeRadius:4,logoPaddingStyle:`circle`,style:{borderRadius:`16px`}}),X(vr,{wallet:n,style:{w:`85%`}}),X(K,{fontSize:`sm`,textAlign:`center`,color:i,children:t(`Copy your address or scan this QR code`)}),X(K,{fontSize:`xs`,textAlign:`center`,color:a,children:t(`This address only supports VeChain assets.`)})]})}),X(W,{pt:0})]})]})},Gr=({quotes:e,selectedQuote:t,toTokenAddress:i,onSelectQuote:a,onBack:o})=>{let{t:c}=Q(),{darkMode:l}=n(),{currentCurrency:u}=Pe(),{account:d}=A(),{exchangeRates:f,prices:m}=Xe(),{tokens:h}=ze({address:d?.address??``}),[g,_]=L(!1),v=I(()=>i&&h.find(e=>p(e.address,i))||null,[i,h]),y=e.filter(e=>!e.reverted),b=e.filter(e=>e.reverted),x=I(()=>y.length===0?null:y.reduce((e,t)=>{let n=BigInt(e.outputAmount||`0`);return BigInt(t.outputAmount||`0`)>n?t:e}),[y]),S=I(()=>{let e=i&&m[i]||0;return y.map(t=>{let n=tn(BigInt(t.outputAmount||`0`)),r=Number(n)*e,i=Me(r,u,f),a=x&&t.aggregatorName===x.aggregatorName,o=0;if(x&&!a){let e=BigInt(x.outputAmount||`0`),n=BigInt(t.outputAmount||`0`);o=Number(n-e)/Number(e)*100}return{...t,outputAmountFormatted:n,valueUsd:r,valueInCurrency:i,isBest:a,percentageDiff:o}}).sort((e,t)=>{let n=BigInt(e.outputAmount||`0`),r=BigInt(t.outputAmount||`0`);return Number(r-n)})},[y,i,m,u,f,x]);return Z(Y,{children:[Z(P,{children:[X(G,{children:c(`Found following rates`)}),X(N,{onClick:o}),X(U,{})]}),X(bt,{h:[`540px`,`auto`],p:0,children:X(H,{children:Z(q,{spacing:6,align:`stretch`,children:[S.length>0&&X(q,{spacing:2,align:`stretch`,children:S.map(e=>{let n=t?.aggregatorName===e.aggregatorName;return Z(R,{p:2.5,borderRadius:`xl`,bg:l?`#00000038`:`gray.50`,borderWidth:1,borderColor:n?`blue.500`:l?`whiteAlpha.200`:`gray.200`,cursor:`pointer`,onClick:()=>a(e),_hover:{borderColor:n?`blue.500`:l?`whiteAlpha.400`:`gray.300`},position:`relative`,children:[(e.isBest||!e.isBest&&e.percentageDiff<0)&&X(R,{position:`absolute`,top:-1,left:0,zIndex:1,children:e.isBest?X(mt,{colorScheme:`purple`,borderRadius:`sm`,fontSize:`2xs`,px:1.5,py:.5,borderTopLeftRadius:`xl`,borderBottomRightRadius:`md`,children:c(`Best`)}):Z(mt,{colorScheme:`red`,borderRadius:`xs`,fontSize:`2xs`,px:1.5,py:.5,borderTopLeftRadius:`xl`,borderBottomRightRadius:`md`,children:[e.percentageDiff.toFixed(2),`%`]})}),Z(q,{align:`stretch`,spacing:1.5,marginTop:4,children:[Z(B,{justify:`space-between`,align:`center`,children:[Z(B,{spacing:1.5,align:`center`,children:[e.aggregator.getIcon(`20px`),X(K,{fontSize:`md`,fontWeight:`bold`,children:e.aggregatorName})]}),X(B,{align:`center`,spacing:1.5,children:v&&Z(Y,{children:[r[v.symbol]?F.cloneElement(r[v.symbol],{boxSize:`24px`,borderRadius:`full`}):s[v.symbol]?X(kt,{src:s[v.symbol],alt:`${v.symbol} logo`,boxSize:`24px`,borderRadius:`full`}):null,X(Ut,{label:Number(e.outputAmountFormatted).toLocaleString(void 0,{maximumFractionDigits:18}),hasArrow:!0,placement:`top`,children:Z(K,{fontSize:`md`,fontWeight:`bold`,textAlign:`right`,whiteSpace:`nowrap`,children:[Number(e.outputAmountFormatted).toLocaleString(void 0,{minimumFractionDigits:4}),` `,v.symbol]})})]})})]}),Z(B,{justify:`space-between`,align:`center`,children:[X(K,{fontSize:`xs`,color:l?`whiteAlpha.500`:`blackAlpha.500`,children:e.gasCostVTHO&&e.gasCostVTHO>0?`Gas: ${e.gasCostVTHO.toLocaleString(void 0,{maximumFractionDigits:2})} VTHO`:``}),e.valueUsd>0&&Z(K,{fontSize:`xs`,color:l?`whiteAlpha.600`:`blackAlpha.600`,textAlign:`right`,whiteSpace:`nowrap`,children:[`≈ `,De(e.valueInCurrency,{currency:u})]})]})]})]},e.aggregatorName)})}),b.length>0&&Z(R,{children:[Z(B,{justify:`space-between`,cursor:`pointer`,onClick:()=>_(!g),py:2,children:[Z(K,{fontSize:`sm`,color:l?`whiteAlpha.600`:`blackAlpha.600`,children:[b.length,` `,c(`rate`),b.length===1?``:`s`,` `,c(`unavailable`)]}),X(V,{as:g?xn:yn,boxSize:4,color:l?`whiteAlpha.600`:`blackAlpha.600`})]}),X(yt,{in:g,animateOpacity:!0,children:X(q,{spacing:2,align:`stretch`,pt:2,children:b.map(e=>X(R,{p:2,borderRadius:`xl`,bg:l?`#00000038`:`gray.50`,opacity:.6,children:Z(B,{justify:`space-between`,children:[Z(B,{spacing:2,align:`center`,children:[e.aggregator.getIcon(`20px`),X(K,{fontSize:`md`,fontWeight:`medium`,children:e.aggregatorName})]}),X(K,{fontSize:`xs`,color:l?`whiteAlpha.500`:`blackAlpha.500`,children:c(`Unable to fetch the price`)})]})},e.aggregatorName))})})]}),S.length===0&&b.length===0&&X(q,{spacing:2,py:8,color:l?`whiteAlpha.600`:`blackAlpha.600`,children:X(K,{fontSize:`lg`,children:c(`No quotes available`)})})]})})}),X(W,{})]})},Kr=e=>e===`0x`||e===an||!e,qr=(e,t,n,r)=>{if(!e||!t||!n||!r)return null;let i=t.toLowerCase(),a=n.toLowerCase(),o=r.toLowerCase(),s=Kr(n),c=Kr(r),l=[],u=[];if(e.outputs&&Array.isArray(e.outputs))for(let t of e.outputs)t.events&&Array.isArray(t.events)&&l.push(...t.events),t.transfers&&Array.isArray(t.transfers)&&u.push(...t.transfers);let d=$t.createInterface().getEvent(`Transfer`),f=d?.topicHash.toLowerCase(),p=l.filter(e=>e.topics&&e.topics.length>0&&e.topics[0]?.toString().toLowerCase()===f),m=null,h=null;if(s){for(let e of u)if(e.sender?.toLowerCase()===i&&e.amount&&e.amount!==`0x0`&&e.amount!==`0x`){let t=BigInt(e.amount);if(t>0n){m=t;break}}}if(c){for(let e of u)if(e.recipient?.toLowerCase()===i&&e.amount&&e.amount!==`0x0`&&e.amount!==`0x`){let t=BigInt(e.amount);if(t>0n){h=t;break}}}if(p.length>0)for(let e of p)try{let t=en({abi:[d],data:e.data.toString(),topics:e.topics.map(e=>e.toString())});if(!t.args||!(`from`in t.args)||!(`to`in t.args)||!(`value`in t.args))continue;let n=t.args.from?.toString().toLowerCase(),r=t.args.to?.toString().toLowerCase(),l=t.args.value,u=e.address.toLowerCase();!s&&n===i&&u&&u===a&&l>0n&&m===null&&(m=l),!c&&r===i&&u&&u===o&&l>0n&&h===null&&(h=l)}catch(e){console.warn(`Failed to decode transfer event:`,e);continue}return{fromAmount:m??0n,toAmount:h??0n}},Jr=({setCurrentContent:e,fromTokenAddress:t,toTokenAddress:i})=>{let{t:a}=Q(),{account:o,connection:c}=A(),{currentCurrency:l}=Pe(),{network:u,feeDelegation:f,darkMode:m}=n(),{isolatedView:h,closeAccountModal:g}=Ue(),_=J(`colors`,`vechain-kit-card`),v=J(`colors`,`vechain-kit-text-primary`),y=J(`colors`,`vechain-kit-text-secondary`),b=J(`colors`,`vechain-kit-text-tertiary`),x=J(`colors`,`vechain-kit-button-primary-bg`),S=J(`colors`,`vechain-kit-button-primary-color`),{preferences:ee}=ae(),{sortedTokens:C}=ze({address:o?.address??``}),[w,te]=L(`main`),[T,E]=L(null),[D,O]=L(null),[k,ne]=L(``),[re,ie]=L(!1),[j,oe]=L(1),[se,ce]=L(`1`),[le,ue]=L(null),[de,fe]=F.useState(null),[pe,he]=F.useState(null),[ge,_e]=F.useState([]),{prices:ve,exchangeRates:ye}=Xe(),be=j===1;F.useEffect(()=>{ce(j===1?`1`:j===.5?`0.5`:j===3?`3`:j.toString())},[j]),F.useEffect(()=>{if(C.length!==0){if((t||i)&&(!T||!D)){if(t&&!T){let e=C.find(e=>p(e.address,t));e&&E(e)}if(i&&!D){let e=C.find(e=>p(e.address,i));e&&O(e)}return}if(!T&&!D){let e=C.find(e=>e.symbol===`VET`);e&&E(e);let t=C.find(e=>e.symbol===`B3TR`);if(!t)try{let e=d(u.type).b3trContractAddress;e&&(t=C.find(t=>p(t.address,e)))}catch(e){console.warn(`Failed to get B3TR address from config:`,e)}t&&O(t)}}},[C,T,D,t,i,u.type]),F.useEffect(()=>{ue(null)},[T?.address,D?.address,k]);let{bestQuote:xe,quotes:Se,isLoading:Ce,from:we,to:Te}=Qe(T,D,k,o?.address??``,j,!!T&&!!D&&Number(k)>0),Ee=I(()=>{if(!k||Number(k)<=0||!we)return 0n;try{return rn(k,we.decimals)}catch{return 0n}},[k,we?.decimals]),M=le||xe,Oe=I(()=>{if(!M?.outputAmount||!Te)return`0`;try{return nn(M.outputAmount,Te.decimals)}catch{return`0`}},[M,Te?.decimals]),ke=I(()=>{if(!T||!k)return 0;let e=ve[T.address]||0;return Me(Number(k)*e,l,ye)},[T?.address,k,ve,l,ye]),Ae=I(()=>{if(!D||!Oe)return 0;let e=ve[D.address]||0;return Me(Number(Oe)*e,l,ye)},[D?.address,Oe,ve,l,ye]),je=I(()=>!T||!D||!o?.address||Ee===0n?null:{fromTokenAddress:T.address,toTokenAddress:D.address,amountIn:Ee.toString(),userAddress:o.address,slippageTolerance:j},[T,D,o?.address,Ee,j]),Ne=M?.gasCostVTHO??0;F.useEffect(()=>{(async()=>{if(!M||!je||!M.aggregator){_e([]);return}try{_e(await M.aggregator.buildSwapTransaction(je,M))}catch(e){console.error(`Failed to build swap clauses for gas estimation:`,e),_e([])}})()},[M,je]);let Fe=ee.availableGasTokens.length>0&&(c.isConnectedWithPrivy||c.isConnectedWithVeChain)&&!f?.delegatorUrl,{data:Ie,isLoading:Re,error:Be,refetch:Ve}=Le({clauses:ge,tokens:de?[de]:ee.availableGasTokens,sendingAmount:k,sendingTokenSymbol:T?.symbol??``,enabled:Fe&&!!f?.genericDelegatorUrl&&ge.length>0}),He=Ie?.usedToken,We=(Re||!Ie)&&c.isConnectedWithPrivy&&!f?.delegatorUrl,Ge=F.useCallback(e=>{fe(e),he(e),setTimeout(()=>Ve(),100)},[Ve]),Ke=!!He&&!Be;F.useEffect(()=>{Be&&de&&fe(null)},[Be,de]);let{executeSwap:qe,isTransactionPending:Je,isWaitingForWalletConfirmation:Ye,txReceipt:Ze,status:$e,error:et}=me(je,M),nt=rt(()=>{let t=Ze?.meta.txID??``,n=a(`Swap successful`,{defaultValue:`Swap successful`}),r;if(Ze&&T&&D&&o?.address){let e=qr(Ze,o.address,T.address,D.address);if(e&&we&&Te)try{let t=we.decimals,n=Te.decimals,i=nn(e.fromAmount,t),o=nn(e.toAmount,n),s=e=>{let t=Number(e);return t>=1e3?t.toLocaleString(void 0,{maximumFractionDigits:2}):t.toLocaleString(void 0,{maximumFractionDigits:6,minimumFractionDigits:0})};r=a(`You successfully swapped {fromAmount} {fromSymbol} for {toAmount} {toSymbol}`,{fromAmount:s(i),fromSymbol:T.symbol,toAmount:s(o),toSymbol:D.symbol,defaultValue:`You successfully swapped ${s(i)} ${T.symbol} for ${s(o)} ${D.symbol}`})}catch(e){console.warn(`Failed to format swap amounts:`,e)}}!r&&T&&D&&(r=a(`You successfully swapped {fromToken} for {toToken}`,{fromToken:T.symbol,toToken:D.symbol,defaultValue:`You successfully swapped ${T.symbol} for ${D.symbol}`})),e({type:`successful-operation`,props:{setCurrentContent:e,txId:t,title:n,description:r,onDone:()=>{h?g():e(`main`)},showSocialButtons:!0}})},[T,D,k,M,Ze,o?.address,e,a,h,g]),it=rt(e=>{let t=typeof e==`string`?e:e.message;console.error(`Swap failed:`,t)},[T,D,k]),[at,ot]=F.useState(!1);F.useEffect(()=>{if($e===`ready`){ot(!1);return}at||($e===`success`&&Ze&&!Ze.reverted?(ot(!0),nt()):$e===`error`&&et?it(et?.reason||et?.message||String(et)):Ze?.reverted&&it(`Transaction reverted`))},[$e,Ze,et,nt,it,at]);let st=rt(e=>{if(E(e),e.symbol===`VET`&&!D){let e=C.find(e=>e.symbol===`B3TR`);if(!e)try{let t=d(u.type).b3trContractAddress;t&&(e=C.find(e=>p(e.address,t)))}catch(e){console.warn(`Failed to get B3TR address from config:`,e)}e&&O(e)}te(`main`)},[D,C,u.type]),ct=rt(e=>{O(e),te(`main`)},[]),lt=rt(e=>{(/^\d*\.?\d*$/.test(e)||e===``)&&ne(e)},[]),ut=rt(()=>{T&&ne(T.balance)},[T]),dt=e=>{if(!e)return null;let t=r[e.symbol],n=s[e.symbol];return{symbol:e.symbol,logoComponent:t,logoUrl:n,balance:e.balance,value:e.valueInCurrency}},ft=dt(T),pt=dt(D);return w===`select-from-token`?X(Vr,{setCurrentContent:e,onSelectToken:st,onBack:()=>te(`main`),showAllTokens:!1}):w===`select-quote`?X(Gr,{quotes:Se,selectedQuote:M,toTokenAddress:D?.address??null,onSelectQuote:e=>{ue(e),te(`main`)},onBack:()=>te(`main`)}):w===`select-to-token`?X(Vr,{setCurrentContent:e,onSelectToken:ct,onBack:()=>te(`main`),showAllTokens:!0}):Z(Y,{children:[Z(P,{children:[X(G,{children:a(`Swap`)}),!h&&X(N,{onClick:()=>e(`main`),isDisabled:Je||Ye}),X(U,{isDisabled:Je||Ye})]}),X(H,{children:Z(q,{spacing:2,align:`stretch`,w:`full`,children:[Z(B,{justify:`space-between`,children:[X(K,{fontSize:`md`,fontWeight:`bold`,color:v,children:a(`From`)}),ft&&Z(K,{cursor:`pointer`,_hover:{color:y,textDecoration:`underline`},onClick:ut,noOfLines:1,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`sm`,fontWeight:`medium`,color:y,children:[a(`Balance`),`:`,` `,Number(ft.balance??0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})]}),X(R,{p:4,borderRadius:`2xl`,bg:_,children:Z(q,{align:`stretch`,spacing:2,children:[Z(B,{justify:`space-between`,children:[X(At,{placeholder:`0`,value:k,onChange:e=>lt(e.target.value),fontSize:`4xl`,fontWeight:`bold`,variant:`unstyled`,"data-testid":`swap-amount-input`,type:`number`,inputMode:`decimal`,color:ft&&k&&Number(k)>Number(ft.balance)?`red.500`:v}),ft?Z(z,{onClick:()=>te(`select-from-token`),variant:`outline`,size:`sm`,borderRadius:`full`,px:6,color:y,borderColor:y,_hover:{bg:m?`whiteAlpha.300`:`blackAlpha.300`},leftIcon:ft.logoComponent?F.cloneElement(ft.logoComponent,{boxSize:`20px`,borderRadius:`full`}):ft.logoUrl?X(kt,{src:ft.logoUrl,alt:`${ft.symbol} logo`,boxSize:`20px`,borderRadius:`full`,fallback:X(R,{boxSize:`20px`,borderRadius:`full`,bg:`whiteAlpha.200`,display:`flex`,alignItems:`center`,justifyContent:`center`,children:X(K,{fontSize:`8px`,fontWeight:`bold`,color:v,children:ft.symbol.slice(0,3)})})}):void 0,children:[ft.symbol,X(V,{as:yn,boxSize:5,color:y})]}):Z(z,{onClick:()=>te(`select-from-token`),variant:`outline`,size:`sm`,borderRadius:`full`,px:6,color:y,borderColor:y,_hover:{bg:m?`whiteAlpha.300`:`blackAlpha.300`,color:b},children:[a(`Select token`),X(V,{as:yn,boxSize:5,color:y})]})]}),X(B,{spacing:1,fontSize:`sm`,justifyContent:`space-between`,color:y,children:X(B,{spacing:2,alignItems:`center`,children:Z(K,{color:y,children:[`≈`,` `,De(ke??0,{currency:l})]})})})]})}),X(B,{justify:`space-between`,mt:4,children:X(K,{fontSize:`md`,fontWeight:`bold`,color:v,children:a(`To`)})}),X(R,{borderRadius:`2xl`,bg:_,p:4,children:Z(q,{align:`stretch`,spacing:2,width:`100%`,children:[Z(B,{justify:`space-between`,alignItems:`center`,children:[X(At,{value:Number(Oe).toLocaleString(void 0,{maximumFractionDigits:Number(Oe)>1e4?0:2}),readOnly:!0,variant:`unstyled`,fontSize:`4xl`,fontWeight:`bold`,"data-testid":`swap-output-amount`,color:v}),pt?Z(z,{onClick:()=>te(`select-to-token`),variant:`outline`,size:`sm`,borderRadius:`full`,px:6,color:y,borderColor:y,_hover:{bg:m?`whiteAlpha.300`:`blackAlpha.300`},leftIcon:pt.logoComponent?F.cloneElement(pt.logoComponent,{boxSize:`20px`,borderRadius:`full`}):pt.logoUrl?X(kt,{src:pt.logoUrl,alt:`${pt.symbol} logo`,boxSize:`20px`,borderRadius:`full`,fallback:X(R,{boxSize:`20px`,borderRadius:`full`,bg:`whiteAlpha.200`,display:`flex`,alignItems:`center`,justifyContent:`center`,children:X(K,{fontSize:`8px`,fontWeight:`bold`,color:v,children:pt.symbol.slice(0,3)})})}):void 0,children:[pt.symbol,X(V,{as:yn,boxSize:5,color:y})]}):Z(z,{onClick:()=>te(`select-to-token`),variant:`outline`,size:`sm`,borderRadius:`full`,px:6,color:y,borderColor:y,_hover:{bg:m?`whiteAlpha.300`:`blackAlpha.300`,color:b},children:[a(`Select token`),X(V,{as:yn,boxSize:5,color:y})]})]}),Z(B,{spacing:1,fontSize:`sm`,justifyContent:`space-between`,color:y,children:[X(B,{spacing:2,alignItems:`center`,children:Z(K,{color:y,children:[`≈`,` `,De(Ae??0,{currency:l})]})}),pt&&Z(K,{noOfLines:1,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`sm`,fontWeight:`medium`,color:y,children:[a(`Balance`),`:`,` `,Number(pt.balance??0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]})}),X(yt,{in:re&&!!M,animateOpacity:!0,children:Z(q,{spacing:1,align:`stretch`,p:4,borderRadius:`2xl`,bg:_,children:[M&&Z(B,{justify:`space-between`,children:[Z(K,{fontSize:`xs`,color:y,children:[a(`Source`),`:`]}),X(z,{variant:`outline`,size:`xs`,borderRadius:`full`,px:3,h:`auto`,py:1,cursor:`pointer`,onClick:()=>te(`select-quote`),color:y,borderColor:y,_hover:{bg:m?`whiteAlpha.300`:`blackAlpha.300`},leftIcon:M.aggregator?.getIcon(`12px`),children:X(K,{fontSize:`xs`,color:v,children:M.aggregatorName})})]}),Z(q,{align:`stretch`,spacing:2,children:[Z(B,{justify:`space-between`,children:[Z(K,{fontSize:`xs`,color:y,children:[a(`Slippage tolerance`),`:`]}),Z(K,{fontSize:`xs`,fontWeight:`medium`,color:v,children:[j,`%`]})]}),X(q,{spacing:3,align:`stretch`,pt:2,children:Z(B,{spacing:2,children:[X(z,{size:`sm`,variant:`outline`,onClick:()=>{oe(1)},flex:`0 0 auto`,minW:`60px`,borderRadius:`md`,fontSize:`xs`,bg:be?x:`transparent`,color:be?S:y,borderColor:be?x:y,_hover:{bg:be?x:m?`whiteAlpha.300`:`blackAlpha.300`,opacity:be?.8:1},children:`Auto`}),X(z,{size:`sm`,variant:`outline`,onClick:()=>{oe(.5)},flex:`0 0 auto`,minW:`60px`,borderRadius:`md`,fontSize:`xs`,bg:j===.5?x:`transparent`,color:j===.5?S:y,borderColor:j===.5?x:y,_hover:{bg:j===.5?x:m?`whiteAlpha.300`:`blackAlpha.300`,opacity:j===.5?.8:1},children:`0.5%`}),X(z,{size:`sm`,variant:`outline`,onClick:()=>{oe(3)},flex:`0 0 auto`,minW:`60px`,borderRadius:`md`,fontSize:`xs`,bg:j===3?x:`transparent`,color:j===3?S:y,borderColor:j===3?x:y,_hover:{bg:j===3?x:m?`whiteAlpha.300`:`blackAlpha.300`,opacity:j===3?.8:1},children:`3%`}),Z(jt,{size:`sm`,flex:1,children:[X(At,{value:se,onChange:e=>{let t=e.target.value;if(/^\d*\.?\d*$/.test(t)||t===``)if(ce(t),t!==``){let e=parseFloat(t);!isNaN(e)&&e>=0&&e<=100&&oe(e)}else oe(1)},placeholder:`1`,borderRadius:`md`,textAlign:`right`,pr:8,fontSize:`xs`,color:v}),X(Nt,{width:`2rem`,pointerEvents:`none`,children:X(K,{fontSize:`2xs`,color:y,children:`%`})})]})]})})]}),Z(B,{justify:`space-between`,children:[Z(K,{fontSize:`xs`,color:y,children:[a(`Fee`),`:`]}),X(K,{fontSize:`xs`,fontWeight:`medium`,color:v,children:Ne>0?`${Ne.toLocaleString(void 0,{maximumFractionDigits:2})} VTHO`:`-`})]})]})}),M&&X(R,{minH:`24px`,display:`flex`,alignItems:`center`,justifyContent:`center`,children:X(z,{variant:`ghost`,size:`xs`,onClick:()=>ie(!re),rightIcon:X(V,{color:b,_hover:{color:y},as:re?fn:cn}),fontSize:`xs`,fontWeight:`light`,color:b,_hover:{color:y},children:a(re?`Hide`:`Show Advanced Options`)})}),ge.length>0&&c.isConnectedWithPrivy&&X(Dr,{estimation:Ie,isLoading:Re,isLoadingTransaction:Je,onTokenChange:Ge,clauses:ge,userSelectedToken:pe})]})}),X(W,{children:X(tt,{buttonText:a(Ce?`Loading quote...`:`Swap`),onConfirm:qe,isSubmitting:Je,isTxWaitingConfirmation:Ye,transactionPendingText:a(`Swapping...`),txReceipt:Ze,transactionError:et,onError:e=>{it(e)},isDisabled:!T||!D||!k||Number(k)<=0||Ce||!M||M?.reverted===!0||!!(ft&&k&&Number(k)>Number(ft.balance))||We,gasEstimationError:Be,hasEnoughGasBalance:Ke,isLoadingGasEstimation:Re,showGasEstimationError:!f?.delegatorUrl&&c.isConnectedWithPrivy,context:`transaction`})})]})},Yr=({setCurrentContent:e,onBack:t=()=>e(`settings`),initialContentSource:n=`settings`})=>{let{t:r}=Q(),{isolatedView:i}=Ue(),a=J(`colors`,`vechain-kit-text-primary`),o=J(`colors`,`vechain-kit-text-secondary`),s=()=>{t()};return Z(Y,{children:[Z(P,{children:[X(G,{"data-testid":`modal-title`,children:r(`Choose your account name`)}),!i&&X(N,{onClick:s}),X(U,{})]}),X(H,{children:Z(q,{spacing:6,align:`center`,py:8,children:[X(V,{as:Zn,boxSize:16,color:o}),Z(q,{spacing:2,children:[X(K,{fontSize:`lg`,fontWeight:`500`,textAlign:`center`,color:a,children:r(`Finally say goodbye to 0x addresses`)}),X(K,{fontSize:`md`,color:o,textAlign:`center`,px:4,children:r(`Name your account to make it easier to exchange assets`)})]})]})}),X(W,{children:X(z,{variant:`vechainKitPrimary`,onClick:()=>e({type:`choose-name-search`,props:{name:``,setCurrentContent:e,initialContentSource:n}}),"data-testid":`choose-name-button`,children:r(`Choose name`)})})]})},Xr=({domain:e,isCurrentDomain:t,onSelect:n})=>{let{connection:r}=A(),{t:i}=Q(),a=E(e.name,r.network),s=J(`colors`,`vechain-kit-card`),l=J(`colors`,`vechain-kit-card-hover`),u=J(`colors`,`vechain-kit-border`),d=J(`colors`,`vechain-kit-text-primary`),f=J(`colors`,`vechain-kit-text-secondary`),p=J(`colors`,`vechain-kit-card`);return X(It,{p:4,bg:s,borderRadius:`xl`,cursor:t?`default`:`pointer`,opacity:t?.7:1,border:`1px solid ${u}`,_hover:{bg:t?l:s,borderColor:u},onClick:()=>!t&&n(e.name),transition:`all 0.2s`,children:Z(B,{spacing:3,align:`center`,children:[X(Tr,{props:{width:`40px`,height:`40px`,src:a.image??c(e.name),alt:e.name}}),Z(q,{align:`start`,spacing:0,flex:1,children:[X(K,{color:d,fontSize:`md`,fontWeight:`500`,children:o(e.name,24,0)}),t&&X(K,{fontSize:`sm`,color:f,children:i(`Current domain`)})]}),t&&X(Vt,{size:`sm`,bg:p,color:d,px:3,py:1,borderRadius:`full`,children:i(`Current`)})]})},e.name)},Zr=({onUnset:e})=>{let t=J(`colors`,`vechain-kit-card`),n=J(`colors`,`vechain-kit-card-hover`),r=J(`colors`,`vechain-kit-border`),i=J(`colors`,`vechain-kit-text-primary`),a=J(`colors`,`vechain-kit-text-secondary`),o=J(`colors`,`vechain-kit-error`),{t:s}=Q();return X(It,{p:4,bg:t,borderRadius:`xl`,cursor:`pointer`,opacity:1,border:`1px solid ${r}`,_hover:{bg:n,borderColor:r,color:`red.400`},onClick:e,transition:`all 0.2s`,role:`button`,"aria-label":s(`Unset current domain`),children:Z(B,{spacing:3,align:`center`,children:[X(R,{width:`40px`,height:`40px`,borderRadius:`full`,display:`flex`,alignItems:`center`,justifyContent:`center`,bg:t,children:X(V,{as:Qn,fontSize:`18px`,color:o})}),Z(q,{align:`start`,spacing:0,flex:1,children:[X(K,{color:i,fontSize:`md`,fontWeight:`500`,children:s(`Unset current domain`)}),X(K,{fontSize:`sm`,color:a,children:s(`Remove your current domain name`)})]})]})},`unset-domain-list-item`)},Qr=({domains:e,onDomainSelect:t,onUnsetDomain:n,isLoading:r})=>{let{t:i}=Q(),{account:a}=A(),o=J(`colors`,`vechain-kit-card`),s=J(`colors`,`vechain-kit-card-hover`),c=J(`colors`,`vechain-kit-text-primary`),l=J(`colors`,`vechain-kit-text-secondary`);return e.length===0||r?null:X(ot,{allowToggle:!0,children:X(ct,{border:`none`,children:({isExpanded:u})=>Z(Y,{children:[Z(st,{bg:o,borderRadius:`xl`,_hover:{bg:s},opacity:r?.7:1,transition:`all 0.2s`,disabled:r,children:[X(R,{flex:`1`,textAlign:`left`,py:2,children:X(K,{fontWeight:`500`,color:c,children:r?i(`Loading your domains...`):`${i(`Your existing domains`)} (${e.length})`})}),X(V,{as:u?xn:yn,fontSize:`20px`,color:l})]}),X(lt,{pb:4,pt:2,children:Z(Ft,{spacing:2,children:[e.map(e=>X(Xr,{domain:e,isCurrentDomain:e.name===a?.domain,onSelect:t},e.name)),a?.domain&&X(Zr,{onUnset:n})]})})]})})})},$r=({name:e,setCurrentContent:t,initialContentSource:r=`settings`})=>{let{t:i}=Q(),{account:a}=A(),{darkMode:o}=n(),{isolatedView:s}=Ue(),[c,l]=L(cr(e)),[u,d]=L(null),[f,p]=L(!1),[m,h]=L(!1),[g,_]=L(!1),v=J(`colors`,`vechain-kit-error`),y=J(`colors`,`vechain-kit-success`),b=J(`colors`,`vechain-kit-text-secondary`),{data:x,isLoading:S}=Re(c),{data:ee,isLoading:C}=ne(`${c}.veworld.vet`),{data:w,isLoading:te}=ve(c),{data:T,isLoading:E}=Ae(a?.address,``),D=S||C||te;it(()=>{if(!g)return;let e=/[^a-zA-Z0-9-]|\s/.test(c);c.length<3?(d(i(`Name must be at least 3 characters long`)),h(!1),p(!1)):e?(d(i(`Only letters, numbers, and hyphens are allowed`)),h(!1),p(!1)):w?(d(i(`This domain is protected`)),h(!1),p(!1)):x?ee?.address?.toLowerCase()===a?.address?.toLowerCase()?(d(null),h(!0),p(!0)):(d(i(`This domain is already taken`)),h(!1),p(!1)):S||(d(null),h(!0),p(!1))},[c,g,x,S,ee,a?.address,w,m,D]);let O=()=>{m&&!u&&t({type:`choose-name-summary`,props:{fullDomain:c+`.veworld.vet`,isOwnDomain:f,setCurrentContent:t,initialContentSource:r}})},k=e=>{let n=e.split(`.`);t({type:`choose-name-summary`,props:{fullDomain:e,domainType:n.length>2?`${n[1]}.${n[2]}`:`vet`,isOwnDomain:!0,setCurrentContent:t,initialContentSource:r}})},re=()=>{t({type:`choose-name-summary`,props:{fullDomain:``,domainType:``,isOwnDomain:!1,isUnsetting:!0,setCurrentContent:t,initialContentSource:r}})},ie=()=>{t(r)};return Z(Y,{children:[Z(P,{children:[X(G,{"data-testid":`modal-title`,children:i(`Choose Name`)}),!s&&X(N,{onClick:ie}),X(U,{})]}),X(H,{children:Z(q,{spacing:4,align:`stretch`,children:[X(Qr,{domains:T?.domains||[],onDomainSelect:k,onUnsetDomain:re,isLoading:E}),Z(jt,{size:`lg`,children:[X(At,{placeholder:i(`Enter your name`),value:c,onChange:e=>{l(cr(e.target.value)),g||_(!0)},paddingRight:`120px`,fontSize:`lg`,height:`60px`,bg:o?`#00000038`:`white`,border:`1px solid ${o?`#ffffff29`:`#ebebeb`}`,_hover:{border:`1px solid ${o?`#ffffff40`:`#e0e0e0`}`},_focus:{border:`1px solid ${o?`#ffffff60`:`#d0d0d0`}`,boxShadow:`none`},isInvalid:!!u,"data-testid":`domain-input`}),X(Nt,{width:`auto`,paddingRight:`12px`,h:`full`,children:X(R,{mr:4,fontSize:`sm`,color:b,children:`.veworld.vet`})})]}),u&&g&&X(K,{color:v,fontSize:`sm`,"data-testid":`domain-availability-status`,children:u}),!u&&g&&c.length>=3&&X(K,{fontSize:`sm`,color:m?y:v,fontWeight:`500`,"data-testid":`domain-availability-status`,children:i(f?`YOU OWN THIS`:m?`AVAILABLE`:`UNAVAILABLE`)})]})}),X(W,{children:X(z,{variant:`vechainKitPrimary`,isDisabled:!m||!!u||w||D,isLoading:D,onClick:O,loadingText:i(`Checking...`),"data-testid":`continue-button`,children:i(`Continue`)})})]})},ei=({setCurrentContent:e,fullDomain:t,domainType:r=`veworld.vet`,isOwnDomain:i,isUnsetting:a=!1,initialContentSource:o=`settings`})=>{let{t:s}=Q(),c=J(`colors`,`vechain-kit-text-primary`),{isolatedView:l,closeAccountModal:u}=Ue(),{account:d,connectedWallet:f,connection:p}=A(),{data:m}=ge(d?.address??``,f?.address??``,3),{open:h}=Ye(),{preferences:g}=ae(),{feeDelegation:_}=n(),v=e=>{console.error(`Transaction failed:`,e)},y=Ze({onSuccess:()=>D()}),b=r.endsWith(`veworld.vet`),x=Ee({subdomain:t.split(`.veworld.vet`)[0],domain:r,alreadyOwned:i,onSuccess:()=>D()}),S=we({domain:!a&&!b?t:``,alreadyOwned:i,onSuccess:()=>D()}),{sendTransaction:ee,txReceipt:C,error:w,isWaitingForWalletConfirmation:te,isTransactionPending:T,clauses:E}=a?y:b?x:S,D=()=>{e({type:`successful-operation`,props:{setCurrentContent:e,txId:C?.meta.txID,title:s(a?`Domain unset`:`Domain set`),description:a?s(`Your domain has been unset successfully.`):s(`Your address has been successfully set to {{name}}`,{name:t}),onDone:()=>{l?u():e(o)}}})},O=async()=>{if(m){h();return}try{await ee()}catch(e){console.error(`Transaction failed:`,e)}},k=()=>{O()},ne=()=>{e({type:`choose-name-search`,props:{setCurrentContent:e,name:t,initialContentSource:o}})},[re,ie]=F.useState(null),[j,oe]=F.useState(null),se=g.availableGasTokens.length>0&&(p.isConnectedWithPrivy||p.isConnectedWithVeChain)&&!_?.delegatorUrl,{data:ce,isLoading:le,error:ue,refetch:de}=Le({clauses:E(),tokens:re?[re]:g.availableGasTokens,enabled:se&&!!_?.genericDelegatorUrl}),fe=ce?.usedToken,pe=(le||!ce)&&p.isConnectedWithPrivy&&!_?.delegatorUrl,me=F.useCallback(e=>{ie(e),oe(e),setTimeout(()=>de(),100)},[de]),he=!!fe&&!ue;return F.useEffect(()=>{ue&&re&&ie(null)},[ue,re]),Z(Y,{children:[Z(P,{children:[X(G,{"data-testid":`confirm-domain`,children:s(a?`Confirm Unset Domain`:`Confirm Name`)}),X(N,{onClick:ne,isDisabled:T}),X(U,{isDisabled:T})]}),Z(H,{children:[Z(q,{spacing:6,align:`center`,mt:10,children:[X(V,{as:Zn,color:c,fontSize:`60px`,opacity:.5}),X(K,{fontSize:`md`,textAlign:`center`,color:c,children:a?s(`By confirming, your current domain will be unset`):s(`By confirming, your address will be set to {{domain}}`,{domain:t})})]}),!a&&X(q,{spacing:4,align:`stretch`,mt:6,children:X(K,{fontSize:`xl`,fontWeight:`bold`,color:c,textAlign:`center`,"data-testid":`preconfirm-domain-val`,children:t})}),p.isConnectedWithPrivy&&X(Dr,{estimation:ce,isLoading:le,isLoadingTransaction:T,onTokenChange:me,clauses:E(),userSelectedToken:j})]}),X(W,{gap:4,w:`full`,children:X(tt,{transactionError:w,isSubmitting:T,isTxWaitingConfirmation:te,onConfirm:O,onRetry:k,transactionPendingText:s(a?`Unsetting current domain...`:`Claiming name...`),txReceipt:C,buttonText:s(`Confirm`),isDisabled:T||pe,onError:v,gasEstimationError:ue,hasEnoughGasBalance:he,isLoadingGasEstimation:le,showGasEstimationError:!_?.delegatorUrl&&p.isConnectedWithPrivy,context:`domain`})})]})},ti=()=>{let{t:e}=Q(),[t,n]=L(``),r=J(`colors`,`vechain-kit-card`),i=J(`colors`,`vechain-kit-text-secondary`),a=J(`colors`,`vechain-kit-text-tertiary`),o=J(`colors`,`vechain-kit-card`),s=J(`colors`,`vechain-kit-card-elevated`),c=[{question:e(`What is VeChain?`),answer:e(`VeChain, headquartered in San Marino, Europe, is a pioneering blockchain ecosystem and creator of VeChainThor, a world-class smart contract platform driving real-world blockchain adoption. Founded in 2015 by Sunny Lu, VeChain has consistently worked to deliver a transparent, efficient, scalable, and adaptable blockchain solution.`)},{question:e(`What is a wallet?`),answer:e(`A wallet is your gateway to the VeChain blockchain. It stores your private keys and allows you to securely manage your digital assets, send and receive tokens, and interact with decentralized applications. Think of it as your digital bank account for blockchain transactions.`)},{question:e(`What is a Smart Account?`),answer:e(`A Smart Account is a smart contract wallet that provides enhanced security and functionality. It allows for features like social recovery, transaction batching, and more.`)},{question:e(`How is my wallet secured?`),answer:e(`Your wallet security depends on how you access it. With self-custody options like the VeWorld extension, mobile app, or hardware wallet, you have complete control over your private keys. This extension itself has no access to your private keys. When logging in with social accounts or VeChain, your wallet is created and secured by Privy and managed by VeChain, providing an easier onboarding experience while maintaining security.`)},{question:e(`How do I backup my wallet?`),answer:e(`Backing up your wallet is crucial as you are the only one with access to your private keys. If something goes wrong, having your private key is the only way to recover your assets. How to backup depends on how you access your wallet: If using VeWorld, the backup option is available within the app. For social login users, you can find backup options in the Wallet section. If you're connected through VeChain or another ecosystem app, you'll need to visit the original website, log in, and access the Wallet section from there.`)},{question:e(`What is a network?`),answer:e(`A network in blockchain refers to the environment where transactions take place. VeChain has two main networks: Mainnet (the live network where real transactions occur) and Testnet (a testing environment for developers). The network you're connected to is displayed at the top of this modal.`)},{question:e(`What is a domain name?`),answer:e(`A domain name is a sort of nickname for your wallet address. It allows you to easily identify your wallet and interact with dApps using a human-readable name. For example, if your wallet address is 0x1234567890, your nickname could be "alice.vechain".`)},{question:e(`What is Privy?`),answer:e(`Privy builds user onboarding and embedded wallet infrastructure to enable better products built on crypto rails. This means embedding asset control within applications themselves to enable users, businesses or machines to use digital assets through seamless product experiences.`)},{question:e(`What is VeBetterDAO?`),answer:e(`VeBetterDAO is a decentralized organization on VeChain blockchain focused on sustainability. Members participate in the governance of the DAO using B3TR tokens for rewards and VOT3 for voting in proposals and weekly token allocation rounds.`)},{question:e(`What is an x2earn application?`),answer:e(`An X2Earn application in VeBetterDAO is a sustainable app that rewards users with B3TR tokens for eco-friendly actions. These apps must distribute B3TR, link user wallets, and provide proof of sustainable actions. They join VeBetterDAO through endorsement and participate in weekly token allocation rounds.`)},{question:e(`What is B3TR?`),answer:e(`B3TR is the incentive token of VeBetterDAO, built on VechainThor blockchain. It has a capped supply of 1 billion tokens, emitted weekly over 12 years. B3TR is used for rewards, governance, and backing VOT3 tokens 1:1. It supports sustainability applications and DAO treasury management.`)},{question:e(`What is VET?`),answer:e(`VET is the primary cryptocurrency of the VeChain network. It represents value and ownership in the VeChain ecosystem, similar to how stocks represent ownership in a company. Holding VET automatically generates VTHO, which is needed to pay for transactions on the network.`)},{question:e(`What is VTHO?`),answer:e(`VTHO (VeThor) is the energy or 'gas' token of the VeChain network. It's used to pay for transaction fees when interacting with the blockchain. VTHO is automatically generated by holding VET tokens, creating a two-token system that helps maintain network stability and manage transaction costs.`)},{question:e(`How do I send tokens?`),answer:e(`You can send tokens by clicking the send icon in the Quick Actions section. Enter the recipient's address or VeChain domain name, select the token, and specify the amount you want to send.`)},{question:e(`What is fee delegation?`),answer:e(`Fee delegation is a unique feature of VeChain that allows someone else (a delegator) to pay for your transaction fees. While many dApps and service providers act as delegators to make it easier for new users to get started, some transactions may still require you to pay fees using your own VTHO. Fees are necessary to prevent network spam and compensate the nodes that process and validate transactions on the blockchain. When paying fees yourself, you'll be able to select VTHO from your assets to cover the transaction cost.`)}].filter(e=>e.question.toLowerCase().includes(t.toLowerCase())||typeof e.answer==`string`&&e.answer.toLowerCase().includes(t.toLowerCase()));return Z(q,{spacing:4,align:`stretch`,children:[Z(jt,{size:`lg`,children:[X(At,{placeholder:e(`Search FAQ`),bg:r,borderRadius:`xl`,height:`56px`,pl:12,value:t,onChange:e=>n(e.target.value)}),X(Mt,{h:`56px`,w:`56px`,pl:4,children:X(Kn,{color:a})})]}),c.length===0?Z(q,{spacing:2,py:8,color:i,children:[X(V,{as:Xn,boxSize:12,opacity:.5}),X(K,{fontSize:`lg`,children:e(`No questions found`)}),X(K,{fontSize:`md`,children:e(`Try searching with a different term`)})]}):X(ot,{allowMultiple:!0,children:c.map((e,t)=>X(ct,{border:`none`,mb:2,children:({isExpanded:t})=>Z(Y,{children:[Z(st,{bg:o,borderRadius:`xl`,color:i,_hover:{bg:s},children:[X(R,{flex:`1`,textAlign:`left`,py:2,children:X(K,{fontWeight:`500`,color:i,children:e.question})}),X(V,{as:t?xn:yn,fontSize:`20px`,opacity:.5})]}),X(lt,{pb:4,children:X(K,{fontSize:`sm`,color:i,opacity:.8,children:e.answer})})]})},t))})]})},ni=({onGoBack:e,showLanguageSelector:t=!0})=>{let{i18n:n,t:r}=Q(),{isolatedView:i}=Ue(),a=J(`colors`,`vechain-kit-card`),o=J(`colors`,`vechain-kit-border`),s=J(`colors`,`vechain-kit-border-hover`);return Z(wr,{children:[Z(P,{children:[X(G,{children:r(`Help`)}),!i&&X(N,{onClick:e}),X(U,{})]}),X(H,{w:`full`,children:Z(q,{spacing:6,align:`stretch`,children:[t&&X(Lt,{borderRadius:`md`,size:`sm`,width:`auto`,value:n.language,onChange:e=>{n.changeLanguage(e.target.value)},bg:a,borderColor:o,_hover:{borderColor:s},children:le.map(e=>X(`option`,{value:e,children:oe[e]},e))}),X(z,{as:Pt,href:b,isExternal:!0,variant:`vechainKitSecondary`,rightIcon:X(V,{as:On}),children:r(`For developers`)}),X(ti,{})]})}),X(W,{pt:0})]})},ri=({setCurrentContent:e,initialContentSource:t=`profile`})=>{let{t:r}=Q(),{network:i}=n(),{account:o}=A(),s=J(`colors`,`vechain-kit-text-primary`),c=J(`colors`,`vechain-kit-error`),l=J(`colors`,`vechain-kit-card`),u=at(null),d=at(null),[f,p]=L(!1),{onUpload:m}=Se({compressImage:!0}),[h,g]=L(null),[_,v]=L(null),y=!!o?.domain,[b,x]=L(null),[S,ee]=L(``),[C,w]=L(``),{register:te,watch:T,formState:{errors:E,isValid:D}}=sr({defaultValues:{displayName:o?.metadata?.display||``,description:o?.metadata?.description||``},mode:`onChange`});it(()=>{if(o?.metadata){let e=o.metadata;ee(e.display||``),w(e.description||``),x(o.image?o.image.replace(`ipfs://`,``):null),g(e=>e??o.image??null)}},[o,i.type]);let O=T(),k=async e=>{let t=e.target.files?.[0];if(t)try{p(!0),h&&URL.revokeObjectURL(h),g(URL.createObjectURL(t));let e=await m(t);if(!e)throw Error(`Failed to compress image`);v(await a(e.file,t.name,i.type))}catch(e){console.error(`Error uploading image:`,e),g(null)}finally{p(!1)}};it(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);let ne=()=>{let e={};return _!==b&&_&&(e.avatarIpfsHash=_),O.displayName!==S&&(e.displayName=O.displayName),O.description!==C&&(e.description=O.description),e},re=I(()=>{let e=ne();return Object.keys(e).length>0},[ne]),ie=()=>{e({type:`account-customization-summary`,props:{setCurrentContent:e,changes:ne(),onDoneRedirectContent:t}})},j=()=>{e(t)};return Z(Y,{children:[Z(P,{children:[X(G,{"data-testid":`modal-title`,children:r(`Customization`)}),X(N,{onClick:j}),X(U,{})]}),Z(H,{children:[Z(R,{cursor:y?`pointer`:`default`,pt:2,display:`flex`,justifyContent:`center`,position:`relative`,onClick:()=>y&&u.current?.click(),children:[X(Tr,{wallet:o,props:{width:`100px`,height:`100px`,boxShadow:`0px 0px 3px 2px #00000024`,src:h??void 0}}),y&&X(V,{as:_n,position:`absolute`,top:`80px`,left:`60%`,bg:l,color:s,p:`1`,borderRadius:`full`,boxSize:`6`}),f&&X(R,{display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`rgba(0, 0, 0, 0.5)`,position:`absolute`,transform:`translateX(0%)`,width:`100px`,height:`100px`,borderRadius:`full`,zIndex:10,children:X(K,{fontSize:`xs`,color:`white`,children:f?`Uploading...`:`Processing...`})})]}),Z(q,{spacing:6,mt:4,children:[!y&&X(zr,{}),X($,{title:o?.domain??r(`Choose account name`),description:r(`Choose a unique .vet domain name for your account.`),onClick:()=>{o?.domain?e({type:`choose-name-search`,props:{name:``,setCurrentContent:e,initialContentSource:{type:`account-customization`,props:{setCurrentContent:e}}}}):e({type:`choose-name`,props:{setCurrentContent:e,initialContentSource:{type:`account-customization`,props:{setCurrentContent:e}},onBack:()=>e({type:`account-customization`,props:{setCurrentContent:e}})}})},leftIcon:Zn,rightIcon:bn,dataTestId:`set-domain-name-button`}),Z(Ct,{isDisabled:!y,isInvalid:!!E.displayName,children:[X(wt,{fontSize:`sm`,fontWeight:`medium`,color:s,children:r(`Display Name`)}),X(At,{...te(`displayName`,{maxLength:{value:25,message:r(`Display name must be less than 25 characters`)}}),placeholder:r(y?`Enter your display name`:`Set a domain first`),fontWeight:`medium`,color:s,"data-testid":`display-name-input`}),E.displayName&&X(K,{color:c,fontSize:`sm`,mt:1,fontWeight:`medium`,children:E.displayName.message})]}),Z(Ct,{isDisabled:!y,isInvalid:!!E.description,children:[X(wt,{fontSize:`sm`,fontWeight:`medium`,color:s,children:r(`Description`)}),X(Ht,{...te(`description`,{maxLength:{value:100,message:r(`Description must be less than 100 characters`)}}),placeholder:r(`Eg: DevRel @ ENS Labs`),fontWeight:`medium`,color:s,"data-testid":`description-input`,minH:`50px`}),E.description&&X(K,{color:c,mt:1,fontSize:`sm`,fontWeight:`medium`,children:E.description.message})]})]}),X(`input`,{type:`file`,ref:u,hidden:!0,accept:`image/*`,onChange:async e=>await k(e)}),X(`input`,{type:`file`,ref:d,hidden:!0,accept:`image/*`,onChange:async e=>{e.preventDefault()}})]}),X(W,{w:`full`,children:X(z,{variant:`vechainKitPrimary`,onClick:ie,isDisabled:!y||!re||!D,isLoading:f,loadingText:r(`Preparing changes...`),"data-testid":`save-changes-button`,children:r(`Save Changes`)})})]})},ii=({setCurrentContent:e,changes:t,onDoneRedirectContent:r})=>{let{t:i}=Q(),{darkMode:a,network:o,feeDelegation:s}=n(),c=J(`colors`,`vechain-kit-text-primary`),{account:l,connectedWallet:u,connection:d}=A(),{preferences:p}=ae(),{data:m}=ge(l?.address??``,u?.address??``,3),{open:h}=Ye(),{handleSubmit:g}=sr({defaultValues:{...t,avatarIpfsHash:t.avatarIpfsHash??void 0}}),_=l?.domain??``,{data:v}=Ce(_),y=Xt(),{sendTransaction:b,txReceipt:x,error:S,isWaitingForWalletConfirmation:ee,isTransactionPending:C,clauses:w}=ye({resolverAddress:v,signerAccountAddress:l?.address??``,onSuccess:async()=>{try{await xe()}catch(e){console.error(`Error refreshing data:`,e)}},onError:e=>{console.error(`Error updating text record:`,e)}}),[te,T]=F.useState(!1);F.useEffect(()=>{if(!x||x.reverted||te||C)return;let t=x.meta.txID;t&&(T(!0),e({type:`successful-operation`,props:{setCurrentContent:e,txId:t,title:i(`Profile Updated`),description:i(`Your changes have been saved successfully.`),onDone:()=>{e(r)}}}))},[x,te,C,e,i,r]),F.useEffect(()=>{C&&T(!1)},[C]);let E=I(()=>{let e=l?.domain??``,n={displayName:`display`,description:`description`,twitter:`com.x`,website:`url`,email:`email`,avatarIpfsHash:`avatar`};return Object.entries(t).filter(e=>e[1]!==void 0&&e[1]!==null).map(([t,r])=>({domain:e,key:n[t],value:t===`avatarIpfsHash`?`ipfs://${r}`:r}))},[t,l?.domain]),D=I(()=>{try{return!v||E.length===0||!w?[]:w(E)}catch(e){return console.error(`Error building clauses:`,e),[]}},[E,w,v]),[O,ne]=F.useState(null),[re,ie]=F.useState(null),j=p.availableGasTokens.length>0&&(d.isConnectedWithPrivy||d.isConnectedWithVeChain)&&!s?.delegatorUrl,{data:oe,isLoading:ce,error:le,refetch:ue}=Le({clauses:D,tokens:O?[O]:p.availableGasTokens,enabled:j&&!!s?.genericDelegatorUrl}),de=oe?.usedToken,fe=(ce||!oe)&&d.isConnectedWithPrivy&&!s?.delegatorUrl,pe=F.useCallback(e=>{ne(e),ie(e),setTimeout(()=>ue(),100)},[ue]),me=!!de&&!le;F.useEffect(()=>{le&&O&&ne(null)},[le,O]);let he=async()=>{if(m){h();return}try{E.length>0&&await b(E)}catch(e){console.error(`Error saving changes:`,e)}},_e=(e,t)=>t?.trim()?Z(q,{align:`flex-start`,w:`full`,spacing:1,children:[X(K,{fontSize:`sm`,color:a?`whiteAlpha.600`:`blackAlpha.600`,children:e}),X(K,{fontSize:`md`,children:t})]}):null,ve=()=>{g(he)()},be=()=>{e({type:`account-customization`,props:{setCurrentContent:e}})},xe=async()=>{t.avatarIpfsHash&&(y.setQueryData(He(_,o.type),f(`ipfs://`+t.avatarIpfsHash,o.type)),y.setQueryData(k(l?.address??``),f(`ipfs://`+t.avatarIpfsHash,o.type))),await y.invalidateQueries({queryKey:se(_,o.type)}),await y.refetchQueries({queryKey:se(_,o.type)})};return Z(Y,{children:[Z(P,{children:[X(G,{children:i(`Confirm Changes`)}),X(N,{isDisabled:C,onClick:be}),X(U,{isDisabled:C})]}),Z(H,{children:[Z(q,{spacing:6,align:`center`,mt:10,children:[X(V,{as:kn,color:c,fontSize:`60px`,opacity:.5}),X(K,{fontSize:`md`,textAlign:`center`,color:c,children:i(`By confirming, the following details attached to your name ({{domain}}) will be updated`,{domain:_})})]}),Z(q,{spacing:4,align:`stretch`,mt:6,children:[t.avatarIpfsHash&&Z(q,{align:`flex-start`,w:`full`,spacing:1,children:[X(K,{fontSize:`sm`,color:a?`whiteAlpha.600`:`blackAlpha.600`,children:i(`Profile Image`)}),X(K,{fontSize:`md`,children:i(`New image selected`)})]}),t.displayName&&_e(i(`Display Name`),t.displayName),t.description&&_e(i(`Description`),t.description),t.twitter&&_e(i(`Twitter`),t.twitter),t.website&&_e(i(`Website`),t.website),t.email&&_e(i(`Email`),t.email)]}),d.isConnectedWithPrivy&&X(Dr,{estimation:oe,isLoading:ce,isLoadingTransaction:C,onTokenChange:pe,clauses:D,userSelectedToken:re})]}),X(W,{gap:4,w:`full`,children:X(tt,{transactionError:S,isSubmitting:C,isTxWaitingConfirmation:ee,onConfirm:g(he),onRetry:ve,transactionPendingText:i(`Saving changes...`),txReceipt:x,buttonText:i(`Confirm`),isDisabled:C||fe,gasEstimationError:le,hasEnoughGasBalance:me,isLoadingGasEstimation:ce,showGasEstimationError:!s?.delegatorUrl&&d.isConnectedWithPrivy,context:`customization`})})]})},ai=({address:e,showHeader:t=!0,showLinks:r=!0,showDescription:i=!0,showDisplayName:a=!0,setCurrentContent:o,onLogout:s})=>{let{network:l}=n(),u=J(`colors`,`vechain-kit-text-primary`),d=J(`colors`,`vechain-kit-text-secondary`),f=J(`colors`,`vechain-kit-card`),p=E(e,l.type),m=c(e),h=p?.records?.url||p?.records?.[`com.x`]||p?.records?.email,g=e=>{try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`?t.toString():null}catch{return null}};return Z(q,{spacing:0,w:`full`,children:[X(R,{p:0,backgroundSize:`100% !important`,backgroundPosition:`center`,position:`relative`,background:t?`no-repeat url('${m}')`:`none`,w:`100%`,borderRadius:`14px 14px 0 0`}),Z(R,{position:`relative`,display:`inline-block`,cursor:o?`pointer`:`default`,onClick:o?()=>{o({type:`account-customization`,props:{setCurrentContent:o,initialContentSource:`profile`}})}:void 0,children:[X(Tr,{wallet:{address:e,domain:p?.domain,image:p?.image,isLoadingMetadata:p?.isLoading,metadata:p?.records},props:{width:`120px`,height:`120px`}}),o&&X(V,{as:Hn,position:`absolute`,bottom:`0`,right:`0`,bg:f,color:u,p:`1`,borderRadius:`full`,boxSize:`6`,border:`2px solid`,borderColor:f})]}),Z(q,{w:`full`,spacing:2,children:[a&&p?.records?.display&&X(K,{fontSize:`xl`,color:u,fontWeight:`bold`,w:`full`,textAlign:`center`,mt:2,"data-testid":`display-name-val`,children:p?.records?.display}),i&&p?.records?.description&&X(K,{fontSize:`sm`,color:d,w:`full`,textAlign:`center`,"data-testid":`description-val`,children:p?.records?.description}),r&&h&&Z(B,{w:`full`,justify:`center`,spacing:5,mt:4,children:[p?.records?.email&&X(Pt,{href:`mailto:${p?.records?.email}`,target:`_blank`,"data-testid":`mail-link`,children:X(V,{as:Bn,color:u})}),p?.records?.url&&X(Pt,{href:g(p.records.url)??void 0,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`website-link`,children:X(V,{as:Pn,color:u})}),p?.records?.[`com.x`]&&X(Pt,{href:`https://x.com/${encodeURIComponent(String(p.records[`com.x`]))}`,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`twitter-link`,children:X(V,{as:ir,color:u})})]}),X(vr,{onLogout:s,wallet:{address:e,domain:p?.domain,image:p?.image,isLoadingMetadata:p?.isLoading,metadata:p?.records},style:{mt:4},setCurrentContent:o})]})]})},oi=({onClick:e,...t})=>{let{smartAccount:n,connectedWallet:r,connection:i}=A(),[a,o]=L(!1);it(()=>{o(!localStorage.getItem(`app-first-visit`))},[]);let{data:s}=ge(n?.address??``,r?.address??``,3),c=i.isConnectedWithPrivy&&s,l=()=>{a&&(localStorage.setItem(`app-first-visit`,`true`),o(!1)),e()};return X(Ot,{"aria-label":`Settings`,size:`sm`,variant:`vechainKitHeaderIconButtons`,position:`absolute`,left:`10px`,top:`8px`,lineHeight:`0`,onClick:l,icon:Z(R,{position:`relative`,children:[X(V,{as:qn,fontSize:`18px`}),c&&X(R,{position:`absolute`,top:`-1px`,right:`-1px`,minWidth:`8px`,height:`8px`,bg:`red.500`,borderRadius:`full`})]}),...t})},si=({setCurrentContent:e,onLogoutSuccess:t,switchFeedback:n})=>{let{t:r}=Q(),{account:i,disconnect:a,connection:o}=A(),{switchWallet:s,isSwitching:c,isInAppBrowser:l}=Ve(),{isSwitchWalletEnabled:u}=O(),{hasAnyBalance:d,formattedBalance:f}=We({address:i?.address}),[p]=fe(de.SHOW_ASSETS,!0),m=()=>{l?s():e({type:`select-wallet`,props:{setCurrentContent:e,onClose:()=>{},returnTo:`profile`,onLogoutSuccess:t}})};return Z(Y,{children:[Z(P,{children:[X(G,{"data-testid":`modal-title`,children:r(`Profile`)}),X(oi,{onClick:()=>{e(`settings`)},"data-testid":`settings-button`}),X(U,{})]}),X(H,{w:`full`,children:Z(q,{w:`full`,spacing:6,children:[X(jr,{showFeedback:n?.showFeedback}),!i?.domain&&X(Rr,{setCurrentContent:e}),X(ai,{onEditClick:()=>{e({type:`account-customization`,props:{setCurrentContent:e,initialContentSource:`profile`}})},address:i?.address??``,showHeader:!1,setCurrentContent:e,onLogout:()=>{a(),t?.()}})]})}),X(W,{w:`full`,children:Z(B,{w:`full`,justify:`space-between`,spacing:4,mt:4,children:[X(z,{size:`md`,width:`full`,height:`40px`,variant:`vechainKitSecondary`,leftIcon:d?void 0:X(V,{as:nr}),onClick:()=>e(`main`),"data-testid":`wallet-button`,children:d?Z(B,{spacing:2,w:`full`,justify:`center`,children:[X(Nr,{address:i?.address??``,maxIcons:2}),X(K,{fontWeight:`600`,children:p?f:f[0]+`*`.repeat(f.slice(1).length)})]}):r(`Wallet`)}),o.isInAppBrowser&&u||!o.isInAppBrowser&&o.isConnectedWithDappKit?X(z,{size:`md`,width:`full`,height:`40px`,variant:`vechainKitSecondary`,leftIcon:X(V,{as:un}),colorScheme:`red`,onClick:async()=>{m()},isLoading:c,isDisabled:c,"data-testid":`switch-wallet-button`,children:r(`Switch`)}):X(z,{size:`md`,width:`full`,height:`40px`,variant:`vechainKitSecondary`,leftIcon:X(V,{as:zn}),colorScheme:`red`,onClick:()=>e({type:`disconnect-confirm`,props:{onDisconnect:()=>{a(),t?.()},onBack:()=>e?.(`profile`)}}),"data-testid":`logout-button`,children:r(`Logout`)})]})})]})},ci=({setCurrentContent:e,handleClose:t,initialContent:n=`settings`})=>{let{t:r}=Q(),{smartAccount:i,connectedWallet:a}=A(),{data:o}=ge(i?.address??``,a?.address??``,3),{sendTransaction:s,isTransactionPending:c,isWaitingForWalletConfirmation:l,error:u,txReceipt:d}=xe({smartAccountAddress:i?.address??``,targetVersion:3,onSuccess:()=>{e({type:`successful-operation`,props:{setCurrentContent:e,txId:d?.meta.txID,title:r(`Upgrade Successful!`),description:r(`Your account has been successfully upgraded to the latest version. You can now enjoy a better user experience, lower gas costs, and enhanced security.`),onDone:()=>{t?t():e(n)},showSocialButtons:!1}})},onError:()=>{console.error(`Error upgrading Smart Account`)}});return Z(Y,{children:[Z(P,{children:[X(G,{children:r(`Account upgrade required`)}),X(N,{onClick:()=>{e(n)}}),X(U,{})]}),X(H,{children:Z(q,{spacing:10,align:`stretch`,children:[X(K,{fontSize:`sm`,textAlign:`center`,children:r(o?`Your smart account needs to be upgraded to the latest version (v3).`:`Your smart account is already upgraded to this version.`)}),Z(B,{align:`center`,justifyContent:`space-evenly`,rounded:`md`,children:[Z(R,{position:`relative`,display:`inline-block`,children:[X(vt,{size:`60px`,bg:`gray.200`,children:X(kt,{borderRadius:`full`,src:i?.image,alt:r(`Profile Picture`),w:`100%`,h:`100%`,objectFit:`cover`})}),X(Dt,{position:`absolute`,top:`-5`,right:`-5`,color:`#D23F63`,fontSize:`28px`,children:`v1`})]}),X(V,{as:dn,color:`#3DBA67`}),Z(R,{position:`relative`,display:`inline-block`,children:[X(vt,{size:`60px`,bg:`gray.200`,children:X(kt,{borderRadius:`full`,src:i?.image,alt:r(`Profile Picture`),w:`100%`,h:`100%`,objectFit:`cover`})}),X(Dt,{position:`absolute`,top:`-5`,right:`-5`,color:`#3DBA67`,fontSize:`28px`,children:`v3`})]})]}),Z(ut,{status:`info`,borderRadius:`md`,children:[X(ft,{}),Z(R,{children:[X(pt,{fontSize:`sm`,children:r(`Benefits of this upgrade:`)}),X(dt,{fontSize:`xs`,children:Z(q,{align:`start`,spacing:0,mt:1,children:[Z(K,{fontSize:`xs`,lineHeight:`1.2`,children:[`• `,r(`Improved security features`)]}),Z(K,{fontSize:`xs`,children:[`• `,r(`Better transaction handling`)]}),Z(K,{fontSize:`xs`,children:[`•`,` `,r(`Enhanced compatibility with dApps`)]}),Z(K,{fontSize:`xs`,children:[`•`,` `,r(`Reduced gas costs for operations`)]})]})})]})]})]})}),X(W,{justifyContent:`center`,children:Z(q,{spacing:3,w:`full`,children:[X(tt,{buttonText:r(o?`Upgrade account`:`Account already upgraded`),onConfirm:async()=>{try{await s()}catch(e){console.error(`Failed to upgrade Smart Account:`,e)}},isTxWaitingConfirmation:l,isSubmitting:c,transactionPendingText:r(`Upgrading...`),txReceipt:d,transactionError:u,isDisabled:!o}),X(z,{mt:2,variant:`link`,onClick:()=>{t?t():e(n)},isDisabled:c,children:r(o?`Close and do this later`:`Close`)})]})})]})},li=({setCurrentContent:e})=>{let{account:t}=A(),{sortedTokens:r}=ze({address:t?.address}),{allowCustomTokens:i,darkMode:a}=n(),{currentCurrency:o}=Pe(),s=J(`colors`,`vechain-kit-text-tertiary`),{t:c}=Q(),{isolatedView:l}=Ue(),[u,d]=L(``),f=t=>{e({type:`send-token`,props:{setCurrentContent:e,preselectedToken:t,onBack:()=>e(`assets`)}})},p=r.filter(({symbol:e})=>e.toLowerCase().includes(u.toLowerCase()));return Z(Y,{children:[Z(P,{children:[X(G,{children:c(`Assets`)}),!l&&X(N,{onClick:()=>e(`main`)}),X(U,{})]}),Z(bt,{h:[`540px`,`auto`],p:0,children:[Z(H,{children:[Z(jt,{size:`lg`,children:[X(At,{placeholder:`Search token`,bg:a?`#00000038`:`gray.50`,borderRadius:`xl`,height:`56px`,pl:12,value:u,onChange:e=>d(e.target.value),"data-testid":`search-token-input`}),X(Mt,{h:`56px`,w:`56px`,pl:4,children:X(Kn,{color:s})})]}),X(q,{spacing:2,align:`stretch`,mt:2,children:p.map(e=>{let t=Number(e.balance)>0;return X(Sr,{symbol:e.symbol,amount:Number(e.balance),currencyValue:e.valueInCurrency,currentCurrency:o,onClick:()=>f(e),isDisabled:!t},e.address)})})]}),X(W,{children:i&&X(z,{variant:`vechainKitSecondary`,leftIcon:X(V,{as:Hn,boxSize:4}),onClick:()=>e(`add-custom-token`),children:c(`Manage Custom Tokens`)})})]})]})},ui=({setCurrentContent:e})=>{let{t}=Q(),n=J(`colors`,`vechain-kit-text-primary`),r=J(`colors`,`vechain-kit-text-secondary`),i=J(`colors`,`vechain-kit-card`),a=J(`colors`,`vechain-kit-overlay`),{addToken:o,removeToken:c,isTokenIncluded:u,isDefaultToken:d,customTokens:f}=_e(),{register:p,setError:m,setValue:h,formState:{errors:g,isValid:_},handleSubmit:v}=sr({defaultValues:{newTokenAddress:``},mode:`onChange`}),y=async e=>{if(e.newTokenAddress){if(u(e.newTokenAddress)||d(e.newTokenAddress))return m(`newTokenAddress`,{type:`manual`,message:t(`Token already added`)});try{await o(e.newTokenAddress),h(`newTokenAddress`,``)}catch(e){console.error(`Error adding token 2:`,e),m(`newTokenAddress`,{type:`manual`,message:t(`Invalid token address`)})}}};return Z(Y,{children:[Z(P,{children:[X(G,{children:t(`Manage Custom Tokens`)}),X(N,{onClick:()=>e(`assets`)}),X(U,{})]}),X(H,{children:Z(q,{spacing:4,align:`stretch`,position:`relative`,children:[X(R,{p:6,borderRadius:`xl`,bg:i,children:X(q,{align:`stretch`,spacing:2,children:Z(Ct,{isInvalid:!!g.newTokenAddress,children:[X(wt,{fontSize:`sm`,fontWeight:`medium`,color:n,children:t(`Token Contract Address`)}),X(At,{...p(`newTokenAddress`,{required:t(`Address is required`),pattern:{value:/^0x[a-fA-F0-9]{40}$/,message:t(`Please enter a valid contract address`)},validate:e=>/^0x[a-fA-F0-9]{40}$/.test(e)||t(`Invalid contract address`)}),onChange:e=>{let t=e.target.value.trim();e.target.value=t,h(`newTokenAddress`,t,{shouldValidate:!0})},placeholder:`0x...`,variant:`outline`,fontSize:`md`,fontWeight:`medium`}),g.newTokenAddress&&X(K,{color:`#ef4444`,fontSize:`sm`,children:g.newTokenAddress.message})]})})}),f.length>0&&Z(R,{p:4,borderRadius:`xl`,bg:a,children:[X(K,{fontSize:`sm`,fontWeight:`medium`,mb:2,children:t(`Existing Custom Tokens`)}),X(q,{align:`stretch`,spacing:2,children:f.map(e=>Z(B,{justify:`space-between`,fontSize:`sm`,p:2,borderRadius:`md`,bg:i,children:[Z(B,{children:[X(kt,{src:s[e?.symbol],alt:`${e.symbol} logo`,boxSize:`20px`,borderRadius:`full`,fallback:X(R,{boxSize:`20px`,borderRadius:`full`,bg:`whiteAlpha.200`,display:`flex`,alignItems:`center`,justifyContent:`center`,children:X(K,{fontSize:`8px`,fontWeight:`bold`,color:n,children:e.symbol?.slice(0,3)})})}),X(K,{fontWeight:`medium`,color:n,children:e.symbol??`Unknown`})]}),X(K,{color:r,children:l(e.address??``,4,4)}),X(z,{size:`sm`,variant:`ghost`,color:n,borderRadius:`md`,p:2,onClick:()=>c(e.address),children:X(Qn,{size:16,color:n})})]},e.address))})]})]})}),X(W,{children:X(z,{variant:`vechainKitPrimary`,isDisabled:!_,onClick:v(y),children:t(`Add Token`)})})]})},di=({setCurrentContent:e})=>{let{t}=Q(),{currentCurrency:n,changeCurrency:r,allCurrencies:a}=Pe(),o=qt(`rgba(0, 0, 0, 0.1)`,`rgba(255, 255, 255, 0.05)`);it(()=>{te(`settings-currency-visited`,`true`)},[]);let s=e=>{let t=n===e;return Z(z,{w:`full`,variant:`ghost`,justifyContent:`space-between`,onClick:()=>r(e),py:6,px:4,bg:t?o:void 0,children:[Z(B,{spacing:3,children:[X(K,{fontSize:`xl`,children:i[e]}),X(K,{children:e.toUpperCase()})]}),t&&X(V,{as:vn,boxSize:5,color:`blue.500`})]},e)};return Z(wr,{children:[Z(P,{children:[X(G,{children:t(`Select currency`)}),X(N,{onClick:()=>e(`settings`)}),X(U,{})]}),X(H,{w:`full`,children:X(q,{justify:`center`,spacing:3,align:`flex-start`,w:`full`,children:a.map(e=>s(e))})}),X(W,{pt:0})]})},fi=({setCurrentContent:e})=>{let{t,i18n:n}=Q(),r=qt(`rgba(0, 0, 0, 0.1)`,`rgba(255, 255, 255, 0.05)`),i=e=>{n.changeLanguage(e)},a=e=>{let t=n.language===e;return Z(z,{w:`full`,variant:`ghost`,justifyContent:`space-between`,onClick:()=>i(e),py:6,px:4,bg:t?r:void 0,children:[X(K,{children:oe[e]}),t&&X(V,{as:vn,boxSize:5,color:`blue.500`})]},e)};return Z(wr,{children:[Z(P,{children:[X(G,{children:t(`Select language`)}),X(N,{onClick:()=>e(`settings`)}),X(U,{})]}),X(H,{w:`full`,children:X(q,{justify:`center`,spacing:3,align:`flex-start`,w:`full`,children:le.map(e=>a(e))})}),X(W,{pt:0})]})},pi=({token:e,index:t,isExcluded:r,onToggleExclusion:i,onDragStart:a,onDragOver:o,onDrop:s,onTouchStart:c,onTouchMove:l,onTouchEnd:d,isDragging:f,isDraggedOver:p})=>{let m=u[e],{darkMode:h}=n(),g=J(`colors`,`vechain-kit-text-primary`),_=J(`colors`,`vechain-kit-text-secondary`),v=J(`colors`,`vechain-kit-card`);return X(R,{bg:h?`#ffffff0a`:`blackAlpha.50`,borderRadius:`md`,border:`1px`,borderColor:f?h?`blue.500`:`blue.300`:p?h?`blue.400`:`blue.200`:v,p:3,mb:2,opacity:f||r?.5:1,cursor:`move`,transition:`background-color 0.2s ease, border-color 0.2s ease`,draggable:!0,onDragStart:()=>a(t),onDragOver:e=>{e.preventDefault(),o(t)},onDrop:()=>s(t),onTouchStart:e=>c(t,e),onTouchMove:l,onTouchEnd:d,_hover:{backgroundColor:h?`#ffffff12`:`blackAlpha.200`},children:Z(B,{justify:`space-between`,children:[Z(B,{opacity:r?.5:1,children:[X(R,{cursor:`grab`,_active:{cursor:`grabbing`},pointerEvents:`none`,children:X(V,{as:Fn,color:_})}),Z(q,{align:`start`,spacing:0,children:[X(K,{fontWeight:`medium`,color:g,children:m.name}),X(K,{fontSize:`sm`,color:_,children:m.description})]})]}),X(Bt,{isChecked:!r,onChange:()=>i(e),colorScheme:`blue`,size:`sm`})]})})},mi=({tokens:e,excludedTokens:t,onReorder:n,onToggleExclusion:r})=>{let[i,a]=L(null),[o,s]=L(null),c=at([]),l=at(0),u=e=>{a(e)},d=e=>{s(e)},f=t=>{if(i===null||i===t){a(null),s(null);return}let r=[...e],o=r[i];r.splice(i,1),r.splice(t,0,o),n(r),a(null),s(null)},p=(e,t)=>{l.current=t.touches[0].clientY,a(e)},m=e=>{if(i===null)return;let t=e.touches[0].clientY;for(let e=0;e<c.current.length;e++){let n=c.current[e];if(!n)continue;let r=n.getBoundingClientRect();if(t>=r.top&&t<=r.bottom){s(e);break}}},h=()=>{if(i!==null&&o!==null&&i!==o){let t=[...e],r=t[i];t.splice(i,1),t.splice(o,0,r),n(t)}a(null),s(null),l.current=0};return X(R,{w:`full`,children:e.map((e,n)=>X(R,{ref:e=>{c.current[n]=e},children:X(pi,{token:e,index:n,isExcluded:t.includes(e),onToggleExclusion:r,onDragStart:u,onDragOver:d,onDrop:f,onTouchStart:p,onTouchMove:m,onTouchEnd:h,isDragging:i===n,isDraggedOver:o===n})},e))})},hi=({setCurrentContent:e})=>{let{t}=Q(),{preferences:n,reorderTokenPriority:r,toggleTokenExclusion:i}=ae(),a=J(`colors`,`vechain-kit-text-primary`),o=J(`colors`,`vechain-kit-text-secondary`),s=rt(e=>{r(e)},[r]);return Z(wr,{children:[Z(P,{children:[X(G,{children:t(`Gas Token Preferences`)}),X(N,{onClick:()=>e(`settings`)}),X(U,{})]}),X(H,{w:`full`,children:Z(q,{justify:`center`,spacing:6,align:`flex-start`,w:`full`,children:[X(q,{w:`full`,justifyContent:`center`,spacing:3,mb:3,children:X(K,{fontSize:`sm`,color:o,textAlign:`center`,children:t(`Choose which tokens to use for transaction fees when the app is not covering them.`)})}),n.availableGasTokens.length===0&&Z(ut,{status:`warning`,borderRadius:`md`,children:[X(ft,{}),X(dt,{fontSize:`sm`,color:o,children:t(`You must enable at least one token to perform transactions. Without any enabled tokens, you will not be able to pay for gas fees.`)})]}),Z(q,{w:`full`,align:`start`,spacing:3,children:[X(K,{fontSize:`md`,fontWeight:`semibold`,color:a,children:t(`Token Priority Order`)}),X(K,{fontSize:`sm`,color:o,children:t(`Drag to reorder. The system will automatically use the highest priority token with sufficient balance.`)}),X(mi,{tokens:n.tokenPriority,excludedTokens:n.excludedTokens,onReorder:s,onToggleExclusion:i})]})]})})]})},gi={showMfaEnrollmentModal:()=>{console.warn(`Privy is not configured. Add privy prop to VeChainKitProvider to enable MFA enrollment.`)}},_i=()=>{let e=!!n().privy,t=null;try{t=Zt()}catch{}return!e||!t?gi:{showMfaEnrollmentModal:t.showMfaEnrollmentModal??(()=>{})}},vi=({setCurrentContent:e,onLogoutSuccess:t})=>{let{t:r}=Q(),{isolatedView:i}=Ue(),{exportWallet:a,linkPasskey:o}=ue(),{showMfaEnrollmentModal:s}=_i(),{feeDelegation:c}=n(),{connection:l,disconnect:u,smartAccount:d,connectedWallet:f}=A(),{data:p}=ge(d?.address??``,f?.address??``,3),m=()=>{e({type:`upgrade-smart-account`,props:{setCurrentContent:e,initialContent:`settings`}})},h=()=>{e(`connection-details`)},g=()=>{u(),t()},_=J(`colors`,`vechain-kit-text-secondary`);return Z(Y,{children:[Z(P,{children:[X(G,{children:r(`Settings`)}),!i&&X(N,{onClick:()=>e(`profile`)}),X(U,{})]}),Z(H,{w:`full`,children:[Z(q,{w:`full`,spacing:2,children:[X(K,{fontSize:`sm`,fontWeight:`bold`,color:_,textAlign:`left`,w:`full`,children:r(`General`)}),X($,{title:r(`Currency`),onClick:()=>{e(`change-currency`)},leftIcon:Dn,rightIcon:bn}),X($,{title:r(`Language`),onClick:()=>{e(`change-language`)},leftIcon:Ln,rightIcon:bn}),l.isConnectedWithPrivy&&!c?.delegatorUrl&&X($,{title:r(`Gas Token Preferences`),onClick:()=>{e(`gas-token-settings`)},leftIcon:jn,rightIcon:bn}),X($,{title:r(`Terms and Policies`),onClick:()=>{e({type:`terms-and-privacy`,props:{onGoBack:()=>e(`settings`)}})},leftIcon:Jn,rightIcon:bn}),X($,{title:r(`Logout`),onClick:()=>e({type:`disconnect-confirm`,props:{onDisconnect:g,onBack:()=>e(`settings`)}}),leftIcon:zn})]}),p&&X(q,{w:`full`,spacing:2,mt:4,children:X($,{title:r(`Upgrade Smart Account to V3`),description:r(`A new version is available for your account`),onClick:m,leftIcon:qn,extraContent:X(R,{minWidth:`8px`,height:`8px`,bg:`red.500`,borderRadius:`full`,display:`flex`,alignItems:`center`,justifyContent:`center`,ml:2})})}),l.isConnectedWithSocialLogin&&Z(q,{w:`full`,spacing:2,mt:4,children:[X(K,{fontSize:`sm`,fontWeight:`bold`,color:_,textAlign:`left`,w:`full`,children:r(`Access and security`)}),X($,{title:r(`Passkey`),onClick:()=>o(),leftIcon:An}),X($,{title:r(`Backup`),onClick:()=>{a()},leftIcon:In}),X($,{title:r(`Manage MFA`),onClick:()=>{s()},leftIcon:Yn}),X($,{title:r(`Login methods`),onClick:()=>{e(`privy-linked-accounts`)},leftIcon:er,rightIcon:bn})]}),Z(q,{w:`full`,spacing:2,mt:4,children:[X(K,{fontSize:`sm`,fontWeight:`bold`,color:_,textAlign:`left`,w:`full`,children:r(`Help`)}),X($,{title:r(`Connection details`),onClick:h,leftIcon:$n,rightIcon:bn}),X($,{title:r(`Explore ecosystem`),onClick:()=>e(`ecosystem`),leftIcon:Rn,rightIcon:bn}),X($,{title:r(`Frequently asked questions`),onClick:()=>e({type:`faq`,props:{onGoBack:()=>e(`settings`),showLanguageSelector:!1}}),leftIcon:wn,rightIcon:bn})]})]}),X(W,{p:0})]})},yi=({title:e,description:t,icon:n})=>{let r=J(`colors`,`vechain-kit-text-secondary`),i=J(`colors`,`vechain-kit-text-primary`);return Z(q,{spacing:6,align:`center`,py:8,children:[X(V,{as:n,boxSize:16,color:r}),Z(q,{spacing:2,children:[X(K,{fontSize:`lg`,fontWeight:`500`,textAlign:`center`,color:i,children:e}),X(K,{fontSize:`md`,color:r,textAlign:`center`,px:4,children:t})]})]})},bi=(e,t=`en-US`)=>new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`}).format(new Date(e)),xi=({document:e})=>{let{t}=Q(),n=J(`colors`,`vechain-kit-text-secondary`),r=e.documentSource===_.VECHAIN_KIT&&e.documentType===y.TERMS;return Z(B,{children:[Z(Vt,{size:`sm`,borderRadius:`full`,color:n,children:[`v`,e.version]}),X(K,{fontSize:`xs`,cursor:`pointer`,color:n,onClick:()=>{window.open(e.url,`_blank`)},_hover:{textDecoration:`underline`},children:r?t(`'{{policyName}}' on connect`,{policyName:e.displayName??t(`Vechain Kit Policy`)}):t(`'{{policyName}}' on {{date}}`,{policyName:e.displayName??t(`Policy`),date:bi(e.timestamp)})})]})},Si=({title:e,description:t,documents:n,bg:r,hoverBg:i,currentPolicy:a})=>{let{t:o}=Q(),s=J(`colors`,`vechain-kit-text-primary`),c=J(`colors`,`vechain-kit-text-secondary`),l=n?.length>0,u=n?.find(e=>e.id===a?.id);return l?X(ct,{border:`none`,mb:3,children:({isExpanded:l})=>Z(Y,{children:[Z(st,{bg:r,borderRadius:`xl`,_hover:{bg:i},children:[Z(q,{w:`full`,align:`flex-start`,textAlign:`left`,children:[X(K,{fontWeight:`700`,color:s,children:e}),X(K,{fontSize:`xs`,color:c,children:t})]}),X(V,{as:l?xn:yn,fontSize:`20px`,color:c})]}),X(lt,{pb:4,pt:3,children:Z(q,{align:`stretch`,spacing:4,children:[u?.id?Z(B,{w:`full`,children:[X(V,{as:vn,color:s}),X(K,{fontSize:`xs`,color:c,children:o(`You accepted current policy on {{date}}`,{date:bi(u.timestamp)})})]}):null,X(B,{w:`full`,textAlign:`left`,children:X(K,{fontSize:`xs`,fontWeight:`bold`,color:c,children:o(`All policies you have accepted`)})}),X(B,{w:`full`,gap:2,children:X(q,{align:`stretch`,spacing:2,children:n.map(e=>X(xi,{document:e},e.id))})}),a&&X(z,{variant:`outline`,size:`xs`,alignSelf:`flex-end`,onClick:()=>{window.open(a.url,`_blank`)},children:o(`View Current Policy`)})]})})]})}):null},Ci=()=>{let{account:t}=A(),{t:r}=Q(),{darkMode:i}=n(),{agreements:a,documents:o}=e(),s=I(()=>{let e=a?.filter(e=>p(e.walletAddress,t?.address));return[{id:`vechain-kit-terms`,...h,documentType:y.TERMS,documentSource:_.VECHAIN_KIT,walletAddress:t?.address??``,timestamp:new Date().getTime()},...e]?.reduce((e,t)=>(e[t.documentType]=[...e[t.documentType]||[],t],e),{})},[a,t?.address]),c=I(()=>o.reduce((e,t)=>{let n=t.documentType;return(!e[n]||t.version>e[n].version)&&(e[n]=t),e},{}),[o]),l=I(()=>Object.values(s).some(e=>e.length>0),[s]),u=i?`whiteAlpha.50`:`blackAlpha.50`,d=i?`whiteAlpha.100`:`blackAlpha.100`,f=I(()=>{let e=[];return s[y.TERMS]?.length>0&&e.push(0),s[y.PRIVACY]?.length>0&&e.push(1),s[y.COOKIES]?.length>0&&e.push(2),e},[s]);return l?X(q,{spacing:4,align:`stretch`,children:Z(ot,{allowMultiple:!0,defaultIndex:f,children:[X(Si,{title:r(`Terms and Conditions`),description:r(`Legal agreement between you, Vechain Kit and the current app, outlining the rules for using wallet services.`),documents:s[y.TERMS],bg:u,hoverBg:d,currentPolicy:c[y.TERMS]}),X(Si,{title:r(`Privacy Policy`),description:r(`Privacy policy outlining the data collection and processing practices.`),documents:s[y.PRIVACY],bg:u,hoverBg:d,currentPolicy:c[y.PRIVACY]}),X(Si,{title:r(`Cookie Policy`),description:r(`Cookie policy outlining the use of cookies and tracking technologies.`),documents:s[y.COOKIES],bg:u,hoverBg:d,currentPolicy:c[y.COOKIES]})]})}):X(yi,{title:r(`No policies accepted`),description:r(`When you have accepted a policy, it will appear here`),icon:Mn})},wi=({onGoBack:e})=>{let{t}=Q();return Z(wr,{children:[Z(P,{children:[X(G,{children:t(`Terms and Policies`)}),X(N,{onClick:e}),X(U,{})]}),X(H,{w:`full`,children:X(q,{spacing:6,align:`stretch`,children:X(Ci,{})})}),X(W,{pt:0})]})},Ti=({wallet:e,isActive:t,onSelect:r,onRemove:i,showRemove:a=!0})=>{let{t:s}=Q(),{network:c}=n(),{formattedBalance:u,isLoading:d}=We({address:e.address}),{domain:f,image:p,isLoading:m}=E(e.address,c.type),h=J(`colors`,`vechain-kit-text-primary`),g=J(`colors`,`vechain-kit-text-secondary`),_=J(`colors`,`vechain-kit-border`),v=d||m;return X(ht,{variant:`vechainKitWalletCard`,onClick:r,borderWidth:t?`2px`:`1px`,borderColor:t?`vechain-kit-primary`:_,_hover:{borderColor:t?`vechain-kit-primary`:`vechain-kit-text-secondary`},children:X(gt,{p:4,children:Z(B,{spacing:3,w:`full`,justifyContent:`space-between`,children:[Z(B,{spacing:3,flex:1,minW:0,children:[X(Tr,{wallet:{address:e.address,domain:f??void 0,image:p??void 0,isLoadingMetadata:m},props:{width:10,height:10}}),Z(q,{spacing:0,alignItems:`flex-start`,flex:1,minW:0,children:[X(K,{fontSize:`sm`,fontWeight:`medium`,color:h,noOfLines:1,children:f?o(f,22,0):l(e.address,6,4)}),X(K,{fontSize:`xs`,color:g,noOfLines:1,children:v?s(`Loading...`):u})]})]}),t&&X(R,{children:X(V,{as:vn,boxSize:5,color:`vechain-kit-primary`})}),a&&!t&&X(Ot,{"aria-label":s(`Remove wallet`),icon:X(V,{as:Qn}),variant:`vechainKitSecondary`,height:`30px`,w:`30px`,borderRadius:`5px`,onClick:e=>{e.stopPropagation(),i()}})]})})})},Ei=e=>m(e.map(e=>e.address.toLowerCase()).sort().join(`|`)),Di=({setCurrentContent:e,returnTo:t=`main`,onLogoutSuccess:n})=>{let{t:r}=Q(),{isolatedView:i}=Ue(),{account:a,disconnect:o}=A(),{disconnect:s}=O(),{open:c}=be(),{getStoredWallets:l,setActiveWallet:u,removeWallet:d}=Ve(),{saveWallet:f}=D(),{refresh:p}=Ke(),m=J(`colors`,`vechain-kit-text-secondary`),[h,g]=L(l()),_=at(Ei(l())),v=rt(()=>{let e=l();g(e),_.current=Ei(e)},[l]);it(()=>{v()},[v,a?.address]),it(()=>{let e=()=>{setTimeout(()=>{v()},100)};if(typeof window<`u`)return window.addEventListener(`wallet_switched`,e),()=>{window.removeEventListener(`wallet_switched`,e)}},[v]),it(()=>{let e=setInterval(()=>{Ei(l())!==_.current&&v()},200);return()=>clearInterval(e)},[l,v]);let y=I(()=>{let e=h.find(e=>e.isActive);return e?e.address:a?.address??null},[h,a?.address]),b=I(()=>h.find(e=>e.address.toLowerCase()===y?.toLowerCase()),[h,y]),x=I(()=>h.filter(e=>e.address.toLowerCase()!==y?.toLowerCase()),[h,y]),S=rt(n=>{n.toLowerCase()!==y?.toLowerCase()&&(b&&f(b.address),u(n),setTimeout(()=>{v()},50),p(),e({type:t,props:{switchFeedback:{showFeedback:!0}}}))},[y,b,a,u,p,e,v,f]),ee=rt(r=>{let i=r.address.toLowerCase()===y?.toLowerCase(),a=h.filter(e=>e.address.toLowerCase()!==r.address.toLowerCase());e({type:`remove-wallet-confirm`,props:{walletAddress:r.address,walletDomain:null,onConfirm:async()=>{if(i&&a.length>0){let e=a[0];u(e.address)}else if(i&&a.length===0)try{await s()}catch(e){console.error(`Error disconnecting:`,e)}if(d(r.address),setTimeout(()=>{v()},50),a.length===0){n&&n();return}e({type:`select-wallet`,props:{setCurrentContent:e,onClose:()=>{},returnTo:t,onLogoutSuccess:n}})},onBack:()=>{e({type:`select-wallet`,props:{setCurrentContent:e,onClose:()=>{},returnTo:t,onLogoutSuccess:n}})}}})},[d,v,e,t,n,y,h,u,s]),C=rt(()=>{c()},[c]),w=()=>{o(),n?.()};return Z(Y,{children:[Z(P,{children:[!i&&X(N,{onClick:()=>{e(t)}}),X(G,{children:r(`Select Wallet`)}),X(U,{})]}),X(H,{w:`full`,children:Z(q,{w:`full`,spacing:4,children:[b&&Z(q,{w:`full`,spacing:2,alignItems:`flex-start`,children:[X(Dt,{size:`sm`,color:m,children:r(`Active Wallet`)}),X(Ti,{wallet:b,isActive:!0,onSelect:()=>{},onRemove:()=>ee(b),showRemove:h.length>1})]}),x.length>0&&Z(q,{w:`full`,spacing:2,alignItems:`flex-start`,children:[X(Dt,{size:`sm`,color:m,children:r(`Other Wallets`)}),x.map(e=>X(Ti,{wallet:e,isActive:!1,onSelect:()=>S(e.address),onRemove:()=>ee(e),showRemove:!0},e.address))]})]})}),X(W,{w:`full`,children:Z(q,{w:`full`,spacing:2,children:[X(z,{w:`full`,leftIcon:X(Wn,{}),variant:`vechainKitSecondary`,onClick:C,children:r(`Add New Wallet`)}),X(z,{w:`full`,leftIcon:X(zn,{}),variant:`vechainKitLogout`,onClick:()=>e({type:`disconnect-confirm`,props:{onDisconnect:w,onBack:()=>e({type:`select-wallet`,props:{setCurrentContent:e,onClose:()=>{},returnTo:t,onLogoutSuccess:n}})}}),children:r(`Logout`)})]})})]})},Oi=({walletAddress:e,walletDomain:t,onConfirm:r,onBack:i,onClose:a})=>{let{t:s}=Q(),{network:c}=n(),{domain:u}=E(e,c.type),d=J(`colors`,`vechain-kit-text-primary`),f=u?o(u,20,0):l(e,6,4);return Z(Y,{children:[Z(P,{children:[X(G,{children:s(`Remove`)}),X(N,{onClick:i}),a&&X(U,{onClick:a})]}),X(H,{children:Z(q,{spacing:6,align:`center`,mt:10,children:[X(V,{as:Qn,color:`#ef4444`,fontSize:`60px`,opacity:.5}),X(K,{fontSize:`md`,textAlign:`center`,color:d,children:s(`Are you sure you want to remove this wallet?`)}),X(K,{fontSize:`sm`,textAlign:`center`,color:`vechain-kit-text-secondary`,fontWeight:`600`,children:f}),X(K,{fontSize:`sm`,textAlign:`center`,color:`vechain-kit-text-secondary`,children:l(e,8,7)})]})}),X(W,{w:`full`,mt:4,children:Z(q,{spacing:3,w:`full`,children:[X(z,{onClick:r,"data-testid":`remove-wallet-button`,variant:`vechainKitLogout`,children:s(`Remove`)}),X(z,{variant:`vechainKitSecondary`,onClick:i,"data-testid":`cancel-remove-button`,children:s(`Cancel`)})]})})]})},ki=br[`@vechain/dapp-kit-react`]||xr[`@vechain/dapp-kit-react`]||`unknown`,Ai=br[`@privy-io/react-auth`]||`unknown`,ji=({connectionCache:e})=>{let{t}=Q(),{connection:r,smartAccount:i,connectedWallet:a}=A(),{source:o}=O(),{privy:s,network:c}=n(),u=s?.appId,{data:f,isLoading:p}=Be(u||[]),{onCopy:m,hasCopied:h}=Kt(``),{data:g,isLoading:_}=ke(),{data:v,isLoading:y}=j(i.address??``,a?.address??``),b=J(`colors`,`vechain-kit-card`),x=J(`colors`,`vechain-kit-text-secondary`),S=J(`colors`,`vechain-kit-text-primary`),ee=(()=>r.isConnectedWithCrossApp&&e?.ecosystemApp?e.ecosystemApp.name:r.isConnectedWithSocialLogin&&f?Object.values(f)[0]?.name??null:r.isConnectedWithDappKit&&o?o:null)(),C=r.isConnectedWithSocialLogin&&p,w=({label:e,value:t,isLoading:n=!1,href:r})=>Z(B,{w:`full`,justifyContent:`space-between`,children:[Z(K,{fontSize:`sm`,color:S,children:[e,`:`]}),X(K,{fontSize:`sm`,as:r?`a`:void 0,href:r,target:`_blank`,rel:`noopener noreferrer`,style:{textDecoration:r?`underline`:`none`},color:x,children:n?`Loading...`:t})]});return C?X(q,{w:`full`,h:`full`,justify:`center`,align:`center`,minH:`200px`,borderRadius:`xl`,bg:b,children:X(zt,{})}):ee?Z(q,{p:4,bg:b,borderRadius:`xl`,spacing:4,w:`full`,justifyContent:`space-between`,children:[X(w,{label:t(`Logged in with`),value:ee}),r.isConnectedWithCrossApp&&e?.timestamp&&X(w,{label:t(`At`),value:new Date(e.timestamp).toLocaleString()}),X(w,{label:t(`Connection Type`),value:r.source.type,isLoading:r.isLoading}),X(xt,{}),X(w,{label:t(`Network`),value:c.type}),X(w,{label:t(`Node URL`),value:c.nodeUrl||d(c.type).nodeUrl}),r.isConnectedWithPrivy&&X(xt,{}),r.isConnectedWithPrivy&&Z(B,{w:`full`,justifyContent:`space-between`,children:[Z(K,{fontSize:`sm`,color:S,children:[t(`Embedded wallet`),`:`]}),Z(B,{children:[X(K,{fontSize:`sm`,color:x,children:a?.address?l(a.address,8,7):`-`}),X(V,{color:x,onClick:()=>{a?.address&&m(a.address)},opacity:a?.address?1:.4,pointerEvents:a?.address?`auto`:`none`,cursor:`pointer`,as:h?vn:En})]})]}),r.isConnectedWithPrivy?Z(Y,{children:[X(w,{label:t(`Smart Account`),value:`v${v?.version??``} ${v?.isDeployed?``:`(not deployed)`}`,isLoading:y}),X(w,{label:t(`Privy Status`),value:g||``,isLoading:_})]}):i.isDeployed&&X(w,{label:t(`Smart Account`),value:`v${v?.version??``}`,isLoading:y}),X(xt,{}),X(w,{label:t(`VeChain Kit`),value:yr,href:`https://github.com/vechain/vechain-kit/releases/tag/${yr}`}),X(w,{label:`DAppKit`,value:ki}),X(w,{label:`Privy`,value:Ai})]}):null},Mi=()=>{let{connection:e}=A(),{t}=Q(),{privy:r,darkMode:i}=n(),{getConnectionCache:a}=re(),o=a(),s=J(`colors`,`vechain-kit-card`);return e.isConnectedWithPrivy?Z(q,{w:`full`,align:`stretch`,textAlign:`center`,mt:5,p:3,borderRadius:`lg`,bg:s,shadow:`sm`,children:[X(K,{fontSize:`xs`,fontWeight:`800`,children:t(`Wallet secured by`)}),Z(B,{justify:`center`,children:[X(ee,{isDark:i,w:`50px`}),X(V,{as:Vn,ml:3}),e.isConnectedWithVeChain?X(x,{isDark:i,w:`80px`,h:`auto`,mb:`3px`}):e.isConnectedWithCrossApp&&o&&X(kt,{src:o.ecosystemApp.logoUrl,alt:o.ecosystemApp.name,maxW:`40px`,borderRadius:`md`}),e.isConnectedWithSocialLogin&&!e.isConnectedWithVeChain&&X(kt,{src:r?.appearance.logo,alt:r?.appearance.logo,maxW:`40px`,borderRadius:`md`})]})]}):null},Ni=({onGoBack:e})=>{let{t}=Q(),{getConnectionCache:n}=re(),r=n()??void 0;return Z(wr,{children:[Z(P,{children:[X(G,{children:t(`Connection Details`)}),X(N,{onClick:()=>{e()}}),X(U,{})]}),Z(H,{w:`full`,children:[X(ji,{connectionCache:r}),X(Mi,{})]}),X(W,{pt:0})]})},Pi=({accountType:e,accountDescription:t,isLoading:n,onConfirm:r,onCancel:i})=>{let{t:a}=Q();return Z(q,{spacing:6,align:`stretch`,children:[X(K,{fontSize:`md`,textAlign:`center`,color:J(`colors`,`vechain-kit-text-primary`),children:a(`Are you sure you want to unlink {{accountType}} as a login method linked to {{accountDescription}}?`,{accountType:e,accountDescription:t})}),Z(q,{spacing:3,w:`full`,children:[X(z,{height:`60px`,colorScheme:`red`,w:`full`,onClick:r,isLoading:n,children:a(`Remove Login Method`)}),X(z,{isLoading:n,height:`60px`,w:`full`,onClick:i,children:a(`Cancel`)})]})]})},Fi=({onBack:e})=>{let{t}=Q(),{privy:r,dappKit:i}=n(),[a,o]=L(null),[s,c]=L(!1),[u,d]=L(!1),[f,p]=L(!1),m=J(`colors`,`vechain-kit-text-primary`),h=J(`colors`,`vechain-kit-text-secondary`),{user:g,linkEmail:_,linkGoogle:v,linkTwitter:y,linkPhone:b,linkSpotify:x,linkApple:S,linkInstagram:ee,linkTiktok:C,linkGithub:w,linkLinkedIn:te,linkTelegram:T,linkFarcaster:E,linkPasskey:D,linkDiscord:O,unlinkEmail:k,unlinkGoogle:ne,unlinkApple:re,unlinkSpotify:ie,unlinkInstagram:A,unlinkTiktok:j,unlinkGithub:ae,unlinkLinkedIn:oe,unlinkTelegram:se,unlinkFarcaster:ce,unlinkPhone:le,unlinkPasskey:ue,unlinkDiscord:de,linkWallet:fe}=Qt(),pe=I(()=>{let e=r?.loginMethods?.filter(e=>[`rabby_wallet`,`coinbase_wallet`,`rainbow`,`phantom`,`metamask`].includes(e))??[],t=i?.allowedWallets??[];return e.length>0||t.length>0},[r?.loginMethods,i?.allowedWallets]),me=e=>{switch(e){case`google_oauth`:return rr;case`email`:return Bn;case`passkey`:return An;case`wallet`:return tr;case`twitter_oauth`:return ir;case`phone`:return Un;case`spotify_oauth`:return hr;case`apple_oauth`:return dr;case`instagram_oauth`:return pr;case`tiktok_oauth`:return _r;case`github_oauth`:return Nn;case`linkedin_oauth`:return mr;case`telegram`:return gr;case`farcaster`:return ur;case`discord_oauth`:return fr;default:return}},he=()=>{let e=g?.linkedAccounts?.filter(e=>e.type!==`wallet`||e.type===`wallet`&&e.connectorType!==`embedded`);return e&&e?.length>1},ge=async e=>{if(he()){p(!0);try{switch(e.type){case`google_oauth`:await ne(e.subject);break;case`email`:await k(e.address);break;case`passkey`:await ue(e.subject);break;case`phone`:await le(e.number);break;case`spotify_oauth`:await ie(e.subject);break;case`apple_oauth`:await re(e.subject);break;case`instagram_oauth`:await A(e.subject);break;case`tiktok_oauth`:await j(e.subject);break;case`github_oauth`:await ae(e.subject);break;case`linkedin_oauth`:await oe(e.subject);break;case`telegram`:await se(e.subject);break;case`farcaster`:await ce(e.subject);break;case`discord_oauth`:await de(e.subject);break;default:break}}catch(e){console.error(e)}finally{p(!1),o(null)}}},_e=e=>{switch(e.type){case`google_oauth`:return e.email;case`email`:return e.address;case`passkey`:return`${e.authenticatorName} - ${e.createdWithBrowser}`;case`phone`:return e.number;case`wallet`:return`${l(e.address)} - ${e.walletClientType}`;default:return``}},ve=g?.linkedAccounts?.map(e=>e.type)||[],ye=r?.loginMethods||[],be=!ve.includes(`google_oauth`)&&ye.includes(`google`),xe=!ve.includes(`email`)&&ye.includes(`email`),Se=!ve.includes(`twitter_oauth`)&&ye.includes(`twitter`),Ce=!ve.includes(`phone`)&&ye.includes(`sms`),we=!ve.includes(`spotify_oauth`)&&ye.includes(`spotify`),Te=!ve.includes(`apple_oauth`)&&ye.includes(`apple`),Ee=!ve.includes(`instagram_oauth`)&&ye.includes(`instagram`),M=!ve.includes(`tiktok_oauth`)&&ye.includes(`tiktok`),De=!ve.includes(`github_oauth`)&&ye.includes(`github`),Oe=!ve.includes(`linkedin_oauth`)&&ye.includes(`linkedin`),ke=!ve.includes(`telegram`)&&ye.includes(`telegram`),Ae=!ve.includes(`farcaster`)&&ye.includes(`farcaster`),je=!ve.includes(`discord_oauth`)&&ye.includes(`discord`);return s?Z(wr,{children:[Z(P,{children:[X(G,{children:t(`Select Additional Login Method`)}),X(N,{onClick:()=>c(!1)}),X(U,{})]}),X(H,{w:`full`,children:Z(q,{spacing:3,align:`stretch`,w:`full`,children:[X($,{title:t(`Set up Passkey`),description:t(`Set up a passkey for easier access`),onClick:()=>D(),leftIcon:An}),be&&X($,{title:t(`Link Google Account`),description:t(`Connect your Google account for easier access`),onClick:()=>v(),leftIcon:rr}),xe&&X($,{title:t(`Link Email Account`),description:t(`Connect your email for easier access`),onClick:()=>_(),leftIcon:Bn,stacked:!0}),Se&&X($,{title:t(`Link Twitter Account`),description:t(`Connect your Twitter account for easier access`),onClick:()=>y(),leftIcon:ir}),Ce&&X($,{title:t(`Link Phone Number`),description:t(`Connect your phone number for easier access`),onClick:()=>b(),leftIcon:Un}),we&&X($,{title:t(`Link Spotify Account`),description:t(`Connect your Spotify account for easier access`),onClick:()=>x(),leftIcon:hr}),Te&&X($,{title:t(`Link Apple Account`),description:t(`Connect your Apple account for easier access`),onClick:()=>S(),leftIcon:dr}),Ee&&X($,{title:t(`Link Instagram Account`),description:t(`Connect your Instagram account for easier access`),onClick:()=>ee(),leftIcon:pr}),M&&X($,{title:t(`Link Tiktok Account`),description:t(`Connect your Tiktok account for easier access`),onClick:()=>C(),leftIcon:_r}),De&&X($,{title:t(`Link Github Account`),description:t(`Connect your Github account for easier access`),onClick:()=>w(),leftIcon:Nn}),Oe&&X($,{title:t(`Link LinkedIn Account`),description:t(`Connect your LinkedIn account for easier access`),onClick:()=>te(),leftIcon:mr}),ke&&X($,{title:t(`Link Telegram Account`),description:t(`Connect your Telegram account for easier access`),onClick:()=>T(),leftIcon:gr}),Ae&&X($,{title:t(`Link Farcaster Account`),description:t(`Connect your Farcaster account for easier access`),onClick:()=>E(),leftIcon:ur}),je&&X($,{title:t(`Link Discord Account`),description:t(`Connect your Discord account for easier access`),onClick:()=>O(),leftIcon:fr}),pe&&X($,{title:t(`Link External Wallet`),description:t(`Connect an external wallet for easier access`),onClick:()=>fe(),leftIcon:tr}),!be&&!xe&&!Se&&!Ce&&!we&&!Te&&!Ee&&!M&&!De&&!Oe&&!ke&&!Ae&&!je&&X(K,{fontSize:`sm`,textAlign:`center`,opacity:.7,children:t(`No additional accounts available to link`)})]})}),X(W,{pt:0})]}):a?Z(wr,{children:[Z(P,{children:[X(G,{children:t(`Remove Login Method`)}),X(N,{onClick:()=>o(null)}),X(U,{})]}),X(H,{children:X(Pi,{accountType:a.type,accountDescription:_e(a),isLoading:f,onConfirm:()=>ge(a),onCancel:()=>o(null)})}),X(W,{pt:0})]}):Z(wr,{children:[Z(P,{children:[X(G,{children:t(`Login methods`)}),X(N,{onClick:e}),X(U,{})]}),X(H,{w:`full`,children:Z(q,{spacing:3,align:`center`,w:`full`,justify:`center`,children:[Z(q,{spacing:1,justify:`flex-start`,alignItems:`flex-start`,mb:5,textAlign:`left`,w:`full`,children:[X(K,{fontSize:`sm`,color:h,children:t(`These accounts are linked to your embedded wallet and can be used to login to your wallet and access your private key.`)}),u&&X(K,{fontSize:`sm`,color:h,children:t(`Adding more linked accounts increases security against loss of access, but also introduces additional potential attack vectors. For enhanced security, we recommend enabling MFA.`)}),X(z,{variant:`link`,mt:0,size:`sm`,onClick:()=>d(!u),color:m,children:t(u?`Show Less`:`Read More`)})]}),g?.linkedAccounts?.filter(e=>e.type!==`wallet`||e.type===`wallet`&&e.connectorType!==`embedded`).map(e=>Z(St,{p:4,borderWidth:`1px`,borderRadius:`md`,align:`center`,justify:`space-between`,w:`full`,children:[Z(St,{align:`center`,gap:3,children:[X(V,{as:me(e.type),color:m}),Z(q,{align:`start`,spacing:0,children:[X(K,{fontWeight:`500`,color:m,children:e.type===`google_oauth`?t(`Google`):e.type===`email`?t(`Email`):e.type===`passkey`?t(`Passkey`):e.type===`twitter_oauth`?t(`Twitter`):e.type===`phone`?t(`Phone Number`):e.type===`spotify_oauth`?t(`Spotify`):e.type===`apple_oauth`?t(`Apple`):e.type===`instagram_oauth`?t(`Instagram`):e.type===`tiktok_oauth`?t(`Tiktok`):e.type===`github_oauth`?t(`Github`):e.type===`linkedin_oauth`?t(`LinkedIn`):e.type===`telegram`?t(`Telegram`):e.type===`farcaster`?t(`Farcaster`):e.type===`discord_oauth`?t(`Discord`):t(`Wallet`)}),X(K,{fontSize:`sm`,color:h,children:_e(e)})]})]}),X(z,{size:`sm`,variant:`ghost`,colorScheme:`red`,isDisabled:!he(),onClick:()=>{e.type===`passkey`?D():o(e)},children:t(`Remove`)})]},e.type))]})}),X(W,{w:`full`,children:X(z,{w:`full`,variant:`vechainKitPrimary`,onClick:()=>c(!0),leftIcon:X(V,{as:Wn}),isDisabled:!be&&!xe&&!Se&&!Ce&&!we&&!Te&&!Ee&&!M&&!De&&!Oe&&!ke&&!Ae&&!je,children:t(`Add Login Method`)})})]})},Ii=({showArchived:e})=>{let{t}=Q();return X(yi,{title:t(e?`No archived notifications`:`No notifications`),description:t(e?`Cleared notifications will appear here`:`When you have notifications, they will appear here`),icon:e?sn:mn})},Li=({notification:e,isArchiveView:t,onMarkAsRead:n})=>{let{t:r}=Q(),i=()=>{n(e.id)};return e.isRead&&!t?null:Z(ut,{status:e.status,variant:`subtle`,borderRadius:`lg`,pr:8,position:`relative`,opacity:e.isRead?.7:1,cursor:`pointer`,_hover:{opacity:.8},"data-testid":`notification-item`,children:[X(ft,{boxSize:`16px`}),Z(R,{children:[X(pt,{fontSize:`sm`,"data-testid":`notification-title`,children:r(e.title)}),X(dt,{fontSize:`xs`,lineHeight:`1.2`,"data-testid":`notification-text`,children:r(e.description)})]}),!t&&!e.isRead&&X(Ot,{position:`absolute`,right:1,top:1,size:`sm`,variant:`ghost`,icon:X(Tn,{}),onClick:e=>{e.stopPropagation(),i()},"aria-label":`Mark as read and archive`,"data-testid":`remove-notification-button`})]},e.id)},Ri=({setCurrentContent:e})=>{let{t}=Q(),{isolatedView:n}=Ue(),{getNotifications:r,getArchivedNotifications:i,clearAllNotifications:a,markAsRead:o}=qe(),[s,c]=L(!1),[l,u]=L(r()),[d,f]=L(i()),p=()=>{a(),f([...d,...l]),u([])},m=e=>{o(e);let t=l.find(t=>t.id===e);u(l.filter(t=>t.id!==e)),t&&f([{...t,isRead:!0},...d])},h=()=>{c(!s)},g=s?d:l,_=[...g].sort((e,t)=>e.id===`welcome`?-1:t.id===`welcome`?1:e.id===`smart-account`?-1:t.id===`smart-account`?1:e.id===`multiclause`?-1:t.id===`multiclause`?1:t.timestamp-e.timestamp);return Z(wr,{children:[Z(P,{children:[!n&&X(N,{onClick:()=>e(`main`)}),X(G,{"data-testid":`modal-title`,children:t(s?`Archived Notifications`:`Notifications`)}),X(U,{})]}),Z(bt,{h:[`540px`,`auto`],p:0,children:[X(H,{children:Z(q,{spacing:4,align:`stretch`,w:`full`,children:[Z(B,{justify:`space-between`,children:[X(z,{variant:`ghost`,leftIcon:X(V,{as:s?mn:sn}),size:`sm`,onClick:h,"data-testid":`toggle-view-button`,children:t(s?`Current`:`Archived`)}),!s&&l.length>0&&X(z,{variant:`ghost`,size:`sm`,onClick:p,"data-testid":`clear-all-button`,children:t(`Clear all`)})]}),g.length===0?X(Ii,{showArchived:s}):X(q,{spacing:3,children:_.map(e=>X(Li,{notification:e,isArchiveView:s,onMarkAsRead:m},e.id))})]})}),X(W,{pt:0})]})]})},zi=e=>{switch(e){case`defi`:return`blue`;case`games`:return`green`;case`collectibles`:return`purple`;case`marketplaces`:return`orange`;case`utilities`:return`cyan`;default:return`gray`}},Bi=({category:e,...t})=>{let{t:n}=Q(),r=e.toLowerCase();return X(Vt,{size:`sm`,colorScheme:zi(r),borderRadius:`full`,px:2,...t,children:n(r)})},Vi=({name:e,imageUrl:t,logoComponent:n,category:r,onClick:i,size:a=`md`})=>Z(ht,{variant:`vechainKitAppCard`,_hover:{opacity:.8},cursor:`pointer`,onClick:i,position:`relative`,children:[r&&X(R,{position:`absolute`,top:`2`,right:`2`,zIndex:`1`,children:X(Bi,{category:r})}),X(gt,{p:a===`sm`?2:4,alignItems:`center`,children:Z(q,{spacing:2,h:`100%`,justifyContent:`space-between`,children:[n||t&&X(kt,{src:t,fallbackSrc:g,alt:e,height:`90px`,objectFit:`contain`,rounded:`full`}),e&&X(K,{fontWeight:`medium`,wordBreak:`break-word`,noOfLines:1,textAlign:`center`,w:`full`,children:e})]})})]}),Hi=({xApp:e,setCurrentContent:t,selectedCategory:n})=>{let{data:r,isLoading:i}=Je(e.id),{data:a,isLoading:o}=Te(r?.logo);return X(Rt,{isLoaded:!i&&!o,borderRadius:`md`,height:`100%`,children:X(Vi,{name:r?.name??``,imageUrl:a?.image??``,linkUrl:r?.external_url??``,category:`vebetter`,onClick:()=>{r?.name&&t({type:`app-overview`,props:{name:r.name,image:a?.image??``,url:r?.external_url??``,description:r?.description??``,category:`vebetter`,selectedCategory:n,setCurrentContent:t}})}})})},Ui=({name:e,image:t,url:n,description:r,category:i,logoComponent:a,selectedCategory:o,setCurrentContent:s})=>X(Vi,{name:e,imageUrl:t,linkUrl:n,category:i,onClick:()=>{s({type:`app-overview`,props:{name:e,image:t,url:n,description:r,category:i,logoComponent:a,selectedCategory:o,setCurrentContent:s}})},...a&&{logoComponent:a}}),Wi=({})=>{let{t:e}=Q(),{shortcuts:t}=Fe();return t.length===0?null:Z(q,{w:`full`,align:`flex-start`,spacing:2,children:[X(K,{fontSize:`sm`,fontWeight:`500`,children:e(`Shortcuts`)}),X(Tt,{templateColumns:`repeat(4, 1fr)`,gap:2,w:`full`,children:t.map(e=>X(Et,{children:X(ht,{_hover:{opacity:.8},cursor:`pointer`,onClick:()=>window.open(e.url,`_blank`),children:X(gt,{p:2,alignItems:`center`,children:X(kt,{src:e.image,fallbackSrc:g,alt:e.name,objectFit:`contain`,rounded:`full`})})})},e.url))})]})},Gi=({selectedCategory:e,onCategoryChange:t,categories:n,darkMode:r})=>{let{t:i}=Q();return Z(R,{width:`full`,mb:4,children:[X(K,{fontSize:`sm`,fontWeight:`500`,mb:2,children:i(`Filter by category`)}),Z(Wt,{spacing:2,children:[X(Gt,{children:X(Vt,{size:`md`,borderRadius:`full`,variant:e===null?`solid`:`outline`,colorScheme:r?`gray`:`blackAlpha`,cursor:`pointer`,onClick:()=>t(null),children:i(`All`)})}),n.map(n=>X(Gt,{children:X(Bi,{category:n,size:`md`,variant:e===n?`solid`:`outline`,cursor:`pointer`,onClick:()=>t(n)})},n))]})]})},Ki=[{name:`VeBetterDAO`,description:`Engage, earn and prosper by doing sustainable actions.`,external_url:w,logo:new URL(`/static/img/coins/64x64/33509.png`,S).toString(),banner:new URL(`/static/img/icons/vbd.png`,S).toString(),screenshots:[],social_urls:[],app_urls:[],tweets:[],ve_world:{banner:new URL(`/static/img/icons/vbd.png`,S).toString()},categories:[]},{name:`vet.domains`,description:`.vet.domains provides a unique and unchangeable identity for Vechain users by linking information to their wallet addresses. It becomes easier for people to use the blockchain by replacing complicated wallet addresses with easy-to-remember names.`,external_url:C,logo:new URL(`/assets/walletconnect.png`,C).toString(),banner:new URL(`/assets/walletconnect.png`,C).toString(),screenshots:[],social_urls:[],app_urls:[],tweets:[],ve_world:{banner:new URL(`/assets/walletconnect.png`,C).toString()},categories:[]}],qi=({setCurrentContent:e,selectedCategory:t})=>{let{t:r}=Q(),{darkMode:i,network:a}=n(),{isolatedView:o}=Ue(),s=J(`colors`,`vechain-kit-text-tertiary`),[c,l]=L(``),[u,d]=L(t||null);it(()=>{t!==void 0&&d(t)},[t]);let{data:f}=je(),{data:p}=Ie(f?(parseInt(f)-1).toString():`1`),{data:m,isLoading:h,error:g}=Ge(),_=I(()=>{let e=new Set;return a.type===`main`&&p&&p.length>0&&e.add(`vebetter`),m&&m.forEach(t=>{t.category&&e.add(t.category)}),Array.from(e).sort()},[m,p,a.type]),v=a.type===`main`?p.filter(e=>e.app.name.toLowerCase().includes(c.toLowerCase())):[],y=Ki.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())),b=m?.filter(e=>(e.name.toLowerCase().includes(c.toLowerCase())||e.description.toLowerCase().includes(c.toLowerCase())||e.tags.some(e=>e.toLowerCase().includes(c.toLowerCase())))&&(u===null||e.category===u))||[],x=u===null,S=u===null||u===`vebetter`,{shortcuts:ee}=Fe();return Z(Y,{children:[Z(P,{children:[X(G,{children:r(`Ecosystem`)}),!o&&X(N,{onClick:()=>e(`settings`)}),X(U,{})]}),X(H,{overflowY:`auto`,minH:`300px`,children:Z(q,{spacing:6,w:`full`,children:[X(Wi,{setCurrentContent:e}),ee.length>0&&X(K,{fontSize:`sm`,fontWeight:`500`,w:`full`,textAlign:`left`,children:r(`All apps`)}),Z(jt,{size:`lg`,children:[X(At,{placeholder:r(`Search Apps`),value:c,onChange:e=>{l(e.target.value)},bg:i?`#00000038`:`gray.50`,borderRadius:`xl`,height:`56px`,pl:12}),X(Mt,{h:`56px`,w:`56px`,pl:4,children:X(Kn,{color:s})})]}),_.length>0&&X(Gi,{selectedCategory:u,onCategoryChange:e=>{d(e)},categories:_,darkMode:i}),Z(Tt,{templateColumns:`repeat(2, 1fr)`,gap:4,w:`full`,children:[x&&y.length>0&&X(Y,{children:y.map(t=>X(Et,{children:X(Ui,{name:t.name,image:t.logo,url:t.external_url,setCurrentContent:e,description:t.description,selectedCategory:u})},t.name))}),S&&v.length>0&&X(Y,{children:v.map(t=>X(Et,{children:X(Hi,{xApp:t.app,setCurrentContent:e,selectedCategory:u})},t.id))}),h?X(Et,{colSpan:2,children:X(_t,{py:4,children:X(zt,{})})}):g?X(Et,{colSpan:2,children:X(K,{color:`red.500`,textAlign:`center`,children:r(`Failed to load App Hub apps`)})}):b.length>0?b.map(t=>X(Et,{children:X(Ui,{name:t.name,image:t.logo,url:t.url,setCurrentContent:e,description:t.description,category:t.category,selectedCategory:u})},t.id)):u&&!S&&X(Et,{colSpan:2,children:X(_t,{py:4,children:X(K,{children:r(`No apps found in this category`)})})})]})]})}),X(W,{pt:0})]})},Ji=({name:e,image:t,url:n,description:r})=>{let{t:i}=Q(),{isShortcut:a,addShortcut:o,removeShortcut:s}=Fe(),c=a(n);return X(z,{px:4,width:`full`,height:`45px`,variant:`vechainKitSecondary`,borderRadius:`xl`,onClick:()=>{c?s(n):o({name:e,image:t,url:n,description:r})},leftIcon:X(V,{as:c?gn:hn}),children:i(c?`Remove from shortcuts`:`Add to shortcuts`)})},Yi=({setCurrentContent:e,name:t,image:n,url:r,description:i,category:a,selectedCategory:o,logoComponent:s})=>{let{t:c}=Q();return Z(Y,{children:[Z(P,{children:[X(G,{children:t}),X(N,{onClick:()=>{e(o?{type:`ecosystem-with-category`,props:{selectedCategory:o,setCurrentContent:e}}:`ecosystem`)}}),X(U,{})]}),X(H,{children:Z(q,{spacing:6,align:`center`,w:`full`,children:[Z(St,{direction:`column`,align:`center`,children:[s||X(kt,{src:n,alt:t,w:`200px`,h:`200px`,objectFit:`contain`,borderRadius:`xl`}),a&&X(B,{mt:2,children:X(Bi,{category:a})})]}),X(K,{fontSize:`sm`,textAlign:`center`,children:i}),X(K,{fontSize:`sm`,textAlign:`center`,children:c(`Click below to access {{ name }} and explore its features.`,{name:t})})]})}),X(W,{children:Z(q,{w:`full`,spacing:4,children:[Z(z,{variant:`vechainKitSecondary`,onClick:()=>{window.open(r,`_blank`)},children:[c(`Launch {{name}}`,{name:t}),X(V,{as:On,ml:2})]}),X(Ji,{name:t,image:n,url:r,description:i})]})})]})},Xi=({txId:e,title:t,description:r,onDone:i,showSocialButtons:a=!1})=>{let{t:o}=Q(),{network:s}=n(),c=d(s.type).explorerUrl,l=`${c}/${e}`,u=J(`colors`,`vechain-kit-success`),f=J(`colors`,`vechain-kit-text-primary`),p=J(`colors`,`vechain-kit-text-secondary`);return Z(Y,{children:[Z(P,{children:[X(G,{children:t}),X(U,{})]}),X(H,{children:Z(q,{align:`center`,p:6,spacing:3,children:[X(V,{as:Cn,fontSize:`100px`,color:u,"data-testid":`success-icon`}),r&&X(K,{fontSize:`sm`,textAlign:`center`,color:f,children:r}),a&&e&&Z(q,{mt:2,spacing:3,children:[X(K,{fontSize:`sm`,fontWeight:`bold`,color:p,children:o(`Share on`)}),X(nt,{description:l})]})]})}),X(W,{justifyContent:`center`,children:Z(q,{width:`full`,spacing:4,children:[X(z,{onClick:i,variant:`vechainKitSecondary`,width:`full`,children:o(`Done`)}),e&&X(Pt,{href:`${c}/${e}`,isExternal:!0,opacity:.5,fontSize:`14px`,textDecoration:`underline`,children:Z(B,{spacing:1,alignItems:`center`,w:`full`,justifyContent:`center`,children:[X(K,{color:p,children:o(`View transaction on the explorer`)}),X(V,{size:16,as:On})]})})]})})]})},Zi=({txId:e,title:t,description:r,onDone:i})=>{let{t:a}=Q(),{network:o,darkMode:s}=n(),c=d(o.type).explorerUrl;return Z(Y,{children:[Z(P,{children:[X(G,{children:t}),X(U,{})]}),X(H,{children:Z(q,{align:`center`,p:6,spacing:3,children:[X(V,{as:Sn,fontSize:`100px`,color:s?`red.400`:`red.500`,"data-testid":`error-icon`}),r&&X(K,{fontSize:`sm`,textAlign:`center`,children:r})]})}),X(W,{justifyContent:`center`,children:Z(q,{width:`full`,spacing:4,children:[X(z,{onClick:i,variant:`vechainKitSecondary`,width:`full`,children:a(`Done`)}),e&&X(Pt,{href:`${c}/${e}`,isExternal:!0,opacity:.5,fontSize:`14px`,textDecoration:`underline`,children:Z(B,{spacing:1,alignItems:`center`,w:`full`,justifyContent:`center`,children:[X(K,{children:a(`View transaction on the explorer`)}),X(V,{size:16,as:On})]})})]})})]})},Qi=({isOpen:e,onClose:n,initialContent:r=`profile`})=>{let{account:i}=A(),{themeConfig:a}=t(),{accountModalContent:o,setAccountModalContent:s}=ie();return it(()=>{e&&s(r)},[e,r,s]),X(et,{isOpen:e,onClose:n,allowExternalFocus:!0,blockScrollOnMount:!0,mobileMinHeight:a?.modal?.useBottomSheetOnMobile?`520px`:`510px`,mobileMaxHeight:a?.modal?.useBottomSheetOnMobile?`520px`:`510px`,desktopMinHeight:`485px`,desktopMaxHeight:`485px`,children:(()=>{if(typeof o==`object`)switch(o.type){case`send-token`:return X(Hr,{...o.props});case`send-token-summary`:return X(Ur,{...o.props});case`swap-token`:return X(Jr,{...o.props});case`choose-name`:return X(Yr,{...o.props});case`choose-name-search`:return X($r,{...o.props});case`choose-name-summary`:return X(ei,{...o.props});case`app-overview`:return X(Yi,{...o.props,setCurrentContent:s});case`disconnect-confirm`:return X($e,{...o.props});case`remove-wallet-confirm`:return X(Oi,{...o.props});case`account-customization`:return X(ri,{...o.props});case`account-customization-summary`:return X(ii,{...o.props});case`successful-operation`:return X(Xi,{...o.props});case`failed-operation`:return X(Zi,{...o.props});case`upgrade-smart-account`:return X(ci,{...o.props});case`faq`:return X(ni,{...o.props});case`terms-and-privacy`:return X(wi,{...o.props});case`ecosystem-with-category`:return X(qi,{setCurrentContent:s,selectedCategory:o.props.selectedCategory});case`select-wallet`:return X(Di,{setCurrentContent:s,onClose:n,returnTo:o.props.returnTo,onLogoutSuccess:o.props.onLogoutSuccess});case`main`:return X(Br,{setCurrentContent:s,onClose:n,wallet:i,switchFeedback:o.props?.switchFeedback});case`profile`:return X(si,{setCurrentContent:s,onLogoutSuccess:()=>{n()},switchFeedback:o.props?.switchFeedback})}switch(o){case`main`:return X(Br,{setCurrentContent:s,onClose:n,wallet:i});case`settings`:return X(vi,{setCurrentContent:s,onLogoutSuccess:()=>{n()}});case`profile`:return X(si,{setCurrentContent:s,onLogoutSuccess:()=>{n()}});case`assets`:return X(li,{setCurrentContent:s});case`notifications`:return X(Ri,{setCurrentContent:s});case`receive-token`:return X(Wr,{setCurrentContent:s});case`swap-token`:return X(Jr,{setCurrentContent:s});case`connection-details`:return X(Ni,{onGoBack:()=>s(`settings`)});case`privy-linked-accounts`:return X(Fi,{onBack:()=>s(`settings`)});case`ecosystem`:return X(qi,{setCurrentContent:s});case`add-custom-token`:return X(ui,{setCurrentContent:s});case`change-currency`:return X(di,{setCurrentContent:s});case`change-language`:return X(fi,{setCurrentContent:s});case`gas-token-settings`:return X(hi,{setCurrentContent:s});default:return null}})()})};export{Mr as A,yr as B,Vr as C,Lr as D,Rr as E,Er as F,Tr as I,wr as L,jr as M,Ar as N,Pr as O,Dr as P,Cr as R,Hr as S,zr as T,vr as V,$r as _,vi as a,Wr as b,di as c,ci as d,si as f,ei as g,ni as h,wi as i,$ as j,Nr as k,ui as l,ri as m,Oi as n,hi as o,ii as p,Di as r,fi as s,Qi as t,li as u,Yr as v,Br as w,Ur as x,Jr as y,Sr as z};
|
|
20
|
+
//# sourceMappingURL=AccountModal-ChuVFqPc.js.map
|