(()=>{"use strict";document.addEventListener("DOMContentLoaded",(function(){let t,e;if(!1!==string_locator.CodeMirror&&""!==string_locator.CodeMirror){t=wp.codeEditor.initialize("code-editor",string_locator.CodeMirror);const o=wp.template("string-locator-alert");function n(){const e=Math.max(document.documentElement.clientHeight,window.innerHeight||0)-89;t.codemirror.setSize(null,parseInt(e))}document.addEventListener("click",(function(e){const o=e.target;o.classList.contains("string-locator-edit-goto")&&(e.preventDefault(),t.codemirror.scrollIntoView(parseInt(o.dataset.gotoLine)),t.codemirror.setCursor(parseInt(o.dataset.gotoLine-1),o.dataset.gotoLinepos))})),document.getElementById("string-locator-edit-form").addEventListener("submit",(function(t){const n=document.getElementById("string-locator-notices");return e=new FormData(this),fetch(string_locator.url.save,{method:"POST",body:e}).then((t=>t.json())).then((function(t){void 0===t.notices?n.innerHTML+=o({type:"error",message:t.responseText}):t.notices.forEach((function(t){n.innerHTML+=o(t)}))})),t.preventDefault(),!1})),n(),t.codemirror.scrollIntoView(parseInt(string_locator.goto_line)),t.codemirror.setCursor(parseInt(string_locator.goto_line-1),parseInt(string_locator.goto_linepos)),window.onresize=n}else t=document.getElementById("code-editor"),t.style.width=document.getElementsByClassName("string-locator-edit-wrap")[0].offsetWidth,t.style.height=parseInt(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-89)}))})();