import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{_ as n,i as r,t as i}from"./emotion-styled.browser.esm.Dj5rZcu_.js";import{t as a}from"./useEmotionTheme.cgGerbj0.js";import{R as o,W as s,b as c}from"./index.ByR4Z2EF.js";var l=e(n(),1),u=e(t(),1),d=(0,u.createContext)(null);d.displayName=`ElementFullscreenContext`;var f=i(`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:r,fullWidth:i}=c(),a=(0,u.useCallback)(t=>{n(t),e(t)},[e]),s=(0,u.useCallback)(()=>{document.body.style.overflow=`hidden`,a(!0)},[a]),l=(0,u.useCallback)(()=>{document.body.style.overflow=`unset`,a(!1)},[a]),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:s,zoomOut:l,fullHeight:r,fullWidth:i}),[t,s,l,r,i])},m=({children:e})=>{let t=a(),{expanded:n,fullHeight:i,fullWidth:o,zoomIn:c,zoomOut:l}=p(),{width:m,elementRef:h}=s(),g=(0,u.useMemo)(()=>({width:n?o:m,height:n?i:void 0,expanded:n,expand:c,collapse:l}),[n,i,o,m,c,l]);return r(d.Provider,{value:g,children:r(f,{ref:h,isExpanded:n,"data-testid":`stFullScreenFrame`,theme:t,children:e})})};function h(e){let t=t=>r(m,{children:r(e,{...t})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,(0,l.default)(t,e)}export{d as n,h as t};