cloudcmd 19.1.11 → 19.1.12

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.
@@ -15,7 +15,7 @@
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 _dom_images_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./dom/images.mjs */ \"./client/dom/images.mjs\");\n/* harmony import */ var _sw_register_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sw/register.js */ \"./client/sw/register.js\");\n/* harmony import */ var _get_json_from_file_table_mjs__WEBPACK_IMPORTED_MODULE_11__ = __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_12__ = __webpack_require__(/*! ./key/index.mjs */ \"./client/key/index.mjs\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _load_module_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./load-module.mjs */ \"./client/load-module.mjs\");\n\n\n/* global DOM */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst noJS = (a) => a.replace(/.js$/, '');\n\nconst isDev = \"development\" === 'development';\n\ninherits__WEBPACK_IMPORTED_MODULE_2__(CloudCmdProto, emitify__WEBPACK_IMPORTED_MODULE_1__);\n\nconst createCloudCmd = ({DOM, Listeners}) => {\n return new CloudCmdProto({\n DOM,\n Listeners,\n });\n};\n\nload_js__WEBPACK_IMPORTED_MODULE_4__.addErrorListener((e, src) => {\n const msg = `file ${src} could not be loaded`;\n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_9__.show.error(msg);\n});\n\nfunction CloudCmdProto({DOM, Listeners}) {\n emitify__WEBPACK_IMPORTED_MODULE_1__.call(this);\n \n const CloudCmd = this;\n const Info = DOM.CurrentInfo;\n \n const {Storage, Files} = DOM;\n \n this.log = () => {\n if (!isDev)\n return;\n };\n this.prefix = '';\n this.prefixSocket = '';\n this.prefixURL = '';\n \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 \n this.order = {\n left: 'asc',\n right: 'asc',\n };\n \n this.changeDir = async (path, overrides = {}) => {\n const {\n isRefresh,\n panel,\n history = true,\n noCurrent,\n currentName,\n } = overrides;\n \n const refresh = isRefresh;\n let panelChanged;\n \n if (!noCurrent && panel && panel !== Info.panel) {\n DOM.changePanel();\n panelChanged = true;\n }\n \n let imgPosition;\n \n if (panelChanged || refresh || !history)\n imgPosition = 'top';\n \n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_9__.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_mjs__WEBPACK_IMPORTED_MODULE_13__.apiURL}`;\n CloudCmd.prefixSocket = config.prefixSocket;\n CloudCmd.DIR_DIST = `${prefix}/dist`;\n CloudCmd.DIR_MODULES = `${this.DIR_DIST}/modules`;\n \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')\n return;\n \n config[key] = value;\n };\n \n if (config.oneFilePanel)\n CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;\n \n if (!document.body.scrollIntoViewIfNeeded)\n await load_js__WEBPACK_IMPORTED_MODULE_4__.js(`${CloudCmd.DIR_MODULES}/polyfill.js`);\n \n await initModules();\n await baseInit();\n \n CloudCmd.route(location.hash);\n };\n \n this.route = (path) => {\n const query = path.split('/');\n \n if (!path)\n return;\n \n const [kebabModule] = query;\n const module = noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(kebabModule.slice(1)));\n \n const [, file] = query;\n const current = DOM.getCurrentByName(file);\n \n if (file && !current) {\n const msg = (0,_common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_13__.formatMsg)('set current file', file, 'error');\n CloudCmd.log(msg);\n \n return;\n }\n \n DOM.setCurrentFile(current);\n CloudCmd.execFromModule(module, 'show');\n };\n \n this.logOut = async () => {\n const url = CloudCmd.prefix + '/logout';\n const error = () => document.location.reload();\n const {prefix} = CloudCmd;\n \n await DOM.Storage.clear();\n (0,_sw_register_js__WEBPACK_IMPORTED_MODULE_10__.unregisterSW)(prefix);\n DOM.load.ajax({\n url,\n error,\n });\n };\n \n const initModules = async () => {\n CloudCmd.Key = _key_index_mjs__WEBPACK_IMPORTED_MODULE_12__.Key;\n CloudCmd.Key.bind();\n \n const [, modules] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, 'modules');\n const showLoad = _dom_images_mjs__WEBPACK_IMPORTED_MODULE_9__.show.load;\n \n const doBefore = {\n edit: showLoad,\n menu: showLoad,\n };\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 \n if (!modules)\n return;\n \n for (const module of modules.local) {\n load(null, module, doBefore[module]);\n }\n };\n \n async function saveCurrentName(currentName) {\n await Storage.set('current-name', currentName);\n }\n \n async function baseInit() {\n const files = DOM.getFiles();\n \n CloudCmd.on('current-file', DOM.updateCurrentInfo);\n CloudCmd.on('current-name', saveCurrentName);\n \n const name = await Storage.get('current-name');\n const currentFile = name && DOM.getCurrentByName(name) || files[0];\n \n /* выделяем строку с первым файлом */\n if (files)\n 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 \n const dirPath = DOM.getCurrentDirPath();\n \n Listeners.init();\n \n const panels = getPanels();\n panels.forEach(Listeners.setOnPanel);\n \n Listeners.initKeysPanel();\n \n if (!CloudCmd.config('dirStorage'))\n return;\n \n const data = await Storage.get(dirPath);\n \n if (!data)\n await Storage.setJson(dirPath, (0,_get_json_from_file_table_mjs__WEBPACK_IMPORTED_MODULE_11__.getJsonFromFileTable)());\n }\n \n function getPanels() {\n const panels = ['left'];\n \n if (CloudCmd.config('oneFilePanel'))\n return panels;\n \n return [\n ...panels,\n 'right',\n ];\n }\n \n this.execFromModule = async (moduleName, funcName, ...args) => {\n await CloudCmd[moduleName]();\n \n const func = CloudCmd[moduleName][funcName];\n func(...args);\n };\n \n this.refresh = async (options = {}) => {\n const {panel = Info.panel, currentName} = options;\n \n const path = DOM.getCurrentDirPath(panel);\n \n const isRefresh = true;\n const history = false;\n const noCurrent = options?.noCurrent;\n \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 {RESTful} = DOM;\n \n CloudCmd.log(`reading dir: \"${path}\";`);\n \n const dirStorage = CloudCmd.config('dirStorage');\n const json = dirStorage && await Storage.getJson(path);\n \n const name = options.currentName || Info.name;\n const {noCurrent, refresh} = options;\n \n if (!refresh && json)\n return await createFileTable(json, panel, options);\n \n const position = DOM.getPanelPosition(panel);\n const sort = CloudCmd.sort[position];\n const order = CloudCmd.order[position];\n \n const query = rendy__WEBPACK_IMPORTED_MODULE_3__('?sort={{ sort }}&order={{ order }}', {\n sort,\n order,\n });\n \n const [, newObj] = await RESTful.read(path + query, 'json');\n \n if (!newObj)\n // that's OK, error handled by RESTful\n return;\n \n options.sort = sort;\n options.order = order;\n \n await createFileTable(newObj, panel, options);\n \n if (refresh && !noCurrent)\n DOM.setCurrentByName(name);\n \n if (!CloudCmd.config('dirStorage'))\n return;\n \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 \n const names = [\n 'file',\n 'path',\n 'link',\n 'pathLink',\n ];\n \n const [error, [file, path, link, pathLink]] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, names);\n \n if (error)\n return DOM.Dialog.alert(error.responseText);\n \n const panel = panelParam || DOM.getPanel();\n const {prefix} = CloudCmd;\n \n const {dir, name} = Info;\n \n const {childNodes} = panel;\n let i = childNodes.length;\n \n while (i--)\n panel.removeChild(panel.lastChild);\n \n panel.innerHTML = (0,_common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_13__.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 \n Listeners.setOnPanel(panel);\n \n if (!noCurrent) {\n let current;\n \n if (name === '..' && dir !== '/')\n current = DOM.getCurrentByName(dir);\n \n if (!current)\n [current] = DOM.getFiles(panel);\n \n DOM.setCurrentFile(current, {\n history,\n });\n \n CloudCmd.emit('active-dir', Info.dirPath);\n }\n }\n \n this.goToParentDir = async () => {\n const {\n dir,\n dirPath,\n parentDirPath,\n panel,\n } = Info;\n \n if (dirPath === parentDirPath)\n return;\n \n const path = parentDirPath;\n \n await CloudCmd.changeDir(path);\n \n const current = DOM.getCurrentByName(dir);\n const [first] = DOM.getFiles(panel);\n \n DOM.setCurrentFile(current || first, {\n history,\n });\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 _dom_images_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./dom/images.mjs */ \"./client/dom/images.mjs\");\n/* harmony import */ var _sw_register_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sw/register.mjs */ \"./client/sw/register.mjs\");\n/* harmony import */ var _get_json_from_file_table_mjs__WEBPACK_IMPORTED_MODULE_11__ = __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_12__ = __webpack_require__(/*! ./key/index.mjs */ \"./client/key/index.mjs\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _load_module_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./load-module.mjs */ \"./client/load-module.mjs\");\n\n\n/* global DOM */\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_mjs__WEBPACK_IMPORTED_MODULE_9__.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_mjs__WEBPACK_IMPORTED_MODULE_9__.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_mjs__WEBPACK_IMPORTED_MODULE_13__.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_mjs__WEBPACK_IMPORTED_MODULE_13__.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_10__.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_12__.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_mjs__WEBPACK_IMPORTED_MODULE_9__.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_11__.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_mjs__WEBPACK_IMPORTED_MODULE_13__.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}");
19
19
 
