define(["exports","./../dialoghelper/dialoghelper.js","./../layoutmanager.js","./../common/globalize.js","./../emby-elements/emby-input/emby-input.js","./../emby-elements/emby-select/emby-select.js","./../emby-elements/emby-button/emby-button.js","./../emby-elements/emby-button/paper-icon-button-light.js","./../emby-elements/emby-scroller/emby-scroller.js","./../emby-elements/emby-dialogclosebutton/emby-dialogclosebutton.js"],function(_exports,_dialoghelper,_layoutmanager,_globalize,_embyInput,_embySelect,_embyButton,_paperIconButtonLight,_embyScroller,_embyDialogclosebutton){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["formDialogStyle"]);_exports.default={show:function(person){return new Promise(function(resolve,reject){require(["text!modules/metadataeditor/personeditor.template.html"],function(template){var dialogOptions={removeOnClose:!0,scrollY:!1},dlg=(_layoutmanager.default.tv?dialogOptions.size="fullscreen":dialogOptions.size="medium-tall",_dialoghelper.default.createDialog(dialogOptions)),dialogOptions=(dlg.classList.add("formDialog"),""),submitted=!1;dialogOptions+=_globalize.default.translateDocument(template,"sharedcomponents"),dlg.innerHTML=dialogOptions,dlg.querySelector(".txtPersonName",dlg).value=person.Name||"",dlg.querySelector(".selectPersonType",dlg).value=person.Type||"",dlg.querySelector(".txtPersonRole",dlg).value=person.Role||"",_dialoghelper.default.open(dlg),dlg.addEventListener("close",function(){submitted?resolve(person):reject()}),dlg.querySelector(".selectPersonType").addEventListener("change",function(e){"Actor"===this.value?dlg.querySelector(".fldRole").classList.remove("hide"):dlg.querySelector(".fldRole").classList.add("hide")}),dlg.querySelector("form").addEventListener("submit",function(e){return submitted=!0,person.Name=dlg.querySelector(".txtPersonName",dlg).value,person.Type=dlg.querySelector(".selectPersonType",dlg).value,person.Role=dlg.querySelector(".txtPersonRole",dlg).value||null,_dialoghelper.default.close(dlg),e.preventDefault(),!1}),dlg.querySelector(".selectPersonType").dispatchEvent(new CustomEvent("change",{bubbles:!0}))})})}}});