const methodMap = [ [ 'requestFullscreen' , 'exitFullscreen' , 'fullscreenElement' , 'fullscreenEnabled' , ] , [ 'webkitRequestFullscreen' , 'webkitExitFullscreen' , 'webkitFullscreenElement' , 'webkitFullscreenEnabled' , ] , [ 'webkitRequestFullScreen' , 'webkitCancelFullScreen' , 'webkitCurrentFullScreenElement' , 'webkitCancelFullScreen' , ] , [ 'mozRequestFullScreen' , 'mozCancelFullScreen' , 'mozFullScreenElement' , 'mozFullScreenEnabled' , ] , [ 'msRequestFullscreen' , 'msExitFullscreen' , 'msFullscreenElement' , 'msFullscreenEnabled' , ] , ] ; const nativeAPI = ( ( ) => { const unprefixedMethods = methodMap [ 0 ] ; for ( const methodList of methodMap ) { const exitFullscreenMethod = methodList ?. [ 1 ] ; if ( exitFullscreenMethod in document ) { return unprefixedMethods . reduce ( ( obj , k , i ) => ( { ... obj , [ k ] : methodList [ i ] } ) , { } ) ; } } return null ; } ) ( ) ; const requestFullscreen = nativeAPI ?. requestFullscreen ; const exitFullscreen = nativeAPI ?. exitFullscreen ; const fullscreenElement = nativeAPI ?. fullscreenElement ; const fullscreenEnabled = nativeAPI ?. fullscreenEnabled ; export const isEnabled = fullscreenEnabled ? ( document as Record < string , any > ) [ fullscreenEnabled ] : false ; export const isFullscreen = ( ) : boolean => fullscreenElement ? ( document as Record < string , any > ) [ fullscreenElement ] : false ; export const requestFs = ( ) => { if ( requestFullscreen ) { ; ( document . documentElement as Record < string , any > ) [ requestFullscreen ] ( ) ; } } ; export const exitFs = ( ) => { if ( exitFullscreen ) { ; ( document as Record < string , any > ) [ exitFullscreen ] ( ) ; } } ;