define(["exports","./../modules/viewmanager/baseview.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/loading/loading.js"],function(_exports,_baseview,_globalize,_embyInput,_embyButton,_embyScroller,_connectionmanager,_approuter,_servicelocator,_loading){function onBackClick(){_approuter.default.back()}function showAlert(options){Emby.importModule("./modules/common/dialogs/alert.js").then(function(alert){return alert(options)})}function processForgotPasswordResult(result){var msg;_loading.default.hide(),"ContactAdmin"===result.Action?showAlert({text:_globalize.default.translate("ContactAdminToResetPassword"),title:_globalize.default.translate("HeaderForgotPassword")}):"InNetworkRequired"===result.Action?showAlert({text:_globalize.default.translate("ForgotPasswordInNetworkRequired"),title:_globalize.default.translate("HeaderForgotPassword")}):"PinCode"===result.Action&&(msg=_globalize.default.translate("ForgotPasswordFileCreated"),msg=(msg+="<p>")+result.PinFile+"</p>",showAlert({html:msg=_servicelocator.appHost.supports("targetblank")&&_servicelocator.appHost.supports("externallinks")?(msg+='<p><a href="https://emby.media/support/articles/Server-Data-Folder.html" target="_blank" is="emby-linkbutton" class="button-link">')+_globalize.default.translate("Help")+"</a></p>":msg,title:_globalize.default.translate("HeaderForgotPassword"),centerText:!1}))}function View(view,params){_baseview.default.apply(this,arguments),view.querySelector(".btnCancel").addEventListener("click",onBackClick),view.querySelector("form").addEventListener("submit",function(e){var apiClient=_connectionmanager.default.getApiClient(params.serverId);return _loading.default.show(),apiClient.ajax({type:"POST",url:apiClient.getUrl("Users/ForgotPassword"),dataType:"json",data:{EnteredUsername:view.querySelector(".txtName").value}}).then(processForgotPasswordResult),e.preventDefault(),!1})}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(View.prototype,_baseview.default.prototype);_exports.default=View});