UNPKG

zcloudcmd

Version:

### [Main][MainURL] [Blog][BlogURL] Live([Heroku][HerokuURL], [Now][NowURL])

2 lines 24.9 kB
!function(e){function t(t){for(var n,a,u=t[0],l=t[1],s=t[2],f=0,d=[];f<u.length;f++)a=u[f],o[a]&&d.push(o[a][0]),o[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(c&&c(t);d.length;)d.shift()();return i.push.apply(i,s||[]),r()}function r(){for(var e,t=0;t<i.length;t++){for(var r=i[t],n=!0,u=1;u<r.length;u++){var l=r[u];0!==o[l]&&(n=!1)}n&&(i.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={18:0},i=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="/dist/";var u=window.webpackJsonp=window.webpackJsonp||[],l=u.push.bind(u);u.push=t,u=u.slice();for(var s=0;s<u.length;s++)t(u[s]);var c=l;i.push([38,0]),r()}({115:function(e,t){},139:function(e,t){},140:function(e,t){},141:function(e,t){},25:function(e,t,r){"use strict";function n(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void r(e)}u.done?t(l):Promise.resolve(l).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function u(e){n(a,o,i,u,l,"next",e)}function l(e){n(a,o,i,u,l,"throw",e)}u(void 0)})}}function i(e){return a.apply(this,arguments)}function a(){return(a=o(function*(e){if(navigator.serviceWorker){var t="https:"===location.protocol,r="localhost"===location.hostname;if(t||r)return navigator.serviceWorker.register("".concat(e,"/sw.js"))}})).apply(this,arguments)}function u(){return(u=o(function*(e){var t=yield i(e);t&&t.unregister(e)})).apply(this,arguments)}e.exports.registerSW=i,e.exports.unregisterSW=function(e){return u.apply(this,arguments)},e.exports.listenSW=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];e&&e.addEventListener.apply(e,r)}},35:function(e,t,r){"use strict";e.exports={BACKSPACE:8,TAB:9,ENTER:13,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,ZERO:48,SEMICOLON:52,COLON:54,A:65,C:67,D:68,G:71,J:74,K:75,M:77,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,X:88,Z:90,INSERT_MAC:96,ASTERISK:106,PLUS:107,MINUS:109,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,EQUAL:187,HYPHEN:189,DOT:190,SLASH:191,TRA:192,BACKSLASH:220,BRACKET_CLOSE:221}},38:function(e,t,r){"use strict";function n(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void r(e)}u.done?t(l):Promise.resolve(l).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function u(e){n(a,o,i,u,l,"next",e)}function l(e){n(a,o,i,u,l,"throw",e)}u(void 0)})}}r(115),r(139),r(140),r(141);var i=r(6).promisify,a=r(7),u=r(4),l=r(25),s=l.registerSW,c=l.listenSW;function f(e){return e?e.indexOf("/")?"/".concat(e):e:""}window.Emitify=r(16),e.exports=window.CloudCmd=function(e){window.Promise=window.Promise||r(42),window.Util=r(9),window.CloudFunc=r(5);var t=r(12);window.DOM=t,window.CloudCmd=r(62),function(e){p.apply(this,arguments)}(e),r(65),r(68),r(79);var n=f(e.prefix);window.CloudCmd.init(n,e)};var d=a(function(){var e=o(function*(e){var t=window.DOM,r=f(e.prefix),n=i(u.js);yield n("".concat(r,"/dist/cloudcmd.common.js")),yield n("".concat(r,"/dist/cloudcmd.js")),console.log("cloudcmd: sw: updated"),t.Events.removeAll(),window.CloudCmd(e)});return function(t){return e.apply(this,arguments)}}());function p(){return(p=o(function*(e){var t=e.prefix,r=yield s(t);c(r,"updatefound",d(e))})).apply(this,arguments)}},62:function(e,t,r){"use strict";function n(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void r(e)}u.done?t(l):Promise.resolve(l).then(n,o)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var i=r(16),a=r(30),u=r(11),l=r(0),s=r(4),c=r(32),f=!1,d=r(3),p=r(25).unregisterSW,v=r(18),h=r(1),C=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(){return e.apply(void 0,r)}},m=function(){},g=function(e){return e.replace(/.js$/,"")},D=r(5),y=D.apiURL,O=D.formatMsg,w=D.buildFromJSON,M=r(63);function b(e){var t,r;i.call(this);var a=this,D=e.CurrentInfo,b=e.Storage,E=e.Files;this.log=function(){var e;f&&(e=console).log.apply(e,arguments)},this.prefix="",this.prefixSocket="",this.prefixURL="",this.DIRCLIENT="/dist/",this.DIRCLIENT_MODULES=this.DIRCLIENT+"modules/",this.MIN_ONE_PANEL_WIDTH=1155,this.HOST=location.origin||location.protocol+"//"+location.host;var S="Cloud Commander";function x(e){var t=a.prefix+"/dist/cloudcmd.common.css";s.css(t,e)}function P(e){var t=a.prefix+"/plugins.js";s.js(t,e)}function k(e){l.if(a.Key,function(){t=new a.Key,a.Key=t,t.bind()},function(e){M({path:"key.js",func:e})}),E.get("modules",function(t,r){var n=d.show.load,o={edit:n,menu:n};r||(r=[]),r.local.forEach(function(e){M({name:null,path:e,dobefore:o[e]})}),e()})}function F(t){var n=e.getFiles();a.on("current-file",e.updateCurrentInfo),n&&e.setCurrentFile(n[0],{history:!location.hash});var o=e.getCurrentDirPath();if((r=a.Listeners).init(),function(){var e=["left"];return a.config("oneFilePanel")?e:[].concat(e,["right"])}().forEach(r.setOnPanel),r.initKeysPanel(),!a.config("dirStorage"))return t();b.get(o,function(r,n){var i,a,u;n||(i=e.getCurrentDirPath(),a=D.files||[],u=a.filter(function(t){return".."!==e.getCurrentName(t)}).map(function(t){var r=e.getCurrentName(t),n=e.getCurrentSize(t),o=e.getCurrentOwner(t),i=e.getCurrentMode(t),a=e.getCurrentDate(t);return{name:r,size:n,mode:i,owner:o,date:a}}),n={path:i,files:u},b.set(o,n)),t()})}function N(t,n,i,u){var s=i.history,c=i.noCurrent;E.get(["file","path","link","pathLink"],function(f,d,p,v,h){var C=e.Dialog,m=n||e.getPanel(),g=a.prefix,y=D.dir,O=D.name;if(f)return C.alert(S,f.responseText);for(var M=m.childNodes.length;M--;)m.removeChild(m.lastChild);if(m.innerHTML=w({sort:i.sort,order:i.order,data:t,id:m.id,prefix:g,template:{file:d,path:p,pathLink:h,link:v}}),r.setOnPanel(m),!c){var b;if(".."===O&&"/"!==y&&(b=e.getCurrentByName(y)),!b)b=o(e.getFiles(m),1)[0];e.setCurrentFile(b,{history:s}),a.emit("active-dir",D.dirPath)}l(u)})}this.TITLE=S,this.sort={left:"name",right:"name"},this.order={left:"asc",right:"asc"},this.loadDir=function(t,r){var n,o,i=t,s=i.isRefresh,c=i.panel,f=i.history,p=i.noCurrent,h=i.currentName;p||c&&c!==D.panel&&(e.changePanel(),n=!0),(n||s||!f)&&(o="top"),d.show.load(o,c),function(t,r,n,o){var i=function(i,s){var c=e.RESTful,f=r.currentName||D.name,d=v.parse(s),p=r.refresh,h=r,C=h.noCurrent;if(!p&&s)return N(d,n,r,o);var m=e.getPanelPosition(n),g=a.sort[m],y=a.order[m],O=u("?sort={{ sort }}&order={{ order }}",{sort:g,order:y});c.read(t+O,"json",function(i,u){i||(r.sort=g,r.order=y,N(u,n,r,function(){p&&!C&&e.setCurrentByName(f),l(o)}),a.config("dirStorage")&&b.set(t,u))})};r||(r={});if(a.log('reading dir: "'+t+'";'),!a.config("dirStorage"))return i();b.get(t,i)}(i.path,{refresh:s,history:f,noCurrent:p,currentName:h},c,r)},this.init=function(e,t){var r=C(l.series,[k,F,P,x,l.with(a.route,location.hash)],m);a.prefix=e,a.prefixURL="".concat(e).concat(y),a.prefixSocket=t.prefixSocket,a.config=function(e){return t[e]},a.config.if=h(function(e,r,n){return t[e]&&r(n)}),a._config=function(e,r){"password"!==e&&(t[e]=r)},t.oneFilePanel&&(a.MIN_ONE_PANEL_WIDTH=1/0),l.if(document.body.scrollIntoViewIfNeeded,r,function(t){var r=e+a.DIRCLIENT_MODULES+"polyfill.js";s.js(r,t)})},this.route=function(t){var r=t.split("/");if(t){var n=o(r,1)[0],i=g(c(n.slice(1))),u=r[1],l=e.getCurrentByName(u);if(!u||l)e.setCurrentFile(l),a.execFromModule(i,"show");else{var s=O("set current file",u,"error");a.log(s)}}},this.logOut=function(){var t=a.prefix+"/logout",r=a.prefix;e.Storage.clear(),p(r),e.load.ajax({url:t,error:function(){return document.location.reload()}})},this.execFromModule=function(){var e,t=(e=function*(e,t){yield a[e]();for(var r=a[e][t],n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];r.apply(void 0,o)},function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function u(e){n(a,o,i,u,l,"next",e)}function l(e){n(a,o,i,u,l,"throw",e)}u(void 0)})});return function(e,r){return t.apply(this,arguments)}}(),this.refresh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;r||"function"!=typeof t||(r=t,t={});var n=t.panel||D.panel,o=e.getCurrentDirPath(n),i=!!t&&t.noCurrent,u=t.currentName;a.loadDir({path:o,isRefresh:!0,history:!1,panel:n,noCurrent:i,currentName:u},r)},this.goToParentDir=function(){var t=D.dir,r=D.dirPath,n=D.parentDirPath;if(r!==n){var i=n;a.loadDir({path:i},function(){var r=D.panel,n=e.getCurrentByName(t),i=o(e.getFiles(r),1)[0];e.setCurrentFile(n||i,{history:history})})}}}a(b,i),e.exports=new b(DOM),s.addErrorListener(function(e,t){var r="file ".concat(t," could not be loaded");d.show.error(r)})},63:function(e,t,r){"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function i(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void r(e)}u.done?t(l):Promise.resolve(l).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function u(e){i(a,n,o,u,l,"next",e)}function l(e){i(a,n,o,u,l,"throw",e)}u(void 0)})}}var u=r(0),l=r(20),s=(0,r(6).promisify)(r(4).js),c=r(32);e.exports=function(e){if(e){var t=e.path,r=e.name||t&&c(t).replace(/.js$/,""),i=e.dobefore;CloudCmd[r]||(CloudCmd[r]=function(){u(i);var e=CloudCmd.prefix+CloudCmd.DIRCLIENT_MODULES+t+".js";return s(e).then(a(function*(){var e=function(){var e=a(function*(e){return e&&e()});return function(t){return e.apply(this,arguments)}}(),t=CloudCmd[r];return o(e,t),CloudCmd[r]=e,CloudCmd.log("init",r),yield t.init(),e}))},CloudCmd[r].show=a(function*(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];CloudCmd.log("show",r,t);var i=CloudCmd[r],a=n(yield l(i),2),u=a[0],s=a[1];if(u)return console.error(u);s.show.apply(s,t)}))}}},65:function(e,t,r){"use strict";function n(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var i=r(0),a=r(8),u=r(1),l=r(33),s=r(66),c=u(r(67)),f=r(34),d=r(5).FS,p=RegExp(String.fromCharCode(160),"g"),v=" ";e.exports.init=function(){var e,t,r,o;e=DOM.getFM(),g.addOnce("contextmenu",e,function(e){CloudCmd.Menu.show({x:e.clientX,y:e.clientY})}),g.addContextMenu(e,function(e){CloudCmd.Menu.ENABLED||e.preventDefault()}),t=DOM.getByClassAll("panel"),r=function(e){var t=e.dataTransfer,r=t.files,o=t.items,i=r.length;if(e.preventDefault(),i&&(!o||!o.length||!o[0].webkitGetAsEntry))return f(r);var a=n(o).filter(function(e){return"file"===e.kind});if(a.length)return DOM.uploadDirectory(a);var u=CloudCmd,l=u.Operation,s=e.shiftKey?"move":"copy";return l.show(s)},o=function(e){var t=e.dataTransfer,r=t.effectAllowed;/move|linkMove/.test(r)?t.dropEffect="move":t.dropEffect="copy",e.preventDefault()},g.add("dragenter",function(){n(t).forEach(function(e){e.classList.add("selected-panel")})}),g.add(["dragleave","drop"],function(){n(t).forEach(function(e){e.classList.remove("selected-panel")})}),n(t).forEach(function(e){g.add("dragover",e,o).add("drop",e,r)}),DOM.Events.add(["unload","beforeunload"],function(e){var t=CloudCmd,r=t.Key,n=r&&r.isBind();if(!n)return e.preventDefault(),"Please make sure that you saved all work."}),g.add("popstate",function(e){var t=e.state,r=(t||"").replace(d,"");if(!r)return CloudCmd.route(location.hash);CloudCmd.loadDir({path:r,history:!1})}),g.add("resize",function(){var e=window.innerWidth<CloudCmd.MIN_ONE_PANEL_WIDTH;if(e){var t=m.panel,r=!t;if(!r){var n=t.getAttribute("data-name"),o="js-left"===n;o||DOM.changePanel()}}}),DOM.Files.get("config",function(e,t){var r=t&&t.packer;h=DOM.getPackerExt(r)}),function(){var e=DOM.getFM(),t=function(e){return e.dataset},r=function(e){return/^js-(left|right)$/.test(e.dataset.name)};g.addClick(e,function(e){var n=e.target,o=n.parentElement;if("js-fm-header"===o.dataset.name){var i=(n.dataset.name||"").replace("js-","");if(/^(name|size|date)$/.test(i)){var a=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t)return r;return e(t.parentElement,r.concat(t))}(n).filter(t).filter(r).pop();CloudCmd.sortPanel(i,a)}}})}()},CloudCmd.Listeners=e.exports;var h,C=u(function(e,t){e.forEach(function(e){e(t)})}),m=DOM.CurrentInfo,g=DOM.Events,D={mousedown:i.with(y,function(e){var t={alt:e.altKey,ctrl:e.ctrlKey,meta:e.metaKey,shift:e.shiftKey},r=O(e.target),n=m.name;DOM.setCurrentFile(r);var i=m.name,a=[];t.shift?a=function(e,t){var r=DOM.getAllFiles(),n=DOM.getFilenames(r),o=c(n),i=o(e),a=o(t);return s(i,a,r)}(n,i):a.push(m.element);0===e.button&&function(e,t){var r=/Mac/.test(window.navigator.platform);if(!e)throw Error("key should not be undefined!");var n=o(t,1)[0];if(r&&e.meta||e.ctrl)return DOM.toggleSelectedFile(n);if(e.shift)t.forEach(DOM.selectFile)}(t,a)}),click:C([function(e){e.ctrlKey||e.preventDefault();t=e.target,r=m.panel,n=DOM.getByDataName("js-files",r),function(e){for(;"UL"!==e.tagName;)e=e.parentElement;return e}(t)!==n&&DOM.changePanel();var t,r,n},function(e){var t=/Mac/.test(window.navigator.platform),r=e.shiftKey,n=e.metaKey,o=e.ctrlKey;r||t&&n||o||DOM.unselectFiles()}]),dragstart:i.with(y,function(e){var t=CloudCmd.prefixURL,r=O(e.target),n=m.isDir,o=DOM.getCurrentLink(r),i=DOM.getCurrentName(r);n&&(i+=h,(o=document.createElement("a")).textContent=i,o.href=t+"/pack"+m.path+h);e.dataTransfer.setData("DownloadURL","application/octet-stream:"+i+":"+o)}),dblclick:i.with(y,function(e){var t=O(e.target),r=DOM.isCurrentIsDir(t),n=DOM.getCurrentPath(t);r?(CloudCmd.loadDir({path:"/"===n?"/":n+"/"}),e.preventDefault()):(CloudCmd.View.show(),e.preventDefault())}),touchstart:i.with(y,function(e){var t=O(e.target);if(!DOM.isCurrentIsDir(t))return;if(!DOM.isCurrentFile(t))return;CloudCmd.loadDir({path:DOM.getCurrentPath(t)})})};e.exports.initKeysPanel=function(){var e=DOM.getById("js-keyspanel");e&&g.addClick(e,function(e){var t=e.target.id,r=function(e){return CloudCmd.Operation.show.bind(null,e)},n={f1:CloudCmd.Help.show,f2:DOM.renameCurrent,f3:CloudCmd.View.show,f4:CloudCmd.EditFile.show,f5:r("copy"),f6:r("move"),f7:DOM.promptNewDir,f8:r("delete"),f9:CloudCmd.Menu.show,f10:CloudCmd.Config.show,"~":CloudCmd.Konsole.show,"shift~":CloudCmd.Terminal.show,contact:CloudCmd.Contact.show};i(n[t])})};function y(e,t){"UL"!==t.target.tagName&&e(t)}function O(e){if(!e)return e;for(;"LI"!==e.tagName;)e=e.parentElement;return e}e.exports.setOnPanel=function(e){var t=function(e){return a.string(e)?DOM.getByDataName("js-"+e):e}(e),r=DOM.getByDataName("js-files",t),n=DOM.getByDataName("js-path",t);g.addClick(n,function(e){return function(e,t){t.preventDefault();var r=t.target,n=r.getAttribute("data-name"),o=function(e){var t=m.panel;if(!t)return!0;var r=e.getAttribute("data-name"),n=t.getAttribute("data-name");return r!==n}(e);if("js-copy-path"===n)return i=r,void l.writeText(i.parentElement.title).then(CloudCmd.log).catch(CloudCmd.log);var i;if("js-refresh"===n)return CloudCmd.refresh({panel:e,noCurrent:o});if("js-path-link"!==n)return;var a=function(e){var t=CloudCmd.HOST,r=CloudCmd.prefix,n=RegExp("^"+r+d);return decodeURI(e).replace(t,"").replace(n,"").replace("%%","%25%").replace(p,v)||"/"}(r.href);CloudCmd.loadDir({path:a,isRefresh:!1,panel:o?e:m.panel})}.bind(null,e)}(t)),g.add(r,D)}},66:function(e,t,r){"use strict";e.exports=function(e,t,r){return e<t?r.slice(e,t+1):e>t?r.slice(t,e+1):[r[e]]}},67:function(e,t,r){"use strict";e.exports=function(e,t){var r=e.indexOf(t);return~r?r:0}},68:function(e,t,r){"use strict";var n=DOM.CurrentInfo,o=r(0),i=r(33),a=r(7),u=r(15),l=r(31),s=r(35),c=r(69),f=r(78),d=r(10)();d([]),v.prototype=s,CloudCmd.Key=v;var p=CloudCmd.loadDir;function v(){var e,t=this;function r(e){return e.key?e.key:(t=e.keyIdentifier,r=t.substring(2),n=parseInt(r,16),String.fromCharCode(n));var t,r,n}function v(e){var u=e.keyCode,v=e.altKey,h=e.ctrlKey,C=e.shiftKey,m=e.metaKey,g=u>=s.ZERO&&u<=s.Z,D=/Numpad/.test(e.code),y=r(e),O=~[".","_","-","+","="].indexOf(y);if(O||(O=function(e,t){switch(t){case s.DOT:return".";case s.HYPHEN:return e?"_":"-";case s.EQUAL:return e?"+":"="}}(C,u))&&(y=O),t.isBind()){var w=CloudCmd.config("vim");if(!w&&!D&&!v&&!h&&!m&&(g||O))return f(y,d);d([]),function(e){var r,u,c,f,d=n.element,v=n.name,h=n.panel,C=n.path,m=n.isDir,g=CloudCmd.Operation,D=e.keyCode,y=e.altKey,O=e.shiftKey,w=e.ctrlKey,M=e.metaKey,b=w||M;d&&(c=d.previousSibling,f=d.nextSibling);switch(D){case t.TAB:DOM.changePanel(),e.preventDefault();break;case t.INSERT:case t.INSERT_MAC:DOM.toggleSelectedFile(d).setCurrentFile(f);break;case t.DELETE:O?g.show("delete:silent"):g.show("delete");break;case t.ASTERISK:DOM.toggleAllSelectedFiles(d);break;case t.PLUS:DOM.expandSelection(),e.preventDefault();break;case t.MINUS:DOM.shrinkSelection(),e.preventDefault();break;case t.F1:CloudCmd.Help.show(),e.preventDefault();break;case t.F2:DOM.renameCurrent(d);break;case t.F3:n.isDir?p({path:C}):O?CloudCmd.Markdown.show(C):b?CloudCmd.sortPanel("name"):CloudCmd.View.show(),e.preventDefault();break;case t.F4:O?CloudCmd.EditFileVim.show():CloudCmd.EditFile.show(),e.preventDefault();break;case t.F5:b?CloudCmd.sortPanel("date"):y?g.show("pack"):g.show("copy"),e.preventDefault();break;case t.F6:b?CloudCmd.sortPanel("size"):g.show("move"),e.preventDefault();break;case t.F7:O?DOM.promptNewFile():DOM.promptNewDir(),e.preventDefault();break;case t.F8:g.show("delete"),e.preventDefault();break;case t.F9:y?g.show("extract"):CloudCmd.Menu.show(),e.preventDefault();break;case t.F10:CloudCmd.Config.show(),e.preventDefault();break;case t.TRA:if(e.preventDefault(),O)return CloudCmd.Terminal.show();CloudCmd.Konsole.show();break;case s.BRACKET_CLOSE:CloudCmd.Konsole.show(),e.preventDefault();break;case t.SPACE:u=!m||".."===v||DOM.isSelected(d),o.if(u,function(){DOM.toggleSelectedFile(d)},function(e){DOM.loadCurrentSize(e,d)}),e.preventDefault();break;case t.U:b&&(DOM.swapPanels(),e.preventDefault());break;case t.UP:O&&DOM.toggleSelectedFile(d),DOM.setCurrentFile(c),e.preventDefault();break;case t.DOWN:O&&DOM.toggleSelectedFile(d),DOM.setCurrentFile(f),e.preventDefault();break;case t.LEFT:if(!y)return;e.preventDefault(),"js-right"===n.panel.getAttribute("data-name")&&DOM.duplicatePanel();break;case t.RIGHT:if(!y)return;e.preventDefault(),"js-left"===n.panel.getAttribute("data-name")&&DOM.duplicatePanel();break;case t.HOME:DOM.setCurrentFile(n.first),e.preventDefault();break;case t.END:DOM.setCurrentFile(n.last),e.preventDefault();break;case t.PAGE_DOWN:for(DOM.scrollByPages(h,1),r=0;r<30&&d.nextSibling;r++)d=d.nextSibling;DOM.setCurrentFile(d),e.preventDefault();break;case t.PAGE_UP:for(DOM.scrollByPages(h,-1),r=0;r<30&&d.previousSibling;r++)d=d.previousSibling;DOM.setCurrentFile(d),e.preventDefault();break;case t.ENTER:n.isDir?p({path:C}):CloudCmd.View.show();break;case t.BACKSPACE:CloudCmd.goToParentDir(),e.preventDefault();break;case t.BACKSLASH:b&&p({path:"/"});break;case t.A:b&&(DOM.selectAllFiles(),e.preventDefault());break;case t.G:y&&(DOM.goToDirectory(),e.preventDefault());break;case t.M:b&&(O?CloudCmd.EditNamesVim.show():CloudCmd.EditNames.show(),e.preventDefault());break;case t.P:if(!b)return;e.preventDefault(),i.writeText(n.dirPath).catch(CloudCmd.log);break;case t.R:b&&(CloudCmd.log("reloading page...\n"),CloudCmd.refresh(),e.preventDefault());break;case t.C:b&&l.copy();break;case t.X:b&&l.cut();break;case t.V:b&&l.paste();break;case t.Z:b&&l.clear();break;case t.D:b&&(CloudCmd.log("clearing storage..."),DOM.Storage.clear(a(CloudCmd.log,"storage cleared")),e.preventDefault())}}(e),u>=s.F1&&u<=s.F10||w&&c(y,e)}}this.isBind=function(){return e},this.setBind=function(){e=!0},this.unsetBind=function(){e=!1},this.bind=function(){u.addKey(v),e=!0}}},69:function(e,t,r){"use strict";var n=r(35),o=DOM.CurrentInfo,i=DOM.Dialog,a=r(10),u=a(""),l=a(!1),s=r(70),c=s.find,f=s.findNext,d=s.findPrevious,p=function(){l(!1)},v=function(){u("")},h=function(e){return e.split("").slice(1).join("")};function C(e,t){var r=t.max,n=t.current,o=t.prevStore,i="d"===o[0];i&&(l(!0),o=h(o));var a,u=r||((a=o)?"g"===a?1:parseInt(a):1);isNaN(u)||(!function(e){var t=e.n,r=e.current,n=e.visual,o=e.sibling,i=n?m:DOM.unselectFile;i(r);for(var a="".concat(o,"Sibling"),u=0;u<t;u++){var l=r[a];if(!l)break;i(r=l)}DOM.setCurrentFile(r)}({n:u,current:n,sibling:e,visual:l()}),i&&CloudCmd.Operation.show("delete"))}function m(e){".."!==DOM.getCurrentName(e)&&DOM.selectFile(e)}e.exports=function(e,t){var r=o.element,a=t.keyCode,s=u(),h=u(s.concat(e));return a===n.ENTER?v():a===n.ESC?(DOM.unselectFiles(),l(!1),v()):"j"===e?(C("next",{prevStore:s,current:r}),v()):"k"===e?(C("previous",{prevStore:s,current:r}),v()):/gg/.test(h)?(C("previous",{current:r,prevStore:s,max:1/0}),v()):"d"!==e||!l()&&"d"!==s?"G"===e?(C("next",{current:r,prevStore:s,max:1/0}),v()):"y"===e?l()?(DOM.Buffer.copy(),p(),DOM.unselectFiles(),v()):v():/^p$/i.test(e)?(DOM.Buffer.paste(),v()):/^v$/i.test(e)?(DOM.toggleSelectedFile(r),l(!l()),v()):"/"===e?(t.preventDefault(),i.prompt("Cloud Commander","Find","",{cancel:!1}).then(c),v()):"n"===e?(f(),v()):"N"===e?(d(),v()):void 0:(CloudCmd.Operation.show("delete"),p(),v())},e.exports.selectFile=m},70:function(e,t,r){"use strict";var n=r(10),o=r(71),i=DOM.CurrentInfo,a=n([]),u=n(0);function l(e,t){return e===t-1?0:++e}function s(e,t){return e?--e:t-1}e.exports.find=function(e){var t=i.files.map(DOM.getCurrentName),r=o(e,t);a(r),u(0),DOM.setCurrentByName(r[0])},e.exports.findNext=function(){var e=a(),t=l(u(),e.length);u(t),DOM.setCurrentByName(e[u()])},e.exports.findPrevious=function(){var e=a(),t=s(u(),e.length);u(t),DOM.setCurrentByName(e[t])},e.exports._next=l,e.exports._previous=s},78:function(e,t,r){"use strict";var n=DOM.CurrentInfo,o=r(9).escapeRegExp;e.exports=function(e,t){for(var r,i=0,a=!1,u=0,l=o(e),s=new RegExp("^"+l+".*$","i"),c=n.files,f=t(),d=f.length;u<d&&e===f[u];)u++;u||t([]);var p=i=u;t(t().concat(e));var v;DOM.getFilenames(c).filter(function(e){return s.test(e)}).filter((v=function(e){return".."===e},function(e){return!v(e)})).some(function(e){var t=DOM.getCurrentByName(e);if(!i)return a=!0,DOM.setCurrentFile(t),!0;p===i&&(r=t),--i}),a||(DOM.setCurrentFile(r),t([e]))}},79:function(e,t,r){"use strict";var n=r(12),o=n.CurrentInfo,i=CloudCmd,a=i.sort,u=i.order,l=n.getPanelPosition(),s=a[l],c=n.getPanel;CloudCmd.sortPanel=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c(),r=t.dataset.name.replace("js-","");e!==s?u[r]="asc":"asc"===u[r]?u[r]="desc":u[r]="asc",s=a[r]=e;var n=r!==o.panelPosition;CloudCmd.refresh({panel:t,noCurrent:n})}}}); //# sourceMappingURL=cloudcmd.js.map