@luno-kit/ui 0.0.12-beta.2 → 0.0.12

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
@@ -122,6 +122,7 @@ interface LunoKitProviderProps {
122
122
  config: Config & {
123
123
  modalSize?: Optional<ModalSize>;
124
124
  modalContainer?: Optional<ModalContainer>;
125
+ showInstalledGroup?: boolean;
125
126
  };
126
127
  theme?: Optional<PartialLunokitTheme | LunokitThemeOverrides>;
127
128
  appInfo?: Optional<Partial<AppInfo>>;
package/dist/index.d.ts CHANGED
@@ -122,6 +122,7 @@ interface LunoKitProviderProps {
122
122
  config: Config & {
123
123
  modalSize?: Optional<ModalSize>;
124
124
  modalContainer?: Optional<ModalContainer>;
125
+ showInstalledGroup?: boolean;
125
126
  };
126
127
  theme?: Optional<PartialLunokitTheme | LunokitThemeOverrides>;
127
128
  appInfo?: Optional<Partial<AppInfo>>;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  'use client'
2
- import{useAccount as At,useActiveConnector as It}from"@luno-kit/react";import{formatAddress as Vt}from"@luno-kit/react/utils";import{useCallback as Pt,useMemo as Be}from"react";import{jsx as Qo}from"react/jsx-runtime";var Ke=o=>Qo("svg",{xmlns:"http://www.w3.org/2000/svg",className:"arrow_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...o,children:Qo("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"})}),So=Ke;import{jsx as Ko}from"react/jsx-runtime";var qe=o=>Ko("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...o,children:Ko("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"})}),q=qe;import{jsx as qo}from"react/jsx-runtime";var Je=o=>qo("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...o,children:qo("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"})}),R=Je;import{jsx as J,jsxs as Ye}from"react/jsx-runtime";var Xe=o=>Ye("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"13294",width:"100%",height:"100%",...o,children:[J("path",{d:"M170.837333 263.338667c-55.893333 25.173333-74.837333 53.333333-74.837333 72.661333 0 19.328 18.944 47.488 74.837333 72.661333 52.906667 23.808 128.256 39.338667 213.162667 39.338667 84.906667 0 160.256-15.530667 213.12-39.338667 55.893333-25.173333 74.88-53.333333 74.88-72.661333 0-19.328-18.944-47.488-74.88-72.661333C544.213333 239.573333 468.906667 224 384 224c-84.906667 0-160.256 15.573333-213.162667 39.338667zM144.64 205.013333C207.530667 176.64 292.181333 160 384 160c91.818667 0 176.469333 16.682667 239.402667 45.013333 59.904 26.922667 112.597333 70.826667 112.597333 130.986667s-52.693333 104.021333-112.597333 130.986667C560.469333 495.36 475.818667 512 384 512c-91.818667 0-176.469333-16.682667-239.402667-45.013333C84.693333 440.021333 32 396.16 32 336s52.693333-104.064 112.597333-130.986667z",fill:"currentColor","p-id":"13295"}),J("path",{d:"M64 304a32 32 0 0 1 32 32v160c0 19.370667 18.944 47.530667 74.837333 72.661333 52.906667 23.808 128.213333 39.338667 213.162667 39.338667 84.949333 0 160.298667-15.530667 213.162667-39.338667 55.893333-25.173333 74.837333-53.290667 74.837333-72.661333v-160a32 32 0 0 1 64 0v160c0 60.245333-52.650667 104.106667-112.554667 131.029333-62.933333 28.330667-147.626667 44.970667-239.445333 44.970667-91.861333 0-176.512-16.64-239.445333-44.970667C84.650667 600.064 32 556.202667 32 496v-160a32 32 0 0 1 32-32z",fill:"currentColor","p-id":"13296"}),J("path",{d:"M256 436.010667a32 32 0 0 1 32 32v160a32 32 0 0 1-64 0v-160a32 32 0 0 1 32-32zM672.128 383.829333a32 32 0 0 1 34.858667-28.885333c75.946667 7.082667 144.469333 25.813333 195.072 53.333333 48.810667 26.581333 89.941333 66.773333 89.941333 119.722667 0 60.245333-52.650667 104.106667-112.554667 131.029333-62.933333 28.288-147.626667 44.970667-239.445333 44.970667-81.621333 0-157.482667-13.269333-217.173333-35.626667a32 32 0 1 1 22.4-59.946666c51.456 19.242667 119.594667 31.573333 194.773333 31.573333 84.949333 0 160.256-15.530667 213.162667-39.338667 55.893333-25.173333 74.837333-53.290667 74.837333-72.661333 0-16.64-13.866667-40.277333-56.533333-63.488-40.96-22.272-100.437333-39.338667-170.453334-45.866667a32 32 0 0 1-28.885333-34.816z",fill:"currentColor","p-id":"13297"}),J("path",{d:"M960 496a32 32 0 0 1 32 32v160c0 60.245333-52.650667 104.106667-112.554667 131.029333-62.933333 28.288-147.626667 44.970667-239.445333 44.970667-91.861333 0-176.512-16.64-239.445333-44.970667-59.904-26.965333-112.554667-70.826667-112.554667-131.029333v-50.773333a32 32 0 0 1 64 0v50.773333c0 19.370667 18.944 47.530667 74.837333 72.661333 52.906667 23.808 128.213333 39.338667 213.162667 39.338667 84.949333 0 160.298667-15.530667 213.162667-39.338667 55.893333-25.173333 74.837333-53.290667 74.837333-72.661333v-160a32 32 0 0 1 32-32z",fill:"currentColor","p-id":"13298"}),J("path",{d:"M768 628.010667a32 32 0 0 1 32 32v160a32 32 0 0 1-64 0v-160a32 32 0 0 1 32-32zM512 436.010667a32 32 0 0 1 32 32v352a32 32 0 0 1-64 0v-352a32 32 0 0 1 32-32z",fill:"currentColor","p-id":"13299"})]}),To=Xe;import{jsx as Jo}from"react/jsx-runtime";var on=o=>Jo("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...o,children:Jo("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"})}),Mo=on;import{jsx as Xo,jsxs as nn}from"react/jsx-runtime";var en=o=>nn("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",version:"1.1","p-id":"8135",width:"256",height:"256",...o,children:[Xo("path",{d:"M512 64L126.26 286.74l-2.26 1.31v448L512 960l385.74-222.74L900 736V288z m353.3 652L512 920 158.7 716V308L512 104l353.3 204z","p-id":"8136",fill:"currentColor"}),Xo("path",{d:"M314.55 589.97l-79.49-272.91-27.3 15.82v358.24l34.65 20.05V466.46l85.64 294.07 21.15 12.19V251.18l-34.65 20.05v318.74zM403.1 803.85l34.65 20.05V529.33h186.88v-34.66H437.75v-244.5l74.05-45.03 124.92 79.79 18.64-29.22-143.16-91.37-109.1 66.29v573.22zM724.36 338.72v405.49l34.66-20.05V360.28l60.24 37.38v-40.8l-149.2-92.79-18.33 29.42 72.63 45.23z","p-id":"8137",fill:"currentColor"})]}),Ao=en;import{jsx as Yo}from"react/jsx-runtime";var tn=o=>Yo("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...o,children:Yo("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"})}),Io=tn;import{jsx as oe,jsxs as rn}from"react/jsx-runtime";var ln=o=>rn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 38 38",fill:"none",...o,children:[oe("path",{d:"M18.273 1.51489L3.90896 10.5424C2.41176 11.443 1.77589 12.1511 2.00136 12.6666H29.374L24.7431 3.04502C23.4245 0.849886 20.52 0.163352 18.273 1.51489ZM16.3185 12.54L6.91729 10.8844L19.5776 3.68595C20.5998 3.07162 21.9184 3.38322 22.5188 4.38262L25.8084 10.8844L16.3185 12.54Z",fill:"currentColor"}),oe("path",{d:"M31.9757 10.1333H6.02426C3.401 10.1333 1.26666 12.217 1.26666 14.7782V33.3551C1.26666 35.9163 3.401 38 6.02426 38H31.9757C34.599 38 36.7333 35.9163 36.7333 33.3551V14.7782C36.7333 12.217 34.599 10.1333 31.9757 10.1333ZM34.1379 27.0218H24.624C22.9545 27.0218 21.5967 25.6956 21.5967 24.0666C21.5967 22.4377 22.9545 21.1115 24.624 21.1115H34.1392V27.0218H34.1379ZM34.1379 18.5782H24.624C21.5219 18.5782 19 21.0393 19 24.0666C19 27.094 21.5219 29.5551 24.6227 29.5551H34.1379V33.3551C34.1379 34.5204 33.1677 35.4666 31.9757 35.4666H6.02426C4.83233 35.4666 3.86206 34.5204 3.86206 33.3551V14.7782C3.86206 13.6128 4.83233 12.6666 6.02426 12.6666H31.9757C33.1677 12.6666 34.1379 13.6128 34.1379 14.7782V18.5782ZM23.3257 24.0666C23.3257 24.9989 24.0996 25.7551 25.0547 25.7551C26.011 25.7551 26.7849 24.9989 26.7849 24.0666C26.7849 23.1344 26.011 22.3782 25.0547 22.3782C24.0996 22.3782 23.3257 23.1344 23.3257 24.0666Z",fill:"currentColor"})]}),Vo=ln;import{jsx as ee}from"react/jsx-runtime";var an=o=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256",fill:"none",...o,children:ee("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z",fill:"currentColor"})}),Po=an;import{jsx as ne}from"react/jsx-runtime";var sn=o=>ne("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...o,children:ne("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"})}),Ro=sn;import{jsx as te}from"react/jsx-runtime";var un=o=>te("svg",{xmlns:"http://www.w3.org/2000/svg",className:"search_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...o,children:te("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"})}),Lo=un;import{jsx as le}from"react/jsx-runtime";var cn=o=>le("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...o,children:le("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"})}),Bo=cn;import{jsx as re}from"react/jsx-runtime";var dn=o=>re("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...o,children:re("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"})}),Oo=dn;import{useCallback as ae,useRef as se,useState as ie}from"react";function io({initialView:o,animationDuration:n=200,animationEasing:e="ease-out"}){let[l,t]=ie(o),[r,a]=ie(!1),u=se(null),m=se(null),p=ae(c=>{if(c===l||r)return;if(a(!0),!u.current){t(c),a(!1);return}let s=u.current,d=s.offsetHeight;t(c),requestAnimationFrame(()=>{if(!s||!m.current){a(!1);return}let h=m.current.offsetHeight;s.animate([{height:`${d}px`},{height:`${h}px`}],{duration:n,easing:e,fill:"forwards"}).addEventListener("finish",()=>{a(!1)})})},[l,r,n,e]),f=ae(()=>{t(o),a(!1)},[o]);return{currentView:l,isAnimating:r,containerRef:u,currentViewRef:m,handleViewChange:p,resetView:f}}import{createContext as pn,useCallback as fn,useContext as hn,useEffect as de,useMemo as Eo,useState as _o}from"react";import{useEffect as mn}from"react";var ue=["--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-assetSelectItemBackground","--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","--color-defaultIconBackground","--font-body","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-assetSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],ce=(o,n)=>{mn(()=>{if(typeof window>"u")return;let e=document.documentElement;o.type==="complete"&&o.completeTheme?(Object.entries(o.completeTheme.colors).forEach(([l,t])=>{t&&e.style.setProperty(`--color-${l}`,t)}),Object.entries(o.completeTheme.fonts).forEach(([l,t])=>{t&&e.style.setProperty(`--font-${l}`,t)}),Object.entries(o.completeTheme.radii).forEach(([l,t])=>{t&&e.style.setProperty(`--radius-${l}`,t)}),Object.entries(o.completeTheme.shadows).forEach(([l,t])=>{t&&e.style.setProperty(`--shadow-${l}`,t)}),Object.entries(o.completeTheme.blurs).forEach(([l,t])=>{t&&e.style.setProperty(`--blur-${l}`,t)}),e.removeAttribute("data-theme")):o.type==="partial"&&o.partialOverrides?(e.setAttribute("data-theme",n),Object.keys(o.partialOverrides).length>0&&(ue.forEach(t=>{e.style.removeProperty(t)}),o.partialOverrides.colors&&Object.entries(o.partialOverrides.colors).forEach(([t,r])=>{r&&e.style.setProperty(`--color-${t}`,r)}),o.partialOverrides.fonts&&Object.entries(o.partialOverrides.fonts).forEach(([t,r])=>{r&&e.style.setProperty(`--font-${t}`,r)}),o.partialOverrides.radii&&Object.entries(o.partialOverrides.radii).forEach(([t,r])=>{r&&e.style.setProperty(`--radius-${t}`,r)}),o.partialOverrides.shadows&&Object.entries(o.partialOverrides.shadows).forEach(([t,r])=>{r&&e.style.setProperty(`--shadow-${t}`,r)}),o.partialOverrides.blurs&&Object.entries(o.partialOverrides.blurs).forEach(([t,r])=>{r&&e.style.setProperty(`--blur-${t}`,r)}))):(e.setAttribute("data-theme",n),ue.forEach(l=>{e.style.removeProperty(l)}))},[o,n])};import{jsx as vn}from"react/jsx-runtime";var Ho="luno.lastThemePreference",xn=o=>{try{localStorage.setItem(Ho,JSON.stringify(o))}catch{}},me=pn(void 0),Do=o=>"colors"in o&&"fonts"in o&&"radii"in o&&"shadows"in o&&"blurs"in o,gn=()=>{let[o,n]=_o(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return de(()=>{if(typeof window>"u")return;let e=window.matchMedia("(prefers-color-scheme: dark)"),l=t=>{n(t.matches?"dark":"light")};return l(e),e.addEventListener("change",l),()=>e.removeEventListener("change",l)},[]),o},Fo=({children:o,theme:n})=>{let e=gn(),[l,t]=_o(()=>{if(typeof window<"u")try{let s=localStorage.getItem(Ho);if(s){let d=JSON.parse(s);if(d?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(d?.preferredTheme)return d.preferredTheme}}catch{}return!n||Do(n)?"light":n.defaultMode||"light"}),[r,a]=_o(()=>{if(typeof window<"u")try{let s=localStorage.getItem(Ho);if(s)return JSON.parse(s)?.isAuto??!1}catch{}return!n||Do(n)?!1:n.autoMode??!1}),u=Eo(()=>{if(!n)return{type:"default",completeTheme:null,partialOverrides:null};if(Do(n))return{type:"complete",completeTheme:n,partialOverrides:null};let c=n;if(c.theme)return{type:"complete",completeTheme:c.theme,partialOverrides:null};let s=null;return l==="light"&&c.light?s=c.light:l==="dark"&&c.dark?s=c.dark:s={...c},{type:"partial",completeTheme:null,partialOverrides:s}},[l,n]),m=Eo(()=>u.type==="complete"?u.completeTheme:null,[u]);ce(u,l);let p=fn(c=>{let s=c==="auto";a(s),t(s?e||"light":c);let d={isAuto:s,...s?{}:{preferredTheme:c}};xn(d)},[e]);de(()=>{r&&t(e||"light")},[e,r]);let f=Eo(()=>({themeMode:l,setThemeChoice:p,currentTheme:m}),[l,p,m]);return vn(me.Provider,{value:f,children:o})},uo=()=>{let o=hn(me);if(!o)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return o};import{LunoProvider as Tn}from"@luno-kit/react";import{ConnectionStatus as co,useStatus as wn}from"@luno-kit/react";import{createContext as Cn,useCallback as $o,useContext as mo,useEffect as bn,useMemo as yn,useState as kn}from"react";import{jsx as Sn}from"react/jsx-runtime";function Go(){let[o,n]=kn(!1),e=$o(()=>n(!0),[]),l=$o(()=>n(!1),[]);return{isOpen:o,open:e,close:l}}var X=Cn(void 0),pe=({children:o})=>{let{isOpen:n,open:e,close:l}=Go(),{isOpen:t,open:r,close:a}=Go(),{isOpen:u,open:m,close:p}=Go(),f=wn(),c=$o(()=>{l(),a(),p()},[l,a,p]);bn(()=>{f===co.Disconnected&&(a(),p())},[f,a,p]);let s=yn(()=>({isConnectModalOpen:n,isAccountModalOpen:t,isChainModalOpen:u,openConnectModal:f!==co.Connected?e:void 0,closeConnectModal:l,openAccountModal:f===co.Connected?r:void 0,closeAccountModal:a,openChainModal:f===co.Connected?m:void 0,closeChainModal:p,closeAllModals:c}),[n,e,l,t,r,a,u,m,p,c,f]);return Sn(X.Provider,{value:s,children:o})},Y=()=>{let o=mo(X);if(!o)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:o.isConnectModalOpen,open:o.openConnectModal,close:o.closeConnectModal}},oo=()=>{let o=mo(X);if(!o)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:o.isAccountModalOpen,open:o.openAccountModal,close:o.closeAccountModal}},eo=()=>{let o=mo(X);if(!o)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:o.isChainModalOpen,open:o.openChainModal,close:o.closeChainModal}},Nn=()=>{let o=mo(X);if(!o)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return o.closeAllModals};import{Fragment as An,jsx as Z,jsxs as fe}from"react/jsx-runtime";var dr=({children:o,config:n,theme:e,appInfo:l})=>Z(Tn,{config:n,children:Z(Fo,{theme:e,children:fe(pe,{children:[Z("div",{children:o}),Z(Mn,{appInfo:l,modalSize:n.modalSize,modalContainer:n.modalContainer})]})})}),Mn=({modalSize:o,appInfo:n,modalContainer:e})=>fe(An,{children:[Z(ge,{size:o,appInfo:n,container:e}),Z(he,{container:e}),Z(xe,{container:e})]});import{clsx as In}from"clsx";import{extendTailwindMerge as Vn}from"tailwind-merge";var Pn=Vn({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function i(...o){return Pn(In(o))}function ve(o,n){let e;return()=>{e&&clearTimeout(e),e=setTimeout(()=>{e=null,o()},n)}}import{useCallback as Rn,useState as Ln}from"react";import{jsx as we,jsxs as Bn}from"react/jsx-runtime";var po=({copyText:o,label:n,className:e=""})=>{let[l,t]=Ln(!1),r=Rn(async a=>{try{return navigator.clipboard?.writeText?(await navigator.clipboard.writeText(a),t(!0),setTimeout(()=>t(!1),2e3),!0):!1}catch(u){return console.error("Copy failed:",u),!1}},[]);return Bn("button",{type:"button",className:i("luno:cursor-pointer luno:bg-transparent luno:border-none luno:p-1 luno:m-0 luno:inline-flex luno:items-center luno:justify-center luno:gap-1","luno:rounded-modalControlButton luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200",e),onClick:()=>!l&&o&&r(o),"aria-label":"Copy address to clipboard",disabled:l,children:[l?we(Bo,{className:"luno:text-accentColor",width:16,height:16}):we(Mo,{width:16,height:16}),n]})};import*as M from"@radix-ui/react-dialog";import fo from"react";import{jsx as Ce,jsxs as _n}from"react/jsx-runtime";var On=({open:o,onOpenChange:n,children:e,contentClassName:l,overlayClassName:t,container:r})=>{let a=fo.useMemo(()=>{if(r)return typeof r=="function"?r():r},[r]);return Ce(M.Root,{open:o,onOpenChange:n,children:_n(M.Portal,{container:a,children:[fo.createElement(M.Overlay,{className:i("luno:fixed luno:inset-0 luno:backdrop-blur-modalOverlay luno:z-[100] luno:bg-modalBackdrop luno-kit","luno:data-[state=open]:[animation:overlay-in_150ms_ease-out]",t)}),Ce(M.Content,{className:i("luno-kit luno:font-body luno:fixed luno:z-[200] luno:text-modalText luno:text-base luno:leading-base","luno:bg-modalBackground luno:shadow-modal luno:focus:outline-none luno:overflow-hidden luno:border luno:border-modalBorder","luno:transition-all luno:duration-200","luno:rounded-t-modalMobile luno:bottom-0 luno:left-0 luno:w-full","luno:translate-y-0 luno:-translate-x-0","luno:data-[state=open]:[animation:slide-up_200ms_ease-out]","luno:md:bottom-auto luno:md:left-1/2 luno:md:top-1/2 luno:md:-translate-x-1/2 luno:md:-translate-y-1/2","luno:md:w-auto luno:md:rounded-modal","luno:md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",l),children:e})]})})},En=({children:o,className:n})=>fo.createElement(M.Title,{className:n},o),Dn=({children:o,className:n,onClick:e})=>fo.createElement(M.Close,{className:n,onClick:e},o),z=On,E=Dn,D=En;import{useState as Xn}from"react";import{useAccount as zn,useChain as Un}from"@luno-kit/react";import Ne,{useMemo as Se,useState as ke}from"react";import{useAccount as Hn,useChain as Fn,useConfig as Gn}from"@luno-kit/react";import{formatBalance as ho}from"@luno-kit/react/utils";import{useQuery as $n}from"@tanstack/react-query";var Zn=async({apiUrl:o,apiKey:n,address:e})=>{try{let l=await fetch(`${o}/api/scan/account/tokens`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":n},body:JSON.stringify({address:e})});if(!l.ok)throw new Error(`Subscan API error: ${l.status}`);let t=await l.json();if(t.code!==0)throw new Error(`Subscan API error: ${t.message}`);let r=t.data.assets||[],a=t.data.native||[],u=t.data.builtin||[],m=r.filter(s=>s.token_image||s.unique_id?.includes("nft")).map(s=>({balance:s.balance,decimals:s.decimals,balanceFormatted:ho(s.balance,s.decimals),logoURI:s.token_image,symbol:s.symbol,assetId:s.asset_id,price:s.price})),p=r.filter(s=>!s.token_image&&!s.unique_id?.includes("nft")).map(s=>({balance:s.balance,decimals:s.decimals,balanceFormatted:ho(s.balance,s.decimals,4),logoURI:s.token_image,symbol:s.symbol,assetId:s.asset_id,price:s.price})),f=a.map(s=>({balance:s.balance,decimals:s.decimals,balanceFormatted:ho(s.balance,s.decimals,4),logoURI:"",symbol:s.symbol,assetId:0,price:s.price})),c=u.map(s=>({balance:s.balance,decimals:s.decimals,balanceFormatted:ho(s.balance,s.decimals,4),logoURI:"",symbol:s.symbol,assetId:s.unique_id,price:s.price}));return{nfts:[...m],tokens:[...f,...p,...c]}}catch(l){throw console.error("Failed to fetch tokens from Subscan:",l),l}};function U(){let{address:o}=Hn(),n=Gn(),{chain:e}=Fn(),l=e?.subscan?.api,t=n?.subscan?.apiKey;return $n({queryKey:["subscan","asset-list",o,e?.genesisHash,l,t],queryFn:()=>Zn({address:o,apiKey:t,apiUrl:l}),enabled:!!o&&!!t&&!!l,staleTime:n?.subscan?.cacheTime||6e4})}import{jsx as be,jsxs as ye}from"react/jsx-runtime";var xo=({type:o})=>ye("div",{className:"luno:flex luno:flex-col luno:gap-1 luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center",children:[be(Vo,{className:"luno:w-[38px] luno:h-[38px] luno:mb-2"}),ye("div",{className:"luno:text-modalText luno:text-base luno:leading-base",children:["No ",o," found"]}),be("div",{className:"luno:text-sm luno:text-modalTextSecondary luno:max-w-[260px]",children:"Switch to a different network or account to view more assets"})]});import{jsx as b,jsxs as no}from"react/jsx-runtime";var Te=Ne.memo(()=>{let{data:o,isFetching:n,error:e}=U(),l=Se(()=>o?o.nfts:[],[o]);return n?b("div",{className:"luno:flex luno:justify-center luno:w-full",children:b("div",{className:"luno:flex luno:flex-wrap luno:justify-between luno:max-w-[350px] luno:w-full luno:min-h-[300px] luno:gap-y-4",children:[1,2,3,4].map(t=>b("div",{className:"luno:animate-pulse luno:bg-skeleton luno:w-[155px] luno:h-[198px] luno:rounded-assetSelectItem"},`skeleton-${t}`))})}):e?no("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center luno:p-4",children:[b("div",{className:"luno:text-error luno:mb-2",children:"Failed to load assets"}),b("div",{className:"luno:text-modalTextSecondary luno:text-sm",children:e instanceof Error?e.message:"Unknown error"})]}):l.length?b("div",{className:"luno:flex luno:justify-center luno:w-full",children:b("div",{className:"luno:flex luno:flex-wrap luno:justify-between luno:max-w-[350px] luno:w-full luno:gap-y-4",children:l.map(t=>b(jn,{asset:t},`${t.symbol}-${t.balance}`))})}):b(xo,{type:"NFTs"})}),jn=Ne.memo(({asset:o})=>{let{chain:n}=Un(),{address:e}=zn(),[l,t]=ke(!!o.logoURI),[r,a]=ke(o.logoURI),u=Se(()=>n?.subscan?.url?`${n.subscan.url.endsWith("/")?n.subscan.url.slice(0,-1):n.subscan.url}/nft_item?collection_id=${o.assetId}&address=${e}`:"",[n,o,e]);return b("div",{className:i("luno:w-[155px] luno:h-[198px] luno:flex luno:items-center luno:p-2.5 luno:rounded-assetSelectItem luno:cursor-default","luno:bg-assetSelectItemBackground","luno:transition-colors luno:duration-200"),children:no("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center",children:[no("div",{className:"luno:relative luno:w-[135px] luno:h-[135px] luno:flex luno:items-center luno:justify-center luno:rounded-[6px] luno:overflow-hidden",children:[l&&b("div",{className:"luno:absolute luno:inset-0 luno:flex luno:items-center luno:justify-center luno:animate-pulse luno:bg-gray-500",children:b("div",{className:"luno:w-4 luno:h-4 luno:border-2 luno:border-t-transparent luno:border-white luno:rounded-full luno:animate-spin"})}),r?b("img",{src:r,alt:`${o.symbol}-NFT`,className:i("luno:w-full luno:h-full luno:object-cover",l?"luno:opacity-0":"luno:opacity-100 luno:transition-opacity luno:duration-200"),onLoad:()=>t(!1),onError:()=>{t(!1),a("")}}):b(Ao,{className:"luno:w-full luno:h-full luno:object-cover"})]}),no("div",{className:"luno:flex luno:items-center luno:justify-between luno:w-full luno:mt-0.5",children:[no("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:[o.balance||"-"," NFTs"]}),b("button",{className:"luno:cursor-pointer luno:bg-transparent luno:border-none luno:p-1 luno:m-0 luno:inline-flex luno:items-center luno:justify-center luno:gap-1 luno:rounded-modalControlButton luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200",onClick:()=>u&&window.open(u),children:b(Po,{})})]}),b("div",{className:"luno:w-full luno:text-left luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap luno:max-w-[135px] luno:overflow-hidden luno:text-ellipsis",children:o.symbol||o.assetId})]})})});import zo,{useMemo as Kn}from"react";import{useMemo as Wn,useState as Me}from"react";import{jsx as Zo,jsxs as Qn}from"react/jsx-runtime";var _=({iconUrl:o,resourceName:n,className:e})=>{let[l,t]=Me(!!o),[r,a]=Me(!1),u=Wn(()=>{if(!n)return"-";let m=n.match(/^([^-]+)-/);return m?.[1]?m[1].charAt(0).toUpperCase():n.charAt(0).toUpperCase()},[n]);return o&&!r?Qn("div",{className:i("luno:relative luno:w-full luno:h-full",e),children:[l&&Zo("div",{className:"luno:absolute luno:inset-0 luno:flex luno:items-center luno:justify-center luno:rounded-full luno:animate-pulse luno:bg-skeleton"}),Zo("img",{src:o,alt:n||"icon",className:i("luno:w-full luno:h-full luno:object-cover luno:rounded-full",l?"luno:opacity-0":"luno:opacity-100 luno:transition-opacity luno:duration-200"),onLoad:()=>t(!1),onError:()=>{t(!1),a(!0)}})]}):Zo("div",{className:i("luno:w-full luno:h-full luno:text-white luno:font-semibold","luno:flex luno:items-center luno:justify-center luno:rounded-full luno:bg-defaultIconBackground",e),children:u})};import{jsx as I,jsxs as j}from"react/jsx-runtime";var qn=o=>`https://raw.githubusercontent.com/Luno-lab/luno-assets/refs/heads/main/assets/tokens/${o?.toLowerCase().trim()||""}.webp`,Ae=zo.memo(()=>{let{data:o,error:n,isFetching:e}=U(),l=Kn(()=>o?[...o.tokens].sort((t,r)=>{let a=t.price?parseFloat(t.balance)/10**t.decimals*parseFloat(t.price):0;return(r.price?parseFloat(r.balance)/10**r.decimals*parseFloat(r.price):0)-a}):[],[o]);return e?I("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:min-h-[300px]",children:[1,2,3,4,5].map(t=>I("div",{className:"luno:animate-pulse luno:bg-skeleton luno:h-[54px] luno:rounded-assetSelectItem"},`skeleton-${t}`))}):n?j("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center luno:p-4",children:[I("div",{className:"luno:text-error luno:mb-2",children:"Failed to load assets"}),I("div",{className:"luno:text-modalTextSecondary luno:text-sm",children:n instanceof Error?n.message:"Unknown error"})]}):l.length?I("div",{className:"luno:flex luno:flex-col luno:gap-1.5",children:l.map(t=>I(Jn,{asset:t},`${t.symbol}-${t.assetId}`))}):I(xo,{type:"Tokens"})}),Jn=zo.memo(({asset:o})=>{let n=o.logoURI||qn(o.symbol),e=zo.useMemo(()=>{if(!o.price)return null;let l=parseFloat(o.balance)/10**o.decimals,t=parseFloat(o.price);return`$${(l*t).toFixed(2)}`},[o.balance,o.decimals,o.price]);return j("div",{role:"listitem",className:i("luno:flex luno:items-center luno:justify-between luno:p-2.5 luno:rounded-assetSelectItem luno:cursor-default","luno:bg-assetSelectItemBackground","luno:transition-colors luno:duration-200"),children:[j("div",{className:"luno:flex luno:items-center luno:gap-2",children:[I(_,{className:"luno:w-[30px] luno:h-[30px] luno:flex luno:items-center luno:justify-center",iconUrl:n,resourceName:`${o.symbol}-token`}),j("div",{className:"luno:flex luno:flex-col luno:items-start",children:[I("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:o.symbol||"Unknown"}),I("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap",children:o.balanceFormatted})]})]}),o.price&&j("div",{className:"luno:flex luno:flex-col luno:items-end",children:[I("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:e}),j("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap",children:["$",o.price]})]})]})});import{jsx as to,jsxs as ot}from"react/jsx-runtime";var Yn=[{key:"Tokens",label:"Tokens"},{key:"NFTs",label:"NFTs"}],Ie=()=>{let[o,n]=Xn("Tokens");return ot("div",{className:i("luno:flex luno:flex-col luno:gap-3.5 luno:p-4 luno:pt-0"),children:[to("div",{className:i("luno:flex luno:items-center luno:gap-1.5 luno:w-full"),children:Yn.map(e=>to("button",{onClick:()=>n(e.key),className:i("luno:px-3.5 luno:flex luno:items-center luno:justify-center luno:cursor-pointer luno:min-w-[48px] luno:min-h-[24px] luno:rounded-networkSelectItem luno:text-[12px] luno:leading-[16px] luno:font-medium luno:transition-colors",o===e.key?"luno:bg-navigationButtonBackground luno:text-modalText":"luno:bg-transparent text-modalTextSecondary luno:hover:text-modalText"),children:e.label},e.key))}),to("div",{className:i("luno:overflow-y-auto luno:flex-1 luno:min-h-[350px] luno:max-h-[350px]"),children:o==="Tokens"?to(Ae,{}):to(Te,{})})]})};import{jsx as Ve}from"react/jsx-runtime";var go=()=>Ve("div",{className:"luno:relative",children:Ve(Ie,{})});go.title="View Assets";import{useAccount as et,useBalance as nt,useChain as tt,useChains as lt,useConfig as rt,useDisconnect as at}from"@luno-kit/react";import{getExplorerUrl as st}from"@luno-kit/react/utils";import{useMemo as it}from"react";import{Fragment as Uo,jsx as w,jsxs as L}from"react/jsx-runtime";var Re=({onViewChange:o,onModalClose:n})=>{let{address:e}=et(),{chain:l}=tt(),t=lt(),{disconnectAsync:r}=at(),{data:a}=nt({address:t.length>0?e:void 0}),u=rt(),{refetch:m}=U(),p=it(()=>{let c={key:"Chain Name",content:L("div",{className:"luno:flex luno:items-stretch luno:w-full luno:justify-between",children:[L("div",{className:"luno:flex luno:items-center luno:gap-2",children:[w("div",{className:"luno:relative",children:w(_,{className:"luno:w-[24px] luno:h-[24px]",iconUrl:l?.chainIconUrl,resourceName:`${l?.name}-chain`})}),L("div",{className:"luno:flex luno:flex-col luno:items-start",children:[w("span",{className:"luno:text-base luno:leading-base luno:text-modalText",children:l?.name||"Polkadot"}),a?L("span",{className:"luno:text-modalTextSecondary luno:text-xs luno:leading-xs",children:[a.formattedTransferable||"0.00"," ",l?.nativeCurrency?.symbol||"DOT"]}):w("span",{className:"luno:animate-pulse luno:rounded luno:w-[80px] luno:h-[16px] luno:bg-skeleton"})]})]}),w("div",{className:"luno:flex luno:items-center luno:justify-center",children:w(So,{className:"luno:w-[16px] luno:h-[16px] luno:text-modalTextSecondary"})})]}),onClick:()=>o("switchChain")},s={key:"Switch Account",content:L(Uo,{children:[w(Oo,{className:"luno:w-[24px] luno:h-[24px]"}),w("span",{className:"luno:text-base luno:text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>o("switchAccount")},d={key:"View Assets",content:L(Uo,{children:[w(To,{className:"luno:w-[24px] luno:h-[24px]"}),w("span",{className:"luno:text-base luno:text-accountActionItemText",children:"View Assets"})]}),onClick:()=>{o("assetList"),m()}},h={key:"View on Explorer",content:L(Uo,{children:[w(Ro,{className:"luno:w-[24px] luno:h-[24px]"}),w("span",{className:"luno:text-base luno:text-accountActionItemText luno:font-medium",children:"View on Explorer"})]}),onClick:()=>window.open(st(l?.blockExplorers?.default?.url,e,"address"))};return t.length===0?[s]:u?.subscan?.apiKey?[c,h,d,s]:[c,h,s]},[o,l,e,a,t,u]),f=async()=>{await r(),n()};return L("div",{className:"luno:flex luno:flex-col luno:items-center luno:gap-3 luno:w-full",children:[w("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:w-full luno:px-4",children:p.map(c=>w(Pe,{onClick:c.onClick,children:c.content},c.key))}),w("div",{className:"luno:w-full luno:mx-[-100px] luno:h-[1px] luno:bg-separatorLine"}),w("div",{className:"luno:w-full luno:px-4 luno:pb-4",children:L(Pe,{onClick:f,children:[w(Io,{}),w("span",{className:"luno:text-base luno:text-accountActionItemText ",children:"Disconnect"})]})})]})},Pe=({children:o,onClick:n})=>w("button",{type:"button",onClick:()=>n?.(),className:i("luno:w-full luno:p-2.5 luno:rounded-accountActionItem luno:border-none luno:text-left luno:flex luno:items-center luno:gap-2 luno:font-medium","luno:bg-accountActionItemBackground luno:hover:bg-accountActionItemBackgroundHover","luno:transition-colors luno:duration-200",n?"luno:cursor-pointer":"luno:cursor-auto"),"aria-label":typeof o=="string"?o:void 0,children:o});import{useAccount as ut,useAccounts as ct,useActiveConnector as dt,useBalance as mt,useChain as pt,useChains as ft}from"@luno-kit/react";import{formatAddress as ht}from"@luno-kit/react/utils";import xt,{useCallback as gt}from"react";import{jsx as H,jsxs as vo}from"react/jsx-runtime";var wo=({onBack:o})=>{let{accounts:n,selectAccount:e}=ct(),{address:l}=ut(),t=gt(r=>{e(r),o()},[o]);return H("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:overflow-auto luno:max-h-[400px] luno:no-scrollbar luno:p-4 luno:pt-0",children:n.map(r=>H(vt,{account:r,isSelected:r.address===l,selectAccount:t},r.address))})};wo.title="Switch Account";var vt=xt.memo(({isSelected:o,account:n,selectAccount:e})=>{let{chain:l}=pt(),t=ft(),r=n.address,{data:a}=mt({address:t.length>0?r:void 0}),u=dt();return vo("button",{type:"button",onClick:()=>e(n),className:i("luno:px-3.5 luno:py-2.5 luno:w-full luno:rounded-accountSelectItem luno:border-none","luno:bg-accountSelectItemBackground","luno:text-left luno:flex luno:items-center luno:justify-between luno:gap-2","luno:transition-colors luno:duration-200",o?"luno:cursor-auto":"luno:cursor-pointer luno:hover:bg-accountSelectItemBackgroundHover"),"aria-label":n.name||r,disabled:o,children:[vo("div",{className:"luno:flex luno:items-center luno:gap-2 luno:grow luno:overflow-hidden",children:[H("div",{className:"luno:shrink-0 luno:w-[24px] luno:h-[24px] luno:rounded-full luno:flex luno:items-center luno:justify-center",children:u?.icon&&H("img",{src:u?.icon,alt:"luno account"})}),vo("div",{className:"luno:flex luno:flex-col luno:items-start luno:overflow-hidden",children:[H("span",{className:"luno:whitespace-nowrap luno:max-w-full luno:text-ellipsis luno:overflow-hidden luno:font-medium luno:text-sm luno:leading-sm luno:text-accountSelectItemText",children:n.name||ht(r)}),t.length>0&&(a?vo("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium",children:[a?.formattedTransferable||"0.00"," ",l?.nativeCurrency?.symbol||"DOT"]}):H("span",{className:"luno:animate-pulse luno:rounded luno:w-[60px] luno:h-[16px] luno:bg-skeleton"}))]})]}),o&&H("div",{className:"luno:shrink-0 luno:border-[1px] luno:border-solid luno:border-accentColor luno:rounded-full luno:overflow-hidden luno:flex luno:items-center luno:justify-center luno:w-[18px] luno:h-[18px]",children:H("div",{className:"luno:rounded-full luno:bg-accentColor luno:w-[10px] luno:h-[10px]"})})]})});import{useApi as wt,useChain as Ct,useChains as bt,useSwitchChain as yt}from"@luno-kit/react";import kt,{useMemo as Nt,useState as Le}from"react";import{Fragment as Tt,jsx as N,jsxs as W}from"react/jsx-runtime";var Co=({onChainSwitched:o,className:n=""})=>{let{chain:e}=Ct(),l=bt(),{switchChainAsync:t}=yt(),{isApiReady:r,apiError:a}=wt(),[u,m]=Le(null),[p,f]=Le(""),c=Nt(()=>l.filter(d=>p.trim()?d.name.toLowerCase().includes(p.toLowerCase()):!0),[l,p]),s=async d=>{if(d.genesisHash!==e?.genesisHash&&!(!r&&!a)){m(d.genesisHash);try{await t({chainId:d.genesisHash}),o?.(d)}catch(h){console.error("Failed to switch chain:",h)}finally{m(null)}}};return W("div",{className:i("luno:flex luno:flex-col luno:gap-3.5",n),children:[N("div",{className:"luno:relative luno:pt-1",children:W("div",{className:"luno:relative",children:[N(Lo,{className:"luno:absolute luno:left-3 luno:top-1/2 luno:transform luno:-translate-y-1/2 luno:w-4 luno:h-4 luno:text-modalTextSecondary"}),N("input",{type:"text",placeholder:"Search by name",value:p,onChange:d=>f(d.target.value),className:"luno:w-full luno:pl-10 luno:pr-3 luno:py-2 luno:text-sm luno:border luno:border-networkSelectItemBackgroundHover luno:rounded-md luno:focus:ring-2 luno:focus:ring-accentColor luno:focus:outline-none luno:focus:border-transparent"})]})}),c.length>0&&N("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:overflow-y-auto luno:max-h-[380px]",children:c.map(d=>N(St,{chain:d,isSelected:d.genesisHash===e?.genesisHash,onSelect:s,isLoading:(u===d.genesisHash||!r)&&!a,isSwitching:u===d.genesisHash},d.genesisHash))}),c.length===0&&N("div",{className:"luno:flex luno:items-center luno:justify-center luno:py-12",children:N("span",{className:"luno:text-modalTextSecondary luno:text-xs",children:"No chains available"})})]})},St=kt.memo(({chain:o,isSelected:n,isLoading:e,onSelect:l,isSwitching:t})=>W("button",{onClick:()=>l(o),disabled:n||e,className:i("luno:flex luno:items-center luno:justify-between luno:p-2.5 luno:rounded-networkSelectItem","luno:bg-networkSelectItemBackground","luno:transition-colors luno:duration-200",n||e?"luno:cursor-default":"luno:cursor-pointer luno:hover:bg-networkSelectItemBackgroundHover",e&&"luno:opacity-80"),children:[W("div",{className:"luno:flex luno:items-center luno:gap-2",children:[N(_,{className:"luno:w-[20px] luno:h-[20px] luno:flex luno:items-center luno:justify-center luno:leading-[20px]",iconUrl:o?.chainIconUrl,resourceName:`${o?.name}-chain`}),N("div",{className:"luno:flex luno:flex-col luno:items-start",children:N("span",{className:"luno:font-medium luno:text-base luno:text-modalText",children:o.name})})]}),N("div",{className:"luno:flex luno:items-center luno:justify-center luno:h-[20px]",children:n?e?W(Tt,{children:[N("span",{className:"luno:text-accentColor luno:text-xs luno:leading-xs luno:mr-1.5",children:t?"Switching":"Connecting"}),N("div",{className:"luno-loading luno:text-accentColor luno:w-[15px] luno:h-[15px]"})]}):W("span",{className:"luno:relative luno:flex luno:w-[10px] luno:h-[10px]",children:[N("span",{className:"luno:[animation:ping_1.2s_cubic-bezier(0,0,0.2,1)_infinite] luno:absolute luno:top-[0] luno:left-[0] luno:inline-flex luno:h-full luno:w-full luno:rounded-full luno:bg-accentColor"}),N("span",{className:"luno:relative luno:inline-flex luno:rounded-full luno:h-full luno:w-full luno:bg-accentColor"})]}):null})]}));import{jsx as Mt}from"react/jsx-runtime";var bo=({onBack:o})=>Mt(Co,{className:"luno:p-4 luno:pt-0"});bo.title="Select Networks";import{Fragment as Rt,jsx as C,jsxs as Q}from"react/jsx-runtime";var he=({container:o})=>{let{isOpen:n,close:e}=oo(),{address:l,account:t}=At(),r=It(),{currentView:a,containerRef:u,currentViewRef:m,handleViewChange:p,resetView:f}=io({initialView:"main"}),c=Pt(()=>{e(),f()},[e]),s=Be(()=>a==="switchAccount"?wo.title:a==="switchChain"?bo.title:a==="assetList"?go.title:null,[a]),d=Be(()=>({main:C(Re,{onViewChange:p,onModalClose:c}),switchAccount:C(wo,{onBack:()=>p("main")}),switchChain:C(bo,{onBack:()=>p("main")}),assetList:C(go,{})}),[p,c]);return C(z,{open:n,onOpenChange:c,container:o,children:Q("div",{className:i("luno:flex luno:flex-col luno:w-full luno:md:w-[360px] luno:max-h-[512px] luno:text-modalText","luno:bg-modalBackground luno:shadow-modal",a==="main"?"luno:gap-5":"luno:gap-3.5"),children:[Q("div",{className:i("luno:flex luno:items-stretch luno:justify-between luno:w-full luno:px-4 luno:pt-4"),children:[a==="main"?Q("div",{className:i("luno:flex luno:items-center luno:gap-3 luno:max-w-[80%]"),children:[r?.icon&&C("div",{className:i("luno:flex luno:items-center luno:justify-center luno:w-[40px] luno:h-[40px] luno:shrink-0"),children:C("img",{src:r.icon,alt:"luno",className:i("luno:w-full luno:h-full luno:object-contain")})}),Q("div",{className:i("luno:flex luno:flex-col luno:items-start luno:gap-1.5 luno:max-w-full"),children:[C(D,{className:"luno:sr-only",children:"Account Details"}),Q("div",{className:i("luno:flex luno:items-center luno:gap-0.5 luno:w-full"),children:[C("span",{className:i("luno:text-base luno:text-modalText luno:font-semibold"),children:Vt(l)}),C(po,{copyText:l})]}),C("div",{className:i("luno:text-sm luno:leading-sm luno:text-modalTextSecondary luno:font-medium luno:text-ellipsis luno:overflow-hidden luno:whitespace-nowrap",t?.name&&t?.name.length>30?"luno:w-[90%]":""),children:t?.name||r?.name})]})]}):Q(Rt,{children:[C("button",{className:i("luno:flex luno:items-center luno:justify-center luno:w-[30px] luno:h-[30px] luno:cursor-pointer luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200"),onClick:()=>p("main"),"aria-label":"Back",children:C(q,{})}),C(D,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300"),children:s})]}),C(E,{className:i("luno:shrink-0 luno:z-10 luno:flex luno:items-center luno:justify-center luno:h-[30px] luno:w-[30px] luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200 luno:cursor-pointer"),children:C(R,{})})]}),C("div",{ref:u,className:i("luno:relative"),children:C("div",{ref:m,children:d[a]})})]})})};import{jsx as K,jsxs as Oe}from"react/jsx-runtime";var xe=({container:o})=>{let{isOpen:n,close:e}=eo();return K(z,{container:o,open:n,onOpenChange:l=>!l&&e(),children:Oe("div",{className:"luno:flex luno:flex-col luno:w-full luno:md:w-[360px] luno:max-h-[512px] luno:p-4 luno:gap-3.5 luno:text-modalText",children:[Oe("div",{className:"luno:flex luno:items-center luno:justify-between luno:w-full",children:[K("div",{className:"luno:w-[30px]"})," ",K(D,{className:"luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300",children:"Select Network"}),K(E,{className:"luno:z-10 luno:flex luno:items-center luno:justify-center luno:h-[30px] luno:w-[30px] luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200 luno:cursor-pointer",children:K(R,{})})]}),K(Co,{})]})})};import{formatAddress as Gt}from"@luno-kit/react/utils";import{ConnectionStatus as yo,useAccount as Lt,useActiveConnector as Bt,useBalance as Ot,useChain as Et,useChains as Dt,useStatus as _t}from"@luno-kit/react";function Ee(){let o=_t(),{account:n,address:e}=Lt(),{chain:l}=Et(),t=Dt(),{data:r}=Ot({address:t.length>0?e:void 0}),a=Bt(),{open:u,isOpen:m}=Y(),{open:p,isOpen:f}=oo(),{open:c,isOpen:s}=eo(),d=o===yo.Connecting,h=o===yo.Connected,v=o===yo.Disconnected||o===yo.Disconnecting,x=!!l&&t.some(V=>V.genesisHash.toLowerCase()===l.genesisHash.toLowerCase());return{activeConnector:a,connectionStatus:o,isConnected:h,isDisconnected:v,isConnecting:d,account:n,address:e,currentChain:l,configuredChains:t,isChainSupported:x,chainIconUrl:l?.chainIconUrl,chainName:l?.name,balance:r,openConnectModal:u,openAccountModal:p,openChainModal:c,isConnectModalOpen:m,isAccountModalOpen:f,isChainModalOpen:s}}import{useEffect as Ht,useState as Ft}from"react";var ko=()=>{let[o,n]=Ft({height:void 0,width:void 0});return Ht(()=>{let e=ve(()=>{n({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),o};import{jsx as F,jsxs as lo}from"react/jsx-runtime";var ro="luno:transition-transform luno:transition-[125] luno:hover:scale-[1.03] luno:transition-ease",$t=({className:o,label:n="Connect Wallet",accountStatus:e="full",chainStatus:l="full",showBalance:t=!0,displayPreference:r="address"})=>{let{isConnected:a,isDisconnected:u,account:m,balance:p,openConnectModal:f,openAccountModal:c,openChainModal:s,chainIconUrl:d,chainName:h,currentChain:v,configuredChains:x,activeConnector:V}=Ee(),{width:O}=ko(),S=O&&O>768;return u||!a||!V?F("button",{type:"button",onClick:()=>f?.(),className:i("luno-kit luno:cursor-pointer luno:font-semibold luno:inline-flex luno:items-center luno:justify-center luno:focus:outline-none","luno:text-connectButtonText luno:bg-connectButtonBackground luno:shadow-button luno:active:scale-[0.95]","luno:rounded-connectButton",ro,"luno:px-3.5 luno:text-base luno:leading-base luno:min-h-[40px]",o),children:n}):lo("div",{className:i("luno-kit luno:text-modalText luno:flex luno:items-stretch luno:bg-transparent luno:font-semibold luno:text-base luno:leading-base luno:gap-3",o),children:[l!=="none"&&x.length>0&&lo("button",{type:"button",onClick:()=>s?.(),className:i("luno:flex luno:items-center luno:rounded-currentNetworkButton luno:cursor-pointer","luno:bg-currentNetworkButtonBackground luno:shadow-button","luno:py-2 luno:px-2.5 luno:gap-1.5",ro),"aria-label":"Switch chain",children:[l==="full"||l==="icon"?F(_,{iconUrl:d,resourceName:`${h}-chain`,className:i("luno:w-[24px] luno:h-[24px]")}):null,(l==="full"||l==="name")&&S&&F("span",{children:v?.name||"Unknown Chain"})]}),lo("button",{type:"button",onClick:()=>c?.(),className:i("luno:flex luno:items-center luno:cursor-pointer luno:rounded-connectButton luno:bg-connectButtonBackground luno:shadow-button",ro),"aria-label":"Open account modal",children:[x.length>0&&t&&S&&F("div",{className:i("luno:p-2 luno:pl-3"),children:p?lo("span",{children:[p?.formattedTransferable||p?.formattedTotal||0," ",v?.nativeCurrency?.symbol||""]}):F("span",{className:i("luno:block luno:animate-pulse luno:rounded luno:w-[80px] luno:h-[20px] luno:bg-accountActionItemBackgroundHover")})}),lo("div",{className:i("luno:flex luno:items-center luno:overflow-hidden luno:bg-connectButtonInnerBackground luno:border-2 luno:border-connectButtonBackground luno:rounded-connectButton luno:gap-1.5 luno:max-h-[40px]",x.length>0&&t&&S?"luno:bg-connectButtonInnerBackground luno:py-1.5 luno:px-2":"luno:bg-connectButtonBackground luno:py-2 luno:px-2.5"),children:[e==="full"&&F("span",{className:i("luno:w-[24px] luno:h-[24px] luno:flex luno:items-center luno:justify-center"),children:F("img",{src:V.icon,alt:"luno account"})}),F("span",{className:i(r==="name"&&m?.name?"luno:text-ellipsis luno:overflow-hidden luno:max-w-[115px] luno:whitespace-nowrap":""),children:r==="name"&&m?.name?m?.name:Gt(m?.address)})]})]})]})};import{useConnect as el}from"@luno-kit/react";import{isMobileDevice as nl}from"@luno-kit/react/utils";import{useEffect as tl,useMemo as ll,useState as Ue}from"react";import De from"react";function ao(o,n){if(!o)return n;if(De.isValidElement(n)){let{className:e,children:l,...t}=n.props||{};return De.createElement(n.type,{...t,className:e},o)}return o}import{useConnectors as Zt}from"@luno-kit/react";import{isMobileDevice as zt}from"@luno-kit/react/utils";import He,{useMemo as Ut}from"react";import{jsx as B,jsxs as Ge}from"react/jsx-runtime";var jt=["polkadot-js","subwallet-js","talisman","walletconnect","nova","nova-mobile"],Wt=["ledger","polkagate","fearless-wallet","mimir","enkrypt","OneKey"],Fe=He.memo(({onConnect:o})=>{let n=Zt(),e=n.filter(a=>a.isInstalled()),l=n.filter(a=>jt.includes(a.id)&&!a.isInstalled()),t=n.filter(a=>Wt.includes(a.id)&&!a.isInstalled()),r=Ut(()=>[{title:"Installed",group:e},{title:"Popular",group:l},{title:"More",group:t}],[e,l,t]);if(zt()){let a=n.filter(u=>u.id!=="polkadot-js").filter(u=>u.links.deepLink||u.isInstalled());return B("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-1 luno:w-full",children:a.map(u=>B(_e,{connector:u,onConnect:()=>o(u)},`${u.id}-${u.name}`))})}return B("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-4 luno:w-full luno:overflow-y-auto luno:max-h-[400px]",children:r.map(a=>a.group.length===0?null:Ge("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-2 luno:w-full",children:[B("div",{className:i("luno:text-sm luno:font-semibold luno:leading-base",a.title==="Installed"?"luno:text-accentColor":"luno:text-modalTextSecondary"),children:a.title}),B("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-1.5 luno:w-full",children:a.group.map(u=>B(_e,{connector:u,onConnect:()=>o(u)},u.id))})]},a.title))})}),_e=He.memo(({connector:o,onConnect:n})=>Ge("button",{onClick:n,className:i("luno:cursor-pointer luno:bg-walletSelectItemBackground luno:p-2 luno:w-full luno:flex luno:items-center luno:gap-3 luno:rounded-walletSelectItem luno:border-none","luno:hover:bg-walletSelectItemBackgroundHover luno:transition-transform luno:active:scale-[0.95]","luno:text-left"),children:[B("div",{className:"luno:w-[28px] luno:h-[28px] luno:rounded-[6px] luno:overflow-hidden",children:B("img",{src:o.icon,alt:o.name,className:"luno:w-full luno:h-full"})}),B("span",{className:"luno:font-semibold luno:leading-base luno:text-base luno:text-modalText",children:o.name})]}));import Xt,{useMemo as Yt}from"react";import{Cuer as Qt}from"cuer";import{jsx as G,jsxs as $e}from"react/jsx-runtime";var Ze=({logoBackground:o,uri:n,size:e})=>{if(!n){let r=Math.floor(14.25),a=e/57,u=r*a,m=Math.ceil(57/2-r/2),p=m+r,f=()=>{let d=[];for(let h=0;h<57;h++)for(let v=0;v<57;v++){if(h>=m&&h<p&&v>=m&&v<p||h<8&&v<8||h<8&&v>=49||h>=49&&v<8)continue;let V=v+.5,O=h+.5;d.push(G("rect",{x:V-.4,y:O-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${v}`))}return d},c=({position:d})=>{let h=7*a,v={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return $e("div",{className:"luno:absolute luno:z-[4]",style:{width:`${h}px`,height:`${h}px`,...v[d]},children:[G("div",{className:"luno:absolute luno:inset-0",style:{borderRadius:`${2*a}px`,border:`${a}px solid var(--color-walletSelectItemBackground)`}}),G("div",{className:"luno:absolute luno:left-1/2 luno:top-1/2 luno:-translate-x-1/2 luno:-translate-y-1/2",style:{width:`${3*a}px`,height:`${3*a}px`,borderRadius:`${.5*a}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},s=()=>{let d=m*a;return G("div",{className:"luno:absolute luno:z-[4] luno:flex luno:items-center luno:justify-center luno:box-border",style:{width:`${u}px`,height:`${u}px`,left:`${d}px`,top:`${d}px`,borderRadius:`${a}px`,padding:`${a/2}px`},children:G("img",{src:o,alt:"QR Code Logo",className:"luno:h-full luno:w-full luno:object-cover",style:{borderRadius:`${a}px`}})})};return $e("div",{className:"luno:relative luno:overflow-hidden luno:flex luno:items-center luno:justify-center",style:{width:e,height:e,borderRadius:`${2*a}px`},children:[G("svg",{className:"luno:absolute luno:inset-0 luno:z-[3]",width:e,height:e,viewBox:"0 0 57 57",children:f()}),G("div",{className:"luno:absolute luno:inset-0 luno: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"}}),c({position:"top-left"}),c({position:"top-right"}),c({position:"bottom-left"}),o&&s()]})}return G(Qt,{arena:o,value:n})};import{useEffect as Kt,useRef as qt}from"react";import{jsx as Jt}from"react/jsx-runtime";var ze=({size:o=160,dotCount:n=300,duration:e=3,className:l=""})=>{let t=qt(null);return Kt(()=>{if(!t.current)return;let r=1,a=2,u=Math.PI*(3-Math.sqrt(5)),m=o/2,p=m-a-r,f="http://www.w3.org/2000/svg";t.current.innerHTML="";let c=document.createElementNS(f,"svg");c.setAttribute("width",o.toString()),c.setAttribute("height",o.toString()),c.setAttribute("viewBox",`0 0 ${o} ${o}`),c.style.display="block",t.current.appendChild(c);for(let s=0;s<n;s++){let d=s+.5,h=d/n,v=Math.sqrt(h)*p,x=d*u,V=m+v*Math.cos(x),O=m+v*Math.sin(x),S=document.createElementNS(f,"circle");S.setAttribute("cx",V.toString()),S.setAttribute("cy",O.toString()),S.setAttribute("r",r.toString()),S.setAttribute("fill","currentColor"),S.setAttribute("opacity","0.6"),c.appendChild(S);let T=document.createElementNS(f,"animate");T.setAttribute("attributeName","r"),T.setAttribute("values",`${r*.5};${r*1.8};${r*.5}`),T.setAttribute("dur",`${e}s`),T.setAttribute("begin",`${h*e}s`),T.setAttribute("repeatCount","indefinite"),T.setAttribute("calcMode","spline"),T.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),S.appendChild(T);let k=document.createElementNS(f,"animate");k.setAttribute("attributeName","opacity"),k.setAttribute("values","0.2;1;0.2"),k.setAttribute("dur",`${e}s`),k.setAttribute("begin",`${h*e}s`),k.setAttribute("repeatCount","indefinite"),k.setAttribute("calcMode","spline"),k.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),S.appendChild(k)}},[o,n,e]),Jt("div",{ref:t,className:i("luno:text-accentColor luno:inline-flex luno:w-full luno:h-full luno:justify-center luno:align-center",l)})};import{Fragment as ol,jsx as g,jsxs as P}from"react/jsx-runtime";var jo=Xt.memo(({selectedConnector:o,onConnect:n,qrCode:e,isWide:l,connectState:t,appInfo:r})=>{let{themeMode:a}=uo(),u=Yt(()=>{if(!r?.decorativeImage)return;let{light:p,dark:f}=r.decorativeImage;return{url:a==="dark"&&f||p}},[r?.decorativeImage,a]),m=o?.hasConnectionUri();return P("div",{className:i("luno:flex luno:flex-col luno:items-center",l?"luno:w-[450px] luno:p-4 luno:min-h-[472px]":"luno:justify-center luno:w-full luno:min-h-[400px]"),children:[l&&g("div",{className:"luno:w-full",children:P("div",{className:"luno:flex luno:items-center luno:justify-between",children:[g("div",{}),g(E,{className:"luno:z-10 luno:w-[30px] luno:h-[30px] luno:flex luno:items-center luno:justify-center luno:cursor-pointer luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200",children:g(R,{})})]})}),g("div",{className:i("luno:flex luno:items-center luno:gap-4 luno:flex-col luno:grow luno:justify-center",o&&m?"luno:max-w-[300px]":"luno:max-w-[360px]"),children:o?m?P("div",{className:"luno:flex luno:flex-col luno:items-center luno:gap-2.5",children:[g(Ze,{size:300,logoBackground:o.icon,uri:e}),P("div",{className:"luno:text-base luno:leading-base luno:font-medium luno:text-center luno:text-modalTextSecondary",children:["Scan the QR code with"," ",o.id==="nova"?"the Nova":"your phone"]}),g("div",{className:"luno:min-h-[20px] luno:flex luno:items-center luno:justify-center",children:o.links?.browserExtension?P("div",{onClick:()=>window.open(o.links.browserExtension),className:"luno:cursor-pointer luno:text-sm luno:text-accentColor luno:font-medium luno:text-center luno:hover:text-modalText",children:["Don't have ",o.name,"?"]}):e?g(po,{className:"luno:text-sm luno:leading-sm luno:font-medium luno:text-accentColor",copyText:e,label:"Copy Link"}):null})]}):P(ol,{children:[g("div",{className:"luno:w-[80px] luno:h-[80px]",children:g("img",{src:o.icon,className:"luno:w-full luno:h-full",alt:""})}),P("p",{className:"luno:text-lg luno:leading-lg luno:text-modalFont luno:font-bold",children:["Opening ",o.name,"..."]}),g("p",{className:"luno:pb-[10px] luno:text-base luno:text-modalTextSecondary luno:leading-base luno:font-medium luno:text-center",children:o.id==="ledger"?t.error?.message:"Confirm connection in the extension"}),t.isConnecting&&g("div",{className:"luno-loading luno:text-modalText luno:w-[24px]"}),!o.isInstalled()&&o.links.browserExtension&&P("div",{onClick:()=>window.open(o.links.browserExtension),className:"luno:cursor-pointer luno:pt-6 luno:text-sm luno:text-accentColor luno:font-medium luno:text-center luno:hover:text-modalText",children:["Don't have ",o.name,"?"]}),!t.isConnecting&&t.isError&&(o?.isInstalled()||o?.id==="ledger")&&g("button",{className:i("luno:rounded-connectButton luno:focus:outline-none luno:py-[4px] luno:px-[12px] luno:cursor-pointer luno:font-semibold luno:text-sm luno:text-modalText luno:bg-connectButtonBackground luno:shadow-connectButton luno:active:scale-[0.95]",ro),onClick:()=>n(o),children:"Retry"})]}):P("div",{className:"luno:relative luno:flex luno:flex-col luno:items-center luno:w-full luno:grow luno:gap-4 luno:pt-[60px]",children:[u?.url?g("div",{className:"luno:w-[160px] luno:h-[160px]",children:g("img",{src:u.url,alt:"Luno Kit",className:"luno:w-full luno:h-full luno:object-contain"})}):g("div",{className:"luno:w-[160px] luno:h-[160px]",children:g(ze,{})}),ao(r?.guideText,g("div",{className:"luno:cursor-pointer luno:text-base luno:leading-base luno:text-accentColor luno:font-semibold luno:text-center luno:hover:text-modalText",onClick:()=>window.open(r?.guideLink||"https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})),ao(r?.description,g("p",{className:"luno:text-modalTextSecondary luno:w-[250px] luno:text-sm luno:leading-sm luno:font-medium luno:text-center",children:"Connect your wallet to start exploring and interacting with DApps."})),l&&r?.policyLinks?.terms&&r?.policyLinks?.privacy&&P("div",{className:"luno:absolute luno:bottom-0 luno:left-0 luno:right-0 luno:text-modalTextSecondary luno:text-xs luno:leading-xs luno:font-regular luno:text-center",children:[g("span",{children:"By connecting your wallet, you agree to our "}),g("a",{href:r.policyLinks.terms,target:r.policyLinks.target||"_blank",rel:"noreferrer noopener",className:"luno:text-accentColor luno:font-regular luno:hover:text-modalText",children:"Terms of Service"}),g("span",{children:" & "}),g("a",{href:r.policyLinks.privacy,target:r.policyLinks.target||"_blank",rel:"noreferrer noopener",className:"luno:text-accentColor luno:font-medium luno:hover:text-modalText",children:"Privacy Policy"})]})]})}),g("div",{})]})});import{Fragment as je,jsx as y,jsxs as $}from"react/jsx-runtime";var ge=({appInfo:o,container:n,size:e="wide"})=>{let{isOpen:l,close:t}=Y(),{connectAsync:r,reset:a,isPending:u,isError:m,error:p}=el(),[f,c]=Ue(null),[s,d]=Ue(),{width:h}=ko(),v=h&&h>768,x=!!(e==="wide"&&v),{containerRef:V,currentViewRef:O,resetView:S,handleViewChange:T,currentView:k}=io({initialView:"Connect Wallet"}),We=async A=>{let Wo=await A.getConnectionUri();d(Wo)},so=async A=>{if(nl()&&A.links.deepLink)try{await r({connectorId:A.id}),No(!1);return}catch{window.location.href=`${A.links.deepLink}?url=${window.location.href}`;return}!x&&T("walletView"),c(A),d(void 0),A.hasConnectionUri()&&We(A),await r({connectorId:A.id}),No(!1)},No=A=>{!A&&t(),a(),S(),c(null),d(void 0)},Qe=ll(()=>({"Connect Wallet":y(Fe,{onConnect:so}),walletView:y(jo,{connectState:{isConnecting:u,isError:m,error:p},isWide:x,selectedConnector:f,qrCode:s,onConnect:so,appInfo:o})}),[x,f,s,so,u,m,p,o]);return tl(()=>{x&&k==="walletView"&&T("Connect Wallet")},[x,k]),$(z,{open:l,onOpenChange:No,container:n,children:[$("div",{className:i("luno:flex luno:items-stretch luno:justify-between luno:w-full luno:md:max-h-[504px] luno:md:max-w-[724px]"),children:[$("div",{className:i("luno:flex luno:flex-col luno:items-start luno:py-4 luno:px-5 luno:w-full luno:md:w-auto",x?"luno:md:min-w-[300px] luno:border-r-[1px] luno:border-r-solid luno:border-r-separatorLine":"luno:md:min-w-[360px]"),children:[$("div",{className:i("luno:flex luno:items-center luno:justify-between luno:w-full",!x&&"luno:pb-4"),children:[k==="Connect Wallet"?$(je,{children:[!x&&y("div",{className:i("luno:w-[30px] luno:h-[30px]"),"aria-hidden":!0}),y(D,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-bold",x?"luno:pb-6":"luno:flex-1 luno:text-center"),children:"Connect Wallet"})]}):$(je,{children:[y("button",{className:i("luno:flex luno:items-center luno:justify-center luno:w-[30px] luno:h-[30px] luno:cursor-pointer luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200"),onClick:()=>T("Connect Wallet"),"aria-label":"Back",children:y(q,{})}),y(D,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300"),children:f?.name})]}),!x&&y(E,{className:"luno:z-10 luno:w-[30px] luno:h-[30px] luno:flex luno:items-center luno:justify-center luno:cursor-pointer luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200",children:y(R,{})})]}),y("div",{ref:V,className:i("luno:relative luno:overflow-hidden luno:w-full",!x&&"luno:flex-1 luno:overflow-auto"),children:y("div",{ref:O,children:Qe[k]})}),!x&&k==="Connect Wallet"&&ao(o?.guideText,y("p",{className:"luno:cursor-pointer luno:w-full luno:pt-4 luno:text-sm luno:leading-sm luno:text-accentColor luno:font-medium luno:text-center luno:hover:text-modalText",onClick:()=>window.open(o?.guideLink||"https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}))]}),x&&y(jo,{connectState:{isConnecting:u,isError:m,error:p},isWide:x,selectedConnector:f,qrCode:s,onConnect:so,appInfo:o})]}),!x&&k==="Connect Wallet"&&o?.policyLinks?.terms&&o?.policyLinks?.privacy&&$("div",{className:"luno:w-full luno:border-t luno:border-t-separatorLine luno:flex luno:flex-col luno:items-center luno:gap-1 luno:p-3",children:[y("div",{className:"luno:text-modalTextSecondary luno:text-xs luno:leading-xs luno:font-regular luno:text-center",children:"By connecting your wallet, you agree to our"}),$("div",{className:"luno:text-xs luno:leading-xs luno:font-regular luno:text-center luno:text-modalTextSecondary",children:[y("a",{href:o.policyLinks.terms,target:o.policyLinks.target||"_blank",rel:"noreferrer noopener",className:"luno:text-accentColor luno:font-medium luno:hover:text-modalText",children:"Terms of Service"}),y("span",{className:"luno:px-1",children:"&"}),y("a",{href:o.policyLinks.privacy,target:o.policyLinks.target||"_blank",rel:"noreferrer noopener",className:"luno:text-accentColor luno:font-medium luno:hover:text-modalText",children:"Privacy Policy"})]})]})]})};export{$t as ConnectButton,dr as LunoKitProvider,oo as useAccountModal,eo as useChainModal,Nn as useCloseAllModals,Y as useConnectModal,uo as useLunoTheme};
2
+ import{useAccount as Vt,useActiveConnector as Pt}from"@luno-kit/react";import{formatAddress as Rt}from"@luno-kit/react/utils";import{useCallback as Lt,useMemo as Oe}from"react";import{jsx as Ko}from"react/jsx-runtime";var Je=o=>Ko("svg",{xmlns:"http://www.w3.org/2000/svg",className:"arrow_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...o,children:Ko("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"})}),To=Je;import{jsx as qo}from"react/jsx-runtime";var Xe=o=>qo("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...o,children:qo("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=Xe;import{jsx as Jo}from"react/jsx-runtime";var Ye=o=>Jo("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...o,children:Jo("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"})}),R=Ye;import{jsx as X,jsxs as en}from"react/jsx-runtime";var on=o=>en("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"13294",width:"100%",height:"100%",...o,children:[X("path",{d:"M170.837333 263.338667c-55.893333 25.173333-74.837333 53.333333-74.837333 72.661333 0 19.328 18.944 47.488 74.837333 72.661333 52.906667 23.808 128.256 39.338667 213.162667 39.338667 84.906667 0 160.256-15.530667 213.12-39.338667 55.893333-25.173333 74.88-53.333333 74.88-72.661333 0-19.328-18.944-47.488-74.88-72.661333C544.213333 239.573333 468.906667 224 384 224c-84.906667 0-160.256 15.573333-213.162667 39.338667zM144.64 205.013333C207.530667 176.64 292.181333 160 384 160c91.818667 0 176.469333 16.682667 239.402667 45.013333 59.904 26.922667 112.597333 70.826667 112.597333 130.986667s-52.693333 104.021333-112.597333 130.986667C560.469333 495.36 475.818667 512 384 512c-91.818667 0-176.469333-16.682667-239.402667-45.013333C84.693333 440.021333 32 396.16 32 336s52.693333-104.064 112.597333-130.986667z",fill:"currentColor","p-id":"13295"}),X("path",{d:"M64 304a32 32 0 0 1 32 32v160c0 19.370667 18.944 47.530667 74.837333 72.661333 52.906667 23.808 128.213333 39.338667 213.162667 39.338667 84.949333 0 160.298667-15.530667 213.162667-39.338667 55.893333-25.173333 74.837333-53.290667 74.837333-72.661333v-160a32 32 0 0 1 64 0v160c0 60.245333-52.650667 104.106667-112.554667 131.029333-62.933333 28.330667-147.626667 44.970667-239.445333 44.970667-91.861333 0-176.512-16.64-239.445333-44.970667C84.650667 600.064 32 556.202667 32 496v-160a32 32 0 0 1 32-32z",fill:"currentColor","p-id":"13296"}),X("path",{d:"M256 436.010667a32 32 0 0 1 32 32v160a32 32 0 0 1-64 0v-160a32 32 0 0 1 32-32zM672.128 383.829333a32 32 0 0 1 34.858667-28.885333c75.946667 7.082667 144.469333 25.813333 195.072 53.333333 48.810667 26.581333 89.941333 66.773333 89.941333 119.722667 0 60.245333-52.650667 104.106667-112.554667 131.029333-62.933333 28.288-147.626667 44.970667-239.445333 44.970667-81.621333 0-157.482667-13.269333-217.173333-35.626667a32 32 0 1 1 22.4-59.946666c51.456 19.242667 119.594667 31.573333 194.773333 31.573333 84.949333 0 160.256-15.530667 213.162667-39.338667 55.893333-25.173333 74.837333-53.290667 74.837333-72.661333 0-16.64-13.866667-40.277333-56.533333-63.488-40.96-22.272-100.437333-39.338667-170.453334-45.866667a32 32 0 0 1-28.885333-34.816z",fill:"currentColor","p-id":"13297"}),X("path",{d:"M960 496a32 32 0 0 1 32 32v160c0 60.245333-52.650667 104.106667-112.554667 131.029333-62.933333 28.288-147.626667 44.970667-239.445333 44.970667-91.861333 0-176.512-16.64-239.445333-44.970667-59.904-26.965333-112.554667-70.826667-112.554667-131.029333v-50.773333a32 32 0 0 1 64 0v50.773333c0 19.370667 18.944 47.530667 74.837333 72.661333 52.906667 23.808 128.213333 39.338667 213.162667 39.338667 84.949333 0 160.298667-15.530667 213.162667-39.338667 55.893333-25.173333 74.837333-53.290667 74.837333-72.661333v-160a32 32 0 0 1 32-32z",fill:"currentColor","p-id":"13298"}),X("path",{d:"M768 628.010667a32 32 0 0 1 32 32v160a32 32 0 0 1-64 0v-160a32 32 0 0 1 32-32zM512 436.010667a32 32 0 0 1 32 32v352a32 32 0 0 1-64 0v-352a32 32 0 0 1 32-32z",fill:"currentColor","p-id":"13299"})]}),Mo=on;import{jsx as Xo}from"react/jsx-runtime";var nn=o=>Xo("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...o,children:Xo("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"})}),Ao=nn;import{jsx as Yo,jsxs as ln}from"react/jsx-runtime";var tn=o=>ln("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",version:"1.1","p-id":"8135",width:"256",height:"256",...o,children:[Yo("path",{d:"M512 64L126.26 286.74l-2.26 1.31v448L512 960l385.74-222.74L900 736V288z m353.3 652L512 920 158.7 716V308L512 104l353.3 204z","p-id":"8136",fill:"currentColor"}),Yo("path",{d:"M314.55 589.97l-79.49-272.91-27.3 15.82v358.24l34.65 20.05V466.46l85.64 294.07 21.15 12.19V251.18l-34.65 20.05v318.74zM403.1 803.85l34.65 20.05V529.33h186.88v-34.66H437.75v-244.5l74.05-45.03 124.92 79.79 18.64-29.22-143.16-91.37-109.1 66.29v573.22zM724.36 338.72v405.49l34.66-20.05V360.28l60.24 37.38v-40.8l-149.2-92.79-18.33 29.42 72.63 45.23z","p-id":"8137",fill:"currentColor"})]}),Io=tn;import{jsx as oe}from"react/jsx-runtime";var rn=o=>oe("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...o,children:oe("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"})}),Vo=rn;import{jsx as ee,jsxs as sn}from"react/jsx-runtime";var an=o=>sn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 38 38",fill:"none",...o,children:[ee("path",{d:"M18.273 1.51489L3.90896 10.5424C2.41176 11.443 1.77589 12.1511 2.00136 12.6666H29.374L24.7431 3.04502C23.4245 0.849886 20.52 0.163352 18.273 1.51489ZM16.3185 12.54L6.91729 10.8844L19.5776 3.68595C20.5998 3.07162 21.9184 3.38322 22.5188 4.38262L25.8084 10.8844L16.3185 12.54Z",fill:"currentColor"}),ee("path",{d:"M31.9757 10.1333H6.02426C3.401 10.1333 1.26666 12.217 1.26666 14.7782V33.3551C1.26666 35.9163 3.401 38 6.02426 38H31.9757C34.599 38 36.7333 35.9163 36.7333 33.3551V14.7782C36.7333 12.217 34.599 10.1333 31.9757 10.1333ZM34.1379 27.0218H24.624C22.9545 27.0218 21.5967 25.6956 21.5967 24.0666C21.5967 22.4377 22.9545 21.1115 24.624 21.1115H34.1392V27.0218H34.1379ZM34.1379 18.5782H24.624C21.5219 18.5782 19 21.0393 19 24.0666C19 27.094 21.5219 29.5551 24.6227 29.5551H34.1379V33.3551C34.1379 34.5204 33.1677 35.4666 31.9757 35.4666H6.02426C4.83233 35.4666 3.86206 34.5204 3.86206 33.3551V14.7782C3.86206 13.6128 4.83233 12.6666 6.02426 12.6666H31.9757C33.1677 12.6666 34.1379 13.6128 34.1379 14.7782V18.5782ZM23.3257 24.0666C23.3257 24.9989 24.0996 25.7551 25.0547 25.7551C26.011 25.7551 26.7849 24.9989 26.7849 24.0666C26.7849 23.1344 26.011 22.3782 25.0547 22.3782C24.0996 22.3782 23.3257 23.1344 23.3257 24.0666Z",fill:"currentColor"})]}),Po=an;import{jsx as ne}from"react/jsx-runtime";var un=o=>ne("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256",fill:"none",...o,children:ne("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z",fill:"currentColor"})}),Ro=un;import{jsx as te}from"react/jsx-runtime";var cn=o=>te("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...o,children:te("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"})}),Lo=cn;import{jsx as le}from"react/jsx-runtime";var dn=o=>le("svg",{xmlns:"http://www.w3.org/2000/svg",className:"search_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...o,children:le("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"})}),Bo=dn;import{jsx as re}from"react/jsx-runtime";var mn=o=>re("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...o,children:re("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"})}),Oo=mn;import{jsx as ae}from"react/jsx-runtime";var pn=o=>ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...o,children:ae("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"})}),Eo=pn;import{useCallback as se,useRef as ie,useState as ue}from"react";function uo({initialView:o,animationDuration:n=200,animationEasing:e="ease-out"}){let[l,t]=ue(o),[a,s]=ue(!1),p=ie(null),u=ie(null),d=se(c=>{if(c===l||a)return;if(s(!0),!p.current){t(c),s(!1);return}let r=p.current,m=r.offsetHeight;t(c),requestAnimationFrame(()=>{if(!r||!u.current){s(!1);return}let h=u.current.offsetHeight;r.animate([{height:`${m}px`},{height:`${h}px`}],{duration:n,easing:e,fill:"forwards"}).addEventListener("finish",()=>{s(!1)})})},[l,a,n,e]),f=se(()=>{t(o),s(!1)},[o]);return{currentView:l,isAnimating:a,containerRef:p,currentViewRef:u,handleViewChange:d,resetView:f}}import{createContext as hn,useCallback as xn,useContext as gn,useEffect as me,useMemo as Do,useState as Go}from"react";import{useEffect as fn}from"react";var ce=["--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-assetSelectItemBackground","--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","--color-defaultIconBackground","--font-body","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-assetSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],de=(o,n)=>{fn(()=>{if(typeof window>"u")return;let e=document.documentElement;o.type==="complete"&&o.completeTheme?(Object.entries(o.completeTheme.colors).forEach(([l,t])=>{t&&e.style.setProperty(`--color-${l}`,t)}),Object.entries(o.completeTheme.fonts).forEach(([l,t])=>{t&&e.style.setProperty(`--font-${l}`,t)}),Object.entries(o.completeTheme.radii).forEach(([l,t])=>{t&&e.style.setProperty(`--radius-${l}`,t)}),Object.entries(o.completeTheme.shadows).forEach(([l,t])=>{t&&e.style.setProperty(`--shadow-${l}`,t)}),Object.entries(o.completeTheme.blurs).forEach(([l,t])=>{t&&e.style.setProperty(`--blur-${l}`,t)}),e.removeAttribute("data-theme")):o.type==="partial"&&o.partialOverrides?(e.setAttribute("data-theme",n),Object.keys(o.partialOverrides).length>0&&(ce.forEach(t=>{e.style.removeProperty(t)}),o.partialOverrides.colors&&Object.entries(o.partialOverrides.colors).forEach(([t,a])=>{a&&e.style.setProperty(`--color-${t}`,a)}),o.partialOverrides.fonts&&Object.entries(o.partialOverrides.fonts).forEach(([t,a])=>{a&&e.style.setProperty(`--font-${t}`,a)}),o.partialOverrides.radii&&Object.entries(o.partialOverrides.radii).forEach(([t,a])=>{a&&e.style.setProperty(`--radius-${t}`,a)}),o.partialOverrides.shadows&&Object.entries(o.partialOverrides.shadows).forEach(([t,a])=>{a&&e.style.setProperty(`--shadow-${t}`,a)}),o.partialOverrides.blurs&&Object.entries(o.partialOverrides.blurs).forEach(([t,a])=>{a&&e.style.setProperty(`--blur-${t}`,a)}))):(e.setAttribute("data-theme",n),ce.forEach(l=>{e.style.removeProperty(l)}))},[o,n])};import{jsx as Cn}from"react/jsx-runtime";var Ho="luno.lastThemePreference",vn=o=>{try{localStorage.setItem(Ho,JSON.stringify(o))}catch{}},pe=hn(void 0),_o=o=>"colors"in o&&"fonts"in o&&"radii"in o&&"shadows"in o&&"blurs"in o,wn=()=>{let[o,n]=Go(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return me(()=>{if(typeof window>"u")return;let e=window.matchMedia("(prefers-color-scheme: dark)"),l=t=>{n(t.matches?"dark":"light")};return l(e),e.addEventListener("change",l),()=>e.removeEventListener("change",l)},[]),o},Fo=({children:o,theme:n})=>{let e=wn(),[l,t]=Go(()=>{if(typeof window<"u")try{let r=localStorage.getItem(Ho);if(r){let m=JSON.parse(r);if(m?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(m?.preferredTheme)return m.preferredTheme}}catch{}return!n||_o(n)?"light":n.defaultMode||"light"}),[a,s]=Go(()=>{if(typeof window<"u")try{let r=localStorage.getItem(Ho);if(r)return JSON.parse(r)?.isAuto??!1}catch{}return!n||_o(n)?!1:n.autoMode??!1}),p=Do(()=>{if(!n)return{type:"default",completeTheme:null,partialOverrides:null};if(_o(n))return{type:"complete",completeTheme:n,partialOverrides:null};let c=n;if(c.theme)return{type:"complete",completeTheme:c.theme,partialOverrides:null};let r=null;return l==="light"&&c.light?r=c.light:l==="dark"&&c.dark?r=c.dark:r={...c},{type:"partial",completeTheme:null,partialOverrides:r}},[l,n]),u=Do(()=>p.type==="complete"?p.completeTheme:null,[p]);de(p,l);let d=xn(c=>{let r=c==="auto";s(r),t(r?e||"light":c);let m={isAuto:r,...r?{}:{preferredTheme:c}};vn(m)},[e]);me(()=>{a&&t(e||"light")},[e,a]);let f=Do(()=>({themeMode:l,setThemeChoice:d,currentTheme:u}),[l,d,u]);return Cn(pe.Provider,{value:f,children:o})},co=()=>{let o=gn(pe);if(!o)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return o};import{LunoProvider as An}from"@luno-kit/react";import{ConnectionStatus as mo,useStatus as bn}from"@luno-kit/react";import{createContext as yn,useCallback as Zo,useContext as po,useEffect as kn,useMemo as Nn,useState as Sn}from"react";import{jsx as Mn}from"react/jsx-runtime";function $o(){let[o,n]=Sn(!1),e=Zo(()=>n(!0),[]),l=Zo(()=>n(!1),[]);return{isOpen:o,open:e,close:l}}var Y=yn(void 0),fe=({children:o})=>{let{isOpen:n,open:e,close:l}=$o(),{isOpen:t,open:a,close:s}=$o(),{isOpen:p,open:u,close:d}=$o(),f=bn(),c=Zo(()=>{l(),s(),d()},[l,s,d]);kn(()=>{f===mo.Disconnected&&(s(),d())},[f,s,d]);let r=Nn(()=>({isConnectModalOpen:n,isAccountModalOpen:t,isChainModalOpen:p,openConnectModal:f!==mo.Connected?e:void 0,closeConnectModal:l,openAccountModal:f===mo.Connected?a:void 0,closeAccountModal:s,openChainModal:f===mo.Connected?u:void 0,closeChainModal:d,closeAllModals:c}),[n,e,l,t,a,s,p,u,d,c,f]);return Mn(Y.Provider,{value:r,children:o})},oo=()=>{let o=po(Y);if(!o)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:o.isConnectModalOpen,open:o.openConnectModal,close:o.closeConnectModal}},eo=()=>{let o=po(Y);if(!o)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:o.isAccountModalOpen,open:o.openAccountModal,close:o.closeAccountModal}},no=()=>{let o=po(Y);if(!o)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:o.isChainModalOpen,open:o.openChainModal,close:o.closeChainModal}},Tn=()=>{let o=po(Y);if(!o)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return o.closeAllModals};import{Fragment as Vn,jsx as Z,jsxs as he}from"react/jsx-runtime";var mr=({children:o,config:n,theme:e,appInfo:l})=>Z(An,{config:n,children:Z(Fo,{theme:e,children:he(fe,{children:[Z("div",{children:o}),Z(In,{appInfo:l,modalSize:n.modalSize,modalContainer:n.modalContainer,showInstalledGroup:n.showInstalledGroup})]})})}),In=({modalSize:o,appInfo:n,modalContainer:e,showInstalledGroup:l})=>he(Vn,{children:[Z(ve,{showInstalledGroup:l,size:o,appInfo:n,container:e}),Z(xe,{container:e}),Z(ge,{container:e})]});import{clsx as Pn}from"clsx";import{extendTailwindMerge as Rn}from"tailwind-merge";var Ln=Rn({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function i(...o){return Ln(Pn(o))}function we(o,n){let e;return()=>{e&&clearTimeout(e),e=setTimeout(()=>{e=null,o()},n)}}import{useCallback as Bn,useState as On}from"react";import{jsx as Ce,jsxs as En}from"react/jsx-runtime";var fo=({copyText:o,label:n,className:e=""})=>{let[l,t]=On(!1),a=Bn(async s=>{try{return navigator.clipboard?.writeText?(await navigator.clipboard.writeText(s),t(!0),setTimeout(()=>t(!1),2e3),!0):!1}catch(p){return console.error("Copy failed:",p),!1}},[]);return En("button",{type:"button",className:i("luno:cursor-pointer luno:bg-transparent luno:border-none luno:p-1 luno:m-0 luno:inline-flex luno:items-center luno:justify-center luno:gap-1","luno:rounded-modalControlButton luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200",e),onClick:()=>!l&&o&&a(o),"aria-label":"Copy address to clipboard",disabled:l,children:[l?Ce(Oo,{className:"luno:text-accentColor",width:16,height:16}):Ce(Ao,{width:16,height:16}),n]})};import*as T from"@radix-ui/react-dialog";import ho from"react";import{jsx as be,jsxs as Hn}from"react/jsx-runtime";var Dn=({open:o,onOpenChange:n,children:e,contentClassName:l,overlayClassName:t,container:a})=>{let s=ho.useMemo(()=>{if(a)return typeof a=="function"?a():a},[a]);return be(T.Root,{open:o,onOpenChange:n,children:Hn(T.Portal,{container:s,children:[ho.createElement(T.Overlay,{className:i("luno:fixed luno:inset-0 luno:backdrop-blur-modalOverlay luno:z-[100] luno:bg-modalBackdrop luno-kit","luno:data-[state=open]:[animation:overlay-in_150ms_ease-out]",t)}),be(T.Content,{className:i("luno-kit luno:font-body luno:fixed luno:z-[200] luno:text-modalText luno:text-base luno:leading-base","luno:bg-modalBackground luno:shadow-modal luno:focus:outline-none luno:overflow-hidden luno:border luno:border-modalBorder","luno:transition-all luno:duration-200","luno:rounded-t-modalMobile luno:bottom-0 luno:left-0 luno:w-full","luno:translate-y-0 luno:-translate-x-0","luno:data-[state=open]:[animation:slide-up_200ms_ease-out]","luno:md:bottom-auto luno:md:left-1/2 luno:md:top-1/2 luno:md:-translate-x-1/2 luno:md:-translate-y-1/2","luno:md:w-auto luno:md:rounded-modal","luno:md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",l),children:e})]})})},_n=({children:o,className:n})=>ho.createElement(T.Title,{className:n},o),Gn=({children:o,className:n,onClick:e})=>ho.createElement(T.Close,{className:n,onClick:e},o),U=Dn,E=Gn,D=_n;import{useState as ot}from"react";import{useAccount as jn,useChain as Wn}from"@luno-kit/react";import Se,{useMemo as Te,useState as Ne}from"react";import{useAccount as Fn,useChain as $n,useConfig as Zn}from"@luno-kit/react";import{formatBalance as xo}from"@luno-kit/react/utils";import{useQuery as zn}from"@tanstack/react-query";var Un=async({apiUrl:o,apiKey:n,address:e})=>{try{let l=await fetch(`${o}/api/scan/account/tokens`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":n},body:JSON.stringify({address:e})});if(!l.ok)throw new Error(`Subscan API error: ${l.status}`);let t=await l.json();if(t.code!==0)throw new Error(`Subscan API error: ${t.message}`);let a=t.data.assets||[],s=t.data.native||[],p=t.data.builtin||[],u=a.filter(r=>r.token_image||r.unique_id?.includes("nft")).map(r=>({balance:r.balance,decimals:r.decimals,balanceFormatted:xo(r.balance,r.decimals),logoURI:r.token_image,symbol:r.symbol,assetId:r.asset_id,price:r.price})),d=a.filter(r=>!r.token_image&&!r.unique_id?.includes("nft")).map(r=>({balance:r.balance,decimals:r.decimals,balanceFormatted:xo(r.balance,r.decimals,4),logoURI:r.token_image,symbol:r.symbol,assetId:r.asset_id,price:r.price})),f=s.map(r=>({balance:r.balance,decimals:r.decimals,balanceFormatted:xo(r.balance,r.decimals,4),logoURI:"",symbol:r.symbol,assetId:0,price:r.price})),c=p.map(r=>({balance:r.balance,decimals:r.decimals,balanceFormatted:xo(r.balance,r.decimals,4),logoURI:"",symbol:r.symbol,assetId:r.unique_id,price:r.price}));return{nfts:[...u],tokens:[...f,...d,...c]}}catch(l){throw console.error("Failed to fetch tokens from Subscan:",l),l}};function j(){let{address:o}=Fn(),n=Zn(),{chain:e}=$n(),l=e?.subscan?.api,t=n?.subscan?.apiKey;return zn({queryKey:["subscan","asset-list",o,e?.genesisHash,l,t],queryFn:()=>Un({address:o,apiKey:t,apiUrl:l}),enabled:!!o&&!!t&&!!l,staleTime:n?.subscan?.cacheTime||6e4})}import{jsx as ye,jsxs as ke}from"react/jsx-runtime";var go=({type:o})=>ke("div",{className:"luno:flex luno:flex-col luno:gap-1 luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center",children:[ye(Po,{className:"luno:w-[38px] luno:h-[38px] luno:mb-2"}),ke("div",{className:"luno:text-modalText luno:text-base luno:leading-base",children:["No ",o," found"]}),ye("div",{className:"luno:text-sm luno:text-modalTextSecondary luno:max-w-[260px]",children:"Switch to a different network or account to view more assets"})]});import{jsx as b,jsxs as to}from"react/jsx-runtime";var Me=Se.memo(()=>{let{data:o,isFetching:n,error:e}=j(),l=Te(()=>o?o.nfts:[],[o]);return n?b("div",{className:"luno:flex luno:justify-center luno:w-full",children:b("div",{className:"luno:flex luno:flex-wrap luno:justify-between luno:max-w-[350px] luno:w-full luno:min-h-[300px] luno:gap-y-4",children:[1,2,3,4].map(t=>b("div",{className:"luno:animate-pulse luno:bg-skeleton luno:w-[155px] luno:h-[198px] luno:rounded-assetSelectItem"},`skeleton-${t}`))})}):e?to("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center luno:p-4",children:[b("div",{className:"luno:text-error luno:mb-2",children:"Failed to load assets"}),b("div",{className:"luno:text-modalTextSecondary luno:text-sm",children:e instanceof Error?e.message:"Unknown error"})]}):l.length?b("div",{className:"luno:flex luno:justify-center luno:w-full",children:b("div",{className:"luno:flex luno:flex-wrap luno:justify-between luno:max-w-[350px] luno:w-full luno:gap-y-4",children:l.map(t=>b(Qn,{asset:t},`${t.symbol}-${t.balance}`))})}):b(go,{type:"NFTs"})}),Qn=Se.memo(({asset:o})=>{let{chain:n}=Wn(),{address:e}=jn(),[l,t]=Ne(!!o.logoURI),[a,s]=Ne(o.logoURI),p=Te(()=>n?.subscan?.url?`${n.subscan.url.endsWith("/")?n.subscan.url.slice(0,-1):n.subscan.url}/nft_item?collection_id=${o.assetId}&address=${e}`:"",[n,o,e]);return b("div",{className:i("luno:w-[155px] luno:h-[198px] luno:flex luno:items-center luno:p-2.5 luno:rounded-assetSelectItem luno:cursor-default","luno:bg-assetSelectItemBackground","luno:transition-colors luno:duration-200"),children:to("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center",children:[to("div",{className:"luno:relative luno:w-[135px] luno:h-[135px] luno:flex luno:items-center luno:justify-center luno:rounded-[6px] luno:overflow-hidden",children:[l&&b("div",{className:"luno:absolute luno:inset-0 luno:flex luno:items-center luno:justify-center luno:animate-pulse luno:bg-gray-500",children:b("div",{className:"luno:w-4 luno:h-4 luno:border-2 luno:border-t-transparent luno:border-white luno:rounded-full luno:animate-spin"})}),a?b("img",{src:a,alt:`${o.symbol}-NFT`,className:i("luno:w-full luno:h-full luno:object-cover",l?"luno:opacity-0":"luno:opacity-100 luno:transition-opacity luno:duration-200"),onLoad:()=>t(!1),onError:()=>{t(!1),s("")}}):b(Io,{className:"luno:w-full luno:h-full luno:object-cover"})]}),to("div",{className:"luno:flex luno:items-center luno:justify-between luno:w-full luno:mt-0.5",children:[to("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:[o.balance||"-"," NFTs"]}),b("button",{className:"luno:cursor-pointer luno:bg-transparent luno:border-none luno:p-1 luno:m-0 luno:inline-flex luno:items-center luno:justify-center luno:gap-1 luno:rounded-modalControlButton luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200",onClick:()=>p&&window.open(p),children:b(Ro,{})})]}),b("div",{className:"luno:w-full luno:text-left luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap luno:max-w-[135px] luno:overflow-hidden luno:text-ellipsis",children:o.symbol||o.assetId})]})})});import Uo,{useMemo as Jn}from"react";import{useMemo as Kn,useState as Ae}from"react";import{jsx as zo,jsxs as qn}from"react/jsx-runtime";var _=({iconUrl:o,resourceName:n,className:e})=>{let[l,t]=Ae(!!o),[a,s]=Ae(!1),p=Kn(()=>{if(!n)return"-";let u=n.match(/^([^-]+)-/);return u?.[1]?u[1].charAt(0).toUpperCase():n.charAt(0).toUpperCase()},[n]);return o&&!a?qn("div",{className:i("luno:relative luno:w-full luno:h-full",e),children:[l&&zo("div",{className:"luno:absolute luno:inset-0 luno:flex luno:items-center luno:justify-center luno:rounded-full luno:animate-pulse luno:bg-skeleton"}),zo("img",{src:o,alt:n||"icon",className:i("luno:w-full luno:h-full luno:object-cover luno:rounded-full",l?"luno:opacity-0":"luno:opacity-100 luno:transition-opacity luno:duration-200"),onLoad:()=>t(!1),onError:()=>{t(!1),s(!0)}})]}):zo("div",{className:i("luno:w-full luno:h-full luno:text-white luno:font-semibold","luno:flex luno:items-center luno:justify-center luno:rounded-full luno:bg-defaultIconBackground",e),children:p})};import{jsx as I,jsxs as W}from"react/jsx-runtime";var Xn=o=>`https://raw.githubusercontent.com/Luno-lab/luno-assets/refs/heads/main/assets/tokens/${o?.toLowerCase().trim()||""}.webp`,Ie=Uo.memo(()=>{let{data:o,error:n,isFetching:e}=j(),l=Jn(()=>o?[...o.tokens].sort((t,a)=>{let s=t.price?parseFloat(t.balance)/10**t.decimals*parseFloat(t.price):0;return(a.price?parseFloat(a.balance)/10**a.decimals*parseFloat(a.price):0)-s}):[],[o]);return e?I("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:min-h-[300px]",children:[1,2,3,4,5].map(t=>I("div",{className:"luno:animate-pulse luno:bg-skeleton luno:h-[54px] luno:rounded-assetSelectItem"},`skeleton-${t}`))}):n?W("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center luno:p-4",children:[I("div",{className:"luno:text-error luno:mb-2",children:"Failed to load assets"}),I("div",{className:"luno:text-modalTextSecondary luno:text-sm",children:n instanceof Error?n.message:"Unknown error"})]}):l.length?I("div",{className:"luno:flex luno:flex-col luno:gap-1.5",children:l.map(t=>I(Yn,{asset:t},`${t.symbol}-${t.assetId}`))}):I(go,{type:"Tokens"})}),Yn=Uo.memo(({asset:o})=>{let n=o.logoURI||Xn(o.symbol),e=Uo.useMemo(()=>{if(!o.price)return null;let l=parseFloat(o.balance)/10**o.decimals,t=parseFloat(o.price);return`$${(l*t).toFixed(2)}`},[o.balance,o.decimals,o.price]);return W("div",{role:"listitem",className:i("luno:flex luno:items-center luno:justify-between luno:p-2.5 luno:rounded-assetSelectItem luno:cursor-default","luno:bg-assetSelectItemBackground","luno:transition-colors luno:duration-200"),children:[W("div",{className:"luno:flex luno:items-center luno:gap-2",children:[I(_,{className:"luno:w-[30px] luno:h-[30px] luno:flex luno:items-center luno:justify-center",iconUrl:n,resourceName:`${o.symbol}-token`}),W("div",{className:"luno:flex luno:flex-col luno:items-start",children:[I("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:o.symbol||"Unknown"}),I("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap",children:o.balanceFormatted})]})]}),o.price&&W("div",{className:"luno:flex luno:flex-col luno:items-end",children:[I("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:e}),W("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap",children:["$",o.price]})]})]})});import{jsx as lo,jsxs as nt}from"react/jsx-runtime";var et=[{key:"Tokens",label:"Tokens"},{key:"NFTs",label:"NFTs"}],Ve=()=>{let[o,n]=ot("Tokens");return nt("div",{className:i("luno:flex luno:flex-col luno:gap-3.5 luno:p-4 luno:pt-0"),children:[lo("div",{className:i("luno:flex luno:items-center luno:gap-1.5 luno:w-full"),children:et.map(e=>lo("button",{onClick:()=>n(e.key),className:i("luno:px-3.5 luno:flex luno:items-center luno:justify-center luno:cursor-pointer luno:min-w-[48px] luno:min-h-[24px] luno:rounded-networkSelectItem luno:text-[12px] luno:leading-[16px] luno:font-medium luno:transition-colors",o===e.key?"luno:bg-navigationButtonBackground luno:text-modalText":"luno:bg-transparent text-modalTextSecondary luno:hover:text-modalText"),children:e.label},e.key))}),lo("div",{className:i("luno:overflow-y-auto luno:flex-1 luno:min-h-[350px] luno:max-h-[350px]"),children:o==="Tokens"?lo(Ie,{}):lo(Me,{})})]})};import{jsx as Pe}from"react/jsx-runtime";var vo=()=>Pe("div",{className:"luno:relative",children:Pe(Ve,{})});vo.title="View Assets";import{useAccount as tt,useBalance as lt,useChain as rt,useChains as at,useConfig as st,useDisconnect as it}from"@luno-kit/react";import{getExplorerUrl as ut}from"@luno-kit/react/utils";import{useMemo as ct}from"react";import{Fragment as jo,jsx as w,jsxs as L}from"react/jsx-runtime";var Le=({onViewChange:o,onModalClose:n})=>{let{address:e}=tt(),{chain:l}=rt(),t=at(),{disconnectAsync:a}=it(),{data:s}=lt({address:t.length>0?e:void 0}),p=st(),{refetch:u}=j(),d=ct(()=>{let c={key:"Chain Name",content:L("div",{className:"luno:flex luno:items-stretch luno:w-full luno:justify-between",children:[L("div",{className:"luno:flex luno:items-center luno:gap-2",children:[w("div",{className:"luno:relative",children:w(_,{className:"luno:w-[24px] luno:h-[24px]",iconUrl:l?.chainIconUrl,resourceName:`${l?.name}-chain`})}),L("div",{className:"luno:flex luno:flex-col luno:items-start",children:[w("span",{className:"luno:text-base luno:leading-base luno:text-modalText",children:l?.name||"Polkadot"}),s?L("span",{className:"luno:text-modalTextSecondary luno:text-xs luno:leading-xs",children:[s.formattedTransferable||"0.00"," ",l?.nativeCurrency?.symbol||"DOT"]}):w("span",{className:"luno:animate-pulse luno:rounded luno:w-[80px] luno:h-[16px] luno:bg-skeleton"})]})]}),w("div",{className:"luno:flex luno:items-center luno:justify-center",children:w(To,{className:"luno:w-[16px] luno:h-[16px] luno:text-modalTextSecondary"})})]}),onClick:()=>o("switchChain")},r={key:"Switch Account",content:L(jo,{children:[w(Eo,{className:"luno:w-[24px] luno:h-[24px]"}),w("span",{className:"luno:text-base luno:text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>o("switchAccount")},m={key:"View Assets",content:L(jo,{children:[w(Mo,{className:"luno:w-[24px] luno:h-[24px]"}),w("span",{className:"luno:text-base luno:text-accountActionItemText",children:"View Assets"})]}),onClick:()=>{o("assetList"),u()}},h={key:"View on Explorer",content:L(jo,{children:[w(Lo,{className:"luno:w-[24px] luno:h-[24px]"}),w("span",{className:"luno:text-base luno:text-accountActionItemText luno:font-medium",children:"View on Explorer"})]}),onClick:()=>window.open(ut(l?.blockExplorers?.default?.url,e,"address"))};return t.length===0?[r]:p?.subscan?.apiKey?[c,h,m,r]:[c,h,r]},[o,l,e,s,t,p]),f=async()=>{await a(),n()};return L("div",{className:"luno:flex luno:flex-col luno:items-center luno:gap-3 luno:w-full",children:[w("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:w-full luno:px-4",children:d.map(c=>w(Re,{onClick:c.onClick,children:c.content},c.key))}),w("div",{className:"luno:w-full luno:mx-[-100px] luno:h-[1px] luno:bg-separatorLine"}),w("div",{className:"luno:w-full luno:px-4 luno:pb-4",children:L(Re,{onClick:f,children:[w(Vo,{}),w("span",{className:"luno:text-base luno:text-accountActionItemText ",children:"Disconnect"})]})})]})},Re=({children:o,onClick:n})=>w("button",{type:"button",onClick:()=>n?.(),className:i("luno:w-full luno:p-2.5 luno:rounded-accountActionItem luno:border-none luno:text-left luno:flex luno:items-center luno:gap-2 luno:font-medium","luno:bg-accountActionItemBackground luno:hover:bg-accountActionItemBackgroundHover","luno:transition-colors luno:duration-200",n?"luno:cursor-pointer":"luno:cursor-auto"),"aria-label":typeof o=="string"?o:void 0,children:o});import{useAccount as dt,useAccounts as mt,useActiveConnector as pt,useBalance as ft,useChain as ht,useChains as xt}from"@luno-kit/react";import{formatAddress as gt}from"@luno-kit/react/utils";import vt,{useCallback as wt}from"react";import{jsx as G,jsxs as wo}from"react/jsx-runtime";var Co=({onBack:o})=>{let{accounts:n,selectAccount:e}=mt(),{address:l}=dt(),t=wt(a=>{e(a),o()},[o]);return G("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:overflow-auto luno:max-h-[400px] luno:no-scrollbar luno:p-4 luno:pt-0",children:n.map(a=>G(Ct,{account:a,isSelected:a.address===l,selectAccount:t},a.address))})};Co.title="Switch Account";var Ct=vt.memo(({isSelected:o,account:n,selectAccount:e})=>{let{chain:l}=ht(),t=xt(),a=n.address,{data:s}=ft({address:t.length>0?a:void 0}),p=pt();return wo("button",{type:"button",onClick:()=>e(n),className:i("luno:px-3.5 luno:py-2.5 luno:w-full luno:rounded-accountSelectItem luno:border-none","luno:bg-accountSelectItemBackground","luno:text-left luno:flex luno:items-center luno:justify-between luno:gap-2","luno:transition-colors luno:duration-200",o?"luno:cursor-auto":"luno:cursor-pointer luno:hover:bg-accountSelectItemBackgroundHover"),"aria-label":n.name||a,disabled:o,children:[wo("div",{className:"luno:flex luno:items-center luno:gap-2 luno:grow luno:overflow-hidden",children:[G("div",{className:"luno:shrink-0 luno:w-[24px] luno:h-[24px] luno:rounded-full luno:flex luno:items-center luno:justify-center",children:p?.icon&&G("img",{src:p?.icon,alt:"luno account"})}),wo("div",{className:"luno:flex luno:flex-col luno:items-start luno:overflow-hidden",children:[G("span",{className:"luno:whitespace-nowrap luno:max-w-full luno:text-ellipsis luno:overflow-hidden luno:font-medium luno:text-sm luno:leading-sm luno:text-accountSelectItemText",children:n.name||gt(a)}),t.length>0&&(s?wo("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium",children:[s?.formattedTransferable||"0.00"," ",l?.nativeCurrency?.symbol||"DOT"]}):G("span",{className:"luno:animate-pulse luno:rounded luno:w-[60px] luno:h-[16px] luno:bg-skeleton"}))]})]}),o&&G("div",{className:"luno:shrink-0 luno:border-[1px] luno:border-solid luno:border-accentColor luno:rounded-full luno:overflow-hidden luno:flex luno:items-center luno:justify-center luno:w-[18px] luno:h-[18px]",children:G("div",{className:"luno:rounded-full luno:bg-accentColor luno:w-[10px] luno:h-[10px]"})})]})});import{useApi as bt,useChain as yt,useChains as kt,useSwitchChain as Nt}from"@luno-kit/react";import St,{useMemo as Tt,useState as Be}from"react";import{Fragment as At,jsx as k,jsxs as Q}from"react/jsx-runtime";var bo=({onChainSwitched:o,className:n=""})=>{let{chain:e}=yt(),l=kt(),{switchChainAsync:t}=Nt(),{isApiReady:a,apiError:s}=bt(),[p,u]=Be(null),[d,f]=Be(""),c=Tt(()=>l.filter(m=>d.trim()?m.name.toLowerCase().includes(d.toLowerCase()):!0),[l,d]),r=async m=>{if(m.genesisHash!==e?.genesisHash&&!(!a&&!s)){u(m.genesisHash);try{await t({chainId:m.genesisHash}),o?.(m)}catch(h){console.error("Failed to switch chain:",h)}finally{u(null)}}};return Q("div",{className:i("luno:flex luno:flex-col luno:gap-3.5",n),children:[k("div",{className:"luno:relative luno:pt-1",children:Q("div",{className:"luno:relative",children:[k(Bo,{className:"luno:absolute luno:left-3 luno:top-1/2 luno:transform luno:-translate-y-1/2 luno:w-4 luno:h-4 luno:text-modalTextSecondary"}),k("input",{type:"text",placeholder:"Search by name",value:d,onChange:m=>f(m.target.value),className:"luno:w-full luno:pl-10 luno:pr-3 luno:py-2 luno:text-sm luno:border luno:border-networkSelectItemBackgroundHover luno:rounded-md luno:focus:ring-2 luno:focus:ring-accentColor luno:focus:outline-none luno:focus:border-transparent"})]})}),c.length>0&&k("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:overflow-y-auto luno:max-h-[380px]",children:c.map(m=>k(Mt,{chain:m,isSelected:m.genesisHash===e?.genesisHash,onSelect:r,isLoading:(p===m.genesisHash||!a)&&!s,isSwitching:p===m.genesisHash},m.genesisHash))}),c.length===0&&k("div",{className:"luno:flex luno:items-center luno:justify-center luno:py-12",children:k("span",{className:"luno:text-modalTextSecondary luno:text-xs",children:"No chains available"})})]})},Mt=St.memo(({chain:o,isSelected:n,isLoading:e,onSelect:l,isSwitching:t})=>Q("button",{onClick:()=>l(o),disabled:n||e,className:i("luno:flex luno:items-center luno:justify-between luno:p-2.5 luno:rounded-networkSelectItem","luno:bg-networkSelectItemBackground","luno:transition-colors luno:duration-200",n||e?"luno:cursor-default":"luno:cursor-pointer luno:hover:bg-networkSelectItemBackgroundHover",e&&"luno:opacity-80"),children:[Q("div",{className:"luno:flex luno:items-center luno:gap-2",children:[k(_,{className:"luno:w-[20px] luno:h-[20px] luno:flex luno:items-center luno:justify-center luno:leading-[20px]",iconUrl:o?.chainIconUrl,resourceName:`${o?.name}-chain`}),k("div",{className:"luno:flex luno:flex-col luno:items-start",children:k("span",{className:"luno:font-medium luno:text-base luno:text-modalText",children:o.name})})]}),k("div",{className:"luno:flex luno:items-center luno:justify-center luno:h-[20px]",children:n?e?Q(At,{children:[k("span",{className:"luno:text-accentColor luno:text-xs luno:leading-xs luno:mr-1.5",children:t?"Switching":"Connecting"}),k("div",{className:"luno-loading luno:text-accentColor luno:w-[15px] luno:h-[15px]"})]}):Q("span",{className:"luno:relative luno:flex luno:w-[10px] luno:h-[10px]",children:[k("span",{className:"luno:[animation:ping_1.2s_cubic-bezier(0,0,0.2,1)_infinite] luno:absolute luno:top-[0] luno:left-[0] luno:inline-flex luno:h-full luno:w-full luno:rounded-full luno:bg-accentColor"}),k("span",{className:"luno:relative luno:inline-flex luno:rounded-full luno:h-full luno:w-full luno:bg-accentColor"})]}):null})]}));import{jsx as It}from"react/jsx-runtime";var yo=({onBack:o})=>It(bo,{className:"luno:p-4 luno:pt-0"});yo.title="Select Networks";import{Fragment as Bt,jsx as C,jsxs as K}from"react/jsx-runtime";var xe=({container:o})=>{let{isOpen:n,close:e}=eo(),{address:l,account:t}=Vt(),a=Pt(),{currentView:s,containerRef:p,currentViewRef:u,handleViewChange:d,resetView:f}=uo({initialView:"main"}),c=Lt(()=>{e(),f()},[e]),r=Oe(()=>s==="switchAccount"?Co.title:s==="switchChain"?yo.title:s==="assetList"?vo.title:null,[s]),m=Oe(()=>({main:C(Le,{onViewChange:d,onModalClose:c}),switchAccount:C(Co,{onBack:()=>d("main")}),switchChain:C(yo,{onBack:()=>d("main")}),assetList:C(vo,{})}),[d,c]);return C(U,{open:n,onOpenChange:c,container:o,children:K("div",{className:i("luno:flex luno:flex-col luno:w-full luno:md:w-[360px] luno:max-h-[512px] luno:text-modalText","luno:bg-modalBackground luno:shadow-modal",s==="main"?"luno:gap-5":"luno:gap-3.5"),children:[K("div",{className:i("luno:flex luno:items-stretch luno:justify-between luno:w-full luno:px-4 luno:pt-4"),children:[s==="main"?K("div",{className:i("luno:flex luno:items-center luno:gap-3 luno:max-w-[80%]"),children:[a?.icon&&C("div",{className:i("luno:flex luno:items-center luno:justify-center luno:w-[40px] luno:h-[40px] luno:shrink-0"),children:C("img",{src:a.icon,alt:"luno",className:i("luno:w-full luno:h-full luno:object-contain")})}),K("div",{className:i("luno:flex luno:flex-col luno:items-start luno:gap-1.5 luno:max-w-full"),children:[C(D,{className:"luno:sr-only",children:"Account Details"}),K("div",{className:i("luno:flex luno:items-center luno:gap-0.5 luno:w-full"),children:[C("span",{className:i("luno:text-base luno:text-modalText luno:font-semibold"),children:Rt(l)}),C(fo,{copyText:l})]}),C("div",{className:i("luno:text-sm luno:leading-sm luno:text-modalTextSecondary luno:font-medium luno:text-ellipsis luno:overflow-hidden luno:whitespace-nowrap",t?.name&&t?.name.length>30?"luno:w-[90%]":""),children:t?.name||a?.name})]})]}):K(Bt,{children:[C("button",{className:i("luno:flex luno:items-center luno:justify-center luno:w-[30px] luno:h-[30px] luno:cursor-pointer luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200"),onClick:()=>d("main"),"aria-label":"Back",children:C(J,{})}),C(D,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300"),children:r})]}),C(E,{className:i("luno:shrink-0 luno:z-10 luno:flex luno:items-center luno:justify-center luno:h-[30px] luno:w-[30px] luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200 luno:cursor-pointer"),children:C(R,{})})]}),C("div",{ref:p,className:i("luno:relative"),children:C("div",{ref:u,children:m[s]})})]})})};import{jsx as q,jsxs as Ee}from"react/jsx-runtime";var ge=({container:o})=>{let{isOpen:n,close:e}=no();return q(U,{container:o,open:n,onOpenChange:l=>!l&&e(),children:Ee("div",{className:"luno:flex luno:flex-col luno:w-full luno:md:w-[360px] luno:max-h-[512px] luno:p-4 luno:gap-3.5 luno:text-modalText",children:[Ee("div",{className:"luno:flex luno:items-center luno:justify-between luno:w-full",children:[q("div",{className:"luno:w-[30px]"})," ",q(D,{className:"luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300",children:"Select Network"}),q(E,{className:"luno:z-10 luno:flex luno:items-center luno:justify-center luno:h-[30px] luno:w-[30px] luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200 luno:cursor-pointer",children:q(R,{})})]}),q(bo,{})]})})};import{formatAddress as Zt}from"@luno-kit/react/utils";import{ConnectionStatus as ko,useAccount as Ot,useActiveConnector as Et,useBalance as Dt,useChain as _t,useChains as Gt,useStatus as Ht}from"@luno-kit/react";function De(){let o=Ht(),{account:n,address:e}=Ot(),{chain:l}=_t(),t=Gt(),{data:a}=Dt({address:t.length>0?e:void 0}),s=Et(),{open:p,isOpen:u}=oo(),{open:d,isOpen:f}=eo(),{open:c,isOpen:r}=no(),m=o===ko.Connecting,h=o===ko.Connected,v=o===ko.Disconnected||o===ko.Disconnecting,M=!!l&&t.some(x=>x.genesisHash.toLowerCase()===l.genesisHash.toLowerCase());return{activeConnector:s,connectionStatus:o,isConnected:h,isDisconnected:v,isConnecting:m,account:n,address:e,currentChain:l,configuredChains:t,isChainSupported:M,chainIconUrl:l?.chainIconUrl,chainName:l?.name,balance:a,openConnectModal:p,openAccountModal:d,openChainModal:c,isConnectModalOpen:u,isAccountModalOpen:f,isChainModalOpen:r}}import{useEffect as Ft,useState as $t}from"react";var No=()=>{let[o,n]=$t({height:void 0,width:void 0});return Ft(()=>{let e=we(()=>{n({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),o};import{jsx as H,jsxs as ro}from"react/jsx-runtime";var ao="luno:transition-transform luno:transition-[125] luno:hover:scale-[1.03] luno:transition-ease",zt=({className:o,label:n="Connect Wallet",accountStatus:e="full",chainStatus:l="full",showBalance:t=!0,displayPreference:a="address"})=>{let{isConnected:s,isDisconnected:p,account:u,balance:d,openConnectModal:f,openAccountModal:c,openChainModal:r,chainIconUrl:m,chainName:h,currentChain:v,configuredChains:M,activeConnector:x}=De(),{width:O}=No(),N=O&&O>768;return p||!s||!x?H("button",{type:"button",onClick:()=>f?.(),className:i("luno-kit luno:cursor-pointer luno:font-semibold luno:inline-flex luno:items-center luno:justify-center luno:focus:outline-none","luno:text-connectButtonText luno:bg-connectButtonBackground luno:shadow-button luno:active:scale-[0.95]","luno:rounded-connectButton",ao,"luno:px-3.5 luno:text-base luno:leading-base luno:min-h-[40px]",o),children:n}):ro("div",{className:i("luno-kit luno:text-modalText luno:flex luno:items-stretch luno:bg-transparent luno:font-semibold luno:text-base luno:leading-base luno:gap-3",o),children:[l!=="none"&&M.length>0&&ro("button",{type:"button",onClick:()=>r?.(),className:i("luno:flex luno:items-center luno:rounded-currentNetworkButton luno:cursor-pointer","luno:bg-currentNetworkButtonBackground luno:shadow-button","luno:py-2 luno:px-2.5 luno:gap-1.5",ao),"aria-label":"Switch chain",children:[l==="full"||l==="icon"?H(_,{iconUrl:m,resourceName:`${h}-chain`,className:i("luno:w-[24px] luno:h-[24px]")}):null,(l==="full"||l==="name")&&N&&H("span",{children:v?.name||"Unknown Chain"})]}),ro("button",{type:"button",onClick:()=>c?.(),className:i("luno:flex luno:items-center luno:cursor-pointer luno:rounded-connectButton luno:bg-connectButtonBackground luno:shadow-button",ao),"aria-label":"Open account modal",children:[M.length>0&&t&&N&&H("div",{className:i("luno:p-2 luno:pl-3"),children:d?ro("span",{children:[d?.formattedTransferable||d?.formattedTotal||0," ",v?.nativeCurrency?.symbol||""]}):H("span",{className:i("luno:block luno:animate-pulse luno:rounded luno:w-[80px] luno:h-[20px] luno:bg-accountActionItemBackgroundHover")})}),ro("div",{className:i("luno:flex luno:items-center luno:overflow-hidden luno:bg-connectButtonInnerBackground luno:border-2 luno:border-connectButtonBackground luno:rounded-connectButton luno:gap-1.5 luno:max-h-[40px]",M.length>0&&t&&N?"luno:bg-connectButtonInnerBackground luno:py-1.5 luno:px-2":"luno:bg-connectButtonBackground luno:py-2 luno:px-2.5"),children:[e==="full"&&H("span",{className:i("luno:w-[24px] luno:h-[24px] luno:flex luno:items-center luno:justify-center"),children:H("img",{src:x.icon,alt:"luno account"})}),H("span",{className:i(a==="name"&&u?.name?"luno:text-ellipsis luno:overflow-hidden luno:max-w-[115px] luno:whitespace-nowrap":""),children:a==="name"&&u?.name?u?.name:Zt(u?.address)})]})]})]})};import{useConnect as nl}from"@luno-kit/react";import{isMobileDevice as tl}from"@luno-kit/react/utils";import{useEffect as ll,useMemo as rl,useState as We}from"react";import _e from"react";function so(o,n){if(!o)return n;if(_e.isValidElement(n)){let{className:e,children:l,...t}=n.props||{};return _e.createElement(n.type,{...t,className:e},o)}return o}import{useConfig as Ut,useConnectors as jt}from"@luno-kit/react";import{isMobileDevice as Wt}from"@luno-kit/react/utils";import Fe,{useMemo as Qt}from"react";import{jsx as B,jsxs as Ze}from"react/jsx-runtime";var Ge=["polkadot-js","subwallet-js","talisman","walletconnect","nova","nova-mobile"];var $e=Fe.memo(({onConnect:o,showInstalledGroup:n})=>{let e=jt(),l=Ut(),t=e.filter(u=>u.isInstalled()),a=e.filter(u=>Ge.includes(u.id)&&!u.isInstalled()),s=e.filter(u=>!Ge.includes(u.id)&&!u.isInstalled()),p=Qt(()=>{if(!l?.connectorGroups)return[{title:"Installed",group:t},{title:"Popular",group:a},{title:"More",group:s}];if(l.connectorGroups.some(r=>r.groupName==="Installed")||!n)return l.connectorGroups.filter(r=>r.wallets.length>0).map(r=>({title:r.groupName,group:r.wallets})).sort((r,m)=>r.title==="Installed"?-1:m.title==="Installed"?1:0);let f=l.connectorGroups.flatMap(r=>r.wallets).filter(r=>r.isInstalled()),c=l.connectorGroups.map(r=>({title:r.groupName,group:r.wallets.filter(m=>!m.isInstalled())})).filter(r=>r.group.length>0);return[...f.length>0?[{title:"Installed",group:f}]:[],...c]},[t,a,s,l?.connectorGroups,n]);if(Wt()){let u=e.filter(d=>d.id!=="polkadot-js").filter(d=>d.links.deepLink||d.isInstalled());return B("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-1 luno:w-full",children:u.map(d=>B(He,{connector:d,onConnect:()=>o(d)},`${d.id}-${d.name}`))})}return B("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-4 luno:w-full luno:overflow-y-auto luno:max-h-[400px]",children:p.map(u=>u.group.length===0?null:Ze("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-2 luno:w-full",children:[B("div",{className:i("luno:text-sm luno:font-semibold luno:leading-base",u.title==="Installed"?"luno:text-accentColor":"luno:text-modalTextSecondary"),children:u.title}),B("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-1.5 luno:w-full",children:u.group.map(d=>B(He,{connector:d,onConnect:()=>o(d)},d.id))})]},u.title))})}),He=Fe.memo(({connector:o,onConnect:n})=>Ze("button",{onClick:n,className:i("luno:cursor-pointer luno:bg-walletSelectItemBackground luno:p-2 luno:w-full luno:flex luno:items-center luno:gap-3 luno:rounded-walletSelectItem luno:border-none","luno:hover:bg-walletSelectItemBackgroundHover luno:transition-transform luno:active:scale-[0.95]","luno:text-left"),children:[B("div",{className:"luno:w-[28px] luno:h-[28px] luno:rounded-[6px] luno:overflow-hidden",children:B("img",{src:o.icon,alt:o.name,className:"luno:w-full luno:h-full"})}),B("span",{className:"luno:font-semibold luno:leading-base luno:text-base luno:text-modalText",children:o.name})]}));import Yt,{useMemo as ol}from"react";import{Cuer as Kt}from"cuer";import{jsx as F,jsxs as ze}from"react/jsx-runtime";var Ue=({logoBackground:o,uri:n,size:e})=>{if(!n){let a=Math.floor(14.25),s=e/57,p=a*s,u=Math.ceil(57/2-a/2),d=u+a,f=()=>{let m=[];for(let h=0;h<57;h++)for(let v=0;v<57;v++){if(h>=u&&h<d&&v>=u&&v<d||h<8&&v<8||h<8&&v>=49||h>=49&&v<8)continue;let x=v+.5,O=h+.5;m.push(F("rect",{x:x-.4,y:O-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${v}`))}return m},c=({position:m})=>{let h=7*s,v={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return ze("div",{className:"luno:absolute luno:z-[4]",style:{width:`${h}px`,height:`${h}px`,...v[m]},children:[F("div",{className:"luno:absolute luno:inset-0",style:{borderRadius:`${2*s}px`,border:`${s}px solid var(--color-walletSelectItemBackground)`}}),F("div",{className:"luno:absolute luno:left-1/2 luno:top-1/2 luno:-translate-x-1/2 luno:-translate-y-1/2",style:{width:`${3*s}px`,height:`${3*s}px`,borderRadius:`${.5*s}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},r=()=>{let m=u*s;return F("div",{className:"luno:absolute luno:z-[4] luno:flex luno:items-center luno:justify-center luno:box-border",style:{width:`${p}px`,height:`${p}px`,left:`${m}px`,top:`${m}px`,borderRadius:`${s}px`,padding:`${s/2}px`},children:F("img",{src:o,alt:"QR Code Logo",className:"luno:h-full luno:w-full luno:object-cover",style:{borderRadius:`${s}px`}})})};return ze("div",{className:"luno:relative luno:overflow-hidden luno:flex luno:items-center luno:justify-center",style:{width:e,height:e,borderRadius:`${2*s}px`},children:[F("svg",{className:"luno:absolute luno:inset-0 luno:z-[3]",width:e,height:e,viewBox:"0 0 57 57",children:f()}),F("div",{className:"luno:absolute luno:inset-0 luno: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"}}),c({position:"top-left"}),c({position:"top-right"}),c({position:"bottom-left"}),o&&r()]})}return F(Kt,{arena:o,value:n})};import{useEffect as qt,useRef as Jt}from"react";import{jsx as Xt}from"react/jsx-runtime";var je=({size:o=160,dotCount:n=300,duration:e=3,className:l=""})=>{let t=Jt(null);return qt(()=>{if(!t.current)return;let a=1,s=2,p=Math.PI*(3-Math.sqrt(5)),u=o/2,d=u-s-a,f="http://www.w3.org/2000/svg";t.current.innerHTML="";let c=document.createElementNS(f,"svg");c.setAttribute("width",o.toString()),c.setAttribute("height",o.toString()),c.setAttribute("viewBox",`0 0 ${o} ${o}`),c.style.display="block",t.current.appendChild(c);for(let r=0;r<n;r++){let m=r+.5,h=m/n,v=Math.sqrt(h)*d,M=m*p,x=u+v*Math.cos(M),O=u+v*Math.sin(M),N=document.createElementNS(f,"circle");N.setAttribute("cx",x.toString()),N.setAttribute("cy",O.toString()),N.setAttribute("r",a.toString()),N.setAttribute("fill","currentColor"),N.setAttribute("opacity","0.6"),c.appendChild(N);let V=document.createElementNS(f,"animate");V.setAttribute("attributeName","r"),V.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),V.setAttribute("dur",`${e}s`),V.setAttribute("begin",`${h*e}s`),V.setAttribute("repeatCount","indefinite"),V.setAttribute("calcMode","spline"),V.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),N.appendChild(V);let S=document.createElementNS(f,"animate");S.setAttribute("attributeName","opacity"),S.setAttribute("values","0.2;1;0.2"),S.setAttribute("dur",`${e}s`),S.setAttribute("begin",`${h*e}s`),S.setAttribute("repeatCount","indefinite"),S.setAttribute("calcMode","spline"),S.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),N.appendChild(S)}},[o,n,e]),Xt("div",{ref:t,className:i("luno:text-accentColor luno:inline-flex luno:w-full luno:h-full luno:justify-center luno:align-center",l)})};import{Fragment as el,jsx as g,jsxs as P}from"react/jsx-runtime";var Wo=Yt.memo(({selectedConnector:o,onConnect:n,qrCode:e,isWide:l,connectState:t,appInfo:a})=>{let{themeMode:s}=co(),p=ol(()=>{if(!a?.decorativeImage)return;let{light:d,dark:f}=a.decorativeImage;return{url:s==="dark"&&f||d}},[a?.decorativeImage,s]),u=o?.hasConnectionUri();return P("div",{className:i("luno:flex luno:flex-col luno:items-center",l?"luno:w-[450px] luno:p-4 luno:min-h-[472px]":"luno:justify-center luno:w-full luno:min-h-[400px]"),children:[l&&g("div",{className:"luno:w-full",children:P("div",{className:"luno:flex luno:items-center luno:justify-between",children:[g("div",{}),g(E,{className:"luno:z-10 luno:w-[30px] luno:h-[30px] luno:flex luno:items-center luno:justify-center luno:cursor-pointer luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200",children:g(R,{})})]})}),g("div",{className:i("luno:flex luno:items-center luno:gap-4 luno:flex-col luno:grow luno:justify-center",o&&u?"luno:max-w-[300px]":"luno:max-w-[360px]"),children:o?u?P("div",{className:"luno:flex luno:flex-col luno:items-center luno:gap-2.5",children:[g(Ue,{size:300,logoBackground:o.icon,uri:e}),P("div",{className:"luno:text-base luno:leading-base luno:font-medium luno:text-center luno:text-modalTextSecondary",children:["Scan the QR code with"," ",o.id==="nova"?"the Nova":"your phone"]}),g("div",{className:"luno:min-h-[20px] luno:flex luno:items-center luno:justify-center",children:o.links?.browserExtension?P("div",{onClick:()=>window.open(o.links.browserExtension),className:"luno:cursor-pointer luno:text-sm luno:text-accentColor luno:font-medium luno:text-center luno:hover:text-modalText",children:["Don't have ",o.name,"?"]}):e?g(fo,{className:"luno:text-sm luno:leading-sm luno:font-medium luno:text-accentColor",copyText:e,label:"Copy Link"}):null})]}):P(el,{children:[g("div",{className:"luno:w-[80px] luno:h-[80px]",children:g("img",{src:o.icon,className:"luno:w-full luno:h-full",alt:""})}),P("p",{className:"luno:text-lg luno:leading-lg luno:text-modalFont luno:font-bold",children:["Opening ",o.name,"..."]}),g("p",{className:"luno:pb-[10px] luno:text-base luno:text-modalTextSecondary luno:leading-base luno:font-medium luno:text-center",children:o.id==="ledger"?t.error?.message:"Confirm connection in the extension"}),t.isConnecting&&g("div",{className:"luno-loading luno:text-modalText luno:w-[24px]"}),!o.isInstalled()&&o.links.browserExtension&&P("div",{onClick:()=>window.open(o.links.browserExtension),className:"luno:cursor-pointer luno:pt-6 luno:text-sm luno:text-accentColor luno:font-medium luno:text-center luno:hover:text-modalText",children:["Don't have ",o.name,"?"]}),!t.isConnecting&&t.isError&&(o?.isInstalled()||o?.id==="ledger")&&g("button",{className:i("luno:rounded-connectButton luno:focus:outline-none luno:py-[4px] luno:px-[12px] luno:cursor-pointer luno:font-semibold luno:text-sm luno:text-modalText luno:bg-connectButtonBackground luno:shadow-connectButton luno:active:scale-[0.95]",ao),onClick:()=>n(o),children:"Retry"})]}):P("div",{className:"luno:relative luno:flex luno:flex-col luno:items-center luno:w-full luno:grow luno:gap-4 luno:pt-[60px]",children:[p?.url?g("div",{className:"luno:w-[160px] luno:h-[160px]",children:g("img",{src:p.url,alt:"Luno Kit",className:"luno:w-full luno:h-full luno:object-contain"})}):g("div",{className:"luno:w-[160px] luno:h-[160px]",children:g(je,{})}),so(a?.guideText,g("div",{className:"luno:cursor-pointer luno:text-base luno:leading-base luno:text-accentColor luno:font-semibold luno:text-center luno:hover:text-modalText",onClick:()=>window.open(a?.guideLink||"https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})),so(a?.description,g("p",{className:"luno:text-modalTextSecondary luno:w-[250px] luno:text-sm luno:leading-sm luno:font-medium luno:text-center",children:"Connect your wallet to start exploring and interacting with DApps."})),l&&a?.policyLinks?.terms&&a?.policyLinks?.privacy&&P("div",{className:"luno:absolute luno:bottom-0 luno:left-0 luno:right-0 luno:text-modalTextSecondary luno:text-xs luno:leading-xs luno:font-regular luno:text-center",children:[g("span",{children:"By connecting your wallet, you agree to our "}),g("a",{href:a.policyLinks.terms,target:a.policyLinks.target||"_blank",rel:"noreferrer noopener",className:"luno:text-accentColor luno:font-regular luno:hover:text-modalText",children:"Terms of Service"}),g("span",{children:" & "}),g("a",{href:a.policyLinks.privacy,target:a.policyLinks.target||"_blank",rel:"noreferrer noopener",className:"luno:text-accentColor luno:font-medium luno:hover:text-modalText",children:"Privacy Policy"})]})]})}),g("div",{})]})});import{Fragment as Qe,jsx as y,jsxs as $}from"react/jsx-runtime";var ve=({appInfo:o,container:n,showInstalledGroup:e=!0,size:l="wide"})=>{let{isOpen:t,close:a}=oo(),{connectAsync:s,reset:p,isPending:u,isError:d,error:f}=nl(),[c,r]=We(null),[m,h]=We(),{width:v}=No(),M=v&&v>768,x=!!(l==="wide"&&M),{containerRef:O,currentViewRef:N,resetView:V,handleViewChange:S,currentView:z}=uo({initialView:"Connect Wallet"}),Ke=async A=>{let Qo=await A.getConnectionUri();h(Qo)},io=async A=>{if(tl()&&A.links.deepLink)try{await s({connectorId:A.id}),So(!1);return}catch{window.location.href=`${A.links.deepLink}?url=${window.location.href}`;return}!x&&S("walletView"),r(A),h(void 0),A.hasConnectionUri()&&Ke(A),await s({connectorId:A.id}),So(!1)},So=A=>{!A&&a(),p(),V(),r(null),h(void 0)},qe=rl(()=>({"Connect Wallet":y($e,{onConnect:io,showInstalledGroup:e}),walletView:y(Wo,{connectState:{isConnecting:u,isError:d,error:f},isWide:x,selectedConnector:c,qrCode:m,onConnect:io,appInfo:o})}),[x,c,m,io,u,d,f,o,e]);return ll(()=>{x&&z==="walletView"&&S("Connect Wallet")},[x,z]),$(U,{open:t,onOpenChange:So,container:n,children:[$("div",{className:i("luno:flex luno:items-stretch luno:justify-between luno:w-full luno:md:max-h-[504px] luno:md:max-w-[724px]"),children:[$("div",{className:i("luno:flex luno:flex-col luno:items-start luno:py-4 luno:px-5 luno:w-full luno:md:w-auto",x?"luno:md:min-w-[300px] luno:border-r-[1px] luno:border-r-solid luno:border-r-separatorLine":"luno:md:min-w-[360px]"),children:[$("div",{className:i("luno:flex luno:items-center luno:justify-between luno:w-full",!x&&"luno:pb-4"),children:[z==="Connect Wallet"?$(Qe,{children:[!x&&y("div",{className:i("luno:w-[30px] luno:h-[30px]"),"aria-hidden":!0}),y(D,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-bold",x?"luno:pb-6":"luno:flex-1 luno:text-center"),children:"Connect Wallet"})]}):$(Qe,{children:[y("button",{className:i("luno:flex luno:items-center luno:justify-center luno:w-[30px] luno:h-[30px] luno:cursor-pointer luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200"),onClick:()=>S("Connect Wallet"),"aria-label":"Back",children:y(J,{})}),y(D,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300"),children:c?.name})]}),!x&&y(E,{className:"luno:z-10 luno:w-[30px] luno:h-[30px] luno:flex luno:items-center luno:justify-center luno:cursor-pointer luno:rounded-modalControlButton luno:border-none luno:hover:bg-modalControlButtonBackgroundHover luno:transition-colors luno:duration-200",children:y(R,{})})]}),y("div",{ref:O,className:i("luno:relative luno:overflow-hidden luno:w-full",!x&&"luno:flex-1 luno:overflow-auto"),children:y("div",{ref:N,children:qe[z]})}),!x&&z==="Connect Wallet"&&so(o?.guideText,y("p",{className:"luno:cursor-pointer luno:w-full luno:pt-4 luno:text-sm luno:leading-sm luno:text-accentColor luno:font-medium luno:text-center luno:hover:text-modalText",onClick:()=>window.open(o?.guideLink||"https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}))]}),x&&y(Wo,{connectState:{isConnecting:u,isError:d,error:f},isWide:x,selectedConnector:c,qrCode:m,onConnect:io,appInfo:o})]}),!x&&z==="Connect Wallet"&&o?.policyLinks?.terms&&o?.policyLinks?.privacy&&$("div",{className:"luno:w-full luno:border-t luno:border-t-separatorLine luno:flex luno:flex-col luno:items-center luno:gap-1 luno:p-3",children:[y("div",{className:"luno:text-modalTextSecondary luno:text-xs luno:leading-xs luno:font-regular luno:text-center",children:"By connecting your wallet, you agree to our"}),$("div",{className:"luno:text-xs luno:leading-xs luno:font-regular luno:text-center luno:text-modalTextSecondary",children:[y("a",{href:o.policyLinks.terms,target:o.policyLinks.target||"_blank",rel:"noreferrer noopener",className:"luno:text-accentColor luno:font-medium luno:hover:text-modalText",children:"Terms of Service"}),y("span",{className:"luno:px-1",children:"&"}),y("a",{href:o.policyLinks.privacy,target:o.policyLinks.target||"_blank",rel:"noreferrer noopener",className:"luno:text-accentColor luno:font-medium luno:hover:text-modalText",children:"Privacy Policy"})]})]})]})};export{zt as ConnectButton,mr as LunoKitProvider,eo as useAccountModal,no as useChainModal,Tn as useCloseAllModals,oo as useConnectModal,co as useLunoTheme};
3
3
  //# sourceMappingURL=index.js.map