import{o as e}from"./rolldown-runtime.js";import{n as t,t as n}from"./jsx-runtime.js";import{Bt as r}from"./useActiveWallet-CEs8euQ3.js";import{k as i}from"./context-Cdw68BC2.js";var a=n(),o=e(t(),1);function s({src:e,...t}){return(0,a.jsx)(`img`,{src:e,...t,style:{display:`none`}})}var c=(0,o.createContext)({currentScreen:null,lastScreen:null,navigate:r,navigateBack:r,resetNavigation:r,setModalData:r,onUserCloseViaDialogOrKeybindRef:void 0}),l=e=>{let t=i(),[n,r]=(0,o.useState)(e.initialScreen),l=(0,o.useRef)(null);(0,o.useEffect)((()=>{e.open||(l.current=null)}),[e.open]),(0,o.useEffect)((()=>{l.current=null}),[e.initialScreen]);let u={data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:n,navigate:(t,n=!0)=>{e.setInitialScreen(t),n&&r(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(n)},resetNavigation:()=>{e.setInitialScreen(null),r(null)},onUserCloseViaDialogOrKeybindRef:l};return(0,a.jsxs)(c.Provider,{value:u,children:[(typeof t.appearance.logo==`string`||t.appearance.logo?.type===`img`)&&(0,a.jsx)(s,{src:typeof t.appearance.logo==`string`?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},u=()=>(0,o.useContext)(c);export{l as n,u as t};