import{t as e}from"./chunk-6hGRweTZ.js";import{t}from"./codemirror-mxAyinHX.js";var n=e(((e,n)=>{(function(r){typeof e==`object`&&typeof n==`object`?r(t()):typeof define==`function`&&define.amd?define([`../../lib/codemirror`],r):r(CodeMirror)})(function(e){function t(t,n,r){var i=t.getWrapperElement(),a=i.appendChild(document.createElement(`div`));return r?a.className=`CodeMirror-dialog CodeMirror-dialog-bottom`:a.className=`CodeMirror-dialog CodeMirror-dialog-top`,typeof n==`string`?a.innerHTML=n:a.appendChild(n),e.addClass(i,`dialog-opened`),a}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension(`openDialog`,function(r,i,a){a||={},n(this,null);var o=t(this,r,a.bottom),s=!1,c=this;function l(t){if(typeof t==`string`)u.value=t;else{if(s)return;s=!0,e.rmClass(o.parentNode,`dialog-opened`),o.parentNode.removeChild(o),c.focus(),a.onClose&&a.onClose(o)}}var u=o.getElementsByTagName(`input`)[0],d;return u?(u.focus(),a.value&&(u.value=a.value,a.selectValueOnOpen!==!1&&u.select()),a.onInput&&e.on(u,`input`,function(e){a.onInput(e,u.value,l)}),a.onKeyUp&&e.on(u,`keyup`,function(e){a.onKeyUp(e,u.value,l)}),e.on(u,`keydown`,function(t){a&&a.onKeyDown&&a.onKeyDown(t,u.value,l)||((t.keyCode==27||a.closeOnEnter!==!1&&t.keyCode==13)&&(u.blur(),e.e_stop(t),l()),t.keyCode==13&&i(u.value,t))}),a.closeOnBlur!==!1&&e.on(o,`focusout`,function(e){e.relatedTarget!==null&&l()})):(d=o.getElementsByTagName(`button`)[0])&&(e.on(d,`click`,function(){l(),c.focus()}),a.closeOnBlur!==!1&&e.on(d,`blur`,l),d.focus()),l}),e.defineExtension(`openConfirm`,function(r,i,a){n(this,null);var o=t(this,r,a&&a.bottom),s=o.getElementsByTagName(`button`),c=!1,l=this,u=1;function d(){c||(c=!0,e.rmClass(o.parentNode,`dialog-opened`),o.parentNode.removeChild(o),l.focus())}s[0].focus();for(var f=0;f<s.length;++f){var p=s[f];(function(t){e.on(p,`click`,function(n){e.e_preventDefault(n),d(),t&&t(l)})})(i[f]),e.on(p,`blur`,function(){--u,setTimeout(function(){u<=0&&d()},200)}),e.on(p,`focus`,function(){++u})}}),e.defineExtension(`openNotification`,function(r,i){n(this,l);var a=t(this,r,i&&i.bottom),o=!1,s,c=i&&i.duration!==void 0?i.duration:5e3;function l(){o||(o=!0,clearTimeout(s),e.rmClass(a.parentNode,`dialog-opened`),a.parentNode.removeChild(a))}return e.on(a,`click`,function(t){e.e_preventDefault(t),l()}),c&&(s=setTimeout(l,c)),l})})}));export default n();export{n as t};
//# sourceMappingURL=dialog-BybDDGY4.js.map