20
20
  /***/ },
21
21
 
@@ -26,7 +26,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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 node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.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 _css_main_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\n/* harmony import */ var _sw_register_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sw/register.js */ \"./client/sw/register.js\");\n/* harmony import */ var _sort_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sort.mjs */ \"./client/sort.mjs\");\n/* harmony import */ var _common_util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/util.js */ \"./common/util.js\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dom/index.js */ \"./client/dom/index.js\");\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\n\nconst isDev = \"development\" === 'development';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (init);\n\nglobalThis.CloudCmd = init;\n\nasync function init(config) {\n globalThis.CloudCmd = (0,_client_mjs__WEBPACK_IMPORTED_MODULE_9__.createCloudCmd)({\n DOM: _dom_index_js__WEBPACK_IMPORTED_MODULE_8__,\n Listeners: _listeners_index_mjs__WEBPACK_IMPORTED_MODULE_10__,\n });\n globalThis.DOM = _dom_index_js__WEBPACK_IMPORTED_MODULE_8__;\n globalThis.Util = _common_util_js__WEBPACK_IMPORTED_MODULE_6__;\n globalThis.CloudFunc = _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_7__;\n \n await register(config);\n \n (0,_sort_mjs__WEBPACK_IMPORTED_MODULE_5__.initSortPanel)();\n globalThis.CloudCmd.sortPanel = _sort_mjs__WEBPACK_IMPORTED_MODULE_5__.sortPanel;\n const prefix = getPrefix(config.prefix);\n \n globalThis.CloudCmd.init(prefix, config);\n \n if (globalThis.CloudCmd.config('menu') === 'aleman')\n 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}\n\nfunction getPrefix(prefix) {\n if (!prefix)\n return '';\n \n if (!prefix.indexOf('/'))\n return prefix;\n \n return `/${prefix}`;\n}\n\nconst onUpdateFound = wraptile__WEBPACK_IMPORTED_MODULE_1__(async (config) => {\n if (isDev)\n return;\n \n const {DOM} = globalThis;\n const prefix = getPrefix(config.prefix);\n \n await load_js__WEBPACK_IMPORTED_MODULE_2__.js(`${prefix}/dist/cloudcmd.common.js`);\n await load_js__WEBPACK_IMPORTED_MODULE_2__.js(`${prefix}/dist/cloudcmd.js`);\n \n console.log('cloudcmd: sw: updated');\n \n DOM.Events.removeAll();\n globalThis.CloudCmd(config);\n});\n\nasync function register(config) {\n const {prefix} = config;\n const sw = await (0,_sw_register_js__WEBPACK_IMPORTED_MODULE_4__.registerSW)(prefix);\n \n (0,_sw_register_js__WEBPACK_IMPORTED_MODULE_4__.listenSW)(sw, 'updatefound', onUpdateFound(config));\n}\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 node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.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 _css_main_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\n/* harmony import */ var _sw_register_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sw/register.mjs */ \"./client/sw/register.mjs\");\n/* harmony import */ var _sort_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sort.mjs */ \"./client/sort.mjs\");\n/* harmony import */ var _common_util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/util.js */ \"./common/util.js\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dom/index.js */ \"./client/dom/index.js\");\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_js__WEBPACK_IMPORTED_MODULE_8__,\n Listeners: _listeners_index_mjs__WEBPACK_IMPORTED_MODULE_10__\n });\n globalThis.DOM = _dom_index_js__WEBPACK_IMPORTED_MODULE_8__;\n globalThis.Util = _common_util_js__WEBPACK_IMPORTED_MODULE_6__;\n globalThis.CloudFunc = _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_7__;\n await register(config);\n (0,_sort_mjs__WEBPACK_IMPORTED_MODULE_5__.initSortPanel)();\n globalThis.CloudCmd.sortPanel = _sort_mjs__WEBPACK_IMPORTED_MODULE_5__.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_1__(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_2__.js(`${prefix}/dist/cloudcmd.common.js`);\n await load_js__WEBPACK_IMPORTED_MODULE_2__.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_4__.registerSW)(prefix);\n (0,_sw_register_mjs__WEBPACK_IMPORTED_MODULE_4__.listenSW)(sw, 'updatefound', onUpdateFound(config));\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/cloudcmd.mjs\n}");
30
30
 
31
31
  /***/ },
32
32
 
@@ -37,7 +37,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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 _common_try_to_promise_all_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../common/try-to-promise-all.js */ \"./common/try-to-promise-all.js\");\n/* harmony import */ var _storage_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./storage.js */ \"./client/dom/storage.js\");\n/* global CloudCmd*/\n\n\n\nconst CLASS = 'cut-file';\nconst COPY = 'copy';\nconst CUT = 'cut';\n\nfunction showMessage(msg) {\n globalThis.DOM.Dialog.alert(msg);\n}\n\nfunction getNames() {\n const {DOM} = globalThis;\n const files = DOM.getActiveFiles();\n \n return DOM.getFilenames(files);\n}\n\nfunction addCutClass() {\n const {DOM} = globalThis;\n const files = DOM.getActiveFiles();\n \n for (const element of files) {\n element.classList.add(CLASS);\n }\n}\n\nfunction rmCutClass() {\n const {DOM} = globalThis;\n const files = DOM.getByClassAll(CLASS);\n \n for (const element of files) {\n element.classList.remove(CLASS);\n }\n}\n\nconst checkEnabled = (fn) => () => {\n const is = CloudCmd.config('buffer');\n \n if (is)\n return fn();\n \n showMessage('Buffer disabled in config!');\n};\n\nasync function readBuffer() {\n const [e, cp, ct] = await _common_try_to_promise_all_js__WEBPACK_IMPORTED_MODULE_0__([\n _storage_js__WEBPACK_IMPORTED_MODULE_1__.getJson(COPY),\n _storage_js__WEBPACK_IMPORTED_MODULE_1__.getJson(CUT),\n ]);\n \n return [\n e,\n cp,\n ct,\n ];\n}\n\nconst copy = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const names = getNames();\n const from = Info.dirPath;\n \n await clear();\n \n if (!names.length)\n return;\n \n await _storage_js__WEBPACK_IMPORTED_MODULE_1__.remove(CUT);\n await _storage_js__WEBPACK_IMPORTED_MODULE_1__.setJson(COPY, {\n from,\n names,\n });\n});\n\nconst cut = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const names = getNames();\n const from = Info.dirPath;\n \n await clear();\n \n if (!names.length)\n return;\n \n addCutClass();\n \n await _storage_js__WEBPACK_IMPORTED_MODULE_1__.setJson(CUT, {\n from,\n names,\n });\n});\n\nconst clear = checkEnabled(async () => {\n await _storage_js__WEBPACK_IMPORTED_MODULE_1__.remove(COPY);\n await _storage_js__WEBPACK_IMPORTED_MODULE_1__.remove(CUT);\n \n rmCutClass();\n});\n\nconst paste = checkEnabled(async () => {\n const Info = globalThis.DOM.CurrentInfo;\n const [error, cp, ct] = await readBuffer();\n \n if (error || !cp && !ct)\n return showMessage(error || 'Buffer is empty!');\n \n const opStr = cp ? 'copy' : 'move';\n const data = cp || ct;\n const {Operation} = CloudCmd;\n const msg = 'Path is same!';\n const to = Info.dirPath;\n \n if (data.from === to)\n return showMessage(msg);\n \n Operation.show(opStr, {\n ...data,\n to,\n });\n \n await clear();\n});\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 _common_try_to_promise_all_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../common/try-to-promise-all.js */ \"./common/try-to-promise-all.js\");\n/* harmony import */ var _storage_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./storage.js */ \"./client/dom/storage.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_0__([_storage_js__WEBPACK_IMPORTED_MODULE_1__.getJson(COPY), _storage_js__WEBPACK_IMPORTED_MODULE_1__.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 _storage_js__WEBPACK_IMPORTED_MODULE_1__.remove(CUT);\n await _storage_js__WEBPACK_IMPORTED_MODULE_1__.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 _storage_js__WEBPACK_IMPORTED_MODULE_1__.setJson(CUT, {\n from,\n names\n });\n});\nconst clear = checkEnabled(async () => {\n await _storage_js__WEBPACK_IMPORTED_MODULE_1__.remove(COPY);\n await _storage_js__WEBPACK_IMPORTED_MODULE_1__.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}");
41
41
 
42
42
  /***/ },
43
43
 
