!function(t){function e(e){for(var n,d,l=e[0],u=e[1],a=e[2],c=0,f=[];c<l.length;c++)d=l[c],Object.prototype.hasOwnProperty.call(r,d)&&r[d]&&f.push(r[d][0]),r[d]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(t[n]=u[n]);for(s&&s(e);f.length;)f.shift()();return i.push.apply(i,a||[]),o()}function o(){for(var t,e=0;e<i.length;e++){for(var o=i[e],n=!0,l=1;l<o.length;l++){var u=o[l];0!==r[u]&&(n=!1)}n&&(i.splice(e--,1),t=d(d.s=o[0]))}return t}var n={},r={6:0},i=[];function d(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,d),o.l=!0,o.exports}d.m=t,d.c=n,d.d=function(t,e,o){d.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},d.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},d.t=function(t,e){if(1&e&&(t=d(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(d.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)d.d(o,n,function(e){return t[e]}.bind(null,n));return o},d.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return d.d(e,"a",e),e},d.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},d.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],u=l.push.bind(l);l.push=e,l=l.slice();for(var a=0;a<l.length;a++)e(l[a]);var s=u;i.push([86,0]),o()}({86:function(t,e,o){"use strict";CloudCmd.EditFile=e;const n=o(32),r=o(7),i=o(5),d=o(23),l=DOM.CurrentInfo,{Dialog:u,Images:a}=DOM,{config:s}=CloudCmd;let c,f;const C=r(),p={beforeClose:async()=>{i.ifExist(c,"hide"),await g()}};function m(){CloudCmd.Edit.hide()}function h(t){const e={x:t.clientX,y:t.clientY};if(t.preventDefault(),c)return;const o={beforeShow:t=>{t.x-=18,t.y-=27},afterClick:()=>{CloudCmd.Edit.getEditor().focus()}},n=CloudCmd.Edit.getElement();c=d(n,o,function(){const t=CloudCmd.Edit.getEditor();return{"Save           Ctrl+S":()=>{t.save()},"Go To Line     Ctrl+G":()=>{t.goToLine()},"Cut            Ctrl+X":()=>{t.cutToClipboard()},"Copy           Ctrl+C":()=>{t.copyToClipboard()},"Paste          Ctrl+V":()=>{t.pasteFromClipboard()},"Delete         Del":()=>{t.remove("right")},"Select All     Ctrl+A":()=>{t.selectAll()},"Close          Esc":m}}()),c.addContextMenuListener(),c.show(e.x,e.y)}async function g(){const t=CloudCmd.Edit.getEditor();if(!t.isChanged())return;const[e]=await u.confirm(f);e||t.save()}t.exports.init=async()=>{C(!0),await CloudCmd.Edit();const t=CloudCmd.Edit.getEditor();var e;(e=t).emit("auth",s("username"),s("password")),e.on("reject",()=>{u.alert("Wrong credentials!")}),function(t){const e=CloudCmd.Edit.getElement();DOM.Events.addOnce("contextmenu",e,h),t.on("save",t=>{DOM.setCurrentSize(n.size(t))})}(t),C(!1)},t.exports.show=async t=>{if(C())return;const e={...p,...t};CloudCmd.config("showFileName")&&(e.title=l.name),a.show.load(),CloudCmd.Edit.getEditor().setOption("keyMap","default");const[o,n]=await l.getData();if(o)return a.hide(),CloudCmd.Edit;const{path:r}=l,i=function(){const{name:t,isDir:e}=l;return e?t+".json":t}();return function(t){f=`Do you want to save changes to ${t}?`}(i),CloudCmd.Edit.getEditor().setValueFirst(r,n).setModeForPath(i).enableKey(),CloudCmd.Edit.show(e),CloudCmd.Edit},t.exports.hide=m,t.exports.isChanged=g}});
//# sourceMappingURL=edit-file.js.map