define(["dialogHelper","layoutManager","globalize","require","material-icons","emby-button","paper-icon-button-light","emby-input","formDialogStyle","emby-scroller"],function(dialogHelper,layoutManager,globalize,require){"use strict";function showDialog(options,template){var dialogOptions={removeOnClose:!0,scrollY:!1};layoutManager.tv&&(dialogOptions.size="fullscreen");var submitValue,dlg=dialogHelper.createDialog(dialogOptions);return dlg.classList.add("formDialog"),dlg.innerHTML=globalize.translateHtml(template,"sharedcomponents"),layoutManager.tv||(dlg.querySelector(".dialogContentInner").style["padding-bottom"]="10em",dlg.classList.add("dialog-fullscreen-lowres")),dlg.querySelector(".btnCancel").addEventListener("click",function(e){dialogHelper.close(dlg)}),dlg.querySelector(".formDialogHeaderTitle").innerHTML=options.title||"",options.description?dlg.querySelector(".fieldDescription").innerHTML=options.description:dlg.querySelector(".fieldDescription").classList.add("hide"),function(dlg,options){var txtInput=dlg.querySelector("#txtInput");txtInput.label?txtInput.label(options.label||""):txtInput.setAttribute("label",options.label||""),txtInput.value=options.value||""}(dlg,options),dlg.querySelector("form").addEventListener("submit",function(e){return submitValue=dlg.querySelector("#txtInput").value,e.preventDefault(),e.stopPropagation(),setTimeout(function(){dialogHelper.close(dlg)},300),!1}),dlg.querySelector(".submitText").innerHTML=options.confirmText||globalize.translate("ButtonOk"),dlg.style.minWidth="28em",dlg.style.maxWidth="90vw",dialogHelper.open(dlg).then(function(){var value=submitValue;return value||Promise.reject()})}return function(options){return require(["text!./prompt.template.html"]).then(function(responses){var template=responses[0];return"string"==typeof options&&(options={title:"",label:options}),showDialog(options,template)})}});