cloudcmd 19.1.21 → 19.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/ChangeLog +22 -0
  2. package/HELP.md +3 -1
  3. package/README.md +1 -1
  4. package/bin/{cloudcmd.mjs → cloudcmd.js} +5 -5
  5. package/common/callbackify.js +1 -3
  6. package/common/datetime.js +2 -4
  7. package/common/try-to-promise-all.js +2 -3
  8. package/dist/cloudcmd.common.js +2 -2
  9. package/dist/cloudcmd.common.js.map +1 -1
  10. package/dist/cloudcmd.js +1 -1
  11. package/dist/cloudcmd.js.map +1 -1
  12. package/dist/modules/cloud.js +1 -1
  13. package/dist/modules/cloud.js.map +1 -1
  14. package/dist/modules/command-line.js +1 -1
  15. package/dist/modules/command-line.js.map +1 -1
  16. package/dist/modules/config.js +1 -1
  17. package/dist/modules/config.js.map +1 -1
  18. package/dist/modules/contact.js +1 -1
  19. package/dist/modules/contact.js.map +1 -1
  20. package/dist/modules/edit-file-vim.js +1 -1
  21. package/dist/modules/edit-file-vim.js.map +1 -1
  22. package/dist/modules/edit-file.js +1 -1
  23. package/dist/modules/edit-file.js.map +1 -1
  24. package/dist/modules/edit-names-vim.js +1 -1
  25. package/dist/modules/edit-names-vim.js.map +1 -1
  26. package/dist/modules/edit-names.js +1 -1
  27. package/dist/modules/edit-names.js.map +1 -1
  28. package/dist/modules/edit.js +1 -1
  29. package/dist/modules/edit.js.map +1 -1
  30. package/dist/modules/help.js +1 -1
  31. package/dist/modules/help.js.map +1 -1
  32. package/dist/modules/konsole.js +1 -1
  33. package/dist/modules/konsole.js.map +1 -1
  34. package/dist/modules/markdown.js +1 -1
  35. package/dist/modules/markdown.js.map +1 -1
  36. package/dist/modules/menu.js +1 -1
  37. package/dist/modules/menu.js.map +1 -1
  38. package/dist/modules/operation.js +1 -1
  39. package/dist/modules/operation.js.map +1 -1
  40. package/dist/modules/polyfill.js +1 -1
  41. package/dist/modules/polyfill.js.map +1 -1
  42. package/dist/modules/terminal-run.js +1 -1
  43. package/dist/modules/terminal-run.js.map +1 -1
  44. package/dist/modules/terminal.js +1 -1
  45. package/dist/modules/terminal.js.map +1 -1
  46. package/dist/modules/upload.js +1 -1
  47. package/dist/modules/upload.js.map +1 -1
  48. package/dist/modules/user-menu.js +1 -1
  49. package/dist/modules/user-menu.js.map +1 -1
  50. package/dist/modules/view.js +1 -1
  51. package/dist/modules/view.js.map +1 -1
  52. package/dist/sw.js +1 -1
  53. package/dist/sw.js.map +1 -1
  54. package/dist-dev/cloudcmd.common.js +335 -366
  55. package/dist-dev/cloudcmd.js +1 -1
  56. package/dist-dev/modules/cloud.js +1 -1
  57. package/dist-dev/modules/command-line.js +1 -1
  58. package/dist-dev/modules/config.js +1 -1
  59. package/dist-dev/modules/edit.js +1 -1
  60. package/dist-dev/modules/konsole.js +1 -1
  61. package/dist-dev/modules/menu.js +1 -1
  62. package/dist-dev/modules/operation.js +1 -1
  63. package/dist-dev/modules/upload.js +1 -1
  64. package/dist-dev/modules/user-menu.js +1 -1
  65. package/dist-dev/modules/view.js +1 -1
  66. package/dist-dev/sw.js +6 -6
  67. package/package.json +17 -16
  68. package/server/auth.js +4 -5
  69. package/server/{cloudcmd.mjs → cloudcmd.js} +7 -7
  70. package/server/{config.mjs → config.js} +16 -24
  71. package/server/depstore.js +1 -3
  72. package/server/distribute/{export.mjs → export.js} +1 -1
  73. package/server/distribute/{import.mjs → import.js} +2 -2
  74. package/server/exit.js +2 -3
  75. package/server/markdown/index.js +12 -12
  76. package/server/markdown/worker.js +3 -3
  77. package/server/prefixer.js +1 -3
  78. package/server/repl.js +4 -6
  79. package/server/rest/info.js +7 -6
  80. package/server/root.js +2 -4
  81. package/server/{route.mjs → route.js} +2 -2
  82. package/server/{server.mjs → server.js} +1 -1
  83. package/server/show-config.js +3 -5
  84. package/server/template.js +6 -4
  85. package/server/terminal.js +4 -3
  86. package/server/{user-menu.mjs → user-menu.js} +19 -8
  87. package/server/{validate.mjs → validate.js} +2 -2
  88. package/static/user-menu.js +5 -5
  89. /package/common/{cloudfunc.mjs → cloudfunc.js} +0 -0
  90. /package/common/{entity.mjs → entity.js} +0 -0
  91. /package/common/{util.mjs → util.js} +0 -0
  92. /package/rules/{split-autoglobals-with-tape.mjs → split-autoglobals-with-tape.js} +0 -0
  93. /package/server/{columns.mjs → columns.js} +0 -0
  94. /package/server/distribute/{log.mjs → log.js} +0 -0
  95. /package/server/{env.mjs → env.js} +0 -0
  96. /package/server/{modulas.mjs → modulas.js} +0 -0
  97. /package/server/rest/{index.mjs → index.js} +0 -0
  98. /package/server/{theme.mjs → theme.js} +0 -0
@@ -8,91 +8,91 @@
8
8
  */
9
9
  (globalThis["webpackChunkcloudcmd"] = globalThis["webpackChunkcloudcmd"] || []).push([["cloudcmd.common"],{
10
10
 
11
- /***/ "./client/client.mjs"
12
- /*!***************************!*\
13
- !*** ./client/client.mjs ***!
14
- \***************************/
11
+ /***/ "./client/client.js"
12
+ /*!**************************!*\
13
+ !*** ./client/client.js ***!
14
+ \**************************/
15
15
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
16
16
 
17
17
  "use strict";
18
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudCmd: () => (/* binding */ createCloudCmd)\n/* harmony export */ });\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var format_io__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\n/* harmony import */ var just_pascal_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.mjs\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _sw_register_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./sw/register.mjs */ \"./client/sw/register.mjs\");\n/* harmony import */ var _get_json_from_file_table_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./get-json-from-file-table.mjs */ \"./client/get-json-from-file-table.mjs\");\n/* harmony import */ var _key_index_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./key/index.mjs */ \"./client/key/index.mjs\");\n/* harmony import */ var _load_module_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./load-module.mjs */ \"./client/load-module.mjs\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst noJS = a => a.replace(/.js$/, '');\nconst isDev = \"development\" === 'development';\ninherits__WEBPACK_IMPORTED_MODULE_2__(CloudCmdProto, emitify__WEBPACK_IMPORTED_MODULE_1__);\nconst createCloudCmd = ({\n DOM,\n Listeners\n}) => {\n return new CloudCmdProto({\n DOM,\n Listeners\n });\n};\nload_js__WEBPACK_IMPORTED_MODULE_4__.addErrorListener((e, src) => {\n const msg = `file ${src} could not be loaded`;\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.error(msg);\n});\nfunction CloudCmdProto({\n DOM,\n Listeners\n}) {\n emitify__WEBPACK_IMPORTED_MODULE_1__.call(this);\n const CloudCmd = this;\n const Info = DOM.CurrentInfo;\n const {\n Storage,\n Files\n } = DOM;\n this.log = () => {\n if (!isDev) return;\n };\n this.prefix = '';\n this.prefixSocket = '';\n this.prefixURL = '';\n this.MIN_ONE_PANEL_WIDTH = DOM.getCSSVar('min-one-panel-width');\n this.HOST = location.origin || location.protocol + '//' + location.host;\n this.sort = {\n left: 'name',\n right: 'name'\n };\n this.order = {\n left: 'asc',\n right: 'asc'\n };\n this.changeDir = async (path, overrides = {}) => {\n const {\n isRefresh,\n panel,\n history = true,\n noCurrent,\n currentName\n } = overrides;\n const refresh = isRefresh;\n let panelChanged;\n if (!noCurrent && panel && panel !== Info.panel) {\n DOM.changePanel();\n panelChanged = true;\n }\n let imgPosition;\n if (panelChanged || refresh || !history) imgPosition = 'top';\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load(imgPosition, panel);\n\n /* загружаем содержимое каталога */\n await ajaxLoad((0,format_io__WEBPACK_IMPORTED_MODULE_6__.addSlashToEnd)(path), {\n refresh,\n history,\n noCurrent,\n currentName,\n showDotFiles: CloudCmd.config('showDotFiles')\n }, panel);\n };\n\n /**\n * Конструктор CloudClient, который\n * выполняет весь функционал по\n * инициализации\n */\n this.init = async (prefix, config) => {\n CloudCmd.prefix = prefix;\n CloudCmd.prefixURL = `${prefix}${_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.apiURL}`;\n CloudCmd.prefixSocket = config.prefixSocket;\n CloudCmd.DIR_DIST = `${prefix}/dist`;\n CloudCmd.DIR_MODULES = `${this.DIR_DIST}/modules`;\n CloudCmd.config = key => config[key];\n CloudCmd.config.if = currify__WEBPACK_IMPORTED_MODULE_8__((key, fn, a) => config[key] && fn(a));\n CloudCmd._config = (key, value) => {\n /*\n * should be called from config.js only\n * after successful update on server\n */\n if (key === 'password') return;\n config[key] = value;\n };\n if (config.oneFilePanel) CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;\n if (!document.body.scrollIntoViewIfNeeded) await load_js__WEBPACK_IMPORTED_MODULE_4__.js(`${CloudCmd.DIR_MODULES}/polyfill.js`);\n await initModules();\n await baseInit();\n CloudCmd.route(location.hash);\n };\n this.route = path => {\n const query = path.split('/');\n if (!path) return;\n const [kebabModule] = query;\n const module = noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(kebabModule.slice(1)));\n const [, file] = query;\n const current = DOM.getCurrentByName(file);\n if (file && !current) {\n const msg = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.formatMsg)('set current file', file, 'error');\n CloudCmd.log(msg);\n return;\n }\n DOM.setCurrentFile(current);\n CloudCmd.execFromModule(module, 'show');\n };\n this.logOut = async () => {\n const url = CloudCmd.prefix + '/logout';\n const error = () => document.location.reload();\n const {\n prefix\n } = CloudCmd;\n await DOM.Storage.clear();\n (0,_sw_register_mjs__WEBPACK_IMPORTED_MODULE_11__.unregisterSW)(prefix);\n DOM.load.ajax({\n url,\n error\n });\n };\n const initModules = async () => {\n CloudCmd.Key = _key_index_mjs__WEBPACK_IMPORTED_MODULE_13__.Key;\n CloudCmd.Key.bind();\n const [, modules] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, 'modules');\n const showLoad = _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load;\n const doBefore = {\n edit: showLoad,\n menu: showLoad\n };\n const load = (name, path, dobefore) => {\n (0,_load_module_mjs__WEBPACK_IMPORTED_MODULE_14__.loadModule)({\n name,\n path,\n dobefore\n });\n };\n if (!modules) return;\n for (const module of modules.local) {\n load(null, module, doBefore[module]);\n }\n };\n async function saveCurrentName(currentName) {\n await Storage.set('current-name', currentName);\n }\n async function baseInit() {\n const files = DOM.getFiles();\n CloudCmd.on('current-file', DOM.updateCurrentInfo);\n CloudCmd.on('current-name', saveCurrentName);\n const name = await Storage.get('current-name');\n const currentFile = name && DOM.getCurrentByName(name) || files[0];\n\n /* выделяем строку с первым файлом */\n if (files) DOM.setCurrentFile(currentFile, {\n // when hash is present\n // it should be handled with this.route\n // overwre otherwise\n history: !location.hash\n });\n const dirPath = DOM.getCurrentDirPath();\n Listeners.init();\n const panels = getPanels();\n panels.forEach(Listeners.setOnPanel);\n Listeners.initKeysPanel();\n if (!CloudCmd.config('dirStorage')) return;\n const data = await Storage.get(dirPath);\n if (!data) await Storage.setJson(dirPath, (0,_get_json_from_file_table_mjs__WEBPACK_IMPORTED_MODULE_12__.getJsonFromFileTable)());\n }\n function getPanels() {\n const panels = ['left'];\n if (CloudCmd.config('oneFilePanel')) return panels;\n return [...panels, 'right'];\n }\n this.execFromModule = async (moduleName, funcName, ...args) => {\n await CloudCmd[moduleName]();\n const func = CloudCmd[moduleName][funcName];\n func(...args);\n };\n this.refresh = async (options = {}) => {\n const {\n panel = Info.panel,\n currentName\n } = options;\n const path = DOM.getCurrentDirPath(panel);\n const isRefresh = true;\n const history = false;\n const noCurrent = options === null || options === void 0 ? void 0 : options.noCurrent;\n await CloudCmd.changeDir(path, {\n isRefresh,\n history,\n panel,\n noCurrent,\n currentName\n });\n };\n\n /**\n * Функция загружает json-данные о Файловой Системе\n * через ajax-запрос.\n * @param path - каталог для чтения\n * @param options\n * { refresh, history } - необходимость обновить данные о каталоге\n * @param panel\n *\n */\n async function ajaxLoad(path, options = {}, panel) {\n const {\n RESTful\n } = DOM;\n CloudCmd.log(`reading dir: \"${path}\";`);\n const dirStorage = CloudCmd.config('dirStorage');\n const json = dirStorage && (await Storage.getJson(path));\n const name = options.currentName || Info.name;\n const {\n noCurrent,\n refresh\n } = options;\n if (!refresh && json) return await createFileTable(json, panel, options);\n const position = DOM.getPanelPosition(panel);\n const sort = CloudCmd.sort[position];\n const order = CloudCmd.order[position];\n const query = rendy__WEBPACK_IMPORTED_MODULE_3__('?sort={{ sort }}&order={{ order }}', {\n sort,\n order\n });\n const [, newObj] = await RESTful.read(path + query, 'json');\n if (!newObj)\n // that's OK, error handled by RESTful\n return;\n options.sort = sort;\n options.order = order;\n await createFileTable(newObj, panel, options);\n if (refresh && !noCurrent) DOM.setCurrentByName(name);\n if (!CloudCmd.config('dirStorage')) return;\n Storage.setJson(path, newObj);\n }\n\n /**\n * Функция строит файловую таблицу\n * @param data - данные о файлах\n * @param panelParam\n * @param options - history, noCurrent, showDotFiles\n */\n async function createFileTable(data, panelParam, options) {\n const {\n history,\n noCurrent,\n showDotFiles\n } = options;\n const names = ['file', 'path', 'link', 'pathLink'];\n const [error, [file, path, link, pathLink]] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, names);\n if (error) return DOM.Dialog.alert(error.responseText);\n const panel = panelParam || DOM.getPanel();\n const {\n prefix\n } = CloudCmd;\n const {\n dir,\n name\n } = Info;\n const {\n childNodes\n } = panel;\n let i = childNodes.length;\n while (i--) panel.removeChild(panel.lastChild);\n panel.innerHTML = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.buildFromJSON)({\n sort: options.sort,\n order: options.order,\n data,\n id: panel.id,\n prefix,\n showDotFiles,\n template: {\n file,\n path,\n pathLink,\n link\n }\n });\n Listeners.setOnPanel(panel);\n if (!noCurrent) {\n let current;\n if (name === '..' && dir !== '/') current = DOM.getCurrentByName(dir);\n if (!current) [current] = DOM.getFiles(panel);\n DOM.setCurrentFile(current, {\n history\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n }\n }\n this.goToParentDir = async () => {\n const {\n dir,\n dirPath,\n parentDirPath,\n panel\n } = Info;\n if (dirPath === parentDirPath) return;\n const path = parentDirPath;\n await CloudCmd.changeDir(path);\n const current = DOM.getCurrentByName(dir);\n const [first] = DOM.getFiles(panel);\n DOM.setCurrentFile(current || first, {\n history\n });\n };\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/client.mjs\n}");
18
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudCmd: () => (/* binding */ createCloudCmd)\n/* harmony export */ });\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var format_io__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\n/* harmony import */ var just_pascal_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.mjs\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _sw_register_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./sw/register.js */ \"./client/sw/register.js\");\n/* harmony import */ var _get_json_from_file_table_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./get-json-from-file-table.js */ \"./client/get-json-from-file-table.js\");\n/* harmony import */ var _key_index_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./key/index.js */ \"./client/key/index.js\");\n/* harmony import */ var _load_module_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./load-module.js */ \"./client/load-module.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst noJS = a => a.replace(/.js$/, '');\nconst isDev = \"development\" === 'development';\ninherits__WEBPACK_IMPORTED_MODULE_2__(CloudCmdProto, emitify__WEBPACK_IMPORTED_MODULE_1__);\nconst createCloudCmd = ({\n DOM,\n Listeners\n}) => {\n return new CloudCmdProto({\n DOM,\n Listeners\n });\n};\nload_js__WEBPACK_IMPORTED_MODULE_4__.addErrorListener((e, src) => {\n const msg = `file ${src} could not be loaded`;\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.error(msg);\n});\nfunction CloudCmdProto({\n DOM,\n Listeners\n}) {\n emitify__WEBPACK_IMPORTED_MODULE_1__.call(this);\n const CloudCmd = this;\n const Info = DOM.CurrentInfo;\n const {\n Storage,\n Files\n } = DOM;\n this.log = () => {\n if (!isDev) return;\n };\n this.prefix = '';\n this.prefixSocket = '';\n this.prefixURL = '';\n this.MIN_ONE_PANEL_WIDTH = DOM.getCSSVar('min-one-panel-width');\n this.HOST = location.origin || location.protocol + '//' + location.host;\n this.sort = {\n left: 'name',\n right: 'name'\n };\n this.order = {\n left: 'asc',\n right: 'asc'\n };\n this.changeDir = async (path, overrides = {}) => {\n const {\n isRefresh,\n panel,\n history = true,\n noCurrent,\n currentName\n } = overrides;\n const refresh = isRefresh;\n let panelChanged;\n if (!noCurrent && panel && panel !== Info.panel) {\n DOM.changePanel();\n panelChanged = true;\n }\n let imgPosition;\n if (panelChanged || refresh || !history) imgPosition = 'top';\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load(imgPosition, panel);\n\n /* загружаем содержимое каталога */\n await ajaxLoad((0,format_io__WEBPACK_IMPORTED_MODULE_6__.addSlashToEnd)(path), {\n refresh,\n history,\n noCurrent,\n currentName,\n showDotFiles: CloudCmd.config('showDotFiles')\n }, panel);\n };\n\n /**\n * Конструктор CloudClient, который\n * выполняет весь функционал по\n * инициализации\n */\n this.init = async (prefix, config) => {\n CloudCmd.prefix = prefix;\n CloudCmd.prefixURL = `${prefix}${_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.apiURL}`;\n CloudCmd.prefixSocket = config.prefixSocket;\n CloudCmd.DIR_DIST = `${prefix}/dist`;\n CloudCmd.DIR_MODULES = `${this.DIR_DIST}/modules`;\n CloudCmd.config = key => config[key];\n CloudCmd.config.if = currify__WEBPACK_IMPORTED_MODULE_8__((key, fn, a) => config[key] && fn(a));\n CloudCmd._config = (key, value) => {\n /*\n * should be called from config.js only\n * after successful update on server\n */\n if (key === 'password') return;\n config[key] = value;\n };\n if (config.oneFilePanel) CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;\n if (!document.body.scrollIntoViewIfNeeded) await load_js__WEBPACK_IMPORTED_MODULE_4__.js(`${CloudCmd.DIR_MODULES}/polyfill.js`);\n await initModules();\n await baseInit();\n CloudCmd.route(location.hash);\n };\n this.route = path => {\n const query = path.split('/');\n if (!path) return;\n const [kebabModule] = query;\n const module = noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(kebabModule.slice(1)));\n const [, file] = query;\n const current = DOM.getCurrentByName(file);\n if (file && !current) {\n const msg = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.formatMsg)('set current file', file, 'error');\n CloudCmd.log(msg);\n return;\n }\n DOM.setCurrentFile(current);\n CloudCmd.execFromModule(module, 'show');\n };\n this.logOut = async () => {\n const url = CloudCmd.prefix + '/logout';\n const error = () => document.location.reload();\n const {\n prefix\n } = CloudCmd;\n await DOM.Storage.clear();\n (0,_sw_register_js__WEBPACK_IMPORTED_MODULE_11__.unregisterSW)(prefix);\n DOM.load.ajax({\n url,\n error\n });\n };\n const initModules = async () => {\n CloudCmd.Key = _key_index_js__WEBPACK_IMPORTED_MODULE_13__.Key;\n CloudCmd.Key.bind();\n const [, modules] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, 'modules');\n const showLoad = _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load;\n const doBefore = {\n edit: showLoad,\n menu: showLoad\n };\n const load = (name, path, dobefore) => {\n (0,_load_module_js__WEBPACK_IMPORTED_MODULE_14__.loadModule)({\n name,\n path,\n dobefore\n });\n };\n if (!modules) return;\n for (const module of modules.local) {\n load(null, module, doBefore[module]);\n }\n };\n async function saveCurrentName(currentName) {\n await Storage.set('current-name', currentName);\n }\n async function baseInit() {\n const files = DOM.getFiles();\n CloudCmd.on('current-file', DOM.updateCurrentInfo);\n CloudCmd.on('current-name', saveCurrentName);\n const name = await Storage.get('current-name');\n const currentFile = name && DOM.getCurrentByName(name) || files[0];\n\n /* выделяем строку с первым файлом */\n if (files) DOM.setCurrentFile(currentFile, {\n // when hash is present\n // it should be handled with this.route\n // overwre otherwise\n history: !location.hash\n });\n const dirPath = DOM.getCurrentDirPath();\n Listeners.init();\n const panels = getPanels();\n panels.forEach(Listeners.setOnPanel);\n Listeners.initKeysPanel();\n if (!CloudCmd.config('dirStorage')) return;\n const data = await Storage.get(dirPath);\n if (!data) await Storage.setJson(dirPath, (0,_get_json_from_file_table_js__WEBPACK_IMPORTED_MODULE_12__.getJsonFromFileTable)());\n }\n function getPanels() {\n const panels = ['left'];\n if (CloudCmd.config('oneFilePanel')) return panels;\n return [...panels, 'right'];\n }\n this.execFromModule = async (moduleName, funcName, ...args) => {\n await CloudCmd[moduleName]();\n const func = CloudCmd[moduleName][funcName];\n func(...args);\n };\n this.refresh = async (options = {}) => {\n const {\n panel = Info.panel,\n currentName\n } = options;\n const path = DOM.getCurrentDirPath(panel);\n const isRefresh = true;\n const history = false;\n const noCurrent = options === null || options === void 0 ? void 0 : options.noCurrent;\n await CloudCmd.changeDir(path, {\n isRefresh,\n history,\n panel,\n noCurrent,\n currentName\n });\n };\n\n /**\n * Функция загружает json-данные о Файловой Системе\n * через ajax-запрос.\n * @param path - каталог для чтения\n * @param options\n * { refresh, history } - необходимость обновить данные о каталоге\n * @param panel\n *\n */\n async function ajaxLoad(path, options = {}, panel) {\n const {\n RESTful\n } = DOM;\n CloudCmd.log(`reading dir: \"${path}\";`);\n const dirStorage = CloudCmd.config('dirStorage');\n const json = dirStorage && (await Storage.getJson(path));\n const name = options.currentName || Info.name;\n const {\n noCurrent,\n refresh\n } = options;\n if (!refresh && json) return await createFileTable(json, panel, options);\n const position = DOM.getPanelPosition(panel);\n const sort = CloudCmd.sort[position];\n const order = CloudCmd.order[position];\n const query = rendy__WEBPACK_IMPORTED_MODULE_3__('?sort={{ sort }}&order={{ order }}', {\n sort,\n order\n });\n const [, newObj] = await RESTful.read(path + query, 'json');\n if (!newObj)\n // that's OK, error handled by RESTful\n return;\n options.sort = sort;\n options.order = order;\n await createFileTable(newObj, panel, options);\n if (refresh && !noCurrent) DOM.setCurrentByName(name);\n if (!CloudCmd.config('dirStorage')) return;\n Storage.setJson(path, newObj);\n }\n\n /**\n * Функция строит файловую таблицу\n * @param data - данные о файлах\n * @param panelParam\n * @param options - history, noCurrent, showDotFiles\n */\n async function createFileTable(data, panelParam, options) {\n const {\n history,\n noCurrent,\n showDotFiles\n } = options;\n const names = ['file', 'path', 'link', 'pathLink'];\n const [error, [file, path, link, pathLink]] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, names);\n if (error) return DOM.Dialog.alert(error.responseText);\n const panel = panelParam || DOM.getPanel();\n const {\n prefix\n } = CloudCmd;\n const {\n dir,\n name\n } = Info;\n const {\n childNodes\n } = panel;\n let i = childNodes.length;\n while (i--) panel.removeChild(panel.lastChild);\n panel.innerHTML = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.buildFromJSON)({\n sort: options.sort,\n order: options.order,\n data,\n id: panel.id,\n prefix,\n showDotFiles,\n template: {\n file,\n path,\n pathLink,\n link\n }\n });\n Listeners.setOnPanel(panel);\n if (!noCurrent) {\n let current;\n if (name === '..' && dir !== '/') current = DOM.getCurrentByName(dir);\n if (!current) [current] = DOM.getFiles(panel);\n DOM.setCurrentFile(current, {\n history\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n }\n }\n this.goToParentDir = async () => {\n const {\n dir,\n dirPath,\n parentDirPath,\n panel\n } = Info;\n if (dirPath === parentDirPath) return;\n const path = parentDirPath;\n await CloudCmd.changeDir(path);\n const current = DOM.getCurrentByName(dir);\n const [first] = DOM.getFiles(panel);\n DOM.setCurrentFile(current || first, {\n history\n });\n };\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/client.js\n}");
19
19
 
20
20
  /***/ },
21
21
 
22
- /***/ "./client/cloudcmd.mjs"
23
- /*!*****************************!*\
24
- !*** ./client/cloudcmd.mjs ***!
25
- \*****************************/
22
+ /***/ "./client/cloudcmd.js"
23
+ /*!****************************!*\
24
+ !*** ./client/cloudcmd.js ***!
25
+ \****************************/
26
26
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
27
27
 
28
28
  "use strict";
29
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _css_main_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _sw_register_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sw/register.mjs */ \"./client/sw/register.mjs\");\n/* harmony import */ var _sort_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./sort.mjs */ \"./client/sort.mjs\");\n/* harmony import */ var _dom_index_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dom/index.mjs */ \"./client/dom/index.mjs\");\n/* harmony import */ var _client_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./client.mjs */ \"./client/client.mjs\");\n/* harmony import */ var _listeners_index_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./listeners/index.mjs */ \"./client/listeners/index.mjs\");\n\n\n\n\n\n\n\n\n\n\n\nconst isDev = \"development\" === 'development';\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (init);\nglobalThis.CloudCmd = init;\nasync function init(config) {\n globalThis.CloudCmd = (0,_client_mjs__WEBPACK_IMPORTED_MODULE_9__.createCloudCmd)({\n DOM: _dom_index_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n Listeners: _listeners_index_mjs__WEBPACK_IMPORTED_MODULE_10__\n });\n globalThis.DOM = _dom_index_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"];\n globalThis.Util = _common_util__WEBPACK_IMPORTED_MODULE_4__;\n globalThis.CloudFunc = _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__;\n await register(config);\n (0,_sort_mjs__WEBPACK_IMPORTED_MODULE_7__.initSortPanel)();\n globalThis.CloudCmd.sortPanel = _sort_mjs__WEBPACK_IMPORTED_MODULE_7__.sortPanel;\n const prefix = getPrefix(config.prefix);\n globalThis.CloudCmd.init(prefix, config);\n if (globalThis.CloudCmd.config('menu') === 'aleman') setTimeout(() => {\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! https://esm.sh/@putout/processor-html */ \"https://esm.sh/@putout/processor-html\"));\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! https://esm.sh/@putout/bundle */ \"https://esm.sh/@putout/bundle\"));\n }, 100);\n}\nfunction getPrefix(prefix) {\n if (!prefix) return '';\n if (!prefix.indexOf('/')) return prefix;\n return `/${prefix}`;\n}\nconst onUpdateFound = wraptile__WEBPACK_IMPORTED_MODULE_2__(async config => {\n if (isDev) return;\n const {\n DOM\n } = globalThis;\n const prefix = getPrefix(config.prefix);\n await load_js__WEBPACK_IMPORTED_MODULE_3__.js(`${prefix}/dist/cloudcmd.common.js`);\n await load_js__WEBPACK_IMPORTED_MODULE_3__.js(`${prefix}/dist/cloudcmd.js`);\n console.log('cloudcmd: sw: updated');\n DOM.Events.removeAll();\n globalThis.CloudCmd(config);\n});\nasync function register(config) {\n const {\n prefix\n } = config;\n const sw = await (0,_sw_register_mjs__WEBPACK_IMPORTED_MODULE_6__.registerSW)(prefix);\n (0,_sw_register_mjs__WEBPACK_IMPORTED_MODULE_6__.listenSW)(sw, 'updatefound', onUpdateFound(config));\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/cloudcmd.mjs\n}");
29
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _css_main_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom */ \"./client/dom/index.js\");\n/* harmony import */ var _sw_register_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./sw/register.js */ \"./client/sw/register.js\");\n/* harmony import */ var _sort_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sort.js */ \"./client/sort.js\");\n/* harmony import */ var _client_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./client.js */ \"./client/client.js\");\n/* harmony import */ var _listeners_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./listeners/index.js */ \"./client/listeners/index.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst isDev = \"development\" === 'development';\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (init);\nglobalThis.CloudCmd = init;\nasync function init(config) {\n globalThis.CloudCmd = (0,_client_js__WEBPACK_IMPORTED_MODULE_9__.createCloudCmd)({\n DOM: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"],\n Listeners: _listeners_index_js__WEBPACK_IMPORTED_MODULE_10__\n });\n globalThis.DOM = _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\n globalThis.Util = _common_util__WEBPACK_IMPORTED_MODULE_4__;\n globalThis.CloudFunc = _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__;\n await register(config);\n (0,_sort_js__WEBPACK_IMPORTED_MODULE_8__.initSortPanel)();\n globalThis.CloudCmd.sortPanel = _sort_js__WEBPACK_IMPORTED_MODULE_8__.sortPanel;\n const prefix = getPrefix(config.prefix);\n globalThis.CloudCmd.init(prefix, config);\n if (globalThis.CloudCmd.config('menu') === 'aleman') setTimeout(() => {\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! https://esm.sh/@putout/processor-html */ \"https://esm.sh/@putout/processor-html\"));\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! https://esm.sh/@putout/bundle */ \"https://esm.sh/@putout/bundle\"));\n }, 100);\n}\nfunction getPrefix(prefix) {\n if (!prefix) return '';\n if (!prefix.indexOf('/')) return prefix;\n return `/${prefix}`;\n}\nconst onUpdateFound = wraptile__WEBPACK_IMPORTED_MODULE_2__(async config => {\n if (isDev) return;\n const {\n DOM\n } = globalThis;\n const prefix = getPrefix(config.prefix);\n await load_js__WEBPACK_IMPORTED_MODULE_3__.js(`${prefix}/dist/cloudcmd.common.js`);\n await load_js__WEBPACK_IMPORTED_MODULE_3__.js(`${prefix}/dist/cloudcmd.js`);\n console.log('cloudcmd: sw: updated');\n DOM.Events.removeAll();\n globalThis.CloudCmd(config);\n});\nasync function register(config) {\n const {\n prefix\n } = config;\n const sw = await (0,_sw_register_js__WEBPACK_IMPORTED_MODULE_7__.registerSW)(prefix);\n (0,_sw_register_js__WEBPACK_IMPORTED_MODULE_7__.listenSW)(sw, 'updatefound', onUpdateFound(config));\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/cloudcmd.js\n}");
30
30
 
31
31
  /***/ },
32
32
 
33
- /***/ "./client/dom/buffer.mjs"
34
- /*!*******************************!*\
35
- !*** ./client/dom/buffer.mjs ***!
36
- \*******************************/
33
+ /***/ "./client/dom/buffer.js"
34
+ /*!******************************!*\
35
+ !*** ./client/dom/buffer.js ***!
36
+ \******************************/
37
37
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
38
38
 
39
39
  "use strict";
40
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ cut: () => (/* binding */ cut),\n/* harmony export */ paste: () => (/* binding */ paste)\n/* harmony export */ });\n/* harmony import */ var _dom_storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/storage */ \"./client/dom/storage.mjs\");\n/* harmony import */ var _common_try_to_promise_all_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/try-to-promise-all.js */ \"./common/try-to-promise-all.js\");\n/* global CloudCmd*/\n\n\nconst CLASS = 'cut-file';\nconst COPY = 'copy';\nconst CUT = 'cut';\nfunction showMessage(msg) {\n globalThis.DOM.Dialog.alert(msg);\n}\nfunction getNames() {\n const {\n DOM\n } = globalThis;\n const files = DOM.getActiveFiles();\n return DOM.getFilenames(files);\n}\nfunction addCutClass() {\n const {\n DOM\n } = globalThis;\n const files = DOM.getActiveFiles();\n for (const element of files) {\n element.classList.add(CLASS);\n }\n}\nfunction rmCutClass() {\n const {\n DOM\n } = globalThis;\n const files = DOM.getByClassAll(CLASS);\n for (const element of files) {\n element.classList.remove(CLASS);\n }\n}\nconst checkEnabled = fn => () => {\n const is = CloudCmd.config('buffer');\n if (is) return fn();\n showMessage('Buffer disabled in config!');\n};\nasync function readBuffer() {\n const [e, cp, ct] = await _common_try_to_promise_all_js__WEBPACK_IMPORTED_MODULE_1__([_dom_storage__WEBPACK_IMPORTED_MODULE_0__.getJson(COPY), _dom_storage__WEBPACK_IMPORTED_MODULE_0__.getJson(CUT)]);\n return [e, cp, ct];\n}\nconst copy = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const names = getNames();\n const from = Info.dirPath;\n await clear();\n if (!names.length) return;\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.remove(CUT);\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.setJson(COPY, {\n from,\n names\n });\n});\nconst cut = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const names = getNames();\n const from = Info.dirPath;\n await clear();\n if (!names.length) return;\n addCutClass();\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.setJson(CUT, {\n from,\n names\n });\n});\nconst clear = checkEnabled(async () => {\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.remove(COPY);\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.remove(CUT);\n rmCutClass();\n});\nconst paste = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const [error, cp, ct] = await readBuffer();\n if (error || !cp && !ct) return showMessage(error || 'Buffer is empty!');\n const opStr = cp ? 'copy' : 'move';\n const data = cp || ct;\n const {\n Operation\n } = CloudCmd;\n const msg = 'Path is same!';\n const to = Info.dirPath;\n if (data.from === to) return showMessage(msg);\n Operation.show(opStr, {\n ...data,\n to\n });\n await clear();\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/buffer.mjs\n}");
40
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ cut: () => (/* binding */ cut),\n/* harmony export */ paste: () => (/* binding */ paste)\n/* harmony export */ });\n/* harmony import */ var _dom_storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/storage */ \"./client/dom/storage.js\");\n/* harmony import */ var _common_try_to_promise_all_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/try-to-promise-all.js */ \"./common/try-to-promise-all.js\");\n/* global CloudCmd*/\n\n\nconst CLASS = 'cut-file';\nconst COPY = 'copy';\nconst CUT = 'cut';\nfunction showMessage(msg) {\n globalThis.DOM.Dialog.alert(msg);\n}\nfunction getNames() {\n const {\n DOM\n } = globalThis;\n const files = DOM.getActiveFiles();\n return DOM.getFilenames(files);\n}\nfunction addCutClass() {\n const {\n DOM\n } = globalThis;\n const files = DOM.getActiveFiles();\n for (const element of files) {\n element.classList.add(CLASS);\n }\n}\nfunction rmCutClass() {\n const {\n DOM\n } = globalThis;\n const files = DOM.getByClassAll(CLASS);\n for (const element of files) {\n element.classList.remove(CLASS);\n }\n}\nconst checkEnabled = fn => () => {\n const is = CloudCmd.config('buffer');\n if (is) return fn();\n showMessage('Buffer disabled in config!');\n};\nasync function readBuffer() {\n const [e, cp, ct] = await (0,_common_try_to_promise_all_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])([_dom_storage__WEBPACK_IMPORTED_MODULE_0__.getJson(COPY), _dom_storage__WEBPACK_IMPORTED_MODULE_0__.getJson(CUT)]);\n return [e, cp, ct];\n}\nconst copy = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const names = getNames();\n const from = Info.dirPath;\n await clear();\n if (!names.length) return;\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.remove(CUT);\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.setJson(COPY, {\n from,\n names\n });\n});\nconst cut = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const names = getNames();\n const from = Info.dirPath;\n await clear();\n if (!names.length) return;\n addCutClass();\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.setJson(CUT, {\n from,\n names\n });\n});\nconst clear = checkEnabled(async () => {\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.remove(COPY);\n await _dom_storage__WEBPACK_IMPORTED_MODULE_0__.remove(CUT);\n rmCutClass();\n});\nconst paste = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const [error, cp, ct] = await readBuffer();\n if (error || !cp && !ct) return showMessage(error || 'Buffer is empty!');\n const opStr = cp ? 'copy' : 'move';\n const data = cp || ct;\n const {\n Operation\n } = CloudCmd;\n const msg = 'Path is same!';\n const to = Info.dirPath;\n if (data.from === to) return showMessage(msg);\n Operation.show(opStr, {\n ...data,\n to\n });\n await clear();\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/buffer.js\n}");
41
41
 
42
42
  /***/ },
43
43
 
44
- /***/ "./client/dom/cmd.mjs"
45
- /*!****************************!*\
46
- !*** ./client/dom/cmd.mjs ***!
47
- \****************************/
44
+ /***/ "./client/dom/cmd.js"
45
+ /*!***************************!*\
46
+ !*** ./client/dom/cmd.js ***!
47
+ \***************************/
48
48
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
49
49
 
50
50
  "use strict";
51
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getSelectedFiles: () => (/* binding */ getSelectedFiles),\n/* harmony export */ isSelected: () => (/* binding */ isSelected),\n/* harmony export */ selectAllFiles: () => (/* binding */ selectAllFiles),\n/* harmony export */ selectFile: () => (/* binding */ selectFile),\n/* harmony export */ toggleAllSelectedFiles: () => (/* binding */ toggleAllSelectedFiles),\n/* harmony export */ toggleSelectedFile: () => (/* binding */ toggleSelectedFile),\n/* harmony export */ unselectFile: () => (/* binding */ unselectFile)\n/* harmony export */ });\n/* global DOM */\nconst SELECTED_FILE = 'selected-file';\nconst Cmd = {\n getSelectedFiles,\n isSelected,\n unselectFile,\n selectFile,\n selectAllFiles,\n toggleSelectedFile,\n toggleAllSelectedFiles\n};\n\n/**\n * selected file check\n *\n * @param currentFile\n */\nfunction isSelected(currentFile) {\n if (!currentFile) return false;\n return DOM.isContainClass(currentFile, SELECTED_FILE);\n}\n\n/**\n * select current file\n * @param currentFile\n */\nfunction selectFile(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n current.classList.add(SELECTED_FILE);\n return Cmd;\n}\nfunction unselectFile(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n current.classList.remove(SELECTED_FILE);\n return Cmd;\n}\nfunction toggleSelectedFile(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const name = DOM.getCurrentName(current);\n if (name === '..') return Cmd;\n current.classList.toggle(SELECTED_FILE);\n return Cmd;\n}\nfunction toggleAllSelectedFiles() {\n DOM.getAllFiles().map(DOM.toggleSelectedFile);\n return Cmd;\n}\nfunction selectAllFiles() {\n DOM.getAllFiles().map(DOM.selectFile);\n return Cmd;\n}\n\n/**\n * unified way to get selected files\n *\n * @currentFile\n */\nfunction getSelectedFiles() {\n const panel = DOM.getPanel();\n const selected = DOM.getByClassAll(SELECTED_FILE, panel);\n return Array.from(selected);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/cmd.mjs\n}");
51
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getSelectedFiles: () => (/* binding */ getSelectedFiles),\n/* harmony export */ isSelected: () => (/* binding */ isSelected),\n/* harmony export */ selectAllFiles: () => (/* binding */ selectAllFiles),\n/* harmony export */ selectFile: () => (/* binding */ selectFile),\n/* harmony export */ toggleAllSelectedFiles: () => (/* binding */ toggleAllSelectedFiles),\n/* harmony export */ toggleSelectedFile: () => (/* binding */ toggleSelectedFile),\n/* harmony export */ unselectFile: () => (/* binding */ unselectFile)\n/* harmony export */ });\n/* global DOM */\nconst SELECTED_FILE = 'selected-file';\nconst Cmd = {\n getSelectedFiles,\n isSelected,\n unselectFile,\n selectFile,\n selectAllFiles,\n toggleSelectedFile,\n toggleAllSelectedFiles\n};\n\n/**\n * selected file check\n *\n * @param currentFile\n */\nfunction isSelected(currentFile) {\n if (!currentFile) return false;\n return DOM.isContainClass(currentFile, SELECTED_FILE);\n}\n\n/**\n * select current file\n * @param currentFile\n */\nfunction selectFile(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n current.classList.add(SELECTED_FILE);\n return Cmd;\n}\nfunction unselectFile(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n current.classList.remove(SELECTED_FILE);\n return Cmd;\n}\nfunction toggleSelectedFile(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const name = DOM.getCurrentName(current);\n if (name === '..') return Cmd;\n current.classList.toggle(SELECTED_FILE);\n return Cmd;\n}\nfunction toggleAllSelectedFiles() {\n DOM.getAllFiles().map(DOM.toggleSelectedFile);\n return Cmd;\n}\nfunction selectAllFiles() {\n DOM.getAllFiles().map(DOM.selectFile);\n return Cmd;\n}\n\n/**\n * unified way to get selected files\n *\n * @currentFile\n */\nfunction getSelectedFiles() {\n const panel = DOM.getPanel();\n const selected = DOM.getByClassAll(SELECTED_FILE, panel);\n return Array.from(selected);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/cmd.js\n}");
52
52
 
53
53
  /***/ },
54
54
 
55
- /***/ "./client/dom/current-file.mjs"
56
- /*!*************************************!*\
57
- !*** ./client/dom/current-file.mjs ***!
58
- \*************************************/
55
+ /***/ "./client/dom/current-file.js"
56
+ /*!************************************!*\
57
+ !*** ./client/dom/current-file.js ***!
58
+ \************************************/
59
59
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
60
60
 
61
61
  "use strict";
62
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _CURRENT_FILE: () => (/* binding */ _CURRENT_FILE),\n/* harmony export */ _parseHrefAttribute: () => (/* binding */ _parseHrefAttribute),\n/* harmony export */ _parseNameAttribute: () => (/* binding */ _parseNameAttribute),\n/* harmony export */ getCurrentByName: () => (/* binding */ getCurrentByName),\n/* harmony export */ getCurrentByPosition: () => (/* binding */ getCurrentByPosition),\n/* harmony export */ getCurrentDirName: () => (/* binding */ getCurrentDirName),\n/* harmony export */ getCurrentDirPath: () => (/* binding */ getCurrentDirPath),\n/* harmony export */ getCurrentFile: () => (/* binding */ getCurrentFile),\n/* harmony export */ getCurrentName: () => (/* binding */ getCurrentName),\n/* harmony export */ getCurrentPath: () => (/* binding */ getCurrentPath),\n/* harmony export */ getCurrentType: () => (/* binding */ getCurrentType),\n/* harmony export */ getNotCurrentDirPath: () => (/* binding */ getNotCurrentDirPath),\n/* harmony export */ getParentDirPath: () => (/* binding */ getParentDirPath),\n/* harmony export */ isCurrentFile: () => (/* binding */ isCurrentFile),\n/* harmony export */ isCurrentIsDir: () => (/* binding */ isCurrentIsDir),\n/* harmony export */ setCurrentByName: () => (/* binding */ setCurrentByName),\n/* harmony export */ setCurrentFile: () => (/* binding */ setCurrentFile),\n/* harmony export */ setCurrentName: () => (/* binding */ setCurrentName),\n/* harmony export */ setTitle: () => (/* binding */ setTitle)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n/* global DOM */\n/* global CloudCmd */\n\n\n\nlet Title;\nconst CURRENT_FILE = 'current-file';\nconst encodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace('\\xa0', ' ');\nconst decodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace(' ', '\\xa0');\nconst _CURRENT_FILE = CURRENT_FILE;\n\n/**\n * set name from current (or param) file\n *\n * @param name\n * @param current\n */\nconst setCurrentName = (name, current) => {\n const Info = DOM.CurrentInfo;\n const {\n link\n } = Info;\n const {\n prefix\n } = CloudCmd;\n const dir = prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS + Info.dirPath;\n const encoded = (0,_common_entity__WEBPACK_IMPORTED_MODULE_2__.encode)(name);\n link.title = encoded;\n link.href = dir + encoded;\n link.innerHTML = encoded;\n current.setAttribute('data-name', createNameAttribute(name));\n CloudCmd.emit('current-file', current);\n return link;\n};\n\n/**\n * get name from current (or param) file\n *\n * @param currentFile\n */\nconst getCurrentName = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n if (!current) return '';\n return parseNameAttribute(current.getAttribute('data-name'));\n};\n\n/**\n * Generate a `data-name` attribute for the given filename\n * @param name The string name to encode\n */\nconst createNameAttribute = name => {\n const encoded = btoa(encodeURI(name));\n return `js-file-${encoded}`;\n};\n\n/**\n * Parse a `data-name` attribute string back into the original filename\n * @param attribute The string we wish to decode\n */\nconst parseNameAttribute = attribute => {\n attribute = attribute.replace('js-file-', '');\n return decodeNBSP(decodeURI(atob(attribute)));\n};\nconst _parseNameAttribute = parseNameAttribute;\nconst parseHrefAttribute = (prefix, attribute) => {\n attribute = attribute.replace(RegExp('^' + prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS), '');\n return (0,_common_entity__WEBPACK_IMPORTED_MODULE_2__.decode)(decodeNBSP(attribute));\n};\nconst _parseHrefAttribute = parseHrefAttribute;\n\n/**\n * get current direcotory path\n */\nconst getCurrentDirPath = (panel = DOM.getPanel()) => {\n const path = DOM.getByDataName('js-path', panel);\n return path.textContent;\n};\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nconst getCurrentPath = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const [element] = DOM.getByTag('a', current);\n const {\n prefix\n } = CloudCmd;\n return parseHrefAttribute(prefix, element.getAttribute('href'));\n};\n\n/**\n * get current direcotory name\n */\nconst getCurrentDirName = () => {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n};\n\n/**\n * get current direcotory path\n */\nconst getParentDirPath = panel => {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path === '/') return path;\n return path.slice(0, index);\n};\n\n/**\n * get not current direcotory path\n */\nconst getNotCurrentDirPath = () => {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n};\n\n/**\n * unified way to get current file\n *\n * @currentFile\n */\nconst getCurrentFile = () => {\n return DOM.getByClass(CURRENT_FILE);\n};\n\n/**\n * get current file by name\n */\nconst getCurrentByName = (name, panel = DOM.CurrentInfo.panel) => {\n const dataName = 'js-file-' + btoa(encodeURI(encodeNBSP(name)));\n return DOM.getByDataName(dataName, panel);\n};\n\n/**\n * private function thet unset currentFile\n *\n * @currentFile\n */\nfunction unsetCurrentFile(currentFile) {\n const is = DOM.isCurrentFile(currentFile);\n if (!is) return;\n currentFile.classList.remove(CURRENT_FILE);\n}\n\n/**\n * unified way to set current file\n */\nconst setCurrentFile = (currentFile, options) => {\n const o = options;\n const currentFileWas = DOM.getCurrentFile();\n if (!currentFile) return DOM;\n let pathWas = '';\n if (currentFileWas) {\n pathWas = DOM.getCurrentDirPath();\n unsetCurrentFile(currentFileWas);\n }\n currentFile.classList.add(CURRENT_FILE);\n const path = DOM.getCurrentDirPath();\n const name = CloudCmd.config('name');\n if (path !== pathWas) {\n DOM.setTitle((0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.getTitle)({\n name,\n path\n }));\n\n /* history could be present\n * but it should be false\n * to prevent default behavior\n */\n if (!o || o.history) {\n const historyPath = path === '/' ? path : _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS + path;\n DOM.setHistory(historyPath, null, historyPath);\n }\n }\n\n /* scrolling to current file */\n const CENTER = true;\n DOM.scrollIntoViewIfNeeded(currentFile, CENTER);\n CloudCmd.emit('current-file', currentFile);\n CloudCmd.emit('current-path', path);\n CloudCmd.emit('current-name', DOM.getCurrentName(currentFile));\n return DOM;\n};\nconst setCurrentByName = name => {\n const current = DOM.getCurrentByName(name);\n return DOM.setCurrentFile(current);\n};\n\n/*\n * set current file by position\n *\n * @param layer - element\n * @param - position {x, y}\n */\nconst getCurrentByPosition = ({\n x,\n y\n}) => {\n const element = document.elementFromPoint(x, y);\n const getEl = el => {\n const {\n tagName\n } = el;\n const isChild = /A|SPAN|LI/.test(tagName);\n if (!isChild) return null;\n if (tagName === 'A') return el.parentElement.parentElement;\n if (tagName === 'SPAN') return el.parentElement;\n return el;\n };\n const el = getEl(element);\n if (el && el.tagName !== 'LI') return null;\n return el;\n};\n\n/**\n * current file check\n *\n * @param currentFile\n */\nconst isCurrentFile = currentFile => {\n if (!currentFile) return false;\n return DOM.isContainClass(currentFile, CURRENT_FILE);\n};\n\n/**\n * set title or create title element\n *\n * @param name\n */\nconst setTitle = name => {\n if (!Title) Title = DOM.getByTag('title')[0] || _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('title', {\n innerHTML: name,\n parent: document.head\n });\n Title.textContent = name;\n return DOM;\n};\n\n/**\n * check is current file is a directory\n *\n * @param currentFile\n */\nconst isCurrentIsDir = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const fileType = DOM.getCurrentType(current);\n const isZip = path.endsWith('.zip');\n const isDir = /^directory(-link)?/.test(fileType);\n return isDir || isZip;\n};\nconst getCurrentType = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const el = DOM.getByDataName('js-type', current);\n const type = el.className.split(' ').pop();\n return type;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/current-file.mjs\n}");
62
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _CURRENT_FILE: () => (/* binding */ _CURRENT_FILE),\n/* harmony export */ _parseHrefAttribute: () => (/* binding */ _parseHrefAttribute),\n/* harmony export */ _parseNameAttribute: () => (/* binding */ _parseNameAttribute),\n/* harmony export */ getCurrentByName: () => (/* binding */ getCurrentByName),\n/* harmony export */ getCurrentByPosition: () => (/* binding */ getCurrentByPosition),\n/* harmony export */ getCurrentDirName: () => (/* binding */ getCurrentDirName),\n/* harmony export */ getCurrentDirPath: () => (/* binding */ getCurrentDirPath),\n/* harmony export */ getCurrentFile: () => (/* binding */ getCurrentFile),\n/* harmony export */ getCurrentName: () => (/* binding */ getCurrentName),\n/* harmony export */ getCurrentPath: () => (/* binding */ getCurrentPath),\n/* harmony export */ getCurrentType: () => (/* binding */ getCurrentType),\n/* harmony export */ getNotCurrentDirPath: () => (/* binding */ getNotCurrentDirPath),\n/* harmony export */ getParentDirPath: () => (/* binding */ getParentDirPath),\n/* harmony export */ isCurrentFile: () => (/* binding */ isCurrentFile),\n/* harmony export */ isCurrentIsDir: () => (/* binding */ isCurrentIsDir),\n/* harmony export */ setCurrentByName: () => (/* binding */ setCurrentByName),\n/* harmony export */ setCurrentFile: () => (/* binding */ setCurrentFile),\n/* harmony export */ setCurrentName: () => (/* binding */ setCurrentName),\n/* harmony export */ setTitle: () => (/* binding */ setTitle)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n/* global DOM */\n/* global CloudCmd */\n\n\n\nlet Title;\nconst CURRENT_FILE = 'current-file';\nconst encodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace('\\xa0', ' ');\nconst decodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace(' ', '\\xa0');\nconst _CURRENT_FILE = CURRENT_FILE;\n\n/**\n * set name from current (or param) file\n *\n * @param name\n * @param current\n */\nconst setCurrentName = (name, current) => {\n const Info = DOM.CurrentInfo;\n const {\n link\n } = Info;\n const {\n prefix\n } = CloudCmd;\n const dir = prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS + Info.dirPath;\n const encoded = (0,_common_entity__WEBPACK_IMPORTED_MODULE_2__.encode)(name);\n link.title = encoded;\n link.href = dir + encoded;\n link.innerHTML = encoded;\n current.setAttribute('data-name', createNameAttribute(name));\n CloudCmd.emit('current-file', current);\n return link;\n};\n\n/**\n * get name from current (or param) file\n *\n * @param currentFile\n */\nconst getCurrentName = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n if (!current) return '';\n return parseNameAttribute(current.getAttribute('data-name'));\n};\n\n/**\n * Generate a `data-name` attribute for the given filename\n * @param name The string name to encode\n */\nconst createNameAttribute = name => {\n const encoded = btoa(encodeURI(name));\n return `js-file-${encoded}`;\n};\n\n/**\n * Parse a `data-name` attribute string back into the original filename\n * @param attribute The string we wish to decode\n */\nconst parseNameAttribute = attribute => {\n attribute = attribute.replace('js-file-', '');\n return decodeNBSP(decodeURI(atob(attribute)));\n};\nconst _parseNameAttribute = parseNameAttribute;\nconst parseHrefAttribute = (prefix, attribute) => {\n attribute = attribute.replace(RegExp('^' + prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS), '');\n return (0,_common_entity__WEBPACK_IMPORTED_MODULE_2__.decode)(decodeNBSP(attribute));\n};\nconst _parseHrefAttribute = parseHrefAttribute;\n\n/**\n * get current direcotory path\n */\nconst getCurrentDirPath = (panel = DOM.getPanel()) => {\n const path = DOM.getByDataName('js-path', panel);\n return path.textContent;\n};\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nconst getCurrentPath = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const [element] = DOM.getByTag('a', current);\n const {\n prefix\n } = CloudCmd;\n return parseHrefAttribute(prefix, element.getAttribute('href'));\n};\n\n/**\n * get current direcotory name\n */\nconst getCurrentDirName = () => {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n};\n\n/**\n * get current direcotory path\n */\nconst getParentDirPath = panel => {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path === '/') return path;\n return path.slice(0, index);\n};\n\n/**\n * get not current direcotory path\n */\nconst getNotCurrentDirPath = () => {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n};\n\n/**\n * unified way to get current file\n *\n * @currentFile\n */\nconst getCurrentFile = () => {\n return DOM.getByClass(CURRENT_FILE);\n};\n\n/**\n * get current file by name\n */\nconst getCurrentByName = (name, panel = DOM.CurrentInfo.panel) => {\n const dataName = 'js-file-' + btoa(encodeURI(encodeNBSP(name)));\n return DOM.getByDataName(dataName, panel);\n};\n\n/**\n * private function thet unset currentFile\n *\n * @currentFile\n */\nfunction unsetCurrentFile(currentFile) {\n const is = DOM.isCurrentFile(currentFile);\n if (!is) return;\n currentFile.classList.remove(CURRENT_FILE);\n}\n\n/**\n * unified way to set current file\n */\nconst setCurrentFile = (currentFile, options) => {\n const o = options;\n const currentFileWas = DOM.getCurrentFile();\n if (!currentFile) return DOM;\n let pathWas = '';\n if (currentFileWas) {\n pathWas = DOM.getCurrentDirPath();\n unsetCurrentFile(currentFileWas);\n }\n currentFile.classList.add(CURRENT_FILE);\n const path = DOM.getCurrentDirPath();\n const name = CloudCmd.config('name');\n if (path !== pathWas) {\n DOM.setTitle((0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.getTitle)({\n name,\n path\n }));\n\n /* history could be present\n * but it should be false\n * to prevent default behavior\n */\n if (!o || o.history) {\n const historyPath = path === '/' ? path : _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS + path;\n DOM.setHistory(historyPath, null, historyPath);\n }\n }\n\n /* scrolling to current file */\n const CENTER = true;\n DOM.scrollIntoViewIfNeeded(currentFile, CENTER);\n CloudCmd.emit('current-file', currentFile);\n CloudCmd.emit('current-path', path);\n CloudCmd.emit('current-name', DOM.getCurrentName(currentFile));\n return DOM;\n};\nconst setCurrentByName = name => {\n const current = DOM.getCurrentByName(name);\n return DOM.setCurrentFile(current);\n};\n\n/*\n * set current file by position\n *\n * @param layer - element\n * @param - position {x, y}\n */\nconst getCurrentByPosition = ({\n x,\n y\n}) => {\n const element = document.elementFromPoint(x, y);\n const getEl = el => {\n const {\n tagName\n } = el;\n const isChild = /A|SPAN|LI/.test(tagName);\n if (!isChild) return null;\n if (tagName === 'A') return el.parentElement.parentElement;\n if (tagName === 'SPAN') return el.parentElement;\n return el;\n };\n const el = getEl(element);\n if (el && el.tagName !== 'LI') return null;\n return el;\n};\n\n/**\n * current file check\n *\n * @param currentFile\n */\nconst isCurrentFile = currentFile => {\n if (!currentFile) return false;\n return DOM.isContainClass(currentFile, CURRENT_FILE);\n};\n\n/**\n * set title or create title element\n *\n * @param name\n */\nconst setTitle = name => {\n if (!Title) Title = DOM.getByTag('title')[0] || _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('title', {\n innerHTML: name,\n parent: document.head\n });\n Title.textContent = name;\n return DOM;\n};\n\n/**\n * check is current file is a directory\n *\n * @param currentFile\n */\nconst isCurrentIsDir = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const fileType = DOM.getCurrentType(current);\n const isZip = path.endsWith('.zip');\n const isDir = /^directory(-link)?/.test(fileType);\n return isDir || isZip;\n};\nconst getCurrentType = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const el = DOM.getByDataName('js-type', current);\n const type = el.className.split(' ').pop();\n return type;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/current-file.js\n}");
63
63
 
64
64
  /***/ },
65
65
 
66
- /***/ "./client/dom/dialog.mjs"
67
- /*!*******************************!*\
68
- !*** ./client/dom/dialog.mjs ***!
69
- \*******************************/
66
+ /***/ "./client/dom/dialog.js"
67
+ /*!******************************!*\
68
+ !*** ./client/dom/dialog.js ***!
69
+ \******************************/
70
70
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
71
71
 
72
72
  "use strict";
73
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alert: () => (/* binding */ alert),\n/* harmony export */ confirm: () => (/* binding */ confirm),\n/* harmony export */ progress: () => (/* binding */ progress),\n/* harmony export */ prompt: () => (/* binding */ prompt)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var smalltalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! smalltalk */ \"./node_modules/smalltalk/lib/smalltalk.js\");\n\n\nconst title = 'Cloud Commander';\nconst alert = (...a) => smalltalk__WEBPACK_IMPORTED_MODULE_1__.alert(title, ...a, {\n cancel: false\n});\nconst prompt = (...a) => (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(smalltalk__WEBPACK_IMPORTED_MODULE_1__.prompt, title, ...a);\nconst confirm = (...a) => (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(smalltalk__WEBPACK_IMPORTED_MODULE_1__.confirm, title, ...a);\nconst progress = (...a) => smalltalk__WEBPACK_IMPORTED_MODULE_1__.progress(title, ...a);\nalert.noFiles = () => {\n return smalltalk__WEBPACK_IMPORTED_MODULE_1__.alert(title, 'No files selected!', {\n cancel: false\n });\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/dialog.mjs\n}");
73
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alert: () => (/* binding */ alert),\n/* harmony export */ confirm: () => (/* binding */ confirm),\n/* harmony export */ progress: () => (/* binding */ progress),\n/* harmony export */ prompt: () => (/* binding */ prompt)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var smalltalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! smalltalk */ \"./node_modules/smalltalk/lib/smalltalk.js\");\n\n\nconst title = 'Cloud Commander';\nconst alert = (...a) => smalltalk__WEBPACK_IMPORTED_MODULE_1__.alert(title, ...a, {\n cancel: false\n});\nconst prompt = (...a) => (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(smalltalk__WEBPACK_IMPORTED_MODULE_1__.prompt, title, ...a);\nconst confirm = (...a) => (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(smalltalk__WEBPACK_IMPORTED_MODULE_1__.confirm, title, ...a);\nconst progress = (...a) => smalltalk__WEBPACK_IMPORTED_MODULE_1__.progress(title, ...a);\nalert.noFiles = () => {\n return smalltalk__WEBPACK_IMPORTED_MODULE_1__.alert(title, 'No files selected!', {\n cancel: false\n });\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/dialog.js\n}");
74
74
 
75
75
  /***/ },
76
76
 
77
- /***/ "./client/dom/directory.mjs"
78
- /*!**********************************!*\
79
- !*** ./client/dom/directory.mjs ***!
80
- \**********************************/
77
+ /***/ "./client/dom/directory.js"
78
+ /*!*********************************!*\
79
+ !*** ./client/dom/directory.js ***!
80
+ \*********************************/
81
81
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
82
82
 
83
83
  "use strict";
84
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ uploadDirectory: () => (/* binding */ uploadDirectory)\n/* harmony export */ });\n/* harmony import */ var philip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! philip */ \"./node_modules/philip/lib/philip.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* global DOM, CloudCmd */\n\n\n\n\nconst uploadDirectory = items => {\n if (items.length) _dom_images__WEBPACK_IMPORTED_MODULE_3__.show('top');\n const entries = Array.from(items).map(item => item.webkitGetAsEntry());\n const dirPath = DOM.getCurrentDirPath();\n const path = dirPath.replace(/\\/$/, '');\n const progress = _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.progress('Uploading...');\n progress.catch(() => {\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert('Upload aborted');\n uploader.abort();\n });\n const uploader = philip__WEBPACK_IMPORTED_MODULE_0__(entries, (type, name, data, i, n, callback) => {\n const {\n prefixURL\n } = CloudCmd;\n const full = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_2__.FS + path + name;\n let upload;\n switch (type) {\n case 'file':\n upload = uploadFile(full, data);\n break;\n case 'directory':\n upload = uploadDir(full);\n break;\n }\n upload.on('end', callback);\n upload.on('progress', count => {\n const current = percent(i, n);\n const next = percent(i + 1, n);\n const max = next - current;\n const value = current + percent(count, 100, max);\n progress.setProgress(value);\n });\n });\n uploader.on('error', error => {\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert(error);\n uploader.abort();\n });\n uploader.on('end', CloudCmd.refresh);\n};\nconst percent = (i, n, per = 100) => Math.round(i * per / n);\nconst uploadFile = (url, data) => DOM.load.put(url, data);\nconst uploadDir = url => DOM.load.put(`${url}?dir`);\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/directory.mjs\n}");
84
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ uploadDirectory: () => (/* binding */ uploadDirectory)\n/* harmony export */ });\n/* harmony import */ var philip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! philip */ \"./node_modules/philip/lib/philip.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* global DOM, CloudCmd */\n\n\n\n\nconst uploadDirectory = items => {\n if (items.length) _dom_images__WEBPACK_IMPORTED_MODULE_3__.show('top');\n const entries = Array.from(items).map(item => item.webkitGetAsEntry());\n const dirPath = DOM.getCurrentDirPath();\n const path = dirPath.replace(/\\/$/, '');\n const progress = _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.progress('Uploading...');\n progress.catch(() => {\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert('Upload aborted');\n uploader.abort();\n });\n const uploader = philip__WEBPACK_IMPORTED_MODULE_0__(entries, (type, name, data, i, n, callback) => {\n const {\n prefixURL\n } = CloudCmd;\n const full = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_2__.FS + path + name;\n let upload;\n switch (type) {\n case 'file':\n upload = uploadFile(full, data);\n break;\n case 'directory':\n upload = uploadDir(full);\n break;\n }\n upload.on('end', callback);\n upload.on('progress', count => {\n const current = percent(i, n);\n const next = percent(i + 1, n);\n const max = next - current;\n const value = current + percent(count, 100, max);\n progress.setProgress(value);\n });\n });\n uploader.on('error', error => {\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert(error);\n uploader.abort();\n });\n uploader.on('end', CloudCmd.refresh);\n};\nconst percent = (i, n, per = 100) => Math.round(i * per / n);\nconst uploadFile = (url, data) => DOM.load.put(url, data);\nconst uploadDir = url => DOM.load.put(`${url}?dir`);\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/directory.js\n}");
85
85
 
86
86
  /***/ },
87
87
 
88
- /***/ "./client/dom/dom-tree.mjs"
89
- /*!*********************************!*\
90
- !*** ./client/dom/dom-tree.mjs ***!
91
- \*********************************/
88
+ /***/ "./client/dom/dom-tree.js"
89
+ /*!********************************!*\
90
+ !*** ./client/dom/dom-tree.js ***!
91
+ \********************************/
92
92
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
93
93
 
94
94
  "use strict";
95
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getByClass: () => (/* binding */ getByClass),\n/* harmony export */ getByClassAll: () => (/* binding */ getByClassAll),\n/* harmony export */ getByDataName: () => (/* binding */ getByDataName),\n/* harmony export */ getById: () => (/* binding */ getById),\n/* harmony export */ getByTag: () => (/* binding */ getByTag),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ isContainClass: () => (/* binding */ isContainClass),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst DOM = {\n show,\n hide,\n getByClass,\n getByClassAll,\n getByDataName,\n getById,\n getByTag,\n isContainClass\n};\n\n/**\n * check class of element\n *\n * @param element\n * @param className\n */\nfunction isContainClass(element, className) {\n if (!element) throw Error('element could not be empty!');\n if (!className) throw Error('className could not be empty!');\n if (Array.isArray(className)) return className.some(currify__WEBPACK_IMPORTED_MODULE_0__(isContainClass, element));\n const {\n classList\n } = element;\n return classList.contains(className);\n}\n\n/**\n * Function search element by tag\n * @param tag - className\n * @param element - element\n */\nfunction getByTag(tag, element = document) {\n return element.getElementsByTagName(tag);\n}\n\n/**\n * Function search element by id\n * @param id\n * @param element\n */\nfunction getById(id, element = document) {\n return element.querySelector(`#${id}`);\n}\n\n/**\n * Function search first element by class name\n * @param className - className\n * @param element - element\n */\nfunction getByClass(className, element = document) {\n return DOM.getByClassAll(className, element)[0];\n}\nfunction getByDataName(attribute, element = document) {\n const selector = '[' + 'data-name=\"' + attribute + '\"]';\n return element.querySelector(selector);\n}\n\n/**\n * Function search element by class name\n * @param className\n * @param element\n */\nfunction getByClassAll(className, element) {\n return (element || document).getElementsByClassName(className);\n}\n\n/**\n * add class=hidden to element\n *\n * @param element\n */\nfunction hide(element) {\n element.classList.add('hidden');\n return DOM;\n}\nfunction show(element) {\n element.classList.remove('hidden');\n return DOM;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/dom-tree.mjs\n}");
95
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getByClass: () => (/* binding */ getByClass),\n/* harmony export */ getByClassAll: () => (/* binding */ getByClassAll),\n/* harmony export */ getByDataName: () => (/* binding */ getByDataName),\n/* harmony export */ getById: () => (/* binding */ getById),\n/* harmony export */ getByTag: () => (/* binding */ getByTag),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ isContainClass: () => (/* binding */ isContainClass),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst DOM = {\n show,\n hide,\n getByClass,\n getByClassAll,\n getByDataName,\n getById,\n getByTag,\n isContainClass\n};\n\n/**\n * check class of element\n *\n * @param element\n * @param className\n */\nfunction isContainClass(element, className) {\n if (!element) throw Error('element could not be empty!');\n if (!className) throw Error('className could not be empty!');\n if (Array.isArray(className)) return className.some(currify__WEBPACK_IMPORTED_MODULE_0__(isContainClass, element));\n const {\n classList\n } = element;\n return classList.contains(className);\n}\n\n/**\n * Function search element by tag\n * @param tag - className\n * @param element - element\n */\nfunction getByTag(tag, element = document) {\n return element.getElementsByTagName(tag);\n}\n\n/**\n * Function search element by id\n * @param id\n * @param element\n */\nfunction getById(id, element = document) {\n return element.querySelector(`#${id}`);\n}\n\n/**\n * Function search first element by class name\n * @param className - className\n * @param element - element\n */\nfunction getByClass(className, element = document) {\n return DOM.getByClassAll(className, element)[0];\n}\nfunction getByDataName(attribute, element = document) {\n const selector = '[' + 'data-name=\"' + attribute + '\"]';\n return element.querySelector(selector);\n}\n\n/**\n * Function search element by class name\n * @param className\n * @param element\n */\nfunction getByClassAll(className, element) {\n return (element || document).getElementsByClassName(className);\n}\n\n/**\n * add class=hidden to element\n *\n * @param element\n */\nfunction hide(element) {\n element.classList.add('hidden');\n return DOM;\n}\nfunction show(element) {\n element.classList.remove('hidden');\n return DOM;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/dom-tree.js\n}");
96
96
 
97
97
  /***/ },
98
98
 
@@ -100,54 +100,54 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
100
100
  /*!******************************************!*\
101
101
  !*** ./client/dom/events/event-store.js ***!
102
102
  \******************************************/
103
- (module) {
103
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
104
104
 
105
105
  "use strict";
106
- eval("{\n\nlet list = [];\nmodule.exports.add = (el, name, fn) => {\n list.push([el, name, fn]);\n};\nmodule.exports.clear = () => {\n list = [];\n};\nmodule.exports.get = () => list;\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/events/event-store.js\n}");
106
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ add: () => (/* binding */ add),\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ get: () => (/* binding */ get)\n/* harmony export */ });\nlet list = [];\nconst add = (el, name, fn) => {\n list.push([el, name, fn]);\n};\nconst clear = () => {\n list = [];\n};\nconst get = () => list;\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/events/event-store.js\n}");
107
107
 
108
108
  /***/ },
109
109
 
110
- /***/ "./client/dom/events/index.mjs"
111
- /*!*************************************!*\
112
- !*** ./client/dom/events/index.mjs ***!
113
- \*************************************/
110
+ /***/ "./client/dom/events/index.js"
111
+ /*!************************************!*\
112
+ !*** ./client/dom/events/index.js ***!
113
+ \************************************/
114
114
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
115
115
 
116
116
  "use strict";
117
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ add: () => (/* binding */ add),\n/* harmony export */ addClick: () => (/* binding */ addClick),\n/* harmony export */ addContextMenu: () => (/* binding */ addContextMenu),\n/* harmony export */ addKey: () => (/* binding */ addKey),\n/* harmony export */ addLoad: () => (/* binding */ addLoad),\n/* harmony export */ addOnce: () => (/* binding */ addOnce),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ removeAll: () => (/* binding */ removeAll),\n/* harmony export */ rmClick: () => (/* binding */ rmClick),\n/* harmony export */ rmKey: () => (/* binding */ rmKey)\n/* harmony export */ });\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var _event_store_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./event-store.js */ \"./client/dom/events/event-store.js\");\n\n\n\n/**\n * safe add event listener\n *\n * @param type\n * @param element - document by default\n * @param listener\n */\nconst add = (type, element, listener) => {\n checkType(type);\n parseArgs(type, element, listener, (element, args) => {\n const [name, fn, options] = args;\n element.addEventListener(name, fn, options);\n _event_store_js__WEBPACK_IMPORTED_MODULE_1__.add(element, name, fn);\n });\n return Events;\n};\n\n/**\n * safe add event listener\n *\n * @param type\n * @param listener\n * @param element - document by default\n */\nconst addOnce = (type, element, listener) => {\n const once = event => {\n Events.remove(type, element, once);\n listener(event);\n };\n if (!listener) {\n listener = element;\n element = null;\n }\n add(type, element, once);\n return Events;\n};\n\n/**\n * safe remove event listener\n *\n * @param type\n * @param listener\n * @param element - document by default\n */\nconst remove = (type, element, listener) => {\n checkType(type);\n parseArgs(type, element, listener, (element, args) => {\n element.removeEventListener(...args);\n });\n return Events;\n};\n\n/**\n * remove all added event listeners\n */\nconst removeAll = () => {\n const events = _event_store_js__WEBPACK_IMPORTED_MODULE_1__.get();\n for (const [el, name, fn] of events) el.removeEventListener(name, fn);\n _event_store_js__WEBPACK_IMPORTED_MODULE_1__.clear();\n};\n\n/**\n * safe add event keydown listener\n *\n * @param args\n */\nconst addKey = function (...args) {\n return add('keydown', ...args);\n};\n\n/**\n * safe remove event click listener\n *\n * @param args\n */\nconst rmKey = function (...args) {\n return Events.remove('keydown', ...args);\n};\n\n/**\n * safe add event click listener\n */\nconst addClick = function (...args) {\n return Events.add('click', ...args);\n};\n\n/**\n * safe remove event click listener\n */\nconst rmClick = function (...args) {\n return remove('click', ...args);\n};\nconst addContextMenu = function (...args) {\n return add('contextmenu', ...args);\n};\n\n/**\n * safe add load listener\n */\nconst addLoad = function (...args) {\n return add('load', ...args);\n};\nfunction checkType(type) {\n if (!type) throw Error('type could not be empty!');\n}\nconst getEventOptions = eventName => {\n if (eventName !== 'touchstart') return false;\n return {\n passive: true\n };\n};\nfunction parseArgs(eventName, element, listener, callback) {\n let isFunc;\n const args = [eventName, element, listener, callback];\n const EVENT_NAME = 1;\n const ELEMENT = 0;\n const type = itype__WEBPACK_IMPORTED_MODULE_0__(eventName);\n switch (type) {\n default:\n if (!type.endsWith('element')) throw Error(`unknown eventName: ${type}`);\n parseArgs(args[EVENT_NAME], args[ELEMENT], listener, callback);\n break;\n case 'string':\n isFunc = itype__WEBPACK_IMPORTED_MODULE_0__[\"function\"](element);\n if (isFunc) {\n listener = element;\n element = null;\n }\n if (!element) element = window;\n callback(element, [eventName, listener, getEventOptions(eventName)]);\n break;\n case 'array':\n for (const name of eventName) {\n parseArgs(name, element, listener, callback);\n }\n break;\n case 'object':\n for (const name of Object.keys(eventName)) {\n const eventListener = eventName[name];\n parseArgs(name, element, eventListener, callback);\n }\n break;\n }\n}\nconst Events = {\n add,\n addClick,\n addContextMenu,\n addKey,\n addLoad,\n addOnce,\n remove,\n removeAll,\n rmClick,\n rmKey\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/events/index.mjs\n}");
117
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ add: () => (/* binding */ add),\n/* harmony export */ addClick: () => (/* binding */ addClick),\n/* harmony export */ addContextMenu: () => (/* binding */ addContextMenu),\n/* harmony export */ addKey: () => (/* binding */ addKey),\n/* harmony export */ addLoad: () => (/* binding */ addLoad),\n/* harmony export */ addOnce: () => (/* binding */ addOnce),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ removeAll: () => (/* binding */ removeAll),\n/* harmony export */ rmClick: () => (/* binding */ rmClick),\n/* harmony export */ rmKey: () => (/* binding */ rmKey)\n/* harmony export */ });\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var _event_store_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./event-store.js */ \"./client/dom/events/event-store.js\");\n\n\n\n/**\n * safe add event listener\n *\n * @param type\n * @param element - document by default\n * @param listener\n */\nconst add = (type, element, listener) => {\n checkType(type);\n parseArgs(type, element, listener, (element, args) => {\n const [name, fn, options] = args;\n element.addEventListener(name, fn, options);\n _event_store_js__WEBPACK_IMPORTED_MODULE_1__.add(element, name, fn);\n });\n return Events;\n};\n\n/**\n * safe add event listener\n *\n * @param type\n * @param listener\n * @param element - document by default\n */\nconst addOnce = (type, element, listener) => {\n const once = event => {\n Events.remove(type, element, once);\n listener(event);\n };\n if (!listener) {\n listener = element;\n element = null;\n }\n add(type, element, once);\n return Events;\n};\n\n/**\n * safe remove event listener\n *\n * @param type\n * @param listener\n * @param element - document by default\n */\nconst remove = (type, element, listener) => {\n checkType(type);\n parseArgs(type, element, listener, (element, args) => {\n element.removeEventListener(...args);\n });\n return Events;\n};\n\n/**\n * remove all added event listeners\n */\nconst removeAll = () => {\n const events = _event_store_js__WEBPACK_IMPORTED_MODULE_1__.get();\n for (const [el, name, fn] of events) el.removeEventListener(name, fn);\n _event_store_js__WEBPACK_IMPORTED_MODULE_1__.clear();\n};\n\n/**\n * safe add event keydown listener\n *\n * @param args\n */\nconst addKey = function (...args) {\n return add('keydown', ...args);\n};\n\n/**\n * safe remove event click listener\n *\n * @param args\n */\nconst rmKey = function (...args) {\n return Events.remove('keydown', ...args);\n};\n\n/**\n * safe add event click listener\n */\nconst addClick = function (...args) {\n return Events.add('click', ...args);\n};\n\n/**\n * safe remove event click listener\n */\nconst rmClick = function (...args) {\n return remove('click', ...args);\n};\nconst addContextMenu = function (...args) {\n return add('contextmenu', ...args);\n};\n\n/**\n * safe add load listener\n */\nconst addLoad = function (...args) {\n return add('load', ...args);\n};\nfunction checkType(type) {\n if (!type) throw Error('type could not be empty!');\n}\nconst getEventOptions = eventName => {\n if (eventName !== 'touchstart') return false;\n return {\n passive: true\n };\n};\nfunction parseArgs(eventName, element, listener, callback) {\n let isFunc;\n const args = [eventName, element, listener, callback];\n const EVENT_NAME = 1;\n const ELEMENT = 0;\n const type = itype__WEBPACK_IMPORTED_MODULE_0__(eventName);\n switch (type) {\n default:\n if (!type.endsWith('element')) throw Error(`unknown eventName: ${type}`);\n parseArgs(args[EVENT_NAME], args[ELEMENT], listener, callback);\n break;\n case 'string':\n isFunc = itype__WEBPACK_IMPORTED_MODULE_0__[\"function\"](element);\n if (isFunc) {\n listener = element;\n element = null;\n }\n if (!element) element = window;\n callback(element, [eventName, listener, getEventOptions(eventName)]);\n break;\n case 'array':\n for (const name of eventName) {\n parseArgs(name, element, listener, callback);\n }\n break;\n case 'object':\n for (const name of Object.keys(eventName)) {\n const eventListener = eventName[name];\n parseArgs(name, element, eventListener, callback);\n }\n break;\n }\n}\nconst Events = {\n add,\n addClick,\n addContextMenu,\n addKey,\n addLoad,\n addOnce,\n remove,\n removeAll,\n rmClick,\n rmKey\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/events/index.js\n}");
118
118
 
119
119
  /***/ },
120
120
 
121
- /***/ "./client/dom/files.mjs"
122
- /*!******************************!*\
123
- !*** ./client/dom/files.mjs ***!
124
- \******************************/
121
+ /***/ "./client/dom/files.js"
122
+ /*!*****************************!*\
123
+ !*** ./client/dom/files.js ***!
124
+ \*****************************/
125
125
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
126
126
 
127
127
  "use strict";
128
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ get: () => (/* binding */ get)\n/* harmony export */ });\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\n/* global CloudCmd */\n\n\n\n\nconst Promises = {};\nconst FILES_JSON = 'config|modules';\nconst FILES_HTML = 'file|path|link|pathLink|media';\nconst FILES_HTML_ROOT = 'view/media-tmpl|config-tmpl|upload';\nconst DIR_HTML = '/tmpl/';\nconst DIR_HTML_FS = `${DIR_HTML}fs/`;\nconst DIR_JSON = '/json/';\nconst timeout = getTimeoutOnce(2000);\nconst get = getFile;\nfunction getFile(name) {\n const type = itype__WEBPACK_IMPORTED_MODULE_0__(name);\n check(name);\n if (type === 'string') return getModule(name);\n if (type === 'array') return Promise.all(name.map(getFile));\n}\nfunction check(name) {\n if (!name) throw Error('name could not be empty!');\n}\nfunction getModule(name) {\n const regExpHTML = RegExp(FILES_HTML + '|' + FILES_HTML_ROOT);\n const regExpJSON = RegExp(FILES_JSON);\n const isHTML = regExpHTML.test(name);\n const isJSON = regExpJSON.test(name);\n if (!isHTML && !isJSON) return showError(name);\n if (name === 'config') return getConfig();\n const path = getPath(name, isHTML, isJSON);\n return getSystemFile(path);\n}\nfunction getPath(name, isHTML, isJSON) {\n let path;\n const regExp = RegExp(FILES_HTML_ROOT);\n const isRoot = regExp.test(name);\n if (isHTML) {\n if (isRoot) path = DIR_HTML + name.replace('-tmpl', '');else path = DIR_HTML_FS + name;\n path += '.hbs';\n } else if (isJSON) {\n path = DIR_JSON + name + '.json';\n }\n return path;\n}\nfunction showError(name) {\n const str = `Wrong file name: ${name}`;\n const error = Error(str);\n throw error;\n}\nconst getSystemFile = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_1__.promisify)((file, callback) => {\n const {\n prefix\n } = CloudCmd;\n if (!Promises[file]) Promises[file] = new Promise((success, error) => {\n const url = prefix + file;\n _dom_load__WEBPACK_IMPORTED_MODULE_2__.ajax({\n url,\n success,\n error\n });\n });\n Promises[file].then(data => {\n callback(null, data);\n }, error => {\n Promises[file] = null;\n callback(error);\n });\n});\nconst getConfig = async () => {\n let is;\n if (!Promises.config) Promises.config = () => {\n is = true;\n return _dom_rest__WEBPACK_IMPORTED_MODULE_3__.Config.read();\n };\n const [, data] = await Promises.config();\n if (data) is = false;\n timeout(() => {\n if (!is) Promises.config = null;\n });\n return data;\n};\nfunction getTimeoutOnce(time) {\n let is;\n return callback => {\n if (is) return;\n is = true;\n setTimeout(() => {\n is = false;\n callback();\n }, time);\n };\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/files.mjs\n}");
128
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ get: () => (/* binding */ get)\n/* harmony export */ });\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.js\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.js\");\n/* global CloudCmd */\n\n\n\n\nconst Promises = {};\nconst FILES_JSON = 'config|modules';\nconst FILES_HTML = 'file|path|link|pathLink|media';\nconst FILES_HTML_ROOT = 'view/media-tmpl|config-tmpl|upload';\nconst DIR_HTML = '/tmpl/';\nconst DIR_HTML_FS = `${DIR_HTML}fs/`;\nconst DIR_JSON = '/json/';\nconst timeout = getTimeoutOnce(2000);\nconst get = getFile;\nfunction getFile(name) {\n const type = itype__WEBPACK_IMPORTED_MODULE_0__(name);\n check(name);\n if (type === 'string') return getModule(name);\n if (type === 'array') return Promise.all(name.map(getFile));\n}\nfunction check(name) {\n if (!name) throw Error('name could not be empty!');\n}\nfunction getModule(name) {\n const regExpHTML = RegExp(FILES_HTML + '|' + FILES_HTML_ROOT);\n const regExpJSON = RegExp(FILES_JSON);\n const isHTML = regExpHTML.test(name);\n const isJSON = regExpJSON.test(name);\n if (!isHTML && !isJSON) return showError(name);\n if (name === 'config') return getConfig();\n const path = getPath(name, isHTML, isJSON);\n return getSystemFile(path);\n}\nfunction getPath(name, isHTML, isJSON) {\n let path;\n const regExp = RegExp(FILES_HTML_ROOT);\n const isRoot = regExp.test(name);\n if (isHTML) {\n if (isRoot) path = DIR_HTML + name.replace('-tmpl', '');else path = DIR_HTML_FS + name;\n path += '.hbs';\n } else if (isJSON) {\n path = DIR_JSON + name + '.json';\n }\n return path;\n}\nfunction showError(name) {\n const str = `Wrong file name: ${name}`;\n const error = Error(str);\n throw error;\n}\nconst getSystemFile = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_1__.promisify)((file, callback) => {\n const {\n prefix\n } = CloudCmd;\n if (!Promises[file]) Promises[file] = new Promise((success, error) => {\n const url = prefix + file;\n _dom_load__WEBPACK_IMPORTED_MODULE_2__.ajax({\n url,\n success,\n error\n });\n });\n Promises[file].then(data => {\n callback(null, data);\n }, error => {\n Promises[file] = null;\n callback(error);\n });\n});\nconst getConfig = async () => {\n let is;\n if (!Promises.config) Promises.config = () => {\n is = true;\n return _dom_rest__WEBPACK_IMPORTED_MODULE_3__.Config.read();\n };\n const [, data] = await Promises.config();\n if (data) is = false;\n timeout(() => {\n if (!is) Promises.config = null;\n });\n return data;\n};\nfunction getTimeoutOnce(time) {\n let is;\n return callback => {\n if (is) return;\n is = true;\n setTimeout(() => {\n is = false;\n callback();\n }, time);\n };\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/files.js\n}");
129
129
 
130
130
  /***/ },
131
131
 
132
- /***/ "./client/dom/images.mjs"
133
- /*!*******************************!*\
134
- !*** ./client/dom/images.mjs ***!
135
- \*******************************/
132
+ /***/ "./client/dom/images.js"
133
+ /*!******************************!*\
134
+ !*** ./client/dom/images.js ***!
135
+ \******************************/
136
136
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
137
137
 
138
138
  "use strict";
139
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clearProgress: () => (/* binding */ clearProgress),\n/* harmony export */ error: () => (/* binding */ error),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ loading: () => (/* binding */ loading),\n/* harmony export */ setProgress: () => (/* binding */ setProgress),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* global DOM */\n\nconst LOADING = 'loading';\nconst HIDDEN = 'hidden';\nconst ERROR = 'error';\nconst getLoadingType = () => isSVG() ? '-svg' : '-gif';\nconst get = getElement;\n\n/**\n * check SVG SMIL animation support\n */\nfunction isSVG() {\n const createNS = document.createElementNS;\n const SVG_URL = 'http://www.w3.org/2000/svg';\n if (!createNS) return false;\n const create = createNS.bind(document);\n const svgNode = create(SVG_URL, 'animate');\n const name = svgNode.toString();\n return /SVGAnimate/.test(name);\n}\nfunction getElement() {\n return _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('span', {\n id: 'js-status-image',\n className: 'icon',\n dataName: 'progress',\n notAppend: true\n });\n}\n\n/* Функция создаёт картинку загрузки */\nconst loading = () => {\n const element = getElement();\n const {\n classList\n } = element;\n const loadingImage = LOADING + getLoadingType();\n classList.add(LOADING, loadingImage);\n classList.remove(ERROR, HIDDEN);\n return element;\n};\n\n/* Функция создаёт картинку ошибки загрузки */\nconst error = () => {\n const element = getElement();\n const {\n classList\n } = element;\n const loadingImage = LOADING + getLoadingType();\n classList.add(ERROR);\n classList.remove(HIDDEN, LOADING, loadingImage);\n return element;\n};\nshow.load = show;\nshow.error = text => {\n const image = Images.error();\n DOM.show(image);\n image.title = text;\n return image;\n};\n\n/**\n* Function shows loading spinner\n* position = {top: true};\n*/\nfunction show(position, panel) {\n const image = Images.loading();\n const parent = image.parentElement;\n const refreshButton = DOM.getRefreshButton(panel);\n let current;\n if (position === 'top') {\n current = refreshButton.parentElement;\n } else {\n current = DOM.getCurrentFile();\n if (current) current = DOM.getByDataName('js-name', current);else current = refreshButton.parentElement;\n }\n if (!parent || parent && parent !== current) current.appendChild(image);\n DOM.show(image);\n return image;\n}\n\n/**\n* hide load image\n*/\nconst hide = () => {\n const element = Images.get();\n DOM.hide(element);\n return Images;\n};\nconst setProgress = (value, title) => {\n const DATA = 'data-progress';\n const element = Images.get();\n if (!element) return Images;\n element.setAttribute(DATA, `${value}%`);\n if (title) element.title = title;\n return Images;\n};\nconst clearProgress = () => {\n const DATA = 'data-progress';\n const element = Images.get();\n if (!element) return Images;\n element.setAttribute(DATA, '');\n element.title = '';\n return Images;\n};\nconst Images = {\n clearProgress,\n setProgress,\n show,\n hide,\n get,\n error,\n loading\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/images.mjs\n}");
139
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clearProgress: () => (/* binding */ clearProgress),\n/* harmony export */ error: () => (/* binding */ error),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ loading: () => (/* binding */ loading),\n/* harmony export */ setProgress: () => (/* binding */ setProgress),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* global DOM */\n\nconst LOADING = 'loading';\nconst HIDDEN = 'hidden';\nconst ERROR = 'error';\nconst getLoadingType = () => isSVG() ? '-svg' : '-gif';\nconst get = getElement;\n\n/**\n * check SVG SMIL animation support\n */\nfunction isSVG() {\n const createNS = document.createElementNS;\n const SVG_URL = 'http://www.w3.org/2000/svg';\n if (!createNS) return false;\n const create = createNS.bind(document);\n const svgNode = create(SVG_URL, 'animate');\n const name = svgNode.toString();\n return /SVGAnimate/.test(name);\n}\nfunction getElement() {\n return _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('span', {\n id: 'js-status-image',\n className: 'icon',\n dataName: 'progress',\n notAppend: true\n });\n}\n\n/* Функция создаёт картинку загрузки */\nconst loading = () => {\n const element = getElement();\n const {\n classList\n } = element;\n const loadingImage = LOADING + getLoadingType();\n classList.add(LOADING, loadingImage);\n classList.remove(ERROR, HIDDEN);\n return element;\n};\n\n/* Функция создаёт картинку ошибки загрузки */\nconst error = () => {\n const element = getElement();\n const {\n classList\n } = element;\n const loadingImage = LOADING + getLoadingType();\n classList.add(ERROR);\n classList.remove(HIDDEN, LOADING, loadingImage);\n return element;\n};\nshow.load = show;\nshow.error = text => {\n const image = Images.error();\n DOM.show(image);\n image.title = text;\n return image;\n};\n\n/**\n* Function shows loading spinner\n* position = {top: true};\n*/\nfunction show(position, panel) {\n const image = Images.loading();\n const parent = image.parentElement;\n const refreshButton = DOM.getRefreshButton(panel);\n let current;\n if (position === 'top') {\n current = refreshButton.parentElement;\n } else {\n current = DOM.getCurrentFile();\n if (current) current = DOM.getByDataName('js-name', current);else current = refreshButton.parentElement;\n }\n if (!parent || parent && parent !== current) current.appendChild(image);\n DOM.show(image);\n return image;\n}\n\n/**\n* hide load image\n*/\nfunction hide() {\n const element = Images.get();\n DOM.hide(element);\n return Images;\n}\nconst setProgress = (value, title) => {\n const DATA = 'data-progress';\n const element = Images.get();\n if (!element) return Images;\n element.setAttribute(DATA, `${value}%`);\n if (title) element.title = title;\n return Images;\n};\nconst clearProgress = () => {\n const DATA = 'data-progress';\n const element = Images.get();\n if (!element) return Images;\n element.setAttribute(DATA, '');\n element.title = '';\n return Images;\n};\nconst Images = {\n clearProgress,\n setProgress,\n show,\n hide,\n get,\n error,\n loading\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/images.js\n}");
140
140
 
141
141
  /***/ },
142
142
 
143
- /***/ "./client/dom/index.mjs"
144
- /*!******************************!*\
145
- !*** ./client/dom/index.mjs ***!
146
- \******************************/
143
+ /***/ "./client/dom/index.js"
144
+ /*!*****************************!*\
145
+ !*** ./client/dom/index.js ***!
146
+ \*****************************/
147
147
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
148
148
 
149
149
  "use strict";
150
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CurrentInfo: () => (/* binding */ CurrentInfo),\n/* harmony export */ changePanel: () => (/* binding */ changePanel),\n/* harmony export */ checkStorageHash: () => (/* binding */ checkStorageHash),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ deleteCurrent: () => (/* binding */ deleteCurrent),\n/* harmony export */ deleteSelected: () => (/* binding */ deleteSelected),\n/* harmony export */ duplicatePanel: () => (/* binding */ duplicatePanel),\n/* harmony export */ expandSelection: () => (/* binding */ expandSelection),\n/* harmony export */ getActiveFiles: () => (/* binding */ getActiveFiles),\n/* harmony export */ getAllFiles: () => (/* binding */ getAllFiles),\n/* harmony export */ getCSSVar: () => (/* binding */ getCSSVar),\n/* harmony export */ getCurrentData: () => (/* binding */ getCurrentData),\n/* harmony export */ getCurrentDate: () => (/* binding */ getCurrentDate),\n/* harmony export */ getCurrentDirName: () => (/* binding */ getCurrentDirName),\n/* harmony export */ getCurrentLink: () => (/* binding */ getCurrentLink),\n/* harmony export */ getCurrentMode: () => (/* binding */ getCurrentMode),\n/* harmony export */ getCurrentOwner: () => (/* binding */ getCurrentOwner),\n/* harmony export */ getCurrentSize: () => (/* binding */ getCurrentSize),\n/* harmony export */ getFM: () => (/* binding */ getFM),\n/* harmony export */ getFilenames: () => (/* binding */ getFilenames),\n/* harmony export */ getFiles: () => (/* binding */ getFiles),\n/* harmony export */ getNotCurrentDirPath: () => (/* binding */ getNotCurrentDirPath),\n/* harmony export */ getPackerExt: () => (/* binding */ getPackerExt),\n/* harmony export */ getPanel: () => (/* binding */ getPanel),\n/* harmony export */ getPanelPosition: () => (/* binding */ getPanelPosition),\n/* harmony export */ getParentDirPath: () => (/* binding */ getParentDirPath),\n/* harmony export */ getRefreshButton: () => (/* binding */ getRefreshButton),\n/* harmony export */ goToDirectory: () => (/* binding */ goToDirectory),\n/* harmony export */ hidePanel: () => (/* binding */ hidePanel),\n/* harmony export */ loadCurrentHash: () => (/* binding */ loadCurrentHash),\n/* harmony export */ loadCurrentSize: () => (/* binding */ loadCurrentSize),\n/* harmony export */ loadRemote: () => (/* binding */ loadRemote),\n/* harmony export */ loadSocket: () => (/* binding */ loadSocket),\n/* harmony export */ promptNewDir: () => (/* binding */ promptNewDir),\n/* harmony export */ promptNewFile: () => (/* binding */ promptNewFile),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ saveDataToStorage: () => (/* binding */ saveDataToStorage),\n/* harmony export */ scrollByPages: () => (/* binding */ scrollByPages),\n/* harmony export */ scrollIntoViewIfNeeded: () => (/* binding */ scrollIntoViewIfNeeded),\n/* harmony export */ setCurrentSize: () => (/* binding */ setCurrentSize),\n/* harmony export */ setHistory: () => (/* binding */ setHistory),\n/* harmony export */ showPanel: () => (/* binding */ showPanel),\n/* harmony export */ shrinkSelection: () => (/* binding */ shrinkSelection),\n/* harmony export */ swapPanels: () => (/* binding */ swapPanels),\n/* harmony export */ unselectFiles: () => (/* binding */ unselectFiles),\n/* harmony export */ updateCurrentInfo: () => (/* binding */ updateCurrentInfo)\n/* harmony export */ });\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _dom_storage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/storage */ \"./client/dom/storage.mjs\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _operations_rename_current_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./operations/rename-current.mjs */ \"./client/dom/operations/rename-current.mjs\");\n/* harmony import */ var _current_file_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./current-file.mjs */ \"./client/dom/current-file.mjs\");\n/* harmony import */ var _dom_tree_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./dom-tree.mjs */ \"./client/dom/dom-tree.mjs\");\n/* harmony import */ var _cmd_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./cmd.mjs */ \"./client/dom/cmd.mjs\");\n/* harmony import */ var _io_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./io/index.js */ \"./client/dom/io/index.js\");\n/* harmony import */ var _directory_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./directory.mjs */ \"./client/dom/directory.mjs\");\n/* harmony import */ var _buffer_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./buffer.mjs */ \"./client/dom/buffer.mjs\");\n/* harmony import */ var _load_remote_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./load-remote.mjs */ \"./client/dom/load-remote.mjs\");\n/* harmony import */ var _select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./select-by-pattern.mjs */ \"./client/dom/select-by-pattern.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n assign\n} = Object;\nconst DOM = {\n getCurrentDirName,\n getNotCurrentDirPath,\n getParentDirPath,\n loadRemote,\n loadSocket,\n promptNewDir,\n promptNewFile,\n unselectFiles,\n getActiveFiles,\n getCurrentDate,\n getCurrentSize,\n loadCurrentSize,\n loadCurrentHash,\n setCurrentSize,\n getCurrentMode,\n getCurrentOwner,\n getCurrentData,\n getRefreshButton,\n getAllFiles,\n expandSelection,\n shrinkSelection,\n setHistory,\n getCurrentLink,\n getFilenames,\n checkStorageHash,\n saveDataToStorage,\n getFM,\n getPanelPosition,\n getCSSVar,\n getPanel,\n getFiles,\n showPanel,\n hidePanel,\n remove,\n deleteCurrent,\n deleteSelected,\n renameCurrent: _operations_rename_current_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n scrollIntoViewIfNeeded,\n scrollByPages,\n changePanel,\n getPackerExt,\n goToDirectory,\n duplicatePanel,\n swapPanels,\n updateCurrentInfo\n};\nassign(DOM, {\n ..._dom_tree_mjs__WEBPACK_IMPORTED_MODULE_10__,\n ..._current_file_mjs__WEBPACK_IMPORTED_MODULE_9__,\n ..._cmd_mjs__WEBPACK_IMPORTED_MODULE_11__\n});\nconst CurrentInfo = {};\nDOM.Images = _dom_images__WEBPACK_IMPORTED_MODULE_7__;\nDOM.load = _dom_load__WEBPACK_IMPORTED_MODULE_0__;\nDOM.Files = _dom_files__WEBPACK_IMPORTED_MODULE_1__;\nDOM.RESTful = _dom_rest__WEBPACK_IMPORTED_MODULE_6__;\nDOM.IO = _io_index_js__WEBPACK_IMPORTED_MODULE_12__;\nDOM.Storage = _dom_storage__WEBPACK_IMPORTED_MODULE_5__;\nDOM.Dialog = _dom_dialog__WEBPACK_IMPORTED_MODULE_2__;\nDOM.CurrentInfo = CurrentInfo;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DOM);\nDOM.uploadDirectory = _directory_mjs__WEBPACK_IMPORTED_MODULE_13__.uploadDirectory;\nDOM.Buffer = _buffer_mjs__WEBPACK_IMPORTED_MODULE_14__;\nDOM.Events = _dom_events__WEBPACK_IMPORTED_MODULE_3__;\nconst isString = a => typeof a === 'string';\nconst TabPanel = {\n 'js-left': null,\n 'js-right': null\n};\nfunction loadRemote(name, options, callback) {\n (0,_load_remote_mjs__WEBPACK_IMPORTED_MODULE_15__.loadRemote)(name, options, callback);\n return DOM;\n}\nfunction loadSocket(callback) {\n DOM.loadRemote('socket', {\n name: 'io'\n }, callback);\n return DOM;\n}\n\n/**\n * create new folder\n *\n */\nasync function promptNewDir() {\n await promptNew('directory');\n}\n\n/**\n * create new file\n *\n * @typeName\n * @type\n */\nasync function promptNewFile() {\n await promptNew('file');\n}\nasync function promptNew(typeName) {\n const {\n Dialog\n } = DOM;\n const dir = DOM.getCurrentDirPath();\n const msg = `New ${typeName}` || 'File';\n const getName = () => {\n const name = DOM.getCurrentName();\n if (name === '..') return '';\n return name;\n };\n const name = getName();\n const [cancel, currentName] = await Dialog.prompt(msg, name);\n if (cancel) return;\n const path = `${dir}${currentName}`;\n if (typeName === 'directory') await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.createDirectory(path);else await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.write(path);\n await CloudCmd.refresh({\n currentName\n });\n}\n\n/**\n * get current directory name\n */\nfunction getCurrentDirName() {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n}\n\n/**\n * get current directory path\n */\nfunction getParentDirPath(panel) {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path !== '/') return path.slice(0, index);\n return path;\n}\n\n/**\n * get not current directory path\n */\nfunction getNotCurrentDirPath() {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n}\n\n/*\n * unselect all files\n */\nfunction unselectFiles(files) {\n files = files || DOM.getSelectedFiles();\n Array.from(files).forEach(DOM.toggleSelectedFile);\n}\n\n/**\n * get all selected files or current when none selected\n *\n * @currentFile\n */\nfunction getActiveFiles() {\n const current = DOM.getCurrentFile();\n const files = DOM.getSelectedFiles();\n const name = DOM.getCurrentName(current);\n if (!files.length && name !== '..') return [current];\n return files;\n}\nfunction getCurrentDate(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n return DOM.getByDataName('js-date', current).textContent;\n}\n\n/**\n * get size\n * @currentFile\n */\nfunction getCurrentSize(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n\n /* если это папка - возвращаем слово dir вместо размера*/\n const size = DOM.getByDataName('js-size', current).textContent.replace(/^<|>$/g, '');\n return size;\n}\n\n/**\n * get size\n * @currentFile\n */\nasync function loadCurrentSize(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?size';\n const link = DOM.getCurrentPath(current);\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.show.load();\n if (name === '..') return;\n const [, size] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(link + query);\n DOM.setCurrentSize(size, current);\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.hide();\n return current;\n}\n\n/**\n * load hash\n * @callback\n * @currentFile\n */\nasync function loadCurrentHash(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?hash';\n const link = DOM.getCurrentPath(current);\n const [, data] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(link + query);\n return data;\n}\n\n/**\n * set size\n * @currentFile\n */\nfunction setCurrentSize(size, currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const sizeElement = DOM.getByDataName('js-size', current);\n sizeElement.textContent = size;\n}\n\n/**\n * @currentFile\n */\nfunction getCurrentMode(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const mode = DOM.getByDataName('js-mode', current);\n return mode.textContent;\n}\n\n/**\n * @currentFile\n */\nfunction getCurrentOwner(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const owner = DOM.getByDataName('js-owner', current);\n return owner.textContent;\n}\n\n/**\n * unified way to get current file content\n *\n * @param currentFile\n */\nasync function getCurrentData(currentFile) {\n const {\n Dialog\n } = DOM;\n const Info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const isDir = DOM.isCurrentIsDir(current);\n if (Info.name === '..') {\n Dialog.alert.noFiles();\n return [Error('No Files')];\n }\n if (isDir) return await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(path);\n const [hashNew, hash] = await DOM.checkStorageHash(path);\n if (!hashNew) return [Error(`Can't get hash of a file`)];\n if (hash === hashNew) return [null, await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.get(`${path}-data`)];\n const [e, data] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(path);\n if (e) return [e, null];\n const ONE_MEGABYTE = 1024 ** 2 * 1024;\n const {\n length\n } = data;\n if (hash && length < ONE_MEGABYTE) await DOM.saveDataToStorage(path, data, hashNew);\n return [null, data];\n}\n\n/**\n * unified way to get RefreshButton\n */\nfunction getRefreshButton(panel = DOM.getPanel()) {\n return DOM.getByDataName('js-refresh', panel);\n}\nfunction getAllFiles() {\n const panel = DOM.getPanel();\n const files = DOM.getFiles(panel);\n const name = DOM.getCurrentName(files[0]);\n const from = a => a === '..' ? 1 : 0;\n const i = from(name);\n return Array.from(files).slice(i);\n}\n\n/**\n * open dialog with expand selection\n */\nasync function expandSelection() {\n const msg = 'expand';\n const {\n files\n } = CurrentInfo;\n await (0,_select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__.selectByPattern)(msg, files);\n}\n\n/**\n * open dialog with shrink selection\n */\nasync function shrinkSelection() {\n const msg = 'shrink';\n const {\n files\n } = CurrentInfo;\n await (0,_select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__.selectByPattern)(msg, files);\n}\n\n/**\n * setting history wrapper\n */\nfunction setHistory(data, title, url) {\n const ret = globalThis.history;\n const {\n prefix\n } = CloudCmd;\n url = prefix + url;\n if (ret) history.pushState(data, title, url);\n return ret;\n}\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nfunction getCurrentLink(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const link = DOM.getByTag('a', current);\n return link[0];\n}\nfunction getFilenames(files) {\n if (!files) throw Error('AllFiles could not be empty');\n const first = files[0] || DOM.getCurrentFile();\n const name = DOM.getCurrentName(first);\n const allFiles = Array.from(files);\n if (name === '..') allFiles.shift();\n const names = allFiles.map(current => {\n return DOM.getCurrentName(current);\n });\n return names;\n}\n\n/**\n * check storage hash\n */\nasync function checkStorageHash(name) {\n const nameHash = `${name}-hash`;\n if (!isString(name)) throw Error('name should be a string!');\n const [loadHash, storeHash] = await Promise.all([DOM.loadCurrentHash(), _dom_storage__WEBPACK_IMPORTED_MODULE_5__.get(nameHash)]);\n return [loadHash, storeHash];\n}\n\n/**\n * save data to storage\n *\n * @param name\n * @param data\n * @param hash\n */\nasync function saveDataToStorage(name, data, hash) {\n const isDir = DOM.isCurrentIsDir();\n if (isDir) return;\n hash = hash || (await DOM.loadCurrentHash());\n const nameHash = `${name}-hash`;\n const nameData = `${name}-data`;\n await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.set(nameHash, hash);\n await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.set(nameData, data);\n return hash;\n}\nfunction getFM() {\n const {\n parentElement\n } = DOM.getPanel();\n return parentElement;\n}\nfunction getPanelPosition(panel) {\n panel = panel || DOM.getPanel();\n return panel.dataset.name.replace('js-', '');\n}\nfunction getCSSVar(name, {\n body = document.body\n} = {}) {\n const bodyStyle = getComputedStyle(body);\n return bodyStyle.getPropertyValue(`--${name}`);\n}\n\n/** function getting panel active, or passive\n * @param options = {active: true}\n */\nfunction getPanel(options) {\n let files;\n let panel;\n let isLeft;\n let dataName = 'js-';\n const current = DOM.getCurrentFile();\n if (!current) {\n panel = DOM.getByDataName('js-left');\n } else {\n files = current.parentElement;\n panel = files.parentElement;\n isLeft = panel.getAttribute('data-name') === 'js-left';\n }\n\n /* if {active : false} getting passive panel */\n if (options && !options.active) {\n dataName += isLeft ? 'right' : 'left';\n panel = DOM.getByDataName(dataName);\n }\n\n /* if two panels showed\n * then always work with passive\n * panel\n */\n if (globalThis.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH) panel = DOM.getByDataName('js-left');\n if (!panel) throw Error('can not find Active Panel!');\n return panel;\n}\nfunction getFiles(element) {\n const files = DOM.getByDataName('js-files', element);\n return files.children || [];\n}\n\n/**\n * shows panel right or left (or active)\n */\nfunction showPanel(active) {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n DOM.show(panel);\n return true;\n}\n\n/**\n * hides panel right or left (or active)\n */\nfunction hidePanel(active) {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n return DOM.hide(panel);\n}\n\n/**\n * remove child of element\n * @param child\n * @param element\n */\nfunction remove(child, element) {\n const parent = element || document.body;\n parent.removeChild(child);\n return DOM;\n}\n\n/**\n * remove current file from file table\n * @param current\n *\n */\nfunction deleteCurrent(current) {\n if (!current) DOM.getCurrentFile();\n const parent = current === null || current === void 0 ? void 0 : current.parentElement;\n const name = DOM.getCurrentName(current);\n if (current && name !== '..') {\n const next = current.nextSibling;\n const prev = current.previousSibling;\n DOM.setCurrentFile(next || prev);\n parent.removeChild(current);\n }\n}\n\n/**\n * remove selected files from file table\n * @Selected\n */\nfunction deleteSelected(selected) {\n selected = selected || DOM.getSelectedFiles();\n if (!selected) return;\n selected.map(DOM.deleteCurrent);\n}\n\n/**\n * rename current file\n *\n * @currentFile\n */\nfunction scrollIntoViewIfNeeded(element, center = false) {\n if (!element || !element.scrollIntoViewIfNeeded) return;\n element.scrollIntoViewIfNeeded(center);\n}\n\n/* scroll on one page */\nfunction scrollByPages(element, pPages) {\n const ret = (element === null || element === void 0 ? void 0 : element.scrollByPages) && pPages;\n if (ret) element.scrollByPages(pPages);\n return ret;\n}\nfunction changePanel() {\n const Info = CurrentInfo;\n let panel = DOM.getPanel();\n CloudCmd.emit('passive-dir', Info.dirPath);\n const panelPassive = DOM.getPanel({\n active: false\n });\n let name = DOM.getCurrentName();\n const filesPassive = DOM.getFiles(panelPassive);\n let dataName = panel.getAttribute('data-name');\n TabPanel[dataName] = name;\n panel = panelPassive;\n dataName = panel.getAttribute('data-name');\n name = TabPanel[dataName];\n let files;\n let current;\n if (name) {\n current = DOM.getCurrentByName(name, panel);\n if (current) files = current.parentElement;\n }\n if (!files || !files.parentElement) {\n current = DOM.getCurrentByName(name, panel);\n if (!current) [current] = filesPassive;\n }\n DOM.setCurrentFile(current, {\n history: true\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n return DOM;\n}\nfunction getPackerExt(type) {\n if (type === 'zip') return '.zip';\n return '.tar.gz';\n}\nasync function goToDirectory(overrides = {}) {\n const {\n Dialog\n } = DOM;\n const {\n prompt = Dialog.prompt,\n changeDir = CloudCmd.changeDir\n } = overrides;\n const msg = 'Go to directory:';\n const {\n dirPath\n } = CurrentInfo;\n const [cancel, path = dirPath] = await prompt(msg, dirPath);\n if (cancel) return;\n await changeDir(path);\n}\nasync function duplicatePanel() {\n const Info = CurrentInfo;\n const {\n isDir\n } = Info;\n const panel = Info.panelPassive;\n const noCurrent = !Info.isOnePanel;\n const getPath = isDir => {\n if (isDir) return Info.path;\n return Info.dirPath;\n };\n const path = getPath(isDir);\n await CloudCmd.changeDir(path, {\n panel,\n noCurrent\n });\n}\nasync function swapPanels() {\n const Info = CurrentInfo;\n const {\n panel,\n files,\n element,\n panelPassive\n } = Info;\n const path = DOM.getCurrentDirPath();\n const dirPathPassive = DOM.getNotCurrentDirPath();\n let currentIndex = files.indexOf(element);\n await CloudCmd.changeDir(path, {\n panel: panelPassive,\n noCurrent: true\n });\n await CloudCmd.changeDir(dirPathPassive, {\n panel\n });\n const length = Info.files.length - 1;\n if (currentIndex > length) currentIndex = length;\n const el = Info.files[currentIndex];\n DOM.setCurrentFile(el);\n}\nfunction updateCurrentInfo(currentFile) {\n const info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const files = current.parentElement;\n const panelPassive = DOM.getPanel({\n active: false\n });\n const filesPassive = DOM.getFiles(panelPassive);\n const name = DOM.getCurrentName(current);\n info.dir = DOM.getCurrentDirName();\n info.dirPath = DOM.getCurrentDirPath();\n info.parentDirPath = DOM.getParentDirPath();\n info.element = current;\n info.ext = (0,_common_util__WEBPACK_IMPORTED_MODULE_4__.getExt)(name);\n info.files = Array.from(files.children);\n info.filesPassive = Array.from(filesPassive);\n info.first = files.firstChild;\n info.getData = DOM.getCurrentData;\n info.last = files.lastChild;\n info.link = DOM.getCurrentLink(current);\n info.mode = DOM.getCurrentMode(current);\n info.name = name;\n info.path = DOM.getCurrentPath(current);\n info.panel = files.parentElement || DOM.getPanel();\n info.panelPassive = panelPassive;\n info.size = DOM.getCurrentSize(current);\n info.isDir = DOM.isCurrentIsDir();\n info.isSelected = DOM.isSelected(current);\n info.panelPosition = DOM.getPanel().dataset.name.replace('js-', '');\n info.isOnePanel = info.panel.getAttribute('data-name') === info.panelPassive.getAttribute('data-name');\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/index.mjs\n}");
150
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CurrentInfo: () => (/* binding */ CurrentInfo),\n/* harmony export */ changePanel: () => (/* binding */ changePanel),\n/* harmony export */ checkStorageHash: () => (/* binding */ checkStorageHash),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ deleteCurrent: () => (/* binding */ deleteCurrent),\n/* harmony export */ deleteSelected: () => (/* binding */ deleteSelected),\n/* harmony export */ duplicatePanel: () => (/* binding */ duplicatePanel),\n/* harmony export */ expandSelection: () => (/* binding */ expandSelection),\n/* harmony export */ getActiveFiles: () => (/* binding */ getActiveFiles),\n/* harmony export */ getAllFiles: () => (/* binding */ getAllFiles),\n/* harmony export */ getCSSVar: () => (/* binding */ getCSSVar),\n/* harmony export */ getCurrentData: () => (/* binding */ getCurrentData),\n/* harmony export */ getCurrentDate: () => (/* binding */ getCurrentDate),\n/* harmony export */ getCurrentDirName: () => (/* binding */ getCurrentDirName),\n/* harmony export */ getCurrentLink: () => (/* binding */ getCurrentLink),\n/* harmony export */ getCurrentMode: () => (/* binding */ getCurrentMode),\n/* harmony export */ getCurrentOwner: () => (/* binding */ getCurrentOwner),\n/* harmony export */ getCurrentSize: () => (/* binding */ getCurrentSize),\n/* harmony export */ getFM: () => (/* binding */ getFM),\n/* harmony export */ getFilenames: () => (/* binding */ getFilenames),\n/* harmony export */ getFiles: () => (/* binding */ getFiles),\n/* harmony export */ getNotCurrentDirPath: () => (/* binding */ getNotCurrentDirPath),\n/* harmony export */ getPackerExt: () => (/* binding */ getPackerExt),\n/* harmony export */ getPanel: () => (/* binding */ getPanel),\n/* harmony export */ getPanelPosition: () => (/* binding */ getPanelPosition),\n/* harmony export */ getParentDirPath: () => (/* binding */ getParentDirPath),\n/* harmony export */ getRefreshButton: () => (/* binding */ getRefreshButton),\n/* harmony export */ goToDirectory: () => (/* binding */ goToDirectory),\n/* harmony export */ hidePanel: () => (/* binding */ hidePanel),\n/* harmony export */ loadCurrentHash: () => (/* binding */ loadCurrentHash),\n/* harmony export */ loadCurrentSize: () => (/* binding */ loadCurrentSize),\n/* harmony export */ loadRemote: () => (/* binding */ loadRemote),\n/* harmony export */ loadSocket: () => (/* binding */ loadSocket),\n/* harmony export */ promptNewDir: () => (/* binding */ promptNewDir),\n/* harmony export */ promptNewFile: () => (/* binding */ promptNewFile),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ saveDataToStorage: () => (/* binding */ saveDataToStorage),\n/* harmony export */ scrollByPages: () => (/* binding */ scrollByPages),\n/* harmony export */ scrollIntoViewIfNeeded: () => (/* binding */ scrollIntoViewIfNeeded),\n/* harmony export */ setCurrentSize: () => (/* binding */ setCurrentSize),\n/* harmony export */ setHistory: () => (/* binding */ setHistory),\n/* harmony export */ showPanel: () => (/* binding */ showPanel),\n/* harmony export */ shrinkSelection: () => (/* binding */ shrinkSelection),\n/* harmony export */ swapPanels: () => (/* binding */ swapPanels),\n/* harmony export */ unselectFiles: () => (/* binding */ unselectFiles),\n/* harmony export */ updateCurrentInfo: () => (/* binding */ updateCurrentInfo)\n/* harmony export */ });\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _dom_storage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/storage */ \"./client/dom/storage.js\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _operations_rename_current_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./operations/rename-current.js */ \"./client/dom/operations/rename-current.js\");\n/* harmony import */ var _current_file_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./current-file.js */ \"./client/dom/current-file.js\");\n/* harmony import */ var _dom_tree_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./dom-tree.js */ \"./client/dom/dom-tree.js\");\n/* harmony import */ var _cmd_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./cmd.js */ \"./client/dom/cmd.js\");\n/* harmony import */ var _io_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./io/index.js */ \"./client/dom/io/index.js\");\n/* harmony import */ var _directory_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./directory.js */ \"./client/dom/directory.js\");\n/* harmony import */ var _buffer_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./buffer.js */ \"./client/dom/buffer.js\");\n/* harmony import */ var _load_remote_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./load-remote.js */ \"./client/dom/load-remote.js\");\n/* harmony import */ var _select_by_pattern_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./select-by-pattern.js */ \"./client/dom/select-by-pattern.js\");\n/* global CloudCmd */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n assign\n} = Object;\nconst DOM = {\n getCurrentDirName,\n getNotCurrentDirPath,\n getParentDirPath,\n loadRemote,\n loadSocket,\n promptNewDir,\n promptNewFile,\n unselectFiles,\n getActiveFiles,\n getCurrentDate,\n getCurrentSize,\n loadCurrentSize,\n loadCurrentHash,\n setCurrentSize,\n getCurrentMode,\n getCurrentOwner,\n getCurrentData,\n getRefreshButton,\n getAllFiles,\n expandSelection,\n shrinkSelection,\n setHistory,\n getCurrentLink,\n getFilenames,\n checkStorageHash,\n saveDataToStorage,\n getFM,\n getPanelPosition,\n getCSSVar,\n getPanel,\n getFiles,\n showPanel,\n hidePanel,\n remove,\n deleteCurrent,\n deleteSelected,\n renameCurrent: _operations_rename_current_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n scrollIntoViewIfNeeded,\n scrollByPages,\n changePanel,\n getPackerExt,\n goToDirectory,\n duplicatePanel,\n swapPanels,\n updateCurrentInfo\n};\nassign(DOM, {\n ..._dom_tree_js__WEBPACK_IMPORTED_MODULE_10__,\n ..._current_file_js__WEBPACK_IMPORTED_MODULE_9__,\n ..._cmd_js__WEBPACK_IMPORTED_MODULE_11__\n});\nconst CurrentInfo = {};\nDOM.Images = _dom_images__WEBPACK_IMPORTED_MODULE_7__;\nDOM.load = _dom_load__WEBPACK_IMPORTED_MODULE_0__;\nDOM.Files = _dom_files__WEBPACK_IMPORTED_MODULE_1__;\nDOM.RESTful = _dom_rest__WEBPACK_IMPORTED_MODULE_6__;\nDOM.IO = _io_index_js__WEBPACK_IMPORTED_MODULE_12__;\nDOM.Storage = _dom_storage__WEBPACK_IMPORTED_MODULE_5__;\nDOM.Dialog = _dom_dialog__WEBPACK_IMPORTED_MODULE_2__;\nDOM.CurrentInfo = CurrentInfo;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DOM);\nDOM.uploadDirectory = _directory_js__WEBPACK_IMPORTED_MODULE_13__.uploadDirectory;\nDOM.Buffer = _buffer_js__WEBPACK_IMPORTED_MODULE_14__;\nDOM.Events = _dom_events__WEBPACK_IMPORTED_MODULE_3__;\nconst isString = a => typeof a === 'string';\nconst TabPanel = {\n 'js-left': null,\n 'js-right': null\n};\nfunction loadRemote(name, options, callback) {\n (0,_load_remote_js__WEBPACK_IMPORTED_MODULE_15__.loadRemote)(name, options, callback);\n return DOM;\n}\nfunction loadSocket(callback) {\n DOM.loadRemote('socket', {\n name: 'io'\n }, callback);\n return DOM;\n}\n\n/**\n * create new folder\n *\n */\nasync function promptNewDir() {\n await promptNew('directory');\n}\n\n/**\n * create new file\n *\n * @typeName\n * @type\n */\nasync function promptNewFile() {\n await promptNew('file');\n}\nasync function promptNew(typeName) {\n const {\n Dialog\n } = DOM;\n const dir = DOM.getCurrentDirPath();\n const msg = `New ${typeName}` || 'File';\n const getName = () => {\n const name = DOM.getCurrentName();\n if (name === '..') return '';\n return name;\n };\n const name = getName();\n const [cancel, currentName] = await Dialog.prompt(msg, name);\n if (cancel) return;\n const path = `${dir}${currentName}`;\n if (typeName === 'directory') await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.createDirectory(path);else await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.write(path);\n await CloudCmd.refresh({\n currentName\n });\n}\n\n/**\n * get current directory name\n */\nfunction getCurrentDirName() {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n}\n\n/**\n * get current directory path\n */\nfunction getParentDirPath(panel) {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path !== '/') return path.slice(0, index);\n return path;\n}\n\n/**\n * get not current directory path\n */\nfunction getNotCurrentDirPath() {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n}\n\n/*\n * unselect all files\n */\nfunction unselectFiles(files) {\n files = files || DOM.getSelectedFiles();\n Array.from(files).forEach(DOM.toggleSelectedFile);\n}\n\n/**\n * get all selected files or current when none selected\n *\n * @currentFile\n */\nfunction getActiveFiles() {\n const current = DOM.getCurrentFile();\n const files = DOM.getSelectedFiles();\n const name = DOM.getCurrentName(current);\n if (!files.length && name !== '..') return [current];\n return files;\n}\nfunction getCurrentDate(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n return DOM.getByDataName('js-date', current).textContent;\n}\n\n/**\n * get size\n * @currentFile\n */\nfunction getCurrentSize(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n\n /* если это папка - возвращаем слово dir вместо размера*/\n const size = DOM.getByDataName('js-size', current).textContent.replace(/^<|>$/g, '');\n return size;\n}\n\n/**\n * get size\n * @currentFile\n */\nasync function loadCurrentSize(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?size';\n const link = DOM.getCurrentPath(current);\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.show.load();\n if (name === '..') return;\n const [, size] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(link + query);\n DOM.setCurrentSize(size, current);\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.hide();\n return current;\n}\n\n/**\n * load hash\n * @callback\n * @currentFile\n */\nasync function loadCurrentHash(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?hash';\n const link = DOM.getCurrentPath(current);\n const [, data] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(link + query);\n return data;\n}\n\n/**\n * set size\n * @currentFile\n */\nfunction setCurrentSize(size, currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const sizeElement = DOM.getByDataName('js-size', current);\n sizeElement.textContent = size;\n}\n\n/**\n * @currentFile\n */\nfunction getCurrentMode(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const mode = DOM.getByDataName('js-mode', current);\n return mode.textContent;\n}\n\n/**\n * @currentFile\n */\nfunction getCurrentOwner(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const owner = DOM.getByDataName('js-owner', current);\n return owner.textContent;\n}\n\n/**\n * unified way to get current file content\n *\n * @param currentFile\n */\nasync function getCurrentData(currentFile) {\n const {\n Dialog\n } = DOM;\n const Info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const isDir = DOM.isCurrentIsDir(current);\n if (Info.name === '..') {\n Dialog.alert.noFiles();\n return [Error('No Files')];\n }\n if (isDir) return await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(path);\n const [hashNew, hash] = await DOM.checkStorageHash(path);\n if (!hashNew) return [Error(`Can't get hash of a file`)];\n if (hash === hashNew) return [null, await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.get(`${path}-data`)];\n const [e, data] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(path);\n if (e) return [e, null];\n const ONE_MEGABYTE = 1024 ** 2 * 1024;\n const {\n length\n } = data;\n if (hash && length < ONE_MEGABYTE) await DOM.saveDataToStorage(path, data, hashNew);\n return [null, data];\n}\n\n/**\n * unified way to get RefreshButton\n */\nfunction getRefreshButton(panel = DOM.getPanel()) {\n return DOM.getByDataName('js-refresh', panel);\n}\nfunction getAllFiles() {\n const panel = DOM.getPanel();\n const files = DOM.getFiles(panel);\n const name = DOM.getCurrentName(files[0]);\n const from = a => a === '..' ? 1 : 0;\n const i = from(name);\n return Array.from(files).slice(i);\n}\n\n/**\n * open dialog with expand selection\n */\nasync function expandSelection() {\n const msg = 'expand';\n const {\n files\n } = CurrentInfo;\n await (0,_select_by_pattern_js__WEBPACK_IMPORTED_MODULE_16__.selectByPattern)(msg, files);\n}\n\n/**\n * open dialog with shrink selection\n */\nasync function shrinkSelection() {\n const msg = 'shrink';\n const {\n files\n } = CurrentInfo;\n await (0,_select_by_pattern_js__WEBPACK_IMPORTED_MODULE_16__.selectByPattern)(msg, files);\n}\n\n/**\n * setting history wrapper\n */\nfunction setHistory(data, title, url) {\n const ret = globalThis.history;\n const {\n prefix\n } = CloudCmd;\n url = prefix + url;\n if (ret) history.pushState(data, title, url);\n return ret;\n}\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nfunction getCurrentLink(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const link = DOM.getByTag('a', current);\n return link[0];\n}\nfunction getFilenames(files) {\n if (!files) throw Error('AllFiles could not be empty');\n const first = files[0] || DOM.getCurrentFile();\n const name = DOM.getCurrentName(first);\n const allFiles = Array.from(files);\n if (name === '..') allFiles.shift();\n const names = allFiles.map(current => {\n return DOM.getCurrentName(current);\n });\n return names;\n}\n\n/**\n * check storage hash\n */\nasync function checkStorageHash(name) {\n const nameHash = `${name}-hash`;\n if (!isString(name)) throw Error('name should be a string!');\n const [loadHash, storeHash] = await Promise.all([DOM.loadCurrentHash(), _dom_storage__WEBPACK_IMPORTED_MODULE_5__.get(nameHash)]);\n return [loadHash, storeHash];\n}\n\n/**\n * save data to storage\n *\n * @param name\n * @param data\n * @param hash\n */\nasync function saveDataToStorage(name, data, hash) {\n const isDir = DOM.isCurrentIsDir();\n if (isDir) return;\n hash = hash || (await DOM.loadCurrentHash());\n const nameHash = `${name}-hash`;\n const nameData = `${name}-data`;\n await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.set(nameHash, hash);\n await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.set(nameData, data);\n return hash;\n}\nfunction getFM() {\n const {\n parentElement\n } = DOM.getPanel();\n return parentElement;\n}\nfunction getPanelPosition(panel) {\n panel = panel || DOM.getPanel();\n return panel.dataset.name.replace('js-', '');\n}\nfunction getCSSVar(name, {\n body = document.body\n} = {}) {\n const bodyStyle = getComputedStyle(body);\n return bodyStyle.getPropertyValue(`--${name}`);\n}\n\n/** function getting panel active, or passive\n * @param options = {active: true}\n */\nfunction getPanel(options) {\n let files;\n let panel;\n let isLeft;\n let dataName = 'js-';\n const current = DOM.getCurrentFile();\n if (!current) {\n panel = DOM.getByDataName('js-left');\n } else {\n files = current.parentElement;\n panel = files.parentElement;\n isLeft = panel.getAttribute('data-name') === 'js-left';\n }\n\n /* if {active : false} getting passive panel */\n if (options && !options.active) {\n dataName += isLeft ? 'right' : 'left';\n panel = DOM.getByDataName(dataName);\n }\n\n /* if two panels showed\n * then always work with passive\n * panel\n */\n if (globalThis.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH) panel = DOM.getByDataName('js-left');\n if (!panel) throw Error('can not find Active Panel!');\n return panel;\n}\nfunction getFiles(element) {\n const files = DOM.getByDataName('js-files', element);\n return files.children || [];\n}\n\n/**\n * shows panel right or left (or active)\n */\nfunction showPanel(active) {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n DOM.show(panel);\n return true;\n}\n\n/**\n * hides panel right or left (or active)\n */\nfunction hidePanel(active) {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n return DOM.hide(panel);\n}\n\n/**\n * remove child of element\n * @param child\n * @param element\n */\nfunction remove(child, element) {\n const parent = element || document.body;\n parent.removeChild(child);\n return DOM;\n}\n\n/**\n * remove current file from file table\n * @param current\n *\n */\nfunction deleteCurrent(current) {\n if (!current) DOM.getCurrentFile();\n const parent = current === null || current === void 0 ? void 0 : current.parentElement;\n const name = DOM.getCurrentName(current);\n if (current && name !== '..') {\n const next = current.nextSibling;\n const prev = current.previousSibling;\n DOM.setCurrentFile(next || prev);\n parent.removeChild(current);\n }\n}\n\n/**\n * remove selected files from file table\n * @Selected\n */\nfunction deleteSelected(selected) {\n selected = selected || DOM.getSelectedFiles();\n if (!selected) return;\n selected.map(DOM.deleteCurrent);\n}\n\n/**\n * rename current file\n *\n * @currentFile\n */\nfunction scrollIntoViewIfNeeded(element, center = false) {\n if (!element || !element.scrollIntoViewIfNeeded) return;\n element.scrollIntoViewIfNeeded(center);\n}\n\n/* scroll on one page */\nfunction scrollByPages(element, pPages) {\n const ret = (element === null || element === void 0 ? void 0 : element.scrollByPages) && pPages;\n if (ret) element.scrollByPages(pPages);\n return ret;\n}\nfunction changePanel() {\n const Info = CurrentInfo;\n let panel = DOM.getPanel();\n CloudCmd.emit('passive-dir', Info.dirPath);\n const panelPassive = DOM.getPanel({\n active: false\n });\n let name = DOM.getCurrentName();\n const filesPassive = DOM.getFiles(panelPassive);\n let dataName = panel.getAttribute('data-name');\n TabPanel[dataName] = name;\n panel = panelPassive;\n dataName = panel.getAttribute('data-name');\n name = TabPanel[dataName];\n let files;\n let current;\n if (name) {\n current = DOM.getCurrentByName(name, panel);\n if (current) files = current.parentElement;\n }\n if (!files || !files.parentElement) {\n current = DOM.getCurrentByName(name, panel);\n if (!current) [current] = filesPassive;\n }\n DOM.setCurrentFile(current, {\n history: true\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n return DOM;\n}\nfunction getPackerExt(type) {\n if (type === 'zip') return '.zip';\n return '.tar.gz';\n}\nasync function goToDirectory(overrides = {}) {\n const {\n Dialog\n } = DOM;\n const {\n prompt = Dialog.prompt,\n changeDir = CloudCmd.changeDir\n } = overrides;\n const msg = 'Go to directory:';\n const {\n dirPath\n } = CurrentInfo;\n const [cancel, path = dirPath] = await prompt(msg, dirPath);\n if (cancel) return;\n await changeDir(path);\n}\nasync function duplicatePanel() {\n const Info = CurrentInfo;\n const {\n isDir\n } = Info;\n const panel = Info.panelPassive;\n const noCurrent = !Info.isOnePanel;\n const getPath = isDir => {\n if (isDir) return Info.path;\n return Info.dirPath;\n };\n const path = getPath(isDir);\n await CloudCmd.changeDir(path, {\n panel,\n noCurrent\n });\n}\nasync function swapPanels() {\n const Info = CurrentInfo;\n const {\n panel,\n files,\n element,\n panelPassive\n } = Info;\n const path = DOM.getCurrentDirPath();\n const dirPathPassive = DOM.getNotCurrentDirPath();\n let currentIndex = files.indexOf(element);\n await CloudCmd.changeDir(path, {\n panel: panelPassive,\n noCurrent: true\n });\n await CloudCmd.changeDir(dirPathPassive, {\n panel\n });\n const length = Info.files.length - 1;\n if (currentIndex > length) currentIndex = length;\n const el = Info.files[currentIndex];\n DOM.setCurrentFile(el);\n}\nfunction updateCurrentInfo(currentFile) {\n const info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const files = current.parentElement;\n const panelPassive = DOM.getPanel({\n active: false\n });\n const filesPassive = DOM.getFiles(panelPassive);\n const name = DOM.getCurrentName(current);\n info.dir = DOM.getCurrentDirName();\n info.dirPath = DOM.getCurrentDirPath();\n info.parentDirPath = DOM.getParentDirPath();\n info.element = current;\n info.ext = (0,_common_util__WEBPACK_IMPORTED_MODULE_4__.getExt)(name);\n info.files = Array.from(files.children);\n info.filesPassive = Array.from(filesPassive);\n info.first = files.firstChild;\n info.getData = DOM.getCurrentData;\n info.last = files.lastChild;\n info.link = DOM.getCurrentLink(current);\n info.mode = DOM.getCurrentMode(current);\n info.name = name;\n info.path = DOM.getCurrentPath(current);\n info.panel = files.parentElement || DOM.getPanel();\n info.panelPassive = panelPassive;\n info.size = DOM.getCurrentSize(current);\n info.isDir = DOM.isCurrentIsDir();\n info.isSelected = DOM.isSelected(current);\n info.panelPosition = DOM.getPanel().dataset.name.replace('js-', '');\n info.isOnePanel = info.panel.getAttribute('data-name') === info.panelPassive.getAttribute('data-name');\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/index.js\n}");
151
151
 
152
152
  /***/ },
153
153
 
@@ -155,10 +155,10 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
155
155
  /*!********************************!*\
156
156
  !*** ./client/dom/io/index.js ***!
157
157
  \********************************/
158
- (module, __unused_webpack_exports, __webpack_require__) {
158
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
159
159
 
160
160
  "use strict";
161
- eval("{\n\nconst {\n FS\n} = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\nconst _sendRequest = __webpack_require__(/*! ./send-request */ \"./client/dom/io/send-request.js\");\nconst imgPosition = {\n top: true\n};\nmodule.exports[\"delete\"] = async (url, data) => {\n return await _sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n imgPosition: {\n top: Boolean(data)\n }\n });\n};\nmodule.exports.patch = async (url, data) => {\n return await _sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n imgPosition\n });\n};\nmodule.exports.write = async (url, data) => {\n return await _sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n imgPosition\n });\n};\nmodule.exports.createDirectory = async (url, overrides = {}) => {\n const {\n sendRequest = _sendRequest\n } = overrides;\n return await sendRequest({\n method: 'PUT',\n url: `${FS}${url}?dir`,\n imgPosition\n });\n};\nmodule.exports.read = async (url, dataType = 'text') => {\n const notLog = !url.includes('?');\n return await _sendRequest({\n method: 'GET',\n url: FS + url,\n notLog,\n dataType\n });\n};\nmodule.exports.copy = async (from, to, names) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/copy',\n data: {\n from,\n to,\n names\n },\n imgPosition\n });\n};\nmodule.exports.pack = async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/pack',\n data\n });\n};\nmodule.exports.extract = async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/extract',\n data\n });\n};\nmodule.exports.move = async (from, to, names) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/move',\n data: {\n from,\n to,\n names\n },\n imgPosition\n });\n};\nmodule.exports.rename = async (from, to) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/rename',\n data: {\n from,\n to\n },\n imgPosition\n });\n};\nmodule.exports.Config = {\n read: async () => {\n return await _sendRequest({\n method: 'GET',\n url: '/config',\n imgPosition,\n notLog: true\n });\n },\n write: async data => {\n return await _sendRequest({\n method: 'PATCH',\n url: '/config',\n data,\n imgPosition\n });\n }\n};\nmodule.exports.Markdown = {\n read: async url => {\n return await _sendRequest({\n method: 'GET',\n url: `/markdown${url}`,\n imgPosition,\n notLog: true\n });\n },\n render: async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/markdown',\n data,\n imgPosition,\n notLog: true\n });\n }\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/io/index.js\n}");
161
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Config: () => (/* binding */ Config),\n/* harmony export */ Markdown: () => (/* binding */ Markdown),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ createDirectory: () => (/* binding */ createDirectory),\n/* harmony export */ extract: () => (/* binding */ extract),\n/* harmony export */ move: () => (/* binding */ move),\n/* harmony export */ pack: () => (/* binding */ pack),\n/* harmony export */ patch: () => (/* binding */ patch),\n/* harmony export */ read: () => (/* binding */ read),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ rename: () => (/* binding */ rename),\n/* harmony export */ write: () => (/* binding */ write)\n/* harmony export */ });\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _send_request_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./send-request.js */ \"./client/dom/io/send-request.js\");\n\n\nconst {\n assign\n} = Object;\nconst imgPosition = {\n top: true\n};\nconst remove = async (url, data, overrides = {}) => {\n const {\n sendRequest = _send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest\n } = overrides;\n const request = {\n method: 'DELETE',\n url: _common_cloudfunc__WEBPACK_IMPORTED_MODULE_0__.FS + url,\n imgPosition: {\n top: Boolean(data)\n }\n };\n if (data) assign(request, {\n data,\n url: `${request.url}?files`\n });\n return await sendRequest(request);\n};\nconst patch = async (url, data) => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PATCH',\n url: _common_cloudfunc__WEBPACK_IMPORTED_MODULE_0__.FS + url,\n data,\n imgPosition\n });\n};\nconst write = async (url, data) => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PUT',\n url: _common_cloudfunc__WEBPACK_IMPORTED_MODULE_0__.FS + url,\n data,\n imgPosition\n });\n};\nconst createDirectory = async (url, overrides = {}) => {\n const {\n sendRequest = _send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest\n } = overrides;\n return await sendRequest({\n method: 'PUT',\n url: `${_common_cloudfunc__WEBPACK_IMPORTED_MODULE_0__.FS}${url}?dir`,\n imgPosition\n });\n};\nconst read = async (url, dataType = 'text') => {\n const notLog = !url.includes('?');\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'GET',\n url: _common_cloudfunc__WEBPACK_IMPORTED_MODULE_0__.FS + url,\n notLog,\n dataType\n });\n};\nconst copy = async (from, to, names) => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PUT',\n url: '/copy',\n data: {\n from,\n to,\n names\n },\n imgPosition\n });\n};\nconst pack = async data => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PUT',\n url: '/pack',\n data\n });\n};\nconst extract = async data => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PUT',\n url: '/extract',\n data\n });\n};\nconst move = async (from, to, names) => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PUT',\n url: '/move',\n data: {\n from,\n to,\n names\n },\n imgPosition\n });\n};\nconst rename = async (from, to) => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PUT',\n url: '/rename',\n data: {\n from,\n to\n },\n imgPosition\n });\n};\nconst Config = {\n read: async () => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'GET',\n url: '/config',\n imgPosition,\n notLog: true\n });\n },\n write: async data => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PATCH',\n url: '/config',\n data,\n imgPosition\n });\n }\n};\nconst Markdown = {\n read: async url => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'GET',\n url: `/markdown${url}`,\n imgPosition,\n notLog: true\n });\n },\n render: async data => {\n return await (0,_send_request_js__WEBPACK_IMPORTED_MODULE_1__.sendRequest)({\n method: 'PUT',\n url: '/markdown',\n data,\n imgPosition,\n notLog: true\n });\n }\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/io/index.js\n}");
162
162
 
163
163
  /***/ },
164
164
 
@@ -166,274 +166,274 @@ eval("{\n\nconst {\n FS\n} = __webpack_require__(/*! #common/cloudfunc */ \"./c
166
166
  /*!***************************************!*\
167
167
  !*** ./client/dom/io/send-request.js ***!
168
168
  \***************************************/
169
- (module, __unused_webpack_exports, __webpack_require__) {
169
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
170
170
 
171
171
  "use strict";
172
- eval("{\n\n/* global CloudCmd */\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst load = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\nmodule.exports = promisify((params, callback) => {\n const p = params;\n const {\n prefixURL\n } = CloudCmd;\n p.url = prefixURL + p.url;\n p.url = encodeURI(p.url);\n p.url = replaceHash(p.url);\n load.ajax({\n method: p.method,\n url: p.url,\n data: p.data,\n dataType: p.dataType,\n error: jqXHR => {\n const response = jqXHR.responseText;\n const {\n statusText,\n status\n } = jqXHR;\n const text = status === 404 ? response : statusText;\n callback(Error(text));\n },\n success: data => {\n Images.hide();\n if (!p.notLog) CloudCmd.log(data);\n callback(null, data);\n }\n });\n});\nmodule.exports._replaceHash = replaceHash;\nfunction replaceHash(url) {\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n */\n return url.replace(/#/g, '%23');\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/io/send-request.js\n}");
172
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _replaceHash: () => (/* binding */ _replaceHash),\n/* harmony export */ sendRequest: () => (/* binding */ sendRequest)\n/* harmony export */ });\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.js\");\n/* global CloudCmd */\n\n\n\nconst sendRequest = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_0__.promisify)((params, callback) => {\n const p = params;\n const {\n prefixURL\n } = CloudCmd;\n p.url = prefixURL + p.url;\n p.url = encodeURI(p.url);\n p.url = replaceHash(p.url);\n _dom_load__WEBPACK_IMPORTED_MODULE_2__.ajax({\n method: p.method,\n url: p.url,\n data: p.data,\n dataType: p.dataType,\n error: jqXHR => {\n const response = jqXHR.responseText;\n const {\n statusText,\n status\n } = jqXHR;\n const text = status === 404 ? response : statusText;\n callback(Error(text));\n },\n success: data => {\n _dom_images__WEBPACK_IMPORTED_MODULE_1__.hide();\n if (!p.notLog) CloudCmd.log(data);\n callback(null, data);\n }\n });\n});\nconst _replaceHash = replaceHash;\nfunction replaceHash(url) {\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n */\n return url.replace(/#/g, '%23');\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/io/send-request.js\n}");
173
173
 
174
174
  /***/ },
175
175
 
176
- /***/ "./client/dom/load-remote.mjs"
177
- /*!************************************!*\
178
- !*** ./client/dom/load-remote.mjs ***!
179
- \************************************/
176
+ /***/ "./client/dom/load-remote.js"
177
+ /*!***********************************!*\
178
+ !*** ./client/dom/load-remote.js ***!
179
+ \***********************************/
180
180
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
181
181
 
182
182
  "use strict";
183
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadRemote: () => (/* binding */ loadRemote)\n/* harmony export */ });\n/* harmony import */ var node_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:util */ \"./node_modules/util/util.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nconst loadRemote = (0,node_util__WEBPACK_IMPORTED_MODULE_0__.callbackify)(async (name, options) => {\n const {\n prefix,\n config\n } = CloudCmd;\n const o = options;\n if (o.name && window[o.name]) return;\n const modules = await _dom_files__WEBPACK_IMPORTED_MODULE_6__.get('modules');\n const online = config('online') && navigator.onLine;\n const module = (0,_common_util__WEBPACK_IMPORTED_MODULE_5__.findObjByNameInArr)(modules.remote, name);\n const isArray = itype__WEBPACK_IMPORTED_MODULE_2__.array(module.local);\n const {\n version\n } = module;\n let remoteTmpls;\n let local;\n if (isArray) {\n remoteTmpls = module.remote;\n ({\n local\n } = module);\n } else {\n remoteTmpls = [module.remote];\n local = [module.local];\n }\n const localURL = local.map(url => prefix + url);\n const remoteURL = remoteTmpls.map(tmpl => {\n return rendy__WEBPACK_IMPORTED_MODULE_1__(tmpl, {\n version\n });\n });\n if (online) {\n const [e] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_3__.parallel, remoteURL);\n if (!e) return;\n }\n await load_js__WEBPACK_IMPORTED_MODULE_3__.parallel(localURL);\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/load-remote.mjs\n}");
183
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadRemote: () => (/* binding */ loadRemote)\n/* harmony export */ });\n/* harmony import */ var node_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:util */ \"./node_modules/util/util.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nconst loadRemote = (0,node_util__WEBPACK_IMPORTED_MODULE_0__.callbackify)(async (name, options) => {\n const {\n prefix,\n config\n } = CloudCmd;\n const o = options;\n if (o.name && window[o.name]) return;\n const modules = await _dom_files__WEBPACK_IMPORTED_MODULE_6__.get('modules');\n const online = config('online') && navigator.onLine;\n const module = (0,_common_util__WEBPACK_IMPORTED_MODULE_5__.findObjByNameInArr)(modules.remote, name);\n const isArray = itype__WEBPACK_IMPORTED_MODULE_2__.array(module.local);\n const {\n version\n } = module;\n let remoteTmpls;\n let local;\n if (isArray) {\n remoteTmpls = module.remote;\n ({\n local\n } = module);\n } else {\n remoteTmpls = [module.remote];\n local = [module.local];\n }\n const localURL = local.map(url => prefix + url);\n const remoteURL = remoteTmpls.map(tmpl => {\n return rendy__WEBPACK_IMPORTED_MODULE_1__(tmpl, {\n version\n });\n });\n if (online) {\n const [e] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_3__.parallel, remoteURL);\n if (!e) return;\n }\n await load_js__WEBPACK_IMPORTED_MODULE_3__.parallel(localURL);\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/load-remote.js\n}");
184
184
 
185
185
  /***/ },
186
186
 
187
- /***/ "./client/dom/load.mjs"
188
- /*!*****************************!*\
189
- !*** ./client/dom/load.mjs ***!
190
- \*****************************/
187
+ /***/ "./client/dom/load.js"
188
+ /*!****************************!*\
189
+ !*** ./client/dom/load.js ***!
190
+ \****************************/
191
191
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
192
192
 
193
193
  "use strict";
194
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ajax: () => (/* binding */ ajax),\n/* harmony export */ getIdBySrc: () => (/* binding */ getIdBySrc),\n/* harmony export */ put: () => (/* binding */ put)\n/* harmony export */ });\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var jonny__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jonny */ \"./node_modules/jonny/lib/jonny.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n\n\n\n\n\n\n/**\n * Function gets id by src\n * @param src\n *\n * Example: http://domain.com/1.js -> 1_js\n */\nfunction getIdBySrc(src) {\n const isStr = itype__WEBPACK_IMPORTED_MODULE_0__.string(src);\n if (!isStr) return;\n if (src.includes(':')) src += '-join';\n const num = src.lastIndexOf('/') + 1;\n const sub = src.substr(src, num);\n const id = src.replace(sub, '').replace(/\\./g, '-');\n return id;\n}\n\n/**\n * load file countent via ajax\n *\n * @param params\n */\nconst ajax = params => {\n const p = params;\n const isObject = itype__WEBPACK_IMPORTED_MODULE_0__.object(p.data);\n const isArray = itype__WEBPACK_IMPORTED_MODULE_0__.array(p.data);\n const isArrayBuf = itype__WEBPACK_IMPORTED_MODULE_0__(p.data) === 'arraybuffer';\n const type = p.type || p.method || 'GET';\n const {\n headers = {}\n } = p;\n const xhr = new XMLHttpRequest();\n xhr.open(type, p.url, true);\n for (const name of Object.keys(headers)) {\n const value = headers[name];\n xhr.setRequestHeader(name, value);\n }\n if (p.responseType) xhr.responseType = p.responseType;\n let data;\n if (!isArrayBuf && isObject || isArray) data = jonny__WEBPACK_IMPORTED_MODULE_1__.stringify(p.data);else ({\n data\n } = p);\n xhr.onreadystatechange = event => {\n const xhr = event.target;\n const OK = 200;\n if (xhr.readyState !== xhr.DONE) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_4__.clearProgress();\n const TYPE_JSON = 'application/json';\n const type = xhr.getResponseHeader('content-type');\n if (xhr.status !== OK) return execon__WEBPACK_IMPORTED_MODULE_3__(p.error, xhr);\n const notText = p.dataType !== 'text';\n const isContain = type.includes(TYPE_JSON);\n let data = xhr.response;\n if (type && isContain && notText) data = jonny__WEBPACK_IMPORTED_MODULE_1__.parse(xhr.response) || xhr.response;\n execon__WEBPACK_IMPORTED_MODULE_3__(p.success, data, xhr.statusText, xhr);\n };\n xhr.send(data);\n};\nconst put = (url, body) => {\n const emitter = emitify__WEBPACK_IMPORTED_MODULE_2__();\n const xhr = new XMLHttpRequest();\n url = encodeURI(url).replace(/#/g, '#');\n xhr.open('put', url, true);\n xhr.upload.onprogress = event => {\n if (!event.lengthComputable) return;\n const percent = event.loaded / event.total * 100;\n const count = Math.round(percent);\n emitter.emit('progress', count);\n };\n xhr.onreadystatechange = () => {\n const over = xhr.readyState === xhr.DONE;\n const OK = 200;\n if (!over) return;\n if (xhr.status === OK) {\n emitter.emit('progress', 100);\n return emitter.emit('end');\n }\n const error = Error(xhr.responseText);\n emitter.emit('error', error);\n };\n xhr.send(body);\n return emitter;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/load.mjs\n}");
194
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ajax: () => (/* binding */ ajax),\n/* harmony export */ getIdBySrc: () => (/* binding */ getIdBySrc),\n/* harmony export */ put: () => (/* binding */ put)\n/* harmony export */ });\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var jonny__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jonny */ \"./node_modules/jonny/lib/jonny.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n\n\n\n\n\n\n/**\n * Function gets id by src\n * @param src\n *\n * Example: http://domain.com/1.js -> 1_js\n */\nfunction getIdBySrc(src) {\n const isStr = itype__WEBPACK_IMPORTED_MODULE_0__.string(src);\n if (!isStr) return;\n if (src.includes(':')) src += '-join';\n const num = src.lastIndexOf('/') + 1;\n const sub = src.substr(src, num);\n const id = src.replace(sub, '').replace(/\\./g, '-');\n return id;\n}\n\n/**\n * load file countent via ajax\n *\n * @param params\n */\nconst ajax = params => {\n const p = params;\n const isObject = itype__WEBPACK_IMPORTED_MODULE_0__.object(p.data);\n const isArray = itype__WEBPACK_IMPORTED_MODULE_0__.array(p.data);\n const isArrayBuf = itype__WEBPACK_IMPORTED_MODULE_0__(p.data) === 'arraybuffer';\n const type = p.type || p.method || 'GET';\n const {\n headers = {}\n } = p;\n const xhr = new XMLHttpRequest();\n xhr.open(type, p.url, true);\n for (const name of Object.keys(headers)) {\n const value = headers[name];\n xhr.setRequestHeader(name, value);\n }\n if (p.responseType) xhr.responseType = p.responseType;\n let data;\n if (!isArrayBuf && isObject || isArray) data = jonny__WEBPACK_IMPORTED_MODULE_1__.stringify(p.data);else ({\n data\n } = p);\n xhr.onreadystatechange = event => {\n const xhr = event.target;\n const OK = 200;\n if (xhr.readyState !== xhr.DONE) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_4__.clearProgress();\n const TYPE_JSON = 'application/json';\n const type = xhr.getResponseHeader('content-type');\n if (xhr.status !== OK) return execon__WEBPACK_IMPORTED_MODULE_3__(p.error, xhr);\n const notText = p.dataType !== 'text';\n const isContain = type.includes(TYPE_JSON);\n let data = xhr.response;\n if (type && isContain && notText) data = jonny__WEBPACK_IMPORTED_MODULE_1__.parse(xhr.response) || xhr.response;\n execon__WEBPACK_IMPORTED_MODULE_3__(p.success, data, xhr.statusText, xhr);\n };\n xhr.send(data);\n};\nconst put = (url, body) => {\n const emitter = emitify__WEBPACK_IMPORTED_MODULE_2__();\n const xhr = new XMLHttpRequest();\n url = encodeURI(url).replace(/#/g, '#');\n xhr.open('put', url, true);\n xhr.upload.onprogress = event => {\n if (!event.lengthComputable) return;\n const percent = event.loaded / event.total * 100;\n const count = Math.round(percent);\n emitter.emit('progress', count);\n };\n xhr.onreadystatechange = () => {\n const over = xhr.readyState === xhr.DONE;\n const OK = 200;\n if (!over) return;\n if (xhr.status === OK) {\n emitter.emit('progress', 100);\n return emitter.emit('end');\n }\n const error = Error(xhr.responseText);\n emitter.emit('error', error);\n };\n xhr.send(body);\n return emitter;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/load.js\n}");
195
195
 
196
196
  /***/ },
197
197
 
198
- /***/ "./client/dom/operations/rename-current.mjs"
199
- /*!**************************************************!*\
200
- !*** ./client/dom/operations/rename-current.mjs ***!
201
- \**************************************************/
198
+ /***/ "./client/dom/operations/rename-current.js"
199
+ /*!*************************************************!*\
200
+ !*** ./client/dom/operations/rename-current.js ***!
201
+ \*************************************************/
202
202
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
203
203
 
204
204
  "use strict";
205
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var just_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! just-capitalize */ \"./node_modules/just-capitalize/index.mjs\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _dom_storage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/storage */ \"./client/dom/storage.mjs\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\n/* harmony import */ var _current_file_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../current-file.mjs */ \"./client/dom/current-file.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (async (current, overrides = {}) => {\n const {\n refresh = CloudCmd.refresh,\n Dialog = _dom_dialog__WEBPACK_IMPORTED_MODULE_1__,\n currentFile = _current_file_mjs__WEBPACK_IMPORTED_MODULE_4__\n } = overrides;\n const {\n isCurrentFile,\n getCurrentName,\n getCurrentFile,\n getCurrentByName,\n getCurrentType,\n getCurrentDirPath,\n setCurrentName\n } = currentFile;\n if (!isCurrentFile(current)) current = getCurrentFile();\n const from = getCurrentName(current);\n if (from === '..') return Dialog.alert.noFiles();\n const [cancel, to] = await Dialog.prompt('Rename', from);\n if (cancel) return;\n const nextFile = getCurrentByName(to);\n if (nextFile) {\n const type = getCurrentType(nextFile);\n const msg = `${(0,just_capitalize__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(type)} \"${to}\" already exists. Proceed?`;\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n }\n if (from === to) return;\n const dirPath = getCurrentDirPath();\n const fromFull = `${dirPath}${from}`;\n const toFull = `${dirPath}${to}`;\n const [e] = await _dom_rest__WEBPACK_IMPORTED_MODULE_3__.rename(fromFull, toFull);\n if (e) return;\n setCurrentName(to, current);\n _dom_storage__WEBPACK_IMPORTED_MODULE_2__.remove(dirPath);\n refresh();\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/operations/rename-current.mjs\n}");
205
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var just_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! just-capitalize */ \"./node_modules/just-capitalize/index.mjs\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _dom_storage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/storage */ \"./client/dom/storage.js\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.js\");\n/* harmony import */ var _current_file_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../current-file.js */ \"./client/dom/current-file.js\");\n/* global CloudCmd */\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (async (current, overrides = {}) => {\n const {\n refresh = CloudCmd.refresh,\n Dialog = _dom_dialog__WEBPACK_IMPORTED_MODULE_1__,\n currentFile = _current_file_js__WEBPACK_IMPORTED_MODULE_4__\n } = overrides;\n const {\n isCurrentFile,\n getCurrentName,\n getCurrentFile,\n getCurrentByName,\n getCurrentType,\n getCurrentDirPath,\n setCurrentName\n } = currentFile;\n if (!isCurrentFile(current)) current = getCurrentFile();\n const from = getCurrentName(current);\n if (from === '..') return Dialog.alert.noFiles();\n const [cancel, to] = await Dialog.prompt('Rename', from);\n if (cancel) return;\n const nextFile = getCurrentByName(to);\n if (nextFile) {\n const type = getCurrentType(nextFile);\n const msg = `${(0,just_capitalize__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(type)} \"${to}\" already exists. Proceed?`;\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n }\n if (from === to) return;\n const dirPath = getCurrentDirPath();\n const fromFull = `${dirPath}${from}`;\n const toFull = `${dirPath}${to}`;\n const [e] = await _dom_rest__WEBPACK_IMPORTED_MODULE_3__.rename(fromFull, toFull);\n if (e) return;\n setCurrentName(to, current);\n _dom_storage__WEBPACK_IMPORTED_MODULE_2__.remove(dirPath);\n refresh();\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/operations/rename-current.js\n}");
206
206
 
207
207
  /***/ },
208
208
 
209
- /***/ "./client/dom/rest.mjs"
210
- /*!*****************************!*\
211
- !*** ./client/dom/rest.mjs ***!
212
- \*****************************/
209
+ /***/ "./client/dom/rest.js"
210
+ /*!****************************!*\
211
+ !*** ./client/dom/rest.js ***!
212
+ \****************************/
213
213
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
214
214
 
215
215
  "use strict";
216
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Config: () => (/* binding */ Config),\n/* harmony export */ Markdown: () => (/* binding */ Markdown),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ createDirectory: () => (/* binding */ createDirectory),\n/* harmony export */ extract: () => (/* binding */ extract),\n/* harmony export */ move: () => (/* binding */ move),\n/* harmony export */ pack: () => (/* binding */ pack),\n/* harmony export */ patch: () => (/* binding */ patch),\n/* harmony export */ read: () => (/* binding */ read),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ rename: () => (/* binding */ rename),\n/* harmony export */ write: () => (/* binding */ write)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n/* harmony import */ var _io_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./io/index.js */ \"./client/dom/io/index.js\");\n\n\n\n\n\nconst handleError = promise => async (...args) => {\n const [e, data] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(promise, ...args);\n if (!e) return [e, data];\n const encoded = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(e.message);\n _dom_images__WEBPACK_IMPORTED_MODULE_2__.show.error(encoded);\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert(encoded);\n return [e, data];\n};\nconst remove = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__[\"delete\"]);\nconst patch = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.patch);\nconst write = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.write);\nconst createDirectory = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.createDirectory);\nconst read = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.read);\nconst copy = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.copy);\nconst pack = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.pack);\nconst extract = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.extract);\nconst move = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.move);\nconst rename = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.rename);\nconst Config = {\n read: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Config.read),\n write: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Config.write)\n};\nconst Markdown = {\n read: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Markdown.read),\n render: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Markdown.render)\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/rest.mjs\n}");
216
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Config: () => (/* binding */ Config),\n/* harmony export */ Markdown: () => (/* binding */ Markdown),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ createDirectory: () => (/* binding */ createDirectory),\n/* harmony export */ extract: () => (/* binding */ extract),\n/* harmony export */ move: () => (/* binding */ move),\n/* harmony export */ pack: () => (/* binding */ pack),\n/* harmony export */ patch: () => (/* binding */ patch),\n/* harmony export */ read: () => (/* binding */ read),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ rename: () => (/* binding */ rename),\n/* harmony export */ write: () => (/* binding */ write)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n/* harmony import */ var _io_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./io/index.js */ \"./client/dom/io/index.js\");\n\n\n\n\n\nconst handleError = promise => async (...args) => {\n const [e, data] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(promise, ...args);\n if (!e) return [e, data];\n const encoded = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(e.message);\n _dom_images__WEBPACK_IMPORTED_MODULE_2__.show.error(encoded);\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert(encoded);\n return [e, data];\n};\nconst remove = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.remove);\nconst patch = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.patch);\nconst write = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.write);\nconst createDirectory = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.createDirectory);\nconst read = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.read);\nconst copy = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.copy);\nconst pack = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.pack);\nconst extract = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.extract);\nconst move = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.move);\nconst rename = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.rename);\nconst Config = {\n read: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Config.read),\n write: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Config.write)\n};\nconst Markdown = {\n read: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Markdown.read),\n render: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Markdown.render)\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/rest.js\n}");
217
217
 
218
218
  /***/ },
219
219
 
220
- /***/ "./client/dom/select-by-pattern.mjs"
221
- /*!******************************************!*\
222
- !*** ./client/dom/select-by-pattern.mjs ***!
223
- \******************************************/
220
+ /***/ "./client/dom/select-by-pattern.js"
221
+ /*!*****************************************!*\
222
+ !*** ./client/dom/select-by-pattern.js ***!
223
+ \*****************************************/
224
224
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
225
225
 
226
226
  "use strict";
227
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ selectByPattern: () => (/* binding */ selectByPattern)\n/* harmony export */ });\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _current_file_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./current-file.mjs */ \"./client/dom/current-file.mjs\");\n/* harmony import */ var _cmd_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./cmd.mjs */ \"./client/dom/cmd.mjs\");\n\n\n\n\nlet SelectType = '*.*';\nconst selectByPattern = async (msg, files) => {\n if (!files) return;\n const allMsg = `Specify file type for ${msg} selection`;\n const [cancel, type] = await (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_0__.prompt)(allMsg, SelectType);\n if (cancel) return;\n SelectType = type;\n const regExp = (0,_common_util__WEBPACK_IMPORTED_MODULE_1__.getRegExp)(type);\n let matches = 0;\n for (const current of files) {\n const name = (0,_current_file_mjs__WEBPACK_IMPORTED_MODULE_2__.getCurrentName)(current);\n if (name === '..' || !regExp.test(name)) continue;\n ++matches;\n let selected = (0,_cmd_mjs__WEBPACK_IMPORTED_MODULE_3__.isSelected)(current);\n const shouldSel = msg === 'expand';\n if (shouldSel) selected = !selected;\n if (selected) (0,_cmd_mjs__WEBPACK_IMPORTED_MODULE_3__.toggleSelectedFile)(current);\n }\n if (!matches) (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_0__.alert)('No matches found!');\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/select-by-pattern.mjs\n}");
227
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ selectByPattern: () => (/* binding */ selectByPattern)\n/* harmony export */ });\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _current_file_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./current-file.js */ \"./client/dom/current-file.js\");\n/* harmony import */ var _cmd_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./cmd.js */ \"./client/dom/cmd.js\");\n\n\n\n\nlet SelectType = '*.*';\nconst selectByPattern = async (msg, files) => {\n if (!files) return;\n const allMsg = `Specify file type for ${msg} selection`;\n const [cancel, type] = await (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_0__.prompt)(allMsg, SelectType);\n if (cancel) return;\n SelectType = type;\n const regExp = (0,_common_util__WEBPACK_IMPORTED_MODULE_1__.getRegExp)(type);\n let matches = 0;\n for (const current of files) {\n const name = (0,_current_file_js__WEBPACK_IMPORTED_MODULE_2__.getCurrentName)(current);\n if (name === '..' || !regExp.test(name)) continue;\n ++matches;\n let selected = (0,_cmd_js__WEBPACK_IMPORTED_MODULE_3__.isSelected)(current);\n const shouldSel = msg === 'expand';\n if (shouldSel) selected = !selected;\n if (selected) (0,_cmd_js__WEBPACK_IMPORTED_MODULE_3__.toggleSelectedFile)(current);\n }\n if (!matches) (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_0__.alert)('No matches found!');\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/select-by-pattern.js\n}");
228
228
 
229
229
  /***/ },
230
230
 
231
- /***/ "./client/dom/storage.mjs"
232
- /*!********************************!*\
233
- !*** ./client/dom/storage.mjs ***!
234
- \********************************/
231
+ /***/ "./client/dom/storage.js"
232
+ /*!*******************************!*\
233
+ !*** ./client/dom/storage.js ***!
234
+ \*******************************/
235
235
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
236
236
 
237
237
  "use strict";
238
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getJson: () => (/* binding */ getJson),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ setJson: () => (/* binding */ setJson)\n/* harmony export */ });\nconst {\n parse,\n stringify\n} = JSON;\nconst set = (name, data) => {\n localStorage.setItem(name, data);\n};\nconst setJson = (name, data) => {\n localStorage.setItem(name, stringify(data));\n};\nconst get = name => {\n return localStorage.getItem(name);\n};\nconst getJson = name => {\n const data = localStorage.getItem(name);\n return parse(data);\n};\nconst clear = () => {\n localStorage.clear();\n};\nconst remove = item => {\n localStorage.removeItem(item);\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/storage.mjs\n}");
238
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getJson: () => (/* binding */ getJson),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ setJson: () => (/* binding */ setJson)\n/* harmony export */ });\nconst {\n parse,\n stringify\n} = JSON;\nconst set = (name, data) => {\n localStorage.setItem(name, data);\n};\nconst setJson = (name, data) => {\n localStorage.setItem(name, stringify(data));\n};\nconst get = name => {\n return localStorage.getItem(name);\n};\nconst getJson = name => {\n const data = localStorage.getItem(name);\n return parse(data);\n};\nconst clear = () => {\n localStorage.clear();\n};\nconst remove = item => {\n localStorage.removeItem(item);\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/storage.js\n}");
239
239
 
240
240
  /***/ },
241
241
 
242
- /***/ "./client/dom/upload-files.mjs"
243
- /*!*************************************!*\
244
- !*** ./client/dom/upload-files.mjs ***!
245
- \*************************************/
242
+ /***/ "./client/dom/upload-files.js"
243
+ /*!************************************!*\
244
+ !*** ./client/dom/upload-files.js ***!
245
+ \************************************/
246
246
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
247
247
 
248
248
  "use strict";
249
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ uploadFiles: () => (/* binding */ uploadFiles)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _current_file_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./current-file.mjs */ \"./client/dom/current-file.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nconst loadFile = wraptile__WEBPACK_IMPORTED_MODULE_1__(_loadFile);\nconst onEnd = wraptile__WEBPACK_IMPORTED_MODULE_1__(_onEnd);\nconst uploadFiles = (dir, files) => {\n if (!files) {\n files = dir;\n dir = (0,_current_file_mjs__WEBPACK_IMPORTED_MODULE_6__.getCurrentDirPath)();\n }\n const n = files.length;\n if (!n) return;\n const array = Array.from(files);\n const {\n name\n } = files[0];\n (0,execon__WEBPACK_IMPORTED_MODULE_0__.eachSeries)(array, loadFile(dir, n), onEnd(name));\n};\nfunction _onEnd(currentName) {\n CloudCmd.refresh({\n currentName\n });\n}\nfunction _loadFile(dir, n, file, callback) {\n let i = 0;\n const {\n name\n } = file;\n const path = dir + name;\n const {\n prefixURL\n } = CloudCmd;\n const api = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_4__.FS;\n const percent = (i, n, per = 100) => {\n return Math.round(i * per / n);\n };\n const step = n => 100 / n;\n ++i;\n _dom_load__WEBPACK_IMPORTED_MODULE_2__.put(api + path, file).on('error', showError).on('end', callback).on('progress', count => {\n const max = step(n);\n const value = (i - 1) * max + percent(count, 100, max);\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.show.load('top');\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.setProgress(Math.round(value));\n });\n}\nfunction showError({\n message\n}) {\n (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_3__.alert)(message);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/upload-files.mjs\n}");
249
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ uploadFiles: () => (/* binding */ uploadFiles)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _current_file_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./current-file.js */ \"./client/dom/current-file.js\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nconst loadFile = wraptile__WEBPACK_IMPORTED_MODULE_1__(_loadFile);\nconst onEnd = wraptile__WEBPACK_IMPORTED_MODULE_1__(_onEnd);\nconst uploadFiles = (dir, files) => {\n if (!files) {\n files = dir;\n dir = (0,_current_file_js__WEBPACK_IMPORTED_MODULE_6__.getCurrentDirPath)();\n }\n const n = files.length;\n if (!n) return;\n const array = Array.from(files);\n const {\n name\n } = files[0];\n (0,execon__WEBPACK_IMPORTED_MODULE_0__.eachSeries)(array, loadFile(dir, n), onEnd(name));\n};\nfunction _onEnd(currentName) {\n CloudCmd.refresh({\n currentName\n });\n}\nfunction _loadFile(dir, n, file, callback) {\n let i = 0;\n const {\n name\n } = file;\n const path = dir + name;\n const {\n prefixURL\n } = CloudCmd;\n const api = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_4__.FS;\n const percent = (i, n, per = 100) => {\n return Math.round(i * per / n);\n };\n const step = n => 100 / n;\n ++i;\n _dom_load__WEBPACK_IMPORTED_MODULE_2__.put(api + path, file).on('error', showError).on('end', callback).on('progress', count => {\n const max = step(n);\n const value = (i - 1) * max + percent(count, 100, max);\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.show.load('top');\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.setProgress(Math.round(value));\n });\n}\nfunction showError({\n message\n}) {\n (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_3__.alert)(message);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/upload-files.js\n}");
250
250
 
251
251
  /***/ },
252
252
 
253
- /***/ "./client/get-json-from-file-table.mjs"
254
- /*!*********************************************!*\
255
- !*** ./client/get-json-from-file-table.mjs ***!
256
- \*********************************************/
253
+ /***/ "./client/get-json-from-file-table.js"
254
+ /*!********************************************!*\
255
+ !*** ./client/get-json-from-file-table.js ***!
256
+ \********************************************/
257
257
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
258
258
 
259
259
  "use strict";
260
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getJsonFromFileTable: () => (/* binding */ getJsonFromFileTable)\n/* harmony export */ });\n/* global DOM */\n/**\n * Функция генерирует JSON из html-таблицы файлов и\n * используеться при первом заходе в корень\n */\nconst getJsonFromFileTable = () => {\n const Info = DOM.CurrentInfo;\n const path = DOM.getCurrentDirPath();\n const infoFiles = Info.files || [];\n const files = infoFiles.filter(notParent).map(parse);\n const fileTable = {\n path,\n files\n };\n return fileTable;\n};\nconst notParent = current => {\n const name = DOM.getCurrentName(current);\n return name !== '..';\n};\nconst parse = current => {\n const name = DOM.getCurrentName(current);\n const size = DOM.getCurrentSize(current);\n const owner = DOM.getCurrentOwner(current);\n const mode = DOM.getCurrentMode(current);\n const date = DOM.getCurrentDate(current);\n const type = DOM.getCurrentType(current);\n return {\n name,\n size,\n mode,\n owner,\n date,\n type\n };\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/get-json-from-file-table.mjs\n}");
260
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getJsonFromFileTable: () => (/* binding */ getJsonFromFileTable)\n/* harmony export */ });\n/* global DOM */\n/**\n * Функция генерирует JSON из html-таблицы файлов и\n * используеться при первом заходе в корень\n */\nconst getJsonFromFileTable = () => {\n const Info = DOM.CurrentInfo;\n const path = DOM.getCurrentDirPath();\n const infoFiles = Info.files || [];\n const files = infoFiles.filter(notParent).map(parse);\n const fileTable = {\n path,\n files\n };\n return fileTable;\n};\nconst notParent = current => {\n const name = DOM.getCurrentName(current);\n return name !== '..';\n};\nconst parse = current => {\n const name = DOM.getCurrentName(current);\n const size = DOM.getCurrentSize(current);\n const owner = DOM.getCurrentOwner(current);\n const mode = DOM.getCurrentMode(current);\n const date = DOM.getCurrentDate(current);\n const type = DOM.getCurrentType(current);\n return {\n name,\n size,\n mode,\n owner,\n date,\n type\n };\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/get-json-from-file-table.js\n}");
261
261
 
262
262
  /***/ },
263
263
 
264
- /***/ "./client/key/binder.mjs"
265
- /*!*******************************!*\
266
- !*** ./client/key/binder.mjs ***!
267
- \*******************************/
264
+ /***/ "./client/key/binder.js"
265
+ /*!******************************!*\
266
+ !*** ./client/key/binder.js ***!
267
+ \******************************/
268
268
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
269
269
 
270
270
  "use strict";
271
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createBinder: () => (/* binding */ createBinder)\n/* harmony export */ });\nconst createBinder = () => {\n let binded = false;\n return {\n isBind() {\n return binded;\n },\n setBind() {\n binded = true;\n },\n unsetBind() {\n binded = false;\n }\n };\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/binder.mjs\n}");
271
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createBinder: () => (/* binding */ createBinder)\n/* harmony export */ });\nconst createBinder = () => {\n let binded = false;\n return {\n isBind() {\n return binded;\n },\n setBind() {\n binded = true;\n },\n unsetBind() {\n binded = false;\n }\n };\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/binder.js\n}");
272
272
 
273
273
  /***/ },
274
274
 
275
- /***/ "./client/key/index.mjs"
276
- /*!******************************!*\
277
- !*** ./client/key/index.mjs ***!
278
- \******************************/
275
+ /***/ "./client/key/index.js"
276
+ /*!*****************************!*\
277
+ !*** ./client/key/index.js ***!
278
+ \*****************************/
279
279
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
280
280
 
281
281
  "use strict";
282
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Key: () => (/* binding */ Key),\n/* harmony export */ _listener: () => (/* binding */ _listener)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../dom/buffer.mjs */ \"./client/dom/buffer.mjs\");\n/* harmony import */ var _key_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./key.mjs */ \"./client/key/key.mjs\");\n/* harmony import */ var _vim_index_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./vim/index.mjs */ \"./client/key/vim/index.mjs\");\n/* harmony import */ var _set_current_by_char_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./set-current-by-char.mjs */ \"./client/key/set-current-by-char.mjs\");\n/* harmony import */ var _binder_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./binder.mjs */ \"./client/key/binder.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\n\n\nconst Chars = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__.fullstore)();\nconst toggleVim = (keyCode, overrides = {}) => {\n const {\n _config,\n config\n } = overrides;\n if (keyCode === _key_mjs__WEBPACK_IMPORTED_MODULE_4__.ESC) _config('vim', !config('vim'));\n};\nconst isUndefined = a => typeof a === 'undefined';\nChars([]);\nconst {\n assign\n} = Object;\nconst binder = (0,_binder_mjs__WEBPACK_IMPORTED_MODULE_7__.createBinder)();\nconst bind = () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_2__.addKey(listener, true);\n binder.setBind();\n};\nconst Key = assign(binder, _key_mjs__WEBPACK_IMPORTED_MODULE_4__, {\n bind\n});\nconst _listener = listener;\nfunction getChar(event) {\n /*\n * event.keyIdentifier deprecated in chrome v51\n * but event.key is absent in chrome <= v51\n */\n const {\n key,\n shift,\n keyCode,\n keyIdentifier\n } = event;\n const char = key || fromCharCode(keyIdentifier);\n const symbol = getSymbol(shift, keyCode);\n return [symbol, char];\n}\nasync function listener(event, overrides = {}) {\n const {\n config = CloudCmd.config,\n _config = CloudCmd._config,\n switchKey = _switchKey,\n vim = _vim_index_mjs__WEBPACK_IMPORTED_MODULE_5__[\"default\"]\n } = overrides;\n const {\n keyCode\n } = event;\n\n // strange chrome bug calls listener twice\n // in second time event misses a lot fields\n if (isUndefined(event.altKey)) return;\n const alt = event.altKey;\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const isBetween = keyCode >= _key_mjs__WEBPACK_IMPORTED_MODULE_4__.ZERO && keyCode <= _key_mjs__WEBPACK_IMPORTED_MODULE_4__.Z;\n const isNumpad = /Numpad/.test(event.code);\n const [symbol, char] = getChar(event);\n if (!binder.isBind()) return;\n toggleVim(keyCode, {\n config,\n _config\n });\n const isVim = config('vim');\n if (!isVim && !isNumpad && !alt && !ctrl && !meta && (isBetween || symbol)) return (0,_set_current_by_char_mjs__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(char, Chars);\n Chars([]);\n await switchKey(event);\n if (keyCode >= _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F1 && keyCode <= _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F10) return;\n if (isVim) vim(char, event);\n}\nfunction getSymbol(shift, keyCode) {\n switch (keyCode) {\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.DOT:\n return '.';\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.HYPHEN:\n return shift ? '_' : '-';\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.EQUAL:\n return shift ? '+' : '=';\n }\n return '';\n}\nfunction fromCharCode(keyIdentifier) {\n const code = keyIdentifier.substring(2);\n const hex = parseInt(code, 16);\n return String.fromCharCode(hex);\n}\nasync function _switchKey(event) {\n const Info = DOM.CurrentInfo;\n let i;\n let isSelected;\n let prev;\n let next;\n let current = Info.element;\n let dataName;\n const {\n name,\n panel,\n path,\n isDir\n } = Info;\n const {\n Operation,\n changeDir,\n config\n } = CloudCmd;\n const {\n keyCode\n } = event;\n const alt = event.altKey;\n const shift = event.shiftKey;\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n if (current) {\n prev = current.previousSibling;\n next = current.nextSibling;\n }\n switch (keyCode) {\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.TAB:\n DOM.changePanel();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.INSERT:\n DOM.toggleSelectedFile(current).setCurrentFile(next);\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.INSERT_MAC:\n DOM.toggleSelectedFile(current).setCurrentFile(next);\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.DELETE:\n if (shift) Operation.show('delete:silent');else Operation.show('delete');\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.ASTERISK:\n DOM.toggleAllSelectedFiles(current);\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.PLUS:\n DOM.expandSelection();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.MINUS:\n DOM.shrinkSelection();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F1:\n CloudCmd.Help.show();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F2:\n CloudCmd.UserMenu.show();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F3:\n event.preventDefault();\n if (Info.isDir) await changeDir(path);else if (shift) CloudCmd.View.show(null, {\n raw: true\n });else if (ctrlMeta) CloudCmd.sortPanel('name');else CloudCmd.View.show();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F4:\n if (config('vim')) CloudCmd.EditFileVim.show();else CloudCmd.EditFile.show();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F5:\n if (ctrlMeta) CloudCmd.sortPanel('date');else if (alt) Operation.show('pack');else Operation.show('copy');\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F6:\n if (ctrlMeta) CloudCmd.sortPanel('size');else if (shift) DOM.renameCurrent(current);else Operation.show('move');\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F7:\n if (shift) DOM.promptNewFile();else DOM.promptNewDir();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F8:\n Operation.show('delete');\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F9:\n if (alt) Operation.show('extract');else CloudCmd.Menu.show();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F10:\n CloudCmd.Config.show();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.TRA:\n event.preventDefault();\n if (shift) return CloudCmd.Terminal.show();\n CloudCmd.Konsole.show();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.BRACKET_CLOSE:\n CloudCmd.Konsole.show();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.SPACE:\n event.preventDefault();\n if (!isDir || name === '..') isSelected = true;else isSelected = DOM.isSelected(current);\n if (!isSelected) await DOM.loadCurrentSize(current);\n DOM.toggleSelectedFile(current);\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.U:\n if (ctrlMeta) {\n DOM.swapPanels();\n event.preventDefault();\n }\n break;\n\n /* navigation on file table: *\n * in case of pressing button 'up', *\n * select previous row */\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.UP:\n if (shift) DOM.toggleSelectedFile(current);\n DOM.setCurrentFile(prev);\n event.preventDefault();\n break;\n\n /* in case of pressing button 'down', *\n * select next row */\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.DOWN:\n if (shift) DOM.toggleSelectedFile(current);\n DOM.setCurrentFile(next);\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.LEFT:\n if (!alt) return;\n event.preventDefault();\n dataName = Info.panel.getAttribute('data-name');\n if (dataName === 'js-right') DOM.duplicatePanel();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.RIGHT:\n if (!alt) return;\n event.preventDefault();\n dataName = Info.panel.getAttribute('data-name');\n if (dataName === 'js-left') DOM.duplicatePanel();\n break;\n\n /* in case of pressing button 'Home', *\n * go to top element */\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.HOME:\n DOM.setCurrentFile(Info.first);\n event.preventDefault();\n break;\n\n /* in case of pressing button 'End', select last element */\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.END:\n DOM.setCurrentFile(Info.last);\n event.preventDefault();\n break;\n\n /* если нажали клавишу page down проматываем экран */\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.PAGE_DOWN:\n DOM.scrollByPages(panel, 1);\n for (i = 0; i < 30; i++) {\n if (!current.nextSibling) break;\n current = current.nextSibling;\n }\n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n\n /* если нажали клавишу page up проматываем экран */\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.PAGE_UP:\n DOM.scrollByPages(panel, -1);\n for (i = 0; i < 30; i++) {\n if (!current.previousSibling) break;\n current = current.previousSibling;\n }\n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.ENTER:\n if (Info.isDir) await changeDir(path);else CloudCmd.View.show();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.BACKSPACE:\n CloudCmd.goToParentDir();\n event.preventDefault();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.BACKSLASH:\n if (ctrlMeta) await changeDir('/');\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.A:\n if (ctrlMeta) {\n DOM.selectAllFiles();\n event.preventDefault();\n }\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.G:\n if (alt) {\n DOM.goToDirectory();\n event.preventDefault();\n }\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.M:\n if (ctrlMeta) {\n if (config('vim')) CloudCmd.EditNamesVim.show();else CloudCmd.EditNames.show();\n event.preventDefault();\n }\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.P:\n if (!ctrlMeta) return;\n event.preventDefault();\n _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_0__.writeText(Info.dirPath).catch(CloudCmd.log);\n break;\n\n /**\n * обновляем страницу,\n * загружаем содержимое каталога\n * при этом данные берём всегда с\n * сервера, а не из кэша\n * (обновляем кэш)\n */\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.R:\n if (ctrlMeta) {\n CloudCmd.log('reloading page...\\n');\n CloudCmd.refresh();\n event.preventDefault();\n }\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.C:\n if (ctrlMeta) _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__.copy();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.X:\n if (ctrlMeta) _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__.cut();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.V:\n if (ctrlMeta) _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__.paste();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.Z:\n if (ctrlMeta) _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__.clear();\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.COLON:\n CloudCmd.CommandLine.show();\n event.preventDefault();\n break;\n\n /* чистим хранилище */\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.D:\n if (ctrlMeta) {\n CloudCmd.log('clearing storage...');\n await DOM.Storage.clear();\n CloudCmd.log('storage cleared');\n event.preventDefault();\n }\n break;\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.DOT:\n if (meta && shift) {\n const showDotFiles = !CloudCmd.config('showDotFiles');\n CloudCmd._config('showDotFiles', showDotFiles);\n CloudCmd.refresh();\n await DOM.RESTful.Config.write({\n showDotFiles\n });\n }\n break;\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/index.mjs\n}");
282
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Key: () => (/* binding */ Key),\n/* harmony export */ _listener: () => (/* binding */ _listener)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _dom_buffer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../dom/buffer.js */ \"./client/dom/buffer.js\");\n/* harmony import */ var _key_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./key.js */ \"./client/key/key.js\");\n/* harmony import */ var _vim_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./vim/index.js */ \"./client/key/vim/index.js\");\n/* harmony import */ var _set_current_by_char_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./set-current-by-char.js */ \"./client/key/set-current-by-char.js\");\n/* harmony import */ var _binder_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./binder.js */ \"./client/key/binder.js\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\n\n\nconst Chars = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__.fullstore)();\nconst toggleVim = (keyCode, overrides = {}) => {\n const {\n _config,\n config\n } = overrides;\n if (keyCode === _key_js__WEBPACK_IMPORTED_MODULE_4__.ESC) _config('vim', !config('vim'));\n};\nconst isUndefined = a => typeof a === 'undefined';\nChars([]);\nconst {\n assign\n} = Object;\nconst binder = (0,_binder_js__WEBPACK_IMPORTED_MODULE_7__.createBinder)();\nconst bind = () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_2__.addKey(listener, true);\n binder.setBind();\n};\nconst Key = assign(binder, _key_js__WEBPACK_IMPORTED_MODULE_4__, {\n bind\n});\nconst _listener = listener;\nfunction getChar(event) {\n /*\n * event.keyIdentifier deprecated in chrome v51\n * but event.key is absent in chrome <= v51\n */\n const {\n key,\n shift,\n keyCode,\n keyIdentifier\n } = event;\n const char = key || fromCharCode(keyIdentifier);\n const symbol = getSymbol(shift, keyCode);\n return [symbol, char];\n}\nasync function listener(event, overrides = {}) {\n const {\n config = CloudCmd.config,\n _config = CloudCmd._config,\n switchKey = _switchKey,\n vim = _vim_index_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]\n } = overrides;\n const {\n keyCode\n } = event;\n\n // strange chrome bug calls listener twice\n // in second time event misses a lot fields\n if (isUndefined(event.altKey)) return;\n const alt = event.altKey;\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const isBetween = keyCode >= _key_js__WEBPACK_IMPORTED_MODULE_4__.ZERO && keyCode <= _key_js__WEBPACK_IMPORTED_MODULE_4__.Z;\n const isNumpad = /Numpad/.test(event.code);\n const [symbol, char] = getChar(event);\n if (!binder.isBind()) return;\n toggleVim(keyCode, {\n config,\n _config\n });\n const isVim = config('vim');\n if (!isVim && !isNumpad && !alt && !ctrl && !meta && (isBetween || symbol)) return (0,_set_current_by_char_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(char, Chars);\n Chars([]);\n await switchKey(event);\n if (keyCode >= _key_js__WEBPACK_IMPORTED_MODULE_4__.F1 && keyCode <= _key_js__WEBPACK_IMPORTED_MODULE_4__.F10) return;\n if (isVim) vim(char, event);\n}\nfunction getSymbol(shift, keyCode) {\n switch (keyCode) {\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.DOT:\n return '.';\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.HYPHEN:\n return shift ? '_' : '-';\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.EQUAL:\n return shift ? '+' : '=';\n }\n return '';\n}\nfunction fromCharCode(keyIdentifier) {\n const code = keyIdentifier.substring(2);\n const hex = parseInt(code, 16);\n return String.fromCharCode(hex);\n}\nasync function _switchKey(event) {\n const Info = DOM.CurrentInfo;\n let i;\n let isSelected;\n let prev;\n let next;\n let current = Info.element;\n let dataName;\n const {\n name,\n panel,\n path,\n isDir\n } = Info;\n const {\n Operation,\n changeDir,\n config\n } = CloudCmd;\n const {\n keyCode\n } = event;\n const alt = event.altKey;\n const shift = event.shiftKey;\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n if (current) {\n prev = current.previousSibling;\n next = current.nextSibling;\n }\n switch (keyCode) {\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.TAB:\n DOM.changePanel();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.INSERT:\n DOM.toggleSelectedFile(current).setCurrentFile(next);\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.INSERT_MAC:\n DOM.toggleSelectedFile(current).setCurrentFile(next);\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.DELETE:\n if (shift) Operation.show('delete:silent');else Operation.show('delete');\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.ASTERISK:\n DOM.toggleAllSelectedFiles(current);\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.PLUS:\n DOM.expandSelection();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.MINUS:\n DOM.shrinkSelection();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F1:\n CloudCmd.Help.show();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F2:\n CloudCmd.UserMenu.show();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F3:\n event.preventDefault();\n if (Info.isDir) await changeDir(path);else if (shift) CloudCmd.View.show(null, {\n raw: true\n });else if (ctrlMeta) CloudCmd.sortPanel('name');else CloudCmd.View.show();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F4:\n if (config('vim')) CloudCmd.EditFileVim.show();else CloudCmd.EditFile.show();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F5:\n if (ctrlMeta) CloudCmd.sortPanel('date');else if (alt) Operation.show('pack');else Operation.show('copy');\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F6:\n if (ctrlMeta) CloudCmd.sortPanel('size');else if (shift) DOM.renameCurrent(current);else Operation.show('move');\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F7:\n if (shift) DOM.promptNewFile();else DOM.promptNewDir();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F8:\n Operation.show('delete');\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F9:\n if (alt) Operation.show('extract');else CloudCmd.Menu.show();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.F10:\n CloudCmd.Config.show();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.TRA:\n event.preventDefault();\n if (shift) return CloudCmd.Terminal.show();\n CloudCmd.Konsole.show();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.BRACKET_CLOSE:\n CloudCmd.Konsole.show();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.SPACE:\n event.preventDefault();\n if (!isDir || name === '..') isSelected = true;else isSelected = DOM.isSelected(current);\n if (!isSelected) await DOM.loadCurrentSize(current);\n DOM.toggleSelectedFile(current);\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.U:\n if (ctrlMeta) {\n DOM.swapPanels();\n event.preventDefault();\n }\n break;\n\n /* navigation on file table: *\n * in case of pressing button 'up', *\n * select previous row */\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.UP:\n if (shift) DOM.toggleSelectedFile(current);\n DOM.setCurrentFile(prev);\n event.preventDefault();\n break;\n\n /* in case of pressing button 'down', *\n * select next row */\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.DOWN:\n if (shift) DOM.toggleSelectedFile(current);\n DOM.setCurrentFile(next);\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.LEFT:\n if (!alt) return;\n event.preventDefault();\n dataName = Info.panel.getAttribute('data-name');\n if (dataName === 'js-right') DOM.duplicatePanel();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.RIGHT:\n if (!alt) return;\n event.preventDefault();\n dataName = Info.panel.getAttribute('data-name');\n if (dataName === 'js-left') DOM.duplicatePanel();\n break;\n\n /* in case of pressing button 'Home', *\n * go to top element */\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.HOME:\n DOM.setCurrentFile(Info.first);\n event.preventDefault();\n break;\n\n /* in case of pressing button 'End', select last element */\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.END:\n DOM.setCurrentFile(Info.last);\n event.preventDefault();\n break;\n\n /* если нажали клавишу page down проматываем экран */\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.PAGE_DOWN:\n DOM.scrollByPages(panel, 1);\n for (i = 0; i < 30; i++) {\n if (!current.nextSibling) break;\n current = current.nextSibling;\n }\n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n\n /* если нажали клавишу page up проматываем экран */\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.PAGE_UP:\n DOM.scrollByPages(panel, -1);\n for (i = 0; i < 30; i++) {\n if (!current.previousSibling) break;\n current = current.previousSibling;\n }\n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.ENTER:\n if (Info.isDir) await changeDir(path);else CloudCmd.View.show();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.BACKSPACE:\n CloudCmd.goToParentDir();\n event.preventDefault();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.BACKSLASH:\n if (ctrlMeta) await changeDir('/');\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.A:\n if (ctrlMeta) {\n DOM.selectAllFiles();\n event.preventDefault();\n }\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.G:\n if (alt) {\n DOM.goToDirectory();\n event.preventDefault();\n }\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.M:\n if (ctrlMeta) {\n if (config('vim')) CloudCmd.EditNamesVim.show();else CloudCmd.EditNames.show();\n event.preventDefault();\n }\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.P:\n if (!ctrlMeta) return;\n event.preventDefault();\n _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_0__.writeText(Info.dirPath).catch(CloudCmd.log);\n break;\n\n /**\n * обновляем страницу,\n * загружаем содержимое каталога\n * при этом данные берём всегда с\n * сервера, а не из кэша\n * (обновляем кэш)\n */\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.R:\n if (ctrlMeta) {\n CloudCmd.log('reloading page...\\n');\n CloudCmd.refresh();\n event.preventDefault();\n }\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.C:\n if (ctrlMeta) _dom_buffer_js__WEBPACK_IMPORTED_MODULE_3__.copy();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.X:\n if (ctrlMeta) _dom_buffer_js__WEBPACK_IMPORTED_MODULE_3__.cut();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.V:\n if (ctrlMeta) _dom_buffer_js__WEBPACK_IMPORTED_MODULE_3__.paste();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.Z:\n if (ctrlMeta) _dom_buffer_js__WEBPACK_IMPORTED_MODULE_3__.clear();\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.COLON:\n CloudCmd.CommandLine.show();\n event.preventDefault();\n break;\n\n /* чистим хранилище */\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.D:\n if (ctrlMeta) {\n CloudCmd.log('clearing storage...');\n await DOM.Storage.clear();\n CloudCmd.log('storage cleared');\n event.preventDefault();\n }\n break;\n case _key_js__WEBPACK_IMPORTED_MODULE_4__.DOT:\n if (meta && shift) {\n const showDotFiles = !CloudCmd.config('showDotFiles');\n CloudCmd._config('showDotFiles', showDotFiles);\n CloudCmd.refresh();\n await DOM.RESTful.Config.write({\n showDotFiles\n });\n }\n break;\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/index.js\n}");
283
283
 
284
284
  /***/ },
285
285
 
286
- /***/ "./client/key/key.mjs"
287
- /*!****************************!*\
288
- !*** ./client/key/key.mjs ***!
289
- \****************************/
286
+ /***/ "./client/key/key.js"
287
+ /*!***************************!*\
288
+ !*** ./client/key/key.js ***!
289
+ \***************************/
290
290
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
291
291
 
292
292
  "use strict";
293
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ A: () => (/* binding */ A),\n/* harmony export */ ASTERISK: () => (/* binding */ ASTERISK),\n/* harmony export */ BACKSLASH: () => (/* binding */ BACKSLASH),\n/* harmony export */ BACKSPACE: () => (/* binding */ BACKSPACE),\n/* harmony export */ BRACKET_CLOSE: () => (/* binding */ BRACKET_CLOSE),\n/* harmony export */ C: () => (/* binding */ C),\n/* harmony export */ CAPSLOCK: () => (/* binding */ CAPSLOCK),\n/* harmony export */ COLON: () => (/* binding */ COLON),\n/* harmony export */ D: () => (/* binding */ D),\n/* harmony export */ DELETE: () => (/* binding */ DELETE),\n/* harmony export */ DOT: () => (/* binding */ DOT),\n/* harmony export */ DOWN: () => (/* binding */ DOWN),\n/* harmony export */ END: () => (/* binding */ END),\n/* harmony export */ ENTER: () => (/* binding */ ENTER),\n/* harmony export */ EQUAL: () => (/* binding */ EQUAL),\n/* harmony export */ ESC: () => (/* binding */ ESC),\n/* harmony export */ F1: () => (/* binding */ F1),\n/* harmony export */ F10: () => (/* binding */ F10),\n/* harmony export */ F2: () => (/* binding */ F2),\n/* harmony export */ F3: () => (/* binding */ F3),\n/* harmony export */ F4: () => (/* binding */ F4),\n/* harmony export */ F5: () => (/* binding */ F5),\n/* harmony export */ F6: () => (/* binding */ F6),\n/* harmony export */ F7: () => (/* binding */ F7),\n/* harmony export */ F8: () => (/* binding */ F8),\n/* harmony export */ F9: () => (/* binding */ F9),\n/* harmony export */ G: () => (/* binding */ G),\n/* harmony export */ HOME: () => (/* binding */ HOME),\n/* harmony export */ HYPHEN: () => (/* binding */ HYPHEN),\n/* harmony export */ INSERT: () => (/* binding */ INSERT),\n/* harmony export */ INSERT_MAC: () => (/* binding */ INSERT_MAC),\n/* harmony export */ J: () => (/* binding */ J),\n/* harmony export */ K: () => (/* binding */ K),\n/* harmony export */ LEFT: () => (/* binding */ LEFT),\n/* harmony export */ M: () => (/* binding */ M),\n/* harmony export */ MINUS: () => (/* binding */ MINUS),\n/* harmony export */ O: () => (/* binding */ O),\n/* harmony export */ P: () => (/* binding */ P),\n/* harmony export */ PAGE_DOWN: () => (/* binding */ PAGE_DOWN),\n/* harmony export */ PAGE_UP: () => (/* binding */ PAGE_UP),\n/* harmony export */ PLUS: () => (/* binding */ PLUS),\n/* harmony export */ Q: () => (/* binding */ Q),\n/* harmony export */ R: () => (/* binding */ R),\n/* harmony export */ RIGHT: () => (/* binding */ RIGHT),\n/* harmony export */ S: () => (/* binding */ S),\n/* harmony export */ SEMICOLON: () => (/* binding */ SEMICOLON),\n/* harmony export */ SLASH: () => (/* binding */ SLASH),\n/* harmony export */ SPACE: () => (/* binding */ SPACE),\n/* harmony export */ T: () => (/* binding */ T),\n/* harmony export */ TAB: () => (/* binding */ TAB),\n/* harmony export */ TRA: () => (/* binding */ TRA),\n/* harmony export */ U: () => (/* binding */ U),\n/* harmony export */ UP: () => (/* binding */ UP),\n/* harmony export */ V: () => (/* binding */ V),\n/* harmony export */ X: () => (/* binding */ X),\n/* harmony export */ Z: () => (/* binding */ Z),\n/* harmony export */ ZERO: () => (/* binding */ ZERO)\n/* harmony export */ });\nconst BACKSPACE = 8;\nconst TAB = 9;\nconst ENTER = 13;\nconst CAPSLOCK = 20;\nconst ESC = 27;\nconst SPACE = 32;\nconst PAGE_UP = 33;\nconst PAGE_DOWN = 34;\nconst END = 35;\nconst HOME = 36;\nconst LEFT = 37;\nconst UP = 38;\nconst RIGHT = 39;\nconst DOWN = 40;\nconst INSERT = 45;\nconst DELETE = 46;\nconst ZERO = 48;\nconst SEMICOLON = 52;\nconst A = 65;\nconst C = 67;\nconst D = 68;\nconst G = 71;\nconst J = 74;\nconst K = 75;\nconst M = 77;\nconst O = 79;\nconst P = 80;\nconst Q = 81;\nconst R = 82;\nconst S = 83;\nconst T = 84;\nconst U = 85;\nconst V = 86;\nconst X = 88;\nconst Z = 90;\nconst INSERT_MAC = 96;\nconst ASTERISK = 106;\nconst PLUS = 107;\nconst MINUS = 109;\nconst F1 = 112;\nconst F2 = 113;\nconst F3 = 114;\nconst F4 = 115;\nconst F5 = 116;\nconst F6 = 117;\nconst F7 = 118;\nconst F8 = 119;\nconst F9 = 120;\nconst F10 = 121;\nconst COLON = 186;\nconst EQUAL = 187;\nconst HYPHEN = 189;\nconst DOT = 190;\nconst SLASH = 191;\nconst TRA = 192;\nconst BACKSLASH = 220;\nconst BRACKET_CLOSE = 221;\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/key.mjs\n}");
293
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ A: () => (/* binding */ A),\n/* harmony export */ ASTERISK: () => (/* binding */ ASTERISK),\n/* harmony export */ BACKSLASH: () => (/* binding */ BACKSLASH),\n/* harmony export */ BACKSPACE: () => (/* binding */ BACKSPACE),\n/* harmony export */ BRACKET_CLOSE: () => (/* binding */ BRACKET_CLOSE),\n/* harmony export */ C: () => (/* binding */ C),\n/* harmony export */ CAPSLOCK: () => (/* binding */ CAPSLOCK),\n/* harmony export */ COLON: () => (/* binding */ COLON),\n/* harmony export */ D: () => (/* binding */ D),\n/* harmony export */ DELETE: () => (/* binding */ DELETE),\n/* harmony export */ DOT: () => (/* binding */ DOT),\n/* harmony export */ DOWN: () => (/* binding */ DOWN),\n/* harmony export */ END: () => (/* binding */ END),\n/* harmony export */ ENTER: () => (/* binding */ ENTER),\n/* harmony export */ EQUAL: () => (/* binding */ EQUAL),\n/* harmony export */ ESC: () => (/* binding */ ESC),\n/* harmony export */ F1: () => (/* binding */ F1),\n/* harmony export */ F10: () => (/* binding */ F10),\n/* harmony export */ F2: () => (/* binding */ F2),\n/* harmony export */ F3: () => (/* binding */ F3),\n/* harmony export */ F4: () => (/* binding */ F4),\n/* harmony export */ F5: () => (/* binding */ F5),\n/* harmony export */ F6: () => (/* binding */ F6),\n/* harmony export */ F7: () => (/* binding */ F7),\n/* harmony export */ F8: () => (/* binding */ F8),\n/* harmony export */ F9: () => (/* binding */ F9),\n/* harmony export */ G: () => (/* binding */ G),\n/* harmony export */ HOME: () => (/* binding */ HOME),\n/* harmony export */ HYPHEN: () => (/* binding */ HYPHEN),\n/* harmony export */ INSERT: () => (/* binding */ INSERT),\n/* harmony export */ INSERT_MAC: () => (/* binding */ INSERT_MAC),\n/* harmony export */ J: () => (/* binding */ J),\n/* harmony export */ K: () => (/* binding */ K),\n/* harmony export */ LEFT: () => (/* binding */ LEFT),\n/* harmony export */ M: () => (/* binding */ M),\n/* harmony export */ MINUS: () => (/* binding */ MINUS),\n/* harmony export */ O: () => (/* binding */ O),\n/* harmony export */ P: () => (/* binding */ P),\n/* harmony export */ PAGE_DOWN: () => (/* binding */ PAGE_DOWN),\n/* harmony export */ PAGE_UP: () => (/* binding */ PAGE_UP),\n/* harmony export */ PLUS: () => (/* binding */ PLUS),\n/* harmony export */ Q: () => (/* binding */ Q),\n/* harmony export */ R: () => (/* binding */ R),\n/* harmony export */ RIGHT: () => (/* binding */ RIGHT),\n/* harmony export */ S: () => (/* binding */ S),\n/* harmony export */ SEMICOLON: () => (/* binding */ SEMICOLON),\n/* harmony export */ SLASH: () => (/* binding */ SLASH),\n/* harmony export */ SPACE: () => (/* binding */ SPACE),\n/* harmony export */ T: () => (/* binding */ T),\n/* harmony export */ TAB: () => (/* binding */ TAB),\n/* harmony export */ TRA: () => (/* binding */ TRA),\n/* harmony export */ U: () => (/* binding */ U),\n/* harmony export */ UP: () => (/* binding */ UP),\n/* harmony export */ V: () => (/* binding */ V),\n/* harmony export */ X: () => (/* binding */ X),\n/* harmony export */ Z: () => (/* binding */ Z),\n/* harmony export */ ZERO: () => (/* binding */ ZERO)\n/* harmony export */ });\nconst BACKSPACE = 8;\nconst TAB = 9;\nconst ENTER = 13;\nconst CAPSLOCK = 20;\nconst ESC = 27;\nconst SPACE = 32;\nconst PAGE_UP = 33;\nconst PAGE_DOWN = 34;\nconst END = 35;\nconst HOME = 36;\nconst LEFT = 37;\nconst UP = 38;\nconst RIGHT = 39;\nconst DOWN = 40;\nconst INSERT = 45;\nconst DELETE = 46;\nconst ZERO = 48;\nconst SEMICOLON = 52;\nconst A = 65;\nconst C = 67;\nconst D = 68;\nconst G = 71;\nconst J = 74;\nconst K = 75;\nconst M = 77;\nconst O = 79;\nconst P = 80;\nconst Q = 81;\nconst R = 82;\nconst S = 83;\nconst T = 84;\nconst U = 85;\nconst V = 86;\nconst X = 88;\nconst Z = 90;\nconst INSERT_MAC = 96;\nconst ASTERISK = 106;\nconst PLUS = 107;\nconst MINUS = 109;\nconst F1 = 112;\nconst F2 = 113;\nconst F3 = 114;\nconst F4 = 115;\nconst F5 = 116;\nconst F6 = 117;\nconst F7 = 118;\nconst F8 = 119;\nconst F9 = 120;\nconst F10 = 121;\nconst COLON = 186;\nconst EQUAL = 187;\nconst HYPHEN = 189;\nconst DOT = 190;\nconst SLASH = 191;\nconst TRA = 192;\nconst BACKSLASH = 220;\nconst BRACKET_CLOSE = 221;\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/key.js\n}");
294
294
 
295
295
  /***/ },
296
296
 
297
- /***/ "./client/key/set-current-by-char.mjs"
298
- /*!********************************************!*\
299
- !*** ./client/key/set-current-by-char.mjs ***!
300
- \********************************************/
297
+ /***/ "./client/key/set-current-by-char.js"
298
+ /*!*******************************************!*\
299
+ !*** ./client/key/set-current-by-char.js ***!
300
+ \*******************************************/
301
301
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
302
302
 
303
303
  "use strict";
304
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ setCurrentByChar)\n/* harmony export */ });\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* global DOM */\n\nfunction setCurrentByChar(char, charStore) {\n const Info = DOM.CurrentInfo;\n let firstByName;\n let skipCount = 0;\n let set = false;\n let i = 0;\n const escapeChar = (0,_common_util__WEBPACK_IMPORTED_MODULE_0__.escapeRegExp)(char);\n const regExp = new RegExp(`^${escapeChar}.*$`, 'i');\n const {\n files\n } = Info;\n const chars = charStore();\n const n = chars.length;\n while (i < n && char === chars[i]) i++;\n if (!i) charStore([]);\n const skipN = skipCount = i;\n charStore(charStore().concat(char));\n const names = DOM.getFilenames(files);\n const isTest = a => regExp.test(a);\n const isRoot = a => a === '..';\n const not = f => a => !f(a);\n const setCurrent = name => {\n const byName = DOM.getCurrentByName(name);\n if (!skipCount) {\n set = true;\n DOM.setCurrentFile(byName);\n return true;\n }\n if (skipN === skipCount) firstByName = byName;\n --skipCount;\n };\n names.filter(isTest).filter(not(isRoot)).some(setCurrent);\n if (!set) {\n DOM.setCurrentFile(firstByName);\n charStore([char]);\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/set-current-by-char.mjs\n}");
304
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ setCurrentByChar)\n/* harmony export */ });\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* global DOM */\n\nfunction setCurrentByChar(char, charStore) {\n const Info = DOM.CurrentInfo;\n let firstByName;\n let skipCount = 0;\n let set = false;\n let i = 0;\n const escapeChar = (0,_common_util__WEBPACK_IMPORTED_MODULE_0__.escapeRegExp)(char);\n const regExp = new RegExp(`^${escapeChar}.*$`, 'i');\n const {\n files\n } = Info;\n const chars = charStore();\n const n = chars.length;\n while (i < n && char === chars[i]) i++;\n if (!i) charStore([]);\n const skipN = skipCount = i;\n charStore(charStore().concat(char));\n const names = DOM.getFilenames(files);\n const isTest = a => regExp.test(a);\n const isRoot = a => a === '..';\n const not = f => a => !f(a);\n const setCurrent = name => {\n const byName = DOM.getCurrentByName(name);\n if (!skipCount) {\n set = true;\n DOM.setCurrentFile(byName);\n return true;\n }\n if (skipN === skipCount) firstByName = byName;\n --skipCount;\n };\n names.filter(isTest).filter(not(isRoot)).some(setCurrent);\n if (!set) {\n DOM.setCurrentFile(firstByName);\n charStore([char]);\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/set-current-by-char.js\n}");
305
305
 
306
306
  /***/ },
307
307
 
308
- /***/ "./client/key/vim/find.mjs"
309
- /*!*********************************!*\
310
- !*** ./client/key/vim/find.mjs ***!
311
- \*********************************/
308
+ /***/ "./client/key/vim/find.js"
309
+ /*!********************************!*\
310
+ !*** ./client/key/vim/find.js ***!
311
+ \********************************/
312
312
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
313
313
 
314
314
  "use strict";
315
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _next: () => (/* binding */ _next),\n/* harmony export */ _previous: () => (/* binding */ _previous),\n/* harmony export */ find: () => (/* binding */ find),\n/* harmony export */ findNext: () => (/* binding */ findNext),\n/* harmony export */ findPrevious: () => (/* binding */ findPrevious)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var limier__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! limier */ \"./node_modules/limier/lib/limier.js\");\n\n\nconst searchStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)([]);\nconst searchIndex = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)(0);\nconst find = (value, names) => {\n const result = limier__WEBPACK_IMPORTED_MODULE_1__(value, names);\n searchStore(result);\n searchIndex(0);\n return result;\n};\nconst findNext = () => {\n const names = searchStore();\n const index = next(searchIndex(), names.length);\n searchIndex(index);\n return names[searchIndex()];\n};\nconst findPrevious = () => {\n const names = searchStore();\n const index = previous(searchIndex(), names.length);\n searchIndex(index);\n return names[index];\n};\nconst _next = next;\nconst _previous = previous;\nfunction next(index, length) {\n if (index === length - 1) return 0;\n return ++index;\n}\nfunction previous(index, length) {\n if (!index) return length - 1;\n return --index;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/vim/find.mjs\n}");
315
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _next: () => (/* binding */ _next),\n/* harmony export */ _previous: () => (/* binding */ _previous),\n/* harmony export */ find: () => (/* binding */ find),\n/* harmony export */ findNext: () => (/* binding */ findNext),\n/* harmony export */ findPrevious: () => (/* binding */ findPrevious)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var limier__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! limier */ \"./node_modules/limier/lib/limier.js\");\n\n\nconst searchStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)([]);\nconst searchIndex = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)(0);\nconst find = (value, names) => {\n const result = limier__WEBPACK_IMPORTED_MODULE_1__(value, names);\n searchStore(result);\n searchIndex(0);\n return result;\n};\nconst findNext = () => {\n const names = searchStore();\n const index = next(searchIndex(), names.length);\n searchIndex(index);\n return names[searchIndex()];\n};\nconst findPrevious = () => {\n const names = searchStore();\n const index = previous(searchIndex(), names.length);\n searchIndex(index);\n return names[index];\n};\nconst _next = next;\nconst _previous = previous;\nfunction next(index, length) {\n if (index === length - 1) return 0;\n return ++index;\n}\nfunction previous(index, length) {\n if (!index) return length - 1;\n return --index;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/vim/find.js\n}");
316
316
 
317
317
  /***/ },
318
318
 
319
- /***/ "./client/key/vim/index.mjs"
320
- /*!**********************************!*\
321
- !*** ./client/key/vim/index.mjs ***!
322
- \**********************************/
319
+ /***/ "./client/key/vim/index.js"
320
+ /*!*********************************!*\
321
+ !*** ./client/key/vim/index.js ***!
322
+ \*********************************/
323
323
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
324
324
 
325
325
  "use strict";
326
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ selectFile: () => (/* binding */ selectFile)\n/* harmony export */ });\n/* harmony import */ var _vim_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vim.mjs */ \"./client/key/vim/vim.mjs\");\n/* harmony import */ var _find_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./find.mjs */ \"./client/key/vim/find.mjs\");\n/* harmony import */ var _set_current_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./set-current.mjs */ \"./client/key/vim/set-current.mjs\");\n/* global CloudCmd */\n/* global DOM */\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((key, event, overrides = {}) => {\n const defaults = {\n ...globalThis.DOM,\n ...globalThis.CloudCmd\n };\n const deps = {\n ...defaults,\n ...overrides\n };\n const operations = getOperations(event, deps);\n (0,_vim_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(key, operations, deps);\n});\nconst getOperations = (event, deps) => {\n var _event$preventDefault, _event$preventDefault2;\n const {\n Info = globalThis.DOM.CurrentInfo,\n CloudCmd = globalThis.CloudCmd,\n Operation,\n unselectFiles,\n setCurrentFile,\n setCurrentByName,\n getCurrentName,\n prompt = globalThis.DOM.Dialog.prompt,\n preventDefault = event === null || event === void 0 || (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.bind(event),\n stopImmediatePropagation = event === null || event === void 0 || (_event$preventDefault2 = event.preventDefault) === null || _event$preventDefault2 === void 0 ? void 0 : _event$preventDefault2.bind(event),\n promptNewFile = DOM.promptNewFile,\n toggleSelectedFile,\n Buffer = {},\n createFindNext = _createFindNext,\n createFindPrevious = _createFindPrevious,\n createMakeFile = _createMakeFile\n } = deps;\n return {\n makeFile: createMakeFile({\n promptNewFile,\n preventDefault,\n stopImmediatePropagation\n }),\n findNext: createFindNext({\n setCurrentByName\n }),\n findPrevious: createFindPrevious({\n setCurrentByName\n }),\n escape: unselectFiles,\n remove: () => {\n Operation.show('delete');\n },\n makeDirectory: () => {\n event.stopImmediatePropagation();\n event.preventDefault();\n DOM.promptNewDir();\n },\n terminal: () => {\n CloudCmd.Terminal.show();\n },\n edit: () => {\n CloudCmd.EditFileVim.show();\n },\n copy: () => {\n Buffer.copy();\n unselectFiles();\n },\n select: () => {\n const current = Info.element;\n toggleSelectedFile(current);\n },\n paste: Buffer.paste,\n moveNext: ({\n count,\n isVisual,\n isDelete\n }) => {\n (0,_set_current_mjs__WEBPACK_IMPORTED_MODULE_2__.setCurrent)('next', {\n count,\n isVisual,\n isDelete\n }, {\n Info,\n setCurrentFile,\n unselectFiles,\n Operation\n });\n },\n movePrevious: ({\n count,\n isVisual,\n isDelete\n }) => {\n (0,_set_current_mjs__WEBPACK_IMPORTED_MODULE_2__.setCurrent)('previous', {\n count,\n isVisual,\n isDelete\n }, {\n Info,\n setCurrentFile,\n unselectFiles,\n Operation\n });\n },\n find: async () => {\n preventDefault();\n const [, value] = await prompt('Find', '');\n if (!value) return;\n const names = Info.files.map(getCurrentName);\n const [result] = _find_mjs__WEBPACK_IMPORTED_MODULE_1__.find(value, names);\n setCurrentByName(result);\n }\n };\n};\nconst selectFile = _set_current_mjs__WEBPACK_IMPORTED_MODULE_2__.selectFileNotParent;\nconst _createFindPrevious = (overrides = {}) => () => {\n const {\n setCurrentByName\n } = overrides;\n const name = _find_mjs__WEBPACK_IMPORTED_MODULE_1__.findPrevious();\n setCurrentByName(name);\n};\nconst _createFindNext = (overrides = {}) => () => {\n const {\n setCurrentByName\n } = overrides;\n const name = _find_mjs__WEBPACK_IMPORTED_MODULE_1__.findNext();\n setCurrentByName(name);\n};\nconst _createMakeFile = (overrides = {}) => () => {\n const {\n promptNewFile,\n stopImmediatePropagation,\n preventDefault\n } = overrides;\n stopImmediatePropagation();\n preventDefault();\n promptNewFile();\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/vim/index.mjs\n}");
326
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ selectFile: () => (/* binding */ selectFile)\n/* harmony export */ });\n/* harmony import */ var _vim_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vim.js */ \"./client/key/vim/vim.js\");\n/* harmony import */ var _find_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./find.js */ \"./client/key/vim/find.js\");\n/* harmony import */ var _set_current_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./set-current.js */ \"./client/key/vim/set-current.js\");\n/* global CloudCmd */\n/* global DOM */\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((key, event, overrides = {}) => {\n const defaults = {\n ...globalThis.DOM,\n ...globalThis.CloudCmd\n };\n const deps = {\n ...defaults,\n ...overrides\n };\n const operations = getOperations(event, deps);\n (0,_vim_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(key, operations, deps);\n});\nconst getOperations = (event, deps) => {\n var _event$preventDefault, _event$preventDefault2;\n const {\n Info = globalThis.DOM.CurrentInfo,\n CloudCmd = globalThis.CloudCmd,\n Operation,\n unselectFiles,\n setCurrentFile,\n setCurrentByName,\n getCurrentName,\n prompt = globalThis.DOM.Dialog.prompt,\n preventDefault = event === null || event === void 0 || (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.bind(event),\n stopImmediatePropagation = event === null || event === void 0 || (_event$preventDefault2 = event.preventDefault) === null || _event$preventDefault2 === void 0 ? void 0 : _event$preventDefault2.bind(event),\n promptNewFile = DOM.promptNewFile,\n toggleSelectedFile,\n Buffer = {},\n createFindNext = _createFindNext,\n createFindPrevious = _createFindPrevious,\n createMakeFile = _createMakeFile\n } = deps;\n return {\n makeFile: createMakeFile({\n promptNewFile,\n preventDefault,\n stopImmediatePropagation\n }),\n findNext: createFindNext({\n setCurrentByName\n }),\n findPrevious: createFindPrevious({\n setCurrentByName\n }),\n escape: unselectFiles,\n remove: () => {\n Operation.show('delete');\n },\n makeDirectory: () => {\n event.stopImmediatePropagation();\n event.preventDefault();\n DOM.promptNewDir();\n },\n terminal: () => {\n CloudCmd.Terminal.show();\n },\n edit: () => {\n CloudCmd.EditFileVim.show();\n },\n copy: () => {\n Buffer.copy();\n unselectFiles();\n },\n select: () => {\n const current = Info.element;\n toggleSelectedFile(current);\n },\n paste: Buffer.paste,\n moveNext: ({\n count,\n isVisual,\n isDelete\n }) => {\n (0,_set_current_js__WEBPACK_IMPORTED_MODULE_2__.setCurrent)('next', {\n count,\n isVisual,\n isDelete\n }, {\n Info,\n setCurrentFile,\n unselectFiles,\n Operation\n });\n },\n movePrevious: ({\n count,\n isVisual,\n isDelete\n }) => {\n (0,_set_current_js__WEBPACK_IMPORTED_MODULE_2__.setCurrent)('previous', {\n count,\n isVisual,\n isDelete\n }, {\n Info,\n setCurrentFile,\n unselectFiles,\n Operation\n });\n },\n find: async () => {\n preventDefault();\n const [, value] = await prompt('Find', '');\n if (!value) return;\n const names = Info.files.map(getCurrentName);\n const [result] = _find_js__WEBPACK_IMPORTED_MODULE_1__.find(value, names);\n setCurrentByName(result);\n }\n };\n};\nconst selectFile = _set_current_js__WEBPACK_IMPORTED_MODULE_2__.selectFileNotParent;\nconst _createFindPrevious = (overrides = {}) => () => {\n const {\n setCurrentByName\n } = overrides;\n const name = _find_js__WEBPACK_IMPORTED_MODULE_1__.findPrevious();\n setCurrentByName(name);\n};\nconst _createFindNext = (overrides = {}) => () => {\n const {\n setCurrentByName\n } = overrides;\n const name = _find_js__WEBPACK_IMPORTED_MODULE_1__.findNext();\n setCurrentByName(name);\n};\nconst _createMakeFile = (overrides = {}) => () => {\n const {\n promptNewFile,\n stopImmediatePropagation,\n preventDefault\n } = overrides;\n stopImmediatePropagation();\n preventDefault();\n promptNewFile();\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/vim/index.js\n}");
327
327
 
328
328
  /***/ },
329
329
 
330
- /***/ "./client/key/vim/set-current.mjs"
331
- /*!****************************************!*\
332
- !*** ./client/key/vim/set-current.mjs ***!
333
- \****************************************/
330
+ /***/ "./client/key/vim/set-current.js"
331
+ /*!***************************************!*\
332
+ !*** ./client/key/vim/set-current.js ***!
333
+ \***************************************/
334
334
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
335
335
 
336
336
  "use strict";
337
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ selectFileNotParent: () => (/* binding */ selectFileNotParent),\n/* harmony export */ setCurrent: () => (/* binding */ setCurrent)\n/* harmony export */ });\n/* global DOM */\nfunction selectFileNotParent(current, {\n getCurrentName,\n selectFile\n} = DOM) {\n const name = getCurrentName(current);\n if (name === '..') return;\n selectFile(current);\n}\nconst setCurrent = (sibling, {\n count,\n isVisual,\n isDelete\n}, {\n Info,\n setCurrentFile,\n unselectFiles,\n Operation\n}) => {\n let current = Info.element;\n const select = isVisual ? selectFileNotParent : unselectFiles;\n select(current);\n const position = `${sibling}Sibling`;\n for (let i = 0; i < count; i++) {\n const next = current[position];\n if (!next) break;\n current = next;\n select(current);\n }\n setCurrentFile(current);\n if (isDelete) Operation.show('delete');\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/vim/set-current.mjs\n}");
337
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ selectFileNotParent: () => (/* binding */ selectFileNotParent),\n/* harmony export */ setCurrent: () => (/* binding */ setCurrent)\n/* harmony export */ });\n/* global DOM */\nfunction selectFileNotParent(current, {\n getCurrentName,\n selectFile\n} = DOM) {\n const name = getCurrentName(current);\n if (name === '..') return;\n selectFile(current);\n}\nconst setCurrent = (sibling, {\n count,\n isVisual,\n isDelete\n}, {\n Info,\n setCurrentFile,\n unselectFiles,\n Operation\n}) => {\n let current = Info.element;\n const select = isVisual ? selectFileNotParent : unselectFiles;\n select(current);\n const position = `${sibling}Sibling`;\n for (let i = 0; i < count; i++) {\n const next = current[position];\n if (!next) break;\n current = next;\n select(current);\n }\n setCurrentFile(current);\n if (isDelete) Operation.show('delete');\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/vim/set-current.js\n}");
338
338
 
339
339
  /***/ },
340
340
 
341
- /***/ "./client/key/vim/vim.mjs"
342
- /*!********************************!*\
343
- !*** ./client/key/vim/vim.mjs ***!
344
- \********************************/
341
+ /***/ "./client/key/vim/vim.js"
342
+ /*!*******************************!*\
343
+ !*** ./client/key/vim/vim.js ***!
344
+ \*******************************/
345
345
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
346
346
 
347
347
  "use strict";
348
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n\nconst store = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)('');\nconst visual = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)(false);\nconst stopVisual = () => {\n visual(false);\n};\nconst end = () => {\n store('');\n};\nconst rmFirst = a => {\n return a.split('').slice(1).join('');\n};\nconst noop = () => {};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((key, operations = {}) => {\n const prevStore = store();\n const isVisual = visual();\n const value = store(prevStore.concat(key));\n const {\n escape = noop,\n moveNext = noop,\n movePrevious = noop,\n remove = noop,\n copy = noop,\n paste = noop,\n select = noop,\n find = noop,\n findNext = noop,\n findPrevious = noop,\n makeFile = noop,\n makeDirectory = noop,\n terminal = noop,\n edit = noop\n } = operations;\n if (key === 'Enter') return end();\n if (key === 'Escape') {\n visual(false);\n escape();\n return end();\n }\n if (key === 'j' || key === 'w') {\n const {\n count,\n isDelete,\n isVisual\n } = handleDelete(prevStore);\n !isNaN(count) && moveNext({\n count,\n isVisual,\n isDelete\n });\n return end();\n }\n if (key === 'k' || key === 'b') {\n const {\n count,\n isDelete,\n isVisual\n } = handleDelete(prevStore);\n !isNaN(count) && movePrevious({\n count,\n isVisual,\n isDelete\n });\n return end();\n }\n if (value === 'gg' || key === '^') {\n const {\n isDelete,\n isVisual\n } = handleDelete(prevStore);\n movePrevious({\n count: Infinity,\n isVisual,\n isDelete\n });\n return end();\n }\n if (value === 'md') {\n makeDirectory();\n return end();\n }\n if (value === 'tt') {\n terminal();\n return end();\n }\n if (value === 'e') {\n edit();\n return end();\n }\n if (value === 'mf') {\n makeFile();\n return end();\n }\n if (key === 'd' && (visual() || prevStore === 'd')) {\n stopVisual();\n remove();\n return end();\n }\n if (key === 'G' || key === '$') {\n moveNext({\n count: Infinity,\n isVisual\n });\n return end();\n }\n if (key === 'y') {\n if (!visual()) return end();\n stopVisual();\n copy();\n return end();\n }\n if (/^p$/i.test(key)) {\n paste();\n return end();\n }\n if (/^v$/i.test(key)) {\n visual(!visual());\n select();\n return end();\n }\n if (key === '/') {\n find();\n return end();\n }\n if (key === 'n') {\n findNext();\n return end();\n }\n if (key === 'N') {\n findPrevious();\n return end();\n }\n if (key === ' ') return end();\n});\nfunction handleDelete(prevStore) {\n const isDelete = prevStore[0] === 'd';\n if (isDelete) {\n visual(true);\n prevStore = rmFirst(prevStore);\n }\n const count = getNumber(prevStore);\n const isVisual = visual();\n return {\n count,\n isDelete,\n isVisual\n };\n}\nfunction getNumber(value) {\n if (!value) return 1;\n if (value === 'g') return 1;\n return parseInt(value);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/vim/vim.mjs\n}");
348
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n\nconst store = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)('');\nconst visual = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)(false);\nconst stopVisual = () => {\n visual(false);\n};\nconst end = () => {\n store('');\n};\nconst rmFirst = a => {\n return a.split('').slice(1).join('');\n};\nconst noop = () => {};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((key, operations = {}) => {\n const prevStore = store();\n const isVisual = visual();\n const value = store(prevStore.concat(key));\n const {\n escape = noop,\n moveNext = noop,\n movePrevious = noop,\n remove = noop,\n copy = noop,\n paste = noop,\n select = noop,\n find = noop,\n findNext = noop,\n findPrevious = noop,\n makeFile = noop,\n makeDirectory = noop,\n terminal = noop,\n edit = noop\n } = operations;\n if (key === 'Enter') return end();\n if (key === 'Escape') {\n visual(false);\n escape();\n return end();\n }\n if (key === 'j' || key === 'w') {\n const {\n count,\n isDelete,\n isVisual\n } = handleDelete(prevStore);\n !isNaN(count) && moveNext({\n count,\n isVisual,\n isDelete\n });\n return end();\n }\n if (key === 'k' || key === 'b') {\n const {\n count,\n isDelete,\n isVisual\n } = handleDelete(prevStore);\n !isNaN(count) && movePrevious({\n count,\n isVisual,\n isDelete\n });\n return end();\n }\n if (value === 'gg' || key === '^') {\n const {\n isDelete,\n isVisual\n } = handleDelete(prevStore);\n movePrevious({\n count: Infinity,\n isVisual,\n isDelete\n });\n return end();\n }\n if (value === 'md') {\n makeDirectory();\n return end();\n }\n if (value === 'tt') {\n terminal();\n return end();\n }\n if (value === 'e') {\n edit();\n return end();\n }\n if (value === 'mf') {\n makeFile();\n return end();\n }\n if (key === 'd' && (visual() || prevStore === 'd')) {\n stopVisual();\n remove();\n return end();\n }\n if (key === 'G' || key === '$') {\n moveNext({\n count: Infinity,\n isVisual\n });\n return end();\n }\n if (key === 'y') {\n if (!visual()) return end();\n stopVisual();\n copy();\n return end();\n }\n if (/^p$/i.test(key)) {\n paste();\n return end();\n }\n if (/^v$/i.test(key)) {\n visual(!visual());\n select();\n return end();\n }\n if (key === '/') {\n find();\n return end();\n }\n if (key === 'n') {\n findNext();\n return end();\n }\n if (key === 'N') {\n findPrevious();\n return end();\n }\n if (key === ' ') return end();\n});\nfunction handleDelete(prevStore) {\n const isDelete = prevStore[0] === 'd';\n if (isDelete) {\n visual(true);\n prevStore = rmFirst(prevStore);\n }\n const count = getNumber(prevStore);\n const isVisual = visual();\n return {\n count,\n isDelete,\n isVisual\n };\n}\nfunction getNumber(value) {\n if (!value) return 1;\n if (value === 'g') return 1;\n return parseInt(value);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/vim/vim.js\n}");
349
349
 
350
350
  /***/ },
351
351
 
352
- /***/ "./client/listeners/get-index.mjs"
353
- /*!****************************************!*\
354
- !*** ./client/listeners/get-index.mjs ***!
355
- \****************************************/
352
+ /***/ "./client/listeners/get-index.js"
353
+ /*!***************************************!*\
354
+ !*** ./client/listeners/get-index.js ***!
355
+ \***************************************/
356
356
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
357
357
 
358
358
  "use strict";
359
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getIndex: () => (/* binding */ getIndex)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst getIndex = currify__WEBPACK_IMPORTED_MODULE_0__((array, item) => {\n const index = array.indexOf(item);\n if (!~index) return 0;\n return index;\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/get-index.mjs\n}");
359
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getIndex: () => (/* binding */ getIndex)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst getIndex = currify__WEBPACK_IMPORTED_MODULE_0__((array, item) => {\n const index = array.indexOf(item);\n if (!~index) return 0;\n return index;\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/get-index.js\n}");
360
360
 
361
361
  /***/ },
362
362
 
363
- /***/ "./client/listeners/get-range.mjs"
364
- /*!****************************************!*\
365
- !*** ./client/listeners/get-range.mjs ***!
366
- \****************************************/
363
+ /***/ "./client/listeners/get-range.js"
364
+ /*!***************************************!*\
365
+ !*** ./client/listeners/get-range.js ***!
366
+ \***************************************/
367
367
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
368
368
 
369
369
  "use strict";
370
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getRange: () => (/* binding */ getRange)\n/* harmony export */ });\nconst getRange = (indexFrom, indexTo, files) => {\n if (indexFrom < indexTo) return files.slice(indexFrom, indexTo + 1);\n if (indexFrom > indexTo) return files.slice(indexTo, indexFrom + 1);\n return [files[indexFrom]];\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/get-range.mjs\n}");
370
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getRange: () => (/* binding */ getRange)\n/* harmony export */ });\nconst getRange = (indexFrom, indexTo, files) => {\n if (indexFrom < indexTo) return files.slice(indexFrom, indexTo + 1);\n if (indexFrom > indexTo) return files.slice(indexTo, indexFrom + 1);\n return [files[indexFrom]];\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/get-range.js\n}");
371
371
 
372
372
  /***/ },
373
373
 
374
- /***/ "./client/listeners/index.mjs"
375
- /*!************************************!*\
376
- !*** ./client/listeners/index.mjs ***!
377
- \************************************/
374
+ /***/ "./client/listeners/index.js"
375
+ /*!***********************************!*\
376
+ !*** ./client/listeners/index.js ***!
377
+ \***********************************/
378
378
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
379
379
 
380
380
  "use strict";
381
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ initKeysPanel: () => (/* binding */ initKeysPanel),\n/* harmony export */ setOnPanel: () => (/* binding */ setOnPanel)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _dom_upload_files__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/upload-files */ \"./client/dom/upload-files.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _get_range_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./get-range.mjs */ \"./client/listeners/get-range.mjs\");\n/* harmony import */ var _get_index_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-index.mjs */ \"./client/listeners/get-index.mjs\");\n/* global DOM, CloudCmd */\n\n\n\n\n\n\n\n\n\n\nconst NBSP_REG = RegExp(String.fromCharCode(160), 'g');\nconst SPACE = ' ';\nconst init = async () => {\n contextMenu();\n dragndrop();\n unload();\n pop();\n resize();\n header();\n await config();\n};\nconst unselect = event => {\n const isMac = /Mac/.test(globalThis.navigator.platform);\n const {\n shiftKey,\n metaKey,\n ctrlKey\n } = event;\n if (shiftKey || isMac && metaKey || ctrlKey) return;\n DOM.unselectFiles();\n};\nconst execAll = currify__WEBPACK_IMPORTED_MODULE_2__((funcs, event) => {\n for (const fn of funcs) fn(event);\n});\nconst EventsFiles = {\n mousedown: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, setCurrentFileByEvent),\n click: execAll([onClick, execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotMobile, unselect)]),\n dragstart: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onDragStart),\n dblclick: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onDblClick),\n touchstart: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onTouch)\n};\nlet EXT;\nfunction header() {\n const fm = DOM.getFM();\n const isDataset = el => el.dataset;\n const isPanel = el => {\n return /^js-(left|right)$/.test(el.dataset.name);\n };\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(fm, event => {\n const el = event.target;\n const parent = el.parentElement;\n if (parent.dataset.name !== 'js-fm-header') return;\n const name = (el.dataset.name || '').replace('js-', '');\n if (!/^(name|size|date)$/.test(name)) return;\n const panel = getPath(el).filter(isDataset).filter(isPanel).pop();\n CloudCmd.sortPanel(name, panel);\n });\n}\nfunction getPath(el, path = []) {\n if (!el) return path;\n return getPath(el.parentElement, path.concat(el));\n}\nasync function config() {\n const [, config] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_3__.tryToCatch)(DOM.Files.get, 'config');\n const type = config === null || config === void 0 ? void 0 : config.packer;\n EXT = DOM.getPackerExt(type);\n}\nconst initKeysPanel = () => {\n const keysElement = DOM.getById('js-keyspanel');\n if (!keysElement) return;\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(keysElement, event => {\n const {\n target\n } = event;\n const {\n id\n } = target;\n const operation = name => {\n const {\n Operation\n } = CloudCmd;\n return Operation.show.bind(null, name);\n };\n const clickFuncs = {\n 'f1': CloudCmd.Help.show,\n 'f2': CloudCmd.UserMenu.show,\n 'f3': CloudCmd.View.show,\n 'f4': CloudCmd.EditFile.show,\n 'f5': operation('copy'),\n 'f6': operation('move'),\n 'f7': DOM.promptNewDir,\n 'f8': operation('delete'),\n 'f9': () => {\n event.stopPropagation();\n CloudCmd.Menu.show();\n },\n 'f10': CloudCmd.Config.show,\n '~': CloudCmd.Konsole.show,\n 'shift~': CloudCmd.Terminal.show,\n 'contact': CloudCmd.Contact.show\n };\n execon__WEBPACK_IMPORTED_MODULE_0__(clickFuncs[id]);\n });\n};\nconst getPanel = side => {\n if (!itype__WEBPACK_IMPORTED_MODULE_1__.string(side)) return side;\n return DOM.getByDataName(`js-${side}`);\n};\nconst setOnPanel = side => {\n const panel = getPanel(side);\n const filesElement = DOM.getByDataName('js-files', panel);\n const pathElement = DOM.getByDataName('js-path', panel);\n\n /* ставим загрузку гифа на клик*/\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(pathElement, getPathListener(panel));\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add(filesElement, EventsFiles);\n};\nfunction getPathListener(panel) {\n return onPathElementClick.bind(null, panel);\n}\nfunction isNoCurrent(panel) {\n const Info = DOM.CurrentInfo;\n const infoPanel = Info.panel;\n if (!infoPanel) return true;\n const namePanel = panel.getAttribute('data-name');\n const nameInfoPanel = infoPanel.getAttribute('data-name');\n return namePanel !== nameInfoPanel;\n}\nfunction decodePath(path) {\n const url = CloudCmd.HOST;\n const {\n prefix\n } = CloudCmd;\n const prefixReg = RegExp('^' + prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__.FS);\n return decodeURI(path).replace(url, '').replace(prefixReg, '') // browser doesn't replace % -> %25% do it for him\n .replace('%%', '%25%').replace(NBSP_REG, SPACE) || '/';\n}\nasync function onPathElementClick(panel, event) {\n const Info = DOM.CurrentInfo;\n event.preventDefault();\n const element = event.target;\n const attr = element.getAttribute('data-name');\n const noCurrent = isNoCurrent(panel);\n if (attr === 'js-copy-path') return copyPath(element);\n if (attr === 'js-refresh') return CloudCmd.refresh({\n panel,\n noCurrent\n });\n if (attr !== 'js-path-link') return;\n const {\n href\n } = element;\n const path = decodePath(href);\n await CloudCmd.changeDir(path, {\n isRefresh: false,\n panel: noCurrent ? panel : Info.panel\n });\n}\nfunction copyPath(el) {\n _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_4__.writeText(el.parentElement.title).then(CloudCmd.log).catch(CloudCmd.log);\n}\nfunction execIfNotMobile(callback, event) {\n const isMobile = DOM.getCSSVar('is-mobile');\n if (!isMobile) callback(event);\n}\nfunction execIfNotUL(callback, event) {\n const {\n target\n } = event;\n const {\n tagName\n } = target;\n if (tagName !== 'UL') callback(event);\n}\nfunction onClick(event) {\n event.preventDefault();\n changePanel(event.target);\n}\nfunction toggleSelect(key, files) {\n const isMac = /Mac/.test(globalThis.navigator.platform);\n if (!key) throw Error('key should not be undefined!');\n const [file] = files;\n if (isMac && key.meta) return DOM.toggleSelectedFile(file);\n if (key.shift) return files.map(DOM.selectFile);\n}\nfunction changePanel(element) {\n const Info = DOM.CurrentInfo;\n const {\n panel\n } = Info;\n const files = DOM.getByDataName('js-files', panel);\n const ul = getULElement(element);\n if (ul !== files) DOM.changePanel();\n}\nasync function onDblClick(event) {\n event.preventDefault();\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n const path = DOM.getCurrentPath(current);\n if (!isDir) return CloudCmd.View.show();\n await CloudCmd.changeDir(path);\n}\nasync function onTouch(event) {\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n if (!isDir) return;\n const isCurrent = DOM.isCurrentFile(current);\n if (!isCurrent) return;\n await CloudCmd.changeDir(DOM.getCurrentPath(current));\n}\n\n/*\n * download file from browser to desktop\n * in Chrome (HTML5)\n */\nfunction onDragStart(event) {\n const Info = DOM.CurrentInfo;\n const {\n prefixURL\n } = CloudCmd;\n const element = getLIElement(event.target);\n const {\n isDir\n } = Info;\n let link = DOM.getCurrentLink(element);\n let name = DOM.getCurrentName(element);\n\n /* if it's directory - adding json extension */\n if (isDir) {\n name += EXT;\n link = document.createElement('a');\n link.textContent = name;\n link.href = prefixURL + '/pack' + Info.path + EXT;\n }\n event.dataTransfer.setData('DownloadURL', 'application/octet-stream' + ':' + name + ':' + link);\n}\nfunction getLIElement(element) {\n if (!element) return element;\n while (element.tagName !== 'LI') element = element.parentElement;\n return element;\n}\nfunction getULElement(element) {\n while (element.tagName !== 'UL') element = element.parentElement;\n return element;\n}\nfunction setCurrentFileByEvent(event) {\n const Info = DOM.CurrentInfo;\n const BUTTON_LEFT = 0;\n const key = {\n alt: event.altKey,\n ctrl: event.ctrlKey,\n meta: event.metaKey,\n shift: event.shiftKey\n };\n const element = getLIElement(event.target);\n const fromName = Info.name;\n DOM.setCurrentFile(element);\n const toName = Info.name;\n let files = [];\n if (key.shift) files = getFilesRange(fromName, toName);else files.push(Info.element);\n if (event.button === BUTTON_LEFT) toggleSelect(key, files);\n}\nfunction getFilesRange(from, to) {\n const files = DOM.getAllFiles();\n const names = DOM.getFilenames(files);\n const getNameIndex = (0,_get_index_mjs__WEBPACK_IMPORTED_MODULE_9__.getIndex)(names);\n const indexFrom = getNameIndex(from);\n const indexTo = getNameIndex(to);\n return (0,_get_range_mjs__WEBPACK_IMPORTED_MODULE_8__.getRange)(indexFrom, indexTo, files);\n}\nfunction contextMenu() {\n const fm = DOM.getFM();\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addOnce('contextmenu', fm, event => {\n CloudCmd.Menu.show({\n x: event.clientX,\n y: event.clientY\n });\n });\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addContextMenu(fm, event => {\n CloudCmd.Menu.ENABLED || event.preventDefault();\n });\n}\nfunction dragndrop() {\n const panels = DOM.getByClassAll('panel');\n const select = ({\n target\n }) => {\n target.classList.add('selected-panel');\n };\n const unselect = ({\n target\n }) => {\n target.classList.remove('selected-panel');\n };\n const onDrop = event => {\n const {\n files,\n items\n } = event.dataTransfer;\n const {\n length: filesCount\n } = files;\n event.preventDefault();\n if (filesCount && (!items || !items.length || !items[0].webkitGetAsEntry)) return (0,_dom_upload_files__WEBPACK_IMPORTED_MODULE_6__.uploadFiles)(files);\n const isFile = item => item.kind === 'file';\n const dirFiles = Array.from(items).filter(isFile);\n if (dirFiles.length) return DOM.uploadDirectory(dirFiles);\n const {\n Operation\n } = CloudCmd;\n const operation = event.shiftKey ? 'move' : 'copy';\n return Operation.show(operation);\n };\n\n /**\n * In macOS Chrome dropEffect = 'none'\n * so drop do not firing up when try\n * to upload file from download bar\n */\n const onDragOver = event => {\n const {\n dataTransfer\n } = event;\n const {\n effectAllowed\n } = dataTransfer;\n if (/move|linkMove/.test(effectAllowed)) dataTransfer.dropEffect = 'move';else dataTransfer.dropEffect = 'copy';\n event.preventDefault();\n };\n for (const panel of panels) _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('dragover', panel, onDragOver).add('drop', panel, onDrop).add('dragenter', select).add(['dragleave', 'drop'], unselect);\n}\nfunction unload() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add(['unload', 'beforeunload'], event => {\n const {\n Key\n } = CloudCmd;\n const isBind = Key === null || Key === void 0 ? void 0 : Key.isBind();\n if (isBind) return;\n event.preventDefault();\n return 'Please make sure that you saved all work.';\n });\n}\nfunction pop() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('popstate', async ({\n state\n }) => {\n const path = (state || '').replace(_common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__.FS, '');\n if (!path) return CloudCmd.route(location.hash);\n const history = false;\n await CloudCmd.changeDir(path, {\n history\n });\n });\n}\nfunction resize() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('resize', () => {\n const Info = DOM.CurrentInfo;\n const is = globalThis.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH;\n if (!is) return;\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return;\n const name = panel.getAttribute('data-name');\n const isLeft = name === 'js-left';\n if (isLeft) return;\n DOM.changePanel();\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/index.mjs\n}");
381
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ initKeysPanel: () => (/* binding */ initKeysPanel),\n/* harmony export */ setOnPanel: () => (/* binding */ setOnPanel)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _dom_upload_files__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/upload-files */ \"./client/dom/upload-files.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _get_range_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./get-range.js */ \"./client/listeners/get-range.js\");\n/* harmony import */ var _get_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-index.js */ \"./client/listeners/get-index.js\");\n/* global DOM, CloudCmd */\n\n\n\n\n\n\n\n\n\n\nconst NBSP_REG = RegExp(String.fromCharCode(160), 'g');\nconst SPACE = ' ';\nasync function init() {\n contextMenu();\n dragndrop();\n unload();\n pop();\n resize();\n header();\n await config();\n}\nconst unselect = event => {\n const isMac = /Mac/.test(globalThis.navigator.platform);\n const {\n shiftKey,\n metaKey,\n ctrlKey\n } = event;\n if (shiftKey || isMac && metaKey || ctrlKey) return;\n DOM.unselectFiles();\n};\nconst execAll = currify__WEBPACK_IMPORTED_MODULE_2__((funcs, event) => {\n for (const fn of funcs) fn(event);\n});\nconst EventsFiles = {\n mousedown: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, setCurrentFileByEvent),\n click: execAll([onClick, execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotMobile, unselect)]),\n dragstart: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onDragStart),\n dblclick: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onDblClick),\n touchstart: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onTouch)\n};\nlet EXT;\nfunction header() {\n const fm = DOM.getFM();\n const isDataset = el => el.dataset;\n const isPanel = el => {\n return /^js-(left|right)$/.test(el.dataset.name);\n };\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(fm, event => {\n const el = event.target;\n const parent = el.parentElement;\n if (parent.dataset.name !== 'js-fm-header') return;\n const name = (el.dataset.name || '').replace('js-', '');\n if (!/^(name|size|date)$/.test(name)) return;\n const panel = getPath(el).filter(isDataset).filter(isPanel).pop();\n CloudCmd.sortPanel(name, panel);\n });\n}\nfunction getPath(el, path = []) {\n if (!el) return path;\n return getPath(el.parentElement, path.concat(el));\n}\nasync function config() {\n const [, config] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_3__.tryToCatch)(DOM.Files.get, 'config');\n const type = config === null || config === void 0 ? void 0 : config.packer;\n EXT = DOM.getPackerExt(type);\n}\nconst initKeysPanel = () => {\n const keysElement = DOM.getById('js-keyspanel');\n if (!keysElement) return;\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(keysElement, event => {\n const {\n target\n } = event;\n const {\n id\n } = target;\n const operation = name => {\n const {\n Operation\n } = CloudCmd;\n return Operation.show.bind(null, name);\n };\n const clickFuncs = {\n 'f1': CloudCmd.Help.show,\n 'f2': CloudCmd.UserMenu.show,\n 'f3': CloudCmd.View.show,\n 'f4': CloudCmd.EditFile.show,\n 'f5': operation('copy'),\n 'f6': operation('move'),\n 'f7': DOM.promptNewDir,\n 'f8': operation('delete'),\n 'f9': () => {\n event.stopPropagation();\n CloudCmd.Menu.show();\n },\n 'f10': CloudCmd.Config.show,\n '~': CloudCmd.Konsole.show,\n 'shift~': CloudCmd.Terminal.show,\n 'contact': CloudCmd.Contact.show\n };\n execon__WEBPACK_IMPORTED_MODULE_0__(clickFuncs[id]);\n });\n};\nconst getPanel = side => {\n if (!itype__WEBPACK_IMPORTED_MODULE_1__.string(side)) return side;\n return DOM.getByDataName(`js-${side}`);\n};\nconst setOnPanel = side => {\n const panel = getPanel(side);\n const filesElement = DOM.getByDataName('js-files', panel);\n const pathElement = DOM.getByDataName('js-path', panel);\n\n /* ставим загрузку гифа на клик*/\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(pathElement, getPathListener(panel));\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add(filesElement, EventsFiles);\n};\nfunction getPathListener(panel) {\n return onPathElementClick.bind(null, panel);\n}\nfunction isNoCurrent(panel) {\n const Info = DOM.CurrentInfo;\n const infoPanel = Info.panel;\n if (!infoPanel) return true;\n const namePanel = panel.getAttribute('data-name');\n const nameInfoPanel = infoPanel.getAttribute('data-name');\n return namePanel !== nameInfoPanel;\n}\nfunction decodePath(path) {\n const url = CloudCmd.HOST;\n const {\n prefix\n } = CloudCmd;\n const prefixReg = RegExp('^' + prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__.FS);\n return decodeURI(path).replace(url, '').replace(prefixReg, '') // browser doesn't replace % -> %25% do it for him\n .replace('%%', '%25%').replace(NBSP_REG, SPACE) || '/';\n}\nasync function onPathElementClick(panel, event) {\n const Info = DOM.CurrentInfo;\n event.preventDefault();\n const element = event.target;\n const attr = element.getAttribute('data-name');\n const noCurrent = isNoCurrent(panel);\n if (attr === 'js-copy-path') return copyPath(element);\n if (attr === 'js-refresh') return CloudCmd.refresh({\n panel,\n noCurrent\n });\n if (attr !== 'js-path-link') return;\n const {\n href\n } = element;\n const path = decodePath(href);\n await CloudCmd.changeDir(path, {\n isRefresh: false,\n panel: noCurrent ? panel : Info.panel\n });\n}\nfunction copyPath(el) {\n _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_4__.writeText(el.parentElement.title).then(CloudCmd.log).catch(CloudCmd.log);\n}\nfunction execIfNotMobile(callback, event) {\n const isMobile = DOM.getCSSVar('is-mobile');\n if (!isMobile) callback(event);\n}\nfunction execIfNotUL(callback, event) {\n const {\n target\n } = event;\n const {\n tagName\n } = target;\n if (tagName !== 'UL') callback(event);\n}\nfunction onClick(event) {\n event.preventDefault();\n changePanel(event.target);\n}\nfunction toggleSelect(key, files) {\n const isMac = /Mac/.test(globalThis.navigator.platform);\n if (!key) throw Error('key should not be undefined!');\n const [file] = files;\n if (isMac && key.meta) return DOM.toggleSelectedFile(file);\n if (key.shift) return files.map(DOM.selectFile);\n}\nfunction changePanel(element) {\n const Info = DOM.CurrentInfo;\n const {\n panel\n } = Info;\n const files = DOM.getByDataName('js-files', panel);\n const ul = getULElement(element);\n if (ul !== files) DOM.changePanel();\n}\nasync function onDblClick(event) {\n event.preventDefault();\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n const path = DOM.getCurrentPath(current);\n if (!isDir) return CloudCmd.View.show();\n await CloudCmd.changeDir(path);\n}\nasync function onTouch(event) {\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n if (!isDir) return;\n const isCurrent = DOM.isCurrentFile(current);\n if (!isCurrent) return;\n await CloudCmd.changeDir(DOM.getCurrentPath(current));\n}\n\n/*\n * download file from browser to desktop\n * in Chrome (HTML5)\n */\nfunction onDragStart(event) {\n const Info = DOM.CurrentInfo;\n const {\n prefixURL\n } = CloudCmd;\n const element = getLIElement(event.target);\n const {\n isDir\n } = Info;\n let link = DOM.getCurrentLink(element);\n let name = DOM.getCurrentName(element);\n\n /* if it's directory - adding json extension */\n if (isDir) {\n name += EXT;\n link = document.createElement('a');\n link.textContent = name;\n link.href = prefixURL + '/pack' + Info.path + EXT;\n }\n event.dataTransfer.setData('DownloadURL', 'application/octet-stream' + ':' + name + ':' + link);\n}\nfunction getLIElement(element) {\n if (!element) return element;\n while (element.tagName !== 'LI') element = element.parentElement;\n return element;\n}\nfunction getULElement(element) {\n while (element.tagName !== 'UL') element = element.parentElement;\n return element;\n}\nfunction setCurrentFileByEvent(event) {\n const Info = DOM.CurrentInfo;\n const BUTTON_LEFT = 0;\n const key = {\n alt: event.altKey,\n ctrl: event.ctrlKey,\n meta: event.metaKey,\n shift: event.shiftKey\n };\n const element = getLIElement(event.target);\n const fromName = Info.name;\n DOM.setCurrentFile(element);\n const toName = Info.name;\n let files = [];\n if (key.shift) files = getFilesRange(fromName, toName);else files.push(Info.element);\n if (event.button === BUTTON_LEFT) toggleSelect(key, files);\n}\nfunction getFilesRange(from, to) {\n const files = DOM.getAllFiles();\n const names = DOM.getFilenames(files);\n const getNameIndex = (0,_get_index_js__WEBPACK_IMPORTED_MODULE_9__.getIndex)(names);\n const indexFrom = getNameIndex(from);\n const indexTo = getNameIndex(to);\n return (0,_get_range_js__WEBPACK_IMPORTED_MODULE_8__.getRange)(indexFrom, indexTo, files);\n}\nfunction contextMenu() {\n const fm = DOM.getFM();\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addOnce('contextmenu', fm, event => {\n CloudCmd.Menu.show({\n x: event.clientX,\n y: event.clientY\n });\n });\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addContextMenu(fm, event => {\n CloudCmd.Menu.ENABLED || event.preventDefault();\n });\n}\nfunction dragndrop() {\n const panels = DOM.getByClassAll('panel');\n const select = ({\n target\n }) => {\n target.classList.add('selected-panel');\n };\n const unselect = ({\n target\n }) => {\n target.classList.remove('selected-panel');\n };\n const onDrop = event => {\n const {\n files,\n items\n } = event.dataTransfer;\n const {\n length: filesCount\n } = files;\n event.preventDefault();\n if (filesCount && (!items || !items.length || !items[0].webkitGetAsEntry)) return (0,_dom_upload_files__WEBPACK_IMPORTED_MODULE_6__.uploadFiles)(files);\n const isFile = item => item.kind === 'file';\n const dirFiles = Array.from(items).filter(isFile);\n if (dirFiles.length) return DOM.uploadDirectory(dirFiles);\n const {\n Operation\n } = CloudCmd;\n const operation = event.shiftKey ? 'move' : 'copy';\n return Operation.show(operation);\n };\n\n /**\n * In macOS Chrome dropEffect = 'none'\n * so drop do not firing up when try\n * to upload file from download bar\n */\n const onDragOver = event => {\n const {\n dataTransfer\n } = event;\n const {\n effectAllowed\n } = dataTransfer;\n if (/move|linkMove/.test(effectAllowed)) dataTransfer.dropEffect = 'move';else dataTransfer.dropEffect = 'copy';\n event.preventDefault();\n };\n for (const panel of panels) _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('dragover', panel, onDragOver).add('drop', panel, onDrop).add('dragenter', select).add(['dragleave', 'drop'], unselect);\n}\nfunction unload() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add(['unload', 'beforeunload'], event => {\n const {\n Key\n } = CloudCmd;\n const isBind = Key === null || Key === void 0 ? void 0 : Key.isBind();\n if (isBind) return;\n event.preventDefault();\n return 'Please make sure that you saved all work.';\n });\n}\nfunction pop() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('popstate', async ({\n state\n }) => {\n const path = (state || '').replace(_common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__.FS, '');\n if (!path) return CloudCmd.route(location.hash);\n const history = false;\n await CloudCmd.changeDir(path, {\n history\n });\n });\n}\nfunction resize() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('resize', () => {\n const Info = DOM.CurrentInfo;\n const is = globalThis.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH;\n if (!is) return;\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return;\n const name = panel.getAttribute('data-name');\n const isLeft = name === 'js-left';\n if (isLeft) return;\n DOM.changePanel();\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/index.js\n}");
382
382
 
383
383
  /***/ },
384
384
 
385
- /***/ "./client/load-module.mjs"
386
- /*!********************************!*\
387
- !*** ./client/load-module.mjs ***!
388
- \********************************/
385
+ /***/ "./client/load-module.js"
386
+ /*!*******************************!*\
387
+ !*** ./client/load-module.js ***!
388
+ \*******************************/
389
389
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
390
390
 
391
391
  "use strict";
392
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadModule: () => (/* binding */ loadModule)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var just_pascal_case__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.mjs\");\n/* global CloudCmd */\n\n\n\n\nconst noJS = a => a.replace(/.js$/, '');\n\n/**\n * function load modules\n * @params = {name, path, func, dobefore, arg}\n */\nconst loadModule = params => {\n if (!params) return;\n const {\n path\n } = params;\n const name = path && noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(path));\n const doBefore = params.dobefore;\n if (CloudCmd[name]) return;\n CloudCmd[name] = async () => {\n execon__WEBPACK_IMPORTED_MODULE_0__(doBefore);\n const {\n DIR_MODULES\n } = CloudCmd;\n const pathFull = `${DIR_MODULES}/${path}.js`;\n await (0,load_js__WEBPACK_IMPORTED_MODULE_2__.js)(pathFull);\n const newModule = async f => f && f();\n const module = CloudCmd[name];\n Object.assign(newModule, module);\n CloudCmd[name] = newModule;\n CloudCmd.log('init', name);\n await module.init();\n return newModule;\n };\n CloudCmd[name].show = async (...args) => {\n CloudCmd.log('show', name, args);\n const m = CloudCmd[name];\n const [e, a] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.tryToCatch)(m);\n if (e) return;\n return await a.show(...args);\n };\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/load-module.mjs\n}");
392
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadModule: () => (/* binding */ loadModule)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var just_pascal_case__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.mjs\");\n/* global CloudCmd */\n\n\n\n\nconst noJS = a => a.replace(/.js$/, '');\n\n/**\n * function load modules\n * @params = {name, path, func, dobefore, arg}\n */\nconst loadModule = params => {\n if (!params) return;\n const {\n path\n } = params;\n const name = path && noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(path));\n const doBefore = params.dobefore;\n if (CloudCmd[name]) return;\n CloudCmd[name] = async () => {\n execon__WEBPACK_IMPORTED_MODULE_0__(doBefore);\n const {\n DIR_MODULES\n } = CloudCmd;\n const pathFull = `${DIR_MODULES}/${path}.js`;\n await (0,load_js__WEBPACK_IMPORTED_MODULE_2__.js)(pathFull);\n const newModule = async f => f && f();\n const module = CloudCmd[name];\n Object.assign(newModule, module);\n CloudCmd[name] = newModule;\n CloudCmd.log('init', name);\n await module.init();\n return newModule;\n };\n CloudCmd[name].show = async (...args) => {\n CloudCmd.log('show', name, args);\n const m = CloudCmd[name];\n const [e, a] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.tryToCatch)(m);\n if (e) return;\n return await a.show(...args);\n };\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/load-module.js\n}");
393
393
 
394
394
  /***/ },
395
395
 
396
- /***/ "./client/modules/cloud.mjs"
397
- /*!**********************************!*\
398
- !*** ./client/modules/cloud.mjs ***!
399
- \**********************************/
396
+ /***/ "./client/modules/cloud.js"
397
+ /*!*********************************!*\
398
+ !*** ./client/modules/cloud.js ***!
399
+ \*********************************/
400
400
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
401
401
 
402
402
  "use strict";
403
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ saveFile: () => (/* binding */ saveFile),\n/* harmony export */ uploadFile: () => (/* binding */ uploadFile)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* global CloudCmd, filepicker */\n\n\n\n\n\n\nconst {\n log\n} = CloudCmd;\nconst upload = currify__WEBPACK_IMPORTED_MODULE_1__(_upload);\nconst Name = 'Cloud';\nCloudCmd[Name] = {\n init,\n uploadFile,\n saveFile\n};\nasync function init() {\n const [modules] = await loadFiles();\n const {\n key\n } = modules.data.FilePicker;\n filepicker.setKey(key);\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.hide();\n}\nfunction uploadFile(filename, data) {\n const mimetype = '';\n filepicker.store(data, {\n mimetype,\n filename\n }, fpFile => {\n filepicker.exportFile(fpFile, log, log);\n });\n}\nfunction saveFile(callback) {\n filepicker.pick(upload(callback));\n}\nfunction _upload(callback, file) {\n const {\n url,\n filename\n } = file;\n const responseType = 'arraybuffer';\n const success = execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](callback, filename);\n (0,_dom_load__WEBPACK_IMPORTED_MODULE_3__.ajax)({\n url,\n responseType,\n success\n });\n}\nfunction loadFiles() {\n const js = '//api.filepicker.io/v2/filepicker.js';\n return Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_4__.get('modules'), load_js__WEBPACK_IMPORTED_MODULE_2__.js(js)]);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/cloud.mjs\n}");
403
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ saveFile: () => (/* binding */ saveFile),\n/* harmony export */ uploadFile: () => (/* binding */ uploadFile)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* global CloudCmd, filepicker */\n\n\n\n\n\n\nconst {\n log\n} = CloudCmd;\nconst upload = currify__WEBPACK_IMPORTED_MODULE_1__(_upload);\nconst Name = 'Cloud';\nCloudCmd[Name] = {\n init,\n uploadFile,\n saveFile\n};\nasync function init() {\n const [modules] = await loadFiles();\n const {\n key\n } = modules.data.FilePicker;\n filepicker.setKey(key);\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.hide();\n}\nfunction uploadFile(filename, data) {\n const mimetype = '';\n filepicker.store(data, {\n mimetype,\n filename\n }, fpFile => {\n filepicker.exportFile(fpFile, log, log);\n });\n}\nfunction saveFile(callback) {\n filepicker.pick(upload(callback));\n}\nfunction _upload(callback, file) {\n const {\n url,\n filename\n } = file;\n const responseType = 'arraybuffer';\n const success = execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](callback, filename);\n (0,_dom_load__WEBPACK_IMPORTED_MODULE_3__.ajax)({\n url,\n responseType,\n success\n });\n}\nfunction loadFiles() {\n const js = '//api.filepicker.io/v2/filepicker.js';\n return Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_4__.get('modules'), load_js__WEBPACK_IMPORTED_MODULE_2__.js(js)]);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/cloud.js\n}");
404
404
 
405
405
  /***/ },
406
406
 
407
- /***/ "./client/modules/command-line.mjs"
408
- /*!*****************************************!*\
409
- !*** ./client/modules/command-line.mjs ***!
410
- \*****************************************/
407
+ /***/ "./client/modules/command-line.js"
408
+ /*!****************************************!*\
409
+ !*** ./client/modules/command-line.js ***!
410
+ \****************************************/
411
411
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
412
412
 
413
413
  "use strict";
414
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* global CloudCmd */\n\nconst init = () => {};\nCloudCmd.CommandLine = {\n init,\n show,\n hide\n};\nasync function show() {\n const [, cmd] = await _dom_dialog__WEBPACK_IMPORTED_MODULE_0__.prompt('Command Line', '');\n const TERMINAL = '^(t|terminal)';\n if (RegExp(`${TERMINAL}$`).test(cmd)) return await CloudCmd.Terminal.show();\n if (RegExp(TERMINAL).test(cmd)) {\n const command = cmd.replace(RegExp(`${TERMINAL} `), '');\n const exitCode = await CloudCmd.TerminalRun.show({\n command: `bash -c '${command}'`\n });\n if (exitCode === -1) await _dom_dialog__WEBPACK_IMPORTED_MODULE_0__.alert(`☝️ Looks like Terminal is disabled, start Cloud Coammnder with '--terminal' flag.`);\n return;\n }\n}\nfunction hide() {}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/command-line.mjs\n}");
414
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* global CloudCmd */\n\nfunction init() {}\nCloudCmd.CommandLine = {\n init,\n show,\n hide\n};\nasync function show() {\n const [, cmd] = await _dom_dialog__WEBPACK_IMPORTED_MODULE_0__.prompt('Command Line', '');\n const TERMINAL = '^(t|terminal)';\n if (RegExp(`${TERMINAL}$`).test(cmd)) return await CloudCmd.Terminal.show();\n if (RegExp(TERMINAL).test(cmd)) {\n const command = cmd.replace(RegExp(`${TERMINAL} `), '');\n const exitCode = await CloudCmd.TerminalRun.show({\n command: `bash -c '${command}'`\n });\n if (exitCode === -1) await _dom_dialog__WEBPACK_IMPORTED_MODULE_0__.alert(`☝️ Looks like Terminal is disabled, start Cloud Coammnder with '--terminal' flag.`);\n return;\n }\n}\nfunction hide() {}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/command-line.js\n}");
415
415
 
416
416
  /***/ },
417
417
 
418
- /***/ "./client/modules/config/index.mjs"
419
- /*!*****************************************!*\
420
- !*** ./client/modules/config/index.mjs ***!
421
- \*****************************************/
418
+ /***/ "./client/modules/config/index.js"
419
+ /*!****************************************!*\
420
+ !*** ./client/modules/config/index.js ***!
421
+ \****************************************/
422
422
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
423
423
 
424
424
  "use strict";
425
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_config_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var squad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _input_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./input.mjs */ \"./client/modules/config/input.mjs\");\n/* global CloudCmd, DOM, io */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n Dialog,\n setTitle\n} = DOM;\nconst Name = 'Config';\nconst loadSocket = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_5__.promisify)(DOM.loadSocket);\nconst showLoad = () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load('top');\n};\nconst addKey = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.addKey(input, fn);\n return input;\n});\nconst addChange = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.add('change', input, fn);\n return input;\n});\nconst Config = {};\nlet Template;\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_7__.css;\nconst init = async () => {\n if (!CloudCmd.config('configDialog')) return;\n showLoad();\n const {\n DIR_DIST\n } = CloudCmd;\n [Template] = await Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_10__.get('config-tmpl'), loadSocket(), loadCSS(`${DIR_DIST}/config.css`), CloudCmd.View()]);\n initSocket();\n};\nconst {\n config,\n Key\n} = CloudCmd;\nlet Element;\nfunction getHost() {\n const {\n host,\n origin,\n protocol\n } = location;\n return origin || `${protocol}//${host}`;\n}\nfunction initSocket() {\n const href = getHost();\n const {\n prefixSocket,\n prefix\n } = CloudCmd;\n const ONE_MINUTE = 60 * 1000;\n const socket = io.connect(href + prefixSocket + '/config', {\n reconnectionAttempts: Infinity,\n reconnectionDelay: ONE_MINUTE,\n path: `${prefix}/socket.io`\n });\n const save = data => {\n onSave(data);\n socket.send(data);\n };\n authCheck(socket);\n socket.on('connect', () => {\n Config.save = save;\n });\n socket.on('message', onSave);\n socket.on('log', CloudCmd.log);\n socket.on('disconnect', () => {\n Config.save = saveHttp;\n });\n socket.on('err', Dialog.alert);\n}\nfunction authCheck(socket) {\n socket.emit('auth', config('username'), config('password'));\n socket.on('reject', wraptile__WEBPACK_IMPORTED_MODULE_3__(Dialog.alert, 'Wrong credentials!'));\n}\nConfig.save = saveHttp;\nasync function show() {\n if (!CloudCmd.config('configDialog')) return;\n await fillTemplate();\n}\nasync function fillTemplate() {\n const [error, config] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_6__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_10__.get, 'config');\n if (error) return Dialog.alert('Could not load config!');\n const {\n editor,\n menu,\n packer,\n columns,\n theme,\n configAuth,\n ...obj\n } = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.convert(config);\n obj[`${menu}-selected`] = 'selected';\n obj[`${editor}-selected`] = 'selected';\n obj[`${packer}-selected`] = 'selected';\n obj[`${columns}-selected`] = 'selected';\n obj[`${theme}-selected`] = 'selected';\n obj.configAuth = configAuth ? '' : 'hidden';\n const innerHTML = rendy__WEBPACK_IMPORTED_MODULE_1__(Template, obj);\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__('form', {\n className: 'config',\n innerHTML\n });\n const inputs = document.querySelectorAll('input, select', Element);\n const [inputFirst] = inputs;\n let afterShow;\n if (inputFirst) {\n onAuthChange(inputFirst.checked);\n afterShow = inputFirst.focus.bind(inputFirst);\n }\n const getTarget = ({\n target\n }) => target;\n const handleChange = squad__WEBPACK_IMPORTED_MODULE_4__(onChange, getTarget);\n Array.from(inputs).map(addKey(onKey)).map(addChange(handleChange));\n const autoSize = true;\n CloudCmd.View.show(Element, {\n autoSize,\n afterShow\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nasync function onChange(el) {\n const obj = {};\n const name = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.getName(el);\n const data = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.getValue(name, Element);\n if (name === 'name') onNameChange(data);else if (name === 'auth') onAuthChange(data);\n obj[name] = data;\n await Config.save(obj);\n}\nfunction onSave(obj) {\n for (const name of Object.keys(obj)) {\n const data = obj[name];\n CloudCmd._config(name, data);\n _input_mjs__WEBPACK_IMPORTED_MODULE_13__.setValue(name, data, Element);\n }\n}\nasync function saveHttp(obj) {\n const {\n RESTful\n } = DOM;\n const [e] = await RESTful.Config.write(obj);\n if (e) return;\n onSave(obj);\n}\nfunction onAuthChange(checked) {\n const elUsername = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.getElementByName('username', Element);\n const elPassword = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.getElementByName('password', Element);\n elUsername.disabled = !checked;\n elPassword.disabled = !checked;\n}\nfunction onNameChange(name) {\n setTitle((0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.getTitle)({\n name\n }));\n}\nasync function onKey({\n keyCode,\n target\n}) {\n switch (keyCode) {\n case Key.ESC:\n return hide();\n case Key.ENTER:\n return await onChange(target);\n }\n}\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/config/index.mjs\n}");
425
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_config_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var squad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _input_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./input.js */ \"./client/modules/config/input.js\");\n/* global CloudCmd, DOM, io */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n Dialog,\n setTitle\n} = DOM;\nconst Name = 'Config';\nconst loadSocket = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_5__.promisify)(DOM.loadSocket);\nconst showLoad = () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load('top');\n};\nconst addKey = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.addKey(input, fn);\n return input;\n});\nconst addChange = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.add('change', input, fn);\n return input;\n});\nconst Config = {};\nlet Template;\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_7__.css;\nasync function init() {\n if (!CloudCmd.config('configDialog')) return;\n showLoad();\n const {\n DIR_DIST\n } = CloudCmd;\n [Template] = await Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_10__.get('config-tmpl'), loadSocket(), loadCSS(`${DIR_DIST}/config.css`), CloudCmd.View()]);\n initSocket();\n}\nconst {\n config,\n Key\n} = CloudCmd;\nlet Element;\nfunction getHost() {\n const {\n host,\n origin,\n protocol\n } = location;\n return origin || `${protocol}//${host}`;\n}\nfunction initSocket() {\n const href = getHost();\n const {\n prefixSocket,\n prefix\n } = CloudCmd;\n const ONE_MINUTE = 60 * 1000;\n const socket = io.connect(href + prefixSocket + '/config', {\n reconnectionAttempts: Infinity,\n reconnectionDelay: ONE_MINUTE,\n path: `${prefix}/socket.io`\n });\n const save = data => {\n onSave(data);\n socket.send(data);\n };\n authCheck(socket);\n socket.on('connect', () => {\n Config.save = save;\n });\n socket.on('message', onSave);\n socket.on('log', CloudCmd.log);\n socket.on('disconnect', () => {\n Config.save = saveHttp;\n });\n socket.on('err', Dialog.alert);\n}\nfunction authCheck(socket) {\n socket.emit('auth', config('username'), config('password'));\n socket.on('reject', wraptile__WEBPACK_IMPORTED_MODULE_3__(Dialog.alert, 'Wrong credentials!'));\n}\nConfig.save = saveHttp;\nasync function show() {\n if (!CloudCmd.config('configDialog')) return;\n await fillTemplate();\n}\nasync function fillTemplate() {\n const [error, config] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_6__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_10__.get, 'config');\n if (error) return Dialog.alert('Could not load config!');\n const {\n editor,\n menu,\n packer,\n columns,\n theme,\n configAuth,\n ...obj\n } = _input_js__WEBPACK_IMPORTED_MODULE_13__.convert(config);\n obj[`${menu}-selected`] = 'selected';\n obj[`${editor}-selected`] = 'selected';\n obj[`${packer}-selected`] = 'selected';\n obj[`${columns}-selected`] = 'selected';\n obj[`${theme}-selected`] = 'selected';\n obj.configAuth = configAuth ? '' : 'hidden';\n const innerHTML = rendy__WEBPACK_IMPORTED_MODULE_1__(Template, obj);\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__('form', {\n className: 'config',\n innerHTML\n });\n const inputs = document.querySelectorAll('input, select', Element);\n const [inputFirst] = inputs;\n let afterShow;\n if (inputFirst) {\n onAuthChange(inputFirst.checked);\n afterShow = inputFirst.focus.bind(inputFirst);\n }\n const getTarget = ({\n target\n }) => target;\n const handleChange = squad__WEBPACK_IMPORTED_MODULE_4__(onChange, getTarget);\n Array.from(inputs).map(addKey(onKey)).map(addChange(handleChange));\n const autoSize = true;\n CloudCmd.View.show(Element, {\n autoSize,\n afterShow\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nasync function onChange(el) {\n const obj = {};\n const name = _input_js__WEBPACK_IMPORTED_MODULE_13__.getName(el);\n const data = _input_js__WEBPACK_IMPORTED_MODULE_13__.getValue(name, Element);\n if (name === 'name') onNameChange(data);else if (name === 'auth') onAuthChange(data);\n obj[name] = data;\n await Config.save(obj);\n}\nfunction onSave(obj) {\n for (const name of Object.keys(obj)) {\n const data = obj[name];\n CloudCmd._config(name, data);\n _input_js__WEBPACK_IMPORTED_MODULE_13__.setValue(name, data, Element);\n }\n}\nasync function saveHttp(obj) {\n const {\n RESTful\n } = DOM;\n const [e] = await RESTful.Config.write(obj);\n if (e) return;\n onSave(obj);\n}\nfunction onAuthChange(checked) {\n const elUsername = _input_js__WEBPACK_IMPORTED_MODULE_13__.getElementByName('username', Element);\n const elPassword = _input_js__WEBPACK_IMPORTED_MODULE_13__.getElementByName('password', Element);\n elUsername.disabled = !checked;\n elPassword.disabled = !checked;\n}\nfunction onNameChange(name) {\n setTitle((0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.getTitle)({\n name\n }));\n}\nasync function onKey({\n keyCode,\n target\n}) {\n switch (keyCode) {\n case Key.ESC:\n return hide();\n case Key.ENTER:\n return await onChange(target);\n }\n}\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/config/index.js\n}");
426
426
 
427
427
  /***/ },
428
428
 
429
- /***/ "./client/modules/config/input.mjs"
430
- /*!*****************************************!*\
431
- !*** ./client/modules/config/input.mjs ***!
432
- \*****************************************/
429
+ /***/ "./client/modules/config/input.js"
430
+ /*!****************************************!*\
431
+ !*** ./client/modules/config/input.js ***!
432
+ \****************************************/
433
433
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
434
434
 
435
435
  "use strict";
436
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ convert: () => (/* binding */ convert),\n/* harmony export */ getElementByName: () => (/* binding */ getElementByName),\n/* harmony export */ getName: () => (/* binding */ getName),\n/* harmony export */ getValue: () => (/* binding */ getValue),\n/* harmony export */ setValue: () => (/* binding */ setValue)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst isType = currify__WEBPACK_IMPORTED_MODULE_0__((type, object, name) => type === typeof object[name]);\nconst isBool = isType('boolean');\nfunction getElementByName(selector, element) {\n const str = `[data-name=\"js-${selector}\"]`;\n return element.querySelector(str);\n}\nconst getName = element => {\n const name = element.getAttribute('data-name').replace(/^js-/, '');\n return name;\n};\nconst convert = config => {\n const result = config;\n const array = Object.keys(config);\n const filtered = array.filter(isBool(config));\n for (const name of filtered) {\n const item = config[name];\n result[name] = setState(item);\n }\n return result;\n};\nfunction setState(state) {\n if (state) return ' checked';\n return '';\n}\nconst getValue = (name, element) => {\n const el = getElementByName(name, element);\n const {\n type\n } = el;\n switch (type) {\n case 'checkbox':\n return el.checked;\n case 'number':\n return Number(el.value);\n default:\n return el.value;\n }\n};\nconst setValue = (name, value, element) => {\n const el = getElementByName(name, element);\n const {\n type\n } = el;\n switch (type) {\n case 'checkbox':\n el.checked = value;\n break;\n default:\n el.value = value;\n break;\n }\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/config/input.mjs\n}");
436
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ convert: () => (/* binding */ convert),\n/* harmony export */ getElementByName: () => (/* binding */ getElementByName),\n/* harmony export */ getName: () => (/* binding */ getName),\n/* harmony export */ getValue: () => (/* binding */ getValue),\n/* harmony export */ setValue: () => (/* binding */ setValue)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst isType = currify__WEBPACK_IMPORTED_MODULE_0__((type, object, name) => type === typeof object[name]);\nconst isBool = isType('boolean');\nfunction getElementByName(selector, element) {\n const str = `[data-name=\"js-${selector}\"]`;\n return element.querySelector(str);\n}\nconst getName = element => {\n const name = element.getAttribute('data-name').replace(/^js-/, '');\n return name;\n};\nconst convert = config => {\n const result = config;\n const array = Object.keys(config);\n const filtered = array.filter(isBool(config));\n for (const name of filtered) {\n const item = config[name];\n result[name] = setState(item);\n }\n return result;\n};\nfunction setState(state) {\n if (state) return ' checked';\n return '';\n}\nconst getValue = (name, element) => {\n const el = getElementByName(name, element);\n const {\n type\n } = el;\n switch (type) {\n case 'checkbox':\n return el.checked;\n case 'number':\n return Number(el.value);\n default:\n return el.value;\n }\n};\nconst setValue = (name, value, element) => {\n const el = getElementByName(name, element);\n const {\n type\n } = el;\n switch (type) {\n case 'checkbox':\n el.checked = value;\n break;\n default:\n el.value = value;\n break;\n }\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/config/input.js\n}");
437
437
 
438
438
  /***/ },
439
439
 
@@ -441,10 +441,10 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
441
441
  /*!***********************************!*\
442
442
  !*** ./client/modules/contact.js ***!
443
443
  \***********************************/
444
- (module, exports, __webpack_require__) {
444
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
445
445
 
446
446
  "use strict";
447
- eval("{/* global CloudCmd */\n/* global DOM */\n\n\n\nCloudCmd.Contact = exports;\nconst olark = __webpack_require__(/*! @cloudcmd/olark */ \"./node_modules/@cloudcmd/olark/index.js\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst {\n Events\n} = DOM;\nconst {\n Key\n} = CloudCmd;\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nmodule.exports.init = () => {\n Events.addKey(onKey);\n olark.identify('6216-545-10-4223');\n olark('api.box.onExpand', show);\n olark('api.box.onShow', show);\n olark('api.box.onShrink', hide);\n};\nfunction show() {\n Key.unsetBind();\n Images.hide();\n olark('api.box.expand');\n}\nfunction hide() {\n Key.setBind();\n olark('api.box.hide');\n}\nfunction onKey({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/contact.js\n}");
447
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_olark__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/olark */ \"./node_modules/@cloudcmd/olark/index.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* global CloudCmd */\n/* global DOM */\n\n\nCloudCmd.Contact = {\n init,\n show,\n hide\n};\nconst {\n Events\n} = DOM;\nconst {\n Key\n} = CloudCmd;\nfunction init() {\n Events.addKey(onKey);\n _cloudcmd_olark__WEBPACK_IMPORTED_MODULE_0__.identify('6216-545-10-4223');\n _cloudcmd_olark__WEBPACK_IMPORTED_MODULE_0__('api.box.onExpand', show);\n _cloudcmd_olark__WEBPACK_IMPORTED_MODULE_0__('api.box.onShow', show);\n _cloudcmd_olark__WEBPACK_IMPORTED_MODULE_0__('api.box.onShrink', hide);\n}\nfunction show() {\n Key.unsetBind();\n _dom_images__WEBPACK_IMPORTED_MODULE_1__.hide();\n _cloudcmd_olark__WEBPACK_IMPORTED_MODULE_0__('api.box.expand');\n}\nfunction hide() {\n Key.setBind();\n _cloudcmd_olark__WEBPACK_IMPORTED_MODULE_0__('api.box.hide');\n}\nfunction onKey({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/contact.js\n}");
448
448
 
449
449
  /***/ },
450
450
 
@@ -452,10 +452,10 @@ eval("{/* global CloudCmd */\n/* global DOM */\n\n\n\nCloudCmd.Contact = exports
452
452
  /*!*****************************************!*\
453
453
  !*** ./client/modules/edit-file-vim.js ***!
454
454
  \*****************************************/
455
- (module, exports, __webpack_require__) {
455
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
456
456
 
457
457
  "use strict";
458
- eval("{\n\n/* global CloudCmd */\nCloudCmd.EditFileVim = exports;\nconst Events = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\nconst {\n Key\n} = CloudCmd;\nconst ConfigView = {\n bindKeys: false,\n beforeClose: () => {\n Events.rmKey(listener);\n CloudCmd.EditFile.isChanged();\n }\n};\nmodule.exports.init = async () => {\n await CloudCmd.EditFile();\n};\nmodule.exports.show = async () => {\n Events.addKey(listener);\n const editFile = await CloudCmd.EditFile.show(ConfigView);\n editFile.getEditor().setKeyMap('vim');\n};\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction listener(event) {\n const {\n keyCode,\n shiftKey\n } = event;\n if (shiftKey && keyCode === Key.ESC) {\n event.preventDefault();\n hide();\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-file-vim.js\n}");
458
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n\nconst {\n CloudCmd\n} = globalThis;\nCloudCmd.EditFileVim = {\n init,\n show,\n hide\n};\nconst {\n Key\n} = CloudCmd;\nconst ConfigView = {\n bindKeys: false,\n beforeClose: () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_0__.rmKey(listener);\n CloudCmd.EditFile.isChanged();\n }\n};\nasync function init() {\n await CloudCmd.EditFile();\n}\nasync function show() {\n _dom_events__WEBPACK_IMPORTED_MODULE_0__.addKey(listener);\n const editFile = await CloudCmd.EditFile.show(ConfigView);\n editFile.getEditor().setKeyMap('vim');\n}\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction listener(event) {\n const {\n keyCode,\n shiftKey\n } = event;\n if (shiftKey && keyCode === Key.ESC) {\n event.preventDefault();\n hide();\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-file-vim.js\n}");
459
459
 
460
460
  /***/ },
461
461
 
@@ -463,10 +463,10 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.EditFileVim = exports;\nconst Events
463
463
  /*!*************************************!*\
464
464
  !*** ./client/modules/edit-file.js ***!
465
465
  \*************************************/
466
- (module, exports, __webpack_require__) {
466
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
467
467
 
468
468
  "use strict";
469
- eval("{\n\n/* global CloudCmd, DOM*/\nCloudCmd.EditFile = exports;\nconst Format = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\nconst {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.cjs\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst supermenu = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog,\n Images\n} = DOM;\nconst {\n config\n} = CloudCmd;\nlet Menu;\nlet MSG_CHANGED;\nconst isLoading = fullstore();\nconst ConfigView = {\n beforeClose: async () => {\n exec.ifExist(Menu, 'hide');\n await isChanged();\n }\n};\nmodule.exports.init = async () => {\n isLoading(true);\n await CloudCmd.Edit();\n const editor = CloudCmd.Edit.getEditor();\n authCheck(editor);\n setListeners(editor);\n isLoading(false);\n};\nfunction getName() {\n const {\n name,\n isDir\n } = Info;\n if (isDir) return `${name}.json`;\n return name;\n}\nmodule.exports.show = async options => {\n if (isLoading()) return;\n const optionsEdit = {\n ...ConfigView,\n ...options\n };\n if (CloudCmd.config('showFileName')) optionsEdit.title = Info.name;\n Images.show.load();\n CloudCmd.Edit.getEditor().setOption('keyMap', 'default');\n const [error, data] = await Info.getData();\n if (error) {\n Images.hide();\n return CloudCmd.Edit;\n }\n const {\n path\n } = Info;\n const name = getName();\n setMsgChanged(name);\n CloudCmd.Edit.getEditor().setValueFirst(path, data).setModeForPath(name).enableKey();\n CloudCmd.Edit.show(optionsEdit);\n return CloudCmd.Edit;\n};\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners(editor) {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n editor.on('save', value => {\n DOM.setCurrentSize(Format.size(value));\n });\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n CloudCmd.Edit.getEditor().focus();\n }\n };\n const element = CloudCmd.Edit.getElement();\n Menu = supermenu(element, options, getMenuData());\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nfunction getMenuData() {\n const editor = CloudCmd.Edit.getEditor();\n return {\n 'Save Ctrl+S': () => {\n editor.save();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n}\nfunction setMsgChanged(name) {\n MSG_CHANGED = `Do you want to save changes to ${name}?`;\n}\nmodule.exports.isChanged = isChanged;\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const is = editor.isChanged();\n if (!is) return;\n const [cancel] = await Dialog.confirm(MSG_CHANGED);\n if (cancel) return;\n editor.save();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-file.js\n}");
469
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ isChanged: () => (/* binding */ isChanged),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var format_io__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n/* global CloudCmd, DOM*/\n\n\n\n\nCloudCmd.EditFile = {\n init,\n show,\n hide,\n isChanged\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog,\n Images\n} = DOM;\nconst {\n config\n} = CloudCmd;\nlet Menu;\nlet MSG_CHANGED;\nconst isLoading = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__.fullstore)();\nconst ConfigView = {\n beforeClose: async () => {\n execon__WEBPACK_IMPORTED_MODULE_2__.ifExist(Menu, 'hide');\n await isChanged();\n }\n};\nasync function init() {\n isLoading(true);\n await CloudCmd.Edit();\n const editor = CloudCmd.Edit.getEditor();\n authCheck(editor);\n setListeners(editor);\n isLoading(false);\n}\nfunction getName() {\n const {\n name,\n isDir\n } = Info;\n if (isDir) return `${name}.json`;\n return name;\n}\nasync function show(options) {\n if (isLoading()) return;\n const optionsEdit = {\n ...ConfigView,\n ...options\n };\n if (CloudCmd.config('showFileName')) optionsEdit.title = Info.name;\n Images.show.load();\n CloudCmd.Edit.getEditor().setOption('keyMap', 'default');\n const [error, data] = await Info.getData();\n if (error) {\n Images.hide();\n return CloudCmd.Edit;\n }\n const {\n path\n } = Info;\n const name = getName();\n setMsgChanged(name);\n CloudCmd.Edit.getEditor().setValueFirst(path, data).setModeForPath(name).enableKey();\n CloudCmd.Edit.show(optionsEdit);\n return CloudCmd.Edit;\n}\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners(editor) {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n editor.on('save', value => {\n DOM.setCurrentSize(format_io__WEBPACK_IMPORTED_MODULE_0__.size(value));\n });\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n CloudCmd.Edit.getEditor().focus();\n }\n };\n const element = CloudCmd.Edit.getElement();\n Menu = supermenu__WEBPACK_IMPORTED_MODULE_3__(element, options, getMenuData());\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nfunction getMenuData() {\n const editor = CloudCmd.Edit.getEditor();\n return {\n 'Save Ctrl+S': () => {\n editor.save();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n}\nfunction setMsgChanged(name) {\n MSG_CHANGED = `Do you want to save changes to ${name}?`;\n}\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const is = editor.isChanged();\n if (!is) return;\n const [cancel] = await Dialog.confirm(MSG_CHANGED);\n if (cancel) return;\n editor.save();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-file.js\n}");
470
470
 
471
471
  /***/ },
472
472
 
@@ -474,10 +474,10 @@ eval("{\n\n/* global CloudCmd, DOM*/\nCloudCmd.EditFile = exports;\nconst Format
474
474
  /*!******************************************!*\
475
475
  !*** ./client/modules/edit-names-vim.js ***!
476
476
  \******************************************/
477
- (module, exports, __webpack_require__) {
477
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
478
478
 
479
479
  "use strict";
480
- eval("{\n\n/* global CloudCmd */\nCloudCmd.EditNamesVim = exports;\nconst Events = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\nconst {\n Key\n} = CloudCmd;\nconst ConfigView = {\n bindKeys: false,\n beforeClose: () => {\n Events.rmKey(listener);\n CloudCmd.EditNames.isChanged();\n }\n};\nmodule.exports.init = async () => {\n await CloudCmd.EditNames();\n};\nmodule.exports.show = () => {\n Events.addKey(listener);\n CloudCmd.EditNames.show(ConfigView).getEditor().setKeyMap('vim');\n};\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction listener(event) {\n const {\n keyCode,\n shiftKey\n } = event;\n if (shiftKey && keyCode === Key.ESC) {\n event.preventDefault();\n hide();\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-names-vim.js\n}");
480
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n\nconst {\n CloudCmd\n} = globalThis;\nCloudCmd.EditNamesVim = {\n init,\n show,\n hide\n};\nconst {\n Key\n} = CloudCmd;\nconst ConfigView = {\n bindKeys: false,\n beforeClose: () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_0__.rmKey(listener);\n CloudCmd.EditNames.isChanged();\n }\n};\nasync function init() {\n await CloudCmd.EditNames();\n}\nfunction show() {\n _dom_events__WEBPACK_IMPORTED_MODULE_0__.addKey(listener);\n CloudCmd.EditNames.show(ConfigView).getEditor().setKeyMap('vim');\n}\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction listener(event) {\n const {\n keyCode,\n shiftKey\n } = event;\n if (shiftKey && keyCode === Key.ESC) {\n event.preventDefault();\n hide();\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-names-vim.js\n}");
481
481
 
482
482
  /***/ },
483
483
 
@@ -485,21 +485,21 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.EditNamesVim = exports;\nconst Events
485
485
  /*!**************************************!*\
486
486
  !*** ./client/modules/edit-names.js ***!
487
487
  \**************************************/
488
- (module, exports, __webpack_require__) {
488
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
489
489
 
490
490
  "use strict";
491
- eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\n/* global CloudCmd, DOM */\nCloudCmd.EditNames = exports;\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst supermenu = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\nconst {\n multiRename\n} = __webpack_require__(/*! multi-rename */ \"./node_modules/multi-rename/lib/multi-rename.js\");\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog\n} = DOM;\nlet Menu;\nconst ConfigView = {\n beforeClose: async () => {\n exec.ifExist(Menu, 'hide');\n DOM.Events.remove('keydown', keyListener);\n await isChanged();\n }\n};\nmodule.exports.init = async () => {\n await CloudCmd.Edit();\n setListeners();\n};\nmodule.exports.show = options => {\n const names = getActiveNames().join('\\n');\n const config = {\n ...ConfigView,\n ...options\n };\n if (Info.name === '..' && names.length === 1) return Dialog.alert.noFiles();\n DOM.Events.addKey(keyListener);\n CloudCmd.Edit.getEditor().setValueFirst('edit-names', names).setMode().setOption('keyMap', 'default').disableKey();\n CloudCmd.Edit.show(config);\n return CloudCmd.Edit;\n};\nasync function keyListener(event) {\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n const {\n Key\n } = CloudCmd;\n if (ctrlMeta && event.keyCode === Key.S) {\n hide();\n } else if (ctrlMeta && event.keyCode === Key.P) {\n const [, pattern] = await Dialog.prompt('Apply pattern:', '[n][e]');\n pattern && applyPattern(pattern);\n }\n}\nfunction applyPattern(pattern) {\n const newNames = multiRename(pattern, getActiveNames());\n const editor = CloudCmd.Edit.getEditor();\n editor.setValue(newNames.join('\\n'));\n}\nfunction getActiveNames() {\n return DOM.getFilenames(DOM.getActiveFiles());\n}\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners() {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n}\nasync function applyNames() {\n const dir = Info.dirPath;\n const from = getActiveNames();\n const nameIndex = from.indexOf(Info.name);\n const editor = CloudCmd.Edit.getEditor();\n const to = editor.getValue().split('\\n');\n const root = CloudCmd.config('root');\n const response = rename(dir, from, to, root);\n const [error] = await tryToCatch(refresh, to, nameIndex, response);\n if (error) alert(error);\n}\nfunction refresh(to, nameIndex, res) {\n if (res.status === 404) {\n const error = res.text();\n throw error;\n }\n const currentName = to[nameIndex];\n CloudCmd.refresh({\n currentName\n });\n}\nfunction getDir(root, dir) {\n if (root === '/') return dir;\n return root + dir;\n}\nfunction rename(path, from, to, root) {\n const dir = getDir(root, path);\n const {\n prefix\n } = CloudCmd;\n return fetch(`${prefix}/rename`, {\n method: 'put',\n credentials: 'include',\n body: JSON.stringify({\n from,\n to,\n dir\n })\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const editor = CloudCmd.Edit.getEditor();\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n editor.focus();\n }\n };\n const menuData = {\n 'Save Ctrl+S': async () => {\n await applyNames();\n hide();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n const element = CloudCmd.Edit.getElement();\n Menu = supermenu(element, options, menuData);\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nmodule.exports.isChanged = isChanged;\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const msg = 'Apply new names?';\n if (!editor.isChanged()) return;\n const [cancel] = await Dialog.confirm(msg);\n !cancel && (await applyNames());\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-names.js\n}");
491
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ isChanged: () => (/* binding */ isChanged),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n/* harmony import */ var multi_rename__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multi-rename */ \"./node_modules/multi-rename/lib/multi-rename.js\");\n\n\n\n\nconst {\n CloudCmd,\n DOM\n} = globalThis;\nCloudCmd.EditNames = {\n init,\n show,\n hide,\n isChanged\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog\n} = DOM;\nlet Menu;\nconst ConfigView = {\n beforeClose: async () => {\n execon__WEBPACK_IMPORTED_MODULE_1__.ifExist(Menu, 'hide');\n DOM.Events.remove('keydown', keyListener);\n await isChanged();\n }\n};\nasync function init() {\n await CloudCmd.Edit();\n setListeners();\n}\nfunction show(options) {\n const names = getActiveNames().join('\\n');\n const config = {\n ...ConfigView,\n ...options\n };\n if (Info.name === '..' && names.length === 1) return Dialog.alert.noFiles();\n DOM.Events.addKey(keyListener);\n CloudCmd.Edit.getEditor().setValueFirst('edit-names', names).setMode().setOption('keyMap', 'default').disableKey();\n CloudCmd.Edit.show(config);\n return CloudCmd.Edit;\n}\nasync function keyListener(event) {\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n const {\n Key\n } = CloudCmd;\n if (ctrlMeta && event.keyCode === Key.S) {\n hide();\n } else if (ctrlMeta && event.keyCode === Key.P) {\n const [, pattern] = await Dialog.prompt('Apply pattern:', '[n][e]');\n pattern && applyPattern(pattern);\n }\n}\nfunction applyPattern(pattern) {\n const newNames = (0,multi_rename__WEBPACK_IMPORTED_MODULE_3__.multiRename)(pattern, getActiveNames());\n const editor = CloudCmd.Edit.getEditor();\n editor.setValue(newNames.join('\\n'));\n}\nfunction getActiveNames() {\n return DOM.getFilenames(DOM.getActiveFiles());\n}\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners() {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n}\nasync function applyNames() {\n const dir = Info.dirPath;\n const from = getActiveNames();\n const nameIndex = from.indexOf(Info.name);\n const editor = CloudCmd.Edit.getEditor();\n const to = editor.getValue().split('\\n');\n const root = CloudCmd.config('root');\n const response = rename(dir, from, to, root);\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(refresh, to, nameIndex, response);\n if (error) alert(error);\n}\nfunction refresh(to, nameIndex, res) {\n if (res.status === 404) {\n const error = res.text();\n throw error;\n }\n const currentName = to[nameIndex];\n CloudCmd.refresh({\n currentName\n });\n}\nfunction getDir(root, dir) {\n if (root === '/') return dir;\n return root + dir;\n}\nfunction rename(path, from, to, root) {\n const dir = getDir(root, path);\n const {\n prefix\n } = CloudCmd;\n return fetch(`${prefix}/rename`, {\n method: 'put',\n credentials: 'include',\n body: JSON.stringify({\n from,\n to,\n dir\n })\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const editor = CloudCmd.Edit.getEditor();\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n editor.focus();\n }\n };\n const menuData = {\n 'Save Ctrl+S': async () => {\n await applyNames();\n hide();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n const element = CloudCmd.Edit.getElement();\n Menu = supermenu__WEBPACK_IMPORTED_MODULE_2__(element, options, menuData);\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const msg = 'Apply new names?';\n if (!editor.isChanged()) return;\n const [cancel] = await Dialog.confirm(msg);\n !cancel && (await applyNames());\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-names.js\n}");
492
492
 
493
493
  /***/ },
494
494
 
495
- /***/ "./client/modules/edit.mjs"
496
- /*!*********************************!*\
497
- !*** ./client/modules/edit.mjs ***!
498
- \*********************************/
495
+ /***/ "./client/modules/edit.js"
496
+ /*!********************************!*\
497
+ !*** ./client/modules/edit.js ***!
498
+ \********************************/
499
499
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
500
500
 
501
501
  "use strict";
502
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getEditor: () => (/* binding */ getEditor),\n/* harmony export */ getElement: () => (/* binding */ getElement),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var montag__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! montag */ \"./node_modules/montag/lib/montag.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nfunction getEditor() {\n return editor;\n}\nconst isFn = a => typeof a === 'function';\nconst loadJS = load_js__WEBPACK_IMPORTED_MODULE_4__.js;\nconst Name = 'Edit';\nCloudCmd[Name] = {\n init,\n show,\n hide,\n getEditor,\n getElement\n};\nconst EditorName = CloudCmd.config('editor');\nlet Loading = true;\nlet Element;\nlet editor;\nconst ConfigView = {\n afterShow: () => {\n editor.moveCursorTo(0, 0).focus();\n }\n};\nasync function init() {\n const element = create();\n await CloudCmd.View();\n await loadFiles(element);\n}\nfunction create() {\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_3__('div', {\n style: montag__WEBPACK_IMPORTED_MODULE_0__`\n width: 100%;\n height: 100%;\n font-family: \"Droid Sans Mono\";\n `,\n notAppend: true\n });\n Element = element;\n return element;\n}\nfunction checkFn(name, fn) {\n if (!isFn(fn)) throw Error(`${name} should be a function!`);\n}\nfunction initConfig(options = {}) {\n const config = {\n ...options,\n ...ConfigView\n };\n if (!options.afterShow) return config;\n checkFn('options.afterShow', options.afterShow);\n config.afterShow = () => {\n ConfigView.afterShow();\n options.afterShow();\n };\n return config;\n}\nfunction show(options) {\n if (Loading) return;\n CloudCmd.View.show(Element, initConfig(options));\n getEditor().setOptions({\n fontSize: 16\n });\n}\nfunction getElement() {\n return Element;\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst loadFiles = async element => {\n const prefix = `${CloudCmd.prefix}/${EditorName}`;\n const socketPath = CloudCmd.prefix;\n const prefixSocket = `${CloudCmd.prefixSocket}/${EditorName}`;\n const url = `${prefix}/${EditorName}.js`;\n (0,_common_util__WEBPACK_IMPORTED_MODULE_6__.time)(`${Name} load`);\n await loadJS(url);\n const word = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_1__.promisify)(window[EditorName]);\n const [ed] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(word, element, {\n maxSize: _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__.MAX_FILE_SIZE,\n prefix,\n prefixSocket,\n socketPath\n });\n (0,_common_util__WEBPACK_IMPORTED_MODULE_6__.timeEnd)(`${Name} load`);\n editor = ed;\n Loading = false;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit.mjs\n}");
502
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getEditor: () => (/* binding */ getEditor),\n/* harmony export */ getElement: () => (/* binding */ getElement),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var montag__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! montag */ \"./node_modules/montag/lib/montag.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nfunction getEditor() {\n return editor;\n}\nconst isFn = a => typeof a === 'function';\nconst loadJS = load_js__WEBPACK_IMPORTED_MODULE_4__.js;\nconst Name = 'Edit';\nCloudCmd[Name] = {\n init,\n show,\n hide,\n getEditor,\n getElement\n};\nconst EditorName = CloudCmd.config('editor');\nlet Loading = true;\nlet Element;\nlet editor;\nconst ConfigView = {\n afterShow: () => {\n editor.moveCursorTo(0, 0).focus();\n }\n};\nasync function init() {\n const element = create();\n await CloudCmd.View();\n await loadFiles(element);\n}\nfunction create() {\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_3__('div', {\n style: montag__WEBPACK_IMPORTED_MODULE_0__`\n width: 100%;\n height: 100%;\n font-family: \"Droid Sans Mono\";\n `,\n notAppend: true\n });\n Element = element;\n return element;\n}\nfunction checkFn(name, fn) {\n if (!isFn(fn)) throw Error(`${name} should be a function!`);\n}\nfunction initConfig(options = {}) {\n const config = {\n ...options,\n ...ConfigView\n };\n if (!options.afterShow) return config;\n checkFn('options.afterShow', options.afterShow);\n config.afterShow = () => {\n ConfigView.afterShow();\n options.afterShow();\n };\n return config;\n}\nfunction show(options) {\n if (Loading) return;\n CloudCmd.View.show(Element, initConfig(options));\n getEditor().setOptions({\n fontSize: 16\n });\n}\nfunction getElement() {\n return Element;\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst loadFiles = async element => {\n const prefix = `${CloudCmd.prefix}/${EditorName}`;\n const socketPath = CloudCmd.prefix;\n const prefixSocket = `${CloudCmd.prefixSocket}/${EditorName}`;\n const url = `${prefix}/${EditorName}.js`;\n (0,_common_util__WEBPACK_IMPORTED_MODULE_6__.time)(`${Name} load`);\n await loadJS(url);\n const word = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_1__.promisify)(window[EditorName]);\n const [ed] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(word, element, {\n maxSize: _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__.MAX_FILE_SIZE,\n prefix,\n prefixSocket,\n socketPath\n });\n (0,_common_util__WEBPACK_IMPORTED_MODULE_6__.timeEnd)(`${Name} load`);\n editor = ed;\n Loading = false;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit.js\n}");
503
503
 
504
504
  /***/ },
505
505
 
@@ -507,21 +507,21 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
507
507
  /*!********************************!*\
508
508
  !*** ./client/modules/help.js ***!
509
509
  \********************************/
510
- (module, exports, __webpack_require__) {
510
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
511
511
 
512
512
  "use strict";
513
- eval("{\n\n/* global CloudCmd */\nCloudCmd.Help = exports;\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nmodule.exports.init = () => {\n Images.show.load('top');\n};\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nfunction show() {\n const positionLoad = 'top';\n const relative = true;\n CloudCmd.Markdown.show('/HELP.md', {\n positionLoad,\n relative\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/help.js\n}");
513
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n\nconst {\n CloudCmd\n} = globalThis;\nCloudCmd.Help = {\n init,\n show,\n hide\n};\nfunction init() {\n _dom_images__WEBPACK_IMPORTED_MODULE_0__.show.load('top');\n}\nfunction show() {\n const positionLoad = 'top';\n const relative = true;\n CloudCmd.Markdown.show('/HELP.md', {\n positionLoad,\n relative\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/help.js\n}");
514
514
 
515
515
  /***/ },
516
516
 
517
- /***/ "./client/modules/konsole.mjs"
518
- /*!************************************!*\
519
- !*** ./client/modules/konsole.mjs ***!
520
- \************************************/
517
+ /***/ "./client/modules/konsole.js"
518
+ /*!***********************************!*\
519
+ !*** ./client/modules/konsole.js ***!
520
+ \***********************************/
521
521
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
522
522
 
523
523
  "use strict";
524
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global Console */\n\n\n\n\n\n\nCloudCmd.Konsole = {\n init,\n show,\n hide\n};\nconst {\n Dialog,\n CurrentInfo: Info\n} = DOM;\nconst rmLastSlash = a => a.replace(/\\/$/, '') || '/';\nlet konsole;\nconst {\n config\n} = CloudCmd;\nconst cd = currify__WEBPACK_IMPORTED_MODULE_1__((fn, dir) => fn(`cd ${rmLastSlash(dir)}`));\nconst Name = 'Konsole';\nlet Element;\nlet Loaded;\nasync function init() {\n if (!config('console')) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.show.load('top');\n await CloudCmd.View();\n await load();\n await create();\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst clear = () => {\n konsole.clear();\n};\nconst getPrefix = () => CloudCmd.prefix + '/console';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/console';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath.bind(DOM),\n PASSIVE_DIR: DOM.getNotCurrentDirPath.bind(DOM),\n CURRENT_NAME: DOM.getCurrentName.bind(DOM),\n CURRENT_PATH: () => Info.path\n});\nasync function onPath(path) {\n if (Info.dirPath === path) return;\n await CloudCmd.changeDir(path);\n}\nconst getDirPath = () => {\n if (config('syncConsolePath')) return Info.dirPath;\n};\nconst create = async () => {\n const options = {\n cwd: getDirPath(),\n env: getEnv(),\n prefix: getPrefix(),\n prefixSocket: getPrefixSocket(),\n socketPath: CloudCmd.prefix\n };\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__('div', {\n className: 'console'\n });\n konsole = await Console(Element, options);\n konsole.on('connect', execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](authCheck, konsole));\n konsole.on('path', config.if('syncConsolePath', onPath));\n CloudCmd.on('active-dir', config.if('syncConsolePath', cd(konsole.handler)));\n konsole.addShortCuts({\n P: () => {\n const command = konsole.getPromptText();\n const path = DOM.getCurrentDirPath();\n konsole.setPromptText(command + path);\n }\n });\n};\nfunction authCheck(konsole) {\n konsole.emit('auth', config('username'), config('password'));\n konsole.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction show(callback) {\n if (!Loaded) return;\n if (!config('console')) return;\n CloudCmd.View.show(Element, {\n afterShow: () => {\n konsole.focus();\n execon__WEBPACK_IMPORTED_MODULE_0__(callback);\n }\n });\n}\nconst load = async () => {\n Util.time(`${Name} load`);\n const prefix = getPrefix();\n const url = `${prefix}/console.js`;\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_3__.js, url);\n Loaded = true;\n Util.timeEnd(`${Name} load`);\n if (error) return Dialog.alert(error.message, {\n cancel: false\n });\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/konsole.mjs\n}");
524
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global Console */\n\n\n\n\n\n\nCloudCmd.Konsole = {\n init,\n show,\n hide\n};\nconst {\n Dialog,\n CurrentInfo: Info\n} = DOM;\nconst rmLastSlash = a => a.replace(/\\/$/, '') || '/';\nlet konsole;\nconst {\n config\n} = CloudCmd;\nconst cd = currify__WEBPACK_IMPORTED_MODULE_1__((fn, dir) => fn(`cd ${rmLastSlash(dir)}`));\nconst Name = 'Konsole';\nlet Element;\nlet Loaded;\nasync function init() {\n if (!config('console')) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.show.load('top');\n await CloudCmd.View();\n await load();\n await create();\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst clear = () => {\n konsole.clear();\n};\nconst getPrefix = () => CloudCmd.prefix + '/console';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/console';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath.bind(DOM),\n PASSIVE_DIR: DOM.getNotCurrentDirPath.bind(DOM),\n CURRENT_NAME: DOM.getCurrentName.bind(DOM),\n CURRENT_PATH: () => Info.path\n});\nasync function onPath(path) {\n if (Info.dirPath === path) return;\n await CloudCmd.changeDir(path);\n}\nconst getDirPath = () => {\n if (config('syncConsolePath')) return Info.dirPath;\n};\nconst create = async () => {\n const options = {\n cwd: getDirPath(),\n env: getEnv(),\n prefix: getPrefix(),\n prefixSocket: getPrefixSocket(),\n socketPath: CloudCmd.prefix\n };\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__('div', {\n className: 'console'\n });\n konsole = await Console(Element, options);\n konsole.on('connect', execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](authCheck, konsole));\n konsole.on('path', config.if('syncConsolePath', onPath));\n CloudCmd.on('active-dir', config.if('syncConsolePath', cd(konsole.handler)));\n konsole.addShortCuts({\n P: () => {\n const command = konsole.getPromptText();\n const path = DOM.getCurrentDirPath();\n konsole.setPromptText(command + path);\n }\n });\n};\nfunction authCheck(konsole) {\n konsole.emit('auth', config('username'), config('password'));\n konsole.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction show(callback) {\n if (!Loaded) return;\n if (!config('console')) return;\n CloudCmd.View.show(Element, {\n afterShow: () => {\n konsole.focus();\n execon__WEBPACK_IMPORTED_MODULE_0__(callback);\n }\n });\n}\nconst load = async () => {\n Util.time(`${Name} load`);\n const prefix = getPrefix();\n const url = `${prefix}/console.js`;\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_3__.js, url);\n Loaded = true;\n Util.timeEnd(`${Name} load`);\n if (error) return Dialog.alert(error.message, {\n cancel: false\n });\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/konsole.js\n}");
525
525
 
526
526
  /***/ },
527
527
 
@@ -529,87 +529,87 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
529
529
  /*!************************************!*\
530
530
  !*** ./client/modules/markdown.js ***!
531
531
  \************************************/
532
- (module, exports, __webpack_require__) {
532
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
533
533
 
534
534
  "use strict";
535
- eval("{\n\n/* global CloudCmd */\nCloudCmd.Markdown = exports;\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst {\n Markdown\n} = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\nconst {\n alert\n} = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\nmodule.exports.init = async () => {\n Images.show.load('top');\n await CloudCmd.View();\n};\nmodule.exports.show = show;\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nasync function show(name, options = {}) {\n const {\n positionLoad,\n relative\n } = options;\n Images.show.load(positionLoad);\n if (relative) name += '?relative';\n const [error, innerHTML] = await Markdown.read(name);\n Images.hide();\n if (error) return alert(error.message, {\n cancel: false\n });\n const className = 'help';\n const div = createElement('div', {\n className,\n innerHTML\n });\n CloudCmd.View.show(div);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/markdown.js\n}");
535
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n\n\n\n\nconst {\n CloudCmd\n} = globalThis;\nCloudCmd.Markdown = {\n init,\n show,\n hide\n};\nasync function init() {\n _dom_images__WEBPACK_IMPORTED_MODULE_1__.show.load('top');\n await CloudCmd.View();\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nasync function show(name, options = {}) {\n const {\n positionLoad,\n relative\n } = options;\n _dom_images__WEBPACK_IMPORTED_MODULE_1__.show.load(positionLoad);\n if (relative) name += '?relative';\n const [error, innerHTML] = await _dom_rest__WEBPACK_IMPORTED_MODULE_2__.Markdown.read(name);\n _dom_images__WEBPACK_IMPORTED_MODULE_1__.hide();\n if (error) return (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_3__.alert)(error.message, {\n cancel: false\n });\n const className = 'help';\n const div = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('div', {\n className,\n innerHTML\n });\n CloudCmd.View.show(div);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/markdown.js\n}");
536
536
 
537
537
  /***/ },
538
538
 
539
- /***/ "./client/modules/menu/cloudmenu.mjs"
540
- /*!*******************************************!*\
541
- !*** ./client/modules/menu/cloudmenu.mjs ***!
542
- \*******************************************/
539
+ /***/ "./client/modules/menu/cloudmenu.js"
540
+ /*!******************************************!*\
541
+ !*** ./client/modules/menu/cloudmenu.js ***!
542
+ \******************************************/
543
543
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
544
544
 
545
545
  "use strict";
546
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudMenu: () => (/* binding */ createCloudMenu)\n/* harmony export */ });\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n\nconst noop = () => {};\nconst {\n CloudCmd\n} = globalThis;\nconst createCloudMenu = async (fm, options, menuData) => {\n const createMenu = await loadMenu();\n const menu = await createMenu(fm, options, menuData);\n menu.addContextMenuListener = menu.addContextMenuListener || noop;\n return menu;\n};\nasync function loadMenu() {\n if (CloudCmd.config('menu') === 'aleman') {\n const {\n host,\n protocol\n } = globalThis.location;\n const url = `${protocol}//${host}/node_modules/aleman/menu/menu.js`;\n const {\n createMenu\n } = await import(/* webpackIgnore: true */url);\n return createMenu;\n }\n return createSupermenu;\n}\nfunction createSupermenu(name, options, menuData) {\n const element = document.querySelector('[data-name=\"js-fm\"]');\n return supermenu__WEBPACK_IMPORTED_MODULE_0__(element, options, menuData);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/cloudmenu.mjs\n}");
546
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudMenu: () => (/* binding */ createCloudMenu)\n/* harmony export */ });\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n\nconst noop = () => {};\nconst {\n CloudCmd\n} = globalThis;\nconst createCloudMenu = async (fm, options, menuData) => {\n const createMenu = await loadMenu();\n const menu = await createMenu(fm, options, menuData);\n menu.addContextMenuListener = menu.addContextMenuListener || noop;\n return menu;\n};\nasync function loadMenu() {\n if (CloudCmd.config('menu') === 'aleman') {\n const {\n host,\n protocol\n } = globalThis.location;\n const url = `${protocol}//${host}/node_modules/aleman/menu/menu.js`;\n const {\n createMenu\n } = await import(/* webpackIgnore: true */url);\n return createMenu;\n }\n return createSupermenu;\n}\nfunction createSupermenu(name, options, menuData) {\n const element = document.querySelector('[data-name=\"js-fm\"]');\n return supermenu__WEBPACK_IMPORTED_MODULE_0__(element, options, menuData);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/cloudmenu.js\n}");
547
547
 
548
548
  /***/ },
549
549
 
550
- /***/ "./client/modules/menu/index.mjs"
551
- /*!***************************************!*\
552
- !*** ./client/modules/menu/index.mjs ***!
553
- \***************************************/
550
+ /***/ "./client/modules/menu/index.js"
551
+ /*!**************************************!*\
552
+ !*** ./client/modules/menu/index.js ***!
553
+ \**************************************/
554
554
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
555
555
 
556
556
  "use strict";
557
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENABLED: () => (/* binding */ ENABLED),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\nconst {\n config,\n Key\n} = CloudCmd;\nconst {\n Buffer,\n Events,\n Dialog,\n Images\n} = DOM;\nconst Info = DOM.CurrentInfo;\nconst alertNoFiles = Dialog.alert.noFiles;\nconst uploadTo = wraptile__WEBPACK_IMPORTED_MODULE_1__(_uploadTo);\nlet MenuShowedName;\nlet MenuContext;\nlet MenuContextFile;\nconst ENABLED = false;\nCloudCmd.Menu = {\n init,\n show,\n hide\n};\nasync function init() {\n const {\n isAuth,\n menuDataFile\n } = getFileMenuData();\n const fm = DOM.getFM();\n const menuData = getMenuData(isAuth);\n const options = getOptions({\n type: 'context'\n });\n const optionsFile = getOptions({\n type: 'file'\n });\n const {\n createCloudMenu\n } = await __webpack_require__.e(/*! import() */ \"cloudcmd.common\").then(__webpack_require__.bind(__webpack_require__, /*! ./cloudmenu.mjs */ \"./client/modules/menu/cloudmenu.mjs\"));\n const {\n name\n } = fm.dataset;\n MenuContext = await createCloudMenu(name, options, menuData);\n MenuContextFile = await createCloudMenu(name, optionsFile, menuDataFile);\n MenuContext.addContextMenuListener();\n MenuContextFile.addContextMenuListener();\n Events.addKey(listener);\n}\nfunction hide() {\n MenuContext.hide();\n MenuContextFile.hide();\n}\nfunction show(position) {\n const {\n x,\n y\n } = getPosition(position);\n MenuContext.show(x, y);\n MenuContextFile.show(x, y);\n Images.hide();\n}\nfunction getPosition(position) {\n if (position) return {\n x: position.x,\n y: position.y\n };\n return getCurrentPosition();\n}\nfunction getMenuNameByEl(el) {\n if (!el) return 'context';\n const name = DOM.getCurrentName(el);\n if (name === '..') return 'context';\n return 'contextFile';\n}\nfunction getOptions({\n type\n}) {\n let name;\n let func;\n if (type === 'context') {\n name = 'context';\n func = Key.unsetBind;\n } else if (type === 'file') {\n name = 'contextFile';\n }\n const options = {\n icon: true,\n infiniteScroll: false,\n beforeClose: Key.setBind,\n beforeHide: Key.setBind,\n beforeShow: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](beforeShow, func),\n beforeClick,\n name\n };\n return options;\n}\nfunction getMenuData(isAuth) {\n const menu = {\n 'Paste': Buffer.paste,\n 'New': {\n File: DOM.promptNewFile,\n Directory: DOM.promptNewDir\n },\n 'Upload': () => {\n CloudCmd.Upload.show();\n },\n 'Upload From Cloud': uploadFromCloud,\n 'Toggle File Selection': DOM.toggleSelectedFile,\n '(Un)Select All': DOM.toggleAllSelectedFiles\n };\n if (isAuth) menu['Log Out'] = CloudCmd.logOut;\n return menu;\n}\nfunction getFileMenuData() {\n const isAuth = CloudCmd.config('auth');\n const menuBottom = getMenuData(isAuth);\n const menuTop = {\n 'View': () => {\n CloudCmd.View.show();\n },\n 'Edit': () => {\n const name = config('vim') ? 'EditFileVim' : 'EditFile';\n CloudCmd[name].show();\n },\n 'Rename': () => {\n setTimeout(DOM.renameCurrent, 100);\n },\n 'Delete': () => {\n CloudCmd.Operation.show('delete');\n },\n 'Pack': () => {\n CloudCmd.Operation.show('pack');\n },\n 'Extract': () => {\n CloudCmd.Operation.show('extract');\n },\n 'Download': preDownload,\n 'Upload To Cloud': uploadTo('Cloud'),\n 'Cut': () => {\n isCurrent(Buffer.cut, alertNoFiles);\n },\n 'Copy': () => {\n isCurrent(Buffer.copy, alertNoFiles);\n }\n };\n const menuDataFile = {\n ...menuTop,\n ...menuBottom\n };\n return {\n isAuth,\n menuDataFile\n };\n}\nfunction isCurrent(yesFn, noFn) {\n if (Info.name !== '..') return yesFn();\n noFn();\n}\nfunction isPath(x, y) {\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return false;\n const el = document.elementFromPoint(x, y);\n const elements = panel.querySelectorAll('[data-name=\"js-path\"] *');\n return !~[].indexOf.call(elements, el);\n}\nfunction beforeShow(callback, params) {\n Key.unsetBind();\n const {\n name,\n position = {\n x: params.x,\n y: params.y\n }\n } = params;\n const {\n x,\n y\n } = position;\n const el = DOM.getCurrentByPosition({\n x,\n y\n });\n const menuName = getMenuNameByEl(el);\n let isShow = menuName !== 'contextFile';\n if (params.name === 'contextFile') isShow = !isShow;\n if (isShow) MenuShowedName = name;\n execon__WEBPACK_IMPORTED_MODULE_0__(callback);\n if (isShow) isShow = isPath(x, y);\n return isShow;\n}\nconst beforeClick = name => MenuShowedName !== name;\nasync function _uploadTo(nameModule) {\n const [error, data] = await Info.getData();\n if (error) return;\n const {\n name\n } = Info;\n CloudCmd.execFromModule(nameModule, 'uploadFile', name, data);\n CloudCmd.log(`Uploading to ${name}...`);\n}\nfunction uploadFromCloud() {\n Images.show.load('top');\n CloudCmd.execFromModule('Cloud', 'saveFile', async (currentName, data) => {\n const path = DOM.getCurrentDirPath() + currentName;\n const [e] = await _dom_rest__WEBPACK_IMPORTED_MODULE_4__.write(path, data);\n if (e) return;\n await CloudCmd.refresh({\n currentName\n });\n });\n}\nfunction preDownload() {\n download(config('packer'));\n}\nfunction download(type) {\n const TIME = 30 * 1000;\n const {\n prefixURL\n } = CloudCmd;\n const PACK = '/pack';\n const date = Date.now();\n const files = DOM.getActiveFiles();\n if (!files.length) return alertNoFiles();\n for (const file of files) {\n const selected = DOM.isSelected(file);\n const isDir = DOM.isCurrentIsDir(file);\n const path = DOM.getCurrentPath(file);\n CloudCmd.log(`downloading file ${path}...`);\n\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n * and all other characters, like \"%\"\n */\n const encodedPath = encodeURI(path).replace(/#/g, '#');\n const id = (0,_dom_load__WEBPACK_IMPORTED_MODULE_3__.getIdBySrc)(path);\n let src;\n if (isDir) src = prefixURL + PACK + encodedPath + DOM.getPackerExt(type);else src = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__.FS + encodedPath + '?download';\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__('iframe', {\n id: id + '-' + date,\n async: false,\n className: 'hidden',\n src\n });\n const {\n body\n } = document;\n const removeChild = body.removeChild.bind(body, element);\n setTimeout(removeChild, TIME);\n if (selected) DOM.toggleSelectedFile(file);\n }\n}\nfunction getCurrentPosition() {\n const current = Info.element;\n const rect = current.getBoundingClientRect();\n const position = {\n x: Math.round(rect.left + rect.width / 3),\n y: Math.round(rect.top)\n };\n return position;\n}\nfunction listener(event) {\n const {\n F9,\n ESC\n } = Key;\n const key = event.keyCode;\n const isBind = Key.isBind();\n if (key === ESC) {\n Key.setBind();\n return hide();\n }\n if (isBind && key === F9) {\n const position = getCurrentPosition();\n MenuContext.show(position.x, position.y);\n event.preventDefault();\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/index.mjs\n}");
557
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENABLED: () => (/* binding */ ENABLED),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.js\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\nconst {\n config,\n Key\n} = CloudCmd;\nconst {\n Buffer,\n Events,\n Dialog,\n Images\n} = DOM;\nconst Info = DOM.CurrentInfo;\nconst alertNoFiles = Dialog.alert.noFiles;\nconst uploadTo = wraptile__WEBPACK_IMPORTED_MODULE_1__(_uploadTo);\nlet MenuShowedName;\nlet MenuContext;\nlet MenuContextFile;\nconst ENABLED = false;\nCloudCmd.Menu = {\n init,\n show,\n hide\n};\nasync function init() {\n const {\n isAuth,\n menuDataFile\n } = getFileMenuData();\n const fm = DOM.getFM();\n const menuData = getMenuData(isAuth);\n const options = getOptions({\n type: 'context'\n });\n const optionsFile = getOptions({\n type: 'file'\n });\n const {\n createCloudMenu\n } = await __webpack_require__.e(/*! import() */ \"cloudcmd.common\").then(__webpack_require__.bind(__webpack_require__, /*! ./cloudmenu.js */ \"./client/modules/menu/cloudmenu.js\"));\n const {\n name\n } = fm.dataset;\n MenuContext = await createCloudMenu(name, options, menuData);\n MenuContextFile = await createCloudMenu(name, optionsFile, menuDataFile);\n MenuContext.addContextMenuListener();\n MenuContextFile.addContextMenuListener();\n Events.addKey(listener);\n}\nfunction hide() {\n MenuContext.hide();\n MenuContextFile.hide();\n}\nfunction show(position) {\n const {\n x,\n y\n } = getPosition(position);\n MenuContext.show(x, y);\n MenuContextFile.show(x, y);\n Images.hide();\n}\nfunction getPosition(position) {\n if (position) return {\n x: position.x,\n y: position.y\n };\n return getCurrentPosition();\n}\nfunction getMenuNameByEl(el) {\n if (!el) return 'context';\n const name = DOM.getCurrentName(el);\n if (name === '..') return 'context';\n return 'contextFile';\n}\nfunction getOptions({\n type\n}) {\n let name;\n let func;\n if (type === 'context') {\n name = 'context';\n func = Key.unsetBind;\n } else if (type === 'file') {\n name = 'contextFile';\n }\n const options = {\n icon: true,\n infiniteScroll: false,\n beforeClose: Key.setBind,\n beforeHide: Key.setBind,\n beforeShow: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](beforeShow, func),\n beforeClick,\n name\n };\n return options;\n}\nfunction getMenuData(isAuth) {\n const menu = {\n 'Paste': Buffer.paste,\n 'New': {\n File: DOM.promptNewFile,\n Directory: DOM.promptNewDir\n },\n 'Upload': () => {\n CloudCmd.Upload.show();\n },\n 'Upload From Cloud': uploadFromCloud,\n 'Toggle File Selection': DOM.toggleSelectedFile,\n '(Un)Select All': DOM.toggleAllSelectedFiles\n };\n if (isAuth) menu['Log Out'] = CloudCmd.logOut;\n return menu;\n}\nfunction getFileMenuData() {\n const isAuth = CloudCmd.config('auth');\n const menuBottom = getMenuData(isAuth);\n const menuTop = {\n 'View': () => {\n CloudCmd.View.show();\n },\n 'Edit': () => {\n const name = config('vim') ? 'EditFileVim' : 'EditFile';\n CloudCmd[name].show();\n },\n 'Rename': () => {\n setTimeout(DOM.renameCurrent, 100);\n },\n 'Delete': () => {\n CloudCmd.Operation.show('delete');\n },\n 'Pack': () => {\n CloudCmd.Operation.show('pack');\n },\n 'Extract': () => {\n CloudCmd.Operation.show('extract');\n },\n 'Download': preDownload,\n 'Upload To Cloud': uploadTo('Cloud'),\n 'Cut': () => {\n isCurrent(Buffer.cut, alertNoFiles);\n },\n 'Copy': () => {\n isCurrent(Buffer.copy, alertNoFiles);\n }\n };\n const menuDataFile = {\n ...menuTop,\n ...menuBottom\n };\n return {\n isAuth,\n menuDataFile\n };\n}\nfunction isCurrent(yesFn, noFn) {\n if (Info.name !== '..') return yesFn();\n noFn();\n}\nfunction isPath(x, y) {\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return false;\n const el = document.elementFromPoint(x, y);\n const elements = panel.querySelectorAll('[data-name=\"js-path\"] *');\n return !~[].indexOf.call(elements, el);\n}\nfunction beforeShow(callback, params) {\n Key.unsetBind();\n const {\n name,\n position = {\n x: params.x,\n y: params.y\n }\n } = params;\n const {\n x,\n y\n } = position;\n const el = DOM.getCurrentByPosition({\n x,\n y\n });\n const menuName = getMenuNameByEl(el);\n let isShow = menuName !== 'contextFile';\n if (params.name === 'contextFile') isShow = !isShow;\n if (isShow) MenuShowedName = name;\n execon__WEBPACK_IMPORTED_MODULE_0__(callback);\n if (isShow) isShow = isPath(x, y);\n return isShow;\n}\nconst beforeClick = name => MenuShowedName !== name;\nasync function _uploadTo(nameModule) {\n const [error, data] = await Info.getData();\n if (error) return;\n const {\n name\n } = Info;\n CloudCmd.execFromModule(nameModule, 'uploadFile', name, data);\n CloudCmd.log(`Uploading to ${name}...`);\n}\nfunction uploadFromCloud() {\n Images.show.load('top');\n CloudCmd.execFromModule('Cloud', 'saveFile', async (currentName, data) => {\n const path = DOM.getCurrentDirPath() + currentName;\n const [e] = await _dom_rest__WEBPACK_IMPORTED_MODULE_4__.write(path, data);\n if (e) return;\n await CloudCmd.refresh({\n currentName\n });\n });\n}\nfunction preDownload() {\n download(config('packer'));\n}\nfunction download(type) {\n const TIME = 30 * 1000;\n const {\n prefixURL\n } = CloudCmd;\n const PACK = '/pack';\n const date = Date.now();\n const files = DOM.getActiveFiles();\n if (!files.length) return alertNoFiles();\n for (const file of files) {\n const selected = DOM.isSelected(file);\n const isDir = DOM.isCurrentIsDir(file);\n const path = DOM.getCurrentPath(file);\n CloudCmd.log(`downloading file ${path}...`);\n\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n * and all other characters, like \"%\"\n */\n const encodedPath = encodeURI(path).replace(/#/g, '#');\n const id = (0,_dom_load__WEBPACK_IMPORTED_MODULE_3__.getIdBySrc)(path);\n let src;\n if (isDir) src = prefixURL + PACK + encodedPath + DOM.getPackerExt(type);else src = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__.FS + encodedPath + '?download';\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__('iframe', {\n id: id + '-' + date,\n async: false,\n className: 'hidden',\n src\n });\n const {\n body\n } = document;\n const removeChild = body.removeChild.bind(body, element);\n setTimeout(removeChild, TIME);\n if (selected) DOM.toggleSelectedFile(file);\n }\n}\nfunction getCurrentPosition() {\n const current = Info.element;\n const rect = current.getBoundingClientRect();\n const position = {\n x: Math.round(rect.left + rect.width / 3),\n y: Math.round(rect.top)\n };\n return position;\n}\nfunction listener(event) {\n const {\n F9,\n ESC\n } = Key;\n const key = event.keyCode;\n const isBind = Key.isBind();\n if (key === ESC) {\n Key.setBind();\n return hide();\n }\n if (isBind && key === F9) {\n const position = getCurrentPosition();\n MenuContext.show(position.x, position.y);\n event.preventDefault();\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/index.js\n}");
558
558
 
559
559
  /***/ },
560
560
 
561
- /***/ "./client/modules/operation/format.mjs"
562
- /*!*********************************************!*\
563
- !*** ./client/modules/operation/format.mjs ***!
564
- \*********************************************/
561
+ /***/ "./client/modules/operation/format.js"
562
+ /*!********************************************!*\
563
+ !*** ./client/modules/operation/format.js ***!
564
+ \********************************************/
565
565
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
566
566
 
567
567
  "use strict";
568
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ format: () => (/* binding */ format)\n/* harmony export */ });\nconst format = (operation, from, to) => {\n if (!to) return `${operation} ${from}`;\n return `${operation} ${from} -> ${to}`;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/format.mjs\n}");
568
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ format: () => (/* binding */ format)\n/* harmony export */ });\nconst format = (operation, from, to) => {\n if (!to) return `${operation} ${from}`;\n return `${operation} ${from} -> ${to}`;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/format.js\n}");
569
569
 
570
570
  /***/ },
571
571
 
572
- /***/ "./client/modules/operation/get-next-current-name.mjs"
573
- /*!************************************************************!*\
574
- !*** ./client/modules/operation/get-next-current-name.mjs ***!
575
- \************************************************************/
572
+ /***/ "./client/modules/operation/get-next-current-name.js"
573
+ /*!***********************************************************!*\
574
+ !*** ./client/modules/operation/get-next-current-name.js ***!
575
+ \***********************************************************/
576
576
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
577
577
 
578
578
  "use strict";
579
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getNextCurrentName: () => (/* binding */ getNextCurrentName)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst not = currify__WEBPACK_IMPORTED_MODULE_0__((array, value) => !array.includes(value));\nconst notOneOf = currify__WEBPACK_IMPORTED_MODULE_0__((a, b) => a.filter(not(b)));\nconst getNextCurrentName = (currentName, names, removedNames) => {\n const i = names.indexOf(currentName);\n const nextNames = notOneOf(names, removedNames);\n const {\n length\n } = nextNames;\n if (nextNames[i]) return nextNames[i];\n return nextNames[length - 1];\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/get-next-current-name.mjs\n}");
579
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getNextCurrentName: () => (/* binding */ getNextCurrentName)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst not = currify__WEBPACK_IMPORTED_MODULE_0__((array, value) => !array.includes(value));\nconst notOneOf = currify__WEBPACK_IMPORTED_MODULE_0__((a, b) => a.filter(not(b)));\nconst getNextCurrentName = (currentName, names, removedNames) => {\n const i = names.indexOf(currentName);\n const nextNames = notOneOf(names, removedNames);\n const {\n length\n } = nextNames;\n if (nextNames[i]) return nextNames[i];\n return nextNames[length - 1];\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/get-next-current-name.js\n}");
580
580
 
581
581
  /***/ },
582
582
 
583
- /***/ "./client/modules/operation/index.mjs"
584
- /*!********************************************!*\
585
- !*** ./client/modules/operation/index.mjs ***!
586
- \********************************************/
583
+ /***/ "./client/modules/operation/index.js"
584
+ /*!*******************************************!*\
585
+ !*** ./client/modules/operation/index.js ***!
586
+ \*******************************************/
587
587
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
588
588
 
589
589
  "use strict";
590
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n/* harmony import */ var _remove_extension_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./remove-extension.mjs */ \"./client/modules/operation/remove-extension.mjs\");\n/* harmony import */ var _set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./set-listeners.mjs */ \"./client/modules/operation/set-listeners.mjs\");\n/* harmony import */ var _get_next_current_name_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-next-current-name.mjs */ \"./client/modules/operation/get-next-current-name.mjs\");\n\n\n\n\n\n\n\n\n\n\nconst {\n DOM,\n CloudCmd\n} = globalThis;\nconst removeQuery = a => a.replace(/\\?.*/, '');\nconst Name = 'Operation';\nconst {\n config\n} = CloudCmd;\nconst {\n Dialog,\n Images\n} = DOM;\nconst authCheck = wraptile__WEBPACK_IMPORTED_MODULE_1__(_authCheck);\nconst Operation = {};\nlet Loaded;\nlet copyFn;\nlet moveFn;\nlet deleteFn;\nlet extractFn;\nlet packZipFn;\nlet packTarFn;\nconst Info = DOM.CurrentInfo;\nconst showLoad = Images.show.load.bind(null, 'top');\nconst processFiles = currify__WEBPACK_IMPORTED_MODULE_0__(_processFiles);\nconst noFilesCheck = () => {\n const {\n length\n } = DOM.getActiveFiles();\n const is = Boolean(!length);\n if (is) return Dialog.alert.noFiles();\n return is;\n};\nconst init = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_2__.promisify)(callback => {\n showLoad();\n execon__WEBPACK_IMPORTED_MODULE_3__.series([DOM.loadSocket, async callback => {\n if (config('dropbox')) return callback();\n const {\n prefix,\n prefixSocket\n } = CloudCmd;\n await loadAll();\n await initOperations(prefix, prefixSocket, callback);\n }, callback => {\n Loaded = true;\n Images.hide();\n callback();\n }], callback);\n});\nfunction _authCheck(spawn, ok) {\n const accept = wraptile__WEBPACK_IMPORTED_MODULE_1__(ok);\n const alertDialog = wraptile__WEBPACK_IMPORTED_MODULE_1__(Dialog.alert);\n spawn.on('accept', accept(spawn));\n spawn.on('reject', alertDialog('Wrong credentials!'));\n spawn.emit('auth', config('username'), config('password'));\n}\nconst onConnect = currify__WEBPACK_IMPORTED_MODULE_0__((fn, operator) => {\n setOperations(operator);\n fn();\n});\nasync function initOperations(prefix, socketPrefix, fn) {\n socketPrefix = `${socketPrefix}/fileop`;\n const operator = await globalThis.fileop({\n prefix,\n socketPrefix\n });\n operator.on('connect', authCheck(operator, onConnect(fn)));\n}\nfunction setOperations(operator) {\n packTarFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Tar';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.tar(from, to, names).then(listen);\n };\n packZipFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Zip';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.zip(from, to, names).then(listen);\n };\n deleteFn = (from, files, callback) => {\n from = removeQuery(from);\n const operation = 'Delete';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from\n });\n operator.remove(from, files).then(listen);\n };\n copyFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Copy';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n to,\n names\n });\n operator.copy(from, to, names).then(listen);\n };\n moveFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Move';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n to\n });\n operator.move(from, to, names).then(listen);\n };\n extractFn = ({\n from,\n to\n }, callback) => {\n const operation = 'Extract';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.extract(from, to).then(listen);\n };\n}\nfunction getPacker(type) {\n if (type === 'zip') return packZipFn;\n return packTarFn;\n}\nconst hide = () => {\n CloudCmd.View.hide();\n};\nconst show = (operation, data) => {\n if (!Loaded) return;\n if (operation === 'copy') return Operation.copy(data);\n if (operation === 'move') return Operation.move(data);\n if (operation === 'delete') return Operation.delete();\n if (operation === 'delete:silent') return Operation.deleteSilent();\n if (operation === 'pack') return Operation.pack();\n if (operation === 'extract') return Operation.extract();\n};\nOperation.copy = processFiles({\n type: 'copy'\n});\nOperation.move = processFiles({\n type: 'move'\n});\nOperation.delete = promptDelete;\nOperation.deleteSilent = deleteSilent;\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\nOperation.extract = () => {\n twopack('extract');\n};\n\n/**\n * prompt and delete current file or selected files\n *\n * @currentFile\n */\nasync function promptDelete() {\n if (noFilesCheck()) return;\n const msgAsk = 'Do you really want to delete the ';\n const msgSel = 'selected ';\n const files = DOM.getActiveFiles();\n const names = DOM.getFilenames(files);\n const n = names.length;\n let msg;\n if (n) {\n let name = '';\n for (let i = 0; i < 5 && i < n; i++) name += '\\n' + names[i];\n if (n >= 5) name += '\\n...';\n msg = msgAsk + msgSel + n + ' files/directories?\\n' + (0,_common_entity__WEBPACK_IMPORTED_MODULE_6__.encode)(name);\n } else {\n const current = DOM.getCurrentFile();\n const isDir = DOM.isCurrentIsDir(current);\n const getType = isDir => isDir ? 'directory' : 'file';\n const type = getType(isDir) + ' ';\n const name = DOM.getCurrentName(current);\n msg = msgAsk + msgSel + type + name + '?';\n }\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n deleteSilent(files);\n}\n\n/**\n * delete current or selected files\n *\n * @files\n */\nfunction deleteSilent(files = DOM.getActiveFiles()) {\n const query = '?files';\n const path = Info.dirPath;\n if (noFilesCheck()) return;\n showLoad();\n const removedNames = DOM.getFilenames(files);\n const names = DOM.CurrentInfo.files.map(DOM.getCurrentName);\n const currentName = DOM.getCurrentName();\n const nextCurrentName = (0,_get_next_current_name_mjs__WEBPACK_IMPORTED_MODULE_9__.getNextCurrentName)(currentName, names, removedNames);\n deleteFn(path + query, removedNames, async () => {\n await CloudCmd.refresh();\n const names = Info.files.map(DOM.getCurrentName);\n const isCurrent = names.includes(currentName);\n const name = isCurrent ? currentName : nextCurrentName;\n DOM.setCurrentByName(name);\n });\n}\n\n/*\n * process files (copy or move)\n * @param data\n * @param operation\n */\nasync function _processFiles(options, data) {\n let selFiles;\n let files;\n let panel;\n let shouldAsk;\n let ok;\n let from = '';\n let to = '';\n let names = [];\n if (data) {\n ({\n from,\n to,\n names\n } = data);\n ({\n panel\n } = Info);\n } else {\n from = Info.dirPath;\n to = DOM.getNotCurrentDirPath();\n selFiles = DOM.getSelectedFiles();\n names = DOM.getFilenames(selFiles);\n data = {};\n shouldAsk = true;\n panel = Info.panelPassive;\n }\n if (!names.length) names.push(DOM.getCurrentName());\n const [name] = names;\n const sameName = DOM.getCurrentByName(name, panel);\n if (!data && noFilesCheck()) return;\n const {\n type\n } = options;\n const isCopy = type === 'copy';\n const option = isCopy ? 'confirmCopy' : 'confirmMove';\n const title = isCopy ? 'Copy' : 'Rename/Move';\n const operation = isCopy ? copyFn : moveFn;\n if (shouldAsk && config(option)) {\n const [cancel, newTo] = await prompt(title, to, names.map(_common_entity__WEBPACK_IMPORTED_MODULE_6__.encode));\n if (!cancel) ask(newTo);\n return;\n }\n ask(to);\n function ask(to) {\n ok = from !== to && to;\n if (ok && !shouldAsk || !sameName) return go();\n const str = `\"${name}\" already exist. Overwrite?`;\n const cancel = false;\n Dialog.confirm(str, {\n cancel\n }).then(go);\n function go() {\n showLoad();\n files = {\n from,\n to,\n names\n };\n operation(files, async () => {\n await DOM.Storage.remove(from);\n const {\n panel,\n panelPassive\n } = Info;\n if (!Info.isOnePanel) CloudCmd.refresh({\n panel: panelPassive,\n noCurrent: true\n });\n CloudCmd.refresh({\n panel\n });\n });\n }\n }\n}\nfunction checkEmpty(name, operation) {\n if (!operation) throw Error(`${name} could not be empty!`);\n}\nfunction twopack(operation, type) {\n let op;\n let fileFrom;\n let currentName = Info.name;\n const {\n path,\n dirPath\n } = Info;\n const activeFiles = DOM.getActiveFiles();\n const names = DOM.getFilenames(activeFiles);\n checkEmpty('operation', operation);\n if (!names.length) return Dialog.alert.noFiles();\n switch (operation) {\n case 'extract':\n op = extractFn;\n fileFrom = {\n from: path,\n to: dirPath\n };\n currentName = (0,_remove_extension_mjs__WEBPACK_IMPORTED_MODULE_7__.removeExtension)(currentName);\n break;\n case 'pack':\n op = getPacker(type);\n if (names.length > 1) currentName = Info.dir;\n currentName += DOM.getPackerExt(type);\n fileFrom = {\n from: dirPath,\n to: dirPath + currentName,\n names\n };\n break;\n }\n showLoad();\n op(fileFrom, error => {\n !error && CloudCmd.refresh({\n currentName\n });\n });\n}\nasync function prompt(msg, to, names) {\n const n = names.length;\n const [name] = names;\n msg += ' ';\n if (names.length > 1) msg += `${n} file(s)`;else msg += `\"${name}\"`;\n msg += ' to';\n return await Dialog.prompt(msg, to);\n}\nglobalThis.CloudCmd[Name] = {\n init,\n hide,\n show\n};\nasync function loadAll() {\n const {\n prefix\n } = globalThis.CloudCmd;\n const file = `${prefix}/fileop/fileop.js`;\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_4__.js, file);\n if (error) Dialog.alert(error.message);\n Loaded = true;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/index.mjs\n}");
590
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n/* harmony import */ var _remove_extension_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./remove-extension.js */ \"./client/modules/operation/remove-extension.js\");\n/* harmony import */ var _set_listeners_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./set-listeners.js */ \"./client/modules/operation/set-listeners.js\");\n/* harmony import */ var _get_next_current_name_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-next-current-name.js */ \"./client/modules/operation/get-next-current-name.js\");\n\n\n\n\n\n\n\n\n\n\nconst {\n DOM,\n CloudCmd\n} = globalThis;\nconst removeQuery = a => a.replace(/\\?.*/, '');\nconst Name = 'Operation';\nconst {\n config\n} = CloudCmd;\nconst {\n Dialog,\n Images\n} = DOM;\nconst authCheck = wraptile__WEBPACK_IMPORTED_MODULE_1__(_authCheck);\nconst Operation = {};\nlet Loaded;\nlet copyFn;\nlet moveFn;\nlet deleteFn;\nlet extractFn;\nlet packZipFn;\nlet packTarFn;\nconst Info = DOM.CurrentInfo;\nconst showLoad = Images.show.load.bind(null, 'top');\nconst processFiles = currify__WEBPACK_IMPORTED_MODULE_0__(_processFiles);\nconst noFilesCheck = () => {\n const {\n length\n } = DOM.getActiveFiles();\n const is = Boolean(!length);\n if (is) return Dialog.alert.noFiles();\n return is;\n};\nconst init = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_2__.promisify)(callback => {\n showLoad();\n execon__WEBPACK_IMPORTED_MODULE_3__.series([DOM.loadSocket, async callback => {\n if (config('dropbox')) return callback();\n const {\n prefix,\n prefixSocket\n } = CloudCmd;\n await loadAll();\n await initOperations(prefix, prefixSocket, callback);\n }, callback => {\n Loaded = true;\n Images.hide();\n callback();\n }], callback);\n});\nfunction _authCheck(spawn, ok) {\n const accept = wraptile__WEBPACK_IMPORTED_MODULE_1__(ok);\n const alertDialog = wraptile__WEBPACK_IMPORTED_MODULE_1__(Dialog.alert);\n spawn.on('accept', accept(spawn));\n spawn.on('reject', alertDialog('Wrong credentials!'));\n spawn.emit('auth', config('username'), config('password'));\n}\nconst onConnect = currify__WEBPACK_IMPORTED_MODULE_0__((fn, operator) => {\n setOperations(operator);\n fn();\n});\nasync function initOperations(prefix, socketPrefix, fn) {\n socketPrefix = `${socketPrefix}/fileop`;\n const operator = await globalThis.fileop({\n prefix,\n socketPrefix\n });\n operator.on('connect', authCheck(operator, onConnect(fn)));\n}\nfunction setOperations(operator) {\n packTarFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Tar';\n const listen = (0,_set_listeners_js__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.tar(from, to, names).then(listen);\n };\n packZipFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Zip';\n const listen = (0,_set_listeners_js__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.zip(from, to, names).then(listen);\n };\n deleteFn = (from, files, callback) => {\n from = removeQuery(from);\n const operation = 'Delete';\n const listen = (0,_set_listeners_js__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from\n });\n operator.remove(from, files).then(listen);\n };\n copyFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Copy';\n const listen = (0,_set_listeners_js__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n to,\n names\n });\n operator.copy(from, to, names).then(listen);\n };\n moveFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Move';\n const listen = (0,_set_listeners_js__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n to\n });\n operator.move(from, to, names).then(listen);\n };\n extractFn = ({\n from,\n to\n }, callback) => {\n const operation = 'Extract';\n const listen = (0,_set_listeners_js__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.extract(from, to).then(listen);\n };\n}\nfunction getPacker(type) {\n if (type === 'zip') return packZipFn;\n return packTarFn;\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nfunction show(operation, data) {\n if (!Loaded) return;\n if (operation === 'copy') return Operation.copy(data);\n if (operation === 'move') return Operation.move(data);\n if (operation === 'delete') return Operation.delete();\n if (operation === 'delete:silent') return Operation.deleteSilent();\n if (operation === 'pack') return Operation.pack();\n if (operation === 'extract') return Operation.extract();\n}\nOperation.copy = processFiles({\n type: 'copy'\n});\nOperation.move = processFiles({\n type: 'move'\n});\nOperation.delete = promptDelete;\nOperation.deleteSilent = deleteSilent;\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\nOperation.extract = () => {\n twopack('extract');\n};\n\n/**\n * prompt and delete current file or selected files\n *\n * @currentFile\n */\nasync function promptDelete() {\n if (noFilesCheck()) return;\n const msgAsk = 'Do you really want to delete the ';\n const msgSel = 'selected ';\n const files = DOM.getActiveFiles();\n const names = DOM.getFilenames(files);\n const n = names.length;\n let msg;\n if (n) {\n let name = '';\n for (let i = 0; i < 5 && i < n; i++) name += '\\n' + names[i];\n if (n >= 5) name += '\\n...';\n msg = msgAsk + msgSel + n + ' files/directories?\\n' + (0,_common_entity__WEBPACK_IMPORTED_MODULE_6__.encode)(name);\n } else {\n const current = DOM.getCurrentFile();\n const isDir = DOM.isCurrentIsDir(current);\n const getType = isDir => isDir ? 'directory' : 'file';\n const type = getType(isDir) + ' ';\n const name = DOM.getCurrentName(current);\n msg = msgAsk + msgSel + type + name + '?';\n }\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n deleteSilent(files);\n}\n\n/**\n * delete current or selected files\n *\n * @files\n */\nfunction deleteSilent(files = DOM.getActiveFiles()) {\n const query = '?files';\n const path = Info.dirPath;\n if (noFilesCheck()) return;\n showLoad();\n const removedNames = DOM.getFilenames(files);\n const names = DOM.CurrentInfo.files.map(DOM.getCurrentName);\n const currentName = DOM.getCurrentName();\n const nextCurrentName = (0,_get_next_current_name_js__WEBPACK_IMPORTED_MODULE_9__.getNextCurrentName)(currentName, names, removedNames);\n deleteFn(path + query, removedNames, async () => {\n await CloudCmd.refresh();\n const names = Info.files.map(DOM.getCurrentName);\n const isCurrent = names.includes(currentName);\n const name = isCurrent ? currentName : nextCurrentName;\n DOM.setCurrentByName(name);\n });\n}\n\n/*\n * process files (copy or move)\n * @param data\n * @param operation\n */\nasync function _processFiles(options, data) {\n let selFiles;\n let files;\n let panel;\n let shouldAsk;\n let ok;\n let from = '';\n let to = '';\n let names = [];\n if (data) {\n ({\n from,\n to,\n names\n } = data);\n ({\n panel\n } = Info);\n } else {\n from = Info.dirPath;\n to = DOM.getNotCurrentDirPath();\n selFiles = DOM.getSelectedFiles();\n names = DOM.getFilenames(selFiles);\n data = {};\n shouldAsk = true;\n panel = Info.panelPassive;\n }\n if (!names.length) names.push(DOM.getCurrentName());\n const [name] = names;\n const sameName = DOM.getCurrentByName(name, panel);\n if (!data && noFilesCheck()) return;\n const {\n type\n } = options;\n const isCopy = type === 'copy';\n const option = isCopy ? 'confirmCopy' : 'confirmMove';\n const title = isCopy ? 'Copy' : 'Rename/Move';\n const operation = isCopy ? copyFn : moveFn;\n if (shouldAsk && config(option)) {\n const [cancel, newTo] = await prompt(title, to, names.map(_common_entity__WEBPACK_IMPORTED_MODULE_6__.encode));\n if (!cancel) ask(newTo);\n return;\n }\n ask(to);\n function ask(to) {\n ok = from !== to && to;\n if (ok && !shouldAsk || !sameName) return go();\n const str = `\"${name}\" already exist. Overwrite?`;\n const cancel = false;\n Dialog.confirm(str, {\n cancel\n }).then(go);\n function go() {\n showLoad();\n files = {\n from,\n to,\n names\n };\n operation(files, async () => {\n await DOM.Storage.remove(from);\n const {\n panel,\n panelPassive\n } = Info;\n if (!Info.isOnePanel) CloudCmd.refresh({\n panel: panelPassive,\n noCurrent: true\n });\n CloudCmd.refresh({\n panel\n });\n });\n }\n }\n}\nfunction checkEmpty(name, operation) {\n if (!operation) throw Error(`${name} could not be empty!`);\n}\nfunction twopack(operation, type) {\n let op;\n let fileFrom;\n let currentName = Info.name;\n const {\n path,\n dirPath\n } = Info;\n const activeFiles = DOM.getActiveFiles();\n const names = DOM.getFilenames(activeFiles);\n checkEmpty('operation', operation);\n if (!names.length) return Dialog.alert.noFiles();\n switch (operation) {\n case 'extract':\n op = extractFn;\n fileFrom = {\n from: path,\n to: dirPath\n };\n currentName = (0,_remove_extension_js__WEBPACK_IMPORTED_MODULE_7__.removeExtension)(currentName);\n break;\n case 'pack':\n op = getPacker(type);\n if (names.length > 1) currentName = Info.dir;\n currentName += DOM.getPackerExt(type);\n fileFrom = {\n from: dirPath,\n to: dirPath + currentName,\n names\n };\n break;\n }\n showLoad();\n op(fileFrom, error => {\n !error && CloudCmd.refresh({\n currentName\n });\n });\n}\nasync function prompt(msg, to, names) {\n const n = names.length;\n const [name] = names;\n msg += ' ';\n if (names.length > 1) msg += `${n} file(s)`;else msg += `\"${name}\"`;\n msg += ' to';\n return await Dialog.prompt(msg, to);\n}\nglobalThis.CloudCmd[Name] = {\n init,\n hide,\n show\n};\nasync function loadAll() {\n const {\n prefix\n } = globalThis.CloudCmd;\n const file = `${prefix}/fileop/fileop.js`;\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_4__.js, file);\n if (error) Dialog.alert(error.message);\n Loaded = true;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/index.js\n}");
591
591
 
592
592
  /***/ },
593
593
 
594
- /***/ "./client/modules/operation/remove-extension.mjs"
595
- /*!*******************************************************!*\
596
- !*** ./client/modules/operation/remove-extension.mjs ***!
597
- \*******************************************************/
594
+ /***/ "./client/modules/operation/remove-extension.js"
595
+ /*!******************************************************!*\
596
+ !*** ./client/modules/operation/remove-extension.js ***!
597
+ \******************************************************/
598
598
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
599
599
 
600
600
  "use strict";
601
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ removeExtension: () => (/* binding */ removeExtension)\n/* harmony export */ });\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n\nconst removeExtension = name => {\n const ext = getExtension(name);\n return name.replace(ext, '');\n};\nfunction getExtension(name) {\n if (name.endsWith('.tar.gz')) return '.tar.gz';\n if (name.endsWith('.tar.bz2')) return '.tar.bz2';\n return (0,_common_util__WEBPACK_IMPORTED_MODULE_0__.getExt)(name);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/remove-extension.mjs\n}");
601
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ removeExtension: () => (/* binding */ removeExtension)\n/* harmony export */ });\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n\nconst removeExtension = name => {\n const ext = getExtension(name);\n return name.replace(ext, '');\n};\nfunction getExtension(name) {\n if (name.endsWith('.tar.gz')) return '.tar.gz';\n if (name.endsWith('.tar.bz2')) return '.tar.bz2';\n return (0,_common_util__WEBPACK_IMPORTED_MODULE_0__.getExt)(name);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/remove-extension.js\n}");
602
602
 
603
603
  /***/ },
604
604
 
605
- /***/ "./client/modules/operation/set-listeners.mjs"
606
- /*!****************************************************!*\
607
- !*** ./client/modules/operation/set-listeners.mjs ***!
608
- \****************************************************/
605
+ /***/ "./client/modules/operation/set-listeners.js"
606
+ /*!***************************************************!*\
607
+ !*** ./client/modules/operation/set-listeners.js ***!
608
+ \***************************************************/
609
609
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
610
610
 
611
611
  "use strict";
612
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ setListeners: () => (/* binding */ setListeners)\n/* harmony export */ });\n/* harmony import */ var for_each_key__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! for-each-key */ \"./node_modules/for-each-key/lib/for-each-key.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _format_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./format.mjs */ \"./client/modules/operation/format.mjs\");\n/* global DOM */\n\n\n\nconst {\n Dialog,\n Images\n} = DOM;\nconst setListeners = options => emitter => {\n const {\n operation,\n callback,\n noContinue,\n from,\n to\n } = options;\n let done;\n let lastError;\n const onAbort = wraptile__WEBPACK_IMPORTED_MODULE_1__(({\n emitter,\n operation\n }) => {\n emitter.abort();\n const msg = `${operation} aborted`;\n lastError = true;\n Dialog.alert(msg, {\n cancel: false\n });\n });\n const removeListener = emitter.removeListener.bind(emitter);\n const on = emitter.on.bind(emitter);\n const message = (0,_format_mjs__WEBPACK_IMPORTED_MODULE_2__.format)(operation, from, to);\n const progress = Dialog.progress(message);\n progress.catch(onAbort({\n emitter,\n operation\n }));\n let noProgress = true;\n const listeners = {\n progress: value => {\n done = value === 100;\n progress.setProgress(value);\n noProgress = false;\n },\n end: () => {\n Images.hide();\n for_each_key__WEBPACK_IMPORTED_MODULE_0__(removeListener, listeners);\n progress.remove();\n if (lastError || done || noProgress) callback();\n },\n error: async error => {\n lastError = error;\n if (noContinue) {\n listeners.end(error);\n Dialog.alert(error);\n progress.remove();\n return;\n }\n const [cancel] = await Dialog.confirm(`${error}\n Continue?`);\n if (!done && !cancel) return emitter.continue();\n emitter.abort();\n progress.remove();\n }\n };\n for_each_key__WEBPACK_IMPORTED_MODULE_0__(on, listeners);\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/set-listeners.mjs\n}");
612
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ setListeners: () => (/* binding */ setListeners)\n/* harmony export */ });\n/* harmony import */ var for_each_key__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! for-each-key */ \"./node_modules/for-each-key/lib/for-each-key.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _format_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./format.js */ \"./client/modules/operation/format.js\");\n/* global DOM */\n\n\n\nconst {\n Dialog,\n Images\n} = DOM;\nconst setListeners = options => emitter => {\n const {\n operation,\n callback,\n noContinue,\n from,\n to\n } = options;\n let done;\n let lastError;\n const onAbort = wraptile__WEBPACK_IMPORTED_MODULE_1__(({\n emitter,\n operation\n }) => {\n emitter.abort();\n const msg = `${operation} aborted`;\n lastError = true;\n Dialog.alert(msg, {\n cancel: false\n });\n });\n const removeListener = emitter.removeListener.bind(emitter);\n const on = emitter.on.bind(emitter);\n const message = (0,_format_js__WEBPACK_IMPORTED_MODULE_2__.format)(operation, from, to);\n const progress = Dialog.progress(message);\n progress.catch(onAbort({\n emitter,\n operation\n }));\n let noProgress = true;\n const listeners = {\n progress: value => {\n done = value === 100;\n progress.setProgress(value);\n noProgress = false;\n },\n end: () => {\n Images.hide();\n for_each_key__WEBPACK_IMPORTED_MODULE_0__(removeListener, listeners);\n progress.remove();\n if (lastError || done || noProgress) callback();\n },\n error: async error => {\n lastError = error;\n if (noContinue) {\n listeners.end(error);\n Dialog.alert(error);\n progress.remove();\n return;\n }\n const [cancel] = await Dialog.confirm(`${error}\n Continue?`);\n if (!done && !cancel) return emitter.continue();\n emitter.abort();\n progress.remove();\n }\n };\n for_each_key__WEBPACK_IMPORTED_MODULE_0__(on, listeners);\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/set-listeners.js\n}");
613
613
 
614
614
  /***/ },
615
615
 
@@ -617,10 +617,10 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
617
617
  /*!************************************!*\
618
618
  !*** ./client/modules/polyfill.js ***!
619
619
  \************************************/
620
- (module, __unused_webpack_exports, __webpack_require__) {
620
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
621
621
 
622
622
  "use strict";
623
- eval("{\n\n__webpack_require__(/*! domtokenlist-shim */ \"./node_modules/domtokenlist-shim/dist/domtokenlist.js\");\nconst _scrollIntoViewIfNeeded = __webpack_require__(/*! scroll-into-view-if-needed */ \"./node_modules/scroll-into-view-if-needed/dist/index.cjs\");\nglobalThis.DOM = globalThis.DOM || {};\nconst scrollIntoViewIfNeeded = (el, overrides = {}) => {\n const {\n scroll = _scrollIntoViewIfNeeded\n } = overrides;\n return scroll(el, {\n block: 'nearest'\n });\n};\nglobalThis.DOM.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;\nmodule.exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/polyfill.js\n}");
623
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ scrollIntoViewIfNeeded: () => (/* binding */ scrollIntoViewIfNeeded)\n/* harmony export */ });\n/* harmony import */ var scroll_into_view_if_needed__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! scroll-into-view-if-needed */ \"./node_modules/scroll-into-view-if-needed/dist/index.js\");\n\nglobalThis.DOM = globalThis.DOM || {};\nconst scrollIntoViewIfNeeded = (el, overrides = {}) => {\n const {\n scroll = scroll_into_view_if_needed__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n } = overrides;\n return scroll(el, {\n block: 'nearest'\n });\n};\nglobalThis.DOM.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/polyfill.js\n}");
624
624
 
625
625
  /***/ },
626
626
 
@@ -628,10 +628,10 @@ eval("{\n\n__webpack_require__(/*! domtokenlist-shim */ \"./node_modules/domtoke
628
628
  /*!****************************************!*\
629
629
  !*** ./client/modules/terminal-run.js ***!
630
630
  \****************************************/
631
- (module, exports, __webpack_require__) {
631
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
632
632
 
633
633
  "use strict";
634
- eval("{\n\n/* global CloudCmd, gritty */\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.cjs\");\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst DOM = __webpack_require__(/*! ../dom/index.mjs */ \"./client/dom/index.mjs\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = fullstore();\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await tryToCatch(load.parallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(globalThis.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n};\nmodule.exports.show = promisify((options = {}, fn) => {\n if (!Loaded) return fn(null, -1);\n if (!config('terminal')) return;\n create(options);\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n },\n afterClose: (/* exec.series args */\n ) => {\n fn(null, exitCodeStore());\n }\n });\n});\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n});\nfunction create(createOptions) {\n const {\n cwd = DOM.getCurrentDirPath(),\n command,\n autoClose,\n closeMessage = 'Press any key to close Terminal...'\n } = createOptions;\n const options = {\n cwd,\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono',\n command,\n autoRestart: false\n };\n let commandExit = false;\n const {\n socket,\n terminal\n } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (commandExit) hide();\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('exit', code => {\n exitCodeStore(code);\n if (autoClose) return hide();\n terminal.write(`\\n${closeMessage}`);\n commandExit = true;\n });\n Socket.on('connect', exec.with(authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/terminal-run.js\n}");
634
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_terminal_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom */ \"./client/dom/index.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n\n\n\n\n\n\n\n\nconst {\n Dialog\n} = _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\nconst {\n CloudCmd\n} = globalThis;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = {\n init,\n show,\n hide\n};\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_3__.fullstore)();\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_5__.parallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(globalThis.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nasync function init() {\n if (!config('terminal')) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.show.load('top');\n await CloudCmd.View();\n await loadAll();\n}\nasync function show(options = {}) {\n await runTerminal(options);\n}\nconst runTerminal = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_1__.promisify)((options, fn) => {\n if (!Loaded) return fn(null, -1);\n if (!config('terminal')) return;\n create(options);\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n },\n afterClose: (/* exec.series args */\n ) => {\n fn(null, exitCodeStore());\n }\n });\n});\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentDirPath,\n PASSIVE_DIR: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getNotCurrentDirPath,\n CURRENT_NAME: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentName,\n CURRENT_PATH: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentPath\n});\nfunction create(createOptions) {\n const {\n cwd = _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentDirPath(),\n command,\n autoClose,\n closeMessage = 'Press any key to close Terminal...'\n } = createOptions;\n const options = {\n cwd,\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono',\n command,\n autoRestart: false\n };\n let commandExit = false;\n const {\n socket,\n terminal\n } = globalThis.gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (commandExit) hide();\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('exit', code => {\n exitCodeStore(code);\n if (autoClose) return hide();\n terminal.write(`\\n${closeMessage}`);\n commandExit = true;\n });\n Socket.on('connect', execon__WEBPACK_IMPORTED_MODULE_4__[\"with\"](authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/terminal-run.js\n}");
635
635
 
636
636
  /***/ },
637
637
 
@@ -639,153 +639,153 @@ eval("{\n\n/* global CloudCmd, gritty */\nconst {\n promisify\n} = __webpack_re
639
639
  /*!************************************!*\
640
640
  !*** ./client/modules/terminal.js ***!
641
641
  \************************************/
642
- (module, exports, __webpack_require__) {
642
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
643
643
 
644
644
  "use strict";
645
- eval("{\n\n/* global CloudCmd */\n/* global gritty */\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst DOM = __webpack_require__(/*! ../dom/index.mjs */ \"./client/dom/index.mjs\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst loadParallel = load.parallel;\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.Terminal = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await tryToCatch(loadParallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(globalThis.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n create();\n};\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n});\nfunction create() {\n const options = {\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono'\n };\n const {\n socket,\n terminal\n } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('connect', exec.with(authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction show() {\n if (!Loaded) return;\n if (!config('terminal')) return;\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n }\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/terminal.js\n}");
645
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_terminal_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #css/terminal.css */ \"./css/terminal.css\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom */ \"./client/dom/index.js\");\n\n\n\n\n\n\nconst loadParallel = load_js__WEBPACK_IMPORTED_MODULE_3__.parallel;\nconst {\n CloudCmd\n} = globalThis;\nconst {\n Dialog\n} = _dom__WEBPACK_IMPORTED_MODULE_5__[\"default\"];\nconst {\n Key,\n config\n} = globalThis.CloudCmd;\nCloudCmd.Terminal = {\n init,\n show,\n hide\n};\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.tryToCatch)(loadParallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(globalThis.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nasync function init() {\n if (!config('terminal')) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_4__.show.load('top');\n await CloudCmd.View();\n await loadAll();\n create();\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: _dom__WEBPACK_IMPORTED_MODULE_5__[\"default\"].getCurrentDirPath,\n PASSIVE_DIR: _dom__WEBPACK_IMPORTED_MODULE_5__[\"default\"].getNotCurrentDirPath,\n CURRENT_NAME: _dom__WEBPACK_IMPORTED_MODULE_5__[\"default\"].getCurrentName,\n CURRENT_PATH: _dom__WEBPACK_IMPORTED_MODULE_5__[\"default\"].getCurrentPath\n});\nfunction create() {\n const options = {\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono'\n };\n const {\n socket,\n terminal\n } = globalThis.gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('connect', execon__WEBPACK_IMPORTED_MODULE_2__[\"with\"](authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction show() {\n if (!Loaded) return;\n if (!config('terminal')) return;\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n }\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/terminal.js\n}");
646
646
 
647
647
  /***/ },
648
648
 
649
- /***/ "./client/modules/upload.mjs"
650
- /*!***********************************!*\
651
- !*** ./client/modules/upload.mjs ***!
652
- \***********************************/
649
+ /***/ "./client/modules/upload.js"
650
+ /*!**********************************!*\
651
+ !*** ./client/modules/upload.js ***!
652
+ \**********************************/
653
653
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
654
654
 
655
655
  "use strict";
656
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_upload_files__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/upload-files */ \"./client/dom/upload-files.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\nCloudCmd.Upload = {\n init,\n show,\n hide\n};\nasync function init() {\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.show.load('top');\n await CloudCmd.View();\n}\nasync function show() {\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.show.load('top');\n const innerHTML = await _dom_files__WEBPACK_IMPORTED_MODULE_1__.get('upload');\n const autoSize = true;\n const el = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('div', {\n innerHTML\n });\n CloudCmd.View.show(el, {\n autoSize,\n afterShow\n });\n const fontFamily = ['\"Droid Sans Mono\"', '\"Ubuntu Mono\"', '\"Consolas\"', 'monospace'].join(', ');\n _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('style', {\n dataName: 'upload-css',\n innerText: `[data-name=js-upload-file-button] {\n font-family: ${fontFamily};\n font-size: 16px;\n margin: 10px 0 10px 0;\n }`\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nfunction afterShow() {\n const button = DOM.getByDataName('js-upload-file-button');\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.hide();\n DOM.Events.add('change', button, ({\n target\n }) => {\n const {\n files\n } = target;\n hide();\n (0,_dom_upload_files__WEBPACK_IMPORTED_MODULE_2__.uploadFiles)(files);\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/upload.mjs\n}");
656
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _dom_upload_files__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/upload-files */ \"./client/dom/upload-files.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* global CloudCmd, DOM */\n\n\n\n\nCloudCmd.Upload = {\n init,\n show,\n hide\n};\nasync function init() {\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.show.load('top');\n await CloudCmd.View();\n}\nasync function show() {\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.show.load('top');\n const innerHTML = await _dom_files__WEBPACK_IMPORTED_MODULE_1__.get('upload');\n const autoSize = true;\n const el = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('div', {\n innerHTML\n });\n CloudCmd.View.show(el, {\n autoSize,\n afterShow\n });\n const fontFamily = ['\"Droid Sans Mono\"', '\"Ubuntu Mono\"', '\"Consolas\"', 'monospace'].join(', ');\n _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('style', {\n dataName: 'upload-css',\n innerText: `[data-name=js-upload-file-button] {\n font-family: ${fontFamily};\n font-size: 16px;\n margin: 10px 0 10px 0;\n }`\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nfunction afterShow() {\n const button = DOM.getByDataName('js-upload-file-button');\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.hide();\n DOM.Events.add('change', button, ({\n target\n }) => {\n const {\n files\n } = target;\n hide();\n (0,_dom_upload_files__WEBPACK_IMPORTED_MODULE_2__.uploadFiles)(files);\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/upload.js\n}");
657
657
 
658
658
  /***/ },
659
659
 
660
- /***/ "./client/modules/user-menu/get-user-menu.mjs"
661
- /*!****************************************************!*\
662
- !*** ./client/modules/user-menu/get-user-menu.mjs ***!
663
- \****************************************************/
660
+ /***/ "./client/modules/user-menu/get-user-menu.js"
661
+ /*!***************************************************!*\
662
+ !*** ./client/modules/user-menu/get-user-menu.js ***!
663
+ \***************************************************/
664
664
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
665
665
 
666
666
  "use strict";
667
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getUserMenu: () => (/* binding */ getUserMenu)\n/* harmony export */ });\nconst getUserMenu = menuFn => {\n const module = {};\n const fn = Function('module', menuFn);\n fn(module);\n return module.exports;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/get-user-menu.mjs\n}");
667
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getUserMenu: () => (/* binding */ getUserMenu)\n/* harmony export */ });\nconst getUserMenu = menuFn => {\n const module = {};\n const fn = Function('module', menuFn);\n fn(module);\n return module.exports;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/get-user-menu.js\n}");
668
668
 
669
669
  /***/ },
670
670
 
671
- /***/ "./client/modules/user-menu/index.mjs"
672
- /*!********************************************!*\
673
- !*** ./client/modules/user-menu/index.mjs ***!
674
- \********************************************/
671
+ /***/ "./client/modules/user-menu/index.js"
672
+ /*!*******************************************!*\
673
+ !*** ./client/modules/user-menu/index.js ***!
674
+ \*******************************************/
675
675
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
676
676
 
677
677
  "use strict";
678
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_user_menu_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/user-menu.css */ \"./css/user-menu.css\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var try_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _babel_code_frame__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/code-frame */ \"./node_modules/@babel/code-frame/lib/index.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _get_user_menu_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./get-user-menu.mjs */ \"./client/modules/user-menu/get-user-menu.mjs\");\n/* harmony import */ var _navigate_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./navigate.mjs */ \"./client/modules/user-menu/navigate.mjs\");\n/* harmony import */ var _parse_error_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./parse-error.mjs */ \"./client/modules/user-menu/parse-error.mjs\");\n/* harmony import */ var _parse_user_menu_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./parse-user-menu.mjs */ \"./client/modules/user-menu/parse-user-menu.mjs\");\n/* harmony import */ var _run_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./run.mjs */ \"./client/modules/user-menu/run.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_4__.css;\nconst sourceStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_3__.fullstore)();\nconst Name = 'UserMenu';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst {\n Key\n} = CloudCmd;\nasync function init() {\n await Promise.all([loadCSS(`${CloudCmd.prefix}/dist/user-menu.css`), CloudCmd.View()]);\n}\nconst {\n CurrentInfo\n} = DOM;\nasync function show() {\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load('top');\n const {\n dirPath\n } = CurrentInfo;\n const res = await fetch(`${CloudCmd.prefix}/api/v1/user-menu?dir=${dirPath}`);\n const source = await res.text();\n const [error, userMenu] = (0,try_catch__WEBPACK_IMPORTED_MODULE_6__.tryCatch)(_get_user_menu_mjs__WEBPACK_IMPORTED_MODULE_11__.getUserMenu, source);\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.hide();\n if (error) return _dom_dialog__WEBPACK_IMPORTED_MODULE_9__.alert(getCodeFrame({\n error,\n source\n }));\n sourceStore(source);\n const {\n names,\n keys,\n items,\n settings\n } = (0,_parse_user_menu_mjs__WEBPACK_IMPORTED_MODULE_14__.parseUserMenu)(userMenu);\n if (settings.run) return (0,_run_mjs__WEBPACK_IMPORTED_MODULE_15__.runSelected)(settings.select, items, runUserMenu);\n const button = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__('button', {\n className: 'cloudcmd-user-menu-button',\n innerText: 'User Menu',\n notAppend: true\n });\n const select = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__('select', {\n className: 'cloudcmd-user-menu',\n innerHTML: fillTemplate(names),\n notAppend: true,\n size: 10\n });\n button.addEventListener('click', onButtonClick(userMenu, select));\n select.addEventListener('dblclick', onDblClick(userMenu));\n select.addEventListener('keydown', onKeyDown({\n keys,\n userMenu\n }));\n const afterShow = () => select.focus();\n const autoSize = true;\n CloudCmd.View.show([button, select], {\n autoSize,\n afterShow\n });\n}\nfunction fillTemplate(options) {\n const result = [];\n for (const option of options) result.push(`<option>${option}</option>`);\n return result.join('');\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst onDblClick = currify__WEBPACK_IMPORTED_MODULE_1__(async (items, e) => {\n const {\n value\n } = e.target;\n await runUserMenu(items[value]);\n});\nconst onButtonClick = wraptile__WEBPACK_IMPORTED_MODULE_2__(async (items, {\n value\n}) => {\n await runUserMenu(items[value]);\n});\nconst onKeyDown = currify__WEBPACK_IMPORTED_MODULE_1__(async ({\n keys,\n userMenu\n}, e) => {\n const {\n keyCode,\n target\n } = e;\n const keyName = e.key.toUpperCase();\n e.preventDefault();\n e.stopPropagation();\n let value;\n if (keyCode === Key.ESC) return hide();\n if (keyCode === Key.ENTER) value = userMenu[target.value];else if (keys[keyName]) value = keys[keyName];else return (0,_navigate_mjs__WEBPACK_IMPORTED_MODULE_12__.navigate)(target, e);\n await runUserMenu(value);\n});\nconst runUserMenu = async fn => {\n hide();\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_7__.tryToCatch)(fn, {\n DOM,\n CloudCmd,\n tryToCatch: try_to_catch__WEBPACK_IMPORTED_MODULE_7__.tryToCatch\n });\n if (!error) return;\n const source = sourceStore();\n return _dom_dialog__WEBPACK_IMPORTED_MODULE_9__.alert(getCodeFrame({\n error,\n source\n }));\n};\nfunction getCodeFrame({\n error,\n source\n}) {\n const {\n code\n } = error;\n if (!code || code === 'frame') return error.message;\n const [line, column] = (0,_parse_error_mjs__WEBPACK_IMPORTED_MODULE_13__.parseError)(error);\n const start = {\n line,\n column\n };\n const location = {\n start\n };\n const frame = (0,_babel_code_frame__WEBPACK_IMPORTED_MODULE_8__.codeFrameColumns)(source, location, {\n message: error.message,\n highlightCode: false\n });\n return `<pre>${frame}</pre>`;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/index.mjs\n}");
678
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_user_menu_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/user-menu.css */ \"./css/user-menu.css\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var try_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _babel_code_frame__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/code-frame */ \"./node_modules/@babel/code-frame/lib/index.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _get_user_menu_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./get-user-menu.js */ \"./client/modules/user-menu/get-user-menu.js\");\n/* harmony import */ var _navigate_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./navigate.js */ \"./client/modules/user-menu/navigate.js\");\n/* harmony import */ var _parse_error_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./parse-error.js */ \"./client/modules/user-menu/parse-error.js\");\n/* harmony import */ var _parse_user_menu_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./parse-user-menu.js */ \"./client/modules/user-menu/parse-user-menu.js\");\n/* harmony import */ var _run_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./run.js */ \"./client/modules/user-menu/run.js\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_4__.css;\nconst sourceStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_3__.fullstore)();\nconst Name = 'UserMenu';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst {\n Key\n} = CloudCmd;\nasync function init() {\n await Promise.all([loadCSS(`${CloudCmd.prefix}/dist/user-menu.css`), CloudCmd.View()]);\n}\nconst {\n CurrentInfo\n} = DOM;\nasync function show() {\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load('top');\n const {\n dirPath\n } = CurrentInfo;\n const res = await fetch(`${CloudCmd.prefix}/api/v1/user-menu?dir=${dirPath}`);\n const source = await res.text();\n const [error, userMenu] = (0,try_catch__WEBPACK_IMPORTED_MODULE_6__.tryCatch)(_get_user_menu_js__WEBPACK_IMPORTED_MODULE_11__.getUserMenu, source);\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.hide();\n if (error) return _dom_dialog__WEBPACK_IMPORTED_MODULE_9__.alert(getCodeFrame({\n error,\n source\n }));\n sourceStore(source);\n const {\n names,\n keys,\n items,\n settings\n } = (0,_parse_user_menu_js__WEBPACK_IMPORTED_MODULE_14__.parseUserMenu)(userMenu);\n if (settings.run) return (0,_run_js__WEBPACK_IMPORTED_MODULE_15__.runSelected)(settings.select, items, runUserMenu);\n const button = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__('button', {\n className: 'cloudcmd-user-menu-button',\n innerText: 'User Menu',\n notAppend: true\n });\n const select = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__('select', {\n className: 'cloudcmd-user-menu',\n innerHTML: fillTemplate(names),\n notAppend: true,\n size: 10\n });\n button.addEventListener('click', onButtonClick(userMenu, select));\n select.addEventListener('dblclick', onDblClick(userMenu));\n select.addEventListener('keydown', onKeyDown({\n keys,\n userMenu\n }));\n const afterShow = () => select.focus();\n const autoSize = true;\n CloudCmd.View.show([button, select], {\n autoSize,\n afterShow\n });\n}\nfunction fillTemplate(options) {\n const result = [];\n for (const option of options) result.push(`<option>${option}</option>`);\n return result.join('');\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst onDblClick = currify__WEBPACK_IMPORTED_MODULE_1__(async (items, e) => {\n const {\n value\n } = e.target;\n await runUserMenu(items[value]);\n});\nconst onButtonClick = wraptile__WEBPACK_IMPORTED_MODULE_2__(async (items, {\n value\n}) => {\n await runUserMenu(items[value]);\n});\nconst onKeyDown = currify__WEBPACK_IMPORTED_MODULE_1__(async ({\n keys,\n userMenu\n}, e) => {\n const {\n keyCode,\n target\n } = e;\n const keyName = e.key.toUpperCase();\n e.preventDefault();\n e.stopPropagation();\n let value;\n if (keyCode === Key.ESC) return hide();\n if (keyCode === Key.ENTER) value = userMenu[target.value];else if (keys[keyName]) value = keys[keyName];else return (0,_navigate_js__WEBPACK_IMPORTED_MODULE_12__.navigate)(target, e);\n await runUserMenu(value);\n});\nconst runUserMenu = async fn => {\n hide();\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_7__.tryToCatch)(fn, {\n DOM,\n CloudCmd,\n tryToCatch: try_to_catch__WEBPACK_IMPORTED_MODULE_7__.tryToCatch\n });\n if (!error) return;\n const source = sourceStore();\n return _dom_dialog__WEBPACK_IMPORTED_MODULE_9__.alert(getCodeFrame({\n error,\n source\n }));\n};\nfunction getCodeFrame({\n error,\n source\n}) {\n const {\n code\n } = error;\n if (!code || code === 'frame') return error.message;\n const [line, column] = (0,_parse_error_js__WEBPACK_IMPORTED_MODULE_13__.parseError)(error);\n const start = {\n line,\n column\n };\n const location = {\n start\n };\n const frame = (0,_babel_code_frame__WEBPACK_IMPORTED_MODULE_8__.codeFrameColumns)(source, location, {\n message: error.message,\n highlightCode: false\n });\n return `<pre>${frame}</pre>`;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/index.js\n}");
679
679
 
680
680
  /***/ },
681
681
 
682
- /***/ "./client/modules/user-menu/navigate.mjs"
683
- /*!***********************************************!*\
684
- !*** ./client/modules/user-menu/navigate.mjs ***!
685
- \***********************************************/
682
+ /***/ "./client/modules/user-menu/navigate.js"
683
+ /*!**********************************************!*\
684
+ !*** ./client/modules/user-menu/navigate.js ***!
685
+ \**********************************************/
686
686
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
687
687
 
688
688
  "use strict";
689
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ navigate: () => (/* binding */ navigate)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _key_key_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../key/key.mjs */ \"./client/key/key.mjs\");\n\n\nconst store = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)(1);\nconst isDigit = a => /^\\d+$/.test(a);\nconst navigate = (el, {\n key,\n keyCode\n}) => {\n if (isDigit(key)) store(Number(key));\n if (keyCode === _key_key_mjs__WEBPACK_IMPORTED_MODULE_1__.DOWN || keyCode === _key_key_mjs__WEBPACK_IMPORTED_MODULE_1__.J) {\n const count = store();\n store(1);\n return down(el, count);\n }\n if (keyCode === _key_key_mjs__WEBPACK_IMPORTED_MODULE_1__.UP || keyCode === _key_key_mjs__WEBPACK_IMPORTED_MODULE_1__.K) {\n const count = store();\n store(1);\n return up(el, count);\n }\n};\nfunction down(el, count) {\n const {\n length\n } = el;\n if (el.selectedIndex === length - 1) el.selectedIndex = 0;else el.selectedIndex += count;\n if (el.selectedIndex < 0) el.selectedIndex = length - 1;\n}\nfunction up(el, count) {\n const {\n length\n } = el;\n if (!el.selectedIndex) el.selectedIndex = length - 1;else el.selectedIndex -= count;\n if (el.selectedIndex < 0) el.selectedIndex = 0;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/navigate.mjs\n}");
689
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ navigate: () => (/* binding */ navigate)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _key_key_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../key/key.js */ \"./client/key/key.js\");\n\n\nconst store = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)(1);\nconst isDigit = a => /^\\d+$/.test(a);\nconst navigate = (el, {\n key,\n keyCode\n}) => {\n if (isDigit(key)) store(Number(key));\n if (keyCode === _key_key_js__WEBPACK_IMPORTED_MODULE_1__.DOWN || keyCode === _key_key_js__WEBPACK_IMPORTED_MODULE_1__.J) {\n const count = store();\n store(1);\n return down(el, count);\n }\n if (keyCode === _key_key_js__WEBPACK_IMPORTED_MODULE_1__.UP || keyCode === _key_key_js__WEBPACK_IMPORTED_MODULE_1__.K) {\n const count = store();\n store(1);\n return up(el, count);\n }\n};\nfunction down(el, count) {\n const {\n length\n } = el;\n if (el.selectedIndex === length - 1) el.selectedIndex = 0;else el.selectedIndex += count;\n if (el.selectedIndex < 0) el.selectedIndex = length - 1;\n}\nfunction up(el, count) {\n const {\n length\n } = el;\n if (!el.selectedIndex) el.selectedIndex = length - 1;else el.selectedIndex -= count;\n if (el.selectedIndex < 0) el.selectedIndex = 0;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/navigate.js\n}");
690
690
 
691
691
  /***/ },
692
692
 
693
- /***/ "./client/modules/user-menu/parse-error.mjs"
694
- /*!**************************************************!*\
695
- !*** ./client/modules/user-menu/parse-error.mjs ***!
696
- \**************************************************/
693
+ /***/ "./client/modules/user-menu/parse-error.js"
694
+ /*!*************************************************!*\
695
+ !*** ./client/modules/user-menu/parse-error.js ***!
696
+ \*************************************************/
697
697
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
698
698
 
699
699
  "use strict";
700
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parseError: () => (/* binding */ parseError)\n/* harmony export */ });\nconst isNumber = a => typeof a === 'number';\nconst parseError = error => {\n const {\n lineNumber,\n columnNumber\n } = error;\n\n // thank you firefox\n if (isNumber(lineNumber) && isNumber(columnNumber)) return [lineNumber, columnNumber];\n const before = error.stack.indexOf('>');\n const str = error.stack.slice(before + 1);\n const after = str.indexOf(')');\n const newStr = str.slice(1, after);\n const [line, column] = newStr.split(':');\n return [Number(line), Number(column)];\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/parse-error.mjs\n}");
700
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parseError: () => (/* binding */ parseError)\n/* harmony export */ });\nconst isNumber = a => typeof a === 'number';\nconst parseError = error => {\n const {\n lineNumber,\n columnNumber\n } = error;\n\n // thank you firefox\n if (isNumber(lineNumber) && isNumber(columnNumber)) return [lineNumber, columnNumber];\n const before = error.stack.indexOf('>');\n const str = error.stack.slice(before + 1);\n const after = str.indexOf(')');\n const newStr = str.slice(1, after);\n const [line, column] = newStr.split(':');\n return [Number(line), Number(column)];\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/parse-error.js\n}");
701
701
 
702
702
  /***/ },
703
703
 
704
- /***/ "./client/modules/user-menu/parse-user-menu.mjs"
705
- /*!******************************************************!*\
706
- !*** ./client/modules/user-menu/parse-user-menu.mjs ***!
707
- \******************************************************/
704
+ /***/ "./client/modules/user-menu/parse-user-menu.js"
705
+ /*!*****************************************************!*\
706
+ !*** ./client/modules/user-menu/parse-user-menu.js ***!
707
+ \*****************************************************/
708
708
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
709
709
 
710
710
  "use strict";
711
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parseUserMenu: () => (/* binding */ parseUserMenu)\n/* harmony export */ });\nconst {\n entries,\n assign\n} = Object;\nconst parseUserMenu = userMenu => {\n const names = [];\n const keys = {};\n const items = {};\n const settings = {};\n for (const [str, fn] of entries(userMenu)) {\n if (str === '__settings') {\n assign(settings, userMenu[str]);\n continue;\n }\n if (str.startsWith('_')) continue;\n names.push(str);\n const [key, name] = str.split(' - ');\n keys[key] = fn;\n items[name] = fn;\n }\n return {\n names,\n keys,\n items,\n settings\n };\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/parse-user-menu.mjs\n}");
711
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parseUserMenu: () => (/* binding */ parseUserMenu)\n/* harmony export */ });\nconst {\n entries,\n assign\n} = Object;\nconst parseUserMenu = userMenu => {\n const names = [];\n const keys = {};\n const items = {};\n const settings = {};\n for (const [str, fn] of entries(userMenu)) {\n if (str === '__settings') {\n assign(settings, userMenu[str]);\n continue;\n }\n if (str.startsWith('_')) continue;\n names.push(str);\n const [key, name] = str.split(' - ');\n keys[key] = fn;\n items[name] = fn;\n }\n return {\n names,\n keys,\n items,\n settings\n };\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/parse-user-menu.js\n}");
712
712
 
713
713
  /***/ },
714
714
 
715
- /***/ "./client/modules/user-menu/run.mjs"
716
- /*!******************************************!*\
717
- !*** ./client/modules/user-menu/run.mjs ***!
718
- \******************************************/
715
+ /***/ "./client/modules/user-menu/run.js"
716
+ /*!*****************************************!*\
717
+ !*** ./client/modules/user-menu/run.js ***!
718
+ \*****************************************/
719
719
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
720
720
 
721
721
  "use strict";
722
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ runSelected: () => (/* binding */ runSelected)\n/* harmony export */ });\nconst runSelected = async (selectedItems, items, runUserMenu) => {\n for (const selected of selectedItems) {\n await runUserMenu(items[selected]);\n }\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/run.mjs\n}");
722
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ runSelected: () => (/* binding */ runSelected)\n/* harmony export */ });\nconst runSelected = async (selectedItems, items, runUserMenu) => {\n for (const selected of selectedItems) {\n await runUserMenu(items[selected]);\n }\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/run.js\n}");
723
723
 
724
724
  /***/ },
725
725
 
726
- /***/ "./client/modules/view/index.mjs"
727
- /*!***************************************!*\
728
- !*** ./client/modules/view/index.mjs ***!
729
- \***************************************/
726
+ /***/ "./client/modules/view/index.js"
727
+ /*!**************************************!*\
728
+ !*** ./client/modules/view/index.js ***!
729
+ \**************************************/
730
730
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
731
731
 
732
732
  "use strict";
733
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _Config: () => (/* binding */ _Config),\n/* harmony export */ _createIframe: () => (/* binding */ _createIframe),\n/* harmony export */ _initConfig: () => (/* binding */ _initConfig),\n/* harmony export */ _viewHtml: () => (/* binding */ _viewHtml),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_view_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #css/view.css */ \"./css/view.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @cloudcmd/modal */ \"./node_modules/@cloudcmd/modal/lib/modal.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n/* harmony import */ var _types_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./types.mjs */ \"./client/modules/view/types.mjs\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst CloudCmd = globalThis.CloudCmd || {};\nconst DOM = globalThis.DOM || {};\nconst isString = a => typeof a === 'string';\nconst {\n assign\n} = Object;\nconst {\n isArray\n} = Array;\nconst lifo = currify__WEBPACK_IMPORTED_MODULE_2__((fn, el, cb, name) => fn(name, el, cb));\nconst series = wraptile__WEBPACK_IMPORTED_MODULE_3__((...a) => {\n for (const f of a) f();\n});\nconst isFn = a => typeof a === 'function';\nconst noop = () => {};\nconst addEvent = lifo(_dom_events__WEBPACK_IMPORTED_MODULE_10__.add);\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_5__.css;\nlet Loading = false;\nconst Name = 'View';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Key\n} = CloudCmd;\nconst basename = a => a.split('/').pop();\nlet El;\nlet TemplateAudio;\nlet Overlay;\nconst Config = {\n beforeShow: () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n Key.unsetBind();\n },\n beforeClose: () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_10__.rmKey(listener);\n Key.setBind();\n },\n afterShow: () => {\n El.focus();\n },\n onOverlayClick,\n afterClose: noop,\n autoSize: false,\n helpers: {\n title: {}\n }\n};\nconst _Config = Config;\nasync function init() {\n await loadAll();\n const events = ['click', 'contextmenu'];\n events.forEach(addEvent(Overlay, onOverlayClick));\n}\nasync function show(data, options = {}) {\n const prefixURL = CloudCmd.prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.FS;\n if (Loading) return;\n if (!options || options.bindKeys !== false) _dom_events__WEBPACK_IMPORTED_MODULE_10__.addKey(listener);\n El = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n className: 'view',\n notAppend: true\n });\n El.tabIndex = 0;\n if (data) {\n if (isArray(data)) El.append(...data);else El.append(data);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, initConfig(options));\n return;\n }\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load();\n const path = prefixURL + Info.path;\n const type = options.raw ? '' : await (0,_types_mjs__WEBPACK_IMPORTED_MODULE_14__.getType)(path);\n switch (type) {\n default:\n return await viewFile();\n case 'markdown':\n return await CloudCmd.Markdown.show(Info.path);\n case 'html':\n return viewHtml(path);\n case 'image':\n return viewImage(Info.path, prefixURL);\n case 'media':\n return await viewMedia(path);\n case 'pdf':\n return viewPDF(path);\n }\n}\nconst _createIframe = createIframe;\nfunction createIframe(src, overrides = {}) {\n const {\n createElement = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__\n } = overrides;\n const element = createElement('iframe', {\n src,\n width: '100%',\n height: '100%'\n });\n element.addEventListener('load', () => {\n element.contentWindow.addEventListener('keydown', listener);\n });\n return element;\n}\nconst _viewHtml = viewHtml;\nfunction viewHtml(src, overrides = {}) {\n const {\n modal = _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__\n } = overrides;\n modal.open(createIframe(src), Config);\n}\nfunction viewPDF(src) {\n const element = createIframe(src);\n const options = assign({}, Config);\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, options);\n}\nasync function viewMedia(path) {\n const [e, element] = await getMediaElement(path);\n if (e) return alert(e);\n const allConfig = {\n ...Config,\n ...{\n autoSize: true,\n afterShow: () => {\n element.querySelector('audio, video').focus();\n }\n }\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, allConfig);\n}\nasync function viewFile() {\n const [error, data] = await Info.getData();\n if (error) return _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n const element = document.createTextNode(data);\n const options = Config;\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n El.append(element);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, options);\n}\nconst copy = a => assign({}, a);\nconst _initConfig = initConfig;\nfunction initConfig(options) {\n const config = copy(Config);\n if (!options) return config;\n const names = Object.keys(options);\n for (const name of names) {\n const isConfig = Boolean(config[name]);\n const item = options[name];\n if (!isFn(item) || !isConfig) {\n config[name] = options[name];\n continue;\n }\n const fn = config[name];\n config[name] = series(fn, item);\n }\n return config;\n}\nfunction hide() {\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.close();\n}\nfunction viewImage(path, prefixURL) {\n const isSupportedImage = a => (0,_types_mjs__WEBPACK_IMPORTED_MODULE_14__.isImage)(a) || a === path;\n const makeTitle = path => ({\n href: `${prefixURL}${path}`,\n title: (0,_common_entity__WEBPACK_IMPORTED_MODULE_13__.encode)(basename(path))\n });\n const names = Info.files.map(DOM.getCurrentPath).filter(isSupportedImage);\n const titles = names.map(makeTitle);\n const index = names.indexOf(Info.path);\n const imageConfig = {\n index,\n autoSize: true,\n arrows: true,\n keys: true,\n helpers: {\n title: {}\n }\n };\n const config = {\n ...Config,\n ...imageConfig\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(titles, config);\n}\nasync function getMediaElement(src) {\n check(src);\n const [error, template] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_9__.get, 'view/media-tmpl');\n if (error) return [error];\n const {\n name\n } = Info;\n if (!TemplateAudio) TemplateAudio = template;\n const is = (0,_types_mjs__WEBPACK_IMPORTED_MODULE_14__.isAudio)(name);\n const type = is ? 'audio' : 'video';\n const innerHTML = rendy__WEBPACK_IMPORTED_MODULE_1__(TemplateAudio, {\n src,\n type,\n name\n });\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n innerHTML\n });\n return [null, element];\n}\nfunction check(src) {\n if (!isString(src)) throw Error('src should be a string!');\n}\nasync function loadAll() {\n const {\n DIR_DIST\n } = CloudCmd;\n (0,_common_util__WEBPACK_IMPORTED_MODULE_8__.time)(`${Name} load`);\n Loading = true;\n await loadCSS(`${DIR_DIST}/view.css`);\n Loading = false;\n}\nfunction onOverlayClick(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n setCurrentByPosition(position);\n}\nfunction setCurrentByPosition(position) {\n const element = DOM.getCurrentByPosition(position);\n if (!element) return;\n const {\n files,\n filesPassive\n } = Info;\n const isFiles = files.includes(element);\n const isFilesPassive = filesPassive.includes(element);\n if (!isFiles && !isFilesPassive) return;\n const isCurrent = DOM.isCurrentFile(element);\n if (isCurrent) return;\n DOM.setCurrentFile(element);\n}\nfunction listener({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/index.mjs\n}");
733
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _Config: () => (/* binding */ _Config),\n/* harmony export */ _createIframe: () => (/* binding */ _createIframe),\n/* harmony export */ _initConfig: () => (/* binding */ _initConfig),\n/* harmony export */ _viewHtml: () => (/* binding */ _viewHtml),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_view_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #css/view.css */ \"./css/view.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @cloudcmd/modal */ \"./node_modules/@cloudcmd/modal/lib/modal.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./types.js */ \"./client/modules/view/types.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst CloudCmd = globalThis.CloudCmd || {};\nconst DOM = globalThis.DOM || {};\nconst isString = a => typeof a === 'string';\nconst {\n assign\n} = Object;\nconst {\n isArray\n} = Array;\nconst lifo = currify__WEBPACK_IMPORTED_MODULE_2__((fn, el, cb, name) => fn(name, el, cb));\nconst series = wraptile__WEBPACK_IMPORTED_MODULE_3__((...a) => {\n for (const f of a) f();\n});\nconst isFn = a => typeof a === 'function';\nconst noop = () => {};\nconst addEvent = lifo(_dom_events__WEBPACK_IMPORTED_MODULE_10__.add);\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_5__.css;\nlet Loading = false;\nconst Name = 'View';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Key\n} = CloudCmd;\nconst basename = a => a.split('/').pop();\nlet El;\nlet TemplateAudio;\nlet Overlay;\nconst Config = {\n beforeShow: () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n Key.unsetBind();\n },\n beforeClose: () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_10__.rmKey(listener);\n Key.setBind();\n },\n afterShow: () => {\n El.focus();\n },\n onOverlayClick,\n afterClose: noop,\n autoSize: false,\n helpers: {\n title: {}\n }\n};\nconst _Config = Config;\nasync function init() {\n await loadAll();\n const events = ['click', 'contextmenu'];\n events.forEach(addEvent(Overlay, onOverlayClick));\n}\nasync function show(data, options = {}) {\n const prefixURL = CloudCmd.prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.FS;\n if (Loading) return;\n if (!options || options.bindKeys !== false) _dom_events__WEBPACK_IMPORTED_MODULE_10__.addKey(listener);\n El = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n className: 'view',\n notAppend: true\n });\n El.tabIndex = 0;\n if (data) {\n if (isArray(data)) El.append(...data);else El.append(data);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, initConfig(options));\n return;\n }\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load();\n const path = prefixURL + Info.path;\n const type = options.raw ? '' : await (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.getType)(path);\n switch (type) {\n default:\n return await viewFile();\n case 'markdown':\n return await CloudCmd.Markdown.show(Info.path);\n case 'html':\n return viewHtml(path);\n case 'image':\n return viewImage(Info.path, prefixURL);\n case 'media':\n return await viewMedia(path);\n case 'pdf':\n return viewPDF(path);\n }\n}\nconst _createIframe = createIframe;\nfunction createIframe(src, overrides = {}) {\n const {\n createElement = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__\n } = overrides;\n const element = createElement('iframe', {\n src,\n width: '100%',\n height: '100%'\n });\n element.addEventListener('load', () => {\n element.contentWindow.addEventListener('keydown', listener);\n });\n return element;\n}\nconst _viewHtml = viewHtml;\nfunction viewHtml(src, overrides = {}) {\n const {\n modal = _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__\n } = overrides;\n modal.open(createIframe(src), Config);\n}\nfunction viewPDF(src) {\n const element = createIframe(src);\n const options = assign({}, Config);\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, options);\n}\nasync function viewMedia(path) {\n const [e, element] = await getMediaElement(path);\n if (e) return alert(e);\n const allConfig = {\n ...Config,\n ...{\n autoSize: true,\n afterShow: () => {\n element.querySelector('audio, video').focus();\n }\n }\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, allConfig);\n}\nasync function viewFile() {\n const [error, data] = await Info.getData();\n if (error) return _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n const element = document.createTextNode(data);\n const options = Config;\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n El.append(element);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, options);\n}\nconst copy = a => assign({}, a);\nconst _initConfig = initConfig;\nfunction initConfig(options) {\n const config = copy(Config);\n if (!options) return config;\n const names = Object.keys(options);\n for (const name of names) {\n const isConfig = Boolean(config[name]);\n const item = options[name];\n if (!isFn(item) || !isConfig) {\n config[name] = options[name];\n continue;\n }\n const fn = config[name];\n config[name] = series(fn, item);\n }\n return config;\n}\nfunction hide() {\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.close();\n}\nfunction viewImage(path, prefixURL) {\n const isSupportedImage = a => (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.isImage)(a) || a === path;\n const makeTitle = path => ({\n href: `${prefixURL}${path}`,\n title: (0,_common_entity__WEBPACK_IMPORTED_MODULE_13__.encode)(basename(path))\n });\n const names = Info.files.map(DOM.getCurrentPath).filter(isSupportedImage);\n const titles = names.map(makeTitle);\n const index = names.indexOf(Info.path);\n const imageConfig = {\n index,\n autoSize: true,\n arrows: true,\n keys: true,\n helpers: {\n title: {}\n }\n };\n const config = {\n ...Config,\n ...imageConfig\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(titles, config);\n}\nasync function getMediaElement(src) {\n check(src);\n const [error, template] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_9__.get, 'view/media-tmpl');\n if (error) return [error];\n const {\n name\n } = Info;\n if (!TemplateAudio) TemplateAudio = template;\n const is = (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.isAudio)(name);\n const type = is ? 'audio' : 'video';\n const innerHTML = rendy__WEBPACK_IMPORTED_MODULE_1__(TemplateAudio, {\n src,\n type,\n name\n });\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n innerHTML\n });\n return [null, element];\n}\nfunction check(src) {\n if (!isString(src)) throw Error('src should be a string!');\n}\nasync function loadAll() {\n const {\n DIR_DIST\n } = CloudCmd;\n (0,_common_util__WEBPACK_IMPORTED_MODULE_8__.time)(`${Name} load`);\n Loading = true;\n await loadCSS(`${DIR_DIST}/view.css`);\n Loading = false;\n}\nfunction onOverlayClick(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n setCurrentByPosition(position);\n}\nfunction setCurrentByPosition(position) {\n const element = DOM.getCurrentByPosition(position);\n if (!element) return;\n const {\n files,\n filesPassive\n } = Info;\n const isFiles = files.includes(element);\n const isFilesPassive = filesPassive.includes(element);\n if (!isFiles && !isFilesPassive) return;\n const isCurrent = DOM.isCurrentFile(element);\n if (isCurrent) return;\n DOM.setCurrentFile(element);\n}\nfunction listener({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/index.js\n}");
734
734
 
735
735
  /***/ },
736
736
 
737
- /***/ "./client/modules/view/types.mjs"
738
- /*!***************************************!*\
739
- !*** ./client/modules/view/types.mjs ***!
740
- \***************************************/
737
+ /***/ "./client/modules/view/types.js"
738
+ /*!**************************************!*\
739
+ !*** ./client/modules/view/types.js ***!
740
+ \**************************************/
741
741
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
742
742
 
743
743
  "use strict";
744
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _detectType: () => (/* binding */ _detectType),\n/* harmony export */ getType: () => (/* binding */ getType),\n/* harmony export */ isAudio: () => (/* binding */ isAudio),\n/* harmony export */ isImage: () => (/* binding */ isImage)\n/* harmony export */ });\n/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:path */ \"./node_modules/path-browserify/index.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\nconst isAudio = name => /\\.(mp3|ogg|m4a)$/i.test(name);\nconst testRegExp = currify__WEBPACK_IMPORTED_MODULE_1__((name, reg) => reg.test(name));\nconst getRegExp = ext => RegExp(`\\\\.${ext}$`, 'i');\nconst isPDF = a => /\\.pdf$/i.test(a);\nconst isHTML = a => a.endsWith('.html');\nconst isMarkdown = a => /.\\.md$/.test(a);\nconst getType = async path => {\n const ext = (0,node_path__WEBPACK_IMPORTED_MODULE_0__.extname)(path);\n if (!ext) path = await detectType(path);\n if (isPDF(path)) return 'pdf';\n if (isImage(path)) return 'image';\n if (isMedia(path)) return 'media';\n if (isHTML(path)) return 'html';\n if (isMarkdown(path)) return 'markdown';\n};\nfunction isImage(name) {\n const images = ['jp(e|g|eg)', 'gif', 'png', 'bmp', 'webp', 'svg', 'ico'];\n return images.map(getRegExp).some(testRegExp(name));\n}\nfunction isMedia(name) {\n return isAudio(name) || isVideo(name);\n}\nfunction isVideo(name) {\n return /\\.(mp4|avi|webm)$/i.test(name);\n}\nconst _detectType = detectType;\nasync function detectType(path) {\n const {\n headers\n } = await fetch(path, {\n method: 'HEAD'\n });\n for (const [name, value] of headers) {\n if (name === 'content-type') return `.${value.split('/').pop()}`;\n }\n return '';\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/types.mjs\n}");
744
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _detectType: () => (/* binding */ _detectType),\n/* harmony export */ getType: () => (/* binding */ getType),\n/* harmony export */ isAudio: () => (/* binding */ isAudio),\n/* harmony export */ isImage: () => (/* binding */ isImage)\n/* harmony export */ });\n/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:path */ \"./node_modules/path-browserify/index.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\nconst isAudio = name => /\\.(mp3|ogg|m4a)$/i.test(name);\nconst testRegExp = currify__WEBPACK_IMPORTED_MODULE_1__((name, reg) => reg.test(name));\nconst getRegExp = ext => RegExp(`\\\\.${ext}$`, 'i');\nconst isPDF = a => /\\.pdf$/i.test(a);\nconst isHTML = a => a.endsWith('.html');\nconst isMarkdown = a => /.\\.md$/.test(a);\nconst getType = async path => {\n const ext = (0,node_path__WEBPACK_IMPORTED_MODULE_0__.extname)(path);\n if (!ext) path = await detectType(path);\n if (isPDF(path)) return 'pdf';\n if (isImage(path)) return 'image';\n if (isMedia(path)) return 'media';\n if (isHTML(path)) return 'html';\n if (isMarkdown(path)) return 'markdown';\n};\nfunction isImage(name) {\n const images = ['jp(e|g|eg)', 'gif', 'png', 'bmp', 'webp', 'svg', 'ico'];\n return images.map(getRegExp).some(testRegExp(name));\n}\nfunction isMedia(name) {\n return isAudio(name) || isVideo(name);\n}\nfunction isVideo(name) {\n return /\\.(mp4|avi|webm)$/i.test(name);\n}\nconst _detectType = detectType;\nasync function detectType(path) {\n const {\n headers\n } = await fetch(path, {\n method: 'HEAD'\n });\n for (const [name, value] of headers) {\n if (name === 'content-type') return `.${value.split('/').pop()}`;\n }\n return '';\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/types.js\n}");
745
745
 
746
746
  /***/ },
747
747
 
748
- /***/ "./client/sort.mjs"
749
- /*!*************************!*\
750
- !*** ./client/sort.mjs ***!
751
- \*************************/
748
+ /***/ "./client/sort.js"
749
+ /*!************************!*\
750
+ !*** ./client/sort.js ***!
751
+ \************************/
752
752
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
753
753
 
754
754
  "use strict";
755
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ initSortPanel: () => (/* binding */ initSortPanel),\n/* harmony export */ sortPanel: () => (/* binding */ sortPanel)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _dom_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom/index.mjs */ \"./client/dom/index.mjs\");\n/* global CloudCmd */\n\n\nconst sortPrevious = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)();\nconst {\n getPanel\n} = _dom_index_mjs__WEBPACK_IMPORTED_MODULE_1__[\"default\"];\nconst initSortPanel = () => {\n const {\n sort\n } = CloudCmd;\n const position = _dom_index_mjs__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getPanelPosition();\n sortPrevious(sort[position]);\n};\nconst sortPanel = (name, panel = getPanel()) => {\n const {\n sort,\n order\n } = CloudCmd;\n const Info = _dom_index_mjs__WEBPACK_IMPORTED_MODULE_1__[\"default\"].CurrentInfo;\n const position = panel.dataset.name.replace('js-', '');\n if (name !== sortPrevious()) order[position] = 'asc';else if (order[position] === 'asc') order[position] = 'desc';else order[position] = 'asc';\n sortPrevious(name);\n sort[position] = name;\n const noCurrent = position !== Info.panelPosition;\n CloudCmd.refresh({\n panel,\n noCurrent\n });\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/sort.mjs\n}");
755
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ initSortPanel: () => (/* binding */ initSortPanel),\n/* harmony export */ sortPanel: () => (/* binding */ sortPanel)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom */ \"./client/dom/index.js\");\n/* global CloudCmd */\n\n\nconst sortPrevious = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)();\nconst {\n getPanel\n} = _dom__WEBPACK_IMPORTED_MODULE_1__[\"default\"];\nconst initSortPanel = () => {\n const {\n sort\n } = CloudCmd;\n const position = _dom__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getPanelPosition();\n sortPrevious(sort[position]);\n};\nconst sortPanel = (name, panel = getPanel()) => {\n const {\n sort,\n order\n } = CloudCmd;\n const Info = _dom__WEBPACK_IMPORTED_MODULE_1__[\"default\"].CurrentInfo;\n const position = panel.dataset.name.replace('js-', '');\n if (name !== sortPrevious()) order[position] = 'asc';else if (order[position] === 'asc') order[position] = 'desc';else order[position] = 'asc';\n sortPrevious(name);\n sort[position] = name;\n const noCurrent = position !== Info.panelPosition;\n CloudCmd.refresh({\n panel,\n noCurrent\n });\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/sort.js\n}");
756
756
 
757
757
  /***/ },
758
758
 
759
- /***/ "./client/sw/register.mjs"
760
- /*!********************************!*\
761
- !*** ./client/sw/register.mjs ***!
762
- \********************************/
759
+ /***/ "./client/sw/register.js"
760
+ /*!*******************************!*\
761
+ !*** ./client/sw/register.js ***!
762
+ \*******************************/
763
763
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
764
764
 
765
765
  "use strict";
766
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ listenSW: () => (/* binding */ listenSW),\n/* harmony export */ registerSW: () => (/* binding */ registerSW),\n/* harmony export */ unregisterSW: () => (/* binding */ unregisterSW)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst listenSW = (sw, ...args) => {\n sw === null || sw === void 0 || sw.addEventListener(...args);\n};\nasync function registerSW(prefix) {\n if (!navigator.serviceWorker) return;\n const isHTTPS = location.protocol === 'https:';\n const isLocalhost = location.hostname === 'localhost';\n if (!isHTTPS && !isLocalhost) return;\n const {\n serviceWorker\n } = navigator;\n const register = serviceWorker.register.bind(serviceWorker);\n const [e, sw] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(register, `${prefix}/sw.mjs`);\n if (e) return null;\n return sw;\n}\nasync function unregisterSW(prefix) {\n const reg = await registerSW(prefix);\n reg === null || reg === void 0 || reg.unregister(prefix);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/sw/register.mjs\n}");
766
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ listenSW: () => (/* binding */ listenSW),\n/* harmony export */ registerSW: () => (/* binding */ registerSW),\n/* harmony export */ unregisterSW: () => (/* binding */ unregisterSW)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst listenSW = (sw, ...args) => {\n sw === null || sw === void 0 || sw.addEventListener(...args);\n};\nasync function registerSW(prefix) {\n if (!navigator.serviceWorker) return;\n const isHTTPS = location.protocol === 'https:';\n const isLocalhost = location.hostname === 'localhost';\n if (!isHTTPS && !isLocalhost) return;\n const {\n serviceWorker\n } = navigator;\n const register = serviceWorker.register.bind(serviceWorker);\n const [e, sw] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(register, `${prefix}/sw.js`);\n if (e) return null;\n return sw;\n}\nasync function unregisterSW(prefix) {\n const reg = await registerSW(prefix);\n reg === null || reg === void 0 || reg.unregister(prefix);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/sw/register.js\n}");
767
767
 
768
768
  /***/ },
769
769
 
770
- /***/ "./common/cloudfunc.mjs"
771
- /*!******************************!*\
772
- !*** ./common/cloudfunc.mjs ***!
773
- \******************************/
770
+ /***/ "./common/cloudfunc.js"
771
+ /*!*****************************!*\
772
+ !*** ./common/cloudfunc.js ***!
773
+ \*****************************/
774
774
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
775
775
 
776
776
  "use strict";
777
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FS: () => (/* binding */ FS),\n/* harmony export */ MAX_FILE_SIZE: () => (/* binding */ MAX_FILE_SIZE),\n/* harmony export */ _getDataName: () => (/* binding */ _getDataName),\n/* harmony export */ _getSize: () => (/* binding */ _getSize),\n/* harmony export */ apiURL: () => (/* binding */ apiURL),\n/* harmony export */ buildFromJSON: () => (/* binding */ buildFromJSON),\n/* harmony export */ formatMsg: () => (/* binding */ formatMsg),\n/* harmony export */ getDotDot: () => (/* binding */ getDotDot),\n/* harmony export */ getHeaderField: () => (/* binding */ getHeaderField),\n/* harmony export */ getPathLink: () => (/* binding */ getPathLink),\n/* harmony export */ getTitle: () => (/* binding */ getTitle)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n\n\n\n\nconst getHeaderField = currify__WEBPACK_IMPORTED_MODULE_1__(_getHeaderField);\n\n/* КОНСТАНТЫ (общие для клиента и сервера)*/\n/* название программы */\nconst NAME = 'Cloud Commander';\nconst FS = '/fs';\nconst Path = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\nPath('/');\nconst filterOutDotFiles = ({\n showDotFiles\n}) => ({\n name\n}) => {\n if (showDotFiles) return true;\n return !name.startsWith('.');\n};\nconst apiURL = '/api/v1';\nconst MAX_FILE_SIZE = 500 * 1024;\nconst formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n if (name) name = `(\"${name}\")`;\n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nconst getTitle = options => {\n options = options || {};\n const {\n path = Path(),\n name\n } = options;\n const array = [name || NAME, path];\n return array.filter(Boolean).join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url) throw Error('url could not be empty!');\n if (!template) throw Error('template could not be empty!');\n const names = url.split('/').slice(1, -1);\n const allNames = ['/', ...names];\n const lines = [];\n const n = allNames.length;\n let path = '/';\n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n if (i) path += `${name}/`;\n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n const slash = i ? '/' : '';\n lines.push(rendy__WEBPACK_IMPORTED_MODULE_0__(template, {\n path,\n name,\n slash,\n prefix\n }));\n }\n return lines.join('');\n}\nfunction _getDataName(name) {\n const encoded = btoa(encodeURI(name));\n return `data-name=\"js-file-${encoded}\" `;\n}\n\n/**\n * Функция строит таблицу файлв из JSON-информации о файлах\n * @param params - информация о файлах\n *\n */\nconst buildFromJSON = params => {\n const {\n prefix,\n template,\n sort = 'name',\n order = 'asc',\n showDotFiles\n } = params;\n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n const path = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(json.path);\n const {\n files\n } = json;\n\n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n let fileTable = rendy__WEBPACK_IMPORTED_MODULE_0__(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath\n });\n const owner = 'owner';\n const mode = 'mode';\n const getFieldName = getHeaderField(sort, order);\n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n const header = rendy__WEBPACK_IMPORTED_MODULE_0__(templateFile, {\n tag: 'div',\n attribute: 'data-name=\"js-fm-header\" ',\n className: 'fm-header',\n type: '',\n name,\n size,\n date,\n owner,\n mode\n });\n\n /* сохраняем путь */\n Path(path);\n fileTable += `${header}<ul data-name=\"js-files\" class=\"files\">`;\n\n /* Если мы не в корне */\n if (path !== '/') {\n const dotDot = getDotDot(path);\n const link = prefix + FS + dotDot;\n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(template.link, {\n link,\n title: '..',\n name: '..'\n });\n const dataName = _getDataName('..');\n const attribute = `draggable=\"true\" ${dataName}`;\n\n /* Сохраняем путь к каталогу верхнего уровня*/\n fileTable += rendy__WEBPACK_IMPORTED_MODULE_0__(template.file, {\n tag: 'li',\n attribute,\n className: '',\n type: 'directory',\n name: linkResult,\n size: '&lt;dir&gt;',\n date: '--.--.----',\n owner: '.',\n mode: '--- --- ---'\n });\n }\n fileTable += files.filter(filterOutDotFiles({\n showDotFiles\n })).map(updateField).map(file => {\n const name = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(file.name);\n const link = prefix + FS + path + name;\n const {\n type,\n mode,\n date,\n owner,\n size\n } = file;\n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(templateLink, {\n link,\n title: name,\n name,\n attribute: getAttribute(file.type)\n });\n const dataName = _getDataName(file.name);\n const attribute = `draggable=\"true\" ${dataName}`;\n return rendy__WEBPACK_IMPORTED_MODULE_0__(templateFile, {\n tag: 'li',\n attribute,\n className: '',\n type,\n name: linkResult,\n size,\n date,\n owner,\n mode\n });\n }).join('');\n fileTable += '</ul>';\n return fileTable;\n};\nconst updateField = file => ({\n ...file,\n date: file.date || '--.--.----',\n owner: file.owner || 'root',\n size: getSize(file)\n});\nfunction getAttribute(type) {\n if (type === 'directory') return '';\n return 'target=\"_blank\" ';\n}\nconst _getSize = getSize;\nfunction getSize({\n size,\n type\n}) {\n if (type === 'directory') return '&lt;dir&gt;';\n if (/link/.test(type)) return '&lt;link&gt;';\n return size;\n}\nfunction _getHeaderField(sort, order, name) {\n const arrow = order === 'asc' ? '↑' : '↓';\n if (sort !== name) return name;\n if (sort === 'name' && order === 'asc') return name;\n return `${name}${arrow}`;\n}\nfunction getDotDot(path) {\n // убираем последний слеш и каталог в котором мы сейчас находимся\n const lastSlash = path.substr(path, path.lastIndexOf('/'));\n const dotDot = lastSlash.substr(lastSlash, lastSlash.lastIndexOf('/'));\n if (!dotDot) return '/';\n return dotDot;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/cloudfunc.mjs\n}");
777
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FS: () => (/* binding */ FS),\n/* harmony export */ MAX_FILE_SIZE: () => (/* binding */ MAX_FILE_SIZE),\n/* harmony export */ _getDataName: () => (/* binding */ _getDataName),\n/* harmony export */ _getSize: () => (/* binding */ _getSize),\n/* harmony export */ apiURL: () => (/* binding */ apiURL),\n/* harmony export */ buildFromJSON: () => (/* binding */ buildFromJSON),\n/* harmony export */ formatMsg: () => (/* binding */ formatMsg),\n/* harmony export */ getDotDot: () => (/* binding */ getDotDot),\n/* harmony export */ getHeaderField: () => (/* binding */ getHeaderField),\n/* harmony export */ getPathLink: () => (/* binding */ getPathLink),\n/* harmony export */ getTitle: () => (/* binding */ getTitle)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n\n\n\n\nconst getHeaderField = currify__WEBPACK_IMPORTED_MODULE_1__(_getHeaderField);\n\n/* КОНСТАНТЫ (общие для клиента и сервера)*/\n/* название программы */\nconst NAME = 'Cloud Commander';\nconst FS = '/fs';\nconst Path = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\nPath('/');\nconst filterOutDotFiles = ({\n showDotFiles\n}) => ({\n name\n}) => {\n if (showDotFiles) return true;\n return !name.startsWith('.');\n};\nconst apiURL = '/api/v1';\nconst MAX_FILE_SIZE = 500 * 1024;\nconst formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n if (name) name = `(\"${name}\")`;\n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nconst getTitle = options => {\n options = options || {};\n const {\n path = Path(),\n name\n } = options;\n const array = [name || NAME, path];\n return array.filter(Boolean).join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url) throw Error('url could not be empty!');\n if (!template) throw Error('template could not be empty!');\n const names = url.split('/').slice(1, -1);\n const allNames = ['/', ...names];\n const lines = [];\n const n = allNames.length;\n let path = '/';\n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n if (i) path += `${name}/`;\n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n const slash = i ? '/' : '';\n lines.push(rendy__WEBPACK_IMPORTED_MODULE_0__(template, {\n path,\n name,\n slash,\n prefix\n }));\n }\n return lines.join('');\n}\nfunction _getDataName(name) {\n const encoded = btoa(encodeURI(name));\n return `data-name=\"js-file-${encoded}\" `;\n}\n\n/**\n * Функция строит таблицу файлв из JSON-информации о файлах\n * @param params - информация о файлах\n *\n */\nconst buildFromJSON = params => {\n const {\n prefix,\n template,\n sort = 'name',\n order = 'asc',\n showDotFiles\n } = params;\n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n const path = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(json.path);\n const {\n files\n } = json;\n\n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n let fileTable = rendy__WEBPACK_IMPORTED_MODULE_0__(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath\n });\n const owner = 'owner';\n const mode = 'mode';\n const getFieldName = getHeaderField(sort, order);\n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n const header = rendy__WEBPACK_IMPORTED_MODULE_0__(templateFile, {\n tag: 'div',\n attribute: 'data-name=\"js-fm-header\" ',\n className: 'fm-header',\n type: '',\n name,\n size,\n date,\n owner,\n mode\n });\n\n /* сохраняем путь */\n Path(path);\n fileTable += `${header}<ul data-name=\"js-files\" class=\"files\">`;\n\n /* Если мы не в корне */\n if (path !== '/') {\n const dotDot = getDotDot(path);\n const link = prefix + FS + dotDot;\n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(template.link, {\n link,\n title: '..',\n name: '..'\n });\n const dataName = _getDataName('..');\n const attribute = `draggable=\"true\" ${dataName}`;\n\n /* Сохраняем путь к каталогу верхнего уровня*/\n fileTable += rendy__WEBPACK_IMPORTED_MODULE_0__(template.file, {\n tag: 'li',\n attribute,\n className: '',\n type: 'directory',\n name: linkResult,\n size: '&lt;dir&gt;',\n date: '--.--.----',\n owner: '.',\n mode: '--- --- ---'\n });\n }\n fileTable += files.filter(filterOutDotFiles({\n showDotFiles\n })).map(updateField).map(file => {\n const name = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(file.name);\n const link = prefix + FS + path + name;\n const {\n type,\n mode,\n date,\n owner,\n size\n } = file;\n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(templateLink, {\n link,\n title: name,\n name,\n attribute: getAttribute(file.type)\n });\n const dataName = _getDataName(file.name);\n const attribute = `draggable=\"true\" ${dataName}`;\n return rendy__WEBPACK_IMPORTED_MODULE_0__(templateFile, {\n tag: 'li',\n attribute,\n className: '',\n type,\n name: linkResult,\n size,\n date,\n owner,\n mode\n });\n }).join('');\n fileTable += '</ul>';\n return fileTable;\n};\nconst updateField = file => ({\n ...file,\n date: file.date || '--.--.----',\n owner: file.owner || 'root',\n size: getSize(file)\n});\nfunction getAttribute(type) {\n if (type === 'directory') return '';\n return 'target=\"_blank\" ';\n}\nconst _getSize = getSize;\nfunction getSize({\n size,\n type\n}) {\n if (type === 'directory') return '&lt;dir&gt;';\n if (/link/.test(type)) return '&lt;link&gt;';\n return size;\n}\nfunction _getHeaderField(sort, order, name) {\n const arrow = order === 'asc' ? '↑' : '↓';\n if (sort !== name) return name;\n if (sort === 'name' && order === 'asc') return name;\n return `${name}${arrow}`;\n}\nfunction getDotDot(path) {\n // убираем последний слеш и каталог в котором мы сейчас находимся\n const lastSlash = path.substr(path, path.lastIndexOf('/'));\n const dotDot = lastSlash.substr(lastSlash, lastSlash.lastIndexOf('/'));\n if (!dotDot) return '/';\n return dotDot;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/cloudfunc.js\n}");
778
778
 
779
779
  /***/ },
780
780
 
781
- /***/ "./common/entity.mjs"
782
- /*!***************************!*\
783
- !*** ./common/entity.mjs ***!
784
- \***************************/
781
+ /***/ "./common/entity.js"
782
+ /*!**************************!*\
783
+ !*** ./common/entity.js ***!
784
+ \**************************/
785
785
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
786
786
 
787
787
  "use strict";
788
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\nconst Entities = {\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"'\n};\nconst keys = Object.keys(Entities);\nconst encode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(char, 'g');\n str = str.replace(reg, code);\n }\n return str;\n};\nconst decode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(code, 'g');\n str = str.replace(reg, char);\n }\n return str;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/entity.mjs\n}");
788
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\nconst Entities = {\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"'\n};\nconst keys = Object.keys(Entities);\nconst encode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(char, 'g');\n str = str.replace(reg, code);\n }\n return str;\n};\nconst decode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(code, 'g');\n str = str.replace(reg, char);\n }\n return str;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/entity.js\n}");
789
789
 
790
790
  /***/ },
791
791
 
@@ -793,21 +793,21 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
793
793
  /*!**************************************!*\
794
794
  !*** ./common/try-to-promise-all.js ***!
795
795
  \**************************************/
796
- (module, __unused_webpack_exports, __webpack_require__) {
796
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
797
797
 
798
798
  "use strict";
799
- eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst all = Promise.all.bind(Promise);\nmodule.exports = async a => {\n const [e, result = []] = await tryToCatch(all, a);\n return [e, ...result];\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/try-to-promise-all.js\n}");
799
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst all = Promise.all.bind(Promise);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (async a => {\n const [e, result = []] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(all, a);\n return [e, ...result];\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/try-to-promise-all.js\n}");
800
800
 
801
801
  /***/ },
802
802
 
803
- /***/ "./common/util.mjs"
804
- /*!*************************!*\
805
- !*** ./common/util.mjs ***!
806
- \*************************/
803
+ /***/ "./common/util.js"
804
+ /*!************************!*\
805
+ !*** ./common/util.js ***!
806
+ \************************/
807
807
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
808
808
 
809
809
  "use strict";
810
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ escapeRegExp: () => (/* binding */ escapeRegExp),\n/* harmony export */ findObjByNameInArr: () => (/* binding */ findObjByNameInArr),\n/* harmony export */ getExt: () => (/* binding */ getExt),\n/* harmony export */ getRegExp: () => (/* binding */ getRegExp),\n/* harmony export */ time: () => (/* binding */ time),\n/* harmony export */ timeEnd: () => (/* binding */ timeEnd)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n\nconst isString = a => typeof a === 'string';\nconst escapeRegExp = str => {\n const isStr = isString(str);\n if (isStr) str = str.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&');\n return str;\n};\n\n/**\n * get regexp from wild card\n */\nconst getRegExp = wildcard => {\n const escaped = `^${wildcard // search from start of line\n .replace(/\\./g, '\\\\.').replace(/\\*/g, '.*').replace('?', '.?')}$`;\n\n // search to end of line\n return RegExp(escaped);\n};\n\n/**\n * function gets file extension\n *\n * @param name\n * @return ext\n */\nconst getExt = name => {\n const isStr = isString(name);\n if (!isStr) return '';\n const dot = name.lastIndexOf('.');\n if (~dot) return name.substr(dot);\n return '';\n};\n\n/**\n * find object by name in arrray\n *\n * @param array\n * @param name\n */\nconst findObjByNameInArr = (array, name) => {\n let ret;\n if (!Array.isArray(array)) throw Error('array should be array!');\n if (!isString(name)) throw Error('name should be string!');\n array.some(item => {\n const is = item.name === name;\n const isArray = Array.isArray(item);\n if (is) {\n ret = item;\n return is;\n }\n if (!isArray) return is;\n return item.some(item => {\n const is = item.name === name;\n if (is) ret = item.data;\n return is;\n });\n });\n return ret;\n};\n\n/**\n * start timer\n * @param name\n */\nconst time = name => {\n execon__WEBPACK_IMPORTED_MODULE_0__.ifExist(console, 'time', [name]);\n};\n\n/**\n * stop timer\n * @param name\n */\nconst timeEnd = name => {\n execon__WEBPACK_IMPORTED_MODULE_0__.ifExist(console, 'timeEnd', [name]);\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/util.mjs\n}");
810
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ escapeRegExp: () => (/* binding */ escapeRegExp),\n/* harmony export */ findObjByNameInArr: () => (/* binding */ findObjByNameInArr),\n/* harmony export */ getExt: () => (/* binding */ getExt),\n/* harmony export */ getRegExp: () => (/* binding */ getRegExp),\n/* harmony export */ time: () => (/* binding */ time),\n/* harmony export */ timeEnd: () => (/* binding */ timeEnd)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n\nconst isString = a => typeof a === 'string';\nconst escapeRegExp = str => {\n const isStr = isString(str);\n if (isStr) str = str.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&');\n return str;\n};\n\n/**\n * get regexp from wild card\n */\nconst getRegExp = wildcard => {\n const escaped = `^${wildcard // search from start of line\n .replace(/\\./g, '\\\\.').replace(/\\*/g, '.*').replace('?', '.?')}$`;\n\n // search to end of line\n return RegExp(escaped);\n};\n\n/**\n * function gets file extension\n *\n * @param name\n * @return ext\n */\nconst getExt = name => {\n const isStr = isString(name);\n if (!isStr) return '';\n const dot = name.lastIndexOf('.');\n if (~dot) return name.substr(dot);\n return '';\n};\n\n/**\n * find object by name in arrray\n *\n * @param array\n * @param name\n */\nconst findObjByNameInArr = (array, name) => {\n let ret;\n if (!Array.isArray(array)) throw Error('array should be array!');\n if (!isString(name)) throw Error('name should be string!');\n array.some(item => {\n const is = item.name === name;\n const isArray = Array.isArray(item);\n if (is) {\n ret = item;\n return is;\n }\n if (!isArray) return is;\n return item.some(item => {\n const is = item.name === name;\n if (is) ret = item.data;\n return is;\n });\n });\n return ret;\n};\n\n/**\n * start timer\n * @param name\n */\nconst time = name => {\n execon__WEBPACK_IMPORTED_MODULE_0__.ifExist(console, 'time', [name]);\n};\n\n/**\n * stop timer\n * @param name\n */\nconst timeEnd = name => {\n execon__WEBPACK_IMPORTED_MODULE_0__.ifExist(console, 'timeEnd', [name]);\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/util.js\n}");
811
811
 
812
812
  /***/ },
813
813
 
@@ -1119,14 +1119,14 @@ eval("{\n\nvar GetIntrinsic = __webpack_require__(/*! get-intrinsic */ \"./node_
1119
1119
 
1120
1120
  /***/ },
1121
1121
 
1122
- /***/ "./node_modules/compute-scroll-into-view/dist/index.cjs"
1123
- /*!**************************************************************!*\
1124
- !*** ./node_modules/compute-scroll-into-view/dist/index.cjs ***!
1125
- \**************************************************************/
1126
- (__unused_webpack_module, exports) {
1122
+ /***/ "./node_modules/compute-scroll-into-view/dist/index.js"
1123
+ /*!*************************************************************!*\
1124
+ !*** ./node_modules/compute-scroll-into-view/dist/index.js ***!
1125
+ \*************************************************************/
1126
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1127
1127
 
1128
1128
  "use strict";
1129
- eval("{Object.defineProperty(exports, \"__esModule\", ({value:!0}));const t=t=>\"object\"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||\"hidden\"!==t)&&(\"visible\"!==t&&\"clip\"!==t),o=(t,o)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const n=getComputedStyle(t,null);return e(n.overflowY,o)||e(n.overflowX,o)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return!1},n=(t,e,o,n,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=o||i>=e&&s>=o?r-t-n:i>e&&s<o||r<t&&s>o?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e};exports.compute=(e,r)=>{var i,s,d,c;if(\"undefined\"==typeof document)return[];const{scrollMode:h,block:u,inline:f,boundary:a,skipOverflowHiddenElements:g}=r,p=\"function\"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError(\"Invalid target\");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&o(W)&&!o(document.documentElement)||null!=W&&o(W,g)&&w.push(W)}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(c=null==(d=window.visualViewport)?void 0:d.height)?c:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return{top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k=\"start\"===u||\"nearest\"===u?x-T:\"end\"===u?I+F:x+v/2-T+F,D=\"center\"===f?R+E/2-V+B:\"end\"===f?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:l,width:r,top:i,right:s,bottom:d,left:c}=e.getBoundingClientRect();if(\"if-needed\"===h&&x>=0&&R>=0&&I<=H&&C<=b&&(e===m&&!o(e)||x>=i&&I<=d&&R>=c&&C<=s))return L;const a=getComputedStyle(e),g=parseInt(a.borderLeftWidth,10),p=parseInt(a.borderTopWidth,10),W=parseInt(a.borderRightWidth,10),T=parseInt(a.borderBottomWidth,10);let B=0,F=0;const V=\"offsetWidth\"in e?e.offsetWidth-e.clientWidth-g-W:0,S=\"offsetHeight\"in e?e.offsetHeight-e.clientHeight-p-T:0,j=\"offsetWidth\"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,O=\"offsetHeight\"in e?0===e.offsetHeight?0:l/e.offsetHeight:0;if(m===e)B=\"start\"===u?k:\"end\"===u?k-H:\"nearest\"===u?n(M,M+H,H,p,T,M+k,M+k+v,v):k-H/2,F=\"start\"===f?D:\"center\"===f?D-b/2:\"end\"===f?D-b:n(y,y+b,b,g,W,y+D,y+D+E,E),B=Math.max(0,B+M),F=Math.max(0,F+y);else{B=\"start\"===u?k-i-p:\"end\"===u?k-d+T+S:\"nearest\"===u?n(i,d,l,p,T+S,k,k+v,v):k-(i+l/2)+S/2,F=\"start\"===f?D-c-g:\"center\"===f?D-(c+r/2)+V/2:\"end\"===f?D-s+W+V:n(c,s,r,g,W+V,D,D+E,E);const{scrollLeft:t,scrollTop:o}=e;B=0===O?0:Math.max(0,Math.min(o+B/O,e.scrollHeight-l/O+S)),F=0===j?0:Math.max(0,Math.min(t+F/j,e.scrollWidth-r/j+V)),k+=o-B,D+=t-F}L.push({el:e,top:B,left:F})}return L};//# sourceMappingURL=index.cjs.map\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/compute-scroll-into-view/dist/index.cjs\n}");
1129
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compute: () => (/* binding */ r)\n/* harmony export */ });\nconst t=t=>\"object\"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||\"hidden\"!==t)&&(\"visible\"!==t&&\"clip\"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return!1},o=(t,e,n,o,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=n||i>=e&&s>=n?r-t-o:i>e&&s<n||r<t&&s>n?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},r=(e,r)=>{var i,s,d,h;if(\"undefined\"==typeof document)return[];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p=\"function\"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError(\"Invalid target\");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W)}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return{top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k=\"start\"===f||\"nearest\"===f?x-T:\"end\"===f?I+F:x+v/2-T+F,D=\"center\"===u?R+E/2-V+B:\"end\"===u?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:l,width:r,top:i,right:s,bottom:d,left:h}=e.getBoundingClientRect();if(\"if-needed\"===c&&x>=0&&R>=0&&I<=H&&C<=b&&(e===m&&!n(e)||x>=i&&I<=d&&R>=h&&C<=s))return L;const a=getComputedStyle(e),g=parseInt(a.borderLeftWidth,10),p=parseInt(a.borderTopWidth,10),W=parseInt(a.borderRightWidth,10),T=parseInt(a.borderBottomWidth,10);let B=0,F=0;const V=\"offsetWidth\"in e?e.offsetWidth-e.clientWidth-g-W:0,S=\"offsetHeight\"in e?e.offsetHeight-e.clientHeight-p-T:0,X=\"offsetWidth\"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,Y=\"offsetHeight\"in e?0===e.offsetHeight?0:l/e.offsetHeight:0;if(m===e)B=\"start\"===f?k:\"end\"===f?k-H:\"nearest\"===f?o(M,M+H,H,p,T,M+k,M+k+v,v):k-H/2,F=\"start\"===u?D:\"center\"===u?D-b/2:\"end\"===u?D-b:o(y,y+b,b,g,W,y+D,y+D+E,E),B=Math.max(0,B+M),F=Math.max(0,F+y);else{B=\"start\"===f?k-i-p:\"end\"===f?k-d+T+S:\"nearest\"===f?o(i,d,l,p,T+S,k,k+v,v):k-(i+l/2)+S/2,F=\"start\"===u?D-h-g:\"center\"===u?D-(h+r/2)+V/2:\"end\"===u?D-s+W+V:o(h,s,r,g,W+V,D,D+E,E);const{scrollLeft:t,scrollTop:n}=e;B=0===Y?0:Math.max(0,Math.min(n+B/Y,e.scrollHeight-l/Y+S)),F=0===X?0:Math.max(0,Math.min(t+F/X,e.scrollWidth-r/X+V)),k+=n-B,D+=t-F}L.push({el:e,top:B,left:F})}return L};//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/compute-scroll-into-view/dist/index.js\n}");
1130
1130
 
1131
1131
  /***/ },
1132
1132
 
@@ -1184,16 +1184,6 @@ eval("{\n\nmodule.exports = Emitify;\n\nfunction Emitify() {\n if (!(this ins
1184
1184
 
1185
1185
  /***/ },
1186
1186
 
1187
- /***/ "./node_modules/domtokenlist-shim/dist/domtokenlist.js"
1188
- /*!*************************************************************!*\
1189
- !*** ./node_modules/domtokenlist-shim/dist/domtokenlist.js ***!
1190
- \*************************************************************/
1191
- () {
1192
-
1193
- eval("{/*! DOMTokenlist shim | Copyright 2016 Jonathan Wilsson and Bogdan Chadkin. */\n;typeof window !== 'undefined' && (function (window) {\n 'use strict';\n\n if (!window.DOMTokenList) {\n return;\n }\n\n var el = document.createElement('a').classList;\n var dtp = DOMTokenList.prototype;\n var add = dtp.add;\n var remove = dtp.remove;\n var toggle = dtp.toggle;\n\n el.add('c1', 'c2');\n\n // Older versions of the HTMLElement.classList spec didn't allow multiple\n // arguments, easy to test for\n var iterateArg = function (fn) {\n return function () {\n var tokens = arguments;\n var i;\n\n for (i = 0; i < tokens.length; i += 1) {\n fn.call(this, tokens[i]);\n }\n };\n };\n\n if (!el.contains('c2')) {\n dtp.add = iterateArg(add);\n dtp.remove = iterateArg(remove);\n }\n\n // Older versions of the spec didn't have a forcedState argument for\n // `toggle` either, test by checking the return value after forcing\n if (!el.toggle('c1', true)) {\n dtp.toggle = function (cls, force) {\n if (force === undefined) {\n return toggle.call(this, cls);\n }\n\n (force ? add : remove).call(this, cls);\n return !!force;\n };\n }\n}(window));\n\n;typeof window !== 'undefined' && (function (window) {\n 'use strict';\n\n var arr = [];\n\n var inArray = function (array, value) {\n var i;\n\n if (arr.indexOf) {\n return arr.indexOf.call(array, value);\n }\n\n for (i = 0; i < array.length; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n\n return -1;\n };\n\n var validateToken = function (token) {\n var whitespace = /[\\u0009\\u000A\\u000C\\u000D\\u0020]/;\n\n if (token === '' || whitespace.test(token)) {\n throw new Error('Token must not be empty or contain whitespace.');\n }\n };\n\n var DOMTokenList = function (element, prop) {\n var inst = this;\n var i;\n var values = [];\n\n if (element && prop) {\n inst.element = element;\n inst.prop = prop;\n\n if (element[prop]) {\n values = element[prop].replace(/^\\s+|\\s+$/g, '').split(/\\s+/);\n\n for (i = 0; i < values.length; i++) {\n inst[i] = values[i];\n }\n }\n }\n\n inst.length = values.length;\n };\n\n DOMTokenList.prototype = {\n add: function () {\n var inst = this;\n var i;\n var tokens = arguments;\n\n for (i = 0; i < tokens.length; i++) {\n validateToken(tokens[i]);\n\n if (!inst.contains(tokens[i])) {\n arr.push.call(inst, tokens[i]);\n }\n }\n\n if (inst.element) {\n inst.element[inst.prop] = inst;\n }\n },\n\n contains: function (token) {\n validateToken(token);\n\n return inArray(this, token) !== -1;\n },\n\n item: function (index) {\n return this[index] || null;\n },\n\n remove: function () {\n var tokens = arguments;\n var inst = this;\n var key;\n var i;\n\n for (i = 0; i < tokens.length; i++) {\n validateToken(tokens[i]);\n\n key = inArray(inst, tokens[i]);\n\n if (key !== -1) {\n arr.splice.call(inst, key, 1);\n }\n }\n\n if (inst.element) {\n inst.element[inst.prop] = inst;\n }\n },\n\n toggle: function (token, force) {\n var inst = this;\n\n if (inst.contains(token)) {\n if (force) {\n return true;\n }\n\n inst.remove(token);\n\n return false;\n } else {\n if (force === false) {\n return false;\n }\n\n inst.add(token);\n\n return true;\n }\n },\n\n toString: function () {\n return arr.join.call(this, ' ');\n }\n };\n\n window.DOMTokenList = DOMTokenList;\n}(window));\n\n;typeof window !== 'undefined' && (function () {\n 'use strict';\n\n if ('classList' in document.createElement('a')) {\n return;\n }\n\n Object.defineProperty(Element.prototype, 'classList', {\n get: function () {\n return new DOMTokenList(this, 'className');\n }\n });\n}());\n\n;typeof window !== 'undefined' && (function () {\n 'use strict';\n\n if ('relList' in document.createElement('a')) {\n return;\n }\n\n var i;\n var elements = [HTMLAnchorElement, HTMLAreaElement, HTMLLinkElement];\n var getter = function () {\n return new DOMTokenList(this, 'rel');\n };\n\n for (i = 0; i < elements.length; i++) {\n Object.defineProperty(elements[i].prototype, 'relList', {\n get: getter\n });\n }\n}());\n\n;typeof window !== 'undefined' && (function () {\n 'use strict';\n\n if (typeof SVGElement === 'undefined') {\n // IE8 does not support SVG and would throw\n // \"Object doesn't support this method or property\"\n return;\n }\n\n // https://connect.microsoft.com/IE/feedback/details/1046039/classlist-not-working-on-svg-elements\n var svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n if ('classList' in svg && !window.QUnit) {\n return;\n }\n\n Object.defineProperty(SVGElement.prototype, 'classList', {\n get: function () {\n if (typeof this.className === 'string') {\n return new DOMTokenList(this, 'className');\n }\n // in SVG world className may not be a DOMString, but a SVGAnimatedString\n // https://developer.mozilla.org/en-US/docs/Web/API/SVGAnimatedString\n if (typeof this.className.baseVal === 'string') {\n return new DOMTokenList(this.className, 'baseVal');\n }\n }\n });\n}());\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/domtokenlist-shim/dist/domtokenlist.js\n}");
1194
-
1195
- /***/ },
1196
-
1197
1187
  /***/ "./node_modules/dunder-proto/get.js"
1198
1188
  /*!******************************************!*\
1199
1189
  !*** ./node_modules/dunder-proto/get.js ***!
@@ -1315,17 +1305,6 @@ eval("{\n\n/** @type {import('.')} */\nmodule.exports = Object;\n\n\n//# sourceU
1315
1305
 
1316
1306
  /***/ },
1317
1307
 
1318
- /***/ "./node_modules/es6-promisify/dist/promisify.js"
1319
- /*!******************************************************!*\
1320
- !*** ./node_modules/es6-promisify/dist/promisify.js ***!
1321
- \******************************************************/
1322
- (__unused_webpack_module, exports) {
1323
-
1324
- "use strict";
1325
- eval("{Object.defineProperty(exports, \"__esModule\", ({value:!0})),exports.promisify=promisify;var customArgumentsToken=\"__ES6-PROMISIFY--CUSTOM-ARGUMENTS__\";function promisify(a){if(\"function\"!=typeof a)throw new TypeError(\"Argument to promisify must be a function\");var b=a[customArgumentsToken],c=promisify.Promise||Promise;if(\"function\"!=typeof c)throw new Error(\"No Promise implementation found; do you need a polyfill?\");return function(){for(var d=this,e=arguments.length,f=Array(e),g=0;g<e;g++)f[g]=arguments[g];return new c(function(c,e){f.push(function(a){if(a)return e(a);for(var d=arguments.length,f=Array(1<d?d-1:0),g=1;g<d;g++)f[g-1]=arguments[g];if(1===f.length||!b)return c(f[0]);var h={};f.forEach(function(a,c){var d=b[c];d&&(h[d]=a)}),c(h)}),a.apply(d,f)})}}promisify.argumentNames=\"__ES6-PROMISIFY--CUSTOM-ARGUMENTS__\",promisify.Promise=void 0;\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/es6-promisify/dist/promisify.js\n}");
1326
-
1327
- /***/ },
1328
-
1329
1308
  /***/ "./node_modules/es6-promisify/dist/promisify.mjs"
1330
1309
  /*!*******************************************************!*\
1331
1310
  !*** ./node_modules/es6-promisify/dist/promisify.mjs ***!
@@ -1391,16 +1370,6 @@ eval("{\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/c
1391
1370
 
1392
1371
  /***/ },
1393
1372
 
1394
- /***/ "./node_modules/fullstore/lib/fullstore.cjs"
1395
- /*!**************************************************!*\
1396
- !*** ./node_modules/fullstore/lib/fullstore.cjs ***!
1397
- \**************************************************/
1398
- (module, __unused_webpack_exports, __webpack_require__) {
1399
-
1400
- eval("{const {fullstore} = __webpack_require__(/*! ./fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n\nmodule.exports = fullstore;\nmodule.exports.fullstore = fullstore;\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/fullstore/lib/fullstore.cjs\n}");
1401
-
1402
- /***/ },
1403
-
1404
1373
  /***/ "./node_modules/fullstore/lib/fullstore.js"
1405
1374
  /*!*************************************************!*\
1406
1375
  !*** ./node_modules/fullstore/lib/fullstore.js ***!
@@ -1925,14 +1894,14 @@ eval("{\n\nvar callBound = __webpack_require__(/*! call-bound */ \"./node_module
1925
1894
 
1926
1895
  /***/ },
1927
1896
 
1928
- /***/ "./node_modules/scroll-into-view-if-needed/dist/index.cjs"
1929
- /*!****************************************************************!*\
1930
- !*** ./node_modules/scroll-into-view-if-needed/dist/index.cjs ***!
1931
- \****************************************************************/
1932
- (module, __unused_webpack_exports, __webpack_require__) {
1897
+ /***/ "./node_modules/scroll-into-view-if-needed/dist/index.js"
1898
+ /*!***************************************************************!*\
1899
+ !*** ./node_modules/scroll-into-view-if-needed/dist/index.js ***!
1900
+ \***************************************************************/
1901
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1933
1902
 
1934
1903
  "use strict";
1935
- eval("{var t=__webpack_require__(/*! compute-scroll-into-view */ \"./node_modules/compute-scroll-into-view/dist/index.cjs\");const o=t=>!1===t?{block:\"end\",inline:\"nearest\"}:(t=>t===Object(t)&&0!==Object.keys(t).length)(t)?t:{block:\"start\",inline:\"nearest\"};module.exports=function(e,r){if(!e.isConnected||!(t=>{let o=t;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(e))return;const n=(t=>{const o=window.getComputedStyle(t);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((t=>\"object\"==typeof t&&\"function\"==typeof t.behavior)(r))return r.behavior(t.compute(e,r));const l=\"boolean\"==typeof r||null==r?void 0:r.behavior;for(const{el:a,top:i,left:c}of t.compute(e,o(r))){const t=i-n.top+n.bottom,o=c-n.left+n.right;a.scroll({top:t,left:o,behavior:l})}};//# sourceMappingURL=index.cjs.map\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/scroll-into-view-if-needed/dist/index.cjs\n}");
1904
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ e)\n/* harmony export */ });\n/* harmony import */ var compute_scroll_into_view__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! compute-scroll-into-view */ \"./node_modules/compute-scroll-into-view/dist/index.js\");\nconst o=t=>!1===t?{block:\"end\",inline:\"nearest\"}:(t=>t===Object(t)&&0!==Object.keys(t).length)(t)?t:{block:\"start\",inline:\"nearest\"};function e(e,r){if(!e.isConnected||!(t=>{let o=t;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(e))return;const n=(t=>{const o=window.getComputedStyle(t);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((t=>\"object\"==typeof t&&\"function\"==typeof t.behavior)(r))return r.behavior((0,compute_scroll_into_view__WEBPACK_IMPORTED_MODULE_0__.compute)(e,r));const l=\"boolean\"==typeof r||null==r?void 0:r.behavior;for(const{el:a,top:i,left:s}of (0,compute_scroll_into_view__WEBPACK_IMPORTED_MODULE_0__.compute)(e,o(r))){const t=i-n.top+n.bottom,o=s-n.left+n.right;a.scroll({top:t,left:o,behavior:l})}}//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/scroll-into-view-if-needed/dist/index.js\n}");
1936
1905
 
1937
1906
  /***/ },
1938
1907