define(["exports","./../modules/emby-apiclient/connectionmanager.js","./../modules/tabbedview/tabbedview.js","./../modules/common/globalize.js","./../modules/emby-elements/emby-itemscontainer/emby-itemscontainer.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/focusmanager.js","./../modules/registrationservices/registrationservices.js","./../modules/common/usersettings/usersettings.js","./../modules/maintabsmanager.js"],function(_exports,_connectionmanager,_tabbedview,_globalize,_embyItemscontainer,_embyButton,_embyScroller,_focusmanager,_registrationservices,_usersettings,_maintabsmanager){function getDefaultSubviews(){return["recordings","schedule","series"]}function hideShowAll(view,className,hide){for(var elems=view.querySelectorAll("."+className),i=0,length=elems.length;i<length;i++)hide?elems[i].classList.add("hide"):elems[i].classList.remove("hide")}function validateUnlock(view,showDialog){return _registrationservices.default.validateFeature("livetv",{showDialog:showDialog,viewOnly:!0}).then(function(){hideShowAll(view,"tabContent",!1),view.querySelector(".unlockContainer").classList.add("hide")},function(){hideShowAll(view,"tabContent",!0),view.querySelector(".unlockContainer").classList.remove("hide"),_focusmanager.default.focus(view.querySelector(".btnUnlock"))})}function LiveTVView(view,params){_tabbedview.default.apply(this,arguments),view.querySelector(".unlockText").innerHTML=_globalize.default.translate("DvrSubscriptionRequired","",""),view.querySelector(".btnUnlockText").innerHTML=_globalize.default.translate("HeaderBecomeProjectSupporter"),validateUnlock(view,!1),view.querySelector(".btnUnlock").addEventListener("click",function(){validateUnlock(view,!0)})}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(LiveTVView.prototype,_tabbedview.default.prototype),LiveTVView.prototype.getTabs=function(){var item=(item=this.item)&&item.Subviews||getDefaultSubviews();return[{name:_globalize.default.translate("Programs"),id:"suggestions"},{name:_globalize.default.translate("Guide"),id:"guide"},{name:_globalize.default.translate("Channels"),id:"channels"},{name:_globalize.default.translate("Tags"),id:"tags",enabled:item.includes("tags")},{name:_globalize.default.translate("Recordings"),id:"recordings"},{name:_globalize.default.translate("Schedule"),id:"schedule"},{name:_globalize.default.translate("Series"),id:"series"}]},LiveTVView.prototype.validateTabLoad=function(index){return validateUnlock(this.view,!1)},LiveTVView.prototype.getDefaultTabUserSettingsValue=function(folderId){return _usersettings.default.get("landing-livetv")},LiveTVView.prototype.loadTabController=function(id){switch(id){case"collections":return Emby.importModule("./modules/tabbedview/collectionstab.js");case"genres":return Emby.importModule("./modules/tabbedview/genrestab.js");case"tags":return Emby.importModule("./modules/tabbedview/tagstab.js");case"suggestions":return Emby.importModule("./livetv/suggestions.js");case"guide":return Emby.importModule("./livetv/guide.js");case"channels":return Emby.importModule("./livetv/channels.js");case"recordings":return Emby.importModule("./livetv/recordings.js");case"schedule":return Emby.importModule("./livetv/schedule.js");case"series":return Emby.importModule("./livetv/series.js");default:throw new Error("tab not found: "+id)}},LiveTVView.prototype.getItem=function(){var params=this.params,params=_connectionmanager.default.getApiClient(params.serverId);return params.getJSON(params.getUrl("LiveTV/Folder"))},LiveTVView.prototype.getTabControllerOptions=function(id){var options=_tabbedview.default.prototype.getTabControllerOptions.apply(this,arguments);return"tags"===id&&(options.tagsApiClientMethod="getLiveTvChannelTags",options.prefixesApiClientMethod="getLiveTvChannelTagPrefixes"),options},LiveTVView.prototype.enableWindowInputCommands=function(){return!0},LiveTVView.prototype.onWindowInputCommand=function(e){switch(e.detail.command){case"livetv":return void e.preventDefault();case"recordedtv":return _maintabsmanager.default.selectedTabIndex(4),void e.preventDefault();case"guide":return _maintabsmanager.default.selectedTabIndex(1),void e.preventDefault()}_tabbedview.default.prototype.onWindowInputCommand.apply(this,arguments)};_exports.default=LiveTVView});