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