@@ -48,7 +48,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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 */ _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_entity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/entity.js */ \"./common/entity.js\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\n/* global DOM */\n/* global CloudCmd */\n\n\n\n\nlet Title;\n\nconst CURRENT_FILE = 'current-file';\nconst encodeNBSP = (a) => a?.replace('\\xa0', ' ');\nconst decodeNBSP = (a) => a?.replace(' ', '\\xa0');\n\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 {link} = Info;\n const {prefix} = CloudCmd;\n const dir = prefix + _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_2__.FS + Info.dirPath;\n const encoded = (0,_common_entity_js__WEBPACK_IMPORTED_MODULE_1__.encode)(name);\n \n link.title = encoded;\n link.href = dir + encoded;\n link.innerHTML = encoded;\n \n current.setAttribute('data-name', createNameAttribute(name));\n CloudCmd.emit('current-file', current);\n \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 \n if (!current)\n return '';\n \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};\n\nconst _parseNameAttribute = parseNameAttribute;\n\nconst parseHrefAttribute = (prefix, attribute) => {\n attribute = attribute.replace(RegExp('^' + prefix + _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_2__.FS), '');\n return (0,_common_entity_js__WEBPACK_IMPORTED_MODULE_1__.decode)(decodeNBSP(attribute));\n};\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 {prefix} = CloudCmd;\n \n return parseHrefAttribute(prefix, element.getAttribute('href'));\n};\n\n/**\n * get current direcotory name\n */\nconst getCurrentDirName = () => {\n const href = DOM\n .getCurrentDirPath()\n .replace(/\\/$/, '');\n \n const substr = href.substr(href, href.lastIndexOf('/'));\n \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 \n if (path === '/')\n return path;\n \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 \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 \n if (!is)\n return;\n \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 \n if (!currentFile)\n return DOM;\n \n let pathWas = '';\n \n if (currentFileWas) {\n pathWas = DOM.getCurrentDirPath();\n unsetCurrentFile(currentFileWas);\n }\n \n currentFile.classList.add(CURRENT_FILE);\n \n const path = DOM.getCurrentDirPath();\n const name = CloudCmd.config('name');\n \n if (path !== pathWas) {\n DOM.setTitle((0,_common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_2__.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_mjs__WEBPACK_IMPORTED_MODULE_2__.FS + path;\n DOM.setHistory(historyPath, null, historyPath);\n }\n }\n \n /* scrolling to current file */\n const CENTER = true;\n \n DOM.scrollIntoViewIfNeeded(currentFile, CENTER);\n \n CloudCmd.emit('current-file', currentFile);\n CloudCmd.emit('current-path', path);\n CloudCmd.emit('current-name', DOM.getCurrentName(currentFile));\n \n return DOM;\n};\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 = ({x, y}) => {\n const element = document.elementFromPoint(x, y);\n \n const getEl = (el) => {\n const {tagName} = el;\n const isChild = /A|SPAN|LI/.test(tagName);\n \n if (!isChild)\n return null;\n \n if (tagName === 'A')\n return el.parentElement.parentElement;\n \n if (tagName === 'SPAN')\n return el.parentElement;\n \n return el;\n };\n \n const el = getEl(element);\n \n if (el && el.tagName !== 'LI')\n return null;\n \n return el;\n};\n\n/**\n * current file check\n *\n * @param currentFile\n */\nconst isCurrentFile = (currentFile) => {\n if (!currentFile)\n return false;\n \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)\n Title = DOM.getByTag('title')[0] || _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('title', {\n innerHTML: name,\n parent: document.head,\n });\n \n Title.textContent = name;\n \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 \n const isZip = path.endsWith('.zip');\n const isDir = /^directory(-link)?/.test(fileType);\n \n return isDir || isZip;\n};\n\nconst getCurrentType = (currentFile) => {\n const current = currentFile || DOM.getCurrentFile();\n const el = DOM.getByDataName('js-type', current);\n const type = el.className\n .split(' ')\n .pop();\n \n return type;\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/current-file.mjs\n}");
51
+ 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_entity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/entity.js */ \"./common/entity.js\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/cloudfunc.mjs */ \"./common/cloudfunc.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_mjs__WEBPACK_IMPORTED_MODULE_2__.FS + Info.dirPath;\n const encoded = (0,_common_entity_js__WEBPACK_IMPORTED_MODULE_1__.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_mjs__WEBPACK_IMPORTED_MODULE_2__.FS), '');\n return (0,_common_entity_js__WEBPACK_IMPORTED_MODULE_1__.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_mjs__WEBPACK_IMPORTED_MODULE_2__.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_mjs__WEBPACK_IMPORTED_MODULE_2__.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}");
52
52
 
53
53
  /***/ },
54
54
 
@@ -103,7 +103,7 @@ eval("{\n\nlet list = [];\nmodule.exports.add = (el, name, fn) => {\n list.push
103
103
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
104
104
 
105
105
  "use strict";
106
- 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 \n parseArgs(type, element, listener, (element, args) => {\n const [name, fn, options] = args;\n \n element.addEventListener(name, fn, options);\n _event_store_js__WEBPACK_IMPORTED_MODULE_1__.add(element, name, fn);\n });\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 \n if (!listener) {\n listener = element;\n element = null;\n }\n \n add(type, element, once);\n \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 \n parseArgs(type, element, listener, (element, args) => {\n element.removeEventListener(...args);\n });\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 \n for (const [el, name, fn] of events)\n el.removeEventListener(name, fn);\n \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};\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};\n\nfunction checkType(type) {\n if (!type)\n throw Error('type could not be empty!');\n}\n\nconst getEventOptions = (eventName) => {\n if (eventName !== 'touchstart')\n return false;\n \n return {\n passive: true,\n };\n};\n\nfunction parseArgs(eventName, element, listener, callback) {\n let isFunc;\n const args = [\n eventName,\n element,\n listener,\n callback,\n ];\n \n const EVENT_NAME = 1;\n const ELEMENT = 0;\n const type = itype__WEBPACK_IMPORTED_MODULE_0__(eventName);\n \n switch(type) {\n default:\n if (!type.endsWith('element'))\n throw Error(`unknown eventName: ${type}`);\n \n parseArgs(args[EVENT_NAME], args[ELEMENT], listener, callback);\n break;\n \n case 'string':\n isFunc = itype__WEBPACK_IMPORTED_MODULE_0__[\"function\"](element);\n \n if (isFunc) {\n listener = element;\n element = null;\n }\n \n if (!element)\n element = window;\n \n callback(element, [\n eventName,\n listener,\n getEventOptions(eventName),\n ]);\n break;\n \n case 'array':\n \n for (const name of eventName) {\n parseArgs(name, element, listener, callback);\n }\n \n break;\n \n case 'object':\n \n for (const name of Object.keys(eventName)) {\n const eventListener = eventName[name];\n \n parseArgs(name, element, eventListener, callback);\n }\n \n break;\n }\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\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/events/index.mjs\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 */ 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}");
107
107
 
108
108
  /***/ },
109
109
 
@@ -125,7 +125,7 @@ eval("{\n\n/* global CloudCmd */\nconst itype = __webpack_require__(/*! itype */
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 */ 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\n\nconst LOADING = 'loading';\nconst HIDDEN = 'hidden';\nconst ERROR = 'error';\n\nconst getLoadingType = () => isSVG() ? '-svg' : '-gif';\n\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 \n if (!createNS)\n return false;\n \n const create = createNS.bind(document);\n const svgNode = create(SVG_URL, 'animate');\n const name = svgNode.toString();\n \n return /SVGAnimate/.test(name);\n}\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 {classList} = element;\n const loadingImage = LOADING + getLoadingType();\n \n classList.add(LOADING, loadingImage);\n classList.remove(ERROR, HIDDEN);\n \n return element;\n};\n\n/* Функция создаёт картинку ошибки загрузки */\nconst error = () => {\n const element = getElement();\n const {classList} = element;\n const loadingImage = LOADING + getLoadingType();\n \n classList.add(ERROR);\n classList.remove(HIDDEN, LOADING, loadingImage);\n \n return element;\n};\n\nshow.load = show;\nshow.error = (text) => {\n const image = Images.error();\n \n DOM.show(image);\n image.title = text;\n \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 \n let current;\n \n if (position === 'top') {\n current = refreshButton.parentElement;\n } else {\n current = DOM.getCurrentFile();\n \n if (current)\n current = DOM.getByDataName('js-name', current);\n else\n current = refreshButton.parentElement;\n }\n \n if (!parent || parent && parent !== current)\n current.appendChild(image);\n \n DOM.show(image);\n \n return image;\n}\n\n/**\n* hide load image\n*/\nconst hide = () => {\n const element = Images.get();\n \n DOM.hide(element);\n \n return Images;\n};\n\nconst setProgress = (value, title) => {\n const DATA = 'data-progress';\n const element = Images.get();\n \n if (!element)\n return Images;\n \n element.setAttribute(DATA, `${value}%`);\n \n if (title)\n element.title = title;\n \n return Images;\n};\n\nconst clearProgress = () => {\n const DATA = 'data-progress';\n const element = Images.get();\n \n if (!element)\n return Images;\n \n element.setAttribute(DATA, '');\n element.title = '';\n \n return Images;\n};\n\nconst Images = {\n clearProgress,\n setProgress,\n show,\n hide,\n get,\n error,\n loading,\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/images.mjs\n}");
128
+ 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}");
129
129
 
