@luno-kit/ui 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -54,8 +54,6 @@ interface LunokitTheme {
54
54
  };
55
55
  fonts: {
56
56
  body: string;
57
- heading: string;
58
- mono: string;
59
57
  };
60
58
  radii: {
61
59
  walletSelectItem: string;
@@ -90,7 +88,7 @@ interface LunokitThemeOverrides {
90
88
  light?: PartialLunokitTheme;
91
89
  dark?: PartialLunokitTheme;
92
90
  }
93
- type ThemeMode = 'light' | 'dark' | 'auto';
91
+ type ThemeMode = 'light' | 'dark';
94
92
 
95
93
  interface ThemeContextValue {
96
94
  themeMode: ThemeMode;
package/dist/index.d.ts CHANGED
@@ -54,8 +54,6 @@ interface LunokitTheme {
54
54
  };
55
55
  fonts: {
56
56
  body: string;
57
- heading: string;
58
- mono: string;
59
57
  };
60
58
  radii: {
61
59
  walletSelectItem: string;
@@ -90,7 +88,7 @@ interface LunokitThemeOverrides {
90
88
  light?: PartialLunokitTheme;
91
89
  dark?: PartialLunokitTheme;
92
90
  }
93
- type ThemeMode = 'light' | 'dark' | 'auto';
91
+ type ThemeMode = 'light' | 'dark';
94
92
 
95
93
  interface ThemeContextValue {
96
94
  themeMode: ThemeMode;
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  'use client'
2
- import{useCallback as lo,useMemo as je}from"react";import{useAccount as co,useActiveConnector as mo,useBalance as uo,useChain as po}from"@luno-kit/react";import ce from"react";import*as M from"@radix-ui/react-dialog";import{clsx as ht}from"clsx";import{extendTailwindMerge as xt}from"tailwind-merge";var gt=xt({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function d(...e){return gt(ht(e))}function Ae(e,n){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},n)}}import{jsx as Te,jsxs as bt}from"react/jsx-runtime";var wt=({open:e,onOpenChange:n,children:t,contentClassName:r,overlayClassName:o})=>Te(M.Root,{open:e,onOpenChange:n,children:bt(M.Portal,{children:[ce.createElement(M.Overlay,{className:d("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",o)}),Te(M.Content,{className:d("luno-kit font-body fixed z-[200] text-modalText text-base leading-base","bg-modalBackground shadow-modal focus:outline-none overflow-hidden border border-modalBorder","transition-all duration-200","rounded-t-modalMobile bottom-0 left-0 w-full","translate-y-0 -translate-x-0","data-[state=open]:[animation:slide-up_200ms_ease-out]","md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2","md:w-auto md:rounded-modal","md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",r),children:t})]})}),Ct=({children:e,className:n})=>ce.createElement(M.Title,{className:n},e),vt=({children:e,className:n,onClick:t})=>ce.createElement(M.Close,{className:n,onClick:t},e),G=wt,E=vt,D=Ct;import{createContext as yt,useCallback as me,useContext as ee,useEffect as St,useMemo as Nt,useState as Mt}from"react";import{ConnectionStatus as Y,useStatus as kt}from"@luno-kit/react";import{jsx as Tt}from"react/jsx-runtime";function de(){let[e,n]=Mt(!1),t=me(()=>n(!0),[]),r=me(()=>n(!1),[]);return{isOpen:e,open:t,close:r}}var z=yt(void 0),Re=({children:e})=>{let{isOpen:n,open:t,close:r}=de(),{isOpen:o,open:a,close:i}=de(),{isOpen:m,open:p,close:u}=de(),f=kt(),l=me(()=>{r(),i(),u()},[r,i,u]);St(()=>{f===Y.Disconnected&&(i(),u())},[f,i,u]);let s=Nt(()=>({isConnectModalOpen:n,isAccountModalOpen:o,isChainModalOpen:m,openConnectModal:f!==Y.Connected?t:void 0,closeConnectModal:r,openAccountModal:f===Y.Connected?a:void 0,closeAccountModal:i,openChainModal:f===Y.Connected?p:void 0,closeChainModal:u,closeAllModals:l}),[n,t,r,o,a,i,m,p,u,l,f]);return Tt(z.Provider,{value:s,children:e})},W=()=>{let e=ee(z);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},Q=()=>{let e=ee(z);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},U=()=>{let e=ee(z);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}},At=()=>{let e=ee(z);if(!e)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return e.closeAllModals};import{jsx as Pe}from"react/jsx-runtime";var Rt=e=>Pe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Pe("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"})}),j=Rt;import{jsx as Ve}from"react/jsx-runtime";var Pt=e=>Ve("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Ve("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),V=Pt;import{jsx as Ie}from"react/jsx-runtime";var Vt=e=>Ie("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Ie("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"})}),ue=Vt;import{jsx as Be}from"react/jsx-runtime";var It=e=>Be("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:Be("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"})}),pe=It;import{jsx as Ee}from"react/jsx-runtime";var Bt=e=>Ee("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Ee("path",{d:"M232,48V88a8,8,0,0,1-16,0V56H184a8,8,0,0,1,0-16h40A8,8,0,0,1,232,48ZM72,200H40V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16Zm152-40a8,8,0,0,0-8,8v32H184a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,224,160ZM32,96a8,8,0,0,0,8-8V56H72a8,8,0,0,0,0-16H32a8,8,0,0,0-8,8V88A8,8,0,0,0,32,96ZM188,167l-56,32a8,8,0,0,1-7.94,0L68,167A8,8,0,0,1,64,160V96a8,8,0,0,1,4-7l56-32a8,8,0,0,1,7.94,0l56,32a8,8,0,0,1,4,7v64A8,8,0,0,1,188,167ZM88.12,96,128,118.79,167.88,96,128,73.21ZM80,155.36l40,22.85V132.64L80,109.79Zm96,0V109.79l-40,22.85v45.57Z"})}),fe=Bt;import{jsx as De}from"react/jsx-runtime";var Et=e=>De("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:De("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"})}),he=Et;import{jsx as Le}from"react/jsx-runtime";var Dt=e=>Le("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...e,children:Le("path",{d:"M253.66,133.66l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L216,132.69V128A88,88,0,0,0,56.49,76.67a8,8,0,0,1-13-9.34A104,104,0,0,1,232,128v4.69l10.34-10.35a8,8,0,0,1,11.32,11.32Zm-41.18,55A104,104,0,0,1,24,128v-4.69L13.66,133.66A8,8,0,0,1,2.34,122.34l24-24a8,8,0,0,1,11.32,0l24,24a8,8,0,0,1-11.32,11.32L40,123.31V128a87.62,87.62,0,0,0,22.24,58.41A79.66,79.66,0,0,1,98.3,157.66a48,48,0,1,1,59.4,0,79.59,79.59,0,0,1,36.08,28.78,89.68,89.68,0,0,0,5.71-7.11,8,8,0,0,1,13,9.34ZM128,152a32,32,0,1,0-32-32A32,32,0,0,0,128,152Zm0,64a88.2,88.2,0,0,0,53.92-18.49,64,64,0,0,0-107.84,0A87.57,87.57,0,0,0,128,216Z"})}),xe=Dt;import{useMemo as Lt}from"react";import{jsx as Oe}from"react/jsx-runtime";var F=({chainIconUrl:e,chainName:n,className:t})=>e?Oe("img",{src:e,alt:n||"Chain icon",className:d("w-full h-full object-cover rounded-full",t)}):Oe("div",{className:d("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:n?n.charAt(0).toUpperCase():"C"});import{useAccount as Ot,useChain as _t,useDisconnect as Ht,getExplorerUrl as Gt}from"@luno-kit/react";import{Fragment as He,jsx as C,jsxs as q}from"react/jsx-runtime";var Ge=({onViewChange:e,onModalClose:n})=>{let{address:t}=Ot(),{chain:r}=_t(),{disconnectAsync:o}=Ht(),a=Lt(()=>[{key:"Chain Name",content:C("div",{className:"flex items-stretch w-full justify-between",children:q("div",{className:"flex items-center gap-2",children:[C("div",{className:"relative",children:C(F,{className:"w-[20px] h-[20px]",chainIconUrl:r?.chainIconUrl,chainName:r?.name})}),C("span",{className:"text-base text-modalText",children:r?.name||"Polkadot"})]})}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:q(He,{children:[C(fe,{}),C("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open(Gt(r?.blockExplorers?.default?.url,t,"address"))},{key:"Switch Account",content:q(He,{children:[C(xe,{}),C("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}],[e,r,t]),i=async()=>{await o(),n()};return q("div",{className:"flex flex-col items-center gap-3 w-full",children:[C("div",{className:"flex flex-col gap-1.5 w-full px-4",children:a.map(m=>C(_e,{onClick:m.onClick,children:m.content},m.key))}),C("div",{className:"w-full mx-[-100px] h-[1px] bg-separatorLine"}),C("div",{className:"w-full px-4 pb-4",children:q(_e,{onClick:i,children:[C(pe,{}),C("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},_e=({children:e,onClick:n})=>C("button",{type:"button",onClick:()=>n?.(),className:d("w-full p-2.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium","bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover","transition-colors duration-200",n?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});import Ft,{useCallback as $t}from"react";import{useAccount as Zt,useAccounts as zt,useActiveConnector as Wt,useBalance as Qt,useChain as Ut}from"@luno-kit/react";import{formatAddress as jt}from"@luno-kit/react";import{Fragment as Kt,jsx as I,jsxs as te}from"react/jsx-runtime";var ge=({onBack:e})=>{let{accounts:n,selectAccount:t}=zt(),{address:r}=Zt(),o=$t(a=>{t(a),e()},[e]);return I("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:n.map(a=>I(qt,{account:a,isSelected:a.address===r,selectAccount:o},a.address))})};ge.title="Switch Accounts";var qt=Ft.memo(({isSelected:e,account:n,selectAccount:t})=>{let{chain:r}=Ut(),o=n.address,{data:a}=Qt({address:o}),i=Wt();return te("button",{type:"button",onClick:()=>t(n),className:d("px-3.5 py-2.5 w-full rounded-accountSelectItem border-none","bg-accountSelectItemBackground","text-left flex items-center justify-between gap-2","transition-colors duration-200",e?"cursor-auto":"cursor-pointer hover:bg-accountSelectItemBackgroundHover"),"aria-label":n.name||o,disabled:e,children:[te("div",{className:"flex items-center gap-2",children:[I("div",{className:"shrink-0 w-[24px] h-[24px] rounded-full flex items-center justify-center",children:i?.icon&&I("img",{src:i?.icon,alt:"luno account"})}),te("div",{className:"flex flex-col items-start",children:[I("span",{className:"font-medium text-sm leading-sm text-accountSelectItemText",children:n.name||jt(o)}),I("span",{className:"text-xs text-modalTextSecondary font-medium",children:a===void 0?I("div",{className:"animate-pulse rounded w-[60px] h-[18px] bg-skeleton"}):te(Kt,{children:[a?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}),e&&I("div",{className:"border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]",children:I("div",{className:"rounded-full bg-accentColor w-[10px] h-[10px]"})})]})});import Jt,{useMemo as Xt,useState as Fe}from"react";import{useApi as Yt,useChain as eo,useChains as to,useSwitchChain as oo}from"@luno-kit/react";import{Fragment as $e,jsx as S,jsxs as $}from"react/jsx-runtime";var no=[{key:"All",label:"All"},{key:"Mainnets",label:"Mainnets"},{key:"Testnets",label:"Testnets"}],oe=({onChainSwitched:e})=>{let{chain:n}=eo(),t=to(),{switchChainAsync:r}=oo(),{isApiReady:o,apiError:a}=Yt(),[i,m]=Fe("All"),[p,u]=Fe(null),f=Xt(()=>{switch(i){case"Mainnets":return t.filter(s=>!s.testnet);case"Testnets":return t.filter(s=>s.testnet);case"All":default:return t}},[t,i]),l=async s=>{if(s.genesisHash!==n?.genesisHash&&!(!o&&!a)){u(s.genesisHash);try{await r({chainId:s.genesisHash}),e?.(s)}catch(c){console.error("Failed to switch chain:",c)}finally{u(null)}}};return $($e,{children:[S("div",{className:"flex items-center gap-1.5 w-full",children:no.map(s=>S("button",{onClick:()=>m(s.key),className:d("px-3.5 flex items-center justify-center cursor-pointer min-w-[48px] min-h-[24px] rounded-networkSelectItem text-[12px] leading-[16px] font-medium transition-colors",i===s.key?"bg-navigationButtonBackground text-modalText":"bg-transparent text-modalTextSecondary hover:text-modalText"),children:s.label},s.key))}),S("div",{className:"flex flex-col gap-1.5 overflow-y-auto custom-scrollbar max-h-[450px]",children:f.map(s=>S(ro,{chain:s,isSelected:s.genesisHash===n?.genesisHash,onSelect:l,isLoading:(p===s.genesisHash||!o)&&!a},s.genesisHash))}),f.length===0&&S("div",{className:"flex items-center justify-center py-12",children:$("span",{className:"text-modalTextSecondary text-xs",children:["No ",i==="All"?"chains":i.toLowerCase()," available"]})})]})},ro=Jt.memo(({chain:e,isSelected:n,isLoading:t,onSelect:r})=>$("button",{onClick:()=>r(e),disabled:n||t,className:d("flex items-center justify-between p-2.5 rounded-networkSelectItem","bg-networkSelectItemBackground","transition-colors duration-200",n||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[$("div",{className:"flex items-center gap-2",children:[S(F,{className:"w-[20px] bg-modal-bg h-[20px] flex items-center justify-center",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),S("div",{className:"flex flex-col items-start",children:S("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),S("div",{className:"flex items-center justify-center h-[20px]",children:n?t?$($e,{children:[S("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:"Switching"}),S("div",{className:"loading text-accentColor w-[15px] h-[15px]"})]}):$("span",{className:"status-dot-container",children:[S("span",{className:"ping-animation"}),S("span",{className:"status-dot"})]}):null})]}));import{jsx as Ze}from"react/jsx-runtime";var ne=({onBack:e})=>Ze("div",{className:"flex flex-col gap-3.5 p-4 pt-0",children:Ze(oe,{})});ne.title="Select Networks";import{useCallback as ao,useState as io}from"react";import{jsx as ze,jsxs as so}from"react/jsx-runtime";var re=({copyText:e,label:n,className:t=""})=>{let[r,o]=io(!1),a=ao(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),o(!0),setTimeout(()=>o(!1),2e3),!0):!1}catch(m){return console.error("Copy failed:",m),!1}},[]);return so("button",{type:"button",className:d("cursor-pointer bg-transparent border-none p-0 m-0 inline-flex items-center justify-center gap-1",t),onClick:()=>!r&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:r,children:[r?ze(he,{className:"text-accentColor",width:16,height:16}):ze(ue,{width:16,height:16}),n]})};import{formatAddress as fo}from"@luno-kit/react";import{useCallback as We,useState as Qe,useRef as Ue}from"react";function ae({initialView:e,animationDuration:n=200,animationEasing:t="ease-out"}){let[r,o]=Qe(e),[a,i]=Qe(!1),m=Ue(null),p=Ue(null),u=We(l=>{if(l===r||a)return;if(i(!0),!m.current){o(l),i(!1);return}let s=m.current,c=s.offsetHeight;o(l),requestAnimationFrame(()=>{if(!s||!p.current){i(!1);return}let h=p.current.offsetHeight;s.animate([{height:c+"px"},{height:h+"px"}],{duration:n,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[r,a,n,t]),f=We(()=>{o(e),i(!1)},[e]);return{currentView:r,isAnimating:a,containerRef:m,currentViewRef:p,handleViewChange:u,resetView:f}}import{Fragment as qe,jsx as g,jsxs as H}from"react/jsx-runtime";var Ke=()=>{let{isOpen:e,close:n}=Q(),{address:t}=co(),{chain:r}=po(),{data:o}=uo({address:t}),a=mo(),{currentView:i,containerRef:m,currentViewRef:p,handleViewChange:u,resetView:f}=ae({initialView:"main"}),l=lo(()=>{n(),f()},[n]),s=je(()=>i==="switchAccount"?"Switch Account":i==="switchChain"?ne.title:null,[i]),c=je(()=>({main:g(Ge,{onViewChange:u,onModalClose:l}),switchAccount:g(ge,{onBack:()=>u("main")}),switchChain:g(ne,{onBack:()=>u("main")})}),[u,l]);return g(G,{open:e,onOpenChange:l,children:H("div",{className:d("flex flex-col w-full md:w-[360px] max-h-[500px] text-modalText","bg-modalBackground shadow-modal",i==="main"?"gap-6":"gap-3.5"),children:[H("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[i==="main"?H("div",{className:"flex items-center gap-3",children:[a?.icon&&g("div",{className:"flex items-center justify-center w-[55px] h-[55px]",children:g("img",{src:a.icon,alt:""})}),H("div",{className:"flex flex-col items-start gap-1 w-full",children:[g(D,{className:"sr-only",children:"Account Details"}),H("div",{className:"flex items-center gap-1.5 w-full",children:[g("span",{className:"text-base text-modalText font-semibold",children:fo(t)}),g(re,{copyText:t})]}),g("div",{className:"text-sm text-modalTextSecondary font-medium min-h-[20px]",children:o===void 0?g("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-skeleton"}):H(qe,{children:[o?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}):H(qe,{children:[g("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>u("main"),"aria-label":"Back",children:g(j,{})}),g(D,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:s})]}),g(E,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:g(V,{})})]}),g("div",{ref:m,className:"relative overflow-hidden",children:g("div",{ref:p,children:c[i]})})]})})};import{jsx as Z,jsxs as Je}from"react/jsx-runtime";var Xe=()=>{let{isOpen:e,close:n}=U();return Z(G,{open:e,onOpenChange:t=>!t&&n(),children:Je("div",{className:"flex flex-col w-full md:w-[360px] max-h-[500px] p-4 gap-3.5 text-modalText",children:[Je("div",{className:"flex items-center justify-between w-full",children:[Z("div",{className:"w-[30px]"})," ",Z(D,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),Z(E,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:Z(V,{})})]}),Z(oe,{})]})})};import{useEffect as Io,useMemo as Bo,useState as it}from"react";import{useConnect as Eo,isMobileDevice as Do}from"@luno-kit/react";import{useStatus as ho,useAccount as xo,useChain as go,useBalance as wo,ConnectionStatus as ie,useChains as Co,useActiveConnector as vo,formatAddress as bo}from"@luno-kit/react";function Ye(){let e=ho(),{account:n,address:t}=xo(),{chain:r}=go(),o=Co(),{data:a}=wo({address:t}),i=vo(),{open:m,isOpen:p}=W(),{open:u,isOpen:f}=Q(),{open:l,isOpen:s}=U(),c=e===ie.Connecting,h=e===ie.Connected,x=e===ie.Disconnected||e===ie.Disconnecting,T=!!r&&o.some(b=>b.genesisHash.toLowerCase()===r.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:h,isDisconnected:x,isConnecting:c,account:n,address:t,displayAddress:bo(t),currentChain:r,configuredChains:o,isChainSupported:T,chainIconUrl:r?.chainIconUrl,chainName:r?.name,balance:a,openConnectModal:m,openAccountModal:u,openChainModal:l,isConnectModalOpen:p,isAccountModalOpen:f,isChainModalOpen:s}}import{useEffect as yo,useState as So}from"react";var se=()=>{let[e,n]=So({height:void 0,width:void 0});return yo(()=>{let t=Ae(()=>{n({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};import Ro from"react";import{Cuer as No}from"cuer";import{jsx as L,jsxs as et}from"react/jsx-runtime";var tt=({logoBackground:e,uri:n,size:t})=>{if(!n){let a=Math.floor(14.25),i=t/57,m=a*i,p=Math.ceil(57/2-a/2),u=p+a,f=()=>{let c=[];for(let h=0;h<57;h++)for(let x=0;x<57;x++){if(h>=p&&h<u&&x>=p&&x<u||h<8&&x<8||h<8&&x>=49||h>=49&&x<8)continue;let b=x+.5,P=h+.5;c.push(L("rect",{x:b-.4,y:P-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${x}`))}return c},l=({position:c})=>{let h=7*i,x={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return et("div",{className:"absolute z-[4]",style:{width:`${h}px`,height:`${h}px`,...x[c]},children:[L("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),L("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",style:{width:`${3*i}px`,height:`${3*i}px`,borderRadius:`${.5*i}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},s=()=>{let c=p*i;return L("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${m}px`,height:`${m}px`,left:`${c}px`,top:`${c}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:L("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return et("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[L("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:f()}),L("div",{className:"absolute inset-0 z-[100]",style:{background:"linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",backgroundSize:"200% 100%",transform:"scale(1.5) rotate(45deg)",animation:"shimmer 1000ms linear infinite both"}}),l({position:"top-left"}),l({position:"top-right"}),l({position:"bottom-left"}),e&&s()]})}return L(No,{arena:e,value:n})};import{jsx as O,jsxs as K}from"react/jsx-runtime";var J="transition-transform transition-[125] hover:scale-[1.03] transition-ease",Mo=({className:e,label:n="Connect Wallet",accountStatus:t="full",chainStatus:r="full",showBalance:o=!0})=>{let{isConnected:a,isDisconnected:i,displayAddress:m,balance:p,openConnectModal:u,openAccountModal:f,openChainModal:l,chainIconUrl:s,chainName:c,currentChain:h,activeConnector:x}=Ye(),{width:T}=se(),b=T&&T>768;return i||!a||!x?O("button",{type:"button",onClick:()=>u?.(),className:d("cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none","text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]","rounded-connectButton",J,"px-3.5 text-base leading-base min-h-[40px]",e),children:n}):K("div",{className:d("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[r!=="none"&&K("button",{type:"button",onClick:()=>l?.(),className:d("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",J),"aria-label":"Switch chain",children:[r==="full"||r==="icon"?O(F,{chainIconUrl:s,chainName:c,className:"w-[24px] h-[24px]"}):null,(r==="full"||r==="name")&&b&&O("span",{children:h?.name||"Unknown Chain"})]}),K("button",{type:"button",onClick:()=>f?.(),className:d("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",J),"aria-label":"Open account modal",children:[o&&b&&O("div",{className:"p-2 pl-3",children:p===void 0?O("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"}):K("span",{className:"",children:[p?.formattedTransferable||p?.formattedTotal||0," ",h?.nativeCurrency?.symbol||""]})}),K("div",{className:d("flex items-center bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",o&&b?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&O("span",{className:"w-[24px] h-[24px]",children:O("img",{src:x.icon,alt:"luno"})}),O("span",{"aria-label":"Wallet icon placeholder",className:"",children:m})]})]})]})};import{useEffect as ko,useRef as Ao}from"react";import{jsx as To}from"react/jsx-runtime";var ot=({size:e=160,dotCount:n=300,duration:t=3,className:r=""})=>{let o=Ao(null);return ko(()=>{if(!o.current)return;let a=1,i=2,m=Math.PI*(3-Math.sqrt(5)),p=e/2,u=p-i-a,f="http://www.w3.org/2000/svg";o.current.innerHTML="";let l=document.createElementNS(f,"svg");l.setAttribute("width",e.toString()),l.setAttribute("height",e.toString()),l.setAttribute("viewBox",`0 0 ${e} ${e}`),l.style.display="block",o.current.appendChild(l);for(let s=0;s<n;s++){let c=s+.5,h=c/n,x=Math.sqrt(h)*u,T=c*m,b=p+x*Math.cos(T),P=p+x*Math.sin(T),R=document.createElementNS(f,"circle");R.setAttribute("cx",b.toString()),R.setAttribute("cy",P.toString()),R.setAttribute("r",a.toString()),R.setAttribute("fill","currentColor"),R.setAttribute("opacity","0.6"),l.appendChild(R);let y=document.createElementNS(f,"animate");y.setAttribute("attributeName","r"),y.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),y.setAttribute("dur",`${t}s`),y.setAttribute("begin",`${h*t}s`),y.setAttribute("repeatCount","indefinite"),y.setAttribute("calcMode","spline"),y.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),R.appendChild(y);let N=document.createElementNS(f,"animate");N.setAttribute("attributeName","opacity"),N.setAttribute("values","0.2;1;0.2"),N.setAttribute("dur",`${t}s`),N.setAttribute("begin",`${h*t}s`),N.setAttribute("repeatCount","indefinite"),N.setAttribute("calcMode","spline"),N.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),R.appendChild(N)}},[e,n,t]),To("div",{ref:o,className:d("text-accentColor inline-flex w-full h-full justify-center align-center",r)})};import{Fragment as nt,jsx as w,jsxs as B}from"react/jsx-runtime";var we=Ro.memo(({selectedConnector:e,onConnect:n,qrCode:t,isWide:r,connectState:o})=>{let a=e?.hasConnectionUri();return B("div",{className:d("flex flex-col items-center",r?"w-[450px] p-4 min-h-[472px]":"justify-center w-full min-h-[400px]"),children:[r&&w("div",{className:"w-full",children:B("div",{className:"flex items-center justify-between",children:[w("div",{}),w(E,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:w(V,{})})]})}),w("div",{className:d("flex items-center gap-4 flex-col grow justify-center",e&&a?"max-w-[300px]":"max-w-[360px]"),children:e?a?B("div",{className:"flex flex-col items-center gap-2.5",children:[w(tt,{size:300,logoBackground:e.icon,uri:t}),B("div",{className:"text-base leading-base font-medium text-center text-modalTextSecondary",children:["Scan the QR code with ",e.id==="nova"?"the Nova":"your phone"]}),w("div",{className:"min-h-[20px] flex items-center justify-center ",children:e.links?.browserExtension?B("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don't have ",e.name,"?"]}):t?w(re,{className:"text-sm leading-sm font-medium text-accentColor hover:text-modalText",copyText:t,label:"Copy Link"}):null})]}):B(nt,{children:[w("div",{className:"w-[80px] h-[80px]",children:w("img",{src:e.icon,className:"w-full h-full",alt:""})}),B("p",{className:"text-lg leading-lg text-modalFont font-bold",children:["Opening ",e.name,"..."]}),w("p",{className:"pb-[10px] text-base text-modalTextSecondary leading-base font-medium text-center",children:"Confirm connection in the extension"}),o.isConnecting&&w("div",{className:"loading text-modalText"}),!e.isInstalled()&&e.links.browserExtension&&B("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer pt-6 text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don\u2018t have ",e.name,"?"]}),!o.isConnecting&&o.isError&&e.isInstalled()&&w("button",{className:d("rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-semibold text-sm text-modalText bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",J),onClick:()=>n(e),children:"Retry"})]}):B(nt,{children:[w("div",{className:"w-[160px] h-[160px] mb-4",children:w(ot,{})}),w("p",{className:"cursor-pointer text-base leading-base text-accentColor font-semibold text-center",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}),w("p",{className:"text-modalTextSecondary w-[250px] text-sm leading-sm font-medium text-center",children:"Connect your wallet to sign in and start using your assets."})]})}),w("div",{})]})});import rt from"react";import{useConnectors as Po,isMobileDevice as Vo}from"@luno-kit/react";import{jsx as A,jsxs as le}from"react/jsx-runtime";var at=rt.memo(({onConnect:e})=>{let n=Po();if(Vo()){let o=n.filter(a=>a.links.deepLink);return A("div",{className:"flex flex-col items-start gap-1 w-full",children:o.map(a=>A(Ce,{connector:a,onConnect:()=>e(a)},`${a.id}-${a.name}`))})}let t=n.filter(o=>o.isInstalled()),r=n.filter(o=>!o.isInstalled());return le("div",{className:"flex flex-col items-start gap-4 w-full",children:[le("div",{className:"flex flex-col items-start gap-2 w-full",children:[A("div",{className:"text-sm text-accentColor font-semibold leading-base",children:"Installed"}),A("div",{className:"flex flex-col items-start gap-1.5 w-full",children:t.map(o=>A(Ce,{connector:o,onConnect:()=>e(o)},o.id))})]}),r.length>0&&le("div",{className:"flex flex-col items-start gap-2 w-full",children:[A("div",{className:"text-sm text-modalTextSecondary font-semibold leading-base",children:"More"}),A("div",{className:"flex flex-col items-start gap-1 w-full",children:r.map(o=>A(Ce,{connector:o,onConnect:()=>e(o)},o.id))})]})]})}),Ce=rt.memo(({connector:e,onConnect:n})=>le("button",{onClick:n,className:d("cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none","hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]","text-left"),children:[A("div",{className:"w-[28px] h-[28px]",children:A("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),A("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));import{Fragment as ve,jsx as v,jsxs as X}from"react/jsx-runtime";var st=({size:e="wide"})=>{let{isOpen:n,close:t}=W(),{connectAsync:r,reset:o,isPending:a,isError:i}=Eo(),[m,p]=it(null),[u,f]=it(),{width:l}=se(),s=l&&l>768,c=!!(e==="wide"&&s),{containerRef:h,currentViewRef:x,resetView:T,handleViewChange:b,currentView:P}=ae({initialView:"Connect Wallet"}),R=async k=>{let ke=await k.getConnectionUri();f(ke)},y=async k=>{if(Do()&&k.links.deepLink)try{await r({connectorId:k.id}),N(!1);return}catch{window.location.href=`${k.links.deepLink}?url=${window.location.href}`;return}!c&&b("walletView"),p(k),f(void 0),k.hasConnectionUri()&&R(k),await r({connectorId:k.id}),N(!1)},N=k=>{!k&&t(),o(),T(),p(null),f(void 0)},ft=Bo(()=>({"Connect Wallet":v(at,{onConnect:y}),walletView:v(we,{connectState:{isConnecting:a,isError:i},isWide:c,selectedConnector:m,qrCode:u,onConnect:y})}),[c,m,u,y,a,i]);return Io(()=>{c&&P==="walletView"&&b("Connect Wallet")},[c,P]),v(G,{open:n,onOpenChange:N,children:X("div",{className:d("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[X("div",{className:d("flex flex-col items-start py-4 px-5 w-full md:w-auto",c?"md:min-w-[300px] border-r-[1px] border-r-solid border-r-separatorLine":"md:min-w-[360px]"),children:[X("div",{className:d("flex items-center justify-between w-full",!c&&"pb-4"),children:[P==="Connect Wallet"?X(ve,{children:[!c&&v("div",{className:"w-[30px] h-[30px]","aria-hidden":!0}),v(D,{className:d("text-lg leading-lg text-modalText font-bold",c?"pb-6":"flex-1 text-center"),children:"Connect Wallet"})]}):X(ve,{children:[v("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>b("Connect Wallet"),"aria-label":"Back",children:v(j,{})}),v(D,{className:d("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300"),children:m?.name})]}),!c&&v(E,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:v(V,{})})]}),v("div",{ref:h,className:"relative overflow-hidden w-full",children:v("div",{ref:x,children:ft[P]})}),!c&&P==="Connect Wallet"&&v(ve,{children:v("p",{className:"cursor-pointer w-full pt-4 text-sm leading-sm text-accentColor font-medium text-center hover:text-modalText",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})})]}),c&&v(we,{connectState:{isConnecting:a,isError:i},isWide:c,selectedConnector:m,qrCode:u,onConnect:y})]})})};import{useState as Zo}from"react";import{LunoProvider as zo}from"@luno-kit/react";import{QueryClient as Wo,QueryClientProvider as Qo}from"@tanstack/react-query";import{createContext as Oo,useState as Se,useContext as _o,useMemo as be,useCallback as Ho,useEffect as dt}from"react";import{useEffect as Lo}from"react";var lt=["--color-accentColor","--color-walletSelectItemBackground","--color-walletSelectItemBackgroundHover","--color-walletSelectItemText","--color-connectButtonBackground","--color-connectButtonInnerBackground","--color-connectButtonText","--color-accountActionItemBackground","--color-accountActionItemBackgroundHover","--color-accountActionItemText","--color-accountSelectItemBackground","--color-accountSelectItemBackgroundHover","--color-accountSelectItemText","--color-currentNetworkButtonBackground","--color-currentNetworkButtonText","--color-networkSelectItemBackground","--color-networkSelectItemBackgroundHover","--color-networkSelectItemText","--color-navigationButtonBackground","--color-separatorLine","--color-modalBackground","--color-modalBackdrop","--color-modalBorder","--color-modalText","--color-modalTextSecondary","--color-modalControlButtonBackgroundHover","--color-modalControlButtonText","--color-success","--color-successForeground","--color-warning","--color-warningForeground","--color-error","--color-errorForeground","--color-info","--color-infoForeground","--color-skeleton","--font-body","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],ct=(e,n)=>{Lo(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([r,o])=>{o&&t.style.setProperty(`--color-${r}`,o)}),Object.entries(e.completeTheme.fonts).forEach(([r,o])=>{o&&t.style.setProperty(`--font-${r}`,o)}),Object.entries(e.completeTheme.radii).forEach(([r,o])=>{o&&t.style.setProperty(`--radius-${r}`,o)}),Object.entries(e.completeTheme.shadows).forEach(([r,o])=>{o&&t.style.setProperty(`--shadow-${r}`,o)}),Object.entries(e.completeTheme.blurs).forEach(([r,o])=>{o&&t.style.setProperty(`--blur-${r}`,o)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",n),Object.keys(e.partialOverrides).length>0&&(lt.forEach(o=>{t.style.removeProperty(o)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([o,a])=>{a&&t.style.setProperty(`--color-${o}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([o,a])=>{a&&t.style.setProperty(`--font-${o}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([o,a])=>{a&&t.style.setProperty(`--radius-${o}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([o,a])=>{a&&t.style.setProperty(`--shadow-${o}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([o,a])=>{a&&t.style.setProperty(`--blur-${o}`,a)}))):(t.setAttribute("data-theme",n),lt.forEach(r=>{t.style.removeProperty(r)}))},[e,n])};import{jsx as $o}from"react/jsx-runtime";var Ne="luno.lastThemePreference",Go=e=>{try{localStorage.setItem(Ne,JSON.stringify(e))}catch{}},mt=Oo(void 0),ye=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Fo=()=>{let[e,n]=Se(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return dt(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=o=>{n(o.matches?"dark":"light")};return r(t),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),e},Me=({children:e,theme:n})=>{let t=Fo(),[r,o]=Se(()=>{if(typeof window<"u")try{let s=localStorage.getItem(Ne);if(s){let c=JSON.parse(s);if(c?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(c?.preferredTheme)return c.preferredTheme}}catch{}return!n||ye(n)?"light":n.defaultMode||"light"}),[a,i]=Se(()=>{if(typeof window<"u")try{let s=localStorage.getItem(Ne);if(s)return JSON.parse(s)?.isAuto??!1}catch{}return!n||ye(n)?!1:n.autoMode??!1}),m=be(()=>{if(!n)return{type:"default",completeTheme:null,partialOverrides:null};if(ye(n))return{type:"complete",completeTheme:n,partialOverrides:null};let l=n;if(l.theme)return{type:"complete",completeTheme:l.theme,partialOverrides:null};let s=null;return r==="light"&&l.light?s=l.light:r==="dark"&&l.dark?s=l.dark:s={...l},{type:"partial",completeTheme:null,partialOverrides:s}},[r,n]),p=be(()=>m.type==="complete"?m.completeTheme:null,[m]);ct(m,r);let u=Ho(l=>{let s=l==="auto";i(s),o(s?t||"light":l);let c={isAuto:s,...s?{}:{preferredTheme:l}};Go(c)},[t]);dt(()=>{a&&o(t||"light")},[t,a]);let f=be(()=>({themeMode:r,setThemeChoice:u,currentTheme:p}),[r,u,p]);return $o(mt.Provider,{value:f,children:e})},ut=()=>{let e=_o(mt);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};import{Fragment as jo,jsx as _,jsxs as pt}from"react/jsx-runtime";var Ja=({children:e,config:n,queryClientConfig:t,theme:r})=>{let[o]=Zo(()=>new Wo(t));return _(Qo,{client:o,children:_(zo,{config:n,children:_(Me,{theme:r,children:pt(Re,{children:[_("div",{className:"font-base luno-kit",children:e}),_(Uo,{modalSize:n.modalSize})]})})})})},Uo=({modalSize:e})=>pt(jo,{children:[_(st,{size:e}),_(Ke,{}),_(Xe,{})]});export{Mo as ConnectButton,Ja as LunoKitProvider,Q as useAccountModal,U as useChainModal,At as useCloseAllModals,W as useConnectModal,ut as useLunoTheme};
2
+ import{useCallback as lo,useMemo as Ue}from"react";import{useAccount as co,useActiveConnector as mo,useBalance as uo,useChain as po}from"@luno-kit/react";import ce from"react";import*as M from"@radix-ui/react-dialog";import{clsx as ht}from"clsx";import{extendTailwindMerge as xt}from"tailwind-merge";var gt=xt({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function d(...e){return gt(ht(e))}function Ae(e,n){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},n)}}import{jsx as Te,jsxs as bt}from"react/jsx-runtime";var wt=({open:e,onOpenChange:n,children:t,contentClassName:r,overlayClassName:o})=>Te(M.Root,{open:e,onOpenChange:n,children:bt(M.Portal,{children:[ce.createElement(M.Overlay,{className:d("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",o)}),Te(M.Content,{className:d("luno-kit font-body fixed z-[200] text-modalText text-base leading-base","bg-modalBackground shadow-modal focus:outline-none overflow-hidden border border-modalBorder","transition-all duration-200","rounded-t-modalMobile bottom-0 left-0 w-full","translate-y-0 -translate-x-0","data-[state=open]:[animation:slide-up_200ms_ease-out]","md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2","md:w-auto md:rounded-modal","md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",r),children:t})]})}),Ct=({children:e,className:n})=>ce.createElement(M.Title,{className:n},e),vt=({children:e,className:n,onClick:t})=>ce.createElement(M.Close,{className:n,onClick:t},e),G=wt,E=vt,D=Ct;import{createContext as yt,useCallback as me,useContext as ee,useEffect as St,useMemo as Nt,useState as Mt}from"react";import{ConnectionStatus as Y,useStatus as kt}from"@luno-kit/react";import{jsx as Tt}from"react/jsx-runtime";function de(){let[e,n]=Mt(!1),t=me(()=>n(!0),[]),r=me(()=>n(!1),[]);return{isOpen:e,open:t,close:r}}var z=yt(void 0),Re=({children:e})=>{let{isOpen:n,open:t,close:r}=de(),{isOpen:o,open:a,close:i}=de(),{isOpen:m,open:p,close:u}=de(),f=kt(),l=me(()=>{r(),i(),u()},[r,i,u]);St(()=>{f===Y.Disconnected&&(i(),u())},[f,i,u]);let s=Nt(()=>({isConnectModalOpen:n,isAccountModalOpen:o,isChainModalOpen:m,openConnectModal:f!==Y.Connected?t:void 0,closeConnectModal:r,openAccountModal:f===Y.Connected?a:void 0,closeAccountModal:i,openChainModal:f===Y.Connected?p:void 0,closeChainModal:u,closeAllModals:l}),[n,t,r,o,a,i,m,p,u,l,f]);return Tt(z.Provider,{value:s,children:e})},W=()=>{let e=ee(z);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},Q=()=>{let e=ee(z);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},j=()=>{let e=ee(z);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}},At=()=>{let e=ee(z);if(!e)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return e.closeAllModals};import{jsx as Pe}from"react/jsx-runtime";var Rt=e=>Pe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Pe("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"})}),U=Rt;import{jsx as Ve}from"react/jsx-runtime";var Pt=e=>Ve("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Ve("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),V=Pt;import{jsx as Ie}from"react/jsx-runtime";var Vt=e=>Ie("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Ie("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"})}),ue=Vt;import{jsx as Be}from"react/jsx-runtime";var It=e=>Be("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:Be("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"})}),pe=It;import{jsx as Ee}from"react/jsx-runtime";var Bt=e=>Ee("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Ee("path",{d:"M232,48V88a8,8,0,0,1-16,0V56H184a8,8,0,0,1,0-16h40A8,8,0,0,1,232,48ZM72,200H40V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16Zm152-40a8,8,0,0,0-8,8v32H184a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,224,160ZM32,96a8,8,0,0,0,8-8V56H72a8,8,0,0,0,0-16H32a8,8,0,0,0-8,8V88A8,8,0,0,0,32,96ZM188,167l-56,32a8,8,0,0,1-7.94,0L68,167A8,8,0,0,1,64,160V96a8,8,0,0,1,4-7l56-32a8,8,0,0,1,7.94,0l56,32a8,8,0,0,1,4,7v64A8,8,0,0,1,188,167ZM88.12,96,128,118.79,167.88,96,128,73.21ZM80,155.36l40,22.85V132.64L80,109.79Zm96,0V109.79l-40,22.85v45.57Z"})}),fe=Bt;import{jsx as De}from"react/jsx-runtime";var Et=e=>De("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:De("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"})}),he=Et;import{jsx as Le}from"react/jsx-runtime";var Dt=e=>Le("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...e,children:Le("path",{d:"M253.66,133.66l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L216,132.69V128A88,88,0,0,0,56.49,76.67a8,8,0,0,1-13-9.34A104,104,0,0,1,232,128v4.69l10.34-10.35a8,8,0,0,1,11.32,11.32Zm-41.18,55A104,104,0,0,1,24,128v-4.69L13.66,133.66A8,8,0,0,1,2.34,122.34l24-24a8,8,0,0,1,11.32,0l24,24a8,8,0,0,1-11.32,11.32L40,123.31V128a87.62,87.62,0,0,0,22.24,58.41A79.66,79.66,0,0,1,98.3,157.66a48,48,0,1,1,59.4,0,79.59,79.59,0,0,1,36.08,28.78,89.68,89.68,0,0,0,5.71-7.11,8,8,0,0,1,13,9.34ZM128,152a32,32,0,1,0-32-32A32,32,0,0,0,128,152Zm0,64a88.2,88.2,0,0,0,53.92-18.49,64,64,0,0,0-107.84,0A87.57,87.57,0,0,0,128,216Z"})}),xe=Dt;import{useMemo as Lt}from"react";import{jsx as Oe}from"react/jsx-runtime";var F=({chainIconUrl:e,chainName:n,className:t})=>e?Oe("img",{src:e,alt:n||"Chain icon",className:d("w-full h-full object-cover rounded-full",t)}):Oe("div",{className:d("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:n?n.charAt(0).toUpperCase():"C"});import{useAccount as Ot,useChain as _t,useDisconnect as Ht,getExplorerUrl as Gt}from"@luno-kit/react";import{Fragment as He,jsx as C,jsxs as q}from"react/jsx-runtime";var Ge=({onViewChange:e,onModalClose:n})=>{let{address:t}=Ot(),{chain:r}=_t(),{disconnectAsync:o}=Ht(),a=Lt(()=>[{key:"Chain Name",content:C("div",{className:"flex items-stretch w-full justify-between",children:q("div",{className:"flex items-center gap-2",children:[C("div",{className:"relative",children:C(F,{className:"w-[20px] h-[20px]",chainIconUrl:r?.chainIconUrl,chainName:r?.name})}),C("span",{className:"text-base text-modalText",children:r?.name||"Polkadot"})]})}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:q(He,{children:[C(fe,{}),C("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open(Gt(r?.blockExplorers?.default?.url,t,"address"))},{key:"Switch Account",content:q(He,{children:[C(xe,{}),C("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}],[e,r,t]),i=async()=>{await o(),n()};return q("div",{className:"flex flex-col items-center gap-3 w-full",children:[C("div",{className:"flex flex-col gap-1.5 w-full px-4",children:a.map(m=>C(_e,{onClick:m.onClick,children:m.content},m.key))}),C("div",{className:"w-full mx-[-100px] h-[1px] bg-separatorLine"}),C("div",{className:"w-full px-4 pb-4",children:q(_e,{onClick:i,children:[C(pe,{}),C("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},_e=({children:e,onClick:n})=>C("button",{type:"button",onClick:()=>n?.(),className:d("w-full p-2.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium","bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover","transition-colors duration-200",n?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});import Ft,{useCallback as $t}from"react";import{useAccount as Zt,useAccounts as zt,useActiveConnector as Wt,useBalance as Qt,useChain as jt}from"@luno-kit/react";import{formatAddress as Ut}from"@luno-kit/react";import{Fragment as Kt,jsx as I,jsxs as te}from"react/jsx-runtime";var ge=({onBack:e})=>{let{accounts:n,selectAccount:t}=zt(),{address:r}=Zt(),o=$t(a=>{t(a),e()},[e]);return I("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:n.map(a=>I(qt,{account:a,isSelected:a.address===r,selectAccount:o},a.address))})};ge.title="Switch Accounts";var qt=Ft.memo(({isSelected:e,account:n,selectAccount:t})=>{let{chain:r}=jt(),o=n.address,{data:a}=Qt({address:o}),i=Wt();return te("button",{type:"button",onClick:()=>t(n),className:d("px-3.5 py-2.5 w-full rounded-accountSelectItem border-none","bg-accountSelectItemBackground","text-left flex items-center justify-between gap-2","transition-colors duration-200",e?"cursor-auto":"cursor-pointer hover:bg-accountSelectItemBackgroundHover"),"aria-label":n.name||o,disabled:e,children:[te("div",{className:"flex items-center gap-2",children:[I("div",{className:"shrink-0 w-[24px] h-[24px] rounded-full flex items-center justify-center",children:i?.icon&&I("img",{src:i?.icon,alt:"luno account"})}),te("div",{className:"flex flex-col items-start",children:[I("span",{className:"font-medium text-sm leading-sm text-accountSelectItemText",children:n.name||Ut(o)}),I("span",{className:"text-xs text-modalTextSecondary font-medium",children:a===void 0?I("div",{className:"animate-pulse rounded w-[60px] h-[18px] bg-skeleton"}):te(Kt,{children:[a?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}),e&&I("div",{className:"border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]",children:I("div",{className:"rounded-full bg-accentColor w-[10px] h-[10px]"})})]})});import Jt,{useMemo as Xt,useState as Fe}from"react";import{useApi as Yt,useChain as eo,useChains as to,useSwitchChain as oo}from"@luno-kit/react";import{Fragment as $e,jsx as S,jsxs as $}from"react/jsx-runtime";var no=[{key:"All",label:"All"},{key:"Mainnets",label:"Mainnets"},{key:"Testnets",label:"Testnets"}],oe=({onChainSwitched:e})=>{let{chain:n}=eo(),t=to(),{switchChainAsync:r}=oo(),{isApiReady:o,apiError:a}=Yt(),[i,m]=Fe("All"),[p,u]=Fe(null),f=Xt(()=>{switch(i){case"Mainnets":return t.filter(s=>!s.testnet);case"Testnets":return t.filter(s=>s.testnet);case"All":default:return t}},[t,i]),l=async s=>{if(s.genesisHash!==n?.genesisHash&&!(!o&&!a)){u(s.genesisHash);try{await r({chainId:s.genesisHash}),e?.(s)}catch(c){console.error("Failed to switch chain:",c)}finally{u(null)}}};return $($e,{children:[S("div",{className:"flex items-center gap-1.5 w-full",children:no.map(s=>S("button",{onClick:()=>m(s.key),className:d("px-3.5 flex items-center justify-center cursor-pointer min-w-[48px] min-h-[24px] rounded-networkSelectItem text-[12px] leading-[16px] font-medium transition-colors",i===s.key?"bg-navigationButtonBackground text-modalText":"bg-transparent text-modalTextSecondary hover:text-modalText"),children:s.label},s.key))}),S("div",{className:"flex flex-col gap-1.5 overflow-y-auto custom-scrollbar max-h-[450px]",children:f.map(s=>S(ro,{chain:s,isSelected:s.genesisHash===n?.genesisHash,onSelect:l,isLoading:(p===s.genesisHash||!o)&&!a},s.genesisHash))}),f.length===0&&S("div",{className:"flex items-center justify-center py-12",children:$("span",{className:"text-modalTextSecondary text-xs",children:["No ",i==="All"?"chains":i.toLowerCase()," available"]})})]})},ro=Jt.memo(({chain:e,isSelected:n,isLoading:t,onSelect:r})=>$("button",{onClick:()=>r(e),disabled:n||t,className:d("flex items-center justify-between p-2.5 rounded-networkSelectItem","bg-networkSelectItemBackground","transition-colors duration-200",n||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[$("div",{className:"flex items-center gap-2",children:[S(F,{className:"w-[20px] h-[20px] flex items-center justify-center leading-[20px]",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),S("div",{className:"flex flex-col items-start",children:S("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),S("div",{className:"flex items-center justify-center h-[20px]",children:n?t?$($e,{children:[S("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:"Switching"}),S("div",{className:"loading text-accentColor w-[15px] h-[15px]"})]}):$("span",{className:"status-dot-container",children:[S("span",{className:"ping-animation"}),S("span",{className:"status-dot"})]}):null})]}));import{jsx as Ze}from"react/jsx-runtime";var ne=({onBack:e})=>Ze("div",{className:"flex flex-col gap-3.5 p-4 pt-0",children:Ze(oe,{})});ne.title="Select Networks";import{useCallback as ao,useState as io}from"react";import{jsx as ze,jsxs as so}from"react/jsx-runtime";var re=({copyText:e,label:n,className:t=""})=>{let[r,o]=io(!1),a=ao(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),o(!0),setTimeout(()=>o(!1),2e3),!0):!1}catch(m){return console.error("Copy failed:",m),!1}},[]);return so("button",{type:"button",className:d("cursor-pointer bg-transparent border-none p-0 m-0 inline-flex items-center justify-center gap-1",t),onClick:()=>!r&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:r,children:[r?ze(he,{className:"text-accentColor",width:16,height:16}):ze(ue,{width:16,height:16}),n]})};import{formatAddress as fo}from"@luno-kit/react";import{useCallback as We,useState as Qe,useRef as je}from"react";function ae({initialView:e,animationDuration:n=200,animationEasing:t="ease-out"}){let[r,o]=Qe(e),[a,i]=Qe(!1),m=je(null),p=je(null),u=We(l=>{if(l===r||a)return;if(i(!0),!m.current){o(l),i(!1);return}let s=m.current,c=s.offsetHeight;o(l),requestAnimationFrame(()=>{if(!s||!p.current){i(!1);return}let h=p.current.offsetHeight;s.animate([{height:c+"px"},{height:h+"px"}],{duration:n,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[r,a,n,t]),f=We(()=>{o(e),i(!1)},[e]);return{currentView:r,isAnimating:a,containerRef:m,currentViewRef:p,handleViewChange:u,resetView:f}}import{Fragment as qe,jsx as g,jsxs as H}from"react/jsx-runtime";var Ke=()=>{let{isOpen:e,close:n}=Q(),{address:t}=co(),{chain:r}=po(),{data:o}=uo({address:t}),a=mo(),{currentView:i,containerRef:m,currentViewRef:p,handleViewChange:u,resetView:f}=ae({initialView:"main"}),l=lo(()=>{n(),f()},[n]),s=Ue(()=>i==="switchAccount"?"Switch Account":i==="switchChain"?ne.title:null,[i]),c=Ue(()=>({main:g(Ge,{onViewChange:u,onModalClose:l}),switchAccount:g(ge,{onBack:()=>u("main")}),switchChain:g(ne,{onBack:()=>u("main")})}),[u,l]);return g(G,{open:e,onOpenChange:l,children:H("div",{className:d("flex flex-col w-full md:w-[360px] max-h-[500px] text-modalText","bg-modalBackground shadow-modal",i==="main"?"gap-6":"gap-3.5"),children:[H("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[i==="main"?H("div",{className:"flex items-center gap-3",children:[a?.icon&&g("div",{className:"flex items-center justify-center w-[55px] h-[55px]",children:g("img",{src:a.icon,alt:"",className:`w-full h-full
3
+ object-contain`})}),H("div",{className:"flex flex-col items-start gap-1 w-full",children:[g(D,{className:"sr-only",children:"Account Details"}),H("div",{className:"flex items-center gap-1.5 w-full",children:[g("span",{className:"text-base text-modalText font-semibold",children:fo(t)}),g(re,{copyText:t})]}),g("div",{className:"text-sm text-modalTextSecondary font-medium min-h-[20px]",children:o===void 0?g("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-skeleton"}):H(qe,{children:[o?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}):H(qe,{children:[g("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>u("main"),"aria-label":"Back",children:g(U,{})}),g(D,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:s})]}),g(E,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:g(V,{})})]}),g("div",{ref:m,className:"relative overflow-hidden",children:g("div",{ref:p,children:c[i]})})]})})};import{jsx as Z,jsxs as Je}from"react/jsx-runtime";var Xe=()=>{let{isOpen:e,close:n}=j();return Z(G,{open:e,onOpenChange:t=>!t&&n(),children:Je("div",{className:"flex flex-col w-full md:w-[360px] max-h-[500px] p-4 gap-3.5 text-modalText",children:[Je("div",{className:"flex items-center justify-between w-full",children:[Z("div",{className:"w-[30px]"})," ",Z(D,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),Z(E,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:Z(V,{})})]}),Z(oe,{})]})})};import{useEffect as Io,useMemo as Bo,useState as it}from"react";import{useConnect as Eo,isMobileDevice as Do}from"@luno-kit/react";import{useStatus as ho,useAccount as xo,useChain as go,useBalance as wo,ConnectionStatus as ie,useChains as Co,useActiveConnector as vo,formatAddress as bo}from"@luno-kit/react";function Ye(){let e=ho(),{account:n,address:t}=xo(),{chain:r}=go(),o=Co(),{data:a}=wo({address:t}),i=vo(),{open:m,isOpen:p}=W(),{open:u,isOpen:f}=Q(),{open:l,isOpen:s}=j(),c=e===ie.Connecting,h=e===ie.Connected,x=e===ie.Disconnected||e===ie.Disconnecting,T=!!r&&o.some(b=>b.genesisHash.toLowerCase()===r.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:h,isDisconnected:x,isConnecting:c,account:n,address:t,displayAddress:bo(t),currentChain:r,configuredChains:o,isChainSupported:T,chainIconUrl:r?.chainIconUrl,chainName:r?.name,balance:a,openConnectModal:m,openAccountModal:u,openChainModal:l,isConnectModalOpen:p,isAccountModalOpen:f,isChainModalOpen:s}}import{useEffect as yo,useState as So}from"react";var se=()=>{let[e,n]=So({height:void 0,width:void 0});return yo(()=>{let t=Ae(()=>{n({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};import Ro from"react";import{Cuer as No}from"cuer";import{jsx as L,jsxs as et}from"react/jsx-runtime";var tt=({logoBackground:e,uri:n,size:t})=>{if(!n){let a=Math.floor(14.25),i=t/57,m=a*i,p=Math.ceil(57/2-a/2),u=p+a,f=()=>{let c=[];for(let h=0;h<57;h++)for(let x=0;x<57;x++){if(h>=p&&h<u&&x>=p&&x<u||h<8&&x<8||h<8&&x>=49||h>=49&&x<8)continue;let b=x+.5,P=h+.5;c.push(L("rect",{x:b-.4,y:P-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${x}`))}return c},l=({position:c})=>{let h=7*i,x={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return et("div",{className:"absolute z-[4]",style:{width:`${h}px`,height:`${h}px`,...x[c]},children:[L("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),L("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",style:{width:`${3*i}px`,height:`${3*i}px`,borderRadius:`${.5*i}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},s=()=>{let c=p*i;return L("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${m}px`,height:`${m}px`,left:`${c}px`,top:`${c}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:L("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return et("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[L("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:f()}),L("div",{className:"absolute inset-0 z-[100]",style:{background:"linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",backgroundSize:"200% 100%",transform:"scale(1.5) rotate(45deg)",animation:"shimmer 1000ms linear infinite both"}}),l({position:"top-left"}),l({position:"top-right"}),l({position:"bottom-left"}),e&&s()]})}return L(No,{arena:e,value:n})};import{jsx as O,jsxs as K}from"react/jsx-runtime";var J="transition-transform transition-[125] hover:scale-[1.03] transition-ease",Mo=({className:e,label:n="Connect Wallet",accountStatus:t="full",chainStatus:r="full",showBalance:o=!0})=>{let{isConnected:a,isDisconnected:i,displayAddress:m,balance:p,openConnectModal:u,openAccountModal:f,openChainModal:l,chainIconUrl:s,chainName:c,currentChain:h,activeConnector:x}=Ye(),{width:T}=se(),b=T&&T>768;return i||!a||!x?O("button",{type:"button",onClick:()=>u?.(),className:d("cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none","text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]","rounded-connectButton",J,"px-3.5 text-base leading-base min-h-[40px]",e),children:n}):K("div",{className:d("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[r!=="none"&&K("button",{type:"button",onClick:()=>l?.(),className:d("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",J),"aria-label":"Switch chain",children:[r==="full"||r==="icon"?O(F,{chainIconUrl:s,chainName:c,className:"w-[24px] h-[24px]"}):null,(r==="full"||r==="name")&&b&&O("span",{children:h?.name||"Unknown Chain"})]}),K("button",{type:"button",onClick:()=>f?.(),className:d("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",J),"aria-label":"Open account modal",children:[o&&b&&O("div",{className:"p-2 pl-3",children:p===void 0?O("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"}):K("span",{className:"",children:[p?.formattedTransferable||p?.formattedTotal||0," ",h?.nativeCurrency?.symbol||""]})}),K("div",{className:d("flex items-center bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",o&&b?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&O("span",{className:"w-[24px] h-[24px]",children:O("img",{src:x.icon,alt:"luno"})}),O("span",{"aria-label":"Wallet icon placeholder",className:"",children:m})]})]})]})};import{useEffect as ko,useRef as Ao}from"react";import{jsx as To}from"react/jsx-runtime";var ot=({size:e=160,dotCount:n=300,duration:t=3,className:r=""})=>{let o=Ao(null);return ko(()=>{if(!o.current)return;let a=1,i=2,m=Math.PI*(3-Math.sqrt(5)),p=e/2,u=p-i-a,f="http://www.w3.org/2000/svg";o.current.innerHTML="";let l=document.createElementNS(f,"svg");l.setAttribute("width",e.toString()),l.setAttribute("height",e.toString()),l.setAttribute("viewBox",`0 0 ${e} ${e}`),l.style.display="block",o.current.appendChild(l);for(let s=0;s<n;s++){let c=s+.5,h=c/n,x=Math.sqrt(h)*u,T=c*m,b=p+x*Math.cos(T),P=p+x*Math.sin(T),R=document.createElementNS(f,"circle");R.setAttribute("cx",b.toString()),R.setAttribute("cy",P.toString()),R.setAttribute("r",a.toString()),R.setAttribute("fill","currentColor"),R.setAttribute("opacity","0.6"),l.appendChild(R);let y=document.createElementNS(f,"animate");y.setAttribute("attributeName","r"),y.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),y.setAttribute("dur",`${t}s`),y.setAttribute("begin",`${h*t}s`),y.setAttribute("repeatCount","indefinite"),y.setAttribute("calcMode","spline"),y.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),R.appendChild(y);let N=document.createElementNS(f,"animate");N.setAttribute("attributeName","opacity"),N.setAttribute("values","0.2;1;0.2"),N.setAttribute("dur",`${t}s`),N.setAttribute("begin",`${h*t}s`),N.setAttribute("repeatCount","indefinite"),N.setAttribute("calcMode","spline"),N.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),R.appendChild(N)}},[e,n,t]),To("div",{ref:o,className:d("text-accentColor inline-flex w-full h-full justify-center align-center",r)})};import{Fragment as nt,jsx as w,jsxs as B}from"react/jsx-runtime";var we=Ro.memo(({selectedConnector:e,onConnect:n,qrCode:t,isWide:r,connectState:o})=>{let a=e?.hasConnectionUri();return B("div",{className:d("flex flex-col items-center",r?"w-[450px] p-4 min-h-[472px]":"justify-center w-full min-h-[400px]"),children:[r&&w("div",{className:"w-full",children:B("div",{className:"flex items-center justify-between",children:[w("div",{}),w(E,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:w(V,{})})]})}),w("div",{className:d("flex items-center gap-4 flex-col grow justify-center",e&&a?"max-w-[300px]":"max-w-[360px]"),children:e?a?B("div",{className:"flex flex-col items-center gap-2.5",children:[w(tt,{size:300,logoBackground:e.icon,uri:t}),B("div",{className:"text-base leading-base font-medium text-center text-modalTextSecondary",children:["Scan the QR code with ",e.id==="nova"?"the Nova":"your phone"]}),w("div",{className:"min-h-[20px] flex items-center justify-center ",children:e.links?.browserExtension?B("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don't have ",e.name,"?"]}):t?w(re,{className:"text-sm leading-sm font-medium text-accentColor hover:text-modalText",copyText:t,label:"Copy Link"}):null})]}):B(nt,{children:[w("div",{className:"w-[80px] h-[80px]",children:w("img",{src:e.icon,className:"w-full h-full",alt:""})}),B("p",{className:"text-lg leading-lg text-modalFont font-bold",children:["Opening ",e.name,"..."]}),w("p",{className:"pb-[10px] text-base text-modalTextSecondary leading-base font-medium text-center",children:"Confirm connection in the extension"}),o.isConnecting&&w("div",{className:"loading text-modalText"}),!e.isInstalled()&&e.links.browserExtension&&B("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer pt-6 text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don\u2018t have ",e.name,"?"]}),!o.isConnecting&&o.isError&&e.isInstalled()&&w("button",{className:d("rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-semibold text-sm text-modalText bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",J),onClick:()=>n(e),children:"Retry"})]}):B(nt,{children:[w("div",{className:"w-[160px] h-[160px] mb-4",children:w(ot,{})}),w("p",{className:"cursor-pointer text-base leading-base text-accentColor font-semibold text-center",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}),w("p",{className:"text-modalTextSecondary w-[250px] text-sm leading-sm font-medium text-center",children:"Connect your wallet to start exploring and interacting with DApps."})]})}),w("div",{})]})});import rt from"react";import{useConnectors as Po,isMobileDevice as Vo}from"@luno-kit/react";import{jsx as A,jsxs as le}from"react/jsx-runtime";var at=rt.memo(({onConnect:e})=>{let n=Po();if(Vo()){let o=n.filter(a=>a.links.deepLink);return A("div",{className:"flex flex-col items-start gap-1 w-full",children:o.map(a=>A(Ce,{connector:a,onConnect:()=>e(a)},`${a.id}-${a.name}`))})}let t=n.filter(o=>o.isInstalled()),r=n.filter(o=>!o.isInstalled());return le("div",{className:"flex flex-col items-start gap-4 w-full",children:[le("div",{className:"flex flex-col items-start gap-2 w-full",children:[A("div",{className:"text-sm text-accentColor font-semibold leading-base",children:"Installed"}),A("div",{className:"flex flex-col items-start gap-1.5 w-full",children:t.map(o=>A(Ce,{connector:o,onConnect:()=>e(o)},o.id))})]}),r.length>0&&le("div",{className:"flex flex-col items-start gap-2 w-full",children:[A("div",{className:"text-sm text-modalTextSecondary font-semibold leading-base",children:"More"}),A("div",{className:"flex flex-col items-start gap-1 w-full",children:r.map(o=>A(Ce,{connector:o,onConnect:()=>e(o)},o.id))})]})]})}),Ce=rt.memo(({connector:e,onConnect:n})=>le("button",{onClick:n,className:d("cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none","hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]","text-left"),children:[A("div",{className:"w-[28px] h-[28px]",children:A("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),A("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));import{Fragment as ve,jsx as v,jsxs as X}from"react/jsx-runtime";var st=({size:e="wide"})=>{let{isOpen:n,close:t}=W(),{connectAsync:r,reset:o,isPending:a,isError:i}=Eo(),[m,p]=it(null),[u,f]=it(),{width:l}=se(),s=l&&l>768,c=!!(e==="wide"&&s),{containerRef:h,currentViewRef:x,resetView:T,handleViewChange:b,currentView:P}=ae({initialView:"Connect Wallet"}),R=async k=>{let ke=await k.getConnectionUri();f(ke)},y=async k=>{if(Do()&&k.links.deepLink)try{await r({connectorId:k.id}),N(!1);return}catch{window.location.href=`${k.links.deepLink}?url=${window.location.href}`;return}!c&&b("walletView"),p(k),f(void 0),k.hasConnectionUri()&&R(k),await r({connectorId:k.id}),N(!1)},N=k=>{!k&&t(),o(),T(),p(null),f(void 0)},ft=Bo(()=>({"Connect Wallet":v(at,{onConnect:y}),walletView:v(we,{connectState:{isConnecting:a,isError:i},isWide:c,selectedConnector:m,qrCode:u,onConnect:y})}),[c,m,u,y,a,i]);return Io(()=>{c&&P==="walletView"&&b("Connect Wallet")},[c,P]),v(G,{open:n,onOpenChange:N,children:X("div",{className:d("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[X("div",{className:d("flex flex-col items-start py-4 px-5 w-full md:w-auto",c?"md:min-w-[300px] border-r-[1px] border-r-solid border-r-separatorLine":"md:min-w-[360px]"),children:[X("div",{className:d("flex items-center justify-between w-full",!c&&"pb-4"),children:[P==="Connect Wallet"?X(ve,{children:[!c&&v("div",{className:"w-[30px] h-[30px]","aria-hidden":!0}),v(D,{className:d("text-lg leading-lg text-modalText font-bold",c?"pb-6":"flex-1 text-center"),children:"Connect Wallet"})]}):X(ve,{children:[v("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>b("Connect Wallet"),"aria-label":"Back",children:v(U,{})}),v(D,{className:d("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300"),children:m?.name})]}),!c&&v(E,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:v(V,{})})]}),v("div",{ref:h,className:"relative overflow-hidden w-full",children:v("div",{ref:x,children:ft[P]})}),!c&&P==="Connect Wallet"&&v(ve,{children:v("p",{className:"cursor-pointer w-full pt-4 text-sm leading-sm text-accentColor font-medium text-center hover:text-modalText",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})})]}),c&&v(we,{connectState:{isConnecting:a,isError:i},isWide:c,selectedConnector:m,qrCode:u,onConnect:y})]})})};import{useState as Zo}from"react";import{LunoProvider as zo}from"@luno-kit/react";import{QueryClient as Wo,QueryClientProvider as Qo}from"@tanstack/react-query";import{createContext as Oo,useState as Se,useContext as _o,useMemo as be,useCallback as Ho,useEffect as dt}from"react";import{useEffect as Lo}from"react";var lt=["--color-accentColor","--color-walletSelectItemBackground","--color-walletSelectItemBackgroundHover","--color-walletSelectItemText","--color-connectButtonBackground","--color-connectButtonInnerBackground","--color-connectButtonText","--color-accountActionItemBackground","--color-accountActionItemBackgroundHover","--color-accountActionItemText","--color-accountSelectItemBackground","--color-accountSelectItemBackgroundHover","--color-accountSelectItemText","--color-currentNetworkButtonBackground","--color-currentNetworkButtonText","--color-networkSelectItemBackground","--color-networkSelectItemBackgroundHover","--color-networkSelectItemText","--color-navigationButtonBackground","--color-separatorLine","--color-modalBackground","--color-modalBackdrop","--color-modalBorder","--color-modalText","--color-modalTextSecondary","--color-modalControlButtonBackgroundHover","--color-modalControlButtonText","--color-success","--color-successForeground","--color-warning","--color-warningForeground","--color-error","--color-errorForeground","--color-info","--color-infoForeground","--color-skeleton","--font-body","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],ct=(e,n)=>{Lo(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([r,o])=>{o&&t.style.setProperty(`--color-${r}`,o)}),Object.entries(e.completeTheme.fonts).forEach(([r,o])=>{o&&t.style.setProperty(`--font-${r}`,o)}),Object.entries(e.completeTheme.radii).forEach(([r,o])=>{o&&t.style.setProperty(`--radius-${r}`,o)}),Object.entries(e.completeTheme.shadows).forEach(([r,o])=>{o&&t.style.setProperty(`--shadow-${r}`,o)}),Object.entries(e.completeTheme.blurs).forEach(([r,o])=>{o&&t.style.setProperty(`--blur-${r}`,o)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",n),Object.keys(e.partialOverrides).length>0&&(lt.forEach(o=>{t.style.removeProperty(o)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([o,a])=>{a&&t.style.setProperty(`--color-${o}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([o,a])=>{a&&t.style.setProperty(`--font-${o}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([o,a])=>{a&&t.style.setProperty(`--radius-${o}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([o,a])=>{a&&t.style.setProperty(`--shadow-${o}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([o,a])=>{a&&t.style.setProperty(`--blur-${o}`,a)}))):(t.setAttribute("data-theme",n),lt.forEach(r=>{t.style.removeProperty(r)}))},[e,n])};import{jsx as $o}from"react/jsx-runtime";var Ne="luno.lastThemePreference",Go=e=>{try{localStorage.setItem(Ne,JSON.stringify(e))}catch{}},mt=Oo(void 0),ye=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Fo=()=>{let[e,n]=Se(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return dt(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=o=>{n(o.matches?"dark":"light")};return r(t),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),e},Me=({children:e,theme:n})=>{let t=Fo(),[r,o]=Se(()=>{if(typeof window<"u")try{let s=localStorage.getItem(Ne);if(s){let c=JSON.parse(s);if(c?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(c?.preferredTheme)return c.preferredTheme}}catch{}return!n||ye(n)?"light":n.defaultMode||"light"}),[a,i]=Se(()=>{if(typeof window<"u")try{let s=localStorage.getItem(Ne);if(s)return JSON.parse(s)?.isAuto??!1}catch{}return!n||ye(n)?!1:n.autoMode??!1}),m=be(()=>{if(!n)return{type:"default",completeTheme:null,partialOverrides:null};if(ye(n))return{type:"complete",completeTheme:n,partialOverrides:null};let l=n;if(l.theme)return{type:"complete",completeTheme:l.theme,partialOverrides:null};let s=null;return r==="light"&&l.light?s=l.light:r==="dark"&&l.dark?s=l.dark:s={...l},{type:"partial",completeTheme:null,partialOverrides:s}},[r,n]),p=be(()=>m.type==="complete"?m.completeTheme:null,[m]);ct(m,r);let u=Ho(l=>{let s=l==="auto";i(s),o(s?t||"light":l);let c={isAuto:s,...s?{}:{preferredTheme:l}};Go(c)},[t]);dt(()=>{a&&o(t||"light")},[t,a]);let f=be(()=>({themeMode:r,setThemeChoice:u,currentTheme:p}),[r,u,p]);return $o(mt.Provider,{value:f,children:e})},ut=()=>{let e=_o(mt);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};import{Fragment as Uo,jsx as _,jsxs as pt}from"react/jsx-runtime";var Ja=({children:e,config:n,queryClientConfig:t,theme:r})=>{let[o]=Zo(()=>new Wo(t));return _(Qo,{client:o,children:_(zo,{config:n,children:_(Me,{theme:r,children:pt(Re,{children:[_("div",{className:"font-base luno-kit",children:e}),_(jo,{modalSize:n.modalSize})]})})})})},jo=({modalSize:e})=>pt(Uo,{children:[_(st,{size:e}),_(Ke,{}),_(Xe,{})]});export{Mo as ConnectButton,Ja as LunoKitProvider,Q as useAccountModal,j as useChainModal,At as useCloseAllModals,W as useConnectModal,ut as useLunoTheme};
3
4
  //# sourceMappingURL=index.js.map