import{n as p,r as n,aD as x,bg as h,y,bh as C,j as i,aZ as w}from"./index.DmrHunjf.js";const b=p("div",{target:"ek8upll0"})(({theme:e,isExpanded:t})=>({width:"100%",...t?{position:"fixed",top:0,left:0,bottom:0,right:0,background:e.colors.bgColor,zIndex:e.zIndices.fullscreenWrapper,padding:e.spacing.md,paddingTop:e.sizes.fullScreenHeaderHeight,overflow:["auto","overlay"],display:"flex",alignItems:"center",justifyContent:"center"}:{}})),f=n.createContext(null);f.displayName="ElementFullscreenContext";const g=e=>{const t=n.useContext(e);if(t==null)throw new Error(`useRequiredContext: ${e.displayName??"context"} not found`);return t},F=()=>{const{setFullScreen:e}=n.useContext(x),[t,u]=n.useState(!1),{fullHeight:s,fullWidth:c}=g(h),o=n.useCallback(a=>{u(a),e(a)},[e]),d=n.useCallback(()=>{document.body.style.overflow="hidden",o(!0)},[o]),l=n.useCallback(()=>{document.body.style.overflow="unset",o(!1)},[o]),r=n.useCallback(a=>{a.keyCode===27&&t&&l()},[l,t]);return n.useEffect(()=>(document.addEventListener("keydown",r,!1),()=>{document.removeEventListener("keydown",r,!1)}),[r]),n.useMemo(()=>({expanded:t,zoomIn:d,zoomOut:l,fullHeight:s,fullWidth:c}),[t,d,l,s,c])},S=({children:e,height:t})=>{const u=y(),{expanded:s,fullHeight:c,fullWidth:o,zoomIn:d,zoomOut:l}=F(),[r,a]=C(),m=n.useMemo(()=>({width:s?o:r,height:s?c:t,expanded:s,expand:d,collapse:l}),[s,c,o,t,r,d,l]);return i(f.Provider,{value:m,children:i(b,{ref:a,isExpanded:s,"data-testid":"stFullScreenFrame",theme:u,children:e})})};function E(e){const t=u=>i(S,{children:i(e,{...u})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,w(t,e)}export{f as E,g as u,E as w};
