define(["apphost","appRouter","loading","./startuphelper","connectionManager","focusManager","appSettings","emby-scroller","emby-input","material-icons","emby-button","emby-checkbox"],function(appHost,appRouter,loading,startupHelper,connectionManager,focusManager,appSettings){"use strict";return function(view,params){view.querySelector(".buttonCancel").addEventListener("click",function(e){appRouter.back()}),view.querySelector(".btnForgotPassword").addEventListener("click",function(e){appRouter.showItem({Type:"ForgotPassword",ServerId:params.serverId})}),view.querySelector(".btnSelectServer").addEventListener("click",function(e){appRouter.showSelectServer()}),view.querySelector("form").addEventListener("submit",function(e){var username=this.querySelector(".txtUserName").value,password=this.querySelector(".txtPassword").value;loading.show();var serverId=params.serverId;return appSettings.enableAutoLogin(view.querySelector(".chkRememberLogin").checked),startupHelper.authenticateUser(serverId,username,password),e.preventDefault(),!1}),view.addEventListener("viewshow",function(e){loading.hide();var txtUserName=view.querySelector(".txtUserName");txtUserName.value=params.user||"",view.querySelector(".txtPassword").value="",view.querySelector(".chkRememberLogin").checked=appSettings.enableAutoLogin(),params.user?focusManager.focus(view.querySelector(".txtPassword")):focusManager.focus(txtUserName)}),appHost.supports("multiserver")&&view.querySelector(".btnSelectServer").classList.remove("hide"),function(view,apiClient){appHost.supports("multiserver")&&apiClient.getJSON(apiClient.getUrl("Branding/Configuration")).then(function(options){var elem=view.querySelector(".disclaimer");options.LoginDisclaimer&&elem.classList.remove("hide"),elem.textContent=options.LoginDisclaimer||""})}(view,connectionManager.getApiClient(params.serverId))}});