define(["exports","./../dialoghelper/dialoghelper.js","./../layoutmanager.js","./../common/globalize.js","./../common/responsehelper.js","./../focusmanager.js","./../emby-elements/emby-dialogclosebutton/emby-dialogclosebutton.js","./../emby-elements/emby-select/emby-select.js","./../emby-elements/emby-button/emby-button.js","./../emby-elements/emby-toggle/emby-toggle.js"],function(_exports,_dialoghelper,_layoutmanager,_globalize,_responsehelper,_focusmanager,_embyDialogclosebutton,_embySelect,_embyButton,_embyToggle){function CopyUserDataDialog(){}function onOpened(){_focusmanager.default.autoFocus(this,{skipIfNotEnabled:!0})}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["flexStyles","formDialogStyle","material-icons"]),CopyUserDataDialog.prototype.show=function(options){this.options=options;var instance=this;return require(["text!./modules/copyuserdatadialog/copyuserdatadialog.template.html"]).then(function(responses){var responses=responses[0],dialogOptions={removeOnClose:!0,scrollY:!1,autoFocus:!1},dialogOptions=(_layoutmanager.default.tv?dialogOptions.size="fullscreen":dialogOptions.size="medium-tall",_dialoghelper.default.createDialog(dialogOptions));return(instance.context=dialogOptions).classList.add("formDialog"),dialogOptions.innerHTML=_globalize.default.translateDocument(responses,"sharedcomponents"),dialogOptions.querySelector("form").addEventListener("submit",function(e){e.preventDefault();var instance=this,userCopyOptions=[];return(e=e.target).querySelector(".chkCopyUserPolicy").checked&&userCopyOptions.push("UserPolicy"),e.querySelector(".chkCopyUserConfiguration").checked&&userCopyOptions.push("UserConfiguration"),e.querySelector(".chkCopyUserData").checked&&userCopyOptions.push("UserData"),instance.options.apiClient.copyUserDataToUsers({userId:instance.options.item.Id,ToUserIds:e.querySelector(".selectUsers").getValues(),CopyOptions:userCopyOptions}).then(function(){instance.closeDialog()},_responsehelper.default.handleErrorResponse)}.bind(instance)),dialogOptions.querySelector(".selectUsers").getItems=function(query){return query=Object.assign({},query),this.options.apiClient.getUsersQueryResult(query)}.bind(instance),dialogOptions.addEventListener("opened",onOpened),_dialoghelper.default.open(dialogOptions).catch(function(){return Promise.resolve()})})},CopyUserDataDialog.prototype.closeDialog=function(){_dialoghelper.default.close(this.context)},CopyUserDataDialog.prototype.pause=function(){},CopyUserDataDialog.prototype.destroy=function(){this.pause(),this.options=null,this.context=null};_exports.default=CopyUserDataDialog});