@luno-kit/ui 0.0.7 → 0.0.8
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
"use strict";var Vt=Object.create;var ce=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var Lt=(e,o)=>{for(var t in o)ce(e,t,{get:o[t],enumerable:!0})},Qe=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of Bt(o))!Dt.call(e,r)&&r!==t&&ce(e,r,{get:()=>o[r],enumerable:!(n=It(o,r))||n.enumerable});return e};var q=(e,o,t)=>(t=e!=null?Vt(Et(e)):{},Qe(o||!e||!e.__esModule?ce(t,"default",{value:e,enumerable:!0}):t,e)),Ot=e=>Qe(ce({},"__esModule",{value:!0}),e);var ao={};Lt(ao,{ConnectButton:()=>Ct,LunoKitProvider:()=>zt,useAccountModal:()=>X,useChainModal:()=>Y,useCloseAllModals:()=>Ke,useConnectModal:()=>J,useLunoTheme:()=>Me});module.exports=Ot(ao);var ae=require("react"),ge=require("@luno-kit/react");var le=q(require("react"),1),B=q(require("@radix-ui/react-dialog"),1);var We=require("clsx"),je=require("tailwind-merge"),_t=(0,je.extendTailwindMerge)({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function m(...e){return _t((0,We.clsx)(e))}function Ue(e,o){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},o)}}var te=require("react/jsx-runtime"),Ht=({open:e,onOpenChange:o,children:t,contentClassName:n,overlayClassName:r})=>(0,te.jsx)(B.Root,{open:e,onOpenChange:o,children:(0,te.jsxs)(B.Portal,{children:[le.default.createElement(B.Overlay,{className:m("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",r)}),(0,te.jsx)(B.Content,{className:m("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]",n),children:t})]})}),Gt=({children:e,className:o})=>le.default.createElement(B.Title,{className:o},e),$t=({children:e,className:o,onClick:t})=>le.default.createElement(B.Close,{className:o,onClick:t},e),K=Ht,Z=$t,F=Gt;var nt=require("react"),rt=require("@luno-kit/react"),de=require("@tanstack/react-query");var y=require("react"),W=require("@luno-kit/react"),Je=require("react/jsx-runtime");function be(){let[e,o]=(0,y.useState)(!1),t=(0,y.useCallback)(()=>o(!0),[]),n=(0,y.useCallback)(()=>o(!1),[]);return{isOpen:e,open:t,close:n}}var oe=(0,y.createContext)(void 0),qe=({children:e})=>{let{isOpen:o,open:t,close:n}=be(),{isOpen:r,open:a,close:i}=be(),{isOpen:c,open:d,close:p}=be(),h=(0,W.useStatus)(),l=(0,y.useCallback)(()=>{n(),i(),p()},[n,i,p]);(0,y.useEffect)(()=>{h===W.ConnectionStatus.Disconnected&&(i(),p())},[h,i,p]);let u=(0,y.useMemo)(()=>({isConnectModalOpen:o,isAccountModalOpen:r,isChainModalOpen:c,openConnectModal:h!==W.ConnectionStatus.Connected?t:void 0,closeConnectModal:n,openAccountModal:h===W.ConnectionStatus.Connected?a:void 0,closeAccountModal:i,openChainModal:h===W.ConnectionStatus.Connected?d:void 0,closeChainModal:p,closeAllModals:l}),[o,t,n,r,a,i,c,d,p,l,h]);return(0,Je.jsx)(oe.Provider,{value:u,children:e})},J=()=>{let e=(0,y.useContext)(oe);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},X=()=>{let e=(0,y.useContext)(oe);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},Y=()=>{let e=(0,y.useContext)(oe);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}},Ke=()=>{let e=(0,y.useContext)(oe);if(!e)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return e.closeAllModals};var S=require("react");var Ye=require("react"),Xe=["--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"],et=(e,o)=>{(0,Ye.useEffect)(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([n,r])=>{r&&t.style.setProperty(`--color-${n}`,r)}),Object.entries(e.completeTheme.fonts).forEach(([n,r])=>{r&&t.style.setProperty(`--font-${n}`,r)}),Object.entries(e.completeTheme.radii).forEach(([n,r])=>{r&&t.style.setProperty(`--radius-${n}`,r)}),Object.entries(e.completeTheme.shadows).forEach(([n,r])=>{r&&t.style.setProperty(`--shadow-${n}`,r)}),Object.entries(e.completeTheme.blurs).forEach(([n,r])=>{r&&t.style.setProperty(`--blur-${n}`,r)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",o),Object.keys(e.partialOverrides).length>0&&(Xe.forEach(r=>{t.style.removeProperty(r)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([r,a])=>{a&&t.style.setProperty(`--color-${r}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([r,a])=>{a&&t.style.setProperty(`--font-${r}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([r,a])=>{a&&t.style.setProperty(`--radius-${r}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([r,a])=>{a&&t.style.setProperty(`--shadow-${r}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([r,a])=>{a&&t.style.setProperty(`--blur-${r}`,a)}))):(t.setAttribute("data-theme",o),Xe.forEach(n=>{t.style.removeProperty(n)}))},[e,o])};var ot=require("react/jsx-runtime"),Se="luno.lastThemePreference",Zt=e=>{try{localStorage.setItem(Se,JSON.stringify(e))}catch{}},tt=(0,S.createContext)(void 0),ye=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Ft=()=>{let[e,o]=(0,S.useState)(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return(0,S.useEffect)(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),n=r=>{o(r.matches?"dark":"light")};return n(t),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e},Ne=({children:e,theme:o})=>{let t=Ft(),[n,r]=(0,S.useState)(()=>{if(typeof window<"u")try{let u=localStorage.getItem(Se);if(u){let s=JSON.parse(u);if(s?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(s?.preferredTheme)return s.preferredTheme}}catch{}return!o||ye(o)?"light":o.defaultMode||"light"}),[a,i]=(0,S.useState)(()=>{if(typeof window<"u")try{let u=localStorage.getItem(Se);if(u)return JSON.parse(u)?.isAuto??!1}catch{}return!o||ye(o)?!1:o.autoMode??!1}),c=(0,S.useMemo)(()=>{if(!o)return{type:"default",completeTheme:null,partialOverrides:null};if(ye(o))return{type:"complete",completeTheme:o,partialOverrides:null};let l=o;if(l.theme)return{type:"complete",completeTheme:l.theme,partialOverrides:null};let u=null;return n==="light"&&l.light?u=l.light:n==="dark"&&l.dark?u=l.dark:u={...l},{type:"partial",completeTheme:null,partialOverrides:u}},[n,o]),d=(0,S.useMemo)(()=>c.type==="complete"?c.completeTheme:null,[c]);et(c,n);let p=(0,S.useCallback)(l=>{let u=l==="auto";i(u),r(u?t||"light":l);let s={isAuto:u,...u?{}:{preferredTheme:l}};Zt(s)},[t]);(0,S.useEffect)(()=>{a&&r(t||"light")},[t,a]);let h=(0,S.useMemo)(()=>({themeMode:n,setThemeChoice:p,currentTheme:d}),[n,p,d]);return(0,ot.jsx)(tt.Provider,{value:h,children:e})},Me=()=>{let e=(0,S.useContext)(tt);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};var k=require("react/jsx-runtime"),zt=({children:e,config:o,queryClientConfig:t,theme:n})=>{let[r]=(0,nt.useState)(()=>new de.QueryClient(t));return(0,k.jsx)(de.QueryClientProvider,{client:r,children:(0,k.jsx)(rt.LunoProvider,{config:o,children:(0,k.jsx)(Ne,{theme:n,children:(0,k.jsxs)(qe,{children:[(0,k.jsx)("div",{className:"font-base luno-kit",children:e}),(0,k.jsx)(Qt,{modalSize:o.modalSize})]})})})})},Qt=({modalSize:e})=>(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(st,{size:e}),(0,k.jsx)(at,{}),(0,k.jsx)(it,{})]});var ke=require("react/jsx-runtime"),Wt=e=>(0,ke.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"arrow_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:(0,ke.jsx)("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"})}),Ae=Wt;var Te=require("react/jsx-runtime"),jt=e=>(0,Te.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Te.jsx)("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"})}),ne=jt;var Pe=require("react/jsx-runtime"),Ut=e=>(0,Pe.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Pe.jsx)("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"})}),G=Ut;var Re=require("react/jsx-runtime"),qt=e=>(0,Re.jsx)("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:(0,Re.jsx)("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"})}),Ve=qt;var Ie=require("react/jsx-runtime"),Kt=e=>(0,Ie.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:(0,Ie.jsx)("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"})}),Be=Kt;var Ee=require("react/jsx-runtime"),Jt=e=>(0,Ee.jsx)("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:(0,Ee.jsx)("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"})}),De=Jt;var Le=require("react/jsx-runtime"),Xt=e=>(0,Le.jsx)("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:(0,Le.jsx)("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"})}),Oe=Xt;var _e=require("react/jsx-runtime"),Yt=e=>(0,_e.jsx)("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:(0,_e.jsx)("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"})}),He=Yt;var lt=require("react");var Ge=require("react/jsx-runtime"),ee=({chainIconUrl:e,chainName:o,className:t})=>e?(0,Ge.jsx)("img",{src:e,alt:o||"Chain icon",className:m("w-full h-full object-cover rounded-full",t)}):(0,Ge.jsx)("div",{className:m("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:o?o.charAt(0).toUpperCase():"C"});var z=require("@luno-kit/react"),dt=require("@luno-kit/react/utils"),x=require("react/jsx-runtime"),mt=({onViewChange:e,onModalClose:o})=>{let{address:t}=(0,z.useAccount)(),{chain:n}=(0,z.useChain)(),{disconnectAsync:r}=(0,z.useDisconnect)(),{data:a}=(0,z.useBalance)({address:t}),i=(0,lt.useMemo)(()=>[{key:"Chain Name",content:(0,x.jsxs)("div",{className:"flex items-stretch w-full justify-between",children:[(0,x.jsxs)("div",{className:"flex items-center gap-2",children:[(0,x.jsx)("div",{className:"relative",children:(0,x.jsx)(ee,{className:"w-[24px] h-[24px]",chainIconUrl:n?.chainIconUrl,chainName:n?.name})}),(0,x.jsxs)("div",{className:"flex flex-col items-start",children:[(0,x.jsx)("span",{className:"text-base leading-base text-modalText",children:n?.name||"Polkadot"}),a?(0,x.jsxs)("span",{className:"text-modalTextSecondary text-xs leading-xs",children:[a.formattedTransferable||"0.00"," ",n?.nativeCurrency?.symbol||"DOT"]}):(0,x.jsx)("span",{className:"animate-pulse rounded w-[80px] h-[16px] bg-skeleton"})]})]}),(0,x.jsx)("div",{className:"flex items-center justify-center",children:(0,x.jsx)(Ae,{className:"w-[16px] h-[16px] text-modalTextSecondary"})})]}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(De,{className:"w-[24px] h-[24px]"}),(0,x.jsx)("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open((0,dt.getExplorerUrl)(n?.blockExplorers?.default?.url,t,"address"))},{key:"Switch Account",content:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(He,{className:"w-[24px] h-[24px]"}),(0,x.jsx)("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}],[e,n,t,a]),c=async()=>{await r(),o()};return(0,x.jsxs)("div",{className:"flex flex-col items-center gap-3 w-full",children:[(0,x.jsx)("div",{className:"flex flex-col gap-1.5 w-full px-4",children:i.map(d=>(0,x.jsx)(ct,{onClick:d.onClick,children:d.content},d.key))}),(0,x.jsx)("div",{className:"w-full mx-[-100px] h-[1px] bg-separatorLine"}),(0,x.jsx)("div",{className:"w-full px-4 pb-4",children:(0,x.jsxs)(ct,{onClick:c,children:[(0,x.jsx)(Be,{}),(0,x.jsx)("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},ct=({children:e,onClick:o})=>(0,x.jsx)("button",{type:"button",onClick:()=>o?.(),className:m("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",o?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});var me=q(require("react"),1),_=require("@luno-kit/react");var ut=require("@luno-kit/react/utils"),A=require("react/jsx-runtime"),$e=({onBack:e})=>{let{accounts:o,selectAccount:t}=(0,_.useAccounts)(),{address:n}=(0,_.useAccount)(),r=(0,me.useCallback)(a=>{t(a),e()},[e]);return(0,A.jsx)("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:o.map(a=>(0,A.jsx)(eo,{account:a,isSelected:a.address===n,selectAccount:r},a.address))})};$e.title="Switch Accounts";var eo=me.default.memo(({isSelected:e,account:o,selectAccount:t})=>{let{chain:n}=(0,_.useChain)(),r=o.address,{data:a}=(0,_.useBalance)({address:r}),i=(0,_.useActiveConnector)();return(0,A.jsxs)("button",{type:"button",onClick:()=>t(o),className:m("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":o.name||r,disabled:e,children:[(0,A.jsxs)("div",{className:"flex items-center gap-2 grow overflow-hidden",children:[(0,A.jsx)("div",{className:"shrink-0 w-[24px] h-[24px] rounded-full flex items-center justify-center",children:i?.icon&&(0,A.jsx)("img",{src:i?.icon,alt:"luno account"})}),(0,A.jsxs)("div",{className:"flex flex-col items-start overflow-hidden",children:[(0,A.jsx)("span",{className:"whitespace-nowrap max-w-full text-ellipsis overflow-hidden font-medium text-sm leading-sm text-accountSelectItemText",children:o.name||(0,ut.formatAddress)(r)}),a?(0,A.jsxs)("span",{className:"text-xs text-modalTextSecondary font-medium",children:[a?.formattedTransferable||"0.00"," ",n?.nativeCurrency?.symbol||"DOT"]}):(0,A.jsx)("span",{className:"animate-pulse rounded w-[60px] h-[16px] bg-skeleton"})]})]}),e&&(0,A.jsx)("div",{className:"shrink-0 border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[16px] h-[16px]",children:(0,A.jsx)("div",{className:"rounded-full bg-accentColor w-[8px] h-[8px]"})})]})});var j=q(require("react"),1);var Q=require("@luno-kit/react");var Ze=require("react/jsx-runtime"),to=e=>(0,Ze.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"search_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:(0,Ze.jsx)("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"})}),pt=to;var C=require("react/jsx-runtime"),ue=({onChainSwitched:e,className:o=""})=>{let{chain:t}=(0,Q.useChain)(),n=(0,Q.useChains)(),{switchChainAsync:r}=(0,Q.useSwitchChain)(),{isApiReady:a,apiError:i}=(0,Q.useApi)(),[c,d]=(0,j.useState)(null),[p,h]=(0,j.useState)(""),l=(0,j.useMemo)(()=>n.filter(s=>p.trim()?s.name.toLowerCase().includes(p.toLowerCase()):!0),[n,p]),u=async s=>{if(s.genesisHash!==t?.genesisHash&&!(!a&&!i)){d(s.genesisHash);try{await r({chainId:s.genesisHash}),e?.(s)}catch(w){console.error("Failed to switch chain:",w)}finally{d(null)}}};return(0,C.jsxs)("div",{className:m("flex flex-col gap-3.5",o),children:[(0,C.jsx)("div",{className:"relative pt-1",children:(0,C.jsxs)("div",{className:"relative",children:[(0,C.jsx)(pt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-modalTextSecondary"}),(0,C.jsx)("input",{type:"text",placeholder:"Search by name",value:p,onChange:s=>h(s.target.value),className:"w-full pl-10 pr-3 py-2 text-sm border border-networkSelectItemBackgroundHover rounded-md focus:ring-2 focus:ring-accentColor focus:outline-none focus:border-transparent"})]})}),l.length>0&&(0,C.jsx)("div",{className:"flex flex-col gap-1.5 overflow-y-auto max-h-[380px]",children:l.map(s=>(0,C.jsx)(oo,{chain:s,isSelected:s.genesisHash===t?.genesisHash,onSelect:u,isLoading:(c===s.genesisHash||!a)&&!i,isSwitching:c===s.genesisHash},s.genesisHash))}),l.length===0&&(0,C.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,C.jsx)("span",{className:"text-modalTextSecondary text-xs",children:"No chains available"})})]})},oo=j.default.memo(({chain:e,isSelected:o,isLoading:t,onSelect:n,isSwitching:r})=>(0,C.jsxs)("button",{onClick:()=>n(e),disabled:o||t,className:m("flex items-center justify-between p-2.5 rounded-networkSelectItem","bg-networkSelectItemBackground","transition-colors duration-200",o||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)(ee,{className:"w-[20px] h-[20px] flex items-center justify-center leading-[20px]",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),(0,C.jsx)("div",{className:"flex flex-col items-start",children:(0,C.jsx)("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),(0,C.jsx)("div",{className:"flex items-center justify-center h-[20px]",children:o?t?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:r?"Switching":"Connecting"}),(0,C.jsx)("div",{className:"loading text-accentColor w-[15px] h-[15px]"})]}):(0,C.jsxs)("span",{className:"status-dot-container",children:[(0,C.jsx)("span",{className:"ping-animation"}),(0,C.jsx)("span",{className:"status-dot"})]}):null})]}));var ft=require("react/jsx-runtime"),pe=({onBack:e})=>(0,ft.jsx)(ue,{className:"p-4 pt-0"});pe.title="Select Networks";var fe=require("react");var re=require("react/jsx-runtime"),he=({copyText:e,label:o,className:t=""})=>{let[n,r]=(0,fe.useState)(!1),a=(0,fe.useCallback)(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),r(!0),setTimeout(()=>r(!1),2e3),!0):!1}catch(c){return console.error("Copy failed:",c),!1}},[]);return(0,re.jsxs)("button",{type:"button",className:m("cursor-pointer bg-transparent border-none p-1 m-0 inline-flex items-center justify-center gap-1","rounded-modalControlButton hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",t),onClick:()=>!n&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:n,children:[n?(0,re.jsx)(Oe,{className:"text-accentColor",width:16,height:16}):(0,re.jsx)(Ve,{width:16,height:16}),o]})};var ht=require("@luno-kit/react/utils");var $=require("react");function xe({initialView:e,animationDuration:o=200,animationEasing:t="ease-out"}){let[n,r]=(0,$.useState)(e),[a,i]=(0,$.useState)(!1),c=(0,$.useRef)(null),d=(0,$.useRef)(null),p=(0,$.useCallback)(l=>{if(l===n||a)return;if(i(!0),!c.current){r(l),i(!1);return}let u=c.current,s=u.offsetHeight;r(l),requestAnimationFrame(()=>{if(!u||!d.current){i(!1);return}let w=d.current.offsetHeight;u.animate([{height:s+"px"},{height:w+"px"}],{duration:o,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[n,a,o,t]),h=(0,$.useCallback)(()=>{r(e),i(!1)},[e]);return{currentView:n,isAnimating:a,containerRef:c,currentViewRef:d,handleViewChange:p,resetView:h}}var g=require("react/jsx-runtime");var at=()=>{let{isOpen:e,close:o}=X(),{address:t,account:n}=(0,ge.useAccount)(),r=(0,ge.useActiveConnector)(),{currentView:a,containerRef:i,currentViewRef:c,handleViewChange:d,resetView:p}=xe({initialView:"main"}),h=(0,ae.useCallback)(()=>{o(),p()},[o]),l=(0,ae.useMemo)(()=>a==="switchAccount"?"Switch Account":a==="switchChain"?pe.title:null,[a]),u=(0,ae.useMemo)(()=>({main:(0,g.jsx)(mt,{onViewChange:d,onModalClose:h}),switchAccount:(0,g.jsx)($e,{onBack:()=>d("main")}),switchChain:(0,g.jsx)(pe,{onBack:()=>d("main")})}),[d,h]);return(0,g.jsx)(K,{open:e,onOpenChange:h,children:(0,g.jsxs)("div",{className:m("flex flex-col w-full md:w-[360px] max-h-[512px] text-modalText","bg-modalBackground shadow-modal",a==="main"?"gap-5":"gap-3.5"),children:[(0,g.jsxs)("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[a==="main"?(0,g.jsxs)("div",{className:"flex items-center gap-3 max-w-[80%]",children:[r?.icon&&(0,g.jsx)("div",{className:"flex items-center justify-center w-[40px] h-[40px] shrink-0",children:(0,g.jsx)("img",{src:r.icon,alt:"",className:"w-full h-full object-contain"})}),(0,g.jsxs)("div",{className:"flex flex-col items-start gap-1.5 max-w-full",children:[(0,g.jsx)(F,{className:"sr-only",children:"Account Details"}),(0,g.jsxs)("div",{className:"flex items-center gap-0.5 w-full ",children:[(0,g.jsx)("span",{className:"text-base text-modalText font-semibold",children:(0,ht.formatAddress)(t)}),(0,g.jsx)(he,{copyText:t})]}),(0,g.jsx)("div",{className:m("text-sm leading-sm text-modalTextSecondary font-medium text-ellipsis overflow-hidden whitespace-nowrap",n?.name&&n?.name.length>30?"w-[90%]":""),children:n?.name||r?.name})]})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("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:()=>d("main"),"aria-label":"Back",children:(0,g.jsx)(ne,{})}),(0,g.jsx)(F,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:l})]}),(0,g.jsx)(Z,{className:"shrink-0 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:(0,g.jsx)(G,{})})]}),(0,g.jsx)("div",{ref:i,className:"relative",children:(0,g.jsx)("div",{ref:c,children:u[a]})})]})})};var H=require("react/jsx-runtime"),it=()=>{let{isOpen:e,close:o}=Y();return(0,H.jsx)(K,{open:e,onOpenChange:t=>!t&&o(),children:(0,H.jsxs)("div",{className:"flex flex-col w-full md:w-[360px] max-h-[512px] p-4 gap-3.5 text-modalText",children:[(0,H.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,H.jsx)("div",{className:"w-[30px]"})," ",(0,H.jsx)(F,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),(0,H.jsx)(Z,{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:(0,H.jsx)(G,{})})]}),(0,H.jsx)(ue,{})]})})};var U=require("react"),Tt=require("@luno-kit/react");var Pt=require("@luno-kit/react/utils");var N=require("@luno-kit/react");function xt(){let e=(0,N.useStatus)(),{account:o,address:t}=(0,N.useAccount)(),{chain:n}=(0,N.useChain)(),r=(0,N.useChains)(),{data:a}=(0,N.useBalance)({address:t}),i=(0,N.useActiveConnector)(),{open:c,isOpen:d}=J(),{open:p,isOpen:h}=X(),{open:l,isOpen:u}=Y(),s=e===N.ConnectionStatus.Connecting,w=e===N.ConnectionStatus.Connected,b=e===N.ConnectionStatus.Disconnected||e===N.ConnectionStatus.Disconnecting,L=!!n&&r.some(V=>V.genesisHash.toLowerCase()===n.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:w,isDisconnected:b,isConnecting:s,account:o,address:t,currentChain:n,configuredChains:r,isChainSupported:L,chainIconUrl:n?.chainIconUrl,chainName:n?.name,balance:a,openConnectModal:c,openAccountModal:p,openChainModal:l,isConnectModalOpen:d,isAccountModalOpen:h,isChainModalOpen:u}}var we=require("react");var ve=()=>{let[e,o]=(0,we.useState)({height:void 0,width:void 0});return(0,we.useEffect)(()=>{let t=Ue(()=>{o({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};var St=q(require("react"),1);var gt=require("cuer"),E=require("react/jsx-runtime"),wt=({logoBackground:e,uri:o,size:t})=>{if(!o){let a=Math.floor(14.25),i=t/57,c=a*i,d=Math.ceil(57/2-a/2),p=d+a,h=()=>{let s=[];for(let w=0;w<57;w++)for(let b=0;b<57;b++){if(w>=d&&w<p&&b>=d&&b<p||w<8&&b<8||w<8&&b>=49||w>=49&&b<8)continue;let V=b+.5,T=w+.5;s.push((0,E.jsx)("rect",{x:V-.4,y:T-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${w}-${b}`))}return s},l=({position:s})=>{let w=7*i,b={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return(0,E.jsxs)("div",{className:"absolute z-[4]",style:{width:`${w}px`,height:`${w}px`,...b[s]},children:[(0,E.jsx)("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),(0,E.jsx)("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)"}})]})},u=()=>{let s=d*i;return(0,E.jsx)("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${c}px`,height:`${c}px`,left:`${s}px`,top:`${s}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:(0,E.jsx)("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return(0,E.jsxs)("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[(0,E.jsx)("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:h()}),(0,E.jsx)("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&&u()]})}return(0,E.jsx)(gt.Cuer,{arena:e,value:o})};var vt=require("@luno-kit/react/utils"),M=require("react/jsx-runtime"),ie="transition-transform transition-[125] hover:scale-[1.03] transition-ease",Ct=({className:e,label:o="Connect Wallet",accountStatus:t="full",chainStatus:n="full",showBalance:r=!0,displayPreference:a="address"})=>{let{isConnected:i,isDisconnected:c,account:d,balance:p,openConnectModal:h,openAccountModal:l,openChainModal:u,chainIconUrl:s,chainName:w,currentChain:b,activeConnector:L}=xt(),{width:V}=ve(),T=V&&V>768;return c||!i||!L?(0,M.jsx)("button",{type:"button",onClick:()=>h?.(),className:m("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",ie,"px-3.5 text-base leading-base min-h-[40px]",e),children:o}):(0,M.jsxs)("div",{className:m("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[n!=="none"&&(0,M.jsxs)("button",{type:"button",onClick:()=>u?.(),className:m("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",ie),"aria-label":"Switch chain",children:[n==="full"||n==="icon"?(0,M.jsx)(ee,{chainIconUrl:s,chainName:w,className:"w-[24px] h-[24px]"}):null,(n==="full"||n==="name")&&T&&(0,M.jsx)("span",{children:b?.name||"Unknown Chain"})]}),(0,M.jsxs)("button",{type:"button",onClick:()=>l?.(),className:m("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",ie),"aria-label":"Open account modal",children:[r&&T&&(0,M.jsx)("div",{className:"p-2 pl-3",children:p?(0,M.jsxs)("span",{children:[p?.formattedTransferable||p?.formattedTotal||0," ",b?.nativeCurrency?.symbol||""]}):(0,M.jsx)("span",{className:"block animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"})}),(0,M.jsxs)("div",{className:m("flex items-center overflow-hidden bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",r&&T?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&(0,M.jsx)("span",{className:"w-[24px] h-[24px] flex items-center justify-center",children:(0,M.jsx)("img",{src:L.icon,alt:"luno"})}),(0,M.jsx)("span",{"aria-label":"Wallet icon placeholder",className:m(a==="name"&&d?.name?"text-ellipsis overflow-hidden max-w-[100px] whitespace-nowrap":""),children:a==="name"&&d?.name?d?.name:(0,vt.formatAddress)(d?.address)})]})]})]})};var Ce=require("react");var yt=require("react/jsx-runtime"),bt=({size:e=160,dotCount:o=300,duration:t=3,className:n=""})=>{let r=(0,Ce.useRef)(null);return(0,Ce.useEffect)(()=>{if(!r.current)return;let a=1,i=2,c=Math.PI*(3-Math.sqrt(5)),d=e/2,p=d-i-a,h="http://www.w3.org/2000/svg";r.current.innerHTML="";let l=document.createElementNS(h,"svg");l.setAttribute("width",e.toString()),l.setAttribute("height",e.toString()),l.setAttribute("viewBox",`0 0 ${e} ${e}`),l.style.display="block",r.current.appendChild(l);for(let u=0;u<o;u++){let s=u+.5,w=s/o,b=Math.sqrt(w)*p,L=s*c,V=d+b*Math.cos(L),T=d+b*Math.sin(L),O=document.createElementNS(h,"circle");O.setAttribute("cx",V.toString()),O.setAttribute("cy",T.toString()),O.setAttribute("r",a.toString()),O.setAttribute("fill","currentColor"),O.setAttribute("opacity","0.6"),l.appendChild(O);let P=document.createElementNS(h,"animate");P.setAttribute("attributeName","r"),P.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),P.setAttribute("dur",`${t}s`),P.setAttribute("begin",`${w*t}s`),P.setAttribute("repeatCount","indefinite"),P.setAttribute("calcMode","spline"),P.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),O.appendChild(P);let I=document.createElementNS(h,"animate");I.setAttribute("attributeName","opacity"),I.setAttribute("values","0.2;1;0.2"),I.setAttribute("dur",`${t}s`),I.setAttribute("begin",`${w*t}s`),I.setAttribute("repeatCount","indefinite"),I.setAttribute("calcMode","spline"),I.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),O.appendChild(I)}},[e,o,t]),(0,yt.jsx)("div",{ref:r,className:m("text-accentColor inline-flex w-full h-full justify-center align-center",n)})};var f=require("react/jsx-runtime"),Fe=St.default.memo(({selectedConnector:e,onConnect:o,qrCode:t,isWide:n,connectState:r})=>{let a=e?.hasConnectionUri();return(0,f.jsxs)("div",{className:m("flex flex-col items-center",n?"w-[450px] p-4 min-h-[472px]":"justify-center w-full min-h-[400px]"),children:[n&&(0,f.jsx)("div",{className:"w-full",children:(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsx)("div",{}),(0,f.jsx)(Z,{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:(0,f.jsx)(G,{})})]})}),(0,f.jsx)("div",{className:m("flex items-center gap-4 flex-col grow justify-center",e&&a?"max-w-[300px]":"max-w-[360px]"),children:e?a?(0,f.jsxs)("div",{className:"flex flex-col items-center gap-2.5",children:[(0,f.jsx)(wt,{size:300,logoBackground:e.icon,uri:t}),(0,f.jsxs)("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"]}),(0,f.jsx)("div",{className:"min-h-[20px] flex items-center justify-center ",children:e.links?.browserExtension?(0,f.jsxs)("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?(0,f.jsx)(he,{className:"text-sm leading-sm font-medium text-accentColor",copyText:t,label:"Copy Link"}):null})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:"w-[80px] h-[80px]",children:(0,f.jsx)("img",{src:e.icon,className:"w-full h-full",alt:""})}),(0,f.jsxs)("p",{className:"text-lg leading-lg text-modalFont font-bold",children:["Opening ",e.name,"..."]}),(0,f.jsx)("p",{className:"pb-[10px] text-base text-modalTextSecondary leading-base font-medium text-center",children:"Confirm connection in the extension"}),r.isConnecting&&(0,f.jsx)("div",{className:"loading text-modalText"}),!e.isInstalled()&&e.links.browserExtension&&(0,f.jsxs)("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,"?"]}),!r.isConnecting&&r.isError&&e.isInstalled()&&(0,f.jsx)("button",{className:m("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]",ie),onClick:()=>o(e),children:"Retry"})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:"w-[160px] h-[160px] mb-4",children:(0,f.jsx)(bt,{})}),(0,f.jsx)("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?"}),(0,f.jsx)("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."})]})}),(0,f.jsx)("div",{})]})});var se=q(require("react"),1),Mt=require("@luno-kit/react"),kt=require("@luno-kit/react/utils");var R=require("react/jsx-runtime"),no=["polkadot-js","subwallet-js","talisman","walletconnect","nova","nova-mobile"],ro=["polkagate","fearless-wallet","mimir","enkrypt"],At=se.default.memo(({onConnect:e})=>{let o=(0,Mt.useConnectors)();if((0,kt.isMobileDevice)()){let i=o.filter(c=>c.links.deepLink);return(0,R.jsx)("div",{className:"flex flex-col items-start gap-1 w-full",children:i.map(c=>(0,R.jsx)(Nt,{connector:c,onConnect:()=>e(c)},`${c.id}-${c.name}`))})}let t=o.filter(i=>i.isInstalled()),n=o.filter(i=>no.includes(i.id)&&!i.isInstalled()),r=o.filter(i=>ro.includes(i.id)&&!i.isInstalled()),a=(0,se.useMemo)(()=>[{title:"Installed",group:t},{title:"Popular",group:n},{title:"More",group:r}],[t,n,r]);return(0,R.jsx)("div",{className:"flex flex-col items-start gap-4 w-full overflow-y-auto custom-scrollbar max-h-[400px]",children:a.map(i=>i.group.length===0?null:(0,R.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full",children:[(0,R.jsx)("div",{className:m("text-sm font-semibold leading-base",i.title==="Installed"?"text-accentColor":"text-modalTextSecondary"),children:i.title}),(0,R.jsx)("div",{className:"flex flex-col items-start gap-1.5 w-full",children:i.group.map(c=>(0,R.jsx)(Nt,{connector:c,onConnect:()=>e(c)},c.id))})]},i.title))})}),Nt=se.default.memo(({connector:e,onConnect:o})=>(0,R.jsxs)("button",{onClick:o,className:m("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:[(0,R.jsx)("div",{className:"w-[28px] h-[28px] rounded-[6px] overflow-hidden",children:(0,R.jsx)("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),(0,R.jsx)("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));var v=require("react/jsx-runtime");var st=({size:e="wide"})=>{let{isOpen:o,close:t}=J(),{connectAsync:n,reset:r,isPending:a,isError:i}=(0,Tt.useConnect)(),[c,d]=(0,U.useState)(null),[p,h]=(0,U.useState)(),{width:l}=ve(),u=l&&l>768,s=!!(e==="wide"&&u),{containerRef:w,currentViewRef:b,resetView:L,handleViewChange:V,currentView:T}=xe({initialView:"Connect Wallet"}),O=async D=>{let ze=await D.getConnectionUri();h(ze)},P=async D=>{if((0,Pt.isMobileDevice)()&&D.links.deepLink)try{await n({connectorId:D.id}),I(!1);return}catch{window.location.href=`${D.links.deepLink}?url=${window.location.href}`;return}!s&&V("walletView"),d(D),h(void 0),D.hasConnectionUri()&&O(D),await n({connectorId:D.id}),I(!1)},I=D=>{!D&&t(),r(),L(),d(null),h(void 0)},Rt=(0,U.useMemo)(()=>({"Connect Wallet":(0,v.jsx)(At,{onConnect:P}),walletView:(0,v.jsx)(Fe,{connectState:{isConnecting:a,isError:i},isWide:s,selectedConnector:c,qrCode:p,onConnect:P})}),[s,c,p,P,a,i]);return(0,U.useEffect)(()=>{s&&T==="walletView"&&V("Connect Wallet")},[s,T]),(0,v.jsx)(K,{open:o,onOpenChange:I,children:(0,v.jsxs)("div",{className:m("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[(0,v.jsxs)("div",{className:m("flex flex-col items-start py-4 px-5 w-full md:w-auto",s?"md:min-w-[300px] border-r-[1px] border-r-solid border-r-separatorLine":"md:min-w-[360px]"),children:[(0,v.jsxs)("div",{className:m("flex items-center justify-between w-full",!s&&"pb-4"),children:[T==="Connect Wallet"?(0,v.jsxs)(v.Fragment,{children:[!s&&(0,v.jsx)("div",{className:"w-[30px] h-[30px]","aria-hidden":!0}),(0,v.jsx)(F,{className:m("text-lg leading-lg text-modalText font-bold",s?"pb-6":"flex-1 text-center"),children:"Connect Wallet"})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("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:()=>V("Connect Wallet"),"aria-label":"Back",children:(0,v.jsx)(ne,{})}),(0,v.jsx)(F,{className:m("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300"),children:c?.name})]}),!s&&(0,v.jsx)(Z,{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:(0,v.jsx)(G,{})})]}),(0,v.jsx)("div",{ref:w,className:"relative overflow-hidden w-full",children:(0,v.jsx)("div",{ref:b,children:Rt[T]})}),!s&&T==="Connect Wallet"&&(0,v.jsx)(v.Fragment,{children:(0,v.jsx)("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?"})})]}),s&&(0,v.jsx)(Fe,{connectState:{isConnecting:a,isError:i},isWide:s,selectedConnector:c,qrCode:p,onConnect:P})]})})};0&&(module.exports={ConnectButton,LunoKitProvider,useAccountModal,useChainModal,useCloseAllModals,useConnectModal,useLunoTheme});
|
|
2
|
+
"use strict";var Vt=Object.create;var ce=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var Ot=(e,o)=>{for(var t in o)ce(e,t,{get:o[t],enumerable:!0})},We=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Bt(o))!Dt.call(e,n)&&n!==t&&ce(e,n,{get:()=>o[n],enumerable:!(r=It(o,n))||r.enumerable});return e};var q=(e,o,t)=>(t=e!=null?Vt(Et(e)):{},We(o||!e||!e.__esModule?ce(t,"default",{value:e,enumerable:!0}):t,e)),Lt=e=>We(ce({},"__esModule",{value:!0}),e);var ao={};Ot(ao,{ConnectButton:()=>wt,LunoKitProvider:()=>qt,useAccountModal:()=>J,useChainModal:()=>X,useCloseAllModals:()=>Ye,useConnectModal:()=>K,useLunoTheme:()=>Ge});module.exports=Lt(ao);var ge=require("@luno-kit/react"),ht=require("@luno-kit/react/utils"),ae=require("react");var be=require("react/jsx-runtime"),_t=e=>(0,be.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"arrow_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:(0,be.jsx)("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"})}),ye=_t;var Se=require("react/jsx-runtime"),Ht=e=>(0,Se.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Se.jsx)("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"})}),te=Ht;var Ne=require("react/jsx-runtime"),Gt=e=>(0,Ne.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Ne.jsx)("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"})}),$=Gt;var Me=require("react/jsx-runtime"),$t=e=>(0,Me.jsx)("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:(0,Me.jsx)("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"})}),ke=$t;var Ae=require("react/jsx-runtime"),Zt=e=>(0,Ae.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:(0,Ae.jsx)("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"})}),Te=Zt;var Pe=require("react/jsx-runtime"),Ft=e=>(0,Pe.jsx)("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:(0,Pe.jsx)("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"})}),Re=Ft;var Ve=require("react/jsx-runtime"),zt=e=>(0,Ve.jsx)("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:(0,Ve.jsx)("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"})}),Ie=zt;var Be=require("react/jsx-runtime"),Qt=e=>(0,Be.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"search_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:(0,Be.jsx)("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"})}),Ee=Qt;var De=require("react/jsx-runtime"),Wt=e=>(0,De.jsx)("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:(0,De.jsx)("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"})}),Oe=Wt;var Z=require("react");function le({initialView:e,animationDuration:o=200,animationEasing:t="ease-out"}){let[r,n]=(0,Z.useState)(e),[a,i]=(0,Z.useState)(!1),c=(0,Z.useRef)(null),m=(0,Z.useRef)(null),p=(0,Z.useCallback)(l=>{if(l===r||a)return;if(i(!0),!c.current){n(l),i(!1);return}let u=c.current,s=u.offsetHeight;n(l),requestAnimationFrame(()=>{if(!u||!m.current){i(!1);return}let w=m.current.offsetHeight;u.animate([{height:s+"px"},{height:w+"px"}],{duration:o,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[r,a,o,t]),f=(0,Z.useCallback)(()=>{n(e),i(!1)},[e]);return{currentView:r,isAnimating:a,containerRef:c,currentViewRef:m,handleViewChange:p,resetView:f}}var y=require("react");var Ue=require("react"),je=["--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"],qe=(e,o)=>{(0,Ue.useEffect)(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([r,n])=>{n&&t.style.setProperty(`--color-${r}`,n)}),Object.entries(e.completeTheme.fonts).forEach(([r,n])=>{n&&t.style.setProperty(`--font-${r}`,n)}),Object.entries(e.completeTheme.radii).forEach(([r,n])=>{n&&t.style.setProperty(`--radius-${r}`,n)}),Object.entries(e.completeTheme.shadows).forEach(([r,n])=>{n&&t.style.setProperty(`--shadow-${r}`,n)}),Object.entries(e.completeTheme.blurs).forEach(([r,n])=>{n&&t.style.setProperty(`--blur-${r}`,n)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",o),Object.keys(e.partialOverrides).length>0&&(je.forEach(n=>{t.style.removeProperty(n)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([n,a])=>{a&&t.style.setProperty(`--color-${n}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([n,a])=>{a&&t.style.setProperty(`--font-${n}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([n,a])=>{a&&t.style.setProperty(`--radius-${n}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([n,a])=>{a&&t.style.setProperty(`--shadow-${n}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([n,a])=>{a&&t.style.setProperty(`--blur-${n}`,a)}))):(t.setAttribute("data-theme",o),je.forEach(r=>{t.style.removeProperty(r)}))},[e,o])};var Je=require("react/jsx-runtime"),_e="luno.lastThemePreference",jt=e=>{try{localStorage.setItem(_e,JSON.stringify(e))}catch{}},Ke=(0,y.createContext)(void 0),Le=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Ut=()=>{let[e,o]=(0,y.useState)(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return(0,y.useEffect)(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=n=>{o(n.matches?"dark":"light")};return r(t),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),e},He=({children:e,theme:o})=>{let t=Ut(),[r,n]=(0,y.useState)(()=>{if(typeof window<"u")try{let u=localStorage.getItem(_e);if(u){let s=JSON.parse(u);if(s?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(s?.preferredTheme)return s.preferredTheme}}catch{}return!o||Le(o)?"light":o.defaultMode||"light"}),[a,i]=(0,y.useState)(()=>{if(typeof window<"u")try{let u=localStorage.getItem(_e);if(u)return JSON.parse(u)?.isAuto??!1}catch{}return!o||Le(o)?!1:o.autoMode??!1}),c=(0,y.useMemo)(()=>{if(!o)return{type:"default",completeTheme:null,partialOverrides:null};if(Le(o))return{type:"complete",completeTheme:o,partialOverrides:null};let l=o;if(l.theme)return{type:"complete",completeTheme:l.theme,partialOverrides:null};let u=null;return r==="light"&&l.light?u=l.light:r==="dark"&&l.dark?u=l.dark:u={...l},{type:"partial",completeTheme:null,partialOverrides:u}},[r,o]),m=(0,y.useMemo)(()=>c.type==="complete"?c.completeTheme:null,[c]);qe(c,r);let p=(0,y.useCallback)(l=>{let u=l==="auto";i(u),n(u?t||"light":l);let s={isAuto:u,...u?{}:{preferredTheme:l}};jt(s)},[t]);(0,y.useEffect)(()=>{a&&n(t||"light")},[t,a]);let f=(0,y.useMemo)(()=>({themeMode:r,setThemeChoice:p,currentTheme:m}),[r,p,m]);return(0,Je.jsx)(Ke.Provider,{value:f,children:e})},Ge=()=>{let e=(0,y.useContext)(Ke);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};var tt=require("@luno-kit/react"),de=require("@tanstack/react-query"),ot=require("react");var W=require("@luno-kit/react"),S=require("react"),et=require("react/jsx-runtime");function $e(){let[e,o]=(0,S.useState)(!1),t=(0,S.useCallback)(()=>o(!0),[]),r=(0,S.useCallback)(()=>o(!1),[]);return{isOpen:e,open:t,close:r}}var oe=(0,S.createContext)(void 0),Xe=({children:e})=>{let{isOpen:o,open:t,close:r}=$e(),{isOpen:n,open:a,close:i}=$e(),{isOpen:c,open:m,close:p}=$e(),f=(0,W.useStatus)(),l=(0,S.useCallback)(()=>{r(),i(),p()},[r,i,p]);(0,S.useEffect)(()=>{f===W.ConnectionStatus.Disconnected&&(i(),p())},[f,i,p]);let u=(0,S.useMemo)(()=>({isConnectModalOpen:o,isAccountModalOpen:n,isChainModalOpen:c,openConnectModal:f!==W.ConnectionStatus.Connected?t:void 0,closeConnectModal:r,openAccountModal:f===W.ConnectionStatus.Connected?a:void 0,closeAccountModal:i,openChainModal:f===W.ConnectionStatus.Connected?m:void 0,closeChainModal:p,closeAllModals:l}),[o,t,r,n,a,i,c,m,p,l,f]);return(0,et.jsx)(oe.Provider,{value:u,children:e})},K=()=>{let e=(0,S.useContext)(oe);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},J=()=>{let e=(0,S.useContext)(oe);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},X=()=>{let e=(0,S.useContext)(oe);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}},Ye=()=>{let e=(0,S.useContext)(oe);if(!e)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return e.closeAllModals};var A=require("react/jsx-runtime"),qt=({children:e,config:o,queryClientConfig:t,theme:r})=>{let[n]=(0,ot.useState)(()=>new de.QueryClient(t));return(0,A.jsx)(de.QueryClientProvider,{client:n,children:(0,A.jsx)(tt.LunoProvider,{config:o,children:(0,A.jsx)(He,{theme:r,children:(0,A.jsxs)(Xe,{children:[(0,A.jsx)("div",{className:"font-base luno-kit",children:e}),(0,A.jsx)(Kt,{modalSize:o.modalSize})]})})})})},Kt=({modalSize:e})=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(at,{size:e}),(0,A.jsx)(nt,{}),(0,A.jsx)(rt,{})]});var it=require("clsx"),st=require("tailwind-merge"),Jt=(0,st.extendTailwindMerge)({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function d(...e){return Jt((0,it.clsx)(e))}function ct(e,o){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},o)}}var me=require("react");var ne=require("react/jsx-runtime"),pe=({copyText:e,label:o,className:t=""})=>{let[r,n]=(0,me.useState)(!1),a=(0,me.useCallback)(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),n(!0),setTimeout(()=>n(!1),2e3),!0):!1}catch(c){return console.error("Copy failed:",c),!1}},[]);return(0,ne.jsxs)("button",{type:"button",className:d("cursor-pointer bg-transparent border-none p-1 m-0 inline-flex items-center justify-center gap-1","rounded-modalControlButton hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",t),onClick:()=>!r&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:r,children:[r?(0,ne.jsx)(Ie,{className:"text-accentColor",width:16,height:16}):(0,ne.jsx)(ke,{width:16,height:16}),o]})};var E=q(require("@radix-ui/react-dialog"),1),ue=q(require("react"),1);var re=require("react/jsx-runtime"),Xt=({open:e,onOpenChange:o,children:t,contentClassName:r,overlayClassName:n})=>(0,re.jsx)(E.Root,{open:e,onOpenChange:o,children:(0,re.jsxs)(E.Portal,{children:[ue.default.createElement(E.Overlay,{className:d("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",n)}),(0,re.jsx)(E.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})]})}),Yt=({children:e,className:o})=>ue.default.createElement(E.Title,{className:o},e),eo=({children:e,className:o,onClick:t})=>ue.default.createElement(E.Close,{className:o,onClick:t},e),Y=Xt,F=eo,z=Yt;var H=require("@luno-kit/react"),dt=require("@luno-kit/react/utils"),mt=require("react");var Ze=require("react/jsx-runtime"),ee=({chainIconUrl:e,chainName:o,className:t})=>e?(0,Ze.jsx)("img",{src:e,alt:o||"Chain icon",className:d("w-full h-full object-cover rounded-full",t)}):(0,Ze.jsx)("div",{className:d("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:o?o.charAt(0).toUpperCase():"C"});var x=require("react/jsx-runtime"),pt=({onViewChange:e,onModalClose:o})=>{let{address:t}=(0,H.useAccount)(),{chain:r}=(0,H.useChain)(),n=(0,H.useChains)(),{disconnectAsync:a}=(0,H.useDisconnect)(),{data:i}=(0,H.useBalance)({address:n.length>0?t:void 0}),c=(0,mt.useMemo)(()=>{let p=[{key:"Chain Name",content:(0,x.jsxs)("div",{className:"flex items-stretch w-full justify-between",children:[(0,x.jsxs)("div",{className:"flex items-center gap-2",children:[(0,x.jsx)("div",{className:"relative",children:(0,x.jsx)(ee,{className:"w-[24px] h-[24px]",chainIconUrl:r?.chainIconUrl,chainName:r?.name})}),(0,x.jsxs)("div",{className:"flex flex-col items-start",children:[(0,x.jsx)("span",{className:"text-base leading-base text-modalText",children:r?.name||"Polkadot"}),i?(0,x.jsxs)("span",{className:"text-modalTextSecondary text-xs leading-xs",children:[i.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]}):(0,x.jsx)("span",{className:"animate-pulse rounded w-[80px] h-[16px] bg-skeleton"})]})]}),(0,x.jsx)("div",{className:"flex items-center justify-center",children:(0,x.jsx)(ye,{className:"w-[16px] h-[16px] text-modalTextSecondary"})})]}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Re,{className:"w-[24px] h-[24px]"}),(0,x.jsx)("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open((0,dt.getExplorerUrl)(r?.blockExplorers?.default?.url,t,"address"))}],f=[{key:"Switch Account",content:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Oe,{className:"w-[24px] h-[24px]"}),(0,x.jsx)("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}];return n.length>0?[...p,...f]:[...f]},[e,r,t,i,n]),m=async()=>{await a(),o()};return(0,x.jsxs)("div",{className:"flex flex-col items-center gap-3 w-full",children:[(0,x.jsx)("div",{className:"flex flex-col gap-1.5 w-full px-4",children:c.map(p=>(0,x.jsx)(lt,{onClick:p.onClick,children:p.content},p.key))}),(0,x.jsx)("div",{className:"w-full mx-[-100px] h-[1px] bg-separatorLine"}),(0,x.jsx)("div",{className:"w-full px-4 pb-4",children:(0,x.jsxs)(lt,{onClick:m,children:[(0,x.jsx)(Te,{}),(0,x.jsx)("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},lt=({children:e,onClick:o})=>(0,x.jsx)("button",{type:"button",onClick:()=>o?.(),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",o?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});var D=require("@luno-kit/react"),ut=require("@luno-kit/react/utils"),fe=q(require("react"),1);var T=require("react/jsx-runtime"),Fe=({onBack:e})=>{let{accounts:o,selectAccount:t}=(0,D.useAccounts)(),{address:r}=(0,D.useAccount)(),n=(0,fe.useCallback)(a=>{t(a),e()},[e]);return(0,T.jsx)("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:o.map(a=>(0,T.jsx)(to,{account:a,isSelected:a.address===r,selectAccount:n},a.address))})};Fe.title="Switch Accounts";var to=fe.default.memo(({isSelected:e,account:o,selectAccount:t})=>{let{chain:r}=(0,D.useChain)(),n=(0,D.useChains)(),a=o.address,{data:i}=(0,D.useBalance)({address:n.length>0?a:void 0}),c=(0,D.useActiveConnector)();return(0,T.jsxs)("button",{type:"button",onClick:()=>t(o),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":o.name||a,disabled:e,children:[(0,T.jsxs)("div",{className:"flex items-center gap-2 grow overflow-hidden",children:[(0,T.jsx)("div",{className:"shrink-0 w-[24px] h-[24px] rounded-full flex items-center justify-center",children:c?.icon&&(0,T.jsx)("img",{src:c?.icon,alt:"luno account"})}),(0,T.jsxs)("div",{className:"flex flex-col items-start overflow-hidden",children:[(0,T.jsx)("span",{className:"whitespace-nowrap max-w-full text-ellipsis overflow-hidden font-medium text-sm leading-sm text-accountSelectItemText",children:o.name||(0,ut.formatAddress)(a)}),n.length>0&&(i?(0,T.jsxs)("span",{className:"text-xs text-modalTextSecondary font-medium",children:[i?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]}):(0,T.jsx)("span",{className:"animate-pulse rounded w-[60px] h-[16px] bg-skeleton"}))]})]}),e&&(0,T.jsx)("div",{className:"shrink-0 border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]",children:(0,T.jsx)("div",{className:"rounded-full bg-accentColor w-[10px] h-[10px]"})})]})});var Q=require("@luno-kit/react"),j=q(require("react"),1);var C=require("react/jsx-runtime"),he=({onChainSwitched:e,className:o=""})=>{let{chain:t}=(0,Q.useChain)(),r=(0,Q.useChains)(),{switchChainAsync:n}=(0,Q.useSwitchChain)(),{isApiReady:a,apiError:i}=(0,Q.useApi)(),[c,m]=(0,j.useState)(null),[p,f]=(0,j.useState)(""),l=(0,j.useMemo)(()=>r.filter(s=>p.trim()?s.name.toLowerCase().includes(p.toLowerCase()):!0),[r,p]),u=async s=>{if(s.genesisHash!==t?.genesisHash&&!(!a&&!i)){m(s.genesisHash);try{await n({chainId:s.genesisHash}),e?.(s)}catch(w){console.error("Failed to switch chain:",w)}finally{m(null)}}};return(0,C.jsxs)("div",{className:d("flex flex-col gap-3.5",o),children:[(0,C.jsx)("div",{className:"relative pt-1",children:(0,C.jsxs)("div",{className:"relative",children:[(0,C.jsx)(Ee,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-modalTextSecondary"}),(0,C.jsx)("input",{type:"text",placeholder:"Search by name",value:p,onChange:s=>f(s.target.value),className:"w-full pl-10 pr-3 py-2 text-sm border border-networkSelectItemBackgroundHover rounded-md focus:ring-2 focus:ring-accentColor focus:outline-none focus:border-transparent"})]})}),l.length>0&&(0,C.jsx)("div",{className:"flex flex-col gap-1.5 overflow-y-auto max-h-[380px]",children:l.map(s=>(0,C.jsx)(oo,{chain:s,isSelected:s.genesisHash===t?.genesisHash,onSelect:u,isLoading:(c===s.genesisHash||!a)&&!i,isSwitching:c===s.genesisHash},s.genesisHash))}),l.length===0&&(0,C.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,C.jsx)("span",{className:"text-modalTextSecondary text-xs",children:"No chains available"})})]})},oo=j.default.memo(({chain:e,isSelected:o,isLoading:t,onSelect:r,isSwitching:n})=>(0,C.jsxs)("button",{onClick:()=>r(e),disabled:o||t,className:d("flex items-center justify-between p-2.5 rounded-networkSelectItem","bg-networkSelectItemBackground","transition-colors duration-200",o||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)(ee,{className:"w-[20px] h-[20px] flex items-center justify-center leading-[20px]",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),(0,C.jsx)("div",{className:"flex flex-col items-start",children:(0,C.jsx)("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),(0,C.jsx)("div",{className:"flex items-center justify-center h-[20px]",children:o?t?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:n?"Switching":"Connecting"}),(0,C.jsx)("div",{className:"loading text-accentColor w-[15px] h-[15px]"})]}):(0,C.jsxs)("span",{className:"status-dot-container",children:[(0,C.jsx)("span",{className:"ping-animation"}),(0,C.jsx)("span",{className:"status-dot"})]}):null})]}));var ft=require("react/jsx-runtime"),xe=({onBack:e})=>(0,ft.jsx)(he,{className:"p-4 pt-0"});xe.title="Select Networks";var g=require("react/jsx-runtime");var nt=()=>{let{isOpen:e,close:o}=J(),{address:t,account:r}=(0,ge.useAccount)(),n=(0,ge.useActiveConnector)(),{currentView:a,containerRef:i,currentViewRef:c,handleViewChange:m,resetView:p}=le({initialView:"main"}),f=(0,ae.useCallback)(()=>{o(),p()},[o]),l=(0,ae.useMemo)(()=>a==="switchAccount"?"Switch Account":a==="switchChain"?xe.title:null,[a]),u=(0,ae.useMemo)(()=>({main:(0,g.jsx)(pt,{onViewChange:m,onModalClose:f}),switchAccount:(0,g.jsx)(Fe,{onBack:()=>m("main")}),switchChain:(0,g.jsx)(xe,{onBack:()=>m("main")})}),[m,f]);return(0,g.jsx)(Y,{open:e,onOpenChange:f,children:(0,g.jsxs)("div",{className:d("flex flex-col w-full md:w-[360px] max-h-[512px] text-modalText","bg-modalBackground shadow-modal",a==="main"?"gap-5":"gap-3.5"),children:[(0,g.jsxs)("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[a==="main"?(0,g.jsxs)("div",{className:"flex items-center gap-3 max-w-[80%]",children:[n?.icon&&(0,g.jsx)("div",{className:"flex items-center justify-center w-[40px] h-[40px] shrink-0",children:(0,g.jsx)("img",{src:n.icon,alt:"",className:"w-full h-full object-contain"})}),(0,g.jsxs)("div",{className:"flex flex-col items-start gap-1.5 max-w-full",children:[(0,g.jsx)(z,{className:"sr-only",children:"Account Details"}),(0,g.jsxs)("div",{className:"flex items-center gap-0.5 w-full ",children:[(0,g.jsx)("span",{className:"text-base text-modalText font-semibold",children:(0,ht.formatAddress)(t)}),(0,g.jsx)(pe,{copyText:t})]}),(0,g.jsx)("div",{className:d("text-sm leading-sm text-modalTextSecondary font-medium text-ellipsis overflow-hidden whitespace-nowrap",r?.name&&r?.name.length>30?"w-[90%]":""),children:r?.name||n?.name})]})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("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:()=>m("main"),"aria-label":"Back",children:(0,g.jsx)(te,{})}),(0,g.jsx)(z,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:l})]}),(0,g.jsx)(F,{className:"shrink-0 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:(0,g.jsx)($,{})})]}),(0,g.jsx)("div",{ref:i,className:"relative",children:(0,g.jsx)("div",{ref:c,children:u[a]})})]})})};var G=require("react/jsx-runtime"),rt=()=>{let{isOpen:e,close:o}=X();return(0,G.jsx)(Y,{open:e,onOpenChange:t=>!t&&o(),children:(0,G.jsxs)("div",{className:"flex flex-col w-full md:w-[360px] max-h-[512px] p-4 gap-3.5 text-modalText",children:[(0,G.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,G.jsx)("div",{className:"w-[30px]"})," ",(0,G.jsx)(z,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),(0,G.jsx)(F,{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:(0,G.jsx)($,{})})]}),(0,G.jsx)(he,{})]})})};var gt=require("@luno-kit/react/utils");var N=require("@luno-kit/react");function xt(){let e=(0,N.useStatus)(),{account:o,address:t}=(0,N.useAccount)(),{chain:r}=(0,N.useChain)(),n=(0,N.useChains)(),{data:a}=(0,N.useBalance)({address:n.length>0?t:void 0}),i=(0,N.useActiveConnector)(),{open:c,isOpen:m}=K(),{open:p,isOpen:f}=J(),{open:l,isOpen:u}=X(),s=e===N.ConnectionStatus.Connecting,w=e===N.ConnectionStatus.Connected,b=e===N.ConnectionStatus.Disconnected||e===N.ConnectionStatus.Disconnecting,L=!!r&&n.some(V=>V.genesisHash.toLowerCase()===r.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:w,isDisconnected:b,isConnecting:s,account:o,address:t,currentChain:r,configuredChains:n,isChainSupported:L,chainIconUrl:r?.chainIconUrl,chainName:r?.name,balance:a,openConnectModal:c,openAccountModal:p,openChainModal:l,isConnectModalOpen:m,isAccountModalOpen:f,isChainModalOpen:u}}var we=require("react");var ve=()=>{let[e,o]=(0,we.useState)({height:void 0,width:void 0});return(0,we.useEffect)(()=>{let t=ct(()=>{o({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};var M=require("react/jsx-runtime"),ie="transition-transform transition-[125] hover:scale-[1.03] transition-ease",wt=({className:e,label:o="Connect Wallet",accountStatus:t="full",chainStatus:r="full",showBalance:n=!0,displayPreference:a="address"})=>{let{isConnected:i,isDisconnected:c,account:m,balance:p,openConnectModal:f,openAccountModal:l,openChainModal:u,chainIconUrl:s,chainName:w,currentChain:b,configuredChains:L,activeConnector:V}=xt(),{width:I}=ve(),k=I&&I>768;return c||!i||!V?(0,M.jsx)("button",{type:"button",onClick:()=>f?.(),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",ie,"px-3.5 text-base leading-base min-h-[40px]",e),children:o}):(0,M.jsxs)("div",{className:d("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[r!=="none"&&L.length>0&&(0,M.jsxs)("button",{type:"button",onClick:()=>u?.(),className:d("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",ie),"aria-label":"Switch chain",children:[r==="full"||r==="icon"?(0,M.jsx)(ee,{chainIconUrl:s,chainName:w,className:"w-[24px] h-[24px]"}):null,(r==="full"||r==="name")&&k&&(0,M.jsx)("span",{children:b?.name||"Unknown Chain"})]}),(0,M.jsxs)("button",{type:"button",onClick:()=>l?.(),className:d("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",ie),"aria-label":"Open account modal",children:[L.length>0&&n&&k&&(0,M.jsx)("div",{className:"p-2 pl-3",children:p?(0,M.jsxs)("span",{children:[p?.formattedTransferable||p?.formattedTotal||0," ",b?.nativeCurrency?.symbol||""]}):(0,M.jsx)("span",{className:"block animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"})}),(0,M.jsxs)("div",{className:d("flex items-center overflow-hidden bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",L.length>0&&n&&k?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&(0,M.jsx)("span",{className:"w-[24px] h-[24px] flex items-center justify-center",children:(0,M.jsx)("img",{src:V.icon,alt:"luno"})}),(0,M.jsx)("span",{"aria-label":"Wallet icon placeholder",className:d(a==="name"&&m?.name?"text-ellipsis overflow-hidden max-w-[115px] whitespace-nowrap":""),children:a==="name"&&m?.name?m?.name:(0,gt.formatAddress)(m?.address)})]})]})]})};var Tt=require("@luno-kit/react"),Pt=require("@luno-kit/react/utils"),U=require("react");var Ct=require("@luno-kit/react"),bt=require("@luno-kit/react/utils"),se=q(require("react"),1);var R=require("react/jsx-runtime"),no=["polkadot-js","subwallet-js","talisman","walletconnect","nova","nova-mobile"],ro=["polkagate","fearless-wallet","mimir","enkrypt"],yt=se.default.memo(({onConnect:e})=>{let o=(0,Ct.useConnectors)();if((0,bt.isMobileDevice)()){let i=o.filter(c=>c.links.deepLink);return(0,R.jsx)("div",{className:"flex flex-col items-start gap-1 w-full",children:i.map(c=>(0,R.jsx)(vt,{connector:c,onConnect:()=>e(c)},`${c.id}-${c.name}`))})}let t=o.filter(i=>i.isInstalled()),r=o.filter(i=>no.includes(i.id)&&!i.isInstalled()),n=o.filter(i=>ro.includes(i.id)&&!i.isInstalled()),a=(0,se.useMemo)(()=>[{title:"Installed",group:t},{title:"Popular",group:r},{title:"More",group:n}],[t,r,n]);return(0,R.jsx)("div",{className:"flex flex-col items-start gap-4 w-full overflow-y-auto custom-scrollbar max-h-[400px]",children:a.map(i=>i.group.length===0?null:(0,R.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full",children:[(0,R.jsx)("div",{className:d("text-sm font-semibold leading-base",i.title==="Installed"?"text-accentColor":"text-modalTextSecondary"),children:i.title}),(0,R.jsx)("div",{className:"flex flex-col items-start gap-1.5 w-full",children:i.group.map(c=>(0,R.jsx)(vt,{connector:c,onConnect:()=>e(c)},c.id))})]},i.title))})}),vt=se.default.memo(({connector:e,onConnect:o})=>(0,R.jsxs)("button",{onClick:o,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:[(0,R.jsx)("div",{className:"w-[28px] h-[28px] rounded-[6px] overflow-hidden",children:(0,R.jsx)("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),(0,R.jsx)("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));var At=q(require("react"),1);var St=require("cuer"),O=require("react/jsx-runtime"),Nt=({logoBackground:e,uri:o,size:t})=>{if(!o){let a=Math.floor(14.25),i=t/57,c=a*i,m=Math.ceil(57/2-a/2),p=m+a,f=()=>{let s=[];for(let w=0;w<57;w++)for(let b=0;b<57;b++){if(w>=m&&w<p&&b>=m&&b<p||w<8&&b<8||w<8&&b>=49||w>=49&&b<8)continue;let V=b+.5,I=w+.5;s.push((0,O.jsx)("rect",{x:V-.4,y:I-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${w}-${b}`))}return s},l=({position:s})=>{let w=7*i,b={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return(0,O.jsxs)("div",{className:"absolute z-[4]",style:{width:`${w}px`,height:`${w}px`,...b[s]},children:[(0,O.jsx)("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),(0,O.jsx)("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)"}})]})},u=()=>{let s=m*i;return(0,O.jsx)("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${c}px`,height:`${c}px`,left:`${s}px`,top:`${s}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:(0,O.jsx)("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return(0,O.jsxs)("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[(0,O.jsx)("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:f()}),(0,O.jsx)("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&&u()]})}return(0,O.jsx)(St.Cuer,{arena:e,value:o})};var Ce=require("react");var kt=require("react/jsx-runtime"),Mt=({size:e=160,dotCount:o=300,duration:t=3,className:r=""})=>{let n=(0,Ce.useRef)(null);return(0,Ce.useEffect)(()=>{if(!n.current)return;let a=1,i=2,c=Math.PI*(3-Math.sqrt(5)),m=e/2,p=m-i-a,f="http://www.w3.org/2000/svg";n.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",n.current.appendChild(l);for(let u=0;u<o;u++){let s=u+.5,w=s/o,b=Math.sqrt(w)*p,L=s*c,V=m+b*Math.cos(L),I=m+b*Math.sin(L),k=document.createElementNS(f,"circle");k.setAttribute("cx",V.toString()),k.setAttribute("cy",I.toString()),k.setAttribute("r",a.toString()),k.setAttribute("fill","currentColor"),k.setAttribute("opacity","0.6"),l.appendChild(k);let P=document.createElementNS(f,"animate");P.setAttribute("attributeName","r"),P.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),P.setAttribute("dur",`${t}s`),P.setAttribute("begin",`${w*t}s`),P.setAttribute("repeatCount","indefinite"),P.setAttribute("calcMode","spline"),P.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),k.appendChild(P);let B=document.createElementNS(f,"animate");B.setAttribute("attributeName","opacity"),B.setAttribute("values","0.2;1;0.2"),B.setAttribute("dur",`${t}s`),B.setAttribute("begin",`${w*t}s`),B.setAttribute("repeatCount","indefinite"),B.setAttribute("calcMode","spline"),B.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),k.appendChild(B)}},[e,o,t]),(0,kt.jsx)("div",{ref:n,className:d("text-accentColor inline-flex w-full h-full justify-center align-center",r)})};var h=require("react/jsx-runtime"),ze=At.default.memo(({selectedConnector:e,onConnect:o,qrCode:t,isWide:r,connectState:n})=>{let a=e?.hasConnectionUri();return(0,h.jsxs)("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&&(0,h.jsx)("div",{className:"w-full",children:(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("div",{}),(0,h.jsx)(F,{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:(0,h.jsx)($,{})})]})}),(0,h.jsx)("div",{className:d("flex items-center gap-4 flex-col grow justify-center",e&&a?"max-w-[300px]":"max-w-[360px]"),children:e?a?(0,h.jsxs)("div",{className:"flex flex-col items-center gap-2.5",children:[(0,h.jsx)(Nt,{size:300,logoBackground:e.icon,uri:t}),(0,h.jsxs)("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"]}),(0,h.jsx)("div",{className:"min-h-[20px] flex items-center justify-center ",children:e.links?.browserExtension?(0,h.jsxs)("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?(0,h.jsx)(pe,{className:"text-sm leading-sm font-medium text-accentColor",copyText:t,label:"Copy Link"}):null})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"w-[80px] h-[80px]",children:(0,h.jsx)("img",{src:e.icon,className:"w-full h-full",alt:""})}),(0,h.jsxs)("p",{className:"text-lg leading-lg text-modalFont font-bold",children:["Opening ",e.name,"..."]}),(0,h.jsx)("p",{className:"pb-[10px] text-base text-modalTextSecondary leading-base font-medium text-center",children:"Confirm connection in the extension"}),n.isConnecting&&(0,h.jsx)("div",{className:"loading text-modalText"}),!e.isInstalled()&&e.links.browserExtension&&(0,h.jsxs)("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,"?"]}),!n.isConnecting&&n.isError&&e.isInstalled()&&(0,h.jsx)("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]",ie),onClick:()=>o(e),children:"Retry"})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"w-[160px] h-[160px] mb-4",children:(0,h.jsx)(Mt,{})}),(0,h.jsx)("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?"}),(0,h.jsx)("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."})]})}),(0,h.jsx)("div",{})]})});var v=require("react/jsx-runtime");var at=({size:e="wide"})=>{let{isOpen:o,close:t}=K(),{connectAsync:r,reset:n,isPending:a,isError:i}=(0,Tt.useConnect)(),[c,m]=(0,U.useState)(null),[p,f]=(0,U.useState)(),{width:l}=ve(),u=l&&l>768,s=!!(e==="wide"&&u),{containerRef:w,currentViewRef:b,resetView:L,handleViewChange:V,currentView:I}=le({initialView:"Connect Wallet"}),k=async _=>{let Qe=await _.getConnectionUri();f(Qe)},P=async _=>{if((0,Pt.isMobileDevice)()&&_.links.deepLink)try{await r({connectorId:_.id}),B(!1);return}catch{window.location.href=`${_.links.deepLink}?url=${window.location.href}`;return}!s&&V("walletView"),m(_),f(void 0),_.hasConnectionUri()&&k(_),await r({connectorId:_.id}),B(!1)},B=_=>{!_&&t(),n(),L(),m(null),f(void 0)},Rt=(0,U.useMemo)(()=>({"Connect Wallet":(0,v.jsx)(yt,{onConnect:P}),walletView:(0,v.jsx)(ze,{connectState:{isConnecting:a,isError:i},isWide:s,selectedConnector:c,qrCode:p,onConnect:P})}),[s,c,p,P,a,i]);return(0,U.useEffect)(()=>{s&&I==="walletView"&&V("Connect Wallet")},[s,I]),(0,v.jsx)(Y,{open:o,onOpenChange:B,children:(0,v.jsxs)("div",{className:d("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[(0,v.jsxs)("div",{className:d("flex flex-col items-start py-4 px-5 w-full md:w-auto",s?"md:min-w-[300px] border-r-[1px] border-r-solid border-r-separatorLine":"md:min-w-[360px]"),children:[(0,v.jsxs)("div",{className:d("flex items-center justify-between w-full",!s&&"pb-4"),children:[I==="Connect Wallet"?(0,v.jsxs)(v.Fragment,{children:[!s&&(0,v.jsx)("div",{className:"w-[30px] h-[30px]","aria-hidden":!0}),(0,v.jsx)(z,{className:d("text-lg leading-lg text-modalText font-bold",s?"pb-6":"flex-1 text-center"),children:"Connect Wallet"})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("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:()=>V("Connect Wallet"),"aria-label":"Back",children:(0,v.jsx)(te,{})}),(0,v.jsx)(z,{className:d("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300"),children:c?.name})]}),!s&&(0,v.jsx)(F,{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:(0,v.jsx)($,{})})]}),(0,v.jsx)("div",{ref:w,className:"relative overflow-hidden w-full",children:(0,v.jsx)("div",{ref:b,children:Rt[I]})}),!s&&I==="Connect Wallet"&&(0,v.jsx)(v.Fragment,{children:(0,v.jsx)("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?"})})]}),s&&(0,v.jsx)(ze,{connectState:{isConnecting:a,isError:i},isWide:s,selectedConnector:c,qrCode:p,onConnect:P})]})})};0&&(module.exports={ConnectButton,LunoKitProvider,useAccountModal,useChainModal,useCloseAllModals,useConnectModal,useLunoTheme});
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|