130
130
  /***/ },
131
131
 
@@ -246,7 +246,7 @@ eval("{\n\n/* global CloudCmd */\nconst {\n eachSeries\n} = __webpack_require__
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 */ 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 \n const files = infoFiles\n .filter(notParent)\n .map(parse);\n \n const fileTable = {\n path,\n files,\n };\n \n return fileTable;\n};\n\nconst notParent = (current) => {\n const name = DOM.getCurrentName(current);\n return name !== '..';\n};\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 \n return {\n name,\n size,\n mode,\n owner,\n date,\n type,\n };\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/get-json-from-file-table.mjs\n}");
249
+ 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}");
250
250
 
251
251
  /***/ },
252
252
 
@@ -268,7 +268,7 @@ eval("{\n\nmodule.exports.createBinder = () => {\n let binded = false;\n retur
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 */ 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_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\n\nconst Chars = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__.fullstore)();\n\nconst toggleVim = (keyCode, overrides = {}) => {\n const {_config, config} = overrides;\n \n if (keyCode === _key_mjs__WEBPACK_IMPORTED_MODULE_4__.ESC)\n _config('vim', !config('vim'));\n};\n\nconst isUndefined = (a) => typeof a === 'undefined';\n\nChars([]);\n\nconst {assign} = Object;\nconst binder = (0,_binder_js__WEBPACK_IMPORTED_MODULE_7__.createBinder)();\n\nconst bind = () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_2__.addKey(listener, true);\n binder.setBind();\n};\n\nconst Key = assign(binder, _key_mjs__WEBPACK_IMPORTED_MODULE_4__, {\n bind,\n});\n\nconst _listener = listener;\n\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 \n const char = key || fromCharCode(keyIdentifier);\n const symbol = getSymbol(shift, keyCode);\n \n return [symbol, char];\n}\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__,\n } = overrides;\n \n const {keyCode} = event;\n \n // strange chrome bug calles listener twice\n // in second time event misses a lot fields\n if (isUndefined(event.altKey))\n return;\n \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 \n const [symbol, char] = getChar(event);\n \n if (!binder.isBind())\n return;\n \n toggleVim(keyCode, {\n config,\n _config,\n });\n \n const isVim = config('vim');\n \n if (!isVim && !isNumpad && !alt && !ctrl && !meta && (isBetween || symbol))\n return _set_current_by_char_js__WEBPACK_IMPORTED_MODULE_6__(char, Chars);\n \n Chars([]);\n await switchKey(event);\n \n if (keyCode >= _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F1 && keyCode <= _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F10)\n return;\n \n if (isVim)\n vim(char, event);\n}\n\nfunction getSymbol(shift, keyCode) {\n switch(keyCode) {\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.DOT:\n return '.';\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.HYPHEN:\n return shift ? '_' : '-';\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.EQUAL:\n return shift ? '+' : '=';\n }\n \n return '';\n}\n\nfunction fromCharCode(keyIdentifier) {\n const code = keyIdentifier.substring(2);\n const hex = parseInt(code, 16);\n \n return String.fromCharCode(hex);\n}\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 \n const {\n name,\n panel,\n path,\n isDir,\n } = Info;\n \n const {\n Operation,\n changeDir,\n config,\n } = CloudCmd;\n \n const {keyCode} = event;\n \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 \n if (current) {\n prev = current.previousSibling;\n next = current.nextSibling;\n }\n \n switch(keyCode) {\n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.TAB:\n DOM.changePanel();\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.INSERT:\n DOM\n .toggleSelectedFile(current)\n .setCurrentFile(next);\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.INSERT_MAC:\n DOM\n .toggleSelectedFile(current)\n .setCurrentFile(next);\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.DELETE:\n if (shift)\n Operation.show('delete:silent');\n else\n Operation.show('delete');\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.ASTERISK:\n DOM.toggleAllSelectedFiles(current);\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.PLUS:\n DOM.expandSelection();\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.MINUS:\n DOM.shrinkSelection();\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F1:\n CloudCmd.Help.show();\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F2:\n CloudCmd.UserMenu.show();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F3:\n event.preventDefault();\n \n if (Info.isDir)\n await changeDir(path);\n else if (shift)\n CloudCmd.View.show(null, {\n raw: true,\n });\n else if (ctrlMeta)\n CloudCmd.sortPanel('name');\n else\n CloudCmd.View.show();\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F4:\n if (config('vim'))\n CloudCmd.EditFileVim.show();\n else\n CloudCmd.EditFile.show();\n \n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F5:\n if (ctrlMeta)\n CloudCmd.sortPanel('date');\n else if (alt)\n Operation.show('pack');\n else\n Operation.show('copy');\n \n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F6:\n if (ctrlMeta)\n CloudCmd.sortPanel('size');\n else if (shift)\n DOM.renameCurrent(current);\n else\n Operation.show('move');\n \n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F7:\n if (shift)\n DOM.promptNewFile();\n else\n DOM.promptNewDir();\n \n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F8:\n Operation.show('delete');\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F9:\n if (alt)\n Operation.show('extract');\n else\n CloudCmd.Menu.show();\n \n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.F10:\n CloudCmd.Config.show();\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.TRA:\n event.preventDefault();\n \n if (shift)\n return CloudCmd.Terminal.show();\n \n CloudCmd.Konsole.show();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.BRACKET_CLOSE:\n CloudCmd.Konsole.show();\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.SPACE:\n event.preventDefault();\n \n if (!isDir || name === '..')\n isSelected = true;\n else\n isSelected = DOM.isSelected(current);\n \n if (!isSelected)\n await DOM.loadCurrentSize(current);\n \n DOM.toggleSelectedFile(current);\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.U:\n if (ctrlMeta) {\n DOM.swapPanels();\n event.preventDefault();\n }\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)\n DOM.toggleSelectedFile(current);\n \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)\n DOM.toggleSelectedFile(current);\n \n DOM.setCurrentFile(next);\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.LEFT:\n if (!alt)\n return;\n \n event.preventDefault();\n \n dataName = Info.panel.getAttribute('data-name');\n \n if (dataName === 'js-right')\n DOM.duplicatePanel();\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.RIGHT:\n if (!alt)\n return;\n \n event.preventDefault();\n \n dataName = Info.panel.getAttribute('data-name');\n \n if (dataName === 'js-left')\n DOM.duplicatePanel();\n \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 \n for (i = 0; i < 30; i++) {\n if (!current.nextSibling)\n break;\n \n current = current.nextSibling;\n }\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 \n for (i = 0; i < 30; i++) {\n if (!current.previousSibling)\n break;\n \n current = current.previousSibling;\n }\n \n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.ENTER:\n if (Info.isDir)\n await changeDir(path);\n else\n CloudCmd.View.show();\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.BACKSPACE:\n CloudCmd.goToParentDir();\n event.preventDefault();\n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.BACKSLASH:\n if (ctrlMeta)\n await changeDir('/');\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.A:\n if (ctrlMeta) {\n DOM.selectAllFiles();\n event.preventDefault();\n }\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.G:\n if (alt) {\n DOM.goToDirectory();\n event.preventDefault();\n }\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.M:\n if (ctrlMeta) {\n if (config('vim'))\n CloudCmd.EditNamesVim.show();\n else\n CloudCmd.EditNames.show();\n \n event.preventDefault();\n }\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.P:\n if (!ctrlMeta)\n return;\n \n event.preventDefault();\n _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_0__.writeText(Info.dirPath)\n .catch(CloudCmd.log);\n \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 \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.C:\n if (ctrlMeta)\n _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__.copy();\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.X:\n if (ctrlMeta)\n _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__.cut();\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.V:\n if (ctrlMeta)\n _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__.paste();\n \n break;\n \n case _key_mjs__WEBPACK_IMPORTED_MODULE_4__.Z:\n if (ctrlMeta)\n _dom_buffer_mjs__WEBPACK_IMPORTED_MODULE_3__.clear();\n \n break;\n \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 \n break;\n \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 \n break;\n }\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/index.mjs\n}");
271
+ 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_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_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_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_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_js__WEBPACK_IMPORTED_MODULE_5__\n } = overrides;\n const {\n keyCode\n } = event;\n\n // strange chrome bug calles 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 _set_current_by_char_js__WEBPACK_IMPORTED_MODULE_6__(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}");
272
272
 
273
273
  /***/ },
274
274
 
@@ -279,7 +279,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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 */ 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\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/key/key.mjs\n}");
282
+ 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}");
283
283
 
284
284
  /***/ },
285
285
 
@@ -345,7 +345,7 @@ eval("{\n\nconst {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./no
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 */ 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\n\nconst getIndex = currify__WEBPACK_IMPORTED_MODULE_0__((array, item) => {\n const index = array.indexOf(item);\n \n if (!~index)\n return 0;\n \n return index;\n});\n\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/get-index.mjs\n}");
348
+ 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}");
349
349
 
