(self.webpackChunk=self.webpackChunk||[]).push([[8025],{8025:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return q},show:function(){return k}}),i(72264),i(63238),i(61418),i(95289);var l,a,s,n=i(1115),r=i(53913),o=i(83094),u=i(6594),c=i(13800),d=i(78695),b=i(53754),p=i(48487),f=i.n(p),v=i(38440),m=(i(78066),i(50447),i(16589),i(1892)),g=i.n(m),h=i(17649),y=(g()(h.Z,{insert:"head",singleton:!1}),h.Z.locals,!1);function S(e){u.ZP.hide();var t=e.target.error;t.code!==t.ABORT_ERR&&(0,v.Z)(b.ZP.translate("MessageFileReadError"))}function L(e){return e&&[".sub",".srt",".vtt",".ass",".ssa"].some((function(t){return e.name.endsWith(t)}))}function Z(e){var t=s;if(!L(t))return(0,v.Z)(b.ZP.translate("MessageSubtitleFileTypeAllowed")),void e.preventDefault();u.ZP.show();var i=o.ZP.parentWithClass(this,"dialog"),c=i.querySelector("#selectLanguage").value,d=i.querySelector("#chkIsForced").checked;r.ZP.getApiClient(a).uploadItemSubtitle(l,c,d,t).then((function(){i.querySelector("#uploadSubtitle").value="",u.ZP.hide(),y=!0,n.default.close(i)})),e.preventDefault()}function k(e){return new Promise((function(t,i){y=!1,function(e,t,i){l=(e=e||{}).itemId,a=e.serverId;var r={removeOnClose:!0,scrollY:!1};d.Z.tv?r.size="fullscreen":r.size="small";var o,p=n.default.createDialog(r);p.classList.add("formDialog"),p.classList.add("subtitleUploaderDialog"),p.innerHTML=b.ZP.translateHtml(f(),"core"),d.Z.tv&&c.Z.centerFocus.on(p,!1),p.addEventListener("close",(function(){d.Z.tv&&c.Z.centerFocus.off(p,!1),u.ZP.hide(),t(y)})),n.default.open(p),(o=p).querySelector(".uploadSubtitleForm").addEventListener("submit",Z),o.querySelector("#uploadSubtitle").addEventListener("change",(function(){!function(e,t){var i=t[0];if(!L(i))return e.querySelector("#subtitleOutput").innerHTML="",e.querySelector("#fldUpload").classList.add("hide"),e.querySelector("#labelDropSubtitle").classList.remove("hide"),void(s=null);s=i;var l,a=new FileReader;a.onerror=S,a.onloadstart=function(){e.querySelector("#fldUpload").classList.add("hide")},a.onabort=function(){u.ZP.hide(),console.debug("File read cancelled")},a.onload=(l=i,function(){var t='<a><i class="material-icons" style="transform: translateY(25%);">subtitles</i><span>'+escape(l.name)+"</span><a/>";e.querySelector("#subtitleOutput").innerHTML=t,e.querySelector("#fldUpload").classList.remove("hide"),e.querySelector("#labelDropSubtitle").classList.add("hide")}),a.readAsDataURL(i)}(o,this.files)})),o.querySelector(".btnBrowse").addEventListener("click",(function(){o.querySelector("#uploadSubtitle").click()}));var v=p.querySelector("#selectLanguage");e.languages&&(v.innerHTML=e.languages.list||null,v.value=e.languages.value||null),p.querySelector(".btnCancel").addEventListener("click",(function(){n.default.close(p)}))}(e,t)}))}var q={show:k}},17649:function(e,t,i){"use strict";var l=i(93476),a=i.n(l)()((function(e){return e[1]}));a.push([e.id,".subtitleEditor-dropZone{border:.2em dashed;border-radius:.25em;text-align:center;position:relative;height:12em;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}",""]),t.Z=a},48487:function(e){e.exports='<div class="formDialogHeader"> <button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><em class="material-icons arrow_back"></em></button> <h3 class="formDialogHeaderTitle"> ${HeaderUploadSubtitle} </h3> </div> <div class="formDialogContent"> <div class="dialogContentInner"> <form class="uploadSubtitleForm"> <div class="flex align-items-center" style="margin:1.5em 0"> <h2 style="margin:0">${HeaderAddUpdateSubtitle}</h2> <button is="emby-button" type="button" class="raised raised-mini btnBrowse" style="margin-left:1.5em"> <em class="material-icons">folder</em> <span>${Browse}</span> </button> </div> <div> <div class="subtitleEditor-dropZone fieldDescription"> <div id="labelDropSubtitle">${LabelDropSubtitleHere}</div> <output id="subtitleOutput" class="flex align-items-center justify-content-center" style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%"></output> <input type="file" accept=".sub,.srt,.vtt,.ass,.ssa" id="uploadSubtitle" name="uploadSubtitle" style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;opacity:0"/> </div> <div id="fldUpload" class="hide"> <br/> <div class="checkboxContainer"> <label> <input type="checkbox" is="emby-checkbox" id="chkIsForced"/> <span>${LabelIsForced}</span> </label> </div> <div class="selectContainer flex-grow"> <select is="emby-select" id="selectLanguage" required="required" label="${LabelLanguage}" autofocus></select> </div> <button is="emby-button" type="submit" class="raised button-submit block"> <span>${Upload}</span> </button> </div> </div> </form> </div> </div> '}}]);