@naculus/connect-appkit-ui 0.1.2
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/LICENSE +21 -0
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{useState as ze,useEffect as sn,useCallback as ln,useRef as cn}from"react";import{AppkitConnectButton as dn}from"@naculus/connect-appkit-react";import{createContext as Yt,useContext as Ze,useState as Ne,useCallback as Pe,useMemo as Je,useRef as Jt}from"react";import{useWeb3 as Zt}from"@naculus/connect-appkit-react";import{jsx as tn}from"react/jsx-runtime";var De=Yt(null);function Ae({children:e}){let t=Zt(),[n,o]=Ne(null),[r,a]=Ne(!1),[d,c]=Ne("idle"),[i,l]=Ne(null),p=Pe(()=>{o(null),a(!1),c("cancelled"),l(null)},[]),m=Jt(void 0);m.current=async()=>{if(!t.startPairing||!t.completePairing){l("WalletConnect pairing not available"),c("error");return}c("loading"),l(null),a(!0);try{let g=await t.startPairing();o(g),c("ready");try{await t.completePairing(),setTimeout(()=>{a(!1),o(null),c("idle")},1e3)}catch(w){c("error"),l(w instanceof Error?w.message:"Connection failed")}}catch(g){c("error"),l(g instanceof Error?g.message:"Failed to generate QR code")}};let f=Pe(async()=>{m.current?.()},[]),x=Pe(()=>{o(null),l(null),c("loading"),m.current?.()},[]),N=Je(()=>({qrUri:n,showQR:r,qrStatus:d,error:i}),[n,r,d,i]),u=Je(()=>({state:N,connectWalletConnect:f,cancelQR:p,retryQR:x}),[N,f,p,x]);return tn(De.Provider,{value:u,children:e})}function en(){let e=Ze(De);if(!e)throw new Error("useWalletConnect must be used within a WalletConnectProvider");return e}function Ee(){return Ze(De)}import{useState as et,useEffect as nn,useRef as on}from"react";function ue(){let[e,t]=et([]),[n,o]=et(!0),r=on(new Set);return nn(()=>{r.current.clear(),o(!0);let a=c=>{let i=c.detail,l=i?.info,p=i?.provider;!l?.rdns||r.current.has(l.rdns)||(r.current.add(l.rdns),t(m=>m.find(f=>f.id===l.rdns)?m:[...m,{id:l.rdns,name:l.name||l.rdns,icon:l.icon||"",rdns:l.rdns,provider:p}]))};window.addEventListener("eip6963:announceProvider",a),window.dispatchEvent(new Event("eip6963:requestProvider"));let d=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",a),clearTimeout(d)}},[]),{wallets:e,isDetecting:n,hasWallets:e.length>0}}import{useState as rn,useEffect as an}from"react";function me(){let[e,t]=rn(!1);return an(()=>{if(typeof navigator>"u"||typeof window>"u")return;let n=navigator.userAgent.toLowerCase();t(/(iphone|ipad|ipod|android|mobile)/i.test(n))},[]),e}import{jsx as tt}from"react/jsx-runtime";function te({className:e,isConnected:t,isConnecting:n,onConnect:o,onDisconnect:r,onMobileDeepLink:a,mobileWalletName:d,startPairing:c,completePairing:i,address:l,balance:p,balanceSymbol:m,tokenBalances:f,isBalanceLoading:x,explorerUrl:N,explorerLabel:u}){let g=Ee(),{wallets:w}=ue(),s=me(),[R,A]=ze(null),[H,K]=ze(!1),[U,Q]=ze(null),_=cn({aborted:!1});sn(()=>{if(!g)return;let{qrStatus:L,qrUri:G,error:j}=g.state;L==="loading"?(K(!0),A(null),Q(null)):L==="ready"&&G?(K(!1),A(G),Q(null)):L==="error"?(K(!1),Q(j)):L==="idle"&&(K(!1),A(null),Q(null))},[g?.state?.qrStatus,g?.state?.qrUri,g?.state?.error]);let F=ln((L,G)=>{if(L==="walletconnect"){if(g){g.connectWalletConnect();return}if(c&&i){K(!0),Q(null),_.current.aborted=!1,c().then(j=>{_.current.aborted||(A(j),K(!1),i().then(()=>{_.current.aborted||A(null)}).catch(se=>{_.current.aborted||Q(se instanceof Error?se.message:"Connection failed")}))}).catch(j=>{_.current.aborted||(K(!1),Q(j instanceof Error?j.message:"Connection failed"))});return}}o?.(L,()=>{},G)},[g,c,i,o]);return tt("div",{className:e,children:tt(dn,{connected:t??!1,connecting:n??!1,address:l??"",balance:p??null,balanceSymbol:m??"ETH",isBalanceLoading:x??!1,tokenBalancesJson:JSON.stringify(f??[]),explorerUrl:N??"",explorerLabel:u??"",walletsJson:JSON.stringify(w),isMobile:s,mobileWalletName:d??"",qrUri:R,qrLoading:H,qrError:U,onAppkitConnect:L=>{F(L.detail.kind,L.detail.walletId)},onAppkitDisconnect:()=>r?.(),onAppkitStartPairing:()=>F("walletconnect"),onAppkitRetry:()=>{_.current.aborted=!0,Q(null),A(null),F("walletconnect")},onAppkitMobileDeepLink:()=>a?.(),onAppkitCopyAddress:L=>{navigator.clipboard?.writeText(L.detail).catch(()=>{})}})})}import{logger as St}from"@naculus/connect-core";import{useState as Co,useRef as No,useEffect as wo}from"react";import{useChain as Ro,useWallet as ko}from"@naculus/connect-appkit-react";import{clsx as un}from"clsx";import{twMerge as mn}from"tailwind-merge";function k(...e){return mn(un(e))}var nt='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 0l-.26.97v28.15l.26.26 13.07-7.72L12 0z" fill="#8C8C8C"/><path d="M12 0L-.87 21.69l12.87 7.72V0z" fill="#3C3C3B"/><path d="M12 31.88l-.16.2v10.55l.16.47 13.08-18.42L12 31.88z" fill="#8C8C8C"/><path d="M12 42.9V31.88L-.87 24.68 12 42.9z" fill="#3C3C3B"/><path d="M12 28.41l13.07-7.72L12 14.09v14.32z" fill="#141414"/><path d="M-.87 20.69L12 28.41V14.09l-12.87 6.6z" fill="#393939"/></svg>',pn='<svg viewBox="0 0 24 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 12.3l-3.7 2.2-3.8-2.2V7.9L11.3 5.7 15 7.9v2.7l-2.2 1.3-1.5-.9v-2l1.5.9 2.2-1.3V7.9L11.3 4 6 7.9v6.3l5.3 3.1 5.3-3.1-1.6-2.8z" fill="#6C00F6"/></svg>',fn='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#F0B90B"/><path d="M12 4l2.7 1.6L14.7 7 12 5.4 9.3 7l-.7-.4L12 4zm4.7 2.7l-2.7 1.6V10l4 2.3v4.7L16 18.7v-4l-1.3-.7v4L12 20l-2.7-1.6v-4L8 14.7v4l-1.3-.7V12.3l4-2.3V8.3l-2.7-1.6.7-.4L12 8l2.7-1.7.7.4z" fill="white"/></svg>',gn='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.5c.3 0 .6.1.8.2l8.8 5.1c.5.3.9.9.9 1.5v10.2c0 .6-.3 1.2-.9 1.5l-8.8 5.1c-.3.2-.6.2-.8.2s-.6-.1-.8-.2l-8.8-5.1c-.5-.3-.9-.9-.9-1.5V8.3c0-.6.3-1.2.9-1.5l8.8-5.1c.3-.2.6-.2.8-.2z" fill="#213147"/><path d="M14.7 13.8l-1.2 3.2c0 .1 0 .2.1.3l2 5.5 2.3-1.3-2.8-7.6c-.1-.2-.3-.2-.4-.1z" fill="#12AAFF"/><path d="M16.3 8.5c0-.2-.3-.2-.4 0l-1.1 3.2c0 .1 0 .2.1.3l3.3 9 2.3-1.3-4.2-9.1v-.1z" fill="#12AAFF"/><path d="M12 3.5c.1 0 .2 0 .3.1l8.8 5.1c.1.1.2.2.2.3v10.2c0 .1-.1.2-.2.3l-8.8 5.1c-.1 0-.2.1-.3.1s-.2 0-.3-.1l-8.8-5.1c-.1-.1-.2-.2-.2-.3V9c0-.1.1-.2.2-.3l8.8-5.1c.1 0 .2-.1.3-.1z" fill="#9DCCED" fill-opacity="0.3"/><path d="M13.3 6.2h-2.2c-.2 0-.3.1-.4.3L5.9 19.6l2.3 1.3L13 6.5c0-.1-.1-.3-.2-.3h.4z" fill="white"/><path d="M15.2 6.2H13c-.2 0-.3.1-.4.3L8.1 21.4l2.3 1.3 6-16.4c0-.1-.1-.3-.2-.3v.2z" fill="white"/></svg>',vn='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF0420"/><path d="M8.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.3-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.3-.4.6-.7 1-.9.4-.2.8-.3 1.3-.3.4 0 .8.1 1.2.2.3.2.6.4.8.7l-1 1c-.2-.2-.4-.3-.6-.4-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.9.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.9.1.3.3.5.6.6.3.2.6.2.9.2.3 0 .6-.1.8-.2.2-.1.4-.3.6-.5l1 1c-.2.3-.5.5-.8.7-.4.2-.9.3-1.4.3z" fill="white"/><path d="M15.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.2-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.2-.4.5-.7.9-.9.4-.2.8-.3 1.3-.3.5 0 1 .1 1.4.3.4.2.7.5.9.9.2.4.3.9.3 1.4v.7h-2.9v-1.1c0-.3-.1-.6-.2-.9-.1-.3-.3-.5-.5-.6-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.8.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.8.1.3.3.5.6.6.2.2.5.2.8.2.3 0 .6-.1.8-.2.2-.1.4-.3.5-.6.1-.3.2-.6.2-1v-1.1h2.9v.7c0 .5-.1 1-.3 1.4-.2.4-.5.7-.9.9-.4.2-.9.3-1.4.3z" fill="white"/></svg>',bn='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#E84142"/><path d="M8.6 16.8H6.3c-.5 0-.8-.1-1-.3-.2-.2-.3-.5-.3-.8 0-.2 0-.4.1-.6l5.8-10.7c.2-.4.5-.7.8-.8.3-.1.5-.1.7 0 .2.1.5.3.7.8l1.2 2.1.1.2c.3.5.5.9.5 1.3.1.4.1.8 0 1.1-.1.4-.3.8-.6 1.3l-3 5.4c-.2.5-.5.8-.8 1-.4.2-.7.2-1.2.2z" fill="white"/><path d="M14.5 16.8h3.3c.5 0 .7-.1 1-.3.2-.2.3-.5.3-.8 0-.2-.1-.4-.3-.7l-1.7-3-.2-.3c-.2-.4-.4-.7-.6-.8-.2-.1-.4-.1-.6 0-.2.1-.4.3-.6.8l-1.6 3c-.2.4-.4.7-.4.9 0 .2.1.5.3.7.1.1.4.3.9.3z" fill="white"/></svg>',xn='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#1969FF"/><path d="M11.3 3.8c.4-.2 1-.2 1.4 0l4.1 2.2c.2.1.4.3.4.5h0v10.9c0 .2-.1.4-.4.6l-4.1 2.2c-.4.2-1 .2-1.4 0l-4.1-2.2c-.3-.1-.4-.4-.4-.6V6.5c0-.2.1-.4.4-.5l4.1-2.2zm5.3 8.7l-3.9 2c-.4.2-1 .2-1.4 0l-3.9-2v4.8l3.9 2c.2.1.5.2.7.2.2 0 .5-.1.7-.2l3.9-2v-4.8z" fill="white"/></svg>',yn={"eip155:1":nt,"eip155:137":pn,"eip155:56":fn,"eip155:42161":gn,"eip155:10":vn,"eip155:43114":bn,"eip155:250":xn,"eip155:11155111":nt};function we(e){return yn[e]}import{createContext as go,useContext as vo,useMemo as bo}from"react";import{Wallet as hn}from"lucide-react";import{jsx as ie,jsxs as Me}from"react/jsx-runtime";function Cn({children:e}){return ie("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground",children:e})}function We({className:e,showAddress:t=!0,showBalance:n=!1,address:o,balance:r,balanceSymbol:a,onConnect:d}){let i=T().Button;if(!o)return Me(i,{"aria-label":"Connect Wallet",onClick:d,className:e,children:[ie(hn,{size:18,className:"shrink-0"}),"Connect Wallet"]});let l=o.includes(":")?o.split(":").pop():o,p=l.slice(0,6)+"..."+l.slice(-4),m=r!=null?parseFloat(r).toLocaleString(void 0,{maximumFractionDigits:4})+" "+(a??"ETH"):null;return Me(i,{className:e,children:[ie(Cn,{children:"W"}),Me("div",{className:"flex flex-col items-start gap-0",children:[t&&ie("span",{className:"font-mono text-xs",children:p}),n&&m&&ie("span",{className:"text-xs text-muted-foreground",children:m}),n&&!m&&r===null&&ie("span",{className:"text-xs text-muted-foreground",children:"Loading..."})]})]})}import{useRef as st,useEffect as it,useState as lt,useCallback as wn}from"react";import{Smartphone as Rn,RefreshCw as ct,CheckCircle2 as kn,AlertCircle as dt,Loader2 as Tn}from"lucide-react";import{useEffect as ot}from"react";import{X as Nn}from"lucide-react";import{jsx as Y,jsxs as Le}from"react/jsx-runtime";function le({open:e,onClose:t,children:n,closable:o}){return ot(()=>{if(!e)return;let r=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=r}},[e]),ot(()=>{if(!e||!t)return;let r=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t]),e?Le("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[Y("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:t}),Le("div",{role:"dialog","aria-modal":"true",className:"relative z-10 w-full max-w-sm rounded-xl border bg-card text-card-foreground shadow-2xl max-h-[85vh] overflow-y-auto p-6",children:[o&&t&&Y("button",{onClick:t,type:"button","aria-label":"Close modal",className:"absolute right-4 top-4 z-20 rounded-md p-1 text-muted-foreground hover:text-foreground",children:Y("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:Y("path",{d:"M18 6 6 18M6 6l12 12","data-testid":"x-icon"})})}),n]})]}):null}function rt({title:e,onClose:t,showCloseButton:n=!0}){return Le("div",{className:"flex items-center justify-between mb-4",children:[Y("h2",{className:"text-lg font-semibold m-0",children:e}),n&&t&&Y("button",{onClick:t,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200","aria-label":"Close",children:Y(Nn,{size:16})})]})}function at({children:e,className:t=""}){return Y("div",{className:k("flex flex-col gap-4",t),children:e})}import{jsx as z,jsxs as q}from"react/jsx-runtime";async function Sn(e,t){let n=await import("qrcode");return new Promise((o,r)=>{n.toCanvas(e,t,{width:280,margin:2},a=>{a?r(a):o()})})}function pe({uri:e,open:t,onClose:n,onDeepLink:o,onRetry:r,status:a="pending",showDeepLink:d,timeoutMs:c=300*1e3,title:i="Scan with WalletConnect",description:l="Open your wallet app and scan this QR code to connect.",className:p}){let m=st(null),[f,x]=lt(!1),[N,u]=lt(0),g=me(),w=T(),s=w.Button,R=d??g,A=st(null);it(()=>{!t||!e||!m.current||(x(!1),Sn(m.current,e).catch(()=>x(!0)))},[t,e]),it(()=>{if(!t||a!=="pending"){A.current&&(clearInterval(A.current),A.current=null),u(0);return}let ye=Date.now();return A.current=setInterval(()=>u(Date.now()-ye),1e3),()=>{A.current&&clearInterval(A.current)}},[t,a,c]);let H=N>=c&&a==="pending",K=H||a==="expired"||a==="error",U=Math.max(0,Math.ceil((c-N)/1e3)),Q=Math.floor(U/60),_=U%60,F=Math.min(N/c,1),L=wn(()=>{e&&o&&o(e)},[e,o]),G=e&&!H&&a==="pending"?f?q("div",{className:"w-[280px] h-[280px] flex flex-col items-center justify-center bg-muted rounded-lg gap-2",children:[z(dt,{size:24,className:"text-muted-foreground"}),z("span",{className:"text-sm text-muted-foreground",children:"Failed to render QR code"})]}):z("canvas",{ref:m,width:280,height:280,className:"rounded-lg border border-border"}):q("div",{className:"flex flex-col items-center justify-center gap-3 bg-muted rounded-lg w-[280px] h-[280px]",children:[a==="scanned"?z(kn,{size:48,className:"text-[hsl(var(--primary))]"}):z(dt,{size:48,className:"text-destructive"}),z("span",{className:"text-sm text-muted-foreground","data-testid":"status-label",children:a==="scanned"?"QR code scanned! Connecting...":H||a==="expired"?"Connection timed out.":"Something went wrong. Try again."})]}),se=w.Modal??le;return z(se,{open:t,onClose:n,closable:!0,title:i,className:p,children:q("div",{className:"p-6",children:[q("div",{className:"text-center mb-5",children:[z("div",{className:"flex justify-center mb-3",children:a==="pending"&&!H&&z(Tn,{size:20,className:"animate-spin text-primary","data-testid":"loader-icon-inline"})}),z("h3",{className:"text-lg font-semibold m-0 text-foreground",children:i}),l&&z("p",{className:"text-sm text-muted-foreground mt-1.5 mb-0",children:l})]}),z("div",{className:"flex justify-center mb-4",children:G}),a==="pending"&&!H&&q("div",{className:"mb-3",children:[z("div",{className:"h-1 bg-muted rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Math.round((1-F)*100),"aria-valuemin":0,"aria-valuemax":100,children:z("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${(1-F)*100}%`}})}),q("p",{"data-testid":"countdown",className:"text-xs text-muted-foreground text-center mt-1.5 mb-0",children:["Expires in ",Q,":",_.toString().padStart(2,"0")]})]}),q("div",{className:"flex flex-col gap-2",children:[R&&e&&a==="pending"&&!H&&q("button",{onClick:L,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg border border-input bg-card px-4 py-2.5 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[z(Rn,{size:16})," Open in Wallet App"]}),K&&r&&(s?q(s,{onClick:r,variant:"default",size:"default",className:"w-full",children:[z(ct,{size:16})," Generate New QR Code"]}):q("button",{onClick:r,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg bg-primary text-primary-foreground px-4 py-2.5 text-sm font-medium hover:bg-primary/90 transition-all duration-200 cursor-pointer border-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[z(ct,{size:16})," Generate New QR Code"]})),s?z(s,{onClick:n,variant:"outline",size:"default",className:"w-full",children:"Cancel"}):z("button",{onClick:n,className:"inline-flex items-center justify-center w-full rounded-lg border border-input bg-transparent px-4 py-2.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Cancel"})]})]})})}import{useState as ut}from"react";import{LogIn as Bn,Loader2 as Pn,CheckCircle2 as He,AlertCircle as Dn,X as An,Copy as En,Check as zn}from"lucide-react";import{Fragment as mt,jsx as y,jsxs as M}from"react/jsx-runtime";function Ve({className:e,isSignedIn:t=!1,isSigningIn:n=!1,result:o=null,error:r=null,onSignIn:a,onClearError:d,children:c}){let[i,l]=ut(!1),[p,m]=ut(!1),f=T(),x=f.Button,N=f.Dialog,u=f.DialogContent,g=f.DialogHeader,w=f.DialogTitle,s=async()=>{if(o?.signature)try{await navigator.clipboard.writeText(o.signature),m(!0),setTimeout(()=>m(!1),2e3)}catch{}};return!t&&!n&&!r?y(x,{onClick:a,className:e,"aria-label":"Sign In",children:M("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[y(Bn,{size:16}),c??"Sign In"]})}):n?y(x,{disabled:!0,className:e,"aria-label":"Signing In",children:M("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[y(Pn,{size:16,className:"animate-spin"}),"Signing In..."]})}):r&&!t?M("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column"},children:[y(x,{onClick:a,className:e,"aria-label":"Retry Sign In",children:M("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[y(Dn,{size:16,style:{color:"var(--destructive, #ef4444)"}}),c??"Retry Sign In"]})}),y("div",{style:{fontSize:"0.75rem",color:"var(--destructive, #ef4444)",padding:"0.25rem 0.5rem",borderRadius:"0.375rem",background:"var(--destructive-foreground, #fef2f2)",marginTop:"2px",wordBreak:"break-word",maxWidth:"100%",lineHeight:1.4},children:r.message})]}):M("div",{style:{position:"relative",display:"inline-block"},children:[y(x,{onClick:()=>l(R=>!R),className:e,children:M("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[y(He,{size:16,style:{color:"#22c55e"}}),y("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Signed In"})]})}),i&&(N&&u?y(N,{open:!0,onOpenChange:R=>{R||l(!1)},children:y(u,{children:g&&w?M(mt,{children:[y(g,{children:y(w,{children:"Sign-In Details"})}),y(Ie,{result:o,onClose:()=>l(!1),copiedSign:p,onCopy:s})]}):M(mt,{children:[y("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Sign-In Details"}),y(Ie,{result:o,onClose:()=>l(!1),copiedSign:p,onCopy:s})]})})}):i&&y("div",{style:{position:"absolute",top:"calc(100% + 8px)",right:0,zIndex:100,width:"340px",maxWidth:"90vw",background:"var(--card, #fff)",border:"1px solid var(--border, #e2e8f0)",borderRadius:"0.75rem",boxShadow:"0 10px 25px rgba(0,0,0,0.1)",padding:"1rem"},children:y(Ie,{result:o,onClose:()=>l(!1),copiedSign:p,onCopy:s})}))]})}function Ie({result:e,onClose:t,copiedSign:n,onCopy:o}){let a=T().Button;if(!e)return M("div",{style:{textAlign:"center",padding:"1rem 0"},children:[y(He,{size:32,style:{color:"#22c55e",margin:"0 auto 0.75rem"}}),y("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground, #64748b)"},children:"Authenticated successfully"}),y(a,{variant:"outline",size:"sm",onClick:t,children:"Close"})]});let{message:d,signature:c}=e,i=c.length>20?c.slice(0,14)+"..."+c.slice(-6):c;return M("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[M("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[M("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[y(He,{size:18,color:"#22c55e"}),y("span",{style:{fontWeight:600,fontSize:"0.9375rem"},children:"Signed In"})]}),y(a,{variant:"ghost",size:"icon",onClick:t,children:y(An,{size:16})})]}),M("div",{style:{display:"grid",gap:"0.375rem"},children:[M("div",{children:[y("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Domain"}),y("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:d.domain})]}),M("div",{children:[y("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Address"}),y("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem",wordBreak:"break-all"},children:d.address})]}),M("div",{children:[y("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Chain"}),y("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:d.chainId})]})]}),d.statement&&y("div",{style:{padding:"0.5rem 0.625rem",borderRadius:"0.375rem",background:"var(--muted, #f1f5f9)",fontSize:"0.8125rem",lineHeight:1.5},children:d.statement}),M("div",{children:[M("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.25rem"},children:[y("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature"}),y(a,{variant:"ghost",size:"icon",onClick:o,title:"Copy signature",children:n?y(zn,{size:12,color:"#22c55e"}):y(En,{size:12})})]}),y("p",{style:{fontSize:"0.75rem",fontFamily:"monospace",wordBreak:"break-all",lineHeight:1.4,color:"var(--muted-foreground, #64748b)",background:"var(--muted, #f1f5f9)",padding:"0.375rem 0.5rem",borderRadius:"0.375rem"},children:i})]}),y(a,{variant:"outline",className:"w-full",onClick:t,children:"Close"})]})}import{useState as J,useCallback as ne,useMemo as Mn}from"react";import{AlertTriangle as Wn,Check as Oe,Copy as Ln,Download as In,Eye as Hn,EyeOff as Vn,SkipForward as pt,ArrowLeft as On,ArrowRight as Un,Shield as Kn,X as Qn}from"lucide-react";import{Fragment as Ke,jsx as h,jsxs as S}from"react/jsx-runtime";function Ue(e){let t=[...e];for(let n=t.length-1;n>0;n--){let o=Math.floor(Math.random()*(n+1));[t[n],t[o]]=[t[o],t[n]]}return t}function ft(e,t=3){let n=e.trim().split(/\s+/);return Ue(n.map((r,a)=>a)).slice(0,Math.min(t,n.length)).map(r=>{let a=n[r],d=n.filter((l,p)=>p!==r),c=Ue(d).slice(0,3),i=Ue([a,...c]);return{index:r,correct:a,options:i}})}function fe({seedPhrase:e,onConfirm:t,onSkip:n,onExportPrivateKey:o,className:r,wordCount:a,inline:d=!1,open:c=!0,onOpenChange:i}){let l=T(),p=l.Button,m=l.Dialog,f=l.DialogContent,x=l.DialogHeader,N=l.DialogTitle,[u,g]=J("reveal"),[w,s]=J(!1),[R,A]=J(!1),[H,K]=J(()=>ft(e,3)),[U,Q]=J({}),[_,F]=J([]),[L,G]=J(!1),[j,se]=J(null),ye=Mn(()=>e.trim().split(/\s+/),[e]),hr=a??(ye.length===24?24:12),Ot=ne(()=>s(!0),[]),Ut=ne(async()=>{try{await navigator.clipboard.writeText(e),A(!0),setTimeout(()=>A(!1),2e3)}catch{}},[e]),Kt=ne(()=>{K(ft(e,3)),Q({}),F([]),g("confirm")},[e]),Qt=ne((E,$)=>{Q(X=>({...X,[E]:$})),F(X=>X.filter(Be=>Be!==E))},[]),$t=ne(()=>{let E=[];for(let $ of H)U[$.index]!==$.correct&&E.push($.index);if(E.length>0){F(E);return}g("done"),t()},[H,U,t]),Ye=ne(()=>{n?.()},[n]),_t=ne(()=>{if(o){let E=o();se(E),G(!0)}},[o]),Ft=H.every(E=>U[E.index]!==void 0),jt=S("div",{className:"space-y-4",children:[h("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 px-4 py-3",children:S("div",{className:"flex items-start gap-2",children:[h(Wn,{size:16,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),h("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:"Write down these words in order and store them somewhere safe. Never share them with anyone. If you lose your seed phrase, your funds cannot be recovered."})]})}),w?S(Ke,{children:[h("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:ye.map((E,$)=>S("div",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2.5 py-1.5 text-sm",children:[h("span",{className:"text-xs text-muted-foreground w-5 shrink-0 text-right",children:$+1}),h("span",{className:"font-mono font-medium",children:E})]},$))}),S("div",{className:"flex flex-wrap gap-2",children:[S(p,{onClick:Ut,variant:"outline",size:"sm",children:[R?h(Oe,{size:14}):h(Ln,{size:14}),R?"Copied":"Copy"]}),o&&S(p,{onClick:_t,variant:"outline",size:"sm",children:[h(In,{size:14}),"Export Private Key"]})]}),L&&j&&S("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[S("div",{className:"flex items-center gap-2",children:[h(Vn,{size:14,className:"text-muted-foreground"}),h("span",{className:"text-xs font-medium text-muted-foreground",children:"Private Key (keep secret!)"})]}),h("p",{className:"font-mono text-xs break-all select-all",children:j})]}),S("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[S(p,{onClick:Kt,variant:"default",children:["I've Saved It",h(Un,{size:16})]}),n&&S(p,{onClick:Ye,variant:"ghost",size:"sm",children:[h(pt,{size:14}),"Skip Backup"]})]})]}):S("div",{className:"flex flex-col items-center gap-3 py-6",children:[h(Kn,{size:40,className:"text-muted-foreground"}),h("p",{className:"text-sm text-muted-foreground text-center",children:"Click the button below to reveal your seed phrase. Make sure no one is watching your screen."}),S(p,{onClick:Ot,variant:"default",children:[h(Hn,{size:16}),"Reveal Seed Phrase"]})]})]}),qt=S("div",{className:"space-y-4",children:[h("p",{className:"text-sm text-muted-foreground",children:"Verify your backup by selecting the correct word for each position."}),H.map(E=>{let $=_.includes(E.index);return S("div",{className:"space-y-2",children:[S("p",{className:k("text-sm font-medium",$?"text-destructive":"text-foreground"),children:["Word #",E.index+1,$&&h("span",{className:"ml-2 text-xs text-destructive",children:"(incorrect)"})]}),h("div",{className:"grid grid-cols-2 gap-2",children:E.options.map(X=>{let Be=U[E.index]===X;return h("button",{onClick:()=>Qt(E.index,X),className:k("rounded-md border px-3 py-2 text-sm font-mono transition-all duration-200 cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",Be?"border-primary bg-primary/10 text-primary font-medium":$?"border-destructive/50 bg-destructive/5":"border-border bg-card hover:border-primary/50"),children:X},X)})})]},E.index)}),S("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[S(p,{onClick:$t,variant:"default",disabled:!Ft,children:[h(Oe,{size:16}),"Verify & Confirm"]}),S("div",{className:"flex gap-2",children:[S(p,{onClick:()=>g("reveal"),variant:"ghost",size:"sm",children:[h(On,{size:14}),"Back"]}),n&&S(p,{onClick:Ye,variant:"ghost",size:"sm",children:[h(pt,{size:14}),"Skip"]})]})]})]}),Gt={reveal:jt,confirm:qt,done:S("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[h("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:h(Oe,{size:24,className:"text-green-600 dark:text-green-400"})}),h("p",{className:"font-medium text-foreground",children:"Backup Confirmed"}),h("p",{className:"text-sm text-muted-foreground",children:"Your seed phrase has been backed up successfully."})]})},Xt={reveal:"Backup Seed Phrase",confirm:"Verify Backup",done:"Backup Complete"},he=Gt[u],Ce=Xt[u];return d?S("div",{className:k("space-y-4",r),children:[u!=="done"&&h("h3",{className:"text-lg font-semibold",children:Ce}),he]}):c?m&&f?h(m,{open:!0,onOpenChange:E=>{E||i?.(!1)},children:h(f,{children:x&&N?S(Ke,{children:[h(x,{children:h(N,{children:Ce})}),h("div",{className:"mt-2 max-h-[55vh] overflow-y-auto",children:he})]}):S(Ke,{children:[h("div",{className:"mb-3 text-lg font-semibold",children:Ce}),h("div",{className:"max-h-[55vh] overflow-y-auto",children:he})]})})}):S(le,{open:!0,onClose:()=>i?.(!1),children:[S("div",{className:"flex items-center justify-between mb-4",children:[h("h2",{className:"text-lg font-semibold m-0",children:Ce}),i&&h("button",{onClick:()=>i(!1),type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200 cursor-pointer border-none bg-transparent","aria-label":"Close",children:h(Qn,{size:16})})]}),he]}):null}import $n from"react";import{Fragment as gt,jsx as I,jsxs as Z}from"react/jsx-runtime";function _n({error:e,reset:t,dismiss:n,retryLabel:o="Try Again"}){let r=T(),a=r.Button,d=r.Dialog,c=r.DialogContent,i=r.DialogHeader,l=r.DialogTitle;if(d&&c)return I(d,{open:!0,onOpenChange:()=>{},children:I(c,{children:i&&l?Z(gt,{children:[I(i,{children:I(l,{children:"Something went wrong"})}),Z("div",{style:{marginTop:"0.5rem"},children:[I("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:e.message||"An unexpected error occurred while connecting your wallet."}),Z("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&I(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),I(a,{variant:"default",size:"default",onClick:t,children:o})]})]})]}):Z(gt,{children:[I("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Something went wrong"}),I("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:e.message||"An unexpected error occurred while connecting your wallet."}),Z("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&I(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),I(a,{variant:"default",size:"default",onClick:t,children:o})]})]})})});let p=!0,m=n??void 0;return Z(le,{open:p,onClose:m,children:[I(rt,{title:"Something went wrong",onClose:m,showCloseButton:!!n}),Z(at,{children:[I("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:e.message||"An unexpected error occurred while connecting your wallet."}),Z("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&I(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),I(a,{variant:"default",size:"default",onClick:t,children:o})]})]})]})}var ge=class extends $n.Component{constructor(t){super(t),this.state={hasError:!1,error:null,dismissed:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t,dismissed:!1}}componentDidCatch(t,n){this.props.onError?.(t,n)}handleReset=()=>{this.setState({hasError:!1,error:null,dismissed:!1}),this.props.onReset?.()};handleDismiss=()=>{this.setState(t=>({...t,dismissed:!0})),this.props.onDismiss?.()};render(){return this.state.dismissed?this.props.children:this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback({error:this.state.error,reset:this.handleReset}):I(_n,{error:this.state.error,reset:this.handleReset,dismiss:this.props.onDismiss?this.handleDismiss:void 0,retryLabel:this.props.retryLabel}):this.props.children}};import{createContext as so,useContext as io,useMemo as ht,useState as yt,useCallback as Se,useEffect as lo}from"react";import{useAccount as Ct,useWallet as co,useChain as uo,useEmbeddedWallet as mo,useDisconnect as Nt,useBalance as po}from"@naculus/connect-appkit-react";import{createContext as to,useContext as no,useMemo as oo}from"react";import{Web3ConnectProvider as ro}from"@naculus/connect-appkit-react";import{createContext as jn,useContext as qn,useMemo as Re,useEffect as ke,useCallback as Gn,useState as Te}from"react";var ce={primary:{name:"--primary",fallback:"221.2 83.2% 53.3%"},"primary-foreground":{name:"--primary-foreground",fallback:"210 40% 98%"},background:{name:"--background",fallback:"0 0% 100%"},foreground:{name:"--foreground",fallback:"222.2 84% 4.9%"},card:{name:"--card",fallback:"0 0% 100%"},"card-foreground":{name:"--card-foreground",fallback:"222.2 84% 4.9%"},popover:{name:"--popover",fallback:"0 0% 100%"},"popover-foreground":{name:"--popover-foreground",fallback:"222.2 84% 4.9%"},secondary:{name:"--secondary",fallback:"210 40% 96.1%"},"secondary-foreground":{name:"--secondary-foreground",fallback:"222.2 47.4% 11.2%"},muted:{name:"--muted",fallback:"210 40% 96.1%"},"muted-foreground":{name:"--muted-foreground",fallback:"215.4 16.3% 46.9%"},accent:{name:"--accent",fallback:"210 40% 96.1%"},"accent-foreground":{name:"--accent-foreground",fallback:"222.2 47.4% 11.2%"},destructive:{name:"--destructive",fallback:"0 84.2% 60.2%"},border:{name:"--border",fallback:"214.3 31.8% 91.4%"},input:{name:"--input",fallback:"214.3 31.8% 91.4%"},ring:{name:"--ring",fallback:"221.2 83.2% 53.3%"},radius:{name:"--radius",fallback:"0.5rem"}},Fn=new Map;function Qe(){Fn.clear()}import{jsx as Zn,jsxs as eo}from"react/jsx-runtime";var vt=jn({theme:{},isDark:!1,setTheme:()=>{},toggleDarkMode:()=>{}});function Xn(e){let t=[];for(let[n,o]of Object.entries(e)){let r=ce[n];r&&o&&t.push(" "+r.name+": "+o+";")}return t.length===0?"":`:root {
|
|
2
|
+
`+t.join(`
|
|
3
|
+
`)+`
|
|
4
|
+
}`}function Yn(e){let t=new Set;if(e!=="computed"||typeof document>"u")return t;for(let n of Object.keys(ce)){let o=ce[n],r=getComputedStyle(document.documentElement).getPropertyValue(o.name).trim();r&&r!==o.fallback&&t.add(n)}return t}function $e({children:e,theme:t={},defaultDark:n=!1,priority:o="fallback"}){let[r,a]=Te(t),[d,c]=Te(n);ke(()=>{Qe()},[r]);let[i,l]=Te(new Set);ke(()=>{l(Yn(o))},[o]);let p=Re(()=>{if(o==="fallback"||i.size===0)return r;let u={};for(let[g,w]of Object.entries(r))!i.has(g)&&w&&(u[g]=w);return u},[r,o,i]),m=Re(()=>Xn(p),[p]);ke(()=>{if(typeof document>"u")return;let u=document.documentElement;d?u.classList.add("dark"):u.classList.remove("dark"),Qe()},[d]);let f=Re(()=>"w3c-theme-"+Math.random().toString(36).slice(2,9),[]),x=Gn(()=>c(u=>!u),[]),N=Re(()=>({theme:r,isDark:d,setTheme:a,toggleDarkMode:x}),[r,d,x]);return eo(vt.Provider,{value:N,children:[m?Zn("style",{id:f,dangerouslySetInnerHTML:{__html:m}}):null,e]})}function bt(){return qn(vt)}function Jn(e){let{theme:t}=bt(),[n,o]=Te("");return ke(()=>{let r=ce[e];if(!r)return;let a=t[e];if(a){o(a);return}if(typeof document>"u"){o(r.fallback);return}let d=getComputedStyle(document.documentElement).getPropertyValue(r.name).trim();o(d||r.fallback)},[e,t]),n||ce[e]?.fallback||""}import{jsx as ve}from"react/jsx-runtime";var xt=to({mode:"walletconnect"});function ao(){return no(xt)}function be({config:e,children:t,autoConnect:n=!1,detectionMode:o="walletconnect",theme:r,defaultDark:a=!1,themePriority:d="computed"}){let c=oo(()=>({mode:o}),[o]),i=o==="walletconnect"||o==="auto";return ve(xt.Provider,{value:c,children:ve($e,{theme:r,defaultDark:a,priority:d,children:ve(_e,{components:{QRCodeModal:pe},children:ve(ro,{config:e,autoConnect:n,children:i?ve(Ae,{children:t}):t})})})})}import{jsx as oe,jsxs as kt}from"react/jsx-runtime";var wt=so(null);function Rt(){let e=io(wt);if(!e)throw new Error("useAppKit must be used within an <AppKit> component");return e}function Fe({projectId:e,metadata:t,enableEmbedded:n=!1,enablePasskeys:o=!1,children:r,className:a,autoConnect:d=!1,theme:c,defaultDark:i=!1,themePriority:l="computed",detectionMode:p="auto"}){let[m,f]=yt(!1),[x,N]=yt(!1),u=ht(()=>({projectId:e,metadata:t,enableEmbedded:n,enablePasskeys:o}),[e,t,n,o]);return oe(be,{config:u,autoConnect:d,detectionMode:p,theme:c,defaultDark:i,themePriority:l,children:oe(fo,{className:a,open:m,setOpen:f,backupOpen:x,setBackupOpen:N,children:r})})}function fo({children:e,className:t,open:n,setOpen:o,backupOpen:r,setBackupOpen:a}){let{isConnected:d,isConnecting:c}=co(),{primaryAccount:i}=Ct(),{currentChain:l,availableChains:p,switchChain:m}=uo(),f=mo(),{disconnect:x}=Nt(),{wallets:N,hasWallets:u}=ue(),{formatted:g}=po(),w=g??null,s=Se(async()=>{await x()},[x]),R=Se(()=>{f.confirmBackup(),a(!1)},[f]),A=Se(()=>{a(!1)},[]),H=Se(()=>f.wallet?.privateKey??null,[f.wallet]),K=ht(()=>({connect:()=>o(!0),disconnect:s,isConnected:d,isConnecting:c,address:i,balance:w,balanceSymbol:l?.token??"ETH",chainName:l?.name??null,availableChains:p.map(U=>({id:U.id,namespace:U.namespace,name:U.name,token:U.token})),switchChain:m,wallets:N,hasWallets:u,backupPending:f.backupPending,seedPhrase:f.seedPhrase,confirmBackup:R,skipBackup:A,open:n,setOpen:o}),[d,c,i,w,l,p,m,N,u,f.backupPending,f.seedPhrase,R,A,s,n,o]);return lo(()=>{f.seedPhrase&&f.backupPending&&a(!0)},[f.seedPhrase,f.backupPending,a]),kt(wt.Provider,{value:K,children:[e,f.seedPhrase&&r&&oe(fe,{seedPhrase:f.seedPhrase,onConfirm:R,onSkip:A,onExportPrivateKey:H,open:r,onOpenChange:a})]})}function je({className:e}){let t=Rt(),{primaryAccount:n}=Ct(),{disconnect:o}=Nt();return t.isConnected&&n?kt("div",{className:k("inline-flex items-center gap-2",e),children:[oe(de,{variant:"minimal"}),oe(te,{isConnected:t.isConnected,address:n,balance:t.balance,balanceSymbol:t.balanceSymbol,onDisconnect:o,className:e})]}):oe(te,{isConnected:t.isConnected,isConnecting:t.isConnecting,address:n,balance:t.balance,balanceSymbol:t.balanceSymbol,onDisconnect:o,className:e})}function qe({className:e,variant:t="dropdown"}){return oe(de,{className:e,variant:t})}import{jsx as ho}from"react/jsx-runtime";var xo={ConnectButton:te,AccountButton:We,ChainSelector:de,QRCodeModal:pe,SignInButton:Ve,SeedPhraseBackup:fe,ErrorBoundary:ge,AppKit:Fe,AppKitButton:je,AppKitChainSelector:qe,Web3ConnectUI:be},Tt=go({});function _e({children:e,components:t={}}){let n=bo(()=>({...xo,...t}),[t]);return ho(Tt.Provider,{value:n,children:e})}function T(){return vo(Tt)}function yo(e){return T()[e]}import{jsx as V,jsxs as re}from"react/jsx-runtime";function xe({chainId:e,className:t}){let n=we(e);return n?V("span",{className:k("inline-flex items-center justify-center shrink-0",t),dangerouslySetInnerHTML:{__html:n}}):null}function de({className:e,showLabel:t=!0,variant:n="dropdown"}){let{currentChain:o,availableChains:r,switchChain:a,isEvm:d}=Ro(),{isConnected:c}=ko(),[i,l]=Co(!1),m=T().Button,f=No(null);if(wo(()=>{function u(g){f.current&&!f.current.contains(g.target)&&l(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]),!c)return null;let x=o?.name??"Unknown Chain",N=r.length>1;return n==="minimal"?re("div",{className:k("inline-flex items-center gap-1.5 text-xs text-muted-foreground",e),children:[o&&V(xe,{chainId:`${o.namespace}:${o.id}`,className:"h-3.5 w-3.5"}),x]}):n==="buttons"?V("div",{className:k("flex flex-wrap gap-2",e),children:r.map(u=>{let g=u.id===o?.id&&u.namespace===o?.namespace,w=`${u.namespace}:${u.id}`;return re(m,{className:g?k("bg-accent","border-primary"):"",onClick:()=>{g||a(w).catch(s=>St.error("ui/ChainSelector","switchChain failed",s))},children:[V(xe,{chainId:w,className:"h-4 w-4"}),u.name,u.token&&V("span",{className:"text-xs opacity-60",children:u.token})]},w)})}):N?re("div",{ref:f,className:k("relative inline-block",e),children:[re(m,{onClick:()=>l(!i),children:[o&&V(xe,{chainId:`${o.namespace}:${o.id}`,className:"h-4 w-4"}),x,V("svg",{className:k("h-3 w-3 transition-transform",i&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:V("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&re("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] rounded-lg border bg-card p-1 shadow-lg animate-in fade-in zoom-in-95 duration-200",children:[t&&V("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Switch Network"}),r.map(u=>{let g=u.id===o?.id&&u.namespace===o?.namespace,w=`${u.namespace}:${u.id}`;return re(m,{onClick:()=>{g||a(w).catch(s=>St.error("ui/ChainSelector","switchChain failed",s)),l(!1)},className:k("flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",g?"bg-accent font-medium":"hover:bg-accent/50"),children:[V(xe,{chainId:w,className:"h-4 w-4"}),V("span",{className:"flex-1 text-left",children:u.name}),u.token&&V("span",{className:"text-xs text-muted-foreground",children:u.token}),g&&V("svg",{className:"h-4 w-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:V("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},w)})]})]}):re("div",{className:k("inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm opacity-60 cursor-default",e),children:[o&&V(xe,{chainId:`${o.namespace}:${o.id}`,className:"h-4 w-4"}),x]})}import{ArrowRight as To,CheckCircle2 as So,Clock as Bo,DollarSign as Po,Loader2 as At,XCircle as Do,AlertCircle as Ao}from"lucide-react";import{Fragment as Dt,jsx as v,jsxs as P}from"react/jsx-runtime";function Eo(e){if(e<1e3)return"<1s";if(e<6e4)return`~${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n>0?`~${t}m ${n}s`:`~${t}m`}function Bt(e){return e.symbol||"UNKNOWN"}function zo(e){let t=e.toLowerCase();return t.includes("lifi")?"default":t.includes("axelar")?"secondary":"outline"}function Mo(e){return e.length>12?`${e.slice(0,6)}...${e.slice(-6)}`:e}function Wo({route:e,onSelect:t}){let n=T(),o=n.Button,r=n.Badge,a=e.provider??"Route";return P("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4 transition-colors hover:bg-accent/30",children:[P("div",{className:"flex flex-col gap-1.5 min-w-0",children:[P("div",{className:"flex items-center gap-2",children:[r?v(r,{variant:zo(a),children:a}):v("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",children:a}),e.steps.length>1&&P("span",{className:"text-xs text-muted-foreground",children:[e.steps.length," steps"]})]}),P("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[P("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[v(Po,{className:"h-3.5 w-3.5"}),"$",e.gasCosts.totalUsd]}),P("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[v(Bo,{className:"h-3.5 w-3.5"}),Eo(e.steps.reduce((d,c)=>{let i=e.estimatedTime>0?15e3:0;return d+i},0))]}),P("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[e.gasCosts.totalUsd," cost"]})]})]}),v(o,{variant:"outline",size:"sm",onClick:t,children:"Select"})]})}function Lo(){let t=T().Skeleton;return P("div",{className:"flex flex-col gap-3","data-testid":"route-selector-loading",children:[P("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[v(At,{className:"h-4 w-4 animate-spin"}),v("span",{children:"Fetching best routes..."})]}),[1,2,3].map(n=>P("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4",children:[v("div",{className:"flex flex-col gap-2 flex-1",children:t?P(Dt,{children:[v(t,{className:"h-4 w-24"}),v(t,{className:"h-3 w-48"})]}):P(Dt,{children:[v("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),v("div",{className:"h-3 w-48 animate-pulse rounded bg-muted"})]})}),t?v(t,{className:"h-8 w-20 rounded-md"}):v("div",{className:"h-8 w-20 animate-pulse rounded-md bg-muted"})]},n))]})}function Io(){return P("div",{className:"flex flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground","data-testid":"route-selector-empty",children:[v(Ao,{className:"h-8 w-8 opacity-40"}),v("span",{children:"No routes found for this pair"}),v("span",{className:"text-xs",children:"Try a different token or amount"})]})}function Ho({error:e,onRetry:t}){let o=T().Button;return P("div",{className:"flex flex-col items-center justify-center gap-2 py-6","data-testid":"route-selector-error",children:[v(Do,{className:"h-8 w-8 text-destructive"}),v("p",{className:"text-sm text-destructive font-medium",children:"Failed to fetch routes"}),v("p",{className:"text-xs text-muted-foreground max-w-xs text-center",children:e}),t&&v(o,{variant:"outline",size:"sm",onClick:t,children:"Retry"})]})}function Vo(){let t=T().Progress;return P("div",{className:"flex flex-col items-center gap-3 py-6","data-testid":"route-selector-executing",children:[v(At,{className:"h-6 w-6 animate-spin text-primary"}),v("p",{className:"text-sm font-medium",children:"Executing route..."}),v("p",{className:"text-xs text-muted-foreground",children:"Please confirm the transaction in your wallet"}),t?v(t,{value:50,className:"w-48 h-1.5"}):v("div",{className:"h-1.5 w-48 rounded-full bg-muted",children:v("div",{className:"h-full w-1/2 rounded-full bg-primary animate-pulse"})})]})}function Oo({txHash:e}){return P("div",{className:"flex flex-col items-center gap-2 py-6","data-testid":"route-selector-success",children:[v(So,{className:"h-8 w-8 text-green-500"}),v("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Route executed successfully!"}),P("p",{className:"text-xs text-muted-foreground font-mono",children:["TX: ",Mo(e)]})]})}function Pt({chainId:e,className:t}){let n=we(`eip155:${e}`);return n?v("span",{className:k("inline-flex items-center justify-center shrink-0",t),dangerouslySetInnerHTML:{__html:n}}):null}function Uo({inputToken:e,outputToken:t,amount:n,routes:o=[],loading:r=!1,executing:a=!1,onRouteSelected:d,onCancel:c,successTxHash:i,error:l,className:p}){let m=T(),f=m.Card,x=m.Button;if(i)return v("div",{className:k("rounded-lg border border-border",p),children:v(Oo,{txHash:i})});if(a)return v("div",{className:k("rounded-lg border border-border",p),children:v(Vo,{})});return f?P(f,{className:k("p-4",p),children:[u(),g(),w()]}):P("div",{className:k("rounded-lg border border-border p-4",p),children:[u(),g(),w()]});function u(){return!e&&!t?null:P("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-sm",children:[e&&P("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[v(Pt,{chainId:e.chainId,className:"h-4 w-4"}),n?`${n.toString()} `:"",Bt(e)]}),e&&t&&v(To,{className:"h-3.5 w-3.5 text-muted-foreground"}),t&&P("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[v(Pt,{chainId:t.chainId,className:"h-4 w-4"}),Bt(t)]})]})}function g(){return r?v(Lo,{}):l?v(Ho,{error:l}):o.length===0?v(Io,{}):v("div",{className:"flex flex-col gap-2","data-testid":"route-selector-routes",children:o.map((s,R)=>v(Wo,{route:s,onSelect:()=>d?.(s)},`${s.fromChain}-${s.toChain}-${s.gasCosts.totalUsd}-${R}`))})}function w(){return!r&&o.length===0&&!l?null:v("div",{className:"mt-4 flex justify-end",children:v(x,{variant:"ghost",size:"sm",onClick:c,children:"Cancel"})})}}import Ko from"react";import{Shield as Qo,ShieldCheck as Et,LoaderCircle as $o,Settings as _o,ChevronRight as Fo,AlertCircle as jo,RotateCcw as qo,CheckCircle2 as Go,Fuel as zt,Zap as Xo,RefreshCw as Yo}from"lucide-react";import{Fragment as er,jsx as C,jsxs as D}from"react/jsx-runtime";function Jo(e){let t=Number(e)/1e18;return t<.001?`~${t.toFixed(6)} ETH`:`~${t.toFixed(3)} ETH`}function Zo({isDeployed:e=!1,isDeploying:t=!1,estimatedGas:n,error:o=null,onUpgrade:r,onShowSettings:a,onRetry:d}){let c=T(),i=c.Button,l=c.Card,p=c.Badge,m=a?D(i,{variant:"outline",className:"w-full",onClick:a,children:[C(_o,{size:15})," Advanced Settings ",C(Fo,{size:14,className:"text-muted-foreground"})]}):null;return e?D(l,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[C("div",{className:"flex items-start justify-between",children:D("div",{className:"flex items-center gap-3",children:[C("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-500/10",children:C(Et,{size:22,className:"text-green-500"})}),D("div",{children:[D("div",{className:"flex items-center gap-2",children:[C("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),D(p,{variant:"secondary",className:"rounded-full bg-green-500/10 px-2 py-0 text-xs font-medium text-green-500",children:[C(Go,{size:12,className:"mr-0.5 inline"})," Deployed"]})]}),C("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your wallet has been upgraded to a smart wallet"})]})]})}),C("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[[zt,"Gas Sponsorship","Enabled"],[Yo,"Recovery","Enabled"]].map(([f,x,N],u)=>D("div",{className:"rounded-lg bg-muted/50 p-3",children:[D("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[Ko.createElement(f,{size:14}),C("span",{children:x})]}),C("div",{className:"mt-1 text-sm font-medium text-foreground",children:N})]},u))}),a&&C("div",{className:"mt-4",children:m})]}):t?C(l,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:D("div",{className:"flex flex-col items-center text-center",children:[C("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:C($o,{size:28,className:"animate-spin text-primary"})}),C("h3",{className:"mb-1 text-base font-semibold text-foreground",children:"Deploying Smart Wallet..."}),C("p",{className:"mb-4 text-sm text-muted-foreground",children:"Please wait, contract deployment may take a few seconds"}),C("div",{className:"h-2 w-full max-w-[200px] overflow-hidden rounded-full bg-muted",children:C("div",{className:"h-full w-full animate-pulse rounded-full bg-primary",style:{animationDuration:"1.5s"}})})]})}):o?D(l,{className:"w-full rounded-xl border border-destructive/30 bg-destructive/5 p-5 shadow-sm",children:[D("div",{className:"flex items-start gap-3",children:[C("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:C(jo,{size:18,className:"text-destructive"})}),D("div",{className:"min-w-0 flex-1",children:[C("h4",{className:"text-sm font-semibold text-destructive",children:"Deployment Failed"}),C("p",{className:"mt-1 text-xs text-destructive/80 break-words",children:o}),d&&D(i,{variant:"outline",size:"sm",className:"mt-3 border-destructive/30 text-destructive hover:bg-destructive/10",onClick:d,children:[C(qo,{size:13})," Retry"]})]})]}),a&&C("div",{className:"mt-3",children:m})]}):D(l,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[D("div",{className:"flex items-center gap-3",children:[C("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10",children:C(Qo,{size:20,className:"text-amber-500"})}),D("div",{children:[D("div",{className:"flex items-center gap-2",children:[C("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),C("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:"Not Upgraded"})]}),C("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Upgrade to a smart wallet for more features"})]})]}),D("div",{className:"mt-4 space-y-2",children:[C(Ge,{icon:Xo,color:"text-green-500",text:"No ETH needed for transactions \u2014 pay gas with USDC/USDT"}),C(Ge,{icon:zt,color:"text-blue-500",text:"Optional dApp sponsorship, zero-cost transactions"}),C(Ge,{icon:Et,color:"text-purple-500",text:"Secure recovery mechanism, no fear of losing keys"})]}),r&&D(i,{className:"mt-4 w-full",onClick:r,children:["Upgrade Now",n!==void 0&&D("span",{className:"ml-1 text-xs opacity-80",children:["(Estimated gas fee: ",Jo(n),")"]})]}),a&&D(er,{children:[D("div",{className:"mt-4 mb-3 flex items-center gap-2",children:[C("div",{className:"h-px flex-1 bg-border"}),C("span",{className:"text-xs text-muted-foreground",children:"or"}),C("div",{className:"h-px flex-1 bg-border"})]}),m]})]})}function Ge({icon:e,color:t,text:n}){return D("div",{className:"flex items-center gap-2.5 text-sm text-foreground/80",children:[C(e,{size:14,className:`shrink-0 ${t}`}),C("span",{children:n})]})}import{useState as Xe,useCallback as Mt}from"react";import{ArrowLeft as Wt,Save as tr,Shield as Lt,Users as It,KeyRound as Ht,Fuel as nr,Wrench as or,Plus as rr,X as ar}from"lucide-react";import{jsx as b,jsxs as B}from"react/jsx-runtime";var sr=[{value:"simple",label:"Single Sign (default)",description:"Single key control, simple and secure",icon:b(Lt,{size:16})},{value:"multi-sig",label:"Multi-Sign (2-of-3)",description:"Requires multiple signers to authorize transactions",icon:b(It,{size:16})},{value:"social-recovery",label:"Social Recovery",description:"Set guardian accounts to help recover",icon:b(Ht,{size:16})}],ir=[{value:"self",label:"Pay Self (ETH)",description:"Pay gas fees with ETH"},{value:"sponsor",label:"Sponsored by dApp",description:"dApp covers your gas fees"},{value:"erc20",label:"Pay with USDC/USDT",description:"Use ERC-20 tokens for gas"},{value:"custom",label:"Custom Paymaster URL",description:"Use a custom paymaster service"}],lr=[{value:"pimlico",label:"Pimlico",description:"High-performance bundler service"},{value:"stackup",label:"Stackup",description:"Decentralized bundler network"},{value:"alchemy",label:"Alchemy",description:"Alchemy AA infrastructure"},{value:"custom",label:"Custom Bundler URL",description:"Use custom bundler endpoint"}];function cr(){return{accountType:"simple",paymasterType:"self",customPaymasterUrl:"",bundlerPreset:"pimlico",customBundlerUrl:"",guardians:[],threshold:2}}function dr({currentConfig:e,onSave:t,onBack:n}){let o=T(),r=o.Button,a=o.Input,d=o.Card,c=o.Separator,[i,l]=Xe({...cr(),...e}),[p,m]=Xe(""),[f,x]=Xe(!1),N=s=>k("flex cursor-pointer items-center gap-3 rounded-lg border px-4 py-3 transition-all duration-200",s?"border-primary bg-primary/5":"border-border hover:bg-accent"),u="w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:border-ring focus:ring-2 focus:ring-ring focus:ring-offset-2 transition-all duration-200",g=Mt(()=>{t?.(i),x(!0),setTimeout(()=>x(!1),2e3)},[i,t]),w=Mt(()=>{let s=p.trim();!s||i.guardians.includes(s)||(l(R=>({...R,guardians:[...R.guardians,s]})),m(""))},[p,i.guardians]);return B(d,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[b("div",{className:"flex items-center justify-between mb-5",children:B("div",{className:"flex items-center gap-2",children:[n&&B(r,{variant:"ghost",size:"sm",onClick:n,children:[b(Wt,{size:15}),"Back"]}),b("h2",{className:"text-lg font-semibold text-foreground",children:"Smart Wallet Settings"})]})}),B("section",{className:"mb-6",children:[B("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[b(Lt,{size:15})," Verification Method"]}),b("div",{className:"space-y-2",children:sr.map(s=>B("label",{className:N(i.accountType===s.value),children:[b("input",{type:"radio",name:"accountType",value:s.value,checked:i.accountType===s.value,onChange:()=>l(R=>({...R,accountType:s.value})),className:"h-4 w-4 text-primary accent-primary"}),b("div",{className:"flex items-center gap-2 text-foreground",children:s.icon}),B("div",{children:[b("div",{className:"text-sm font-medium text-foreground",children:s.label}),b("div",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.value))})]}),i.accountType==="social-recovery"&&B("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[B("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[b(Ht,{size:14})," Guardian Addresses"]}),b("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set at least one guardian to help recover your wallet if you lose your key"}),i.guardians.length>0&&b("div",{className:"mb-3 space-y-1.5",children:i.guardians.map(s=>B("div",{className:"flex items-center justify-between rounded-md bg-card px-3 py-2 text-sm",children:[B("span",{className:"font-mono text-xs text-foreground",children:[s.slice(0,8),"...",s.slice(-6)]}),b(r,{variant:"ghost",size:"icon",onClick:()=>l(R=>({...R,guardians:R.guardians.filter(A=>A!==s)})),children:b(ar,{size:14})})]},s))}),B("div",{className:"flex gap-2",children:[b(a,{type:"text",placeholder:"Enter guardian address (0x...)",value:p,onChange:s=>m(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),w())},className:"flex-1"}),B(r,{size:"sm",onClick:w,disabled:!p.trim(),children:[b(rr,{size:14})," Add"]})]})]}),i.accountType==="multi-sig"&&B("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[B("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[b(It,{size:14})," Signing Threshold"]}),b("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set how many signers are needed to authorize a transaction"}),b("div",{className:"flex items-center gap-3",children:[1,2,3].map(s=>B("label",{className:N(i.threshold===s),children:[b("input",{type:"radio",name:"threshold",value:s,checked:i.threshold===s,onChange:()=>l(R=>({...R,threshold:s})),className:"sr-only"}),s,"-of-3"]},s))})]}),b(c,{className:"my-4"}),B("section",{className:"mb-6",children:[B("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[b(nr,{size:15})," Gas Fees"]}),b("div",{className:"space-y-2",children:ir.map(s=>B("label",{className:N(i.paymasterType===s.value),children:[b("input",{type:"radio",name:"paymasterType",value:s.value,checked:i.paymasterType===s.value,onChange:()=>l(R=>({...R,paymasterType:s.value})),className:"h-4 w-4 text-primary accent-primary"}),B("div",{className:"flex-1",children:[b("div",{className:"text-sm font-medium text-foreground",children:s.label}),b("div",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.value))}),i.paymasterType==="custom"&&b("div",{className:"mt-3",children:b("input",{type:"text",placeholder:"Custom Paymaster URL",value:i.customPaymasterUrl,onChange:s=>l(R=>({...R,customPaymasterUrl:s.target.value})),className:u})})]}),b(c,{className:"my-4"}),B("section",{className:"mb-6",children:[B("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[b(or,{size:15})," Bundler"]}),b("div",{className:"space-y-2",children:lr.map(s=>B("label",{className:N(i.bundlerPreset===s.value),children:[b("input",{type:"radio",name:"bundlerPreset",value:s.value,checked:i.bundlerPreset===s.value,onChange:()=>l(R=>({...R,bundlerPreset:s.value})),className:"h-4 w-4 text-primary accent-primary"}),B("div",{className:"flex-1",children:[b("div",{className:"text-sm font-medium text-foreground",children:s.label}),b("div",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.value))}),i.bundlerPreset==="custom"&&b("div",{className:"mt-3",children:b("input",{type:"text",placeholder:"Custom Bundler URL",value:i.customBundlerUrl,onChange:s=>l(R=>({...R,customBundlerUrl:s.target.value})),className:u})})]}),B("div",{className:"flex items-center gap-3",children:[B(r,{className:"flex-1",onClick:g,children:[b(tr,{size:15}),f?"Saved \u2713":"Save Settings"]}),n&&B(r,{variant:"outline",onClick:n,children:[b(Wt,{size:15}),"\u2190 Back to Simple Mode"]})]})]})}import{AlertTriangle as ur,CheckCircle as mr,ShieldAlert as pr,X as fr}from"lucide-react";import{useValidateDestination as gr}from"@naculus/connect-appkit-react";import{jsx as W,jsxs as ee}from"react/jsx-runtime";var vr={safe:{icon:W(mr,{size:20}),label:"Safe",colorClass:"text-[hsl(var(--safe,142_76%_36%))]",bgClass:"bg-[hsl(var(--safe)/0.1)]",buttonVariant:"default"},warning:{icon:W(ur,{size:20}),label:"Warning",colorClass:"text-[hsl(var(--warning,38_92%_50%))]",bgClass:"bg-[hsl(var(--warning)/0.1)]",buttonVariant:"default"},blocked:{icon:W(pr,{size:20}),label:"Blocked",colorClass:"text-destructive",bgClass:"bg-destructive/10",buttonVariant:"destructive"}};function br({address:e,open:t,onClose:n,onProceed:o}){let r=T(),a=r.Button,d=r.Dialog,c=r.DialogContent,i=r.DialogHeader,l=r.DialogTitle,{validation:p}=gr({address:e}),{level:m,warning:f}=p,x=vr[m],N=m==="blocked",u=e.length>12?`${e.slice(0,6)}...${e.slice(-4)}`:e,g=s=>k("inline-flex items-center justify-center whitespace-nowrap rounded-lg","text-sm font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","h-10 px-4 py-2",s==="outline"&&"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",s==="destructive"&&"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm",s==="default"&&"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm"),w=ee("div",{className:"flex flex-col gap-4",children:[ee("div",{className:k("flex items-center gap-3 rounded-lg p-4",x.bgClass),children:[W("span",{className:x.colorClass,children:x.icon}),ee("div",{className:"flex flex-col gap-0.5",children:[W("span",{className:k("text-sm font-semibold",x.colorClass),children:x.label}),W("span",{className:"text-xs text-muted-foreground break-all font-mono",children:u})]})]}),f&&W("p",{className:"text-sm text-muted-foreground m-0",children:f}),ee("div",{className:"flex gap-2 justify-end pt-2",children:[a?W(a,{onClick:n,variant:"outline",className:"w-full sm:w-auto",children:"Cancel"}):W("button",{type:"button",onClick:n,className:k(g("outline"),"w-full sm:w-auto"),children:"Cancel"}),o&&(a?W(a,{onClick:o,variant:N?"destructive":"default",disabled:N,className:"w-full sm:w-auto",children:"Proceed anyway"}):W("button",{type:"button",onClick:o,disabled:N,className:k(g(N?"destructive":"default"),"w-full sm:w-auto"),children:"Proceed anyway"}))]})]});return d&&c&&i&&l?W(d,{open:t,onOpenChange:s=>{s||n()},children:ee(c,{className:"sm:max-w-md",children:[W(i,{children:W(l,{children:"Address Warning"})}),w]})}):t?ee("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[W("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:n}),ee("div",{role:"dialog","aria-modal":"true",className:"relative z-10 w-full max-w-sm rounded-xl border bg-card text-card-foreground shadow-2xl p-6",children:[ee("div",{className:"flex items-center justify-between mb-4",children:[W("h2",{className:"text-lg font-semibold m-0",children:"Address Warning"}),W("button",{onClick:n,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close",children:W(fr,{size:16})})]}),w]})]}):null}import{Wallet as Vt,AlertCircle as xr}from"lucide-react";import{jsx as O,jsxs as ae}from"react/jsx-runtime";function yr({wallets:e,onSelect:t,loading:n=!1,error:o=null}){let a=T().Card,d=c=>a?O(a,{className:"p-4",children:c}):O("div",{className:"rounded-xl border bg-card text-card-foreground shadow-sm p-4",children:c});return n?d(ae("div",{className:"flex flex-col gap-3",children:[Array.from({length:3}).map((c,i)=>ae("div",{className:"flex items-center gap-3 p-3 rounded-lg animate-pulse",children:[O("div",{className:"h-10 w-10 rounded-full bg-muted"}),O("div",{className:"h-4 w-32 rounded bg-muted"})]},i)),O("p",{className:"text-xs text-muted-foreground text-center m-0",children:"Detecting wallets..."})]})):o?d(ae("div",{className:"flex flex-col items-center gap-3 py-4",children:[O(xr,{size:24,className:"text-destructive"}),O("p",{className:"text-sm text-destructive m-0 font-medium",children:o})]})):e.length===0?d(ae("div",{className:"flex flex-col items-center gap-3 py-6",children:[O(Vt,{size:32,className:"text-muted-foreground"}),ae("p",{className:"text-sm text-muted-foreground m-0 text-center",children:["No wallets detected.",O("br",{}),"Install a browser wallet extension to get started."]})]})):O("div",{className:"flex flex-col gap-2",children:e.map(c=>ae("button",{type:"button",onClick:()=>t(c),className:k("flex items-center gap-3 w-full p-3 rounded-lg","border border-input bg-card hover:bg-accent hover:text-accent-foreground","transition-all duration-200 cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[c.icon?O("img",{src:c.icon,alt:c.name,className:"h-10 w-10 rounded-full object-cover shrink-0",onError:i=>{i.target.style.display="none"}}):O("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:O(Vt,{size:18,className:"text-muted-foreground"})}),ae("div",{className:"flex flex-col items-start gap-0.5 text-left min-w-0",children:[O("span",{className:"text-sm font-medium truncate w-full",children:c.name}),O("span",{className:"text-xs text-muted-foreground truncate w-full",children:c.rdns})]})]},c.id))})}export{We as AccountButton,br as AddressWarningDialog,Fe as AppKit,je as AppKitButton,qe as AppKitChainSelector,de as ChainSelector,te as ConnectButton,ge as ErrorBoundary,pe as QRCodeModal,Uo as RouteSelector,fe as SeedPhraseBackup,Ve as SignInButton,dr as SmartWalletSettings,Zo as SmartWalletToggle,$e as ThemeProvider,Ae as WalletConnectProvider,yr as WalletPicker,_e as Web3ComponentProvider,be as Web3ConnectUI,k as cn,Rt as useAppKit,yo as useComponent,T as useComponentRegistry,ao as useDetectionMode,ue as useEIP6963,me as useIsMobile,bt as useTheme,Jn as useThemeVariable,en as useWalletConnect,Ee as useWalletConnectOptional};
|
|
5
|
+
//# sourceMappingURL=index.js.map
|