import{r as n,s as f,L as p,ap as h,u as x,a3 as y,j as i,aq as g}from"./index.Bzd-hLkw.js";const m=n.createContext(null);m.displayName="ElementFullscreenContext";const C=f("div",{target:"e13s7uld0"})(({theme:e,isExpanded:t})=>({width:"100%",height:"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",display:"flex",alignItems:"center",justifyContent:"center"}:{}})),w=()=>{const{setFullScreen:e}=n.useContext(p),[t,s]=n.useState(!1),{fullHeight:r,fullWidth:u}=h(),l=n.useCallback(a=>{s(a),e(a)},[e]),c=n.useCallback(()=>{document.body.style.overflow="hidden",l(!0)},[l]),o=n.useCallback(()=>{document.body.style.overflow="unset",l(!1)},[l]),d=n.useCallback(a=>{a.keyCode===27&&t&&o()},[o,t]);return n.useEffect(()=>(document.addEventListener("keydown",d,!1),()=>{document.removeEventListener("keydown",d,!1)}),[d]),n.useMemo(()=>({expanded:t,zoomIn:c,zoomOut:o,fullHeight:r,fullWidth:u}),[t,c,o,r,u])},F=({children:e})=>{const t=x(),{expanded:s,fullHeight:r,fullWidth:u,zoomIn:l,zoomOut:c}=w(),{width:o,elementRef:d}=y(),a=n.useMemo(()=>({width:s?u:o,height:s?r:void 0,expanded:s,expand:l,collapse:c}),[s,r,u,o,l,c]);return i(m.Provider,{value:a,children:i(C,{ref:d,isExpanded:s,"data-testid":"stFullScreenFrame",theme:t,children:e})})};function S(e){const t=s=>i(F,{children:i(e,{...s})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,g(t,e)}export{m as E,S as w};
