define(["exports","./../list/list.js","./../modules/common/globalize.js","./../modules/emby-elements/emby-input/emby-input.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/emby-apiclient/connectionmanager.js","./../modules/approuter.js","./../modules/common/servicelocator.js","./../modules/common/appsettings.js","./../modules/common/textencoding.js"],function(_exports,_list,_globalize,_embyInput,_embyButton,_embyScroller,_connectionmanager,_approuter,_servicelocator,_appsettings,_textencoding){function setItemProperies(server){}function addItems(items,serverId){items.push({Name:_globalize.default.translate("HeaderManualLogin"),Type:"ManualLogin",ServerId:serverId}),items.push({Name:_globalize.default.translate("HeaderForgotPassword"),Type:"ForgotPassword",ServerId:serverId}),_servicelocator.appHost.supports("multiserver")&&items.push({Name:_globalize.default.translate("HeaderChangeServer"),Type:"SelectServer"})}function showUserSignIn(apiClient,user){user.HasPassword?_approuter.default.showServerLogin({apiClient:apiClient,username:user.Name,loginType:"manual"}):_approuter.default.authenticateUser({serverId:user.ServerId,username:user.Name})}function LoginPage(view,params){this.enableAlphaNumericShortcuts=!1,this.enableTotalRecordCountDisplay=!1,this.supportsViewSettings=!1,_list.default.call(this,view,params),view.querySelector(".itemsContainer").addEventListener("action-null",function(e){var apiClient,item=e.detail.item;if("User"===item.Type)return apiClient=_connectionmanager.default.getApiClient(item),_connectionmanager.default.isLoggedIn(item.ServerId,item.Id)&&("none"!==_appsettings.default.autoLogin()||_appsettings.default.enableProfilePin(item.Id))?_approuter.default.changeToUser({apiClient:apiClient,userId:item.Id}).catch(function(err){"aborterror"!==((null==err?void 0:err.name)||"").toLowerCase()&&showUserSignIn(apiClient,item)}):void showUserSignIn(apiClient,item);_approuter.default.showItem(item)}.bind(this)),function(instance){var view=instance.view,instance=instance.getApiClient().serverName()||"",instance=(instance=globalThis.appMode?instance:instance.replace(/(emby)/gi,"Media Server").replace(/(Media Server Media Server)/gi,"Media Server").replace(/(Media Server MediaServer)/gi,"MediaServer"))?_globalize.default.translate("SignIntoServerName",_textencoding.default.htmlEncode(instance)):_globalize.default.translate("HeaderPleaseSignIn");view.querySelector(".scrollSlider").insertAdjacentHTML("afterbegin",'<h1 style="text-align:center;margin: 0 0 .5em;">'+instance+"</h1>")}(this),function(view,apiClient){_servicelocator.appHost.supports("multiserver")||apiClient.getJSON(apiClient.getUrl("Branding/Configuration")).then(function(options){var elem;options.LoginDisclaimer&&((elem=document.createElement("div")).classList.add("disclaimer"),elem.textContent=options.LoginDisclaimer||"",elem.style.textAlign="center",elem.classList.add("padded-bottom","padded-bottom-page","padded-top"),(options=view.querySelector(".scrollSlider")).insertAdjacentHTML("afterbegin",'<h1 style="text-align:center;margin-top:0;">'+_globalize.default.translate("HeaderPleaseSignIn")+"</h1>"),options.appendChild(elem),view.querySelector(".itemsContainer").classList.remove("padded-bottom-page"))})}(view,_connectionmanager.default.getApiClient(params.serverId))}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["material-icons"]),Object.assign(LoginPage.prototype,_list.default.prototype),LoginPage.prototype.getSortMenuOptions=function(){return[]},LoginPage.prototype.getItemTypes=function(){return["User"]},LoginPage.prototype.getItems=function(query){var serverId=this.params.serverId,apiClient=_connectionmanager.default.getApiClient(serverId),specialItems=[],numSpecialItems=(addItems(specialItems,serverId),specialItems.length);return apiClient.getPublicUsersQueryResult(query).then(function(result){return result.Items.forEach(setItemProperies),result.Items.length<query.Limit&&addItems(result.Items,serverId),!1!==query.EnableTotalRecordCount&&(result.TotalRecordCount+=numSpecialItems),result})},LoginPage.prototype.setTitle=function(){},LoginPage.prototype.getBaseListRendererOptions=function(){var options=_list.default.prototype.getBaseListRendererOptions.apply(this,arguments);return options.draggable=!1,options.draggableXActions=!1,options.multiSelect=!1,options.contextMenu=!1,options.action="custom",options},LoginPage.prototype.getCardOptions=function(items,settings){var options=_list.default.prototype.getCardOptions.apply(this,arguments);return options.defaultBackground=!0,options.fields=["Name"],options};_exports.default=LoginPage});