Liferay.Loader.define("fragment-web$codemirror@5.65.2/addon/dialog/dialog",["module","exports","require","../../lib/codemirror"],(function(o,e,n){var t,i=void 0;window;t=function(o){function dialogDiv(e,n,t){var i=e.getWrapperElement(),l=i.appendChild(document.createElement("div"));return l.className=t?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof n?l.innerHTML=n:l.appendChild(n),o.addClass(i,"dialog-opened"),l}function closeNotification(o,e){o.state.currentNotificationClose&&o.state.currentNotificationClose(),o.state.currentNotificationClose=e}o.defineExtension("openDialog",(function(e,n,t){t||(t={}),closeNotification(this,null);var i=dialogDiv(this,e,t.bottom),l=!1,r=this;function close(e){if("string"==typeof e)a.value=e;else{if(l)return;l=!0,o.rmClass(i.parentNode,"dialog-opened"),i.parentNode.removeChild(i),r.focus(),t.onClose&&t.onClose(i)}}var c,a=i.getElementsByTagName("input")[0];return a?(a.focus(),t.value&&(a.value=t.value,!1!==t.selectValueOnOpen&&a.select()),t.onInput&&o.on(a,"input",(function(o){t.onInput(o,a.value,close)})),t.onKeyUp&&o.on(a,"keyup",(function(o){t.onKeyUp(o,a.value,close)})),o.on(a,"keydown",(function(e){t&&t.onKeyDown&&t.onKeyDown(e,a.value,close)||((27==e.keyCode||!1!==t.closeOnEnter&&13==e.keyCode)&&(a.blur(),o.e_stop(e),close()),13==e.keyCode&&n(a.value,e))})),!1!==t.closeOnBlur&&o.on(i,"focusout",(function(o){null!==o.relatedTarget&&close()}))):(c=i.getElementsByTagName("button")[0])&&(o.on(c,"click",(function(){close(),r.focus()})),!1!==t.closeOnBlur&&o.on(c,"blur",close),c.focus()),close})),o.defineExtension("openConfirm",(function(e,n,t){closeNotification(this,null);var i=dialogDiv(this,e,t&&t.bottom),l=i.getElementsByTagName("button"),r=!1,c=this,a=1;function close(){r||(r=!0,o.rmClass(i.parentNode,"dialog-opened"),i.parentNode.removeChild(i),c.focus())}l[0].focus();for(var s=0;s<l.length;++s){var u=l[s];!function(e){o.on(u,"click",(function(n){o.e_preventDefault(n),close(),e&&e(c)}))}(n[s]),o.on(u,"blur",(function(){--a,setTimeout((function(){a<=0&&close()}),200)})),o.on(u,"focus",(function(){++a}))}})),o.defineExtension("openNotification",(function(e,n){closeNotification(this,close);var t,i=dialogDiv(this,e,n&&n.bottom),l=!1,r=n&&void 0!==n.duration?n.duration:5e3;function close(){l||(l=!0,clearTimeout(t),o.rmClass(i.parentNode,"dialog-opened"),i.parentNode.removeChild(i))}return o.on(i,"click",(function(e){o.e_preventDefault(e),close()})),r&&(t=setTimeout(close,r)),close}))},"object"==typeof e&&"object"==typeof o?t(n("../../lib/codemirror")):"function"==typeof i&&i.amd?i(["../../lib/codemirror"],t):t(CodeMirror)}));
//# sourceMappingURL=dialog.js.map