define(["exports","./../backdrop/backdrop.js","./../common/globalize.js","./../layoutmanager.js","./../maintabsmanager.js","./../appheader/appheader.js","./../common/usersettings/usersettings.js","./../emby-apiclient/connectionmanager.js","./../viewmanager/baseview.js","./../emby-elements/emby-tabs/emby-tabs.js","./../approuter.js","./../common/querystring.js","./../common/appsettings.js","./../loading/loading.js","../focusmanager.js","./../common/textencoding.js"],function(_exports,_backdrop,_globalize,_layoutmanager,_maintabsmanager,_appheader,_usersettings,_connectionmanager,_baseview,_embyTabs,_approuter,_querystring,_appsettings,_loading,_focusmanager,_textencoding){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var deviceMemory,platform,cores,enableTabAnimation=!((cores=navigator.hardwareConcurrency||4)<4||(2400<=(screen.width||screen.availWidth||0)||1400<=(screen.height||screen.availHeight||0))&&cores<6||(deviceMemory=navigator.deviceMemory||2)<2||(platform=(navigator.platform||"").toLowerCase(),"android"===globalThis.appMode&&(cores<4||deviceMemory<2||platform.includes("armv7"))));function onDataFetchError(instance,controller,response,signal){_loading.default.hide(),Emby.importModule("./modules/common/responsehelper.js").then(function(responseHelper){return responseHelper.getErrorInfo(response,{enableDefaultTitle:!1}).then(function(errorInfo){var errorOwner=controller||instance,errorElement=errorOwner._errorElement,html=(errorElement||((errorElement=document.createElement("div")).classList.add("padded-left","padded-left-page","padded-right","padded-top"),errorOwner===instance&&errorElement.classList.add("padded-top-page"),html="",html=(html+='
")+"
"+"
",(html=(null==(html=errorOwner.scroller)?void 0:html.getScrollSlider())||errorOwner.view).insertBefore(errorElement,html.firstChild),(errorOwner._errorElement=errorElement).querySelector(".btnRetryData").addEventListener("click",function(){var currentTabController=this.currentTabController,resumeOptions=(_loading.default.show(),{refresh:!0,autoFocus:!0});currentTabController?resumeController(this,currentTabController,resumeOptions,!0):(this._errorElement&&this._errorElement.classList.add("hide"),this.onBeginResume(resumeOptions),this.onResume(resumeOptions))}.bind(instance))),errorInfo.title||errorInfo.html),errorOwner=errorInfo.title?errorInfo.html:null,errorInfo=errorElement.querySelector(".errorTitle"),html=(errorInfo.innerHTML=_textencoding.default.htmlEncode(html||""),html?errorInfo.classList.remove("hide"):errorInfo.classList.add("hide"),errorElement.querySelector(".errorMessage"));return html.innerHTML=errorOwner||"",errorOwner?html.classList.remove("hide"):html.classList.add("hide"),null!=signal&&signal.throwIfAborted(),errorElement.classList.remove("hide"),_focusmanager.default.focus(errorElement.querySelector(".btnRetryData")),Promise.reject(response)})})}function resumeController(instance,controller,options,showError){return controller._errorElement&&!controller._errorElement.classList.contains("hide")&&(controller._errorElement.classList.add("hide"),(options=options||{}).refresh=!0),(controller.onResume(options)||Promise.resolve()).catch(function(errorResponse){var _options$signal;return null!=(_options$signal=options.signal)&&_options$signal.throwIfAborted(),showError?onDataFetchError(instance,controller,errorResponse,options.signal):Promise.reject(errorResponse)})}function loadTab(instance,index,previousIndex,previousTabController){instance.getTabController(index).then(function(controller){var autoFocus=null==previousIndex;!autoFocus&&_layoutmanager.default.tv&&previousTabController&&previousTabController.view&&!_appheader.default.hasFocus()&&(autoFocus=!0),resumeController(instance,controller,{autoFocus:autoFocus,refresh:!controller.refreshed},!0),controller.refreshed=!0,null!=previousIndex&&_layoutmanager.default.tv&&enableTabAnimation&&controller.view&&controller.view.animate&&(index