text: // Open simple dialogs on top of an editor. Relies on dialog.css.
  (function(){function e(e,t,n){var r=e.getWrapperElement(),i;return i=r.appendChild(document.createElement("div")),n?i.className="CodeMirror-dialog CodeMirror-dialog-bottom":i.className="CodeMirror-dialog CodeMirror-dialog-top",typeof t=="string"?i.innerHTML=t:i.appendChild(t),i}function t(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}CodeMirror.defineExtension("openDialog",function(n,r,i){function a(){if(o)return;o=!0,s.parentNode.removeChild(s)}t(this,null);var s=e(this,n,i&&i.bottom),o=!1,u=this,f=s.getElementsByTagName("input")[0],l;if(f)i&&i.value&&(f.value=i.value),CodeMirror.on(f,"keydown",function(e){if(i&&i.onKeyDown&&i.onKeyDown(e,f.value,a))return;if(e.keyCode==13||e.keyCode==27)CodeMirror.e_stop(e),a(),u.focus(),e.keyCode==13&&r(f.value)}),i&&i.onKeyUp&&CodeMirror.on(f,"keyup",function(e){i.onKeyUp(e,f.value,a)}),i&&i.value&&(f.value=i.value),f.focus(),CodeMirror.on(f,"blur",a);else if(l=s.getElementsByTagName("button")[0])CodeMirror.on(l,"click",function(){a(),u.focus()}),l.focus(),CodeMirror.on(l,"blur",a);return a}),CodeMirror.defineExtension("openConfirm",function(n,r,i){function l(){if(u)return;u=!0,s.parentNode.removeChild(s),a.focus()}t(this,null);var s=e(this,n,i&&i.bottom),o=s.getElementsByTagName("button"),u=!1,a=this,f=1;o[0].focus();for(var c=0;c<o.length;++c){var h=o[c];(function(e){CodeMirror.on(h,"click",function(t){CodeMirror.e_preventDefault(t),l(),e&&e(a)})})(r[c]),CodeMirror.on(h,"blur",function(){--f,setTimeout(function(){f<=0&&l()},200)}),CodeMirror.on(h,"focus",function(){++f})}}),CodeMirror.defineExtension("openNotification",function(n,r){function a(){if(o)return;o=!0,clearTimeout(u),i.parentNode.removeChild(i)}t(this,a);var i=e(this,n,r&&r.bottom),s=r&&(r.duration===undefined?5e3:r.duration),o=!1,u;CodeMirror.on(i,"click",function(e){CodeMirror.e_preventDefault(e),a()}),s&&(u=setTimeout(a,r.duration))})})();