import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useContext as n,useState as r,useRef as t,useEffect as i,createContext as l}from"react";import{u as o}from"./context-BKnOUECq.mjs";import{n as c}from"./internal-context-dfitw7Ot.mjs";function s({src:a,...n}){/*#__PURE__*/return e("img",{src:a,...n,style:{display:"none"}})}const p=/*#__PURE__*/l({currentScreen:null,lastScreen:null,navigate:c,navigateBack:c,resetNavigation:c,setModalData:c,onUserCloseViaDialogOrKeybindRef:void 0}),u=n=>{let l=o(),[c,u]=r(n.initialScreen),g=t(null);i((()=>{n.open||(g.current=null)}),[n.open]),i((()=>{g.current=null}),[n.initialScreen]);let d={data:n.data,setModalData:n.setModalData,currentScreen:n.initialScreen,lastScreen:c,navigate:(e,a=!0)=>{n.setInitialScreen(e),a&&u(n.initialScreen)},navigateBack:()=>{n.setInitialScreen(c)},resetNavigation:()=>{n.setInitialScreen(null),u(null)},onUserCloseViaDialogOrKeybindRef:g};/*#__PURE__*/return a(p.Provider,{value:d,children:[("string"==typeof l.appearance.logo||"img"===l.appearance.logo?.type)&&/*#__PURE__*/e(s,{src:"string"==typeof l.appearance.logo?l.appearance.logo:l.appearance.logo.props.src}),n.children]})},g=()=>n(p);export{u as M,g as u};
//# sourceMappingURL=modal-context-DBwfUxD-.mjs.map
