@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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Naculus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var jt=Object.create;var De=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty;var Jt=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})},rt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Gt(t))!Yt.call(e,r)&&r!==n&&De(e,r,{get:()=>t[r],enumerable:!(o=qt(t,r))||o.enumerable});return e};var _e=(e,t,n)=>(n=e!=null?jt(Xt(e)):{},rt(t||!e||!e.__esModule?De(n,"default",{value:e,enumerable:!0}):n,e)),Zt=e=>rt(De({},"__esModule",{value:!0}),e);var An={};Jt(An,{AccountButton:()=>We,AddressWarningDialog:()=>Mt,AppKit:()=>Oe,AppKitButton:()=>Ue,AppKitChainSelector:()=>Ke,ChainSelector:()=>de,ConnectButton:()=>ie,ErrorBoundary:()=>xe,QRCodeModal:()=>ve,RouteSelector:()=>Pt,SeedPhraseBackup:()=>be,SignInButton:()=>Le,SmartWalletSettings:()=>Et,SmartWalletToggle:()=>At,ThemeProvider:()=>Ie,WalletConnectProvider:()=>Ae,WalletPicker:()=>Wt,Web3ComponentProvider:()=>Ve,Web3ConnectUI:()=>Ne,cn:()=>R,useAppKit:()=>et,useComponent:()=>kt,useComponentRegistry:()=>S,useDetectionMode:()=>Nt,useEIP6963:()=>pe,useIsMobile:()=>fe,useTheme:()=>Ze,useThemeVariable:()=>yt,useWalletConnect:()=>st,useWalletConnectOptional:()=>Ee});module.exports=Zt(An);var re=require("react"),lt=require("@naculus/connect-appkit-react");var H=require("react"),at=require("@naculus/connect-appkit-react"),it=require("react/jsx-runtime"),Fe=(0,H.createContext)(null);function Ae({children:e}){let t=(0,at.useWeb3)(),[n,o]=(0,H.useState)(null),[r,a]=(0,H.useState)(!1),[g,u]=(0,H.useState)("idle"),[i,l]=(0,H.useState)(null),x=(0,H.useCallback)(()=>{o(null),a(!1),u("cancelled"),l(null)},[]),b=(0,H.useRef)(void 0);b.current=async()=>{if(!t.startPairing||!t.completePairing){l("WalletConnect pairing not available"),u("error");return}u("loading"),l(null),a(!0);try{let h=await t.startPairing();o(h),u("ready");try{await t.completePairing(),setTimeout(()=>{a(!1),o(null),u("idle")},1e3)}catch(w){u("error"),l(w instanceof Error?w.message:"Connection failed")}}catch(h){u("error"),l(h instanceof Error?h.message:"Failed to generate QR code")}};let y=(0,H.useCallback)(async()=>{b.current?.()},[]),C=(0,H.useCallback)(()=>{o(null),l(null),u("loading"),b.current?.()},[]),N=(0,H.useMemo)(()=>({qrUri:n,showQR:r,qrStatus:g,error:i}),[n,r,g,i]),v=(0,H.useMemo)(()=>({state:N,connectWalletConnect:y,cancelQR:x,retryQR:C}),[N,y,x,C]);return(0,it.jsx)(Fe.Provider,{value:v,children:e})}function st(){let e=(0,H.useContext)(Fe);if(!e)throw new Error("useWalletConnect must be used within a WalletConnectProvider");return e}function Ee(){return(0,H.useContext)(Fe)}var ce=require("react");function pe(){let[e,t]=(0,ce.useState)([]),[n,o]=(0,ce.useState)(!0),r=(0,ce.useRef)(new Set);return(0,ce.useEffect)(()=>{r.current.clear(),o(!0);let a=u=>{let i=u.detail,l=i?.info,x=i?.provider;!l?.rdns||r.current.has(l.rdns)||(r.current.add(l.rdns),t(b=>b.find(y=>y.id===l.rdns)?b:[...b,{id:l.rdns,name:l.name||l.rdns,icon:l.icon||"",rdns:l.rdns,provider:x}]))};window.addEventListener("eip6963:announceProvider",a),window.dispatchEvent(new Event("eip6963:requestProvider"));let g=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",a),clearTimeout(g)}},[]),{wallets:e,isDetecting:n,hasWallets:e.length>0}}var ze=require("react");function fe(){let[e,t]=(0,ze.useState)(!1);return(0,ze.useEffect)(()=>{if(typeof navigator>"u"||typeof window>"u")return;let n=navigator.userAgent.toLowerCase();t(/(iphone|ipad|ipod|android|mobile)/i.test(n))},[]),e}var je=require("react/jsx-runtime");function ie({className:e,isConnected:t,isConnecting:n,onConnect:o,onDisconnect:r,onMobileDeepLink:a,mobileWalletName:g,startPairing:u,completePairing:i,address:l,balance:x,balanceSymbol:b,tokenBalances:y,isBalanceLoading:C,explorerUrl:N,explorerLabel:v}){let h=Ee(),{wallets:w}=pe(),s=fe(),[k,M]=(0,re.useState)(null),[Q,j]=(0,re.useState)(!1),[_,q]=(0,re.useState)(null),te=(0,re.useRef)({aborted:!1});(0,re.useEffect)(()=>{if(!h)return;let{qrStatus:U,qrUri:ae,error:oe}=h.state;U==="loading"?(j(!0),M(null),q(null)):U==="ready"&&ae?(j(!1),M(ae),q(null)):U==="error"?(j(!1),q(oe)):U==="idle"&&(j(!1),M(null),q(null))},[h?.state?.qrStatus,h?.state?.qrUri,h?.state?.error]);let ne=(0,re.useCallback)((U,ae)=>{if(U==="walletconnect"){if(h){h.connectWalletConnect();return}if(u&&i){j(!0),q(null),te.current.aborted=!1,u().then(oe=>{te.current.aborted||(M(oe),j(!1),i().then(()=>{te.current.aborted||M(null)}).catch(me=>{te.current.aborted||q(me instanceof Error?me.message:"Connection failed")}))}).catch(oe=>{te.current.aborted||(j(!1),q(oe instanceof Error?oe.message:"Connection failed"))});return}}o?.(U,()=>{},ae)},[h,u,i,o]);return(0,je.jsx)("div",{className:e,children:(0,je.jsx)(lt.AppkitConnectButton,{connected:t??!1,connecting:n??!1,address:l??"",balance:x??null,balanceSymbol:b??"ETH",isBalanceLoading:C??!1,tokenBalancesJson:JSON.stringify(y??[]),explorerUrl:N??"",explorerLabel:v??"",walletsJson:JSON.stringify(w),isMobile:s,mobileWalletName:g??"",qrUri:k,qrLoading:Q,qrError:_,onAppkitConnect:U=>{ne(U.detail.kind,U.detail.walletId)},onAppkitDisconnect:()=>r?.(),onAppkitStartPairing:()=>ne("walletconnect"),onAppkitRetry:()=>{te.current.aborted=!0,q(null),M(null),ne("walletconnect")},onAppkitMobileDeepLink:()=>a?.(),onAppkitCopyAddress:U=>{navigator.clipboard?.writeText(U.detail).catch(()=>{})}})})}var tt=require("@naculus/connect-core"),Re=require("react"),Qe=require("@naculus/connect-appkit-react");var ct=require("clsx"),dt=require("tailwind-merge");function R(...e){return(0,dt.twMerge)((0,ct.clsx)(e))}var ut='<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>',en='<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>',tn='<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>',nn='<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>',on='<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>',rn='<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>',an='<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>',sn={"eip155:1":ut,"eip155:137":en,"eip155:56":tn,"eip155:42161":nn,"eip155:10":on,"eip155:43114":rn,"eip155:250":an,"eip155:11155111":ut};function Me(e){return sn[e]}var we=require("react");var mt=require("lucide-react");var J=require("react/jsx-runtime");function ln({children:e}){return(0,J.jsx)("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:g}){let i=S().Button;if(!o)return(0,J.jsxs)(i,{"aria-label":"Connect Wallet",onClick:g,className:e,children:[(0,J.jsx)(mt.Wallet,{size:18,className:"shrink-0"}),"Connect Wallet"]});let l=o.includes(":")?o.split(":").pop():o,x=l.slice(0,6)+"..."+l.slice(-4),b=r!=null?parseFloat(r).toLocaleString(void 0,{maximumFractionDigits:4})+" "+(a??"ETH"):null;return(0,J.jsxs)(i,{className:e,children:[(0,J.jsx)(ln,{children:"W"}),(0,J.jsxs)("div",{className:"flex flex-col items-start gap-0",children:[t&&(0,J.jsx)("span",{className:"font-mono text-xs",children:x}),n&&b&&(0,J.jsx)("span",{className:"text-xs text-muted-foreground",children:b}),n&&!b&&r===null&&(0,J.jsx)("span",{className:"text-xs text-muted-foreground",children:"Loading..."})]})]})}var Z=require("react"),Y=require("lucide-react");var qe=require("react");var pt=require("lucide-react"),G=require("react/jsx-runtime");function ge({open:e,onClose:t,children:n,closable:o}){return(0,qe.useEffect)(()=>{if(!e)return;let r=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=r}},[e]),(0,qe.useEffect)(()=>{if(!e||!t)return;let r=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t]),e?(0,G.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,G.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:t}),(0,G.jsxs)("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&&(0,G.jsx)("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:(0,G.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,G.jsx)("path",{d:"M18 6 6 18M6 6l12 12","data-testid":"x-icon"})})}),n]})]}):null}function ft({title:e,onClose:t,showCloseButton:n=!0}){return(0,G.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,G.jsx)("h2",{className:"text-lg font-semibold m-0",children:e}),n&&t&&(0,G.jsx)("button",{onClick:t,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200","aria-label":"Close",children:(0,G.jsx)(pt.X,{size:16})})]})}function gt({children:e,className:t=""}){return(0,G.jsx)("div",{className:R("flex flex-col gap-4",t),children:e})}var T=require("react/jsx-runtime");async function cn(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 ve({uri:e,open:t,onClose:n,onDeepLink:o,onRetry:r,status:a="pending",showDeepLink:g,timeoutMs:u=300*1e3,title:i="Scan with WalletConnect",description:l="Open your wallet app and scan this QR code to connect.",className:x}){let b=(0,Z.useRef)(null),[y,C]=(0,Z.useState)(!1),[N,v]=(0,Z.useState)(0),h=fe(),w=S(),s=w.Button,k=g??h,M=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{!t||!e||!b.current||(C(!1),cn(b.current,e).catch(()=>C(!0)))},[t,e]),(0,Z.useEffect)(()=>{if(!t||a!=="pending"){M.current&&(clearInterval(M.current),M.current=null),v(0);return}let Se=Date.now();return M.current=setInterval(()=>v(Date.now()-Se),1e3),()=>{M.current&&clearInterval(M.current)}},[t,a,u]);let Q=N>=u&&a==="pending",j=Q||a==="expired"||a==="error",_=Math.max(0,Math.ceil((u-N)/1e3)),q=Math.floor(_/60),te=_%60,ne=Math.min(N/u,1),U=(0,Z.useCallback)(()=>{e&&o&&o(e)},[e,o]),ae=e&&!Q&&a==="pending"?y?(0,T.jsxs)("div",{className:"w-[280px] h-[280px] flex flex-col items-center justify-center bg-muted rounded-lg gap-2",children:[(0,T.jsx)(Y.AlertCircle,{size:24,className:"text-muted-foreground"}),(0,T.jsx)("span",{className:"text-sm text-muted-foreground",children:"Failed to render QR code"})]}):(0,T.jsx)("canvas",{ref:b,width:280,height:280,className:"rounded-lg border border-border"}):(0,T.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 bg-muted rounded-lg w-[280px] h-[280px]",children:[a==="scanned"?(0,T.jsx)(Y.CheckCircle2,{size:48,className:"text-[hsl(var(--primary))]"}):(0,T.jsx)(Y.AlertCircle,{size:48,className:"text-destructive"}),(0,T.jsx)("span",{className:"text-sm text-muted-foreground","data-testid":"status-label",children:a==="scanned"?"QR code scanned! Connecting...":Q||a==="expired"?"Connection timed out.":"Something went wrong. Try again."})]}),me=w.Modal??ge;return(0,T.jsx)(me,{open:t,onClose:n,closable:!0,title:i,className:x,children:(0,T.jsxs)("div",{className:"p-6",children:[(0,T.jsxs)("div",{className:"text-center mb-5",children:[(0,T.jsx)("div",{className:"flex justify-center mb-3",children:a==="pending"&&!Q&&(0,T.jsx)(Y.Loader2,{size:20,className:"animate-spin text-primary","data-testid":"loader-icon-inline"})}),(0,T.jsx)("h3",{className:"text-lg font-semibold m-0 text-foreground",children:i}),l&&(0,T.jsx)("p",{className:"text-sm text-muted-foreground mt-1.5 mb-0",children:l})]}),(0,T.jsx)("div",{className:"flex justify-center mb-4",children:ae}),a==="pending"&&!Q&&(0,T.jsxs)("div",{className:"mb-3",children:[(0,T.jsx)("div",{className:"h-1 bg-muted rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Math.round((1-ne)*100),"aria-valuemin":0,"aria-valuemax":100,children:(0,T.jsx)("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${(1-ne)*100}%`}})}),(0,T.jsxs)("p",{"data-testid":"countdown",className:"text-xs text-muted-foreground text-center mt-1.5 mb-0",children:["Expires in ",q,":",te.toString().padStart(2,"0")]})]}),(0,T.jsxs)("div",{className:"flex flex-col gap-2",children:[k&&e&&a==="pending"&&!Q&&(0,T.jsxs)("button",{onClick:U,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:[(0,T.jsx)(Y.Smartphone,{size:16})," Open in Wallet App"]}),j&&r&&(s?(0,T.jsxs)(s,{onClick:r,variant:"default",size:"default",className:"w-full",children:[(0,T.jsx)(Y.RefreshCw,{size:16})," Generate New QR Code"]}):(0,T.jsxs)("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:[(0,T.jsx)(Y.RefreshCw,{size:16})," Generate New QR Code"]})),s?(0,T.jsx)(s,{onClick:n,variant:"outline",size:"default",className:"w-full",children:"Cancel"}):(0,T.jsx)("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"})]})]})})}var Xe=require("react"),K=require("lucide-react");var f=require("react/jsx-runtime");function Le({className:e,isSignedIn:t=!1,isSigningIn:n=!1,result:o=null,error:r=null,onSignIn:a,onClearError:g,children:u}){let[i,l]=(0,Xe.useState)(!1),[x,b]=(0,Xe.useState)(!1),y=S(),C=y.Button,N=y.Dialog,v=y.DialogContent,h=y.DialogHeader,w=y.DialogTitle,s=async()=>{if(o?.signature)try{await navigator.clipboard.writeText(o.signature),b(!0),setTimeout(()=>b(!1),2e3)}catch{}};return!t&&!n&&!r?(0,f.jsx)(C,{onClick:a,className:e,"aria-label":"Sign In",children:(0,f.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,f.jsx)(K.LogIn,{size:16}),u??"Sign In"]})}):n?(0,f.jsx)(C,{disabled:!0,className:e,"aria-label":"Signing In",children:(0,f.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,f.jsx)(K.Loader2,{size:16,className:"animate-spin"}),"Signing In..."]})}):r&&!t?(0,f.jsxs)("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column"},children:[(0,f.jsx)(C,{onClick:a,className:e,"aria-label":"Retry Sign In",children:(0,f.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,f.jsx)(K.AlertCircle,{size:16,style:{color:"var(--destructive, #ef4444)"}}),u??"Retry Sign In"]})}),(0,f.jsx)("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})]}):(0,f.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,f.jsx)(C,{onClick:()=>l(k=>!k),className:e,children:(0,f.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,f.jsx)(K.CheckCircle2,{size:16,style:{color:"#22c55e"}}),(0,f.jsx)("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Signed In"})]})}),i&&(N&&v?(0,f.jsx)(N,{open:!0,onOpenChange:k=>{k||l(!1)},children:(0,f.jsx)(v,{children:h&&w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(h,{children:(0,f.jsx)(w,{children:"Sign-In Details"})}),(0,f.jsx)(Ge,{result:o,onClose:()=>l(!1),copiedSign:x,onCopy:s})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Sign-In Details"}),(0,f.jsx)(Ge,{result:o,onClose:()=>l(!1),copiedSign:x,onCopy:s})]})})}):i&&(0,f.jsx)("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:(0,f.jsx)(Ge,{result:o,onClose:()=>l(!1),copiedSign:x,onCopy:s})}))]})}function Ge({result:e,onClose:t,copiedSign:n,onCopy:o}){let a=S().Button;if(!e)return(0,f.jsxs)("div",{style:{textAlign:"center",padding:"1rem 0"},children:[(0,f.jsx)(K.CheckCircle2,{size:32,style:{color:"#22c55e",margin:"0 auto 0.75rem"}}),(0,f.jsx)("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground, #64748b)"},children:"Authenticated successfully"}),(0,f.jsx)(a,{variant:"outline",size:"sm",onClick:t,children:"Close"})]});let{message:g,signature:u}=e,i=u.length>20?u.slice(0,14)+"..."+u.slice(-6):u;return(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,f.jsx)(K.CheckCircle2,{size:18,color:"#22c55e"}),(0,f.jsx)("span",{style:{fontWeight:600,fontSize:"0.9375rem"},children:"Signed In"})]}),(0,f.jsx)(a,{variant:"ghost",size:"icon",onClick:t,children:(0,f.jsx)(K.X,{size:16})})]}),(0,f.jsxs)("div",{style:{display:"grid",gap:"0.375rem"},children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Domain"}),(0,f.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:g.domain})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Address"}),(0,f.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem",wordBreak:"break-all"},children:g.address})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Chain"}),(0,f.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:g.chainId})]})]}),g.statement&&(0,f.jsx)("div",{style:{padding:"0.5rem 0.625rem",borderRadius:"0.375rem",background:"var(--muted, #f1f5f9)",fontSize:"0.8125rem",lineHeight:1.5},children:g.statement}),(0,f.jsxs)("div",{children:[(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.25rem"},children:[(0,f.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature"}),(0,f.jsx)(a,{variant:"ghost",size:"icon",onClick:o,title:"Copy signature",children:n?(0,f.jsx)(K.Check,{size:12,color:"#22c55e"}):(0,f.jsx)(K.Copy,{size:12})})]}),(0,f.jsx)("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})]}),(0,f.jsx)(a,{variant:"outline",className:"w-full",onClick:t,children:"Close"})]})}var V=require("react"),D=require("lucide-react");var c=require("react/jsx-runtime");function Ye(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 vt(e,t=3){let n=e.trim().split(/\s+/);return Ye(n.map((r,a)=>a)).slice(0,Math.min(t,n.length)).map(r=>{let a=n[r],g=n.filter((l,x)=>x!==r),u=Ye(g).slice(0,3),i=Ye([a,...u]);return{index:r,correct:a,options:i}})}function be({seedPhrase:e,onConfirm:t,onSkip:n,onExportPrivateKey:o,className:r,wordCount:a,inline:g=!1,open:u=!0,onOpenChange:i}){let l=S(),x=l.Button,b=l.Dialog,y=l.DialogContent,C=l.DialogHeader,N=l.DialogTitle,[v,h]=(0,V.useState)("reveal"),[w,s]=(0,V.useState)(!1),[k,M]=(0,V.useState)(!1),[Q,j]=(0,V.useState)(()=>vt(e,3)),[_,q]=(0,V.useState)({}),[te,ne]=(0,V.useState)([]),[U,ae]=(0,V.useState)(!1),[oe,me]=(0,V.useState)(null),Se=(0,V.useMemo)(()=>e.trim().split(/\s+/),[e]),En=a??(Se.length===24?24:12),Lt=(0,V.useCallback)(()=>s(!0),[]),It=(0,V.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),M(!0),setTimeout(()=>M(!1),2e3)}catch{}},[e]),Ht=(0,V.useCallback)(()=>{j(vt(e,3)),q({}),ne([]),h("confirm")},[e]),Vt=(0,V.useCallback)((L,X)=>{q(se=>({...se,[L]:X})),ne(se=>se.filter($e=>$e!==L))},[]),Ot=(0,V.useCallback)(()=>{let L=[];for(let X of Q)_[X.index]!==X.correct&&L.push(X.index);if(L.length>0){ne(L);return}h("done"),t()},[Q,_,t]),ot=(0,V.useCallback)(()=>{n?.()},[n]),Ut=(0,V.useCallback)(()=>{if(o){let L=o();me(L),ae(!0)}},[o]),Kt=Q.every(L=>_[L.index]!==void 0),Qt=(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)("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:(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)(D.AlertTriangle,{size:16,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,c.jsx)("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?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:Se.map((L,X)=>(0,c.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2.5 py-1.5 text-sm",children:[(0,c.jsx)("span",{className:"text-xs text-muted-foreground w-5 shrink-0 text-right",children:X+1}),(0,c.jsx)("span",{className:"font-mono font-medium",children:L})]},X))}),(0,c.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,c.jsxs)(x,{onClick:It,variant:"outline",size:"sm",children:[k?(0,c.jsx)(D.Check,{size:14}):(0,c.jsx)(D.Copy,{size:14}),k?"Copied":"Copy"]}),o&&(0,c.jsxs)(x,{onClick:Ut,variant:"outline",size:"sm",children:[(0,c.jsx)(D.Download,{size:14}),"Export Private Key"]})]}),U&&oe&&(0,c.jsxs)("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(D.EyeOff,{size:14,className:"text-muted-foreground"}),(0,c.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Private Key (keep secret!)"})]}),(0,c.jsx)("p",{className:"font-mono text-xs break-all select-all",children:oe})]}),(0,c.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[(0,c.jsxs)(x,{onClick:Ht,variant:"default",children:["I've Saved It",(0,c.jsx)(D.ArrowRight,{size:16})]}),n&&(0,c.jsxs)(x,{onClick:ot,variant:"ghost",size:"sm",children:[(0,c.jsx)(D.SkipForward,{size:14}),"Skip Backup"]})]})]}):(0,c.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,c.jsx)(D.Shield,{size:40,className:"text-muted-foreground"}),(0,c.jsx)("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."}),(0,c.jsxs)(x,{onClick:Lt,variant:"default",children:[(0,c.jsx)(D.Eye,{size:16}),"Reveal Seed Phrase"]})]})]}),$t=(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"Verify your backup by selecting the correct word for each position."}),Q.map(L=>{let X=te.includes(L.index);return(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsxs)("p",{className:R("text-sm font-medium",X?"text-destructive":"text-foreground"),children:["Word #",L.index+1,X&&(0,c.jsx)("span",{className:"ml-2 text-xs text-destructive",children:"(incorrect)"})]}),(0,c.jsx)("div",{className:"grid grid-cols-2 gap-2",children:L.options.map(se=>{let $e=_[L.index]===se;return(0,c.jsx)("button",{onClick:()=>Vt(L.index,se),className:R("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",$e?"border-primary bg-primary/10 text-primary font-medium":X?"border-destructive/50 bg-destructive/5":"border-border bg-card hover:border-primary/50"),children:se},se)})})]},L.index)}),(0,c.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[(0,c.jsxs)(x,{onClick:Ot,variant:"default",disabled:!Kt,children:[(0,c.jsx)(D.Check,{size:16}),"Verify & Confirm"]}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsxs)(x,{onClick:()=>h("reveal"),variant:"ghost",size:"sm",children:[(0,c.jsx)(D.ArrowLeft,{size:14}),"Back"]}),n&&(0,c.jsxs)(x,{onClick:ot,variant:"ghost",size:"sm",children:[(0,c.jsx)(D.SkipForward,{size:14}),"Skip"]})]})]})]}),_t={reveal:Qt,confirm:$t,done:(0,c.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[(0,c.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:(0,c.jsx)(D.Check,{size:24,className:"text-green-600 dark:text-green-400"})}),(0,c.jsx)("p",{className:"font-medium text-foreground",children:"Backup Confirmed"}),(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your seed phrase has been backed up successfully."})]})},Ft={reveal:"Backup Seed Phrase",confirm:"Verify Backup",done:"Backup Complete"},Be=_t[v],Pe=Ft[v];return g?(0,c.jsxs)("div",{className:R("space-y-4",r),children:[v!=="done"&&(0,c.jsx)("h3",{className:"text-lg font-semibold",children:Pe}),Be]}):u?b&&y?(0,c.jsx)(b,{open:!0,onOpenChange:L=>{L||i?.(!1)},children:(0,c.jsx)(y,{children:C&&N?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(C,{children:(0,c.jsx)(N,{children:Pe})}),(0,c.jsx)("div",{className:"mt-2 max-h-[55vh] overflow-y-auto",children:Be})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"mb-3 text-lg font-semibold",children:Pe}),(0,c.jsx)("div",{className:"max-h-[55vh] overflow-y-auto",children:Be})]})})}):(0,c.jsxs)(ge,{open:!0,onClose:()=>i?.(!1),children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,c.jsx)("h2",{className:"text-lg font-semibold m-0",children:Pe}),i&&(0,c.jsx)("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:(0,c.jsx)(D.X,{size:16})})]}),Be]}):null}var bt=_e(require("react"),1);var B=require("react/jsx-runtime");function dn({error:e,reset:t,dismiss:n,retryLabel:o="Try Again"}){let r=S(),a=r.Button,g=r.Dialog,u=r.DialogContent,i=r.DialogHeader,l=r.DialogTitle;if(g&&u)return(0,B.jsx)(g,{open:!0,onOpenChange:()=>{},children:(0,B.jsx)(u,{children:i&&l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i,{children:(0,B.jsx)(l,{children:"Something went wrong"})}),(0,B.jsxs)("div",{style:{marginTop:"0.5rem"},children:[(0,B.jsx)("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."}),(0,B.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,B.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,B.jsx)(a,{variant:"default",size:"default",onClick:t,children:o})]})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Something went wrong"}),(0,B.jsx)("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."}),(0,B.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,B.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,B.jsx)(a,{variant:"default",size:"default",onClick:t,children:o})]})]})})});let x=!0,b=n??void 0;return(0,B.jsxs)(ge,{open:x,onClose:b,children:[(0,B.jsx)(ft,{title:"Something went wrong",onClose:b,showCloseButton:!!n}),(0,B.jsxs)(gt,{children:[(0,B.jsx)("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."}),(0,B.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,B.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,B.jsx)(a,{variant:"default",size:"default",onClick:t,children:o})]})]})]})}var xe=class extends bt.default.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}):(0,B.jsx)(dn,{error:this.state.error,reset:this.handleReset,dismiss:this.props.onDismiss?this.handleDismiss:void 0,retryLabel:this.props.retryLabel}):this.props.children}};var O=require("react"),F=require("@naculus/connect-appkit-react");var Ce=require("react"),ht=require("@naculus/connect-appkit-react");var I=require("react");var ye={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"}},un=new Map;function Je(){un.clear()}var He=require("react/jsx-runtime"),xt=(0,I.createContext)({theme:{},isDark:!1,setTheme:()=>{},toggleDarkMode:()=>{}});function mn(e){let t=[];for(let[n,o]of Object.entries(e)){let r=ye[n];r&&o&&t.push(" "+r.name+": "+o+";")}return t.length===0?"":`:root {
2
+ `+t.join(`
3
+ `)+`
4
+ }`}function pn(e){let t=new Set;if(e!=="computed"||typeof document>"u")return t;for(let n of Object.keys(ye)){let o=ye[n],r=getComputedStyle(document.documentElement).getPropertyValue(o.name).trim();r&&r!==o.fallback&&t.add(n)}return t}function Ie({children:e,theme:t={},defaultDark:n=!1,priority:o="fallback"}){let[r,a]=(0,I.useState)(t),[g,u]=(0,I.useState)(n);(0,I.useEffect)(()=>{Je()},[r]);let[i,l]=(0,I.useState)(new Set);(0,I.useEffect)(()=>{l(pn(o))},[o]);let x=(0,I.useMemo)(()=>{if(o==="fallback"||i.size===0)return r;let v={};for(let[h,w]of Object.entries(r))!i.has(h)&&w&&(v[h]=w);return v},[r,o,i]),b=(0,I.useMemo)(()=>mn(x),[x]);(0,I.useEffect)(()=>{if(typeof document>"u")return;let v=document.documentElement;g?v.classList.add("dark"):v.classList.remove("dark"),Je()},[g]);let y=(0,I.useMemo)(()=>"w3c-theme-"+Math.random().toString(36).slice(2,9),[]),C=(0,I.useCallback)(()=>u(v=>!v),[]),N=(0,I.useMemo)(()=>({theme:r,isDark:g,setTheme:a,toggleDarkMode:C}),[r,g,C]);return(0,He.jsxs)(xt.Provider,{value:N,children:[b?(0,He.jsx)("style",{id:y,dangerouslySetInnerHTML:{__html:b}}):null,e]})}function Ze(){return(0,I.useContext)(xt)}function yt(e){let{theme:t}=Ze(),[n,o]=(0,I.useState)("");return(0,I.useEffect)(()=>{let r=ye[e];if(!r)return;let a=t[e];if(a){o(a);return}if(typeof document>"u"){o(r.fallback);return}let g=getComputedStyle(document.documentElement).getPropertyValue(r.name).trim();o(g||r.fallback)},[e,t]),n||ye[e]?.fallback||""}var he=require("react/jsx-runtime"),Ct=(0,Ce.createContext)({mode:"walletconnect"});function Nt(){return(0,Ce.useContext)(Ct)}function Ne({config:e,children:t,autoConnect:n=!1,detectionMode:o="walletconnect",theme:r,defaultDark:a=!1,themePriority:g="computed"}){let u=(0,Ce.useMemo)(()=>({mode:o}),[o]),i=o==="walletconnect"||o==="auto";return(0,he.jsx)(Ct.Provider,{value:u,children:(0,he.jsx)(Ie,{theme:r,defaultDark:a,priority:g,children:(0,he.jsx)(Ve,{components:{QRCodeModal:ve},children:(0,he.jsx)(ht.Web3ConnectProvider,{config:e,autoConnect:n,children:i?(0,he.jsx)(Ae,{children:t}):t})})})})}var ee=require("react/jsx-runtime"),wt=(0,O.createContext)(null);function et(){let e=(0,O.useContext)(wt);if(!e)throw new Error("useAppKit must be used within an <AppKit> component");return e}function Oe({projectId:e,metadata:t,enableEmbedded:n=!1,enablePasskeys:o=!1,children:r,className:a,autoConnect:g=!1,theme:u,defaultDark:i=!1,themePriority:l="computed",detectionMode:x="auto"}){let[b,y]=(0,O.useState)(!1),[C,N]=(0,O.useState)(!1),v=(0,O.useMemo)(()=>({projectId:e,metadata:t,enableEmbedded:n,enablePasskeys:o}),[e,t,n,o]);return(0,ee.jsx)(Ne,{config:v,autoConnect:g,detectionMode:x,theme:u,defaultDark:i,themePriority:l,children:(0,ee.jsx)(fn,{className:a,open:b,setOpen:y,backupOpen:C,setBackupOpen:N,children:r})})}function fn({children:e,className:t,open:n,setOpen:o,backupOpen:r,setBackupOpen:a}){let{isConnected:g,isConnecting:u}=(0,F.useWallet)(),{primaryAccount:i}=(0,F.useAccount)(),{currentChain:l,availableChains:x,switchChain:b}=(0,F.useChain)(),y=(0,F.useEmbeddedWallet)(),{disconnect:C}=(0,F.useDisconnect)(),{wallets:N,hasWallets:v}=pe(),{formatted:h}=(0,F.useBalance)(),w=h??null,s=(0,O.useCallback)(async()=>{await C()},[C]),k=(0,O.useCallback)(()=>{y.confirmBackup(),a(!1)},[y]),M=(0,O.useCallback)(()=>{a(!1)},[]),Q=(0,O.useCallback)(()=>y.wallet?.privateKey??null,[y.wallet]),j=(0,O.useMemo)(()=>({connect:()=>o(!0),disconnect:s,isConnected:g,isConnecting:u,address:i,balance:w,balanceSymbol:l?.token??"ETH",chainName:l?.name??null,availableChains:x.map(_=>({id:_.id,namespace:_.namespace,name:_.name,token:_.token})),switchChain:b,wallets:N,hasWallets:v,backupPending:y.backupPending,seedPhrase:y.seedPhrase,confirmBackup:k,skipBackup:M,open:n,setOpen:o}),[g,u,i,w,l,x,b,N,v,y.backupPending,y.seedPhrase,k,M,s,n,o]);return(0,O.useEffect)(()=>{y.seedPhrase&&y.backupPending&&a(!0)},[y.seedPhrase,y.backupPending,a]),(0,ee.jsxs)(wt.Provider,{value:j,children:[e,y.seedPhrase&&r&&(0,ee.jsx)(be,{seedPhrase:y.seedPhrase,onConfirm:k,onSkip:M,onExportPrivateKey:Q,open:r,onOpenChange:a})]})}function Ue({className:e}){let t=et(),{primaryAccount:n}=(0,F.useAccount)(),{disconnect:o}=(0,F.useDisconnect)();return t.isConnected&&n?(0,ee.jsxs)("div",{className:R("inline-flex items-center gap-2",e),children:[(0,ee.jsx)(de,{variant:"minimal"}),(0,ee.jsx)(ie,{isConnected:t.isConnected,address:n,balance:t.balance,balanceSymbol:t.balanceSymbol,onDisconnect:o,className:e})]}):(0,ee.jsx)(ie,{isConnected:t.isConnected,isConnecting:t.isConnecting,address:n,balance:t.balance,balanceSymbol:t.balanceSymbol,onDisconnect:o,className:e})}function Ke({className:e,variant:t="dropdown"}){return(0,ee.jsx)(de,{className:e,variant:t})}var Tt=require("react/jsx-runtime"),gn={ConnectButton:ie,AccountButton:We,ChainSelector:de,QRCodeModal:ve,SignInButton:Le,SeedPhraseBackup:be,ErrorBoundary:xe,AppKit:Oe,AppKitButton:Ue,AppKitChainSelector:Ke,Web3ConnectUI:Ne},Rt=(0,we.createContext)({});function Ve({children:e,components:t={}}){let n=(0,we.useMemo)(()=>({...gn,...t}),[t]);return(0,Tt.jsx)(Rt.Provider,{value:n,children:e})}function S(){return(0,we.useContext)(Rt)}function kt(e){return S()[e]}var A=require("react/jsx-runtime");function ke({chainId:e,className:t}){let n=Me(e);return n?(0,A.jsx)("span",{className:R("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:g}=(0,Qe.useChain)(),{isConnected:u}=(0,Qe.useWallet)(),[i,l]=(0,Re.useState)(!1),b=S().Button,y=(0,Re.useRef)(null);if((0,Re.useEffect)(()=>{function v(h){y.current&&!y.current.contains(h.target)&&l(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]),!u)return null;let C=o?.name??"Unknown Chain",N=r.length>1;return n==="minimal"?(0,A.jsxs)("div",{className:R("inline-flex items-center gap-1.5 text-xs text-muted-foreground",e),children:[o&&(0,A.jsx)(ke,{chainId:`${o.namespace}:${o.id}`,className:"h-3.5 w-3.5"}),C]}):n==="buttons"?(0,A.jsx)("div",{className:R("flex flex-wrap gap-2",e),children:r.map(v=>{let h=v.id===o?.id&&v.namespace===o?.namespace,w=`${v.namespace}:${v.id}`;return(0,A.jsxs)(b,{className:h?R("bg-accent","border-primary"):"",onClick:()=>{h||a(w).catch(s=>tt.logger.error("ui/ChainSelector","switchChain failed",s))},children:[(0,A.jsx)(ke,{chainId:w,className:"h-4 w-4"}),v.name,v.token&&(0,A.jsx)("span",{className:"text-xs opacity-60",children:v.token})]},w)})}):N?(0,A.jsxs)("div",{ref:y,className:R("relative inline-block",e),children:[(0,A.jsxs)(b,{onClick:()=>l(!i),children:[o&&(0,A.jsx)(ke,{chainId:`${o.namespace}:${o.id}`,className:"h-4 w-4"}),C,(0,A.jsx)("svg",{className:R("h-3 w-3 transition-transform",i&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,A.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&(0,A.jsxs)("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&&(0,A.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Switch Network"}),r.map(v=>{let h=v.id===o?.id&&v.namespace===o?.namespace,w=`${v.namespace}:${v.id}`;return(0,A.jsxs)(b,{onClick:()=>{h||a(w).catch(s=>tt.logger.error("ui/ChainSelector","switchChain failed",s)),l(!1)},className:R("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",h?"bg-accent font-medium":"hover:bg-accent/50"),children:[(0,A.jsx)(ke,{chainId:w,className:"h-4 w-4"}),(0,A.jsx)("span",{className:"flex-1 text-left",children:v.name}),v.token&&(0,A.jsx)("span",{className:"text-xs text-muted-foreground",children:v.token}),h&&(0,A.jsx)("svg",{className:"h-4 w-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,A.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},w)})]})]}):(0,A.jsxs)("div",{className:R("inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm opacity-60 cursor-default",e),children:[o&&(0,A.jsx)(ke,{chainId:`${o.namespace}:${o.id}`,className:"h-4 w-4"}),C]})}var $=require("lucide-react");var d=require("react/jsx-runtime");function vn(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 St(e){return e.symbol||"UNKNOWN"}function bn(e){let t=e.toLowerCase();return t.includes("lifi")?"default":t.includes("axelar")?"secondary":"outline"}function xn(e){return e.length>12?`${e.slice(0,6)}...${e.slice(-6)}`:e}function yn({route:e,onSelect:t}){let n=S(),o=n.Button,r=n.Badge,a=e.provider??"Route";return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4 transition-colors hover:bg-accent/30",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[r?(0,d.jsx)(r,{variant:bn(a),children:a}):(0,d.jsx)("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",children:a}),e.steps.length>1&&(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.steps.length," steps"]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,d.jsx)($.DollarSign,{className:"h-3.5 w-3.5"}),"$",e.gasCosts.totalUsd]}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,d.jsx)($.Clock,{className:"h-3.5 w-3.5"}),vn(e.steps.reduce((g,u)=>{let i=e.estimatedTime>0?15e3:0;return g+i},0))]}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[e.gasCosts.totalUsd," cost"]})]})]}),(0,d.jsx)(o,{variant:"outline",size:"sm",onClick:t,children:"Select"})]})}function hn(){let t=S().Skeleton;return(0,d.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"route-selector-loading",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,d.jsx)($.Loader2,{className:"h-4 w-4 animate-spin"}),(0,d.jsx)("span",{children:"Fetching best routes..."})]}),[1,2,3].map(n=>(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4",children:[(0,d.jsx)("div",{className:"flex flex-col gap-2 flex-1",children:t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(t,{className:"h-4 w-24"}),(0,d.jsx)(t,{className:"h-3 w-48"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),(0,d.jsx)("div",{className:"h-3 w-48 animate-pulse rounded bg-muted"})]})}),t?(0,d.jsx)(t,{className:"h-8 w-20 rounded-md"}):(0,d.jsx)("div",{className:"h-8 w-20 animate-pulse rounded-md bg-muted"})]},n))]})}function Cn(){return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground","data-testid":"route-selector-empty",children:[(0,d.jsx)($.AlertCircle,{className:"h-8 w-8 opacity-40"}),(0,d.jsx)("span",{children:"No routes found for this pair"}),(0,d.jsx)("span",{className:"text-xs",children:"Try a different token or amount"})]})}function Nn({error:e,onRetry:t}){let o=S().Button;return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-6","data-testid":"route-selector-error",children:[(0,d.jsx)($.XCircle,{className:"h-8 w-8 text-destructive"}),(0,d.jsx)("p",{className:"text-sm text-destructive font-medium",children:"Failed to fetch routes"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground max-w-xs text-center",children:e}),t&&(0,d.jsx)(o,{variant:"outline",size:"sm",onClick:t,children:"Retry"})]})}function wn(){let t=S().Progress;return(0,d.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6","data-testid":"route-selector-executing",children:[(0,d.jsx)($.Loader2,{className:"h-6 w-6 animate-spin text-primary"}),(0,d.jsx)("p",{className:"text-sm font-medium",children:"Executing route..."}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Please confirm the transaction in your wallet"}),t?(0,d.jsx)(t,{value:50,className:"w-48 h-1.5"}):(0,d.jsx)("div",{className:"h-1.5 w-48 rounded-full bg-muted",children:(0,d.jsx)("div",{className:"h-full w-1/2 rounded-full bg-primary animate-pulse"})})]})}function Rn({txHash:e}){return(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2 py-6","data-testid":"route-selector-success",children:[(0,d.jsx)($.CheckCircle2,{className:"h-8 w-8 text-green-500"}),(0,d.jsx)("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Route executed successfully!"}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground font-mono",children:["TX: ",xn(e)]})]})}function Bt({chainId:e,className:t}){let n=Me(`eip155:${e}`);return n?(0,d.jsx)("span",{className:R("inline-flex items-center justify-center shrink-0",t),dangerouslySetInnerHTML:{__html:n}}):null}function Pt({inputToken:e,outputToken:t,amount:n,routes:o=[],loading:r=!1,executing:a=!1,onRouteSelected:g,onCancel:u,successTxHash:i,error:l,className:x}){let b=S(),y=b.Card,C=b.Button;if(i)return(0,d.jsx)("div",{className:R("rounded-lg border border-border",x),children:(0,d.jsx)(Rn,{txHash:i})});if(a)return(0,d.jsx)("div",{className:R("rounded-lg border border-border",x),children:(0,d.jsx)(wn,{})});return y?(0,d.jsxs)(y,{className:R("p-4",x),children:[v(),h(),w()]}):(0,d.jsxs)("div",{className:R("rounded-lg border border-border p-4",x),children:[v(),h(),w()]});function v(){return!e&&!t?null:(0,d.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-sm",children:[e&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,d.jsx)(Bt,{chainId:e.chainId,className:"h-4 w-4"}),n?`${n.toString()} `:"",St(e)]}),e&&t&&(0,d.jsx)($.ArrowRight,{className:"h-3.5 w-3.5 text-muted-foreground"}),t&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,d.jsx)(Bt,{chainId:t.chainId,className:"h-4 w-4"}),St(t)]})]})}function h(){return r?(0,d.jsx)(hn,{}):l?(0,d.jsx)(Nn,{error:l}):o.length===0?(0,d.jsx)(Cn,{}):(0,d.jsx)("div",{className:"flex flex-col gap-2","data-testid":"route-selector-routes",children:o.map((s,k)=>(0,d.jsx)(yn,{route:s,onSelect:()=>g?.(s)},`${s.fromChain}-${s.toChain}-${s.gasCosts.totalUsd}-${k}`))})}function w(){return!r&&o.length===0&&!l?null:(0,d.jsx)("div",{className:"mt-4 flex justify-end",children:(0,d.jsx)(C,{variant:"ghost",size:"sm",onClick:u,children:"Cancel"})})}}var Dt=_e(require("react"),1),E=require("lucide-react");var p=require("react/jsx-runtime");function kn(e){let t=Number(e)/1e18;return t<.001?`~${t.toFixed(6)} ETH`:`~${t.toFixed(3)} ETH`}function At({isDeployed:e=!1,isDeploying:t=!1,estimatedGas:n,error:o=null,onUpgrade:r,onShowSettings:a,onRetry:g}){let u=S(),i=u.Button,l=u.Card,x=u.Badge,b=a?(0,p.jsxs)(i,{variant:"outline",className:"w-full",onClick:a,children:[(0,p.jsx)(E.Settings,{size:15})," Advanced Settings ",(0,p.jsx)(E.ChevronRight,{size:14,className:"text-muted-foreground"})]}):null;return e?(0,p.jsxs)(l,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,p.jsx)("div",{className:"flex items-start justify-between",children:(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[(0,p.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-500/10",children:(0,p.jsx)(E.ShieldCheck,{size:22,className:"text-green-500"})}),(0,p.jsxs)("div",{children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,p.jsxs)(x,{variant:"secondary",className:"rounded-full bg-green-500/10 px-2 py-0 text-xs font-medium text-green-500",children:[(0,p.jsx)(E.CheckCircle2,{size:12,className:"mr-0.5 inline"})," Deployed"]})]}),(0,p.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your wallet has been upgraded to a smart wallet"})]})]})}),(0,p.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[[E.Fuel,"Gas Sponsorship","Enabled"],[E.RefreshCw,"Recovery","Enabled"]].map(([y,C,N],v)=>(0,p.jsxs)("div",{className:"rounded-lg bg-muted/50 p-3",children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[Dt.default.createElement(y,{size:14}),(0,p.jsx)("span",{children:C})]}),(0,p.jsx)("div",{className:"mt-1 text-sm font-medium text-foreground",children:N})]},v))}),a&&(0,p.jsx)("div",{className:"mt-4",children:b})]}):t?(0,p.jsx)(l,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:(0,p.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,p.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:(0,p.jsx)(E.LoaderCircle,{size:28,className:"animate-spin text-primary"})}),(0,p.jsx)("h3",{className:"mb-1 text-base font-semibold text-foreground",children:"Deploying Smart Wallet..."}),(0,p.jsx)("p",{className:"mb-4 text-sm text-muted-foreground",children:"Please wait, contract deployment may take a few seconds"}),(0,p.jsx)("div",{className:"h-2 w-full max-w-[200px] overflow-hidden rounded-full bg-muted",children:(0,p.jsx)("div",{className:"h-full w-full animate-pulse rounded-full bg-primary",style:{animationDuration:"1.5s"}})})]})}):o?(0,p.jsxs)(l,{className:"w-full rounded-xl border border-destructive/30 bg-destructive/5 p-5 shadow-sm",children:[(0,p.jsxs)("div",{className:"flex items-start gap-3",children:[(0,p.jsx)("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:(0,p.jsx)(E.AlertCircle,{size:18,className:"text-destructive"})}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("h4",{className:"text-sm font-semibold text-destructive",children:"Deployment Failed"}),(0,p.jsx)("p",{className:"mt-1 text-xs text-destructive/80 break-words",children:o}),g&&(0,p.jsxs)(i,{variant:"outline",size:"sm",className:"mt-3 border-destructive/30 text-destructive hover:bg-destructive/10",onClick:g,children:[(0,p.jsx)(E.RotateCcw,{size:13})," Retry"]})]})]}),a&&(0,p.jsx)("div",{className:"mt-3",children:b})]}):(0,p.jsxs)(l,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[(0,p.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10",children:(0,p.jsx)(E.Shield,{size:20,className:"text-amber-500"})}),(0,p.jsxs)("div",{children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,p.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:"Not Upgraded"})]}),(0,p.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Upgrade to a smart wallet for more features"})]})]}),(0,p.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,p.jsx)(nt,{icon:E.Zap,color:"text-green-500",text:"No ETH needed for transactions \u2014 pay gas with USDC/USDT"}),(0,p.jsx)(nt,{icon:E.Fuel,color:"text-blue-500",text:"Optional dApp sponsorship, zero-cost transactions"}),(0,p.jsx)(nt,{icon:E.ShieldCheck,color:"text-purple-500",text:"Secure recovery mechanism, no fear of losing keys"})]}),r&&(0,p.jsxs)(i,{className:"mt-4 w-full",onClick:r,children:["Upgrade Now",n!==void 0&&(0,p.jsxs)("span",{className:"ml-1 text-xs opacity-80",children:["(Estimated gas fee: ",kn(n),")"]})]}),a&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"mt-4 mb-3 flex items-center gap-2",children:[(0,p.jsx)("div",{className:"h-px flex-1 bg-border"}),(0,p.jsx)("span",{className:"text-xs text-muted-foreground",children:"or"}),(0,p.jsx)("div",{className:"h-px flex-1 bg-border"})]}),b]})]})}function nt({icon:e,color:t,text:n}){return(0,p.jsxs)("div",{className:"flex items-center gap-2.5 text-sm text-foreground/80",children:[(0,p.jsx)(e,{size:14,className:`shrink-0 ${t}`}),(0,p.jsx)("span",{children:n})]})}var ue=require("react"),W=require("lucide-react");var m=require("react/jsx-runtime"),Tn=[{value:"simple",label:"Single Sign (default)",description:"Single key control, simple and secure",icon:(0,m.jsx)(W.Shield,{size:16})},{value:"multi-sig",label:"Multi-Sign (2-of-3)",description:"Requires multiple signers to authorize transactions",icon:(0,m.jsx)(W.Users,{size:16})},{value:"social-recovery",label:"Social Recovery",description:"Set guardian accounts to help recover",icon:(0,m.jsx)(W.KeyRound,{size:16})}],Sn=[{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"}],Bn=[{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 Pn(){return{accountType:"simple",paymasterType:"self",customPaymasterUrl:"",bundlerPreset:"pimlico",customBundlerUrl:"",guardians:[],threshold:2}}function Et({currentConfig:e,onSave:t,onBack:n}){let o=S(),r=o.Button,a=o.Input,g=o.Card,u=o.Separator,[i,l]=(0,ue.useState)({...Pn(),...e}),[x,b]=(0,ue.useState)(""),[y,C]=(0,ue.useState)(!1),N=s=>R("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"),v="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",h=(0,ue.useCallback)(()=>{t?.(i),C(!0),setTimeout(()=>C(!1),2e3)},[i,t]),w=(0,ue.useCallback)(()=>{let s=x.trim();!s||i.guardians.includes(s)||(l(k=>({...k,guardians:[...k.guardians,s]})),b(""))},[x,i.guardians]);return(0,m.jsxs)(g,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,m.jsx)("div",{className:"flex items-center justify-between mb-5",children:(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,m.jsxs)(r,{variant:"ghost",size:"sm",onClick:n,children:[(0,m.jsx)(W.ArrowLeft,{size:15}),"Back"]}),(0,m.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Smart Wallet Settings"})]})}),(0,m.jsxs)("section",{className:"mb-6",children:[(0,m.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,m.jsx)(W.Shield,{size:15})," Verification Method"]}),(0,m.jsx)("div",{className:"space-y-2",children:Tn.map(s=>(0,m.jsxs)("label",{className:N(i.accountType===s.value),children:[(0,m.jsx)("input",{type:"radio",name:"accountType",value:s.value,checked:i.accountType===s.value,onChange:()=>l(k=>({...k,accountType:s.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,m.jsx)("div",{className:"flex items-center gap-2 text-foreground",children:s.icon}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-sm font-medium text-foreground",children:s.label}),(0,m.jsx)("div",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.value))})]}),i.accountType==="social-recovery"&&(0,m.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,m.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,m.jsx)(W.KeyRound,{size:14})," Guardian Addresses"]}),(0,m.jsx)("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&&(0,m.jsx)("div",{className:"mb-3 space-y-1.5",children:i.guardians.map(s=>(0,m.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-card px-3 py-2 text-sm",children:[(0,m.jsxs)("span",{className:"font-mono text-xs text-foreground",children:[s.slice(0,8),"...",s.slice(-6)]}),(0,m.jsx)(r,{variant:"ghost",size:"icon",onClick:()=>l(k=>({...k,guardians:k.guardians.filter(M=>M!==s)})),children:(0,m.jsx)(W.X,{size:14})})]},s))}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(a,{type:"text",placeholder:"Enter guardian address (0x...)",value:x,onChange:s=>b(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),w())},className:"flex-1"}),(0,m.jsxs)(r,{size:"sm",onClick:w,disabled:!x.trim(),children:[(0,m.jsx)(W.Plus,{size:14})," Add"]})]})]}),i.accountType==="multi-sig"&&(0,m.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,m.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,m.jsx)(W.Users,{size:14})," Signing Threshold"]}),(0,m.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set how many signers are needed to authorize a transaction"}),(0,m.jsx)("div",{className:"flex items-center gap-3",children:[1,2,3].map(s=>(0,m.jsxs)("label",{className:N(i.threshold===s),children:[(0,m.jsx)("input",{type:"radio",name:"threshold",value:s,checked:i.threshold===s,onChange:()=>l(k=>({...k,threshold:s})),className:"sr-only"}),s,"-of-3"]},s))})]}),(0,m.jsx)(u,{className:"my-4"}),(0,m.jsxs)("section",{className:"mb-6",children:[(0,m.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,m.jsx)(W.Fuel,{size:15})," Gas Fees"]}),(0,m.jsx)("div",{className:"space-y-2",children:Sn.map(s=>(0,m.jsxs)("label",{className:N(i.paymasterType===s.value),children:[(0,m.jsx)("input",{type:"radio",name:"paymasterType",value:s.value,checked:i.paymasterType===s.value,onChange:()=>l(k=>({...k,paymasterType:s.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("div",{className:"text-sm font-medium text-foreground",children:s.label}),(0,m.jsx)("div",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.value))}),i.paymasterType==="custom"&&(0,m.jsx)("div",{className:"mt-3",children:(0,m.jsx)("input",{type:"text",placeholder:"Custom Paymaster URL",value:i.customPaymasterUrl,onChange:s=>l(k=>({...k,customPaymasterUrl:s.target.value})),className:v})})]}),(0,m.jsx)(u,{className:"my-4"}),(0,m.jsxs)("section",{className:"mb-6",children:[(0,m.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,m.jsx)(W.Wrench,{size:15})," Bundler"]}),(0,m.jsx)("div",{className:"space-y-2",children:Bn.map(s=>(0,m.jsxs)("label",{className:N(i.bundlerPreset===s.value),children:[(0,m.jsx)("input",{type:"radio",name:"bundlerPreset",value:s.value,checked:i.bundlerPreset===s.value,onChange:()=>l(k=>({...k,bundlerPreset:s.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("div",{className:"text-sm font-medium text-foreground",children:s.label}),(0,m.jsx)("div",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.value))}),i.bundlerPreset==="custom"&&(0,m.jsx)("div",{className:"mt-3",children:(0,m.jsx)("input",{type:"text",placeholder:"Custom Bundler URL",value:i.customBundlerUrl,onChange:s=>l(k=>({...k,customBundlerUrl:s.target.value})),className:v})})]}),(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsxs)(r,{className:"flex-1",onClick:h,children:[(0,m.jsx)(W.Save,{size:15}),y?"Saved \u2713":"Save Settings"]}),n&&(0,m.jsxs)(r,{variant:"outline",onClick:n,children:[(0,m.jsx)(W.ArrowLeft,{size:15}),"\u2190 Back to Simple Mode"]})]})]})}var le=require("lucide-react");var zt=require("@naculus/connect-appkit-react"),P=require("react/jsx-runtime"),Dn={safe:{icon:(0,P.jsx)(le.CheckCircle,{size:20}),label:"Safe",colorClass:"text-[hsl(var(--safe,142_76%_36%))]",bgClass:"bg-[hsl(var(--safe)/0.1)]",buttonVariant:"default"},warning:{icon:(0,P.jsx)(le.AlertTriangle,{size:20}),label:"Warning",colorClass:"text-[hsl(var(--warning,38_92%_50%))]",bgClass:"bg-[hsl(var(--warning)/0.1)]",buttonVariant:"default"},blocked:{icon:(0,P.jsx)(le.ShieldAlert,{size:20}),label:"Blocked",colorClass:"text-destructive",bgClass:"bg-destructive/10",buttonVariant:"destructive"}};function Mt({address:e,open:t,onClose:n,onProceed:o}){let r=S(),a=r.Button,g=r.Dialog,u=r.DialogContent,i=r.DialogHeader,l=r.DialogTitle,{validation:x}=(0,zt.useValidateDestination)({address:e}),{level:b,warning:y}=x,C=Dn[b],N=b==="blocked",v=e.length>12?`${e.slice(0,6)}...${e.slice(-4)}`:e,h=s=>R("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=(0,P.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,P.jsxs)("div",{className:R("flex items-center gap-3 rounded-lg p-4",C.bgClass),children:[(0,P.jsx)("span",{className:C.colorClass,children:C.icon}),(0,P.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,P.jsx)("span",{className:R("text-sm font-semibold",C.colorClass),children:C.label}),(0,P.jsx)("span",{className:"text-xs text-muted-foreground break-all font-mono",children:v})]})]}),y&&(0,P.jsx)("p",{className:"text-sm text-muted-foreground m-0",children:y}),(0,P.jsxs)("div",{className:"flex gap-2 justify-end pt-2",children:[a?(0,P.jsx)(a,{onClick:n,variant:"outline",className:"w-full sm:w-auto",children:"Cancel"}):(0,P.jsx)("button",{type:"button",onClick:n,className:R(h("outline"),"w-full sm:w-auto"),children:"Cancel"}),o&&(a?(0,P.jsx)(a,{onClick:o,variant:N?"destructive":"default",disabled:N,className:"w-full sm:w-auto",children:"Proceed anyway"}):(0,P.jsx)("button",{type:"button",onClick:o,disabled:N,className:R(h(N?"destructive":"default"),"w-full sm:w-auto"),children:"Proceed anyway"}))]})]});return g&&u&&i&&l?(0,P.jsx)(g,{open:t,onOpenChange:s=>{s||n()},children:(0,P.jsxs)(u,{className:"sm:max-w-md",children:[(0,P.jsx)(i,{children:(0,P.jsx)(l,{children:"Address Warning"})}),w]})}):t?(0,P.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,P.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:n}),(0,P.jsxs)("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:[(0,P.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,P.jsx)("h2",{className:"text-lg font-semibold m-0",children:"Address Warning"}),(0,P.jsx)("button",{onClick:n,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close",children:(0,P.jsx)(le.X,{size:16})})]}),w]})]}):null}var Te=require("lucide-react");var z=require("react/jsx-runtime");function Wt({wallets:e,onSelect:t,loading:n=!1,error:o=null}){let a=S().Card,g=u=>a?(0,z.jsx)(a,{className:"p-4",children:u}):(0,z.jsx)("div",{className:"rounded-xl border bg-card text-card-foreground shadow-sm p-4",children:u});return n?g((0,z.jsxs)("div",{className:"flex flex-col gap-3",children:[Array.from({length:3}).map((u,i)=>(0,z.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg animate-pulse",children:[(0,z.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted"}),(0,z.jsx)("div",{className:"h-4 w-32 rounded bg-muted"})]},i)),(0,z.jsx)("p",{className:"text-xs text-muted-foreground text-center m-0",children:"Detecting wallets..."})]})):o?g((0,z.jsxs)("div",{className:"flex flex-col items-center gap-3 py-4",children:[(0,z.jsx)(Te.AlertCircle,{size:24,className:"text-destructive"}),(0,z.jsx)("p",{className:"text-sm text-destructive m-0 font-medium",children:o})]})):e.length===0?g((0,z.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,z.jsx)(Te.Wallet,{size:32,className:"text-muted-foreground"}),(0,z.jsxs)("p",{className:"text-sm text-muted-foreground m-0 text-center",children:["No wallets detected.",(0,z.jsx)("br",{}),"Install a browser wallet extension to get started."]})]})):(0,z.jsx)("div",{className:"flex flex-col gap-2",children:e.map(u=>(0,z.jsxs)("button",{type:"button",onClick:()=>t(u),className:R("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:[u.icon?(0,z.jsx)("img",{src:u.icon,alt:u.name,className:"h-10 w-10 rounded-full object-cover shrink-0",onError:i=>{i.target.style.display="none"}}):(0,z.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:(0,z.jsx)(Te.Wallet,{size:18,className:"text-muted-foreground"})}),(0,z.jsxs)("div",{className:"flex flex-col items-start gap-0.5 text-left min-w-0",children:[(0,z.jsx)("span",{className:"text-sm font-medium truncate w-full",children:u.name}),(0,z.jsx)("span",{className:"text-xs text-muted-foreground truncate w-full",children:u.rdns})]})]},u.id))})}0&&(module.exports={AccountButton,AddressWarningDialog,AppKit,AppKitButton,AppKitChainSelector,ChainSelector,ConnectButton,ErrorBoundary,QRCodeModal,RouteSelector,SeedPhraseBackup,SignInButton,SmartWalletSettings,SmartWalletToggle,ThemeProvider,WalletConnectProvider,WalletPicker,Web3ComponentProvider,Web3ConnectUI,cn,useAppKit,useComponent,useComponentRegistry,useDetectionMode,useEIP6963,useIsMobile,useTheme,useThemeVariable,useWalletConnect,useWalletConnectOptional});
5
+ //# sourceMappingURL=index.cjs.map