!function(e){function t(t){for(var o,d,l=t[0],u=t[1],s=t[2],a=0,f=[];a<l.length;a++)d=l[a],Object.prototype.hasOwnProperty.call(r,d)&&r[d]&&f.push(r[d][0]),r[d]=0;for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&(e[o]=u[o]);for(c&&c(t);f.length;)f.shift()();return i.push.apply(i,s||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],o=!0,l=1;l<n.length;l++){var u=n[l];0!==r[u]&&(o=!1)}o&&(i.splice(t--,1),e=d(d.s=n[0]))}return e}var o={},r={8:0},i=[];function d(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,d),n.l=!0,n.exports}d.m=e,d.c=o,d.d=function(e,t,n){d.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.t=function(e,t){if(1&t&&(e=d(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(d.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)d.d(n,o,function(t){return e[t]}.bind(null,o));return n},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,"a",t),t},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],u=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var c=u;i.push([91,0]),n()}({91:function(e,t,n){"use strict";CloudCmd.EditNames=t;const o=n(0),r=n(5),i=n(23),d=n(92),l=Promise.reject.bind(Promise),u=DOM.CurrentInfo,{Dialog:s}=DOM,c=o((function(e,t,n){if(404===n.status)return n.text().then(l);const o=e[t];CloudCmd.refresh({currentName:o})})),a=o((function(e,t,n,o){const r=function(e,t){return"/"===e?t:e+t}(o,e),{prefix:i}=CloudCmd;return fetch(i+"/rename",{method:"put",credentials:"include",body:JSON.stringify({from:t,to:n,dir:r})})}));let f;const p={beforeClose:async()=>{r.ifExist(f,"hide"),DOM.Events.remove("keydown",C),await b()}};async function C(e){const t=e.ctrlKey,n=e.metaKey,o=t||n,{Key:r}=CloudCmd;if(o&&e.keyCode===r.S)y();else if(o&&e.keyCode===r.P){const[,e]=await s.prompt("Apply pattern:","[n][e]");e&&function(e){const t=d(e,m());CloudCmd.Edit.getEditor().setValue(t.join("\n"))}(e)}}function m(){return DOM.getFilenames(DOM.getActiveFiles())}function y(){CloudCmd.Edit.hide()}function h(){const e=u.dirPath,t=m(),n=t.indexOf(u.name),o=CloudCmd.Edit.getEditor().getValue().split("\n"),r=CloudCmd.config("root");Promise.resolve(r).then(a(e,t,o)).then(c(o,n)).catch(alert)}function g(e){const t={x:e.clientX,y:e.clientY};if(e.preventDefault(),f)return;const n=CloudCmd.Edit.getEditor(),o={beforeShow:e=>{e.x-=18,e.y-=27},afterClick:()=>{n.focus()}},r={"Save           Ctrl+S":()=>{h(),y()},"Go To Line     Ctrl+G":()=>{n.goToLine()},"Cut            Ctrl+X":()=>{n.cutToClipboard()},"Copy           Ctrl+C":()=>{n.copyToClipboard()},"Paste          Ctrl+V":()=>{n.pasteFromClipboard()},"Delete         Del":()=>{n.remove("right")},"Select All     Ctrl+A":()=>{n.selectAll()},"Close          Esc":y},d=CloudCmd.Edit.getElement();f=i(d,o,r),f.addContextMenuListener(),f.show(t.x,t.y)}async function b(){if(!CloudCmd.Edit.getEditor().isChanged())return;const[,e]=await s.confirm("Apply new names?");e&&h()}e.exports.init=async()=>{await CloudCmd.Edit(),function(){const e=CloudCmd.Edit.getElement();DOM.Events.addOnce("contextmenu",e,g)}()},e.exports.show=e=>{const t=m().join("\n"),n={...p,...e};return".."===u.name&&1===t.length?s.alert.noFiles():(DOM.Events.addKey(C),CloudCmd.Edit.getEditor().setValueFirst("edit-names",t).setMode().setOption("keyMap","default").disableKey(),CloudCmd.Edit.show(n),CloudCmd.Edit)},e.exports.hide=y,e.exports.isChanged=b}});
//# sourceMappingURL=edit-names.js.map