350
350
  /***/ },
351
351
 
@@ -356,7 +356,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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 */ getRange: () => (/* binding */ getRange)\n/* harmony export */ });\nconst getRange = (indexFrom, indexTo, files) => {\n if (indexFrom < indexTo)\n return files.slice(indexFrom, indexTo + 1);\n \n if (indexFrom > indexTo)\n return files.slice(indexTo, indexFrom + 1);\n \n return [files[indexFrom]];\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/get-range.mjs\n}");
359
+ 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}");
360
360
 
361
361
  /***/ },
362
362
 
@@ -367,7 +367,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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 */ 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 _get_range_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./get-range.mjs */ \"./client/listeners/get-range.mjs\");\n/* harmony import */ var _dom_upload_files_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../dom/upload-files.js */ \"./client/dom/upload-files.js\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../common/cloudfunc.mjs */ \"./common/cloudfunc.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\n\nconst NBSP_REG = RegExp(String.fromCharCode(160), 'g');\nconst SPACE = ' ';\n\nconst init = async () => {\n contextMenu();\n dragndrop();\n unload();\n pop();\n resize();\n header();\n await config();\n};\n\nconst unselect = (event) => {\n const isMac = /Mac/.test(globalThis.navigator.platform);\n const {\n shiftKey,\n metaKey,\n ctrlKey,\n } = event;\n \n if (shiftKey || isMac && metaKey || ctrlKey)\n return;\n \n DOM.unselectFiles();\n};\n\nconst execAll = currify__WEBPACK_IMPORTED_MODULE_2__((funcs, event) => {\n for (const fn of funcs)\n fn(event);\n});\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};\n\nlet EXT;\n\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 \n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(fm, (event) => {\n const el = event.target;\n const parent = el.parentElement;\n \n if (parent.dataset.name !== 'js-fm-header')\n return;\n \n const name = (el.dataset.name || '').replace('js-', '');\n \n if (!/^(name|size|date)$/.test(name))\n return;\n \n const panel = getPath(el)\n .filter(isDataset)\n .filter(isPanel)\n .pop();\n \n CloudCmd.sortPanel(name, panel);\n });\n}\n\nfunction getPath(el, path = []) {\n if (!el)\n return path;\n \n return getPath(el.parentElement, path.concat(el));\n}\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?.packer;\n \n EXT = DOM.getPackerExt(type);\n}\n\nconst initKeysPanel = () => {\n const keysElement = DOM.getById('js-keyspanel');\n \n if (!keysElement)\n return;\n \n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(keysElement, (event) => {\n const {target} = event;\n const {id} = target;\n \n const operation = (name) => {\n const {Operation} = CloudCmd;\n \n return Operation.show.bind(null, name);\n };\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 \n execon__WEBPACK_IMPORTED_MODULE_0__(clickFuncs[id]);\n });\n};\n\nconst getPanel = (side) => {\n if (!itype__WEBPACK_IMPORTED_MODULE_1__.string(side))\n return side;\n \n return DOM.getByDataName(`js-${side}`);\n};\n\nconst setOnPanel = (side) => {\n const panel = getPanel(side);\n \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};\n\nfunction getPathListener(panel) {\n return onPathElementClick.bind(null, panel);\n}\n\nfunction isNoCurrent(panel) {\n const Info = DOM.CurrentInfo;\n const infoPanel = Info.panel;\n \n if (!infoPanel)\n return true;\n \n const namePanel = panel.getAttribute('data-name');\n const nameInfoPanel = infoPanel.getAttribute('data-name');\n \n return namePanel !== nameInfoPanel;\n}\n\nfunction decodePath(path) {\n const url = CloudCmd.HOST;\n const {prefix} = CloudCmd;\n const prefixReg = RegExp('^' + prefix + _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_8__.FS);\n \n return decodeURI(path)\n .replace(url, '')\n .replace(prefixReg, '') // browser doesn't replace % -> %25% do it for him\n .replace('%%', '%25%')\n .replace(NBSP_REG, SPACE) || '/';\n}\n\nasync function onPathElementClick(panel, event) {\n const Info = DOM.CurrentInfo;\n event.preventDefault();\n \n const element = event.target;\n const attr = element.getAttribute('data-name');\n const noCurrent = isNoCurrent(panel);\n \n if (attr === 'js-copy-path')\n return copyPath(element);\n \n if (attr === 'js-refresh')\n return CloudCmd.refresh({\n panel,\n noCurrent,\n });\n \n if (attr !== 'js-path-link')\n return;\n \n const {href} = element;\n const path = decodePath(href);\n \n await CloudCmd.changeDir(path, {\n isRefresh: false,\n panel: noCurrent ? panel : Info.panel,\n });\n}\n\nfunction copyPath(el) {\n _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_4__.writeText(el.parentElement.title)\n .then(CloudCmd.log)\n .catch(CloudCmd.log);\n}\n\nfunction execIfNotMobile(callback, event) {\n const isMobile = DOM.getCSSVar('is-mobile');\n \n if (!isMobile)\n callback(event);\n}\n\nfunction execIfNotUL(callback, event) {\n const {target} = event;\n const {tagName} = target;\n \n if (tagName !== 'UL')\n callback(event);\n}\n\nfunction onClick(event) {\n event.preventDefault();\n changePanel(event.target);\n}\n\nfunction toggleSelect(key, files) {\n const isMac = /Mac/.test(globalThis.navigator.platform);\n \n if (!key)\n throw Error('key should not be undefined!');\n \n const [file] = files;\n \n if (isMac && key.meta)\n return DOM.toggleSelectedFile(file);\n \n if (key.shift)\n return files.map(DOM.selectFile);\n}\n\nfunction changePanel(element) {\n const Info = DOM.CurrentInfo;\n const {panel} = Info;\n const files = DOM.getByDataName('js-files', panel);\n const ul = getULElement(element);\n \n if (ul !== files)\n DOM.changePanel();\n}\n\nasync function onDblClick(event) {\n event.preventDefault();\n \n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n const path = DOM.getCurrentPath(current);\n \n if (!isDir)\n return CloudCmd.View.show();\n \n await CloudCmd.changeDir(path);\n}\n\nasync function onTouch(event) {\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n \n if (!isDir)\n return;\n \n const isCurrent = DOM.isCurrentFile(current);\n \n if (!isCurrent)\n return;\n \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 {prefixURL} = CloudCmd;\n const element = getLIElement(event.target);\n const {isDir} = 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 \n event.dataTransfer.setData('DownloadURL', 'application/octet-stream' + ':' + name +\n ':' + link);\n}\n\nfunction getLIElement(element) {\n if (!element)\n return element;\n \n while (element.tagName !== 'LI')\n element = element.parentElement;\n \n return element;\n}\n\nfunction getULElement(element) {\n while (element.tagName !== 'UL')\n element = element.parentElement;\n \n return element;\n}\n\nfunction setCurrentFileByEvent(event) {\n const Info = DOM.CurrentInfo;\n const BUTTON_LEFT = 0;\n \n const key = {\n alt: event.altKey,\n ctrl: event.ctrlKey,\n meta: event.metaKey,\n shift: event.shiftKey,\n };\n \n const element = getLIElement(event.target);\n \n const fromName = Info.name;\n DOM.setCurrentFile(element);\n const toName = Info.name;\n \n let files = [];\n \n if (key.shift)\n files = getFilesRange(fromName, toName);\n else\n files.push(Info.element);\n \n if (event.button === BUTTON_LEFT)\n toggleSelect(key, files);\n}\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 \n const indexFrom = getNameIndex(from);\n const indexTo = getNameIndex(to);\n \n return (0,_get_range_mjs__WEBPACK_IMPORTED_MODULE_6__.getRange)(indexFrom, indexTo, files);\n}\n\nfunction contextMenu() {\n const fm = DOM.getFM();\n \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 \n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addContextMenu(fm, (event) => {\n CloudCmd.Menu.ENABLED || event.preventDefault();\n });\n}\n\nfunction dragndrop() {\n const panels = DOM.getByClassAll('panel');\n const select = ({target}) => {\n target.classList.add('selected-panel');\n };\n \n const unselect = ({target}) => {\n target.classList.remove('selected-panel');\n };\n \n const onDrop = (event) => {\n const {files, items} = event.dataTransfer;\n \n const {length: filesCount} = files;\n \n event.preventDefault();\n \n if (filesCount && (!items || !items.length || !items[0].webkitGetAsEntry))\n return _dom_upload_files_js__WEBPACK_IMPORTED_MODULE_7__(files);\n \n const isFile = (item) => item.kind === 'file';\n \n const dirFiles = Array\n .from(items)\n .filter(isFile);\n \n if (dirFiles.length)\n return DOM.uploadDirectory(dirFiles);\n \n const {Operation} = CloudCmd;\n const operation = event.shiftKey ? 'move' : 'copy';\n \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 {dataTransfer} = event;\n const {effectAllowed} = dataTransfer;\n \n if (/move|linkMove/.test(effectAllowed))\n dataTransfer.dropEffect = 'move';\n else\n dataTransfer.dropEffect = 'copy';\n \n event.preventDefault();\n };\n \n for (const panel of panels)\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('dragover', panel, onDragOver)\n .add('drop', panel, onDrop)\n .add('dragenter', select)\n .add(['dragleave', 'drop'], unselect);\n}\n\nfunction unload() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add(['unload', 'beforeunload'], (event) => {\n const {Key} = CloudCmd;\n const isBind = Key?.isBind();\n \n if (isBind)\n return;\n \n event.preventDefault();\n return 'Please make sure that you saved all work.';\n });\n}\n\nfunction pop() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('popstate', async ({state}) => {\n const path = (state || '').replace(_common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_8__.FS, '');\n \n if (!path)\n return CloudCmd.route(location.hash);\n \n const history = false;\n \n await CloudCmd.changeDir(path, {\n history,\n });\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 \n if (!is)\n return;\n \n const {panel} = Info;\n const isEmptyRoot = !panel;\n \n if (isEmptyRoot)\n return;\n \n const name = panel.getAttribute('data-name');\n const isLeft = name === 'js-left';\n \n if (isLeft)\n return;\n \n DOM.changePanel();\n });\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/index.mjs\n}");
370
+ 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 _get_range_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./get-range.mjs */ \"./client/listeners/get-range.mjs\");\n/* harmony import */ var _dom_upload_files_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../dom/upload-files.js */ \"./client/dom/upload-files.js\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../common/cloudfunc.mjs */ \"./common/cloudfunc.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_mjs__WEBPACK_IMPORTED_MODULE_8__.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_6__.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 _dom_upload_files_js__WEBPACK_IMPORTED_MODULE_7__(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_mjs__WEBPACK_IMPORTED_MODULE_8__.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}");
371
371
 
372
372
  /***/ },
373
373
 
@@ -378,7 +378,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
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 */ 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\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)\n return;\n \n const {path} = params;\n \n const name = path && noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(path));\n const doBefore = params.dobefore;\n \n if (CloudCmd[name])\n return;\n \n CloudCmd[name] = async () => {\n execon__WEBPACK_IMPORTED_MODULE_0__(doBefore);\n \n const {DIR_MODULES} = CloudCmd;\n const pathFull = `${DIR_MODULES}/${path}.js`;\n \n await (0,load_js__WEBPACK_IMPORTED_MODULE_2__.js)(pathFull);\n const newModule = async (f) => f && f();\n const module = CloudCmd[name];\n \n Object.assign(newModule, module);\n \n CloudCmd[name] = newModule;\n CloudCmd.log('init', name);\n \n await module.init();\n \n return newModule;\n };\n \n CloudCmd[name].show = async (...args) => {\n CloudCmd.log('show', name, args);\n const m = CloudCmd[name];\n \n const [e, a] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.tryToCatch)(m);\n \n if (e)\n return;\n \n return await a.show(...args);\n };\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/load-module.mjs\n}");
381
+ 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}");
382
382
 
383
383
  /***/ },
384
384
 
@@ -404,25 +404,25 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.CommandLine = exports;\nconst Dialog
404
404
 
405
405
  /***/ },
406
406
 
407
- /***/ "./client/modules/config/index.js"
408
- /*!****************************************!*\
409
- !*** ./client/modules/config/index.js ***!
410
- \****************************************/
411
- (module, __unused_webpack_exports, __webpack_require__) {
407
+ /***/ "./client/modules/config/index.mjs"
408
+ /*!*****************************************!*\
409
+ !*** ./client/modules/config/index.mjs ***!
410
+ \*****************************************/
411
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
412
412
 
413
413
  "use strict";
414
- eval("{\n\n/* global CloudCmd, DOM, io */\n__webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst squad = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\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.cjs\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst input = __webpack_require__(/*! ./input */ \"./client/modules/config/input.js\");\nconst Images = __webpack_require__(/*! ../../dom/images.mjs */ \"./client/dom/images.mjs\");\nconst Events = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\nconst Files = __webpack_require__(/*! ../../dom/files */ \"./client/dom/files.js\");\nconst {\n getTitle\n} = __webpack_require__(/*! ../../../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\nconst {\n Dialog,\n setTitle\n} = DOM;\nconst Name = 'Config';\nCloudCmd[Name] = module.exports;\nconst loadSocket = promisify(DOM.loadSocket);\nconst showLoad = () => {\n Images.show.load('top');\n};\nconst addKey = currify((fn, input) => {\n Events.addKey(input, fn);\n return input;\n});\nconst addChange = currify((fn, input) => {\n Events.add('change', input, fn);\n return input;\n});\nconst Config = {};\nlet Template;\nconst loadCSS = load.css;\nmodule.exports.init = async () => {\n if (!CloudCmd.config('configDialog')) return;\n showLoad();\n const {\n DIR_DIST\n } = CloudCmd;\n [Template] = await Promise.all([Files.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(Dialog.alert, 'Wrong credentials!'));\n}\nConfig.save = saveHttp;\nmodule.exports.show = show;\nasync function show() {\n if (!CloudCmd.config('configDialog')) return;\n await fillTemplate();\n}\nasync function fillTemplate() {\n const [error, config] = await tryToCatch(Files.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.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(Template, obj);\n Element = createElement('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(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}\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nasync function onChange(el) {\n const obj = {};\n const name = input.getName(el);\n const data = input.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.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.getElementByName('username', Element);\n const elPassword = input.getElementByName('password', Element);\n elUsername.disabled = !checked;\n elPassword.disabled = !checked;\n}\nfunction onNameChange(name) {\n setTitle(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}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/config/index.js\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 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 wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var squad__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\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 load_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.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 _dom_events__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _css_config_css__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\n/* harmony import */ var _input_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./input.mjs */ \"./client/modules/config/input.mjs\");\n/* harmony import */ var _dom_images_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../dom/images.mjs */ \"./client/dom/images.mjs\");\n/* harmony import */ var _dom_files_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../dom/files.js */ \"./client/dom/files.js\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../common/cloudfunc.mjs */ \"./common/cloudfunc.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_4__.promisify)(DOM.loadSocket);\nconst showLoad = () => {\n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_11__.show.load('top');\n};\nconst addKey = currify__WEBPACK_IMPORTED_MODULE_1__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_8__.addKey(input, fn);\n return input;\n});\nconst addChange = currify__WEBPACK_IMPORTED_MODULE_1__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_8__.add('change', input, fn);\n return input;\n});\nconst Config = {};\nlet Template;\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_6__.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_js__WEBPACK_IMPORTED_MODULE_12__.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_2__(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_5__.tryToCatch)(_dom_files_js__WEBPACK_IMPORTED_MODULE_12__.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_10__.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_0__(Template, obj);\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('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_3__(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_10__.getName(el);\n const data = _input_mjs__WEBPACK_IMPORTED_MODULE_10__.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_10__.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_10__.getElementByName('username', Element);\n const elPassword = _input_mjs__WEBPACK_IMPORTED_MODULE_10__.getElementByName('password', Element);\n elUsername.disabled = !checked;\n elPassword.disabled = !checked;\n}\nfunction onNameChange(name) {\n setTitle((0,_common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_13__.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}");
415
415
 
416
416
  /***/ },
417
417
 
418
- /***/ "./client/modules/config/input.js"
419
- /*!****************************************!*\
420
- !*** ./client/modules/config/input.js ***!
421
- \****************************************/
422
- (module, __unused_webpack_exports, __webpack_require__) {
418
+ /***/ "./client/modules/config/input.mjs"
419
+ /*!*****************************************!*\
420
+ !*** ./client/modules/config/input.mjs ***!
421
+ \*****************************************/
422
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
423
423
 
424
424
  "use strict";
425
- eval("{\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isType = currify((type, object, name) => type === typeof object[name]);\nconst isBool = isType('boolean');\nmodule.exports.getElementByName = getElementByName;\nfunction getElementByName(selector, element) {\n const str = `[data-name=\"js-${selector}\"]`;\n return element.querySelector(str);\n}\nmodule.exports.getName = element => {\n const name = element.getAttribute('data-name').replace(/^js-/, '');\n return name;\n};\nmodule.exports.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}\nmodule.exports.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};\nmodule.exports.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}");
425
+ 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}");
426
426
 
427
427
  /***/ },
428
428
 
@@ -532,7 +532,7 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.Markdown = exports;\nconst createElem
532
532
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
533
533
 
534
534
  "use strict";
535
- 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\n\nconst noop = () => {};\nconst {CloudCmd} = globalThis;\n\nconst createCloudMenu = async (fm, options, menuData) => {\n const createMenu = await loadMenu();\n const menu = await createMenu(fm, options, menuData);\n \n menu.addContextMenuListener = menu.addContextMenuListener || noop;\n \n return menu;\n};\n\nasync function loadMenu() {\n if (CloudCmd.config('menu') === 'aleman') {\n const {host, protocol} = globalThis.location;\n const url = `${protocol}//${host}/node_modules/aleman/menu/menu.js`;\n const {createMenu} = await import(/* webpackIgnore: true */url);\n \n return createMenu;\n }\n \n return createSupermenu;\n}\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\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/cloudmenu.mjs\n}");
535
+ 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}");
536
536
 
537
537
  /***/ },
538
538
 
@@ -576,7 +576,7 @@ eval("{\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/c
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 */ 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_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../common/entity.js */ \"./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_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./set-listeners.mjs */ \"./client/modules/operation/set-listeners.mjs\");\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\n\nconst {DOM, CloudCmd} = globalThis;\n\nconst removeQuery = (a) => a.replace(/\\?.*/, '');\n\nconst Name = 'Operation';\n\nconst {config} = CloudCmd;\nconst {Dialog, Images} = DOM;\n\nconst authCheck = wraptile__WEBPACK_IMPORTED_MODULE_1__(_authCheck);\nconst Operation = {};\n\nlet Loaded;\n\nlet copyFn;\nlet moveFn;\nlet deleteFn;\nlet extractFn;\nlet packZipFn;\nlet packTarFn;\n\nconst Info = DOM.CurrentInfo;\nconst showLoad = Images.show.load.bind(null, 'top');\n\nconst processFiles = currify__WEBPACK_IMPORTED_MODULE_0__(_processFiles);\n\nconst noFilesCheck = () => {\n const {length} = DOM.getActiveFiles();\n const is = Boolean(!length);\n \n if (is)\n return Dialog.alert.noFiles();\n \n return is;\n};\n\nconst init = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_2__.promisify)((callback) => {\n showLoad();\n \n execon__WEBPACK_IMPORTED_MODULE_3__.series([\n DOM.loadSocket,\n async (callback) => {\n if (config('dropbox'))\n return callback();\n \n const {prefix, prefixSocket} = CloudCmd;\n \n await loadAll();\n await initOperations(prefix, prefixSocket, callback);\n },\n (callback) => {\n Loaded = true;\n Images.hide();\n callback();\n },\n ], callback);\n});\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 \n spawn.on('accept', accept(spawn));\n spawn.on('reject', alertDialog('Wrong credentials!'));\n spawn.emit('auth', config('username'), config('password'));\n}\n\nconst onConnect = currify__WEBPACK_IMPORTED_MODULE_0__((fn, operator) => {\n setOperations(operator);\n fn();\n});\n\nasync function initOperations(prefix, socketPrefix, fn) {\n socketPrefix = `${socketPrefix}/fileop`;\n \n const operator = await globalThis.fileop({\n prefix,\n socketPrefix,\n });\n \n operator.on('connect', authCheck(operator, onConnect(fn)));\n}\n\nfunction setOperations(operator) {\n packTarFn = ({from, to, names}, 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 \n operator\n .tar(from, to, names)\n .then(listen);\n };\n \n packZipFn = ({from, to, names}, 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 \n operator\n .zip(from, to, names)\n .then(listen);\n };\n \n deleteFn = (from, files, callback) => {\n from = removeQuery(from);\n \n const operation = 'Delete';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n });\n \n operator\n .remove(from, files)\n .then(listen);\n };\n \n copyFn = ({from, to, names}, 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 \n operator\n .copy(from, to, names)\n .then(listen);\n };\n \n moveFn = ({from, to, names}, 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 \n operator\n .move(from, to, names)\n .then(listen);\n };\n \n extractFn = ({from, to}, 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 \n operator\n .extract(from, to)\n .then(listen);\n };\n}\n\nfunction getPacker(type) {\n if (type === 'zip')\n return packZipFn;\n \n return packTarFn;\n}\n\nconst hide = () => {\n CloudCmd.View.hide();\n};\n\nconst show = (operation, data) => {\n if (!Loaded)\n return;\n \n if (operation === 'copy')\n return Operation.copy(data);\n \n if (operation === 'move')\n return Operation.move(data);\n \n if (operation === 'delete')\n return Operation.delete();\n \n if (operation === 'delete:silent')\n return Operation.deleteSilent();\n \n if (operation === 'pack')\n return Operation.pack();\n \n if (operation === 'extract')\n return Operation.extract();\n};\n\nOperation.copy = processFiles({\n type: 'copy',\n});\n\nOperation.move = processFiles({\n type: 'move',\n});\n\nOperation.delete = promptDelete;\n\nOperation.deleteSilent = deleteSilent;\n\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\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())\n return;\n \n const msgAsk = 'Do you really want to delete the ';\n const msgSel = 'selected ';\n \n const files = DOM.getActiveFiles();\n const names = DOM.getFilenames(files);\n const n = names.length;\n \n let msg;\n \n if (n) {\n let name = '';\n \n for (let i = 0; i < 5 && i < n; i++)\n name += '\\n' + names[i];\n \n if (n >= 5)\n name += '\\n...';\n \n msg = msgAsk + msgSel + n + ' files/directories?\\n' + (0,_common_entity_js__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 \n const type = getType(isDir) + ' ';\n \n const name = DOM.getCurrentName(current);\n \n msg = msgAsk + msgSel + type + name + '?';\n }\n \n const [cancel] = await Dialog.confirm(msg);\n \n if (cancel)\n return;\n \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 \n if (noFilesCheck())\n return;\n \n showLoad();\n \n const removedNames = DOM.getFilenames(files);\n const names = DOM.CurrentInfo.files.map(DOM.getCurrentName);\n const currentName = DOM.getCurrentName();\n const nextCurrentName = _get_next_current_name_js__WEBPACK_IMPORTED_MODULE_9__(currentName, names, removedNames);\n \n deleteFn(path + query, removedNames, async () => {\n await CloudCmd.refresh();\n \n const names = Info.files.map(DOM.getCurrentName);\n const isCurrent = names.includes(currentName);\n \n const name = isCurrent ? currentName : nextCurrentName;\n \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 \n let from = '';\n let to = '';\n \n let names = [];\n \n if (data) {\n ({\n from,\n to,\n names,\n } = data);\n \n ({panel} = 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 \n if (!names.length)\n names.push(DOM.getCurrentName());\n \n const [name] = names;\n \n const sameName = DOM.getCurrentByName(name, panel);\n \n if (!data && noFilesCheck())\n return;\n \n const {type} = options;\n \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 \n if (shouldAsk && config(option)) {\n const [cancel, newTo] = await prompt(title, to, names.map(_common_entity_js__WEBPACK_IMPORTED_MODULE_6__.encode));\n \n if (!cancel)\n ask(newTo);\n \n return;\n }\n \n ask(to);\n \n function ask(to) {\n ok = from !== to && to;\n \n if (ok && !shouldAsk || !sameName)\n return go();\n \n const str = `\"${name}\" already exist. Overwrite?`;\n const cancel = false;\n \n Dialog\n .confirm(str, {\n cancel,\n })\n .then(go);\n \n function go() {\n showLoad();\n \n files = {\n from,\n to,\n names,\n };\n \n operation(files, async () => {\n await DOM.Storage.remove(from);\n \n const {panel, panelPassive} = Info;\n \n if (!Info.isOnePanel)\n CloudCmd.refresh({\n panel: panelPassive,\n noCurrent: true,\n });\n \n CloudCmd.refresh({\n panel,\n });\n });\n }\n }\n}\n\nfunction checkEmpty(name, operation) {\n if (!operation)\n throw Error(`${name} could not be empty!`);\n}\n\nfunction twopack(operation, type) {\n let op;\n let fileFrom;\n let currentName = Info.name;\n \n const {path, dirPath} = Info;\n \n const activeFiles = DOM.getActiveFiles();\n const names = DOM.getFilenames(activeFiles);\n \n checkEmpty('operation', operation);\n \n if (!names.length)\n return Dialog.alert.noFiles();\n \n switch(operation) {\n case 'extract':\n op = extractFn;\n \n fileFrom = {\n from: path,\n to: dirPath,\n };\n \n currentName = _remove_extension_js__WEBPACK_IMPORTED_MODULE_7__(currentName);\n \n break;\n \n case 'pack':\n op = getPacker(type);\n \n if (names.length > 1)\n currentName = Info.dir;\n \n currentName += DOM.getPackerExt(type);\n \n fileFrom = {\n from: dirPath,\n to: dirPath + currentName,\n names,\n };\n break;\n }\n \n showLoad();\n \n op(fileFrom, (error) => {\n !error && CloudCmd.refresh({\n currentName,\n });\n });\n}\n\nasync function prompt(msg, to, names) {\n const n = names.length;\n const [name] = names;\n \n msg += ' ';\n \n if (names.length > 1)\n msg += `${n} file(s)`;\n else\n msg += `\"${name}\"`;\n \n msg += ' to';\n \n return await Dialog.prompt(msg, to);\n}\n\nglobalThis.CloudCmd[Name] = {\n init,\n hide,\n show,\n};\n\nasync function loadAll() {\n const {prefix} = globalThis.CloudCmd;\n const file = `${prefix}/fileop/fileop.js`;\n \n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_4__.js, file);\n \n if (error)\n Dialog.alert(error.message);\n \n Loaded = true;\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/index.mjs\n}");
579
+ 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_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../common/entity.js */ \"./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_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./set-listeners.mjs */ \"./client/modules/operation/set-listeners.mjs\");\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_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_js__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 = _get_next_current_name_js__WEBPACK_IMPORTED_MODULE_9__(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_js__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 = _remove_extension_js__WEBPACK_IMPORTED_MODULE_7__(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}");
580
580
 
581
581
  /***/ },
582
582
 
@@ -598,7 +598,7 @@ eval("{\n\nconst {\n getExt\n} = __webpack_require__(/*! ../../../common/util *
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 */ 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\n\nconst {Dialog, Images} = DOM;\n\nconst setListeners = (options) => (emitter) => {\n const {\n operation,\n callback,\n noContinue,\n from,\n to,\n } = options;\n \n let done;\n let lastError;\n \n const onAbort = wraptile__WEBPACK_IMPORTED_MODULE_1__(({emitter, operation}) => {\n emitter.abort();\n \n const msg = `${operation} aborted`;\n \n lastError = true;\n \n Dialog.alert(msg, {\n cancel: false,\n });\n });\n \n const removeListener = emitter.removeListener.bind(emitter);\n const on = emitter.on.bind(emitter);\n \n const message = _format_js__WEBPACK_IMPORTED_MODULE_2__(operation, from, to);\n const progress = Dialog.progress(message);\n \n progress.catch(onAbort({\n emitter,\n operation,\n }));\n \n let noProgress = true;\n \n const listeners = {\n progress: (value) => {\n done = value === 100;\n progress.setProgress(value);\n noProgress = false;\n },\n \n end: () => {\n Images.hide();\n for_each_key__WEBPACK_IMPORTED_MODULE_0__(removeListener, listeners);\n progress.remove();\n \n if (lastError || done || noProgress)\n callback();\n },\n \n error: async (error) => {\n lastError = error;\n \n if (noContinue) {\n listeners.end(error);\n Dialog.alert(error);\n progress.remove();\n \n return;\n }\n \n const [cancel] = await Dialog.confirm(`${error}\n Continue?`);\n \n if (!done && !cancel)\n return emitter.continue();\n \n emitter.abort();\n progress.remove();\n },\n };\n \n for_each_key__WEBPACK_IMPORTED_MODULE_0__(on, listeners);\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/set-listeners.mjs\n}");
601
+ 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 = _format_js__WEBPACK_IMPORTED_MODULE_2__(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}");
602
602
 
603
603
  /***/ },
604
604
 
@@ -741,18 +741,18 @@ eval("{\n\nconst {\n extname\n} = __webpack_require__(/*! node:path */ \"./node
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 */ 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_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom/index.js */ \"./client/dom/index.js\");\n/* global CloudCmd */\n\n\n\nconst sortPrevious = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)();\n\nconst {getPanel} = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__;\n\nconst initSortPanel = () => {\n const {sort} = CloudCmd;\n const position = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__.getPanelPosition();\n \n sortPrevious(sort[position]);\n};\n\nconst sortPanel = (name, panel = getPanel()) => {\n const {sort, order} = CloudCmd;\n const Info = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__.CurrentInfo;\n const position = panel.dataset.name.replace('js-', '');\n \n if (name !== sortPrevious())\n order[position] = 'asc';\n else if (order[position] === 'asc')\n order[position] = 'desc';\n else\n order[position] = 'asc';\n \n sortPrevious(name);\n sort[position] = name;\n const noCurrent = position !== Info.panelPosition;\n \n CloudCmd.refresh({\n panel,\n noCurrent,\n });\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/sort.mjs\n}");
744
+ 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_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom/index.js */ \"./client/dom/index.js\");\n/* global CloudCmd */\n\n\nconst sortPrevious = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)();\nconst {\n getPanel\n} = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__;\nconst initSortPanel = () => {\n const {\n sort\n } = CloudCmd;\n const position = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__.getPanelPosition();\n sortPrevious(sort[position]);\n};\nconst sortPanel = (name, panel = getPanel()) => {\n const {\n sort,\n order\n } = CloudCmd;\n const Info = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__.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}");
745
745
 
746
746
  /***/ },
747
747
 
748
- /***/ "./client/sw/register.js"
749
- /*!*******************************!*\
750
- !*** ./client/sw/register.js ***!
751
- \*******************************/
752
- (module, __unused_webpack_exports, __webpack_require__) {
748
+ /***/ "./client/sw/register.mjs"
749
+ /*!********************************!*\
750
+ !*** ./client/sw/register.mjs ***!
751
+ \********************************/
752
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
753
753
 
754
754
  "use strict";
755
- eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nmodule.exports.registerSW = registerSW;\nmodule.exports.unregisterSW = unregisterSW;\nmodule.exports.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 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}");
755
+ 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}");
756
756
 
757
757
  /***/ },
758
758
 
@@ -763,7 +763,7 @@ eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"
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 */ 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 _entity_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./entity.js */ \"./common/entity.js\");\n\n\n\n\n\nconst getHeaderField = currify__WEBPACK_IMPORTED_MODULE_1__(_getHeaderField);\n\n/* КОНСТАНТЫ (общие для клиента и сервера)*/\n/* название программы */\nconst NAME = 'Cloud Commander';\n\nconst FS = '/fs';\n\nconst Path = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\n\nPath('/');\n\nconst filterOutDotFiles = ({showDotFiles}) => ({name}) => {\n if (showDotFiles)\n return true;\n \n return !name.startsWith('.');\n};\n\nconst apiURL = '/api/v1';\nconst MAX_FILE_SIZE = 500 * 1024;\n\nconst formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n \n if (name)\n name = `(\"${name}\")`;\n \n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nconst getTitle = (options) => {\n options = options || {};\n \n const {path = Path(), name} = options;\n \n const array = [\n name || NAME,\n path,\n ];\n \n return array\n .filter(Boolean)\n .join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url)\n throw Error('url could not be empty!');\n \n if (!template)\n throw Error('template could not be empty!');\n \n const names = url\n .split('/')\n .slice(1, -1);\n \n const allNames = [\n '/',\n ...names,\n ];\n \n const lines = [];\n const n = allNames.length;\n \n let path = '/';\n \n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n \n if (i)\n path += `${name}/`;\n \n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n \n const slash = i ? '/' : '';\n \n lines.push(rendy__WEBPACK_IMPORTED_MODULE_0__(template, {\n path,\n name,\n slash,\n prefix,\n }));\n }\n \n return lines.join('');\n}\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 \n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n \n const path = (0,_entity_js__WEBPACK_IMPORTED_MODULE_3__.encode)(json.path);\n \n const {files} = json;\n \n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n \n let fileTable = rendy__WEBPACK_IMPORTED_MODULE_0__(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath,\n });\n \n const owner = 'owner';\n const mode = 'mode';\n \n const getFieldName = getHeaderField(sort, order);\n \n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n \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 \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 \n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(template.link, {\n link,\n title: '..',\n name: '..',\n });\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 \n fileTable += files\n .filter(filterOutDotFiles({\n showDotFiles,\n }))\n .map(updateField)\n .map((file) => {\n const name = (0,_entity_js__WEBPACK_IMPORTED_MODULE_3__.encode)(file.name);\n const link = prefix + FS + path + name;\n \n const {\n type,\n mode,\n date,\n owner,\n size,\n } = file;\n \n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(templateLink, {\n link,\n title: name,\n name,\n attribute: getAttribute(file.type),\n });\n \n const dataName = _getDataName(file.name);\n const attribute = `draggable=\"true\" ${dataName}`;\n \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 })\n .join('');\n \n fileTable += '</ul>';\n \n return fileTable;\n};\n\nconst updateField = (file) => ({\n ...file,\n date: file.date || '--.--.----',\n owner: file.owner || 'root',\n size: getSize(file),\n});\n\nfunction getAttribute(type) {\n if (type === 'directory')\n return '';\n \n return 'target=\"_blank\" ';\n}\n\nconst _getSize = getSize;\n\nfunction getSize({size, type}) {\n if (type === 'directory')\n return '&lt;dir&gt;';\n \n if (/link/.test(type))\n return '&lt;link&gt;';\n \n return size;\n}\n\nfunction _getHeaderField(sort, order, name) {\n const arrow = order === 'asc' ? '↑' : '↓';\n \n if (sort !== name)\n return name;\n \n if (sort === 'name' && order === 'asc')\n return name;\n \n return `${name}${arrow}`;\n}\n\nfunction getDotDot(path) {\n // убираем последний слеш и каталог в котором мы сейчас находимся\n const lastSlash = path.substr(path, path.lastIndexOf('/'));\n const dotDot = lastSlash.substr(lastSlash, lastSlash.lastIndexOf('/'));\n \n if (!dotDot)\n return '/';\n \n return dotDot;\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/cloudfunc.mjs\n}");
766
+ 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 _entity_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./entity.js */ \"./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,_entity_js__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,_entity_js__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}");
767
767
 
768
768
  /***/ },
769
769