var isShowMobileTips=null,isLandscape=!1,isEnableScroll=!0,scrollingEvent=null,onOrientationChangeEvent=null,touchCount=0,updateScreenDelay=300,dragRatio=1.2;function onOrientationChange(e){null!=onOrientationChangeEvent&&(clearTimeout(onOrientationChangeEvent),onOrientationChangeEvent=null),onOrientationChangeEvent=setTimeout(()=>{if(!ScreenUtil.setFullscreen(!0)){let n=e;showMobileTips(isLandscape=90==n||-90==n,!0)}},updateScreenDelay)}function onScrolling(e){isBottomPage()?console.log("bottom!"):isTopPage()&&console.log("top!"),onTriggerCloseTips(),console.log(document.body.scrollTop,document.body.offsetHeight),console.log(window.innerHeight,window.pageYOffset)}function onTriggerCloseTips(){(!isLandscape||isLandscape&&isBottomPage()&&touchCount<=0)&&(ScreenUtil.setFullscreen(!0)||showMobileTips(!1,!0))}function onCheckFirstTime(){scrollToTop(),onOrientationChange(window.orientation)}function isTopPage(){return window.innerHeight+window.pageYOffset=document.body.offsetHeight}function showMobileTips(e,n=!0){let t=document.getElementById("animation-container"),o=document.getElementById("game-container"),l=document.getElementById("mobile-tips"),s=game.scale.displaySize._width,i=game.scale.displaySize._height;isShowMobileTips!=e&&(isShowMobileTips=e,e?(t&&(t.style.width=s+"px",t.style.height=i*dragRatio+"px",t.style.display="block"),o&&(o.style.pointerEvents="none"),l&&(l.style.visibility="visible",l.style.display="block"),ScreenUtil.setEnableAllInput(!1),n&&setTimeout(()=>{scrollToTop()},updateScreenDelay)):(t&&(t.style.width="0px",t.style.height="0px",t.style.display="none"),o&&(o.style.pointerEvents="auto"),l&&(l.style.visibility="hidden",l.style.display="none"),ScreenUtil.setEnableAllInput(!0),n&&setTimeout(()=>{scrollToBottom()},updateScreenDelay)))}function scrollToTop(){window.scrollTo(0,0),console.log("scrollToTop!")}function scrollToBottom(){window.scrollTo(0,window.innerHeight+1),console.log("scrollToBottom!")}window.addEventListener("orientationchange",(function(e){onOrientationChange(e.target.orientation)})),window.addEventListener("scroll",(function(e){onScrolling(e)})),window.addEventListener("touchstart",(function(e){console.log("touchstart",e.touches.length),touchCount=e.touches.length})),window.addEventListener("touchend",(function(e){console.log("touchend",e.touches.length),touchCount=e.touches.length,onTriggerCloseTips()}));var keys={37:1,38:1,39:1,40:1};function preventDefault(e){e.preventDefault()}function preventDefaultForScrollKeys(e){if(keys[e.keyCode])return preventDefault(e),!1}var supportsPassive=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){supportsPassive=!0}}))}catch(e){}var wheelOpt=!!supportsPassive&&{passive:!1},wheelEvent="onwheel"in document.createElement("div")?"wheel":"mousewheel";function disableScroll(){window.addEventListener("DOMMouseScroll",preventDefault,!1),window.addEventListener(wheelEvent,preventDefault,wheelOpt),window.addEventListener("touchmove",preventDefault,wheelOpt),window.addEventListener("keydown",preventDefaultForScrollKeys,!1),isEnableScroll=!1}function enableScroll(){window.removeEventListener("DOMMouseScroll",preventDefault,!1),window.removeEventListener(wheelEvent,preventDefault,wheelOpt),window.removeEventListener("touchmove",preventDefault,wheelOpt),window.removeEventListener("keydown",preventDefaultForScrollKeys,!1),isEnableScroll=!0}class ScreenUtil{static setFullscreen(e){if(console.log("setFullscreen",e),Helper.getCurrentScene().sys.game.device.fullscreen.available){console.log("Support fullscreen!");let n=Helper.getCurrentScene();return e?n.scale.isFullscreen||n.scale.startFullscreen():n.scale.isFullscreen&&n.scale.stopFullscreen(),!0}{console.log("Fullscreen not support.");let n=document.documentElement;if(console.log(n),e)if(n.requestFullscreen)n.requestFullscreen();else if(n.mozRequestFullScreen)n.mozRequestFullScreen();else if(n.webkitRequestFullscreen)n.webkitRequestFullscreen();else{if(!n.msRequestFullscreen)return console.log("error fullscreen"),!1;n.msRequestFullscreen()}else if(document.exitFullscreen)document.exitFullscreen();else if(document.mozRequestFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else{if(!document.msExitFullscreen)return console.log("error fullscreen"),!1;document.msExitFullscreen()}return!0}}static setEnableAllInput(e){game&&(game.input.enabled=e)}}