@luno-kit/ui 0.0.9-beta.0 → 0.0.10

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.js CHANGED
@@ -1,3 +1,3 @@
1
1
  'use client'
2
- import{useAccount as At,useActiveConnector as Mt}from"@luno-kit/react";import{formatAddress as It}from"@luno-kit/react/utils";import{useCallback as Vt,useMemo as Ve}from"react";import{jsx as zo}from"react/jsx-runtime";var ze=o=>zo("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:zo("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"})}),Co=ze;import{jsx as Uo}from"react/jsx-runtime";var Ue=o=>Uo("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...o,children:Uo("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=Ue;import{jsx as jo}from"react/jsx-runtime";var je=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=je;import{jsx as K,jsxs as Qe}from"react/jsx-runtime";var We=o=>Qe("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:[K("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"}),K("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"}),K("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"}),K("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"}),K("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"})]}),bo=We;import{jsx as Wo}from"react/jsx-runtime";var qe=o=>Wo("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:Wo("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"})}),yo=qe;import{jsx as Qo,jsxs as Je}from"react/jsx-runtime";var Ke=o=>Je("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:[Qo("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"}),Qo("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"})]}),No=Ke;import{jsx as qo}from"react/jsx-runtime";var Xe=o=>qo("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...o,children:qo("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"})}),So=Xe;import{jsx as Ko,jsxs as on}from"react/jsx-runtime";var Ye=o=>on("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 38 38",fill:"none",...o,children:[Ko("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"}),Ko("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"})]}),ko=Ye;import{jsx as Jo}from"react/jsx-runtime";var en=o=>Jo("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...o,children:Jo("path",{d:"M14 6.5C14 6.63261 13.9473 6.75979 13.8536 6.85355C13.7598 6.94732 13.6326 7 13.5 7C13.3674 7 13.2402 6.94732 13.1464 6.85355C13.0527 6.75979 13 6.63261 13 6.5V3.7075L8.85437 7.85375C8.76055 7.94757 8.63331 8.00028 8.50062 8.00028C8.36794 8.00028 8.2407 7.94757 8.14688 7.85375C8.05305 7.75993 8.00035 7.63268 8.00035 7.5C8.00035 7.36732 8.05305 7.24007 8.14688 7.14625L12.2925 3H9.5C9.36739 3 9.24021 2.94732 9.14645 2.85355C9.05268 2.75979 9 2.63261 9 2.5C9 2.36739 9.05268 2.24021 9.14645 2.14645C9.24021 2.05268 9.36739 2 9.5 2H13.5C13.6326 2 13.7598 2.05268 13.8536 2.14645C13.9473 2.24021 14 2.36739 14 2.5V6.5ZM11.5 8C11.3674 8 11.2402 8.05268 11.1464 8.14645C11.0527 8.24021 11 8.36739 11 8.5V13H3V5H7.5C7.63261 5 7.75979 4.94732 7.85355 4.85355C7.94732 4.75979 8 4.63261 8 4.5C8 4.36739 7.94732 4.24021 7.85355 4.14645C7.75979 4.05268 7.63261 4 7.5 4H3C2.73478 4 2.48043 4.10536 2.29289 4.29289C2.10536 4.48043 2 4.73478 2 5V13C2 13.2652 2.10536 13.5196 2.29289 13.7071C2.48043 13.8946 2.73478 14 3 14H11C11.2652 14 11.5196 13.8946 11.7071 13.7071C11.8946 13.5196 12 13.2652 12 13V8.5C12 8.36739 11.9473 8.24021 11.8536 8.14645C11.7598 8.05268 11.6326 8 11.5 8Z",fill:"currentColor"})}),To=en;import{jsx as Xo}from"react/jsx-runtime";var nn=o=>Xo("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:Xo("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"})}),Ao=nn;import{jsx as Yo}from"react/jsx-runtime";var tn=o=>Yo("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:Yo("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"})}),Mo=tn;import{jsx as oe}from"react/jsx-runtime";var ln=o=>oe("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:oe("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"})}),Io=ln;import{jsx as ee}from"react/jsx-runtime";var rn=o=>ee("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:ee("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"})}),Vo=rn;import{useCallback as ne,useRef as te,useState as le}from"react";function ao({initialView:o,animationDuration:n=200,animationEasing:e="ease-out"}){let[l,t]=le(o),[r,s]=le(!1),c=te(null),m=te(null),p=ne(d=>{if(d===l||r)return;if(s(!0),!c.current){t(d),s(!1);return}let a=c.current,u=a.offsetHeight;t(d),requestAnimationFrame(()=>{if(!a||!m.current){s(!1);return}let h=m.current.offsetHeight;a.animate([{height:`${u}px`},{height:`${h}px`}],{duration:n,easing:e,fill:"forwards"}).addEventListener("finish",()=>{s(!1)})})},[l,r,n,e]),f=ne(()=>{t(o),s(!1)},[o]);return{currentView:l,isAnimating:r,containerRef:c,currentViewRef:m,handleViewChange:p,resetView:f}}import{createContext as sn,useCallback as un,useContext as cn,useEffect as se,useMemo as Po,useState as Bo}from"react";import{useEffect as an}from"react";var re=["--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"],ae=(o,n)=>{an(()=>{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&&(re.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),re.forEach(l=>{e.style.removeProperty(l)}))},[o,n])};import{jsx as pn}from"react/jsx-runtime";var Lo="luno.lastThemePreference",dn=o=>{try{localStorage.setItem(Lo,JSON.stringify(o))}catch{}},ie=sn(void 0),Ro=o=>"colors"in o&&"fonts"in o&&"radii"in o&&"shadows"in o&&"blurs"in o,mn=()=>{let[o,n]=Bo(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return se(()=>{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},Eo=({children:o,theme:n})=>{let e=mn(),[l,t]=Bo(()=>{if(typeof window<"u")try{let a=localStorage.getItem(Lo);if(a){let u=JSON.parse(a);if(u?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(u?.preferredTheme)return u.preferredTheme}}catch{}return!n||Ro(n)?"light":n.defaultMode||"light"}),[r,s]=Bo(()=>{if(typeof window<"u")try{let a=localStorage.getItem(Lo);if(a)return JSON.parse(a)?.isAuto??!1}catch{}return!n||Ro(n)?!1:n.autoMode??!1}),c=Po(()=>{if(!n)return{type:"default",completeTheme:null,partialOverrides:null};if(Ro(n))return{type:"complete",completeTheme:n,partialOverrides:null};let d=n;if(d.theme)return{type:"complete",completeTheme:d.theme,partialOverrides:null};let a=null;return l==="light"&&d.light?a=d.light:l==="dark"&&d.dark?a=d.dark:a={...d},{type:"partial",completeTheme:null,partialOverrides:a}},[l,n]),m=Po(()=>c.type==="complete"?c.completeTheme:null,[c]);ae(c,l);let p=un(d=>{let a=d==="auto";s(a),t(a?e||"light":d);let u={isAuto:a,...a?{}:{preferredTheme:d}};dn(u)},[e]);se(()=>{r&&t(e||"light")},[e,r]);let f=Po(()=>({themeMode:l,setThemeChoice:p,currentTheme:m}),[l,p,m]);return pn(ie.Provider,{value:f,children:o})},ue=()=>{let o=cn(ie);if(!o)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return o};import{LunoProvider as bn}from"@luno-kit/react";import{QueryClient as yn,QueryClientProvider as Nn}from"@tanstack/react-query";import{useState as Sn}from"react";import{ConnectionStatus as so,useStatus as fn}from"@luno-kit/react";import{createContext as hn,useCallback as _o,useContext as io,useEffect as xn,useMemo as gn,useState as vn}from"react";import{jsx as Cn}from"react/jsx-runtime";function Do(){let[o,n]=vn(!1),e=_o(()=>n(!0),[]),l=_o(()=>n(!1),[]);return{isOpen:o,open:e,close:l}}var J=hn(void 0),ce=({children:o})=>{let{isOpen:n,open:e,close:l}=Do(),{isOpen:t,open:r,close:s}=Do(),{isOpen:c,open:m,close:p}=Do(),f=fn(),d=_o(()=>{l(),s(),p()},[l,s,p]);xn(()=>{f===so.Disconnected&&(s(),p())},[f,s,p]);let a=gn(()=>({isConnectModalOpen:n,isAccountModalOpen:t,isChainModalOpen:c,openConnectModal:f!==so.Connected?e:void 0,closeConnectModal:l,openAccountModal:f===so.Connected?r:void 0,closeAccountModal:s,openChainModal:f===so.Connected?m:void 0,closeChainModal:p,closeAllModals:d}),[n,e,l,t,r,s,c,m,p,d,f]);return Cn(J.Provider,{value:a,children:o})},X=()=>{let o=io(J);if(!o)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:o.isConnectModalOpen,open:o.openConnectModal,close:o.closeConnectModal}},Y=()=>{let o=io(J);if(!o)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:o.isAccountModalOpen,open:o.openAccountModal,close:o.closeAccountModal}},oo=()=>{let o=io(J);if(!o)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:o.isChainModalOpen,open:o.openChainModal,close:o.closeChainModal}},wn=()=>{let o=io(J);if(!o)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return o.closeAllModals};import{Fragment as Tn,jsx as D,jsxs as de}from"react/jsx-runtime";var cr=({children:o,config:n,queryClientConfig:e,theme:l})=>{let[t]=Sn(()=>new yn(e));return D(Nn,{client:t,children:D(bn,{config:n,children:D(Eo,{theme:l,children:de(ce,{children:[D("div",{children:o}),D(kn,{modalSize:n.modalSize})]})})})})},kn=({modalSize:o})=>de(Tn,{children:[D(fe,{size:o}),D(me,{}),D(pe,{})]});import{clsx as An}from"clsx";import{extendTailwindMerge as Mn}from"tailwind-merge";var In=Mn({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function i(...o){return In(An(o))}function he(o,n){let e;return()=>{e&&clearTimeout(e),e=setTimeout(()=>{e=null,o()},n)}}import{useCallback as Vn,useState as Pn}from"react";import{jsx as xe,jsxs as Rn}from"react/jsx-runtime";var uo=({copyText:o,label:n,className:e=""})=>{let[l,t]=Pn(!1),r=Vn(async s=>{try{return navigator.clipboard?.writeText?(await navigator.clipboard.writeText(s),t(!0),setTimeout(()=>t(!1),2e3),!0):!1}catch(c){return console.error("Copy failed:",c),!1}},[]);return Rn("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?xe(Io,{className:"luno:text-accentColor",width:16,height:16}):xe(yo,{width:16,height:16}),n]})};import*as M from"@radix-ui/react-dialog";import Oo from"react";import{jsx as ge,jsxs as Dn}from"react/jsx-runtime";var Bn=({open:o,onOpenChange:n,children:e,contentClassName:l,overlayClassName:t})=>ge(M.Root,{open:o,onOpenChange:n,children:Dn(M.Portal,{children:[Oo.createElement(M.Overlay,{className:i("luno:fixed luno:inset-0 luno:z-[100] luno:bg-modalBackdrop luno-kit","luno:data-[state=open]:[animation:overlay-in_150ms_ease-out]",t)}),ge(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})]})}),Ln=({children:o,className:n})=>Oo.createElement(M.Title,{className:n},o),En=({children:o,className:n,onClick:e})=>Oo.createElement(M.Close,{className:n,onClick:e},o),Z=Bn,_=En,O=Ln;import{useState as Jn}from"react";import{useAccount as $n,useChain as Zn}from"@luno-kit/react";import Ce,{useMemo as be,useState as zn}from"react";import{useAccount as _n,useChain as On,useConfig as Hn}from"@luno-kit/react";import{formatBalance as co}from"@luno-kit/react/utils";import{useQuery as Fn}from"@tanstack/react-query";var Gn=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||[],s=t.data.native||[],c=t.data.builtin||[],m=r.filter(a=>a.token_image||a.unique_id?.includes("nft")).map(a=>({balance:a.balance,decimals:a.decimals,balanceFormatted:co(a.balance,a.decimals),logoURI:a.token_image,symbol:a.symbol,assetId:a.asset_id,price:a.price})),p=r.filter(a=>!a.token_image&&!a.unique_id?.includes("nft")).map(a=>({balance:a.balance,decimals:a.decimals,balanceFormatted:co(a.balance,a.decimals,4),logoURI:a.token_image,symbol:a.symbol,assetId:a.asset_id,price:a.price})),f=s.map(a=>({balance:a.balance,decimals:a.decimals,balanceFormatted:co(a.balance,a.decimals,4),logoURI:"",symbol:a.symbol,assetId:0,price:a.price})),d=c.map(a=>({balance:a.balance,decimals:a.decimals,balanceFormatted:co(a.balance,a.decimals,4),logoURI:"",symbol:a.symbol,assetId:a.unique_id,price:a.price}));return{nfts:[...m],tokens:[...f,...p,...d]}}catch(l){throw console.error("Failed to fetch tokens from Subscan:",l),l}};function z(){let{address:o}=_n(),n=Hn(),{chain:e}=On(),l=e?.subscan?.api,t=n?.subscan?.apiKey;return Fn({queryKey:["subscan","asset-list",o,e?.genesisHash,l,t],queryFn:()=>Gn({address:o,apiKey:t,apiUrl:l}),enabled:!!o&&!!t&&!!l,staleTime:n?.subscan?.cacheTime||6e4})}import{jsx as ve,jsxs as we}from"react/jsx-runtime";var mo=({type:o})=>we("div",{className:"luno:flex luno:flex-col luno:gap-1 luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center",children:[ve(ko,{className:"luno:w-[38px] luno:h-[38px] luno:mb-2"}),we("div",{className:"luno:text-modalText luno:text-base luno:leading-base",children:["No ",o," found"]}),ve("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 C,jsxs as eo}from"react/jsx-runtime";var ye=Ce.memo(()=>{let{data:o,isFetching:n,error:e}=z(),l=be(()=>o?o.nfts:[],[o]);return n?C("div",{className:"luno:flex luno:justify-center luno:w-full",children:C("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=>C("div",{className:"luno:animate-pulse luno:bg-skeleton luno:w-[155px] luno:h-[198px] luno:rounded-assetSelectItem"},`skeleton-${t}`))})}):e?eo("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center luno:p-4",children:[C("div",{className:"luno:text-error luno:mb-2",children:"Failed to load assets"}),C("div",{className:"luno:text-modalTextSecondary luno:text-sm",children:e instanceof Error?e.message:"Unknown error"})]}):l.length?C("div",{className:"luno:flex luno:justify-center luno:w-full",children:C("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=>C(Un,{asset:t},`${t.symbol}-${t.balance}`))})}):C(mo,{type:"NFTs"})}),Un=Ce.memo(({asset:o})=>{let{chain:n}=Zn(),{address:e}=$n(),[l,t]=zn(!!o.logoURI),r=be(()=>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 C("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:eo("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center",children:[eo("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&&C("div",{className:"luno:absolute luno:inset-0 luno:flex luno:items-center luno:justify-center luno:animate-pulse luno:bg-gray-500",children:C("div",{className:"luno:w-4 luno:h-4 luno:border-2 luno:border-t-transparent luno:border-white luno:rounded-full luno:animate-spin"})}),o.logoURI?C("img",{src:o.logoURI,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)}):C(No,{className:"luno:w-full luno:h-full luno:object-cover"})]}),eo("div",{className:"luno:flex luno:items-center luno:justify-between luno:w-full luno:mt-0.5",children:[eo("span",{className:"luno:font-medium luno:text-sm luno:leading-sm tluno:ext-modalText",children:[o.balance||"-"," NFTs"]}),C("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:()=>r&&window.open(r),children:C(To,{})})]}),C("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 Fo,{useMemo as Qn}from"react";import{useMemo as jn,useState as Ne}from"react";import{jsx as Ho,jsxs as Wn}from"react/jsx-runtime";var H=({iconUrl:o,resourceName:n,className:e})=>{let[l,t]=Ne(!!o),[r,s]=Ne(!1),c=jn(()=>{if(!n)return"-";let m=n.match(/^([^-]+)-/);return m?.[1]?m[1].charAt(0).toUpperCase():n.charAt(0).toUpperCase()},[n]);return o&&!r?Wn("div",{className:i("luno:relative luno:w-full luno:h-full",e),children:[l&&Ho("div",{className:"luno:absolute luno:inset-0 luno:flex luno:items-center luno:justify-center luno:rounded-full luno:animate-pulse luno:bg-skeleton"}),Ho("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)}})]}):Ho("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:c})};import{jsx as P,jsxs as U}from"react/jsx-runtime";var qn=o=>`https://raw.githubusercontent.com/Luno-lab/luno-assets/refs/heads/main/assets/tokens/${o?.toLowerCase().trim()||""}.webp`,Se=Fo.memo(()=>{let{data:o,error:n,isFetching:e}=z(),l=Qn(()=>o?o.tokens:[],[o]);return e?P("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:min-h-[300px]",children:[1,2,3,4,5].map(t=>P("div",{className:"luno:animate-pulse luno:bg-skeleton luno:h-[54px] luno:rounded-assetSelectItem"},`skeleton-${t}`))}):n?U("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center luno:p-4",children:[P("div",{className:"luno:text-error luno:mb-2",children:"Failed to load assets"}),P("div",{className:"luno:text-modalTextSecondary luno:text-sm",children:n instanceof Error?n.message:"Unknown error"})]}):l.length?P("div",{className:"luno:flex luno:flex-col luno:gap-1.5",children:l.map(t=>P(Kn,{asset:t},`${t.symbol}-${t.assetId}`))}):P(mo,{type:"Tokens"})}),Kn=Fo.memo(({asset:o})=>{let n=o.logoURI||qn(o.symbol),e=Fo.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 U("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:[U("div",{className:"luno:flex luno:items-center luno:gap-2",children:[P(H,{className:"luno:w-[30px] luno:h-[30px] luno:flex luno:items-center luno:justify-center",iconUrl:n,resourceName:`${o.symbol}-token`}),U("div",{className:"luno:flex luno:flex-col luno:items-start",children:[P("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:o.symbol||"Unknown"}),P("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap",children:o.balanceFormatted})]})]}),o.price&&U("div",{className:"luno:flex luno:flex-col luno:items-end",children:[P("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:e}),U("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap",children:["$",o.price]})]})]})});import{jsx as no,jsxs as Yn}from"react/jsx-runtime";var Xn=[{key:"Tokens",label:"Tokens"},{key:"NFTs",label:"NFTs"}],ke=()=>{let[o,n]=Jn("Tokens");return Yn("div",{className:i("luno:flex luno:flex-col luno:gap-3.5 luno:p-4 luno:pt-0"),children:[no("div",{className:i("luno:flex luno:items-center luno:gap-1.5 luno:w-full"),children:Xn.map(e=>no("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))}),no("div",{className:i("luno:overflow-y-auto luno:flex-1 luno:min-h-[350px] luno:max-h-[350px]"),children:o==="Tokens"?no(Se,{}):no(ye,{})})]})};import{jsx as Te}from"react/jsx-runtime";var po=()=>Te("div",{className:"luno:relative",children:Te(ke,{})});po.title="View Assets";import{useAccount as ot,useBalance as et,useChain as nt,useChains as tt,useConfig as lt,useDisconnect as rt}from"@luno-kit/react";import{getExplorerUrl as at}from"@luno-kit/react/utils";import{useMemo as st}from"react";import{Fragment as Go,jsx as g,jsxs as B}from"react/jsx-runtime";var Me=({onViewChange:o,onModalClose:n})=>{let{address:e}=ot(),{chain:l}=nt(),t=tt(),{disconnectAsync:r}=rt(),{data:s}=et({address:t.length>0?e:void 0}),c=lt(),{refetch:m}=z(),p=st(()=>{let d={key:"Chain Name",content:B("div",{className:"luno:flex luno:items-stretch luno:w-full luno:justify-between",children:[B("div",{className:"luno:flex luno:items-center luno:gap-2",children:[g("div",{className:"luno:relative",children:g(H,{className:"luno:w-[24px] luno:h-[24px]",iconUrl:l?.chainIconUrl,resourceName:`${l?.name}-chain`})}),B("div",{className:"luno:flex luno:flex-col luno:items-start",children:[g("span",{className:"luno:text-base luno:leading-base luno:text-modalText",children:l?.name||"Polkadot"}),s?B("span",{className:"luno:text-modalTextSecondary luno:text-xs luno:leading-xs",children:[s.formattedTransferable||"0.00"," ",l?.nativeCurrency?.symbol||"DOT"]}):g("span",{className:"luno:animate-pulse luno:rounded luno:w-[80px] luno:h-[16px] luno:bg-skeleton"})]})]}),g("div",{className:"luno:flex luno:items-center luno:justify-center",children:g(Co,{className:"luno:w-[16px] luno:h-[16px] luno:text-modalTextSecondary"})})]}),onClick:()=>o("switchChain")},a={key:"Switch Account",content:B(Go,{children:[g(Vo,{className:"luno:w-[24px] luno:h-[24px]"}),g("span",{className:"luno:text-base luno:text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>o("switchAccount")},u={key:"View Assets",content:B(Go,{children:[g(bo,{className:"luno:w-[24px] luno:h-[24px]"}),g("span",{className:"luno:text-base luno:text-accountActionItemText",children:"View Assets"})]}),onClick:()=>{o("assetList"),m()}},h={key:"View on Explorer",content:B(Go,{children:[g(Ao,{className:"luno:w-[24px] luno:h-[24px]"}),g("span",{className:"luno:text-base luno:text-accountActionItemText luno:font-medium",children:"View on Explorer"})]}),onClick:()=>window.open(at(l?.blockExplorers?.default?.url,e,"address"))};return t.length===0?[a]:c?.subscan?.apiKey?[d,h,u,a]:[d,h,a]},[o,l,e,s,t,c]),f=async()=>{await r(),n()};return B("div",{className:"luno:flex luno:flex-col luno:items-center luno:gap-3 luno:w-full",children:[g("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:w-full luno:px-4",children:p.map(d=>g(Ae,{onClick:d.onClick,children:d.content},d.key))}),g("div",{className:"luno:w-full luno:mx-[-100px] luno:h-[1px] luno:bg-separatorLine"}),g("div",{className:"luno:w-full luno:px-4 luno:pb-4",children:B(Ae,{onClick:f,children:[g(So,{}),g("span",{className:"luno:text-base luno:text-accountActionItemText ",children:"Disconnect"})]})})]})},Ae=({children:o,onClick:n})=>g("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 it,useAccounts as ut,useActiveConnector as ct,useBalance as dt,useChain as mt,useChains as pt}from"@luno-kit/react";import{formatAddress as ft}from"@luno-kit/react/utils";import ht,{useCallback as xt}from"react";import{jsx as F,jsxs as fo}from"react/jsx-runtime";var ho=({onBack:o})=>{let{accounts:n,selectAccount:e}=ut(),{address:l}=it(),t=xt(r=>{e(r),o()},[o]);return F("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=>F(gt,{account:r,isSelected:r.address===l,selectAccount:t},r.address))})};ho.title="Switch Account";var gt=ht.memo(({isSelected:o,account:n,selectAccount:e})=>{let{chain:l}=mt(),t=pt(),r=n.address,{data:s}=dt({address:t.length>0?r:void 0}),c=ct();return fo("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:[fo("div",{className:"luno:flex luno:items-center luno:gap-2 luno:grow luno:overflow-hidden",children:[F("div",{className:"luno:shrink-0 luno:w-[24px] luno:h-[24px] luno:rounded-full luno:flex luno:items-center luno:justify-center",children:c?.icon&&F("img",{src:c?.icon,alt:"luno account"})}),fo("div",{className:"luno:flex luno:flex-col luno:items-start luno:overflow-hidden",children:[F("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||ft(r)}),t.length>0&&(s?fo("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium",children:[s?.formattedTransferable||"0.00"," ",l?.nativeCurrency?.symbol||"DOT"]}):F("span",{className:"luno:animate-pulse luno:rounded luno:w-[60px] luno:h-[16px] luno:bg-skeleton"}))]})]}),o&&F("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:F("div",{className:"luno:rounded-full luno:bg-accentColor luno:w-[10px] luno:h-[10px]"})})]})});import{useApi as vt,useChain as wt,useChains as Ct,useSwitchChain as bt}from"@luno-kit/react";import yt,{useMemo as Nt,useState as Ie}from"react";import{Fragment as kt,jsx as b,jsxs as j}from"react/jsx-runtime";var xo=({onChainSwitched:o,className:n=""})=>{let{chain:e}=wt(),l=Ct(),{switchChainAsync:t}=bt(),{isApiReady:r,apiError:s}=vt(),[c,m]=Ie(null),[p,f]=Ie(""),d=Nt(()=>l.filter(u=>p.trim()?u.name.toLowerCase().includes(p.toLowerCase()):!0),[l,p]),a=async u=>{if(u.genesisHash!==e?.genesisHash&&!(!r&&!s)){m(u.genesisHash);try{await t({chainId:u.genesisHash}),o?.(u)}catch(h){console.error("Failed to switch chain:",h)}finally{m(null)}}};return j("div",{className:i("luno:flex luno:flex-col luno:gap-3.5",n),children:[b("div",{className:"luno:relative luno:pt-1",children:j("div",{className:"luno:relative",children:[b(Mo,{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"}),b("input",{type:"text",placeholder:"Search by name",value:p,onChange:u=>f(u.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"})]})}),d.length>0&&b("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:overflow-y-auto luno:max-h-[380px]",children:d.map(u=>b(St,{chain:u,isSelected:u.genesisHash===e?.genesisHash,onSelect:a,isLoading:(c===u.genesisHash||!r)&&!s,isSwitching:c===u.genesisHash},u.genesisHash))}),d.length===0&&b("div",{className:"luno:flex luno:items-center luno:justify-center luno:py-12",children:b("span",{className:"luno:text-modalTextSecondary luno:text-xs",children:"No chains available"})})]})},St=yt.memo(({chain:o,isSelected:n,isLoading:e,onSelect:l,isSwitching:t})=>j("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:[j("div",{className:"luno:flex luno:items-center luno:gap-2",children:[b(H,{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`}),b("div",{className:"luno:flex luno:flex-col luno:items-start",children:b("span",{className:"luno:font-medium luno:text-base luno:text-modalText",children:o.name})})]}),b("div",{className:"luno:flex luno:items-center luno:justify-center luno:h-[20px]",children:n?e?j(kt,{children:[b("span",{className:"luno:text-accentColor luno:text-xs luno:leading-xs luno:mr-1.5",children:t?"Switching":"Connecting"}),b("div",{className:"loading luno:text-accentColor luno:w-[15px] luno:h-[15px]"})]}):j("span",{className:"luno:relative luno:flex luno:w-[10px] luno:h-[10px]",children:[b("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 luno:opacity-75"}),b("span",{className:"luno:relative luno:inline-flex luno:rounded-full luno:h-full luno:w-full luno:bg-accentColor"})]}):null})]}));import{jsx as Tt}from"react/jsx-runtime";var go=({onBack:o})=>Tt(xo,{className:"luno:p-4 luno:pt-0"});go.title="Select Networks";import{Fragment as Pt,jsx as v,jsxs as W}from"react/jsx-runtime";var me=()=>{let{isOpen:o,close:n}=Y(),{address:e,account:l}=At(),t=Mt(),{currentView:r,containerRef:s,currentViewRef:c,handleViewChange:m,resetView:p}=ao({initialView:"main"}),f=Vt(()=>{n(),p()},[n]),d=Ve(()=>r==="switchAccount"?ho.title:r==="switchChain"?go.title:r==="assetList"?po.title:null,[r]),a=Ve(()=>({main:v(Me,{onViewChange:m,onModalClose:f}),switchAccount:v(ho,{onBack:()=>m("main")}),switchChain:v(go,{onBack:()=>m("main")}),assetList:v(po,{})}),[m,f]);return v(Z,{open:o,onOpenChange:f,children:W("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",r==="main"?"luno:gap-5":"luno:gap-3.5"),children:[W("div",{className:i("luno:flex luno:items-stretch luno:justify-between luno:w-full luno:px-4 luno:pt-4"),children:[r==="main"?W("div",{className:i("luno:flex luno:items-center luno:gap-3 luno:max-w-[80%]"),children:[t?.icon&&v("div",{className:i("luno:flex luno:items-center luno:justify-center luno:w-[40px] luno:h-[40px] luno:shrink-0"),children:v("img",{src:t.icon,alt:"luno",className:i("luno:w-full luno:h-full luno:object-contain")})}),W("div",{className:i("luno:flex luno:flex-col luno:items-start luno:gap-1.5 luno:max-w-full"),children:[v(O,{className:"luno:sr-only",children:"Account Details"}),W("div",{className:i("luno:flex luno:items-center luno:gap-0.5 luno:w-full"),children:[v("span",{className:i("luno:text-base luno:text-modalText luno:font-semibold"),children:It(e)}),v(uo,{copyText:e})]}),v("div",{className:i("luno:text-sm luno:leading-sm luno:text-modalTextSecondary luno:font-medium luno:text-ellipsis luno:overflow-hidden luno:whitespace-nowrap",l?.name&&l?.name.length>30?"luno:w-[90%]":""),children:l?.name||t?.name})]})]}):W(Pt,{children:[v("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:()=>m("main"),"aria-label":"Back",children:v(q,{})}),v(O,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300"),children:d})]}),v(_,{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:v(R,{})})]}),v("div",{ref:s,className:i("luno:relative"),children:v("div",{ref:c,children:a[r]})})]})})};import{jsx as Q,jsxs as Pe}from"react/jsx-runtime";var pe=()=>{let{isOpen:o,close:n}=oo();return Q(Z,{open:o,onOpenChange:e=>!e&&n(),children:Pe("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:[Pe("div",{className:"luno:flex luno:items-center luno:justify-between luno:w-full",children:[Q("div",{className:"luno:w-[30px]"})," ",Q(O,{className:"luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300",children:"Select Network"}),Q(_,{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(xo,{})]})})};import{formatAddress as Ft}from"@luno-kit/react/utils";import{ConnectionStatus as vo,useAccount as Rt,useActiveConnector as Bt,useBalance as Lt,useChain as Et,useChains as Dt,useStatus as _t}from"@luno-kit/react";function Re(){let o=_t(),{account:n,address:e}=Rt(),{chain:l}=Et(),t=Dt(),{data:r}=Lt({address:t.length>0?e:void 0}),s=Bt(),{open:c,isOpen:m}=X(),{open:p,isOpen:f}=Y(),{open:d,isOpen:a}=oo(),u=o===vo.Connecting,h=o===vo.Connected,x=o===vo.Disconnected||o===vo.Disconnecting,I=!!l&&t.some(k=>k.genesisHash.toLowerCase()===l.genesisHash.toLowerCase());return{activeConnector:s,connectionStatus:o,isConnected:h,isDisconnected:x,isConnecting:u,account:n,address:e,currentChain:l,configuredChains:t,isChainSupported:I,chainIconUrl:l?.chainIconUrl,chainName:l?.name,balance:r,openConnectModal:c,openAccountModal:p,openChainModal:d,isConnectModalOpen:m,isAccountModalOpen:f,isChainModalOpen:a}}import{useEffect as Ot,useState as Ht}from"react";var wo=()=>{let[o,n]=Ht({height:void 0,width:void 0});return Ot(()=>{let e=he(()=>{n({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),o};import{jsx as G,jsxs as to}from"react/jsx-runtime";var lo="luno:transition-transform luno:transition-[125] luno:hover:scale-[1.03] luno:transition-ease",Gt=({className:o,label:n="Connect Wallet",accountStatus:e="full",chainStatus:l="full",showBalance:t=!0,displayPreference:r="address"})=>{let{isConnected:s,isDisconnected:c,account:m,balance:p,openConnectModal:f,openAccountModal:d,openChainModal:a,chainIconUrl:u,chainName:h,currentChain:x,configuredChains:I,activeConnector:k}=Re(),{width:T}=wo(),y=T&&T>768;return c||!s||!k?G("button",{type:"button",onClick:()=>f?.(),className:i("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",lo,"luno:px-3.5 luno:text-base luno:leading-base luno:min-h-[40px]",o),children:n}):to("div",{className:i("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"&&I.length>0&&to("button",{type:"button",onClick:()=>a?.(),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",lo),"aria-label":"Switch chain",children:[l==="full"||l==="icon"?G(H,{iconUrl:u,resourceName:`${h}-chain`,className:i("luno:w-[24px] luno:h-[24px]")}):null,(l==="full"||l==="name")&&y&&G("span",{children:x?.name||"Unknown Chain"})]}),to("button",{type:"button",onClick:()=>d?.(),className:i("luno:flex luno:items-center luno:cursor-pointer luno:rounded-connectButton luno:bg-connectButtonBackground luno:shadow-button",lo),"aria-label":"Open account modal",children:[I.length>0&&t&&y&&G("div",{className:i("luno:p-2 luno:pl-3"),children:p?to("span",{children:[p?.formattedTransferable||p?.formattedTotal||0," ",x?.nativeCurrency?.symbol||""]}):G("span",{className:i("luno:block luno:animate-pulse luno:rounded luno:w-[80px] luno:h-[20px] luno:bg-accountActionItemBackgroundHover")})}),to("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]",I.length>0&&t&&y?"luno:bg-connectButtonInnerBackground luno:py-1.5 luno:px-2":"luno:bg-connectButtonBackground luno:py-2 luno:px-2.5"),children:[e==="full"&&G("span",{className:i("luno:w-[24px] luno:h-[24px] luno:flex luno:items-center luno:justify-center"),children:G("img",{src:k.icon,alt:"luno account"})}),G("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:Ft(m?.address)})]})]})]})};import{useConnect as Xt}from"@luno-kit/react";import{isMobileDevice as Yt}from"@luno-kit/react/utils";import{useEffect as ol,useMemo as el,useState as Ge}from"react";import{useConnectors as $t}from"@luno-kit/react";import{isMobileDevice as Zt}from"@luno-kit/react/utils";import Le,{useMemo as zt}from"react";import{jsx as L,jsxs as De}from"react/jsx-runtime";var Ut=["polkadot-js","subwallet-js","talisman","walletconnect","nova","nova-mobile"],jt=["polkagate","fearless-wallet","mimir","enkrypt"],Ee=Le.memo(({onConnect:o})=>{let n=$t(),e=n.filter(s=>s.isInstalled()),l=n.filter(s=>Ut.includes(s.id)&&!s.isInstalled()),t=n.filter(s=>jt.includes(s.id)&&!s.isInstalled()),r=zt(()=>[{title:"Installed",group:e},{title:"Popular",group:l},{title:"More",group:t}],[e,l,t]);if(Zt()){let s=n.filter(c=>c.links.deepLink);return L("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-1 luno:w-full",children:s.map(c=>L(Be,{connector:c,onConnect:()=>o(c)},`${c.id}-${c.name}`))})}return L("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(s=>s.group.length===0?null:De("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-2 luno:w-full",children:[L("div",{className:i("luno:text-sm luno:font-semibold luno:leading-base",s.title==="Installed"?"luno:text-accentColor":"luno:text-modalTextSecondary"),children:s.title}),L("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-1.5 luno:w-full",children:s.group.map(c=>L(Be,{connector:c,onConnect:()=>o(c)},c.id))})]},s.title))})}),Be=Le.memo(({connector:o,onConnect:n})=>De("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:[L("div",{className:"luno:w-[28px] luno:h-[28px] luno:rounded-[6px] luno:overflow-hidden",children:L("img",{src:o.icon,alt:o.name,className:"luno:w-full luno:h-full"})}),L("span",{className:"luno:font-semibold luno:leading-base luno:text-base luno:text-modalText",children:o.name})]}));import Jt from"react";import{Cuer as Wt}from"cuer";import{jsx as $,jsxs as _e}from"react/jsx-runtime";var Oe=({logoBackground:o,uri:n,size:e})=>{if(!n){let r=Math.floor(14.25),s=e/57,c=r*s,m=Math.ceil(57/2-r/2),p=m+r,f=()=>{let u=[];for(let h=0;h<57;h++)for(let x=0;x<57;x++){if(h>=m&&h<p&&x>=m&&x<p||h<8&&x<8||h<8&&x>=49||h>=49&&x<8)continue;let k=x+.5,T=h+.5;u.push($("rect",{x:k-.4,y:T-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${x}`))}return u},d=({position:u})=>{let h=7*s,x={"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`,...x[u]},children:[$("div",{className:"luno:absolute luno:inset-0",style:{borderRadius:`${2*s}px`,border:`${s}px solid var(--color-walletSelectItemBackground)`}}),$("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)"}})]})},a=()=>{let u=m*s;return $("div",{className:"luno:absolute luno:z-[4] luno:flex luno:items-center luno:justify-center luno:box-border",style:{width:`${c}px`,height:`${c}px`,left:`${u}px`,top:`${u}px`,borderRadius:`${s}px`,padding:`${s/2}px`},children:$("img",{src:o,alt:"QR Code Logo",className:"luno:h-full luno:w-full luno:object-cover",style:{borderRadius:`${s}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*s}px`},children:[$("svg",{className:"luno:absolute luno:inset-0 luno:z-[3]",width:e,height:e,viewBox:"0 0 57 57",children: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"}}),d({position:"top-left"}),d({position:"top-right"}),d({position:"bottom-left"}),o&&a()]})}return $(Wt,{arena:o,value:n})};import{useEffect as Qt,useRef as qt}from"react";import{jsx as Kt}from"react/jsx-runtime";var He=({size:o=160,dotCount:n=300,duration:e=3,className:l=""})=>{let t=qt(null);return Qt(()=>{if(!t.current)return;let r=1,s=2,c=Math.PI*(3-Math.sqrt(5)),m=o/2,p=m-s-r,f="http://www.w3.org/2000/svg";t.current.innerHTML="";let d=document.createElementNS(f,"svg");d.setAttribute("width",o.toString()),d.setAttribute("height",o.toString()),d.setAttribute("viewBox",`0 0 ${o} ${o}`),d.style.display="block",t.current.appendChild(d);for(let a=0;a<n;a++){let u=a+.5,h=u/n,x=Math.sqrt(h)*p,I=u*c,k=m+x*Math.cos(I),T=m+x*Math.sin(I),y=document.createElementNS(f,"circle");y.setAttribute("cx",k.toString()),y.setAttribute("cy",T.toString()),y.setAttribute("r",r.toString()),y.setAttribute("fill","currentColor"),y.setAttribute("opacity","0.6"),d.appendChild(y);let S=document.createElementNS(f,"animate");S.setAttribute("attributeName","r"),S.setAttribute("values",`${r*.5};${r*1.8};${r*.5}`),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"),y.appendChild(S);let A=document.createElementNS(f,"animate");A.setAttribute("attributeName","opacity"),A.setAttribute("values","0.2;1;0.2"),A.setAttribute("dur",`${e}s`),A.setAttribute("begin",`${h*e}s`),A.setAttribute("repeatCount","indefinite"),A.setAttribute("calcMode","spline"),A.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),y.appendChild(A)}},[o,n,e]),Kt("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 Fe,jsx as w,jsxs as E}from"react/jsx-runtime";var $o=Jt.memo(({selectedConnector:o,onConnect:n,qrCode:e,isWide:l,connectState:t})=>{let r=o?.hasConnectionUri();return E("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&&w("div",{className:"luno:w-full",children:E("div",{className:"luno:flex luno:items-center luno:justify-between",children:[w("div",{}),w(_,{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:w(R,{})})]})}),w("div",{className:i("luno:flex luno:items-center luno:gap-4 luno:flex-col luno:grow luno:justify-center",o&&r?"luno:max-w-[300px]":"luno:max-w-[360px]"),children:o?r?E("div",{className:"luno:flex luno:flex-col luno:items-center luno:gap-2.5",children:[w(Oe,{size:300,logoBackground:o.icon,uri:e}),E("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"]}),w("div",{className:"luno:min-h-[20px] luno:flex luno:items-center luno:justify-center",children:o.links?.browserExtension?E("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?w(uo,{className:"luno:text-sm luno:leading-sm luno:font-medium luno:text-accentColor",copyText:e,label:"Copy Link"}):null})]}):E(Fe,{children:[w("div",{className:"luno:w-[80px] luno:h-[80px]",children:w("img",{src:o.icon,className:"luno:w-full luno:h-full",alt:""})}),E("p",{className:"luno:text-lg luno:leading-lg luno:text-modalFont luno:font-bold",children:["Opening ",o.name,"..."]}),w("p",{className:"luno:pb-[10px] luno:text-base luno:text-modalTextSecondary luno:leading-base luno:font-medium luno:text-center",children:"Confirm connection in the extension"}),t.isConnecting&&w("div",{className:"loading luno:text-modalText luno:w-[24px]"}),!o.isInstalled()&&o.links.browserExtension&&E("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\u2018t have ",o.name,"?"]}),!t.isConnecting&&t.isError&&o.isInstalled()&&w("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]",lo),onClick:()=>n(o),children:"Retry"})]}):E(Fe,{children:[w("div",{className:"luno:w-[160px] luno:h-[160px] luno:mb-4",children:w(He,{})}),w("div",{className:"luno:cursor-pointer luno:text-base luno:leading-base luno:text-accentColor luno:font-semibold luno:text-center",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}),w("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."})]})}),w("div",{})]})});import{Fragment as $e,jsx as N,jsxs as ro}from"react/jsx-runtime";var fe=({size:o="wide"})=>{let{isOpen:n,close:e}=X(),{connectAsync:l,reset:t,isPending:r,isError:s}=Xt(),[c,m]=Ge(null),[p,f]=Ge(),{width:d}=wo(),a=d&&d>768,u=!!(o==="wide"&&a),{containerRef:h,currentViewRef:x,resetView:I,handleViewChange:k,currentView:T}=ao({initialView:"Connect Wallet"}),y=async V=>{let Zo=await V.getConnectionUri();f(Zo)},S=async V=>{if(Yt()&&V.links.deepLink)try{await l({connectorId:V.id}),A(!1);return}catch{window.location.href=`${V.links.deepLink}?url=${window.location.href}`;return}!u&&k("walletView"),m(V),f(void 0),V.hasConnectionUri()&&y(V),await l({connectorId:V.id}),A(!1)},A=V=>{!V&&e(),t(),I(),m(null),f(void 0)},Ze=el(()=>({"Connect Wallet":N(Ee,{onConnect:S}),walletView:N($o,{connectState:{isConnecting:r,isError:s},isWide:u,selectedConnector:c,qrCode:p,onConnect:S})}),[u,c,p,S,r,s]);return ol(()=>{u&&T==="walletView"&&k("Connect Wallet")},[u,T]),N(Z,{open:n,onOpenChange:A,children:ro("div",{className:i("luno:flex items-stretch luno:justify-between luno:w-full luno:md:max-h-[504px] luno:md:max-w-[724px]"),children:[ro("div",{className:i("luno:flex luno:flex-col luno:items-start luno:py-4 luno:px-5 luno:w-full luno:md:w-auto",u?"luno:md:min-w-[300px] luno:border-r-[1px] luno:border-r-solid luno:border-r-separatorLine":"luno:md:min-w-[360px]"),children:[ro("div",{className:i("luno:flex luno:items-center luno:justify-between luno:w-full",!u&&"pb-4"),children:[T==="Connect Wallet"?ro($e,{children:[!u&&N("div",{className:i("luno:w-[30px] luno:h-[30px]"),"aria-hidden":!0}),N(O,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-bold",u?"luno:pb-6":"luno:flex-1 luno:text-center"),children:"Connect Wallet"})]}):ro($e,{children:[N("button",{className:i("flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200"),onClick:()=>k("Connect Wallet"),"aria-label":"Back",children:N(q,{})}),N(O,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300"),children:c?.name})]}),!u&&N(_,{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:N(R,{})})]}),N("div",{ref:h,className:i("luno:relative luno:overflow-hidden luno:w-full"),children:N("div",{ref:x,children:Ze[T]})}),!u&&T==="Connect Wallet"&&N("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("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})]}),u&&N($o,{connectState:{isConnecting:r,isError:s},isWide:u,selectedConnector:c,qrCode:p,onConnect:S})]})})};export{Gt as ConnectButton,cr as LunoKitProvider,Y as useAccountModal,oo as useChainModal,wn as useCloseAllModals,X as useConnectModal,ue as useLunoTheme};
2
+ import{useAccount as At,useActiveConnector as Mt}from"@luno-kit/react";import{formatAddress as It}from"@luno-kit/react/utils";import{useCallback as Vt,useMemo as Pe}from"react";import{jsx as zo}from"react/jsx-runtime";var Ue=o=>zo("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:zo("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"})}),Co=Ue;import{jsx as Uo}from"react/jsx-runtime";var je=o=>Uo("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...o,children:Uo("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=je;import{jsx as jo}from"react/jsx-runtime";var We=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=We;import{jsx as K,jsxs as qe}from"react/jsx-runtime";var Qe=o=>qe("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:[K("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"}),K("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"}),K("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"}),K("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"}),K("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"})]}),bo=Qe;import{jsx as Wo}from"react/jsx-runtime";var Ke=o=>Wo("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:Wo("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"})}),yo=Ke;import{jsx as Qo,jsxs as Xe}from"react/jsx-runtime";var Je=o=>Xe("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:[Qo("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"}),Qo("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"})]}),No=Je;import{jsx as qo}from"react/jsx-runtime";var Ye=o=>qo("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...o,children:qo("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"})}),So=Ye;import{jsx as Ko,jsxs as en}from"react/jsx-runtime";var on=o=>en("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 38 38",fill:"none",...o,children:[Ko("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"}),Ko("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"})]}),ko=on;import{jsx as Jo}from"react/jsx-runtime";var nn=o=>Jo("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256",fill:"none",...o,children:Jo("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"})}),To=nn;import{jsx as Xo}from"react/jsx-runtime";var tn=o=>Xo("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:Xo("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"})}),Ao=tn;import{jsx as Yo}from"react/jsx-runtime";var ln=o=>Yo("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:Yo("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"})}),Mo=ln;import{jsx as oe}from"react/jsx-runtime";var rn=o=>oe("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:oe("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"})}),Io=rn;import{jsx as ee}from"react/jsx-runtime";var an=o=>ee("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:ee("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"})}),Vo=an;import{useCallback as ne,useRef as te,useState as le}from"react";function ao({initialView:o,animationDuration:t=200,animationEasing:e="ease-out"}){let[l,n]=le(o),[r,s]=le(!1),u=te(null),m=te(null),p=ne(d=>{if(d===l||r)return;if(s(!0),!u.current){n(d),s(!1);return}let a=u.current,c=a.offsetHeight;n(d),requestAnimationFrame(()=>{if(!a||!m.current){s(!1);return}let h=m.current.offsetHeight;a.animate([{height:`${c}px`},{height:`${h}px`}],{duration:t,easing:e,fill:"forwards"}).addEventListener("finish",()=>{s(!1)})})},[l,r,t,e]),f=ne(()=>{n(o),s(!1)},[o]);return{currentView:l,isAnimating:r,containerRef:u,currentViewRef:m,handleViewChange:p,resetView:f}}import{createContext as un,useCallback as cn,useContext as dn,useEffect as se,useMemo as Po,useState as Bo}from"react";import{useEffect as sn}from"react";var re=["--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"],ae=(o,t)=>{sn(()=>{if(typeof window>"u")return;let e=document.documentElement;o.type==="complete"&&o.completeTheme?(Object.entries(o.completeTheme.colors).forEach(([l,n])=>{n&&e.style.setProperty(`--color-${l}`,n)}),Object.entries(o.completeTheme.fonts).forEach(([l,n])=>{n&&e.style.setProperty(`--font-${l}`,n)}),Object.entries(o.completeTheme.radii).forEach(([l,n])=>{n&&e.style.setProperty(`--radius-${l}`,n)}),Object.entries(o.completeTheme.shadows).forEach(([l,n])=>{n&&e.style.setProperty(`--shadow-${l}`,n)}),Object.entries(o.completeTheme.blurs).forEach(([l,n])=>{n&&e.style.setProperty(`--blur-${l}`,n)}),e.removeAttribute("data-theme")):o.type==="partial"&&o.partialOverrides?(e.setAttribute("data-theme",t),Object.keys(o.partialOverrides).length>0&&(re.forEach(n=>{e.style.removeProperty(n)}),o.partialOverrides.colors&&Object.entries(o.partialOverrides.colors).forEach(([n,r])=>{r&&e.style.setProperty(`--color-${n}`,r)}),o.partialOverrides.fonts&&Object.entries(o.partialOverrides.fonts).forEach(([n,r])=>{r&&e.style.setProperty(`--font-${n}`,r)}),o.partialOverrides.radii&&Object.entries(o.partialOverrides.radii).forEach(([n,r])=>{r&&e.style.setProperty(`--radius-${n}`,r)}),o.partialOverrides.shadows&&Object.entries(o.partialOverrides.shadows).forEach(([n,r])=>{r&&e.style.setProperty(`--shadow-${n}`,r)}),o.partialOverrides.blurs&&Object.entries(o.partialOverrides.blurs).forEach(([n,r])=>{r&&e.style.setProperty(`--blur-${n}`,r)}))):(e.setAttribute("data-theme",t),re.forEach(l=>{e.style.removeProperty(l)}))},[o,t])};import{jsx as fn}from"react/jsx-runtime";var Lo="luno.lastThemePreference",mn=o=>{try{localStorage.setItem(Lo,JSON.stringify(o))}catch{}},ie=un(void 0),Ro=o=>"colors"in o&&"fonts"in o&&"radii"in o&&"shadows"in o&&"blurs"in o,pn=()=>{let[o,t]=Bo(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return se(()=>{if(typeof window>"u")return;let e=window.matchMedia("(prefers-color-scheme: dark)"),l=n=>{t(n.matches?"dark":"light")};return l(e),e.addEventListener("change",l),()=>e.removeEventListener("change",l)},[]),o},Eo=({children:o,theme:t})=>{let e=pn(),[l,n]=Bo(()=>{if(typeof window<"u")try{let a=localStorage.getItem(Lo);if(a){let c=JSON.parse(a);if(c?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(c?.preferredTheme)return c.preferredTheme}}catch{}return!t||Ro(t)?"light":t.defaultMode||"light"}),[r,s]=Bo(()=>{if(typeof window<"u")try{let a=localStorage.getItem(Lo);if(a)return JSON.parse(a)?.isAuto??!1}catch{}return!t||Ro(t)?!1:t.autoMode??!1}),u=Po(()=>{if(!t)return{type:"default",completeTheme:null,partialOverrides:null};if(Ro(t))return{type:"complete",completeTheme:t,partialOverrides:null};let d=t;if(d.theme)return{type:"complete",completeTheme:d.theme,partialOverrides:null};let a=null;return l==="light"&&d.light?a=d.light:l==="dark"&&d.dark?a=d.dark:a={...d},{type:"partial",completeTheme:null,partialOverrides:a}},[l,t]),m=Po(()=>u.type==="complete"?u.completeTheme:null,[u]);ae(u,l);let p=cn(d=>{let a=d==="auto";s(a),n(a?e||"light":d);let c={isAuto:a,...a?{}:{preferredTheme:d}};mn(c)},[e]);se(()=>{r&&n(e||"light")},[e,r]);let f=Po(()=>({themeMode:l,setThemeChoice:p,currentTheme:m}),[l,p,m]);return fn(ie.Provider,{value:f,children:o})},ue=()=>{let o=dn(ie);if(!o)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return o};import{LunoProvider as yn}from"@luno-kit/react";import{QueryClient as Nn,QueryClientProvider as Sn}from"@tanstack/react-query";import{useState as kn}from"react";import{ConnectionStatus as so,useStatus as hn}from"@luno-kit/react";import{createContext as xn,useCallback as _o,useContext as io,useEffect as gn,useMemo as vn,useState as wn}from"react";import{jsx as bn}from"react/jsx-runtime";function Do(){let[o,t]=wn(!1),e=_o(()=>t(!0),[]),l=_o(()=>t(!1),[]);return{isOpen:o,open:e,close:l}}var J=xn(void 0),ce=({children:o})=>{let{isOpen:t,open:e,close:l}=Do(),{isOpen:n,open:r,close:s}=Do(),{isOpen:u,open:m,close:p}=Do(),f=hn(),d=_o(()=>{l(),s(),p()},[l,s,p]);gn(()=>{f===so.Disconnected&&(s(),p())},[f,s,p]);let a=vn(()=>({isConnectModalOpen:t,isAccountModalOpen:n,isChainModalOpen:u,openConnectModal:f!==so.Connected?e:void 0,closeConnectModal:l,openAccountModal:f===so.Connected?r:void 0,closeAccountModal:s,openChainModal:f===so.Connected?m:void 0,closeChainModal:p,closeAllModals:d}),[t,e,l,n,r,s,u,m,p,d,f]);return bn(J.Provider,{value:a,children:o})},X=()=>{let o=io(J);if(!o)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:o.isConnectModalOpen,open:o.openConnectModal,close:o.closeConnectModal}},Y=()=>{let o=io(J);if(!o)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:o.isAccountModalOpen,open:o.openAccountModal,close:o.closeAccountModal}},oo=()=>{let o=io(J);if(!o)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:o.isChainModalOpen,open:o.openChainModal,close:o.closeChainModal}},Cn=()=>{let o=io(J);if(!o)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return o.closeAllModals};import{Fragment as An,jsx as D,jsxs as de}from"react/jsx-runtime";var cr=({children:o,config:t,queryClientConfig:e,theme:l})=>{let[n]=kn(()=>new Nn(e));return D(Sn,{client:n,children:D(yn,{config:t,children:D(Eo,{theme:l,children:de(ce,{children:[D("div",{children:o}),D(Tn,{modalSize:t.modalSize})]})})})})},Tn=({modalSize:o})=>de(An,{children:[D(fe,{size:o}),D(me,{}),D(pe,{})]});import{clsx as Mn}from"clsx";import{extendTailwindMerge as In}from"tailwind-merge";var Vn=In({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function i(...o){return Vn(Mn(o))}function he(o,t){let e;return()=>{e&&clearTimeout(e),e=setTimeout(()=>{e=null,o()},t)}}import{useCallback as Pn,useState as Rn}from"react";import{jsx as xe,jsxs as Bn}from"react/jsx-runtime";var uo=({copyText:o,label:t,className:e=""})=>{let[l,n]=Rn(!1),r=Pn(async s=>{try{return navigator.clipboard?.writeText?(await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!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?xe(Io,{className:"luno:text-accentColor",width:16,height:16}):xe(yo,{width:16,height:16}),t]})};import*as M from"@radix-ui/react-dialog";import Oo from"react";import{jsx as ge,jsxs as _n}from"react/jsx-runtime";var Ln=({open:o,onOpenChange:t,children:e,contentClassName:l,overlayClassName:n})=>ge(M.Root,{open:o,onOpenChange:t,children:_n(M.Portal,{children:[Oo.createElement(M.Overlay,{className:i("luno:fixed luno:inset-0 luno:z-[100] luno:bg-modalBackdrop luno-kit","luno:data-[state=open]:[animation:overlay-in_150ms_ease-out]",n)}),ge(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:t})=>Oo.createElement(M.Title,{className:t},o),Dn=({children:o,className:t,onClick:e})=>Oo.createElement(M.Close,{className:t,onClick:e},o),Z=Ln,_=Dn,O=En;import{useState as Jn}from"react";import{useAccount as Zn,useChain as zn}from"@luno-kit/react";import be,{useMemo as ye,useState as Ce}from"react";import{useAccount as On,useChain as Hn,useConfig as Fn}from"@luno-kit/react";import{formatBalance as co}from"@luno-kit/react/utils";import{useQuery as Gn}from"@tanstack/react-query";var $n=async({apiUrl:o,apiKey:t,address:e})=>{try{let l=await fetch(`${o}/api/scan/account/tokens`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":t},body:JSON.stringify({address:e})});if(!l.ok)throw new Error(`Subscan API error: ${l.status}`);let n=await l.json();if(n.code!==0)throw new Error(`Subscan API error: ${n.message}`);let r=n.data.assets||[],s=n.data.native||[],u=n.data.builtin||[],m=r.filter(a=>a.token_image||a.unique_id?.includes("nft")).map(a=>({balance:a.balance,decimals:a.decimals,balanceFormatted:co(a.balance,a.decimals),logoURI:a.token_image,symbol:a.symbol,assetId:a.asset_id,price:a.price})),p=r.filter(a=>!a.token_image&&!a.unique_id?.includes("nft")).map(a=>({balance:a.balance,decimals:a.decimals,balanceFormatted:co(a.balance,a.decimals,4),logoURI:a.token_image,symbol:a.symbol,assetId:a.asset_id,price:a.price})),f=s.map(a=>({balance:a.balance,decimals:a.decimals,balanceFormatted:co(a.balance,a.decimals,4),logoURI:"",symbol:a.symbol,assetId:0,price:a.price})),d=u.map(a=>({balance:a.balance,decimals:a.decimals,balanceFormatted:co(a.balance,a.decimals,4),logoURI:"",symbol:a.symbol,assetId:a.unique_id,price:a.price}));return{nfts:[...m],tokens:[...f,...p,...d]}}catch(l){throw console.error("Failed to fetch tokens from Subscan:",l),l}};function z(){let{address:o}=On(),t=Fn(),{chain:e}=Hn(),l=e?.subscan?.api,n=t?.subscan?.apiKey;return Gn({queryKey:["subscan","asset-list",o,e?.genesisHash,l,n],queryFn:()=>$n({address:o,apiKey:n,apiUrl:l}),enabled:!!o&&!!n&&!!l,staleTime:t?.subscan?.cacheTime||6e4})}import{jsx as ve,jsxs as we}from"react/jsx-runtime";var mo=({type:o})=>we("div",{className:"luno:flex luno:flex-col luno:gap-1 luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center",children:[ve(ko,{className:"luno:w-[38px] luno:h-[38px] luno:mb-2"}),we("div",{className:"luno:text-modalText luno:text-base luno:leading-base",children:["No ",o," found"]}),ve("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 C,jsxs as eo}from"react/jsx-runtime";var Ne=be.memo(()=>{let{data:o,isFetching:t,error:e}=z(),l=ye(()=>o?o.nfts:[],[o]);return t?C("div",{className:"luno:flex luno:justify-center luno:w-full",children:C("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(n=>C("div",{className:"luno:animate-pulse luno:bg-skeleton luno:w-[155px] luno:h-[198px] luno:rounded-assetSelectItem"},`skeleton-${n}`))})}):e?eo("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center luno:p-4",children:[C("div",{className:"luno:text-error luno:mb-2",children:"Failed to load assets"}),C("div",{className:"luno:text-modalTextSecondary luno:text-sm",children:e instanceof Error?e.message:"Unknown error"})]}):l.length?C("div",{className:"luno:flex luno:justify-center luno:w-full",children:C("div",{className:"luno:flex luno:flex-wrap luno:justify-between luno:max-w-[350px] luno:w-full luno:gap-y-4",children:l.map(n=>C(Un,{asset:n},`${n.symbol}-${n.balance}`))})}):C(mo,{type:"NFTs"})}),Un=be.memo(({asset:o})=>{let{chain:t}=zn(),{address:e}=Zn(),[l,n]=Ce(!!o.logoURI),[r,s]=Ce(o.logoURI),u=ye(()=>t?.subscan?.url?`${t.subscan.url.endsWith("/")?t.subscan.url.slice(0,-1):t.subscan.url}/nft_item?collection_id=${o.assetId}&address=${e}`:"",[t,o,e]);return C("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:eo("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center",children:[eo("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&&C("div",{className:"luno:absolute luno:inset-0 luno:flex luno:items-center luno:justify-center luno:animate-pulse luno:bg-gray-500",children:C("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?C("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:()=>n(!1),onError:()=>{n(!1),s("")}}):C(No,{className:"luno:w-full luno:h-full luno:object-cover"})]}),eo("div",{className:"luno:flex luno:items-center luno:justify-between luno:w-full luno:mt-0.5",children:[eo("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:[o.balance||"-"," NFTs"]}),C("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:C(To,{})})]}),C("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 Fo,{useMemo as Qn}from"react";import{useMemo as jn,useState as Se}from"react";import{jsx as Ho,jsxs as Wn}from"react/jsx-runtime";var H=({iconUrl:o,resourceName:t,className:e})=>{let[l,n]=Se(!!o),[r,s]=Se(!1),u=jn(()=>{if(!t)return"-";let m=t.match(/^([^-]+)-/);return m?.[1]?m[1].charAt(0).toUpperCase():t.charAt(0).toUpperCase()},[t]);return o&&!r?Wn("div",{className:i("luno:relative luno:w-full luno:h-full",e),children:[l&&Ho("div",{className:"luno:absolute luno:inset-0 luno:flex luno:items-center luno:justify-center luno:rounded-full luno:animate-pulse luno:bg-skeleton"}),Ho("img",{src:o,alt:t||"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:()=>n(!1),onError:()=>{n(!1),s(!0)}})]}):Ho("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 P,jsxs as U}from"react/jsx-runtime";var qn=o=>`https://raw.githubusercontent.com/Luno-lab/luno-assets/refs/heads/main/assets/tokens/${o?.toLowerCase().trim()||""}.webp`,ke=Fo.memo(()=>{let{data:o,error:t,isFetching:e}=z(),l=Qn(()=>o?[...o.tokens].sort((n,r)=>{let s=n.price?parseFloat(n.balance)/10**n.decimals*parseFloat(n.price):0;return(r.price?parseFloat(r.balance)/10**r.decimals*parseFloat(r.price):0)-s}):[],[o]);return e?P("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:min-h-[300px]",children:[1,2,3,4,5].map(n=>P("div",{className:"luno:animate-pulse luno:bg-skeleton luno:h-[54px] luno:rounded-assetSelectItem"},`skeleton-${n}`))}):t?U("div",{className:"luno:flex luno:flex-col luno:items-center luno:justify-center luno:min-h-[300px] luno:text-center luno:p-4",children:[P("div",{className:"luno:text-error luno:mb-2",children:"Failed to load assets"}),P("div",{className:"luno:text-modalTextSecondary luno:text-sm",children:t instanceof Error?t.message:"Unknown error"})]}):l.length?P("div",{className:"luno:flex luno:flex-col luno:gap-1.5",children:l.map(n=>P(Kn,{asset:n},`${n.symbol}-${n.assetId}`))}):P(mo,{type:"Tokens"})}),Kn=Fo.memo(({asset:o})=>{let t=o.logoURI||qn(o.symbol),e=Fo.useMemo(()=>{if(!o.price)return null;let l=parseFloat(o.balance)/10**o.decimals,n=parseFloat(o.price);return`$${(l*n).toFixed(2)}`},[o.balance,o.decimals,o.price]);return U("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:[U("div",{className:"luno:flex luno:items-center luno:gap-2",children:[P(H,{className:"luno:w-[30px] luno:h-[30px] luno:flex luno:items-center luno:justify-center",iconUrl:t,resourceName:`${o.symbol}-token`}),U("div",{className:"luno:flex luno:flex-col luno:items-start",children:[P("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:o.symbol||"Unknown"}),P("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap",children:o.balanceFormatted})]})]}),o.price&&U("div",{className:"luno:flex luno:flex-col luno:items-end",children:[P("span",{className:"luno:font-medium luno:text-sm luno:leading-sm luno:text-modalText",children:e}),U("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium luno:whitespace-nowrap",children:["$",o.price]})]})]})});import{jsx as no,jsxs as Yn}from"react/jsx-runtime";var Xn=[{key:"Tokens",label:"Tokens"},{key:"NFTs",label:"NFTs"}],Te=()=>{let[o,t]=Jn("Tokens");return Yn("div",{className:i("luno:flex luno:flex-col luno:gap-3.5 luno:p-4 luno:pt-0"),children:[no("div",{className:i("luno:flex luno:items-center luno:gap-1.5 luno:w-full"),children:Xn.map(e=>no("button",{onClick:()=>t(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))}),no("div",{className:i("luno:overflow-y-auto luno:flex-1 luno:min-h-[350px] luno:max-h-[350px]"),children:o==="Tokens"?no(ke,{}):no(Ne,{})})]})};import{jsx as Ae}from"react/jsx-runtime";var po=()=>Ae("div",{className:"luno:relative",children:Ae(Te,{})});po.title="View Assets";import{useAccount as ot,useBalance as et,useChain as nt,useChains as tt,useConfig as lt,useDisconnect as rt}from"@luno-kit/react";import{getExplorerUrl as at}from"@luno-kit/react/utils";import{useMemo as st}from"react";import{Fragment as Go,jsx as g,jsxs as B}from"react/jsx-runtime";var Ie=({onViewChange:o,onModalClose:t})=>{let{address:e}=ot(),{chain:l}=nt(),n=tt(),{disconnectAsync:r}=rt(),{data:s}=et({address:n.length>0?e:void 0}),u=lt(),{refetch:m}=z(),p=st(()=>{let d={key:"Chain Name",content:B("div",{className:"luno:flex luno:items-stretch luno:w-full luno:justify-between",children:[B("div",{className:"luno:flex luno:items-center luno:gap-2",children:[g("div",{className:"luno:relative",children:g(H,{className:"luno:w-[24px] luno:h-[24px]",iconUrl:l?.chainIconUrl,resourceName:`${l?.name}-chain`})}),B("div",{className:"luno:flex luno:flex-col luno:items-start",children:[g("span",{className:"luno:text-base luno:leading-base luno:text-modalText",children:l?.name||"Polkadot"}),s?B("span",{className:"luno:text-modalTextSecondary luno:text-xs luno:leading-xs",children:[s.formattedTransferable||"0.00"," ",l?.nativeCurrency?.symbol||"DOT"]}):g("span",{className:"luno:animate-pulse luno:rounded luno:w-[80px] luno:h-[16px] luno:bg-skeleton"})]})]}),g("div",{className:"luno:flex luno:items-center luno:justify-center",children:g(Co,{className:"luno:w-[16px] luno:h-[16px] luno:text-modalTextSecondary"})})]}),onClick:()=>o("switchChain")},a={key:"Switch Account",content:B(Go,{children:[g(Vo,{className:"luno:w-[24px] luno:h-[24px]"}),g("span",{className:"luno:text-base luno:text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>o("switchAccount")},c={key:"View Assets",content:B(Go,{children:[g(bo,{className:"luno:w-[24px] luno:h-[24px]"}),g("span",{className:"luno:text-base luno:text-accountActionItemText",children:"View Assets"})]}),onClick:()=>{o("assetList"),m()}},h={key:"View on Explorer",content:B(Go,{children:[g(Ao,{className:"luno:w-[24px] luno:h-[24px]"}),g("span",{className:"luno:text-base luno:text-accountActionItemText luno:font-medium",children:"View on Explorer"})]}),onClick:()=>window.open(at(l?.blockExplorers?.default?.url,e,"address"))};return n.length===0?[a]:u?.subscan?.apiKey?[d,h,c,a]:[d,h,a]},[o,l,e,s,n,u]),f=async()=>{await r(),t()};return B("div",{className:"luno:flex luno:flex-col luno:items-center luno:gap-3 luno:w-full",children:[g("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:w-full luno:px-4",children:p.map(d=>g(Me,{onClick:d.onClick,children:d.content},d.key))}),g("div",{className:"luno:w-full luno:mx-[-100px] luno:h-[1px] luno:bg-separatorLine"}),g("div",{className:"luno:w-full luno:px-4 luno:pb-4",children:B(Me,{onClick:f,children:[g(So,{}),g("span",{className:"luno:text-base luno:text-accountActionItemText ",children:"Disconnect"})]})})]})},Me=({children:o,onClick:t})=>g("button",{type:"button",onClick:()=>t?.(),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",t?"luno:cursor-pointer":"luno:cursor-auto"),"aria-label":typeof o=="string"?o:void 0,children:o});import{useAccount as it,useAccounts as ut,useActiveConnector as ct,useBalance as dt,useChain as mt,useChains as pt}from"@luno-kit/react";import{formatAddress as ft}from"@luno-kit/react/utils";import ht,{useCallback as xt}from"react";import{jsx as F,jsxs as fo}from"react/jsx-runtime";var ho=({onBack:o})=>{let{accounts:t,selectAccount:e}=ut(),{address:l}=it(),n=xt(r=>{e(r),o()},[o]);return F("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:t.map(r=>F(gt,{account:r,isSelected:r.address===l,selectAccount:n},r.address))})};ho.title="Switch Account";var gt=ht.memo(({isSelected:o,account:t,selectAccount:e})=>{let{chain:l}=mt(),n=pt(),r=t.address,{data:s}=dt({address:n.length>0?r:void 0}),u=ct();return fo("button",{type:"button",onClick:()=>e(t),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":t.name||r,disabled:o,children:[fo("div",{className:"luno:flex luno:items-center luno:gap-2 luno:grow luno:overflow-hidden",children:[F("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&&F("img",{src:u?.icon,alt:"luno account"})}),fo("div",{className:"luno:flex luno:flex-col luno:items-start luno:overflow-hidden",children:[F("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:t.name||ft(r)}),n.length>0&&(s?fo("span",{className:"luno:text-xs luno:text-modalTextSecondary luno:font-medium",children:[s?.formattedTransferable||"0.00"," ",l?.nativeCurrency?.symbol||"DOT"]}):F("span",{className:"luno:animate-pulse luno:rounded luno:w-[60px] luno:h-[16px] luno:bg-skeleton"}))]})]}),o&&F("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:F("div",{className:"luno:rounded-full luno:bg-accentColor luno:w-[10px] luno:h-[10px]"})})]})});import{useApi as vt,useChain as wt,useChains as Ct,useSwitchChain as bt}from"@luno-kit/react";import yt,{useMemo as Nt,useState as Ve}from"react";import{Fragment as kt,jsx as b,jsxs as j}from"react/jsx-runtime";var xo=({onChainSwitched:o,className:t=""})=>{let{chain:e}=wt(),l=Ct(),{switchChainAsync:n}=bt(),{isApiReady:r,apiError:s}=vt(),[u,m]=Ve(null),[p,f]=Ve(""),d=Nt(()=>l.filter(c=>p.trim()?c.name.toLowerCase().includes(p.toLowerCase()):!0),[l,p]),a=async c=>{if(c.genesisHash!==e?.genesisHash&&!(!r&&!s)){m(c.genesisHash);try{await n({chainId:c.genesisHash}),o?.(c)}catch(h){console.error("Failed to switch chain:",h)}finally{m(null)}}};return j("div",{className:i("luno:flex luno:flex-col luno:gap-3.5",t),children:[b("div",{className:"luno:relative luno:pt-1",children:j("div",{className:"luno:relative",children:[b(Mo,{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"}),b("input",{type:"text",placeholder:"Search by name",value:p,onChange:c=>f(c.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"})]})}),d.length>0&&b("div",{className:"luno:flex luno:flex-col luno:gap-1.5 luno:overflow-y-auto luno:max-h-[380px]",children:d.map(c=>b(St,{chain:c,isSelected:c.genesisHash===e?.genesisHash,onSelect:a,isLoading:(u===c.genesisHash||!r)&&!s,isSwitching:u===c.genesisHash},c.genesisHash))}),d.length===0&&b("div",{className:"luno:flex luno:items-center luno:justify-center luno:py-12",children:b("span",{className:"luno:text-modalTextSecondary luno:text-xs",children:"No chains available"})})]})},St=yt.memo(({chain:o,isSelected:t,isLoading:e,onSelect:l,isSwitching:n})=>j("button",{onClick:()=>l(o),disabled:t||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",t||e?"luno:cursor-default":"luno:cursor-pointer luno:hover:bg-networkSelectItemBackgroundHover",e&&"luno:opacity-80"),children:[j("div",{className:"luno:flex luno:items-center luno:gap-2",children:[b(H,{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`}),b("div",{className:"luno:flex luno:flex-col luno:items-start",children:b("span",{className:"luno:font-medium luno:text-base luno:text-modalText",children:o.name})})]}),b("div",{className:"luno:flex luno:items-center luno:justify-center luno:h-[20px]",children:t?e?j(kt,{children:[b("span",{className:"luno:text-accentColor luno:text-xs luno:leading-xs luno:mr-1.5",children:n?"Switching":"Connecting"}),b("div",{className:"loading luno:text-accentColor luno:w-[15px] luno:h-[15px]"})]}):j("span",{className:"luno:relative luno:flex luno:w-[10px] luno:h-[10px]",children:[b("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"}),b("span",{className:"luno:relative luno:inline-flex luno:rounded-full luno:h-full luno:w-full luno:bg-accentColor"})]}):null})]}));import{jsx as Tt}from"react/jsx-runtime";var go=({onBack:o})=>Tt(xo,{className:"luno:p-4 luno:pt-0"});go.title="Select Networks";import{Fragment as Pt,jsx as v,jsxs as W}from"react/jsx-runtime";var me=()=>{let{isOpen:o,close:t}=Y(),{address:e,account:l}=At(),n=Mt(),{currentView:r,containerRef:s,currentViewRef:u,handleViewChange:m,resetView:p}=ao({initialView:"main"}),f=Vt(()=>{t(),p()},[t]),d=Pe(()=>r==="switchAccount"?ho.title:r==="switchChain"?go.title:r==="assetList"?po.title:null,[r]),a=Pe(()=>({main:v(Ie,{onViewChange:m,onModalClose:f}),switchAccount:v(ho,{onBack:()=>m("main")}),switchChain:v(go,{onBack:()=>m("main")}),assetList:v(po,{})}),[m,f]);return v(Z,{open:o,onOpenChange:f,children:W("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",r==="main"?"luno:gap-5":"luno:gap-3.5"),children:[W("div",{className:i("luno:flex luno:items-stretch luno:justify-between luno:w-full luno:px-4 luno:pt-4"),children:[r==="main"?W("div",{className:i("luno:flex luno:items-center luno:gap-3 luno:max-w-[80%]"),children:[n?.icon&&v("div",{className:i("luno:flex luno:items-center luno:justify-center luno:w-[40px] luno:h-[40px] luno:shrink-0"),children:v("img",{src:n.icon,alt:"luno",className:i("luno:w-full luno:h-full luno:object-contain")})}),W("div",{className:i("luno:flex luno:flex-col luno:items-start luno:gap-1.5 luno:max-w-full"),children:[v(O,{className:"luno:sr-only",children:"Account Details"}),W("div",{className:i("luno:flex luno:items-center luno:gap-0.5 luno:w-full"),children:[v("span",{className:i("luno:text-base luno:text-modalText luno:font-semibold"),children:It(e)}),v(uo,{copyText:e})]}),v("div",{className:i("luno:text-sm luno:leading-sm luno:text-modalTextSecondary luno:font-medium luno:text-ellipsis luno:overflow-hidden luno:whitespace-nowrap",l?.name&&l?.name.length>30?"luno:w-[90%]":""),children:l?.name||n?.name})]})]}):W(Pt,{children:[v("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:()=>m("main"),"aria-label":"Back",children:v(q,{})}),v(O,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300"),children:d})]}),v(_,{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:v(R,{})})]}),v("div",{ref:s,className:i("luno:relative"),children:v("div",{ref:u,children:a[r]})})]})})};import{jsx as Q,jsxs as Re}from"react/jsx-runtime";var pe=()=>{let{isOpen:o,close:t}=oo();return Q(Z,{open:o,onOpenChange:e=>!e&&t(),children:Re("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:[Re("div",{className:"luno:flex luno:items-center luno:justify-between luno:w-full",children:[Q("div",{className:"luno:w-[30px]"})," ",Q(O,{className:"luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300",children:"Select Network"}),Q(_,{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(xo,{})]})})};import{formatAddress as Ft}from"@luno-kit/react/utils";import{ConnectionStatus as vo,useAccount as Rt,useActiveConnector as Bt,useBalance as Lt,useChain as Et,useChains as Dt,useStatus as _t}from"@luno-kit/react";function Be(){let o=_t(),{account:t,address:e}=Rt(),{chain:l}=Et(),n=Dt(),{data:r}=Lt({address:n.length>0?e:void 0}),s=Bt(),{open:u,isOpen:m}=X(),{open:p,isOpen:f}=Y(),{open:d,isOpen:a}=oo(),c=o===vo.Connecting,h=o===vo.Connected,x=o===vo.Disconnected||o===vo.Disconnecting,I=!!l&&n.some(k=>k.genesisHash.toLowerCase()===l.genesisHash.toLowerCase());return{activeConnector:s,connectionStatus:o,isConnected:h,isDisconnected:x,isConnecting:c,account:t,address:e,currentChain:l,configuredChains:n,isChainSupported:I,chainIconUrl:l?.chainIconUrl,chainName:l?.name,balance:r,openConnectModal:u,openAccountModal:p,openChainModal:d,isConnectModalOpen:m,isAccountModalOpen:f,isChainModalOpen:a}}import{useEffect as Ot,useState as Ht}from"react";var wo=()=>{let[o,t]=Ht({height:void 0,width:void 0});return Ot(()=>{let e=he(()=>{t({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),o};import{jsx as G,jsxs as to}from"react/jsx-runtime";var lo="luno:transition-transform luno:transition-[125] luno:hover:scale-[1.03] luno:transition-ease",Gt=({className:o,label:t="Connect Wallet",accountStatus:e="full",chainStatus:l="full",showBalance:n=!0,displayPreference:r="address"})=>{let{isConnected:s,isDisconnected:u,account:m,balance:p,openConnectModal:f,openAccountModal:d,openChainModal:a,chainIconUrl:c,chainName:h,currentChain:x,configuredChains:I,activeConnector:k}=Be(),{width:T}=wo(),y=T&&T>768;return u||!s||!k?G("button",{type:"button",onClick:()=>f?.(),className:i("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",lo,"luno:px-3.5 luno:text-base luno:leading-base luno:min-h-[40px]",o),children:t}):to("div",{className:i("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"&&I.length>0&&to("button",{type:"button",onClick:()=>a?.(),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",lo),"aria-label":"Switch chain",children:[l==="full"||l==="icon"?G(H,{iconUrl:c,resourceName:`${h}-chain`,className:i("luno:w-[24px] luno:h-[24px]")}):null,(l==="full"||l==="name")&&y&&G("span",{children:x?.name||"Unknown Chain"})]}),to("button",{type:"button",onClick:()=>d?.(),className:i("luno:flex luno:items-center luno:cursor-pointer luno:rounded-connectButton luno:bg-connectButtonBackground luno:shadow-button",lo),"aria-label":"Open account modal",children:[I.length>0&&n&&y&&G("div",{className:i("luno:p-2 luno:pl-3"),children:p?to("span",{children:[p?.formattedTransferable||p?.formattedTotal||0," ",x?.nativeCurrency?.symbol||""]}):G("span",{className:i("luno:block luno:animate-pulse luno:rounded luno:w-[80px] luno:h-[20px] luno:bg-accountActionItemBackgroundHover")})}),to("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]",I.length>0&&n&&y?"luno:bg-connectButtonInnerBackground luno:py-1.5 luno:px-2":"luno:bg-connectButtonBackground luno:py-2 luno:px-2.5"),children:[e==="full"&&G("span",{className:i("luno:w-[24px] luno:h-[24px] luno:flex luno:items-center luno:justify-center"),children:G("img",{src:k.icon,alt:"luno account"})}),G("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:Ft(m?.address)})]})]})]})};import{useConnect as Xt}from"@luno-kit/react";import{isMobileDevice as Yt}from"@luno-kit/react/utils";import{useEffect as ol,useMemo as el,useState as $e}from"react";import{useConnectors as $t}from"@luno-kit/react";import{isMobileDevice as Zt}from"@luno-kit/react/utils";import Ee,{useMemo as zt}from"react";import{jsx as L,jsxs as _e}from"react/jsx-runtime";var Ut=["polkadot-js","subwallet-js","talisman","walletconnect","nova","nova-mobile"],jt=["polkagate","fearless-wallet","mimir","enkrypt"],De=Ee.memo(({onConnect:o})=>{let t=$t(),e=t.filter(s=>s.isInstalled()),l=t.filter(s=>Ut.includes(s.id)&&!s.isInstalled()),n=t.filter(s=>jt.includes(s.id)&&!s.isInstalled()),r=zt(()=>[{title:"Installed",group:e},{title:"Popular",group:l},{title:"More",group:n}],[e,l,n]);if(Zt()){let s=t.filter(u=>u.links.deepLink);return L("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-1 luno:w-full",children:s.map(u=>L(Le,{connector:u,onConnect:()=>o(u)},`${u.id}-${u.name}`))})}return L("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(s=>s.group.length===0?null:_e("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-2 luno:w-full",children:[L("div",{className:i("luno:text-sm luno:font-semibold luno:leading-base",s.title==="Installed"?"luno:text-accentColor":"luno:text-modalTextSecondary"),children:s.title}),L("div",{className:"luno:flex luno:flex-col luno:items-start luno:gap-1.5 luno:w-full",children:s.group.map(u=>L(Le,{connector:u,onConnect:()=>o(u)},u.id))})]},s.title))})}),Le=Ee.memo(({connector:o,onConnect:t})=>_e("button",{onClick:t,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:[L("div",{className:"luno:w-[28px] luno:h-[28px] luno:rounded-[6px] luno:overflow-hidden",children:L("img",{src:o.icon,alt:o.name,className:"luno:w-full luno:h-full"})}),L("span",{className:"luno:font-semibold luno:leading-base luno:text-base luno:text-modalText",children:o.name})]}));import Jt from"react";import{Cuer as Wt}from"cuer";import{jsx as $,jsxs as Oe}from"react/jsx-runtime";var He=({logoBackground:o,uri:t,size:e})=>{if(!t){let r=Math.floor(14.25),s=e/57,u=r*s,m=Math.ceil(57/2-r/2),p=m+r,f=()=>{let c=[];for(let h=0;h<57;h++)for(let x=0;x<57;x++){if(h>=m&&h<p&&x>=m&&x<p||h<8&&x<8||h<8&&x>=49||h>=49&&x<8)continue;let k=x+.5,T=h+.5;c.push($("rect",{x:k-.4,y:T-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${x}`))}return c},d=({position:c})=>{let h=7*s,x={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return Oe("div",{className:"luno:absolute luno:z-[4]",style:{width:`${h}px`,height:`${h}px`,...x[c]},children:[$("div",{className:"luno:absolute luno:inset-0",style:{borderRadius:`${2*s}px`,border:`${s}px solid var(--color-walletSelectItemBackground)`}}),$("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)"}})]})},a=()=>{let c=m*s;return $("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:`${c}px`,top:`${c}px`,borderRadius:`${s}px`,padding:`${s/2}px`},children:$("img",{src:o,alt:"QR Code Logo",className:"luno:h-full luno:w-full luno:object-cover",style:{borderRadius:`${s}px`}})})};return Oe("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:[$("svg",{className:"luno:absolute luno:inset-0 luno:z-[3]",width:e,height:e,viewBox:"0 0 57 57",children: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"}}),d({position:"top-left"}),d({position:"top-right"}),d({position:"bottom-left"}),o&&a()]})}return $(Wt,{arena:o,value:t})};import{useEffect as Qt,useRef as qt}from"react";import{jsx as Kt}from"react/jsx-runtime";var Fe=({size:o=160,dotCount:t=300,duration:e=3,className:l=""})=>{let n=qt(null);return Qt(()=>{if(!n.current)return;let r=1,s=2,u=Math.PI*(3-Math.sqrt(5)),m=o/2,p=m-s-r,f="http://www.w3.org/2000/svg";n.current.innerHTML="";let d=document.createElementNS(f,"svg");d.setAttribute("width",o.toString()),d.setAttribute("height",o.toString()),d.setAttribute("viewBox",`0 0 ${o} ${o}`),d.style.display="block",n.current.appendChild(d);for(let a=0;a<t;a++){let c=a+.5,h=c/t,x=Math.sqrt(h)*p,I=c*u,k=m+x*Math.cos(I),T=m+x*Math.sin(I),y=document.createElementNS(f,"circle");y.setAttribute("cx",k.toString()),y.setAttribute("cy",T.toString()),y.setAttribute("r",r.toString()),y.setAttribute("fill","currentColor"),y.setAttribute("opacity","0.6"),d.appendChild(y);let S=document.createElementNS(f,"animate");S.setAttribute("attributeName","r"),S.setAttribute("values",`${r*.5};${r*1.8};${r*.5}`),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"),y.appendChild(S);let A=document.createElementNS(f,"animate");A.setAttribute("attributeName","opacity"),A.setAttribute("values","0.2;1;0.2"),A.setAttribute("dur",`${e}s`),A.setAttribute("begin",`${h*e}s`),A.setAttribute("repeatCount","indefinite"),A.setAttribute("calcMode","spline"),A.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),y.appendChild(A)}},[o,t,e]),Kt("div",{ref:n,className:i("luno:text-accentColor luno:inline-flex luno:w-full luno:h-full luno:justify-center luno:align-center",l)})};import{Fragment as Ge,jsx as w,jsxs as E}from"react/jsx-runtime";var $o=Jt.memo(({selectedConnector:o,onConnect:t,qrCode:e,isWide:l,connectState:n})=>{let r=o?.hasConnectionUri();return E("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&&w("div",{className:"luno:w-full",children:E("div",{className:"luno:flex luno:items-center luno:justify-between",children:[w("div",{}),w(_,{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:w(R,{})})]})}),w("div",{className:i("luno:flex luno:items-center luno:gap-4 luno:flex-col luno:grow luno:justify-center",o&&r?"luno:max-w-[300px]":"luno:max-w-[360px]"),children:o?r?E("div",{className:"luno:flex luno:flex-col luno:items-center luno:gap-2.5",children:[w(He,{size:300,logoBackground:o.icon,uri:e}),E("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"]}),w("div",{className:"luno:min-h-[20px] luno:flex luno:items-center luno:justify-center",children:o.links?.browserExtension?E("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?w(uo,{className:"luno:text-sm luno:leading-sm luno:font-medium luno:text-accentColor",copyText:e,label:"Copy Link"}):null})]}):E(Ge,{children:[w("div",{className:"luno:w-[80px] luno:h-[80px]",children:w("img",{src:o.icon,className:"luno:w-full luno:h-full",alt:""})}),E("p",{className:"luno:text-lg luno:leading-lg luno:text-modalFont luno:font-bold",children:["Opening ",o.name,"..."]}),w("p",{className:"luno:pb-[10px] luno:text-base luno:text-modalTextSecondary luno:leading-base luno:font-medium luno:text-center",children:"Confirm connection in the extension"}),n.isConnecting&&w("div",{className:"loading luno:text-modalText luno:w-[24px]"}),!o.isInstalled()&&o.links.browserExtension&&E("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\u2018t have ",o.name,"?"]}),!n.isConnecting&&n.isError&&o.isInstalled()&&w("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]",lo),onClick:()=>t(o),children:"Retry"})]}):E(Ge,{children:[w("div",{className:"luno:w-[160px] luno:h-[160px] luno:mb-4",children:w(Fe,{})}),w("div",{className:"luno:cursor-pointer luno:text-base luno:leading-base luno:text-accentColor luno:font-semibold luno:text-center",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}),w("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."})]})}),w("div",{})]})});import{Fragment as Ze,jsx as N,jsxs as ro}from"react/jsx-runtime";var fe=({size:o="wide"})=>{let{isOpen:t,close:e}=X(),{connectAsync:l,reset:n,isPending:r,isError:s}=Xt(),[u,m]=$e(null),[p,f]=$e(),{width:d}=wo(),a=d&&d>768,c=!!(o==="wide"&&a),{containerRef:h,currentViewRef:x,resetView:I,handleViewChange:k,currentView:T}=ao({initialView:"Connect Wallet"}),y=async V=>{let Zo=await V.getConnectionUri();f(Zo)},S=async V=>{if(Yt()&&V.links.deepLink)try{await l({connectorId:V.id}),A(!1);return}catch{window.location.href=`${V.links.deepLink}?url=${window.location.href}`;return}!c&&k("walletView"),m(V),f(void 0),V.hasConnectionUri()&&y(V),await l({connectorId:V.id}),A(!1)},A=V=>{!V&&e(),n(),I(),m(null),f(void 0)},ze=el(()=>({"Connect Wallet":N(De,{onConnect:S}),walletView:N($o,{connectState:{isConnecting:r,isError:s},isWide:c,selectedConnector:u,qrCode:p,onConnect:S})}),[c,u,p,S,r,s]);return ol(()=>{c&&T==="walletView"&&k("Connect Wallet")},[c,T]),N(Z,{open:t,onOpenChange:A,children:ro("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:[ro("div",{className:i("luno:flex luno:flex-col luno:items-start luno:py-4 luno:px-5 luno:w-full luno:md:w-auto",c?"luno:md:min-w-[300px] luno:border-r-[1px] luno:border-r-solid luno:border-r-separatorLine":"luno:md:min-w-[360px]"),children:[ro("div",{className:i("luno:flex luno:items-center luno:justify-between luno:w-full",!c&&"luno:pb-4"),children:[T==="Connect Wallet"?ro(Ze,{children:[!c&&N("div",{className:i("luno:w-[30px] luno:h-[30px]"),"aria-hidden":!0}),N(O,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-bold",c?"luno:pb-6":"luno:flex-1 luno:text-center"),children:"Connect Wallet"})]}):ro(Ze,{children:[N("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:()=>k("Connect Wallet"),"aria-label":"Back",children:N(q,{})}),N(O,{className:i("luno:text-lg luno:leading-lg luno:text-modalText luno:font-semibold luno:transition-opacity luno:duration-300"),children:u?.name})]}),!c&&N(_,{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:N(R,{})})]}),N("div",{ref:h,className:i("luno:relative luno:overflow-hidden luno:w-full"),children:N("div",{ref:x,children:ze[T]})}),!c&&T==="Connect Wallet"&&N("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("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})]}),c&&N($o,{connectState:{isConnecting:r,isError:s},isWide:c,selectedConnector:u,qrCode:p,onConnect:S})]})})};export{Gt as ConnectButton,cr as LunoKitProvider,Y as useAccountModal,oo as useChainModal,Cn as useCloseAllModals,X as useConnectModal,ue as useLunoTheme};
3
3
  //# sourceMappingURL=index.js.map