import{Ja as e,Qa as t,Xa as n,_t as r,cr as i,io as a,qt as o,tn as s,vr as c}from"./index.dkY5s53S.js";var l=a(n(),1),u=a(t(),1),d=(0,u.createContext)(null);d.displayName=`ElementFullscreenContext`;var f=c(`div`,{target:`e1xxut3m0`})(({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`}:{}})),p=()=>{let{setFullScreen:e}=(0,u.useContext)(o),[t,n]=(0,u.useState)(!1),{fullHeight:i,fullWidth:a}=r(),s=(0,u.useCallback)(t=>{n(t),e(t)},[e]),c=(0,u.useCallback)(()=>{document.body.style.overflow=`hidden`,s(!0)},[s]),l=(0,u.useCallback)(()=>{document.body.style.overflow=`unset`,s(!1)},[s]),d=(0,u.useCallback)(e=>{e.keyCode===27&&t&&l()},[l,t]);return(0,u.useEffect)(()=>(document.addEventListener(`keydown`,d,!1),()=>{document.removeEventListener(`keydown`,d,!1)}),[d]),(0,u.useMemo)(()=>({expanded:t,zoomIn:c,zoomOut:l,fullHeight:i,fullWidth:a}),[t,c,l,i,a])},m=({children:t})=>{let n=i(),{expanded:r,fullHeight:a,fullWidth:o,zoomIn:c,zoomOut:l}=p(),{width:m,elementRef:h}=s(),g=(0,u.useMemo)(()=>({width:r?o:m,height:r?a:void 0,expanded:r,expand:c,collapse:l}),[r,a,o,m,c,l]);return e(d.Provider,{value:g,children:e(f,{ref:h,isExpanded:r,"data-testid":`stFullScreenFrame`,theme:n,children:t})})};function h(t){let n=n=>e(m,{children:e(t,{...n})});return n.displayName=`withFullScreenWrapper(${t.displayName||t.name})`,(0,l.default)(n,t)}export{d as n,h as t};