cloudcmd 19.1.20 → 19.1.21

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_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}");
18
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudCmd: () => (/* binding */ createCloudCmd)\n/* harmony export */ });\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var format_io__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\n/* harmony import */ var just_pascal_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.mjs\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _sw_register_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./sw/register.mjs */ \"./client/sw/register.mjs\");\n/* harmony import */ var _get_json_from_file_table_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./get-json-from-file-table.mjs */ \"./client/get-json-from-file-table.mjs\");\n/* harmony import */ var _key_index_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./key/index.mjs */ \"./client/key/index.mjs\");\n/* harmony import */ var _load_module_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./load-module.mjs */ \"./client/load-module.mjs\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst noJS = a => a.replace(/.js$/, '');\nconst isDev = \"development\" === 'development';\ninherits__WEBPACK_IMPORTED_MODULE_2__(CloudCmdProto, emitify__WEBPACK_IMPORTED_MODULE_1__);\nconst createCloudCmd = ({\n DOM,\n Listeners\n}) => {\n return new CloudCmdProto({\n DOM,\n Listeners\n });\n};\nload_js__WEBPACK_IMPORTED_MODULE_4__.addErrorListener((e, src) => {\n const msg = `file ${src} could not be loaded`;\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.error(msg);\n});\nfunction CloudCmdProto({\n DOM,\n Listeners\n}) {\n emitify__WEBPACK_IMPORTED_MODULE_1__.call(this);\n const CloudCmd = this;\n const Info = DOM.CurrentInfo;\n const {\n Storage,\n Files\n } = DOM;\n this.log = () => {\n if (!isDev) return;\n };\n this.prefix = '';\n this.prefixSocket = '';\n this.prefixURL = '';\n this.MIN_ONE_PANEL_WIDTH = DOM.getCSSVar('min-one-panel-width');\n this.HOST = location.origin || location.protocol + '//' + location.host;\n this.sort = {\n left: 'name',\n right: 'name'\n };\n this.order = {\n left: 'asc',\n right: 'asc'\n };\n this.changeDir = async (path, overrides = {}) => {\n const {\n isRefresh,\n panel,\n history = true,\n noCurrent,\n currentName\n } = overrides;\n const refresh = isRefresh;\n let panelChanged;\n if (!noCurrent && panel && panel !== Info.panel) {\n DOM.changePanel();\n panelChanged = true;\n }\n let imgPosition;\n if (panelChanged || refresh || !history) imgPosition = 'top';\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load(imgPosition, panel);\n\n /* загружаем содержимое каталога */\n await ajaxLoad((0,format_io__WEBPACK_IMPORTED_MODULE_6__.addSlashToEnd)(path), {\n refresh,\n history,\n noCurrent,\n currentName,\n showDotFiles: CloudCmd.config('showDotFiles')\n }, panel);\n };\n\n /**\n * Конструктор CloudClient, который\n * выполняет весь функционал по\n * инициализации\n */\n this.init = async (prefix, config) => {\n CloudCmd.prefix = prefix;\n CloudCmd.prefixURL = `${prefix}${_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.apiURL}`;\n CloudCmd.prefixSocket = config.prefixSocket;\n CloudCmd.DIR_DIST = `${prefix}/dist`;\n CloudCmd.DIR_MODULES = `${this.DIR_DIST}/modules`;\n CloudCmd.config = key => config[key];\n CloudCmd.config.if = currify__WEBPACK_IMPORTED_MODULE_8__((key, fn, a) => config[key] && fn(a));\n CloudCmd._config = (key, value) => {\n /*\n * should be called from config.js only\n * after successful update on server\n */\n if (key === 'password') return;\n config[key] = value;\n };\n if (config.oneFilePanel) CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;\n if (!document.body.scrollIntoViewIfNeeded) await load_js__WEBPACK_IMPORTED_MODULE_4__.js(`${CloudCmd.DIR_MODULES}/polyfill.js`);\n await initModules();\n await baseInit();\n CloudCmd.route(location.hash);\n };\n this.route = path => {\n const query = path.split('/');\n if (!path) return;\n const [kebabModule] = query;\n const module = noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(kebabModule.slice(1)));\n const [, file] = query;\n const current = DOM.getCurrentByName(file);\n if (file && !current) {\n const msg = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.formatMsg)('set current file', file, 'error');\n CloudCmd.log(msg);\n return;\n }\n DOM.setCurrentFile(current);\n CloudCmd.execFromModule(module, 'show');\n };\n this.logOut = async () => {\n const url = CloudCmd.prefix + '/logout';\n const error = () => document.location.reload();\n const {\n prefix\n } = CloudCmd;\n await DOM.Storage.clear();\n (0,_sw_register_mjs__WEBPACK_IMPORTED_MODULE_11__.unregisterSW)(prefix);\n DOM.load.ajax({\n url,\n error\n });\n };\n const initModules = async () => {\n CloudCmd.Key = _key_index_mjs__WEBPACK_IMPORTED_MODULE_13__.Key;\n CloudCmd.Key.bind();\n const [, modules] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, 'modules');\n const showLoad = _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load;\n const doBefore = {\n edit: showLoad,\n menu: showLoad\n };\n const load = (name, path, dobefore) => {\n (0,_load_module_mjs__WEBPACK_IMPORTED_MODULE_14__.loadModule)({\n name,\n path,\n dobefore\n });\n };\n if (!modules) return;\n for (const module of modules.local) {\n load(null, module, doBefore[module]);\n }\n };\n async function saveCurrentName(currentName) {\n await Storage.set('current-name', currentName);\n }\n async function baseInit() {\n const files = DOM.getFiles();\n CloudCmd.on('current-file', DOM.updateCurrentInfo);\n CloudCmd.on('current-name', saveCurrentName);\n const name = await Storage.get('current-name');\n const currentFile = name && DOM.getCurrentByName(name) || files[0];\n\n /* выделяем строку с первым файлом */\n if (files) DOM.setCurrentFile(currentFile, {\n // when hash is present\n // it should be handled with this.route\n // overwre otherwise\n history: !location.hash\n });\n const dirPath = DOM.getCurrentDirPath();\n Listeners.init();\n const panels = getPanels();\n panels.forEach(Listeners.setOnPanel);\n Listeners.initKeysPanel();\n if (!CloudCmd.config('dirStorage')) return;\n const data = await Storage.get(dirPath);\n if (!data) await Storage.setJson(dirPath, (0,_get_json_from_file_table_mjs__WEBPACK_IMPORTED_MODULE_12__.getJsonFromFileTable)());\n }\n function getPanels() {\n const panels = ['left'];\n if (CloudCmd.config('oneFilePanel')) return panels;\n return [...panels, 'right'];\n }\n this.execFromModule = async (moduleName, funcName, ...args) => {\n await CloudCmd[moduleName]();\n const func = CloudCmd[moduleName][funcName];\n func(...args);\n };\n this.refresh = async (options = {}) => {\n const {\n panel = Info.panel,\n currentName\n } = options;\n const path = DOM.getCurrentDirPath(panel);\n const isRefresh = true;\n const history = false;\n const noCurrent = options === null || options === void 0 ? void 0 : options.noCurrent;\n await CloudCmd.changeDir(path, {\n isRefresh,\n history,\n panel,\n noCurrent,\n currentName\n });\n };\n\n /**\n * Функция загружает json-данные о Файловой Системе\n * через ajax-запрос.\n * @param path - каталог для чтения\n * @param options\n * { refresh, history } - необходимость обновить данные о каталоге\n * @param panel\n *\n */\n async function ajaxLoad(path, options = {}, panel) {\n const {\n RESTful\n } = DOM;\n CloudCmd.log(`reading dir: \"${path}\";`);\n const dirStorage = CloudCmd.config('dirStorage');\n const json = dirStorage && (await Storage.getJson(path));\n const name = options.currentName || Info.name;\n const {\n noCurrent,\n refresh\n } = options;\n if (!refresh && json) return await createFileTable(json, panel, options);\n const position = DOM.getPanelPosition(panel);\n const sort = CloudCmd.sort[position];\n const order = CloudCmd.order[position];\n const query = rendy__WEBPACK_IMPORTED_MODULE_3__('?sort={{ sort }}&order={{ order }}', {\n sort,\n order\n });\n const [, newObj] = await RESTful.read(path + query, 'json');\n if (!newObj)\n // that's OK, error handled by RESTful\n return;\n options.sort = sort;\n options.order = order;\n await createFileTable(newObj, panel, options);\n if (refresh && !noCurrent) DOM.setCurrentByName(name);\n if (!CloudCmd.config('dirStorage')) return;\n Storage.setJson(path, newObj);\n }\n\n /**\n * Функция строит файловую таблицу\n * @param data - данные о файлах\n * @param panelParam\n * @param options - history, noCurrent, showDotFiles\n */\n async function createFileTable(data, panelParam, options) {\n const {\n history,\n noCurrent,\n showDotFiles\n } = options;\n const names = ['file', 'path', 'link', 'pathLink'];\n const [error, [file, path, link, pathLink]] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, names);\n if (error) return DOM.Dialog.alert(error.responseText);\n const panel = panelParam || DOM.getPanel();\n const {\n prefix\n } = CloudCmd;\n const {\n dir,\n name\n } = Info;\n const {\n childNodes\n } = panel;\n let i = childNodes.length;\n while (i--) panel.removeChild(panel.lastChild);\n panel.innerHTML = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.buildFromJSON)({\n sort: options.sort,\n order: options.order,\n data,\n id: panel.id,\n prefix,\n showDotFiles,\n template: {\n file,\n path,\n pathLink,\n link\n }\n });\n Listeners.setOnPanel(panel);\n if (!noCurrent) {\n let current;\n if (name === '..' && dir !== '/') current = DOM.getCurrentByName(dir);\n if (!current) [current] = DOM.getFiles(panel);\n DOM.setCurrentFile(current, {\n history\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n }\n }\n this.goToParentDir = async () => {\n const {\n dir,\n dirPath,\n parentDirPath,\n panel\n } = Info;\n if (dirPath === parentDirPath) return;\n const path = parentDirPath;\n await CloudCmd.changeDir(path);\n const current = DOM.getCurrentByName(dir);\n const [first] = DOM.getFiles(panel);\n DOM.setCurrentFile(current || first, {\n history\n });\n };\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/client.mjs\n}");
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 _common_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _css_main_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\n/* harmony import */ var _sw_register_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sw/register.mjs */ \"./client/sw/register.mjs\");\n/* harmony import */ var _sort_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sort.mjs */ \"./client/sort.mjs\");\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_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dom/index.mjs */ \"./client/dom/index.mjs\");\n/* harmony import */ var _client_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./client.mjs */ \"./client/client.mjs\");\n/* harmony import */ var _listeners_index_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./listeners/index.mjs */ \"./client/listeners/index.mjs\");\n\n\n\n\n\n\n\n\n\n\n\nconst isDev = \"development\" === 'development';\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (init);\nglobalThis.CloudCmd = init;\nasync function init(config) {\n globalThis.CloudCmd = (0,_client_mjs__WEBPACK_IMPORTED_MODULE_9__.createCloudCmd)({\n DOM: _dom_index_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n Listeners: _listeners_index_mjs__WEBPACK_IMPORTED_MODULE_10__\n });\n globalThis.DOM = _dom_index_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"];\n globalThis.Util = _common_util__WEBPACK_IMPORTED_MODULE_3__;\n globalThis.CloudFunc = _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_7__;\n await register(config);\n (0,_sort_mjs__WEBPACK_IMPORTED_MODULE_6__.initSortPanel)();\n globalThis.CloudCmd.sortPanel = _sort_mjs__WEBPACK_IMPORTED_MODULE_6__.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_5__.registerSW)(prefix);\n (0,_sw_register_mjs__WEBPACK_IMPORTED_MODULE_5__.listenSW)(sw, 'updatefound', onUpdateFound(config));\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/cloudcmd.mjs\n}");
29
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _css_main_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _sw_register_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sw/register.mjs */ \"./client/sw/register.mjs\");\n/* harmony import */ var _sort_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./sort.mjs */ \"./client/sort.mjs\");\n/* harmony import */ var _dom_index_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dom/index.mjs */ \"./client/dom/index.mjs\");\n/* harmony import */ var _client_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./client.mjs */ \"./client/client.mjs\");\n/* harmony import */ var _listeners_index_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./listeners/index.mjs */ \"./client/listeners/index.mjs\");\n\n\n\n\n\n\n\n\n\n\n\nconst isDev = \"development\" === 'development';\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (init);\nglobalThis.CloudCmd = init;\nasync function init(config) {\n globalThis.CloudCmd = (0,_client_mjs__WEBPACK_IMPORTED_MODULE_9__.createCloudCmd)({\n DOM: _dom_index_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n Listeners: _listeners_index_mjs__WEBPACK_IMPORTED_MODULE_10__\n });\n globalThis.DOM = _dom_index_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"];\n globalThis.Util = _common_util__WEBPACK_IMPORTED_MODULE_4__;\n globalThis.CloudFunc = _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__;\n await register(config);\n (0,_sort_mjs__WEBPACK_IMPORTED_MODULE_7__.initSortPanel)();\n globalThis.CloudCmd.sortPanel = _sort_mjs__WEBPACK_IMPORTED_MODULE_7__.sortPanel;\n const prefix = getPrefix(config.prefix);\n globalThis.CloudCmd.init(prefix, config);\n if (globalThis.CloudCmd.config('menu') === 'aleman') setTimeout(() => {\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! https://esm.sh/@putout/processor-html */ \"https://esm.sh/@putout/processor-html\"));\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! https://esm.sh/@putout/bundle */ \"https://esm.sh/@putout/bundle\"));\n }, 100);\n}\nfunction getPrefix(prefix) {\n if (!prefix) return '';\n if (!prefix.indexOf('/')) return prefix;\n return `/${prefix}`;\n}\nconst onUpdateFound = wraptile__WEBPACK_IMPORTED_MODULE_2__(async config => {\n if (isDev) return;\n const {\n DOM\n } = globalThis;\n const prefix = getPrefix(config.prefix);\n await load_js__WEBPACK_IMPORTED_MODULE_3__.js(`${prefix}/dist/cloudcmd.common.js`);\n await load_js__WEBPACK_IMPORTED_MODULE_3__.js(`${prefix}/dist/cloudcmd.js`);\n console.log('cloudcmd: sw: updated');\n DOM.Events.removeAll();\n globalThis.CloudCmd(config);\n});\nasync function register(config) {\n const {\n prefix\n } = config;\n const sw = await (0,_sw_register_mjs__WEBPACK_IMPORTED_MODULE_6__.registerSW)(prefix);\n (0,_sw_register_mjs__WEBPACK_IMPORTED_MODULE_6__.listenSW)(sw, 'updatefound', onUpdateFound(config));\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/cloudcmd.mjs\n}");
30
30
 
31
31
  /***/ },
32
32
 
@@ -59,7 +59,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
59
59
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
60
60
 
61
61
  "use strict";
62
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _CURRENT_FILE: () => (/* binding */ _CURRENT_FILE),\n/* harmony export */ _parseHrefAttribute: () => (/* binding */ _parseHrefAttribute),\n/* harmony export */ _parseNameAttribute: () => (/* binding */ _parseNameAttribute),\n/* harmony export */ getCurrentByName: () => (/* binding */ getCurrentByName),\n/* harmony export */ getCurrentByPosition: () => (/* binding */ getCurrentByPosition),\n/* harmony export */ getCurrentDirName: () => (/* binding */ getCurrentDirName),\n/* harmony export */ getCurrentDirPath: () => (/* binding */ getCurrentDirPath),\n/* harmony export */ getCurrentFile: () => (/* binding */ getCurrentFile),\n/* harmony export */ getCurrentName: () => (/* binding */ getCurrentName),\n/* harmony export */ getCurrentPath: () => (/* binding */ getCurrentPath),\n/* harmony export */ getCurrentType: () => (/* binding */ getCurrentType),\n/* harmony export */ getNotCurrentDirPath: () => (/* binding */ getNotCurrentDirPath),\n/* harmony export */ getParentDirPath: () => (/* binding */ getParentDirPath),\n/* harmony export */ isCurrentFile: () => (/* binding */ isCurrentFile),\n/* harmony export */ isCurrentIsDir: () => (/* binding */ isCurrentIsDir),\n/* harmony export */ setCurrentByName: () => (/* binding */ setCurrentByName),\n/* harmony export */ setCurrentFile: () => (/* binding */ setCurrentFile),\n/* harmony export */ setCurrentName: () => (/* binding */ setCurrentName),\n/* harmony export */ setTitle: () => (/* binding */ setTitle)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_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}");
62
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _CURRENT_FILE: () => (/* binding */ _CURRENT_FILE),\n/* harmony export */ _parseHrefAttribute: () => (/* binding */ _parseHrefAttribute),\n/* harmony export */ _parseNameAttribute: () => (/* binding */ _parseNameAttribute),\n/* harmony export */ getCurrentByName: () => (/* binding */ getCurrentByName),\n/* harmony export */ getCurrentByPosition: () => (/* binding */ getCurrentByPosition),\n/* harmony export */ getCurrentDirName: () => (/* binding */ getCurrentDirName),\n/* harmony export */ getCurrentDirPath: () => (/* binding */ getCurrentDirPath),\n/* harmony export */ getCurrentFile: () => (/* binding */ getCurrentFile),\n/* harmony export */ getCurrentName: () => (/* binding */ getCurrentName),\n/* harmony export */ getCurrentPath: () => (/* binding */ getCurrentPath),\n/* harmony export */ getCurrentType: () => (/* binding */ getCurrentType),\n/* harmony export */ getNotCurrentDirPath: () => (/* binding */ getNotCurrentDirPath),\n/* harmony export */ getParentDirPath: () => (/* binding */ getParentDirPath),\n/* harmony export */ isCurrentFile: () => (/* binding */ isCurrentFile),\n/* harmony export */ isCurrentIsDir: () => (/* binding */ isCurrentIsDir),\n/* harmony export */ setCurrentByName: () => (/* binding */ setCurrentByName),\n/* harmony export */ setCurrentFile: () => (/* binding */ setCurrentFile),\n/* harmony export */ setCurrentName: () => (/* binding */ setCurrentName),\n/* harmony export */ setTitle: () => (/* binding */ setTitle)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n/* global DOM */\n/* global CloudCmd */\n\n\n\nlet Title;\nconst CURRENT_FILE = 'current-file';\nconst encodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace('\\xa0', ' ');\nconst decodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace(' ', '\\xa0');\nconst _CURRENT_FILE = CURRENT_FILE;\n\n/**\n * set name from current (or param) file\n *\n * @param name\n * @param current\n */\nconst setCurrentName = (name, current) => {\n const Info = DOM.CurrentInfo;\n const {\n link\n } = Info;\n const {\n prefix\n } = CloudCmd;\n const dir = prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS + Info.dirPath;\n const encoded = (0,_common_entity__WEBPACK_IMPORTED_MODULE_2__.encode)(name);\n link.title = encoded;\n link.href = dir + encoded;\n link.innerHTML = encoded;\n current.setAttribute('data-name', createNameAttribute(name));\n CloudCmd.emit('current-file', current);\n return link;\n};\n\n/**\n * get name from current (or param) file\n *\n * @param currentFile\n */\nconst getCurrentName = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n if (!current) return '';\n return parseNameAttribute(current.getAttribute('data-name'));\n};\n\n/**\n * Generate a `data-name` attribute for the given filename\n * @param name The string name to encode\n */\nconst createNameAttribute = name => {\n const encoded = btoa(encodeURI(name));\n return `js-file-${encoded}`;\n};\n\n/**\n * Parse a `data-name` attribute string back into the original filename\n * @param attribute The string we wish to decode\n */\nconst parseNameAttribute = attribute => {\n attribute = attribute.replace('js-file-', '');\n return decodeNBSP(decodeURI(atob(attribute)));\n};\nconst _parseNameAttribute = parseNameAttribute;\nconst parseHrefAttribute = (prefix, attribute) => {\n attribute = attribute.replace(RegExp('^' + prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS), '');\n return (0,_common_entity__WEBPACK_IMPORTED_MODULE_2__.decode)(decodeNBSP(attribute));\n};\nconst _parseHrefAttribute = parseHrefAttribute;\n\n/**\n * get current direcotory path\n */\nconst getCurrentDirPath = (panel = DOM.getPanel()) => {\n const path = DOM.getByDataName('js-path', panel);\n return path.textContent;\n};\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nconst getCurrentPath = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const [element] = DOM.getByTag('a', current);\n const {\n prefix\n } = CloudCmd;\n return parseHrefAttribute(prefix, element.getAttribute('href'));\n};\n\n/**\n * get current direcotory name\n */\nconst getCurrentDirName = () => {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n};\n\n/**\n * get current direcotory path\n */\nconst getParentDirPath = panel => {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path === '/') return path;\n return path.slice(0, index);\n};\n\n/**\n * get not current direcotory path\n */\nconst getNotCurrentDirPath = () => {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n};\n\n/**\n * unified way to get current file\n *\n * @currentFile\n */\nconst getCurrentFile = () => {\n return DOM.getByClass(CURRENT_FILE);\n};\n\n/**\n * get current file by name\n */\nconst getCurrentByName = (name, panel = DOM.CurrentInfo.panel) => {\n const dataName = 'js-file-' + btoa(encodeURI(encodeNBSP(name)));\n return DOM.getByDataName(dataName, panel);\n};\n\n/**\n * private function thet unset currentFile\n *\n * @currentFile\n */\nfunction unsetCurrentFile(currentFile) {\n const is = DOM.isCurrentFile(currentFile);\n if (!is) return;\n currentFile.classList.remove(CURRENT_FILE);\n}\n\n/**\n * unified way to set current file\n */\nconst setCurrentFile = (currentFile, options) => {\n const o = options;\n const currentFileWas = DOM.getCurrentFile();\n if (!currentFile) return DOM;\n let pathWas = '';\n if (currentFileWas) {\n pathWas = DOM.getCurrentDirPath();\n unsetCurrentFile(currentFileWas);\n }\n currentFile.classList.add(CURRENT_FILE);\n const path = DOM.getCurrentDirPath();\n const name = CloudCmd.config('name');\n if (path !== pathWas) {\n DOM.setTitle((0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.getTitle)({\n name,\n path\n }));\n\n /* history could be present\n * but it should be false\n * to prevent default behavior\n */\n if (!o || o.history) {\n const historyPath = path === '/' ? path : _common_cloudfunc__WEBPACK_IMPORTED_MODULE_1__.FS + path;\n DOM.setHistory(historyPath, null, historyPath);\n }\n }\n\n /* scrolling to current file */\n const CENTER = true;\n DOM.scrollIntoViewIfNeeded(currentFile, CENTER);\n CloudCmd.emit('current-file', currentFile);\n CloudCmd.emit('current-path', path);\n CloudCmd.emit('current-name', DOM.getCurrentName(currentFile));\n return DOM;\n};\nconst setCurrentByName = name => {\n const current = DOM.getCurrentByName(name);\n return DOM.setCurrentFile(current);\n};\n\n/*\n * set current file by position\n *\n * @param layer - element\n * @param - position {x, y}\n */\nconst getCurrentByPosition = ({\n x,\n y\n}) => {\n const element = document.elementFromPoint(x, y);\n const getEl = el => {\n const {\n tagName\n } = el;\n const isChild = /A|SPAN|LI/.test(tagName);\n if (!isChild) return null;\n if (tagName === 'A') return el.parentElement.parentElement;\n if (tagName === 'SPAN') return el.parentElement;\n return el;\n };\n const el = getEl(element);\n if (el && el.tagName !== 'LI') return null;\n return el;\n};\n\n/**\n * current file check\n *\n * @param currentFile\n */\nconst isCurrentFile = currentFile => {\n if (!currentFile) return false;\n return DOM.isContainClass(currentFile, CURRENT_FILE);\n};\n\n/**\n * set title or create title element\n *\n * @param name\n */\nconst setTitle = name => {\n if (!Title) Title = DOM.getByTag('title')[0] || _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('title', {\n innerHTML: name,\n parent: document.head\n });\n Title.textContent = name;\n return DOM;\n};\n\n/**\n * check is current file is a directory\n *\n * @param currentFile\n */\nconst isCurrentIsDir = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const fileType = DOM.getCurrentType(current);\n const isZip = path.endsWith('.zip');\n const isDir = /^directory(-link)?/.test(fileType);\n return isDir || isZip;\n};\nconst getCurrentType = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const el = DOM.getByDataName('js-type', current);\n const type = el.className.split(' ').pop();\n return type;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/current-file.mjs\n}");
63
63
 
64
64
  /***/ },
65
65
 
@@ -81,7 +81,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
81
81
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
82
82
 
83
83
  "use strict";
84
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ uploadDirectory: () => (/* binding */ uploadDirectory)\n/* harmony export */ });\n/* harmony import */ var philip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! philip */ \"./node_modules/philip/lib/philip.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _images_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./images.mjs */ \"./client/dom/images.mjs\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\n/* global DOM, CloudCmd */\n\n\n\n\nconst uploadDirectory = items => {\n if (items.length) _images_mjs__WEBPACK_IMPORTED_MODULE_2__.show('top');\n const entries = Array.from(items).map(item => item.webkitGetAsEntry());\n const dirPath = DOM.getCurrentDirPath();\n const path = dirPath.replace(/\\/$/, '');\n const progress = _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.progress('Uploading...');\n progress.catch(() => {\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert('Upload aborted');\n uploader.abort();\n });\n const uploader = philip__WEBPACK_IMPORTED_MODULE_0__(entries, (type, name, data, i, n, callback) => {\n const {\n prefixURL\n } = CloudCmd;\n const full = prefixURL + _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_3__.FS + path + name;\n let upload;\n switch (type) {\n case 'file':\n upload = uploadFile(full, data);\n break;\n case 'directory':\n upload = uploadDir(full);\n break;\n }\n upload.on('end', callback);\n upload.on('progress', count => {\n const current = percent(i, n);\n const next = percent(i + 1, n);\n const max = next - current;\n const value = current + percent(count, 100, max);\n progress.setProgress(value);\n });\n });\n uploader.on('error', error => {\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert(error);\n uploader.abort();\n });\n uploader.on('end', CloudCmd.refresh);\n};\nconst percent = (i, n, per = 100) => Math.round(i * per / n);\nconst uploadFile = (url, data) => DOM.load.put(url, data);\nconst uploadDir = url => DOM.load.put(`${url}?dir`);\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/directory.mjs\n}");
84
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ uploadDirectory: () => (/* binding */ uploadDirectory)\n/* harmony export */ });\n/* harmony import */ var philip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! philip */ \"./node_modules/philip/lib/philip.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* global DOM, CloudCmd */\n\n\n\n\nconst uploadDirectory = items => {\n if (items.length) _dom_images__WEBPACK_IMPORTED_MODULE_3__.show('top');\n const entries = Array.from(items).map(item => item.webkitGetAsEntry());\n const dirPath = DOM.getCurrentDirPath();\n const path = dirPath.replace(/\\/$/, '');\n const progress = _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.progress('Uploading...');\n progress.catch(() => {\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert('Upload aborted');\n uploader.abort();\n });\n const uploader = philip__WEBPACK_IMPORTED_MODULE_0__(entries, (type, name, data, i, n, callback) => {\n const {\n prefixURL\n } = CloudCmd;\n const full = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_2__.FS + path + name;\n let upload;\n switch (type) {\n case 'file':\n upload = uploadFile(full, data);\n break;\n case 'directory':\n upload = uploadDir(full);\n break;\n }\n upload.on('end', callback);\n upload.on('progress', count => {\n const current = percent(i, n);\n const next = percent(i + 1, n);\n const max = next - current;\n const value = current + percent(count, 100, max);\n progress.setProgress(value);\n });\n });\n uploader.on('error', error => {\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert(error);\n uploader.abort();\n });\n uploader.on('end', CloudCmd.refresh);\n};\nconst percent = (i, n, per = 100) => Math.round(i * per / n);\nconst uploadFile = (url, data) => DOM.load.put(url, data);\nconst uploadDir = url => DOM.load.put(`${url}?dir`);\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/directory.mjs\n}");
85
85
 
86
86
  /***/ },
87
87
 
@@ -147,7 +147,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
147
147
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
148
148
 
149
149
  "use strict";
150
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CurrentInfo: () => (/* binding */ CurrentInfo),\n/* harmony export */ changePanel: () => (/* binding */ changePanel),\n/* harmony export */ checkStorageHash: () => (/* binding */ checkStorageHash),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ deleteCurrent: () => (/* binding */ deleteCurrent),\n/* harmony export */ deleteSelected: () => (/* binding */ deleteSelected),\n/* harmony export */ duplicatePanel: () => (/* binding */ duplicatePanel),\n/* harmony export */ expandSelection: () => (/* binding */ expandSelection),\n/* harmony export */ getActiveFiles: () => (/* binding */ getActiveFiles),\n/* harmony export */ getAllFiles: () => (/* binding */ getAllFiles),\n/* harmony export */ getCSSVar: () => (/* binding */ getCSSVar),\n/* harmony export */ getCurrentData: () => (/* binding */ getCurrentData),\n/* harmony export */ getCurrentDate: () => (/* binding */ getCurrentDate),\n/* harmony export */ getCurrentDirName: () => (/* binding */ getCurrentDirName),\n/* harmony export */ getCurrentLink: () => (/* binding */ getCurrentLink),\n/* harmony export */ getCurrentMode: () => (/* binding */ getCurrentMode),\n/* harmony export */ getCurrentOwner: () => (/* binding */ getCurrentOwner),\n/* harmony export */ getCurrentSize: () => (/* binding */ getCurrentSize),\n/* harmony export */ getFM: () => (/* binding */ getFM),\n/* harmony export */ getFilenames: () => (/* binding */ getFilenames),\n/* harmony export */ getFiles: () => (/* binding */ getFiles),\n/* harmony export */ getNotCurrentDirPath: () => (/* binding */ getNotCurrentDirPath),\n/* harmony export */ getPackerExt: () => (/* binding */ getPackerExt),\n/* harmony export */ getPanel: () => (/* binding */ getPanel),\n/* harmony export */ getPanelPosition: () => (/* binding */ getPanelPosition),\n/* harmony export */ getParentDirPath: () => (/* binding */ getParentDirPath),\n/* harmony export */ getRefreshButton: () => (/* binding */ getRefreshButton),\n/* harmony export */ goToDirectory: () => (/* binding */ goToDirectory),\n/* harmony export */ hidePanel: () => (/* binding */ hidePanel),\n/* harmony export */ loadCurrentHash: () => (/* binding */ loadCurrentHash),\n/* harmony export */ loadCurrentSize: () => (/* binding */ loadCurrentSize),\n/* harmony export */ loadRemote: () => (/* binding */ loadRemote),\n/* harmony export */ loadSocket: () => (/* binding */ loadSocket),\n/* harmony export */ promptNewDir: () => (/* binding */ promptNewDir),\n/* harmony export */ promptNewFile: () => (/* binding */ promptNewFile),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ saveDataToStorage: () => (/* binding */ saveDataToStorage),\n/* harmony export */ scrollByPages: () => (/* binding */ scrollByPages),\n/* harmony export */ scrollIntoViewIfNeeded: () => (/* binding */ scrollIntoViewIfNeeded),\n/* harmony export */ setCurrentSize: () => (/* binding */ setCurrentSize),\n/* harmony export */ setHistory: () => (/* binding */ setHistory),\n/* harmony export */ showPanel: () => (/* binding */ showPanel),\n/* harmony export */ shrinkSelection: () => (/* binding */ shrinkSelection),\n/* harmony export */ swapPanels: () => (/* binding */ swapPanels),\n/* harmony export */ unselectFiles: () => (/* binding */ unselectFiles),\n/* harmony export */ updateCurrentInfo: () => (/* binding */ updateCurrentInfo)\n/* harmony export */ });\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _dom_storage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/storage */ \"./client/dom/storage.mjs\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\n/* harmony import */ var _images_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./images.mjs */ \"./client/dom/images.mjs\");\n/* harmony import */ var _operations_rename_current_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./operations/rename-current.mjs */ \"./client/dom/operations/rename-current.mjs\");\n/* harmony import */ var _current_file_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./current-file.mjs */ \"./client/dom/current-file.mjs\");\n/* harmony import */ var _dom_tree_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./dom-tree.mjs */ \"./client/dom/dom-tree.mjs\");\n/* harmony import */ var _cmd_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./cmd.mjs */ \"./client/dom/cmd.mjs\");\n/* harmony import */ var _io_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./io/index.js */ \"./client/dom/io/index.js\");\n/* harmony import */ var _directory_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./directory.mjs */ \"./client/dom/directory.mjs\");\n/* harmony import */ var _buffer_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./buffer.mjs */ \"./client/dom/buffer.mjs\");\n/* harmony import */ var _load_remote_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./load-remote.mjs */ \"./client/dom/load-remote.mjs\");\n/* harmony import */ var _select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./select-by-pattern.mjs */ \"./client/dom/select-by-pattern.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n assign\n} = Object;\nconst DOM = {\n getCurrentDirName,\n getNotCurrentDirPath,\n getParentDirPath,\n loadRemote,\n loadSocket,\n promptNewDir,\n promptNewFile,\n unselectFiles,\n getActiveFiles,\n getCurrentDate,\n getCurrentSize,\n loadCurrentSize,\n loadCurrentHash,\n setCurrentSize,\n getCurrentMode,\n getCurrentOwner,\n getCurrentData,\n getRefreshButton,\n getAllFiles,\n expandSelection,\n shrinkSelection,\n setHistory,\n getCurrentLink,\n getFilenames,\n checkStorageHash,\n saveDataToStorage,\n getFM,\n getPanelPosition,\n getCSSVar,\n getPanel,\n getFiles,\n showPanel,\n hidePanel,\n remove,\n deleteCurrent,\n deleteSelected,\n renameCurrent: _operations_rename_current_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n scrollIntoViewIfNeeded,\n scrollByPages,\n changePanel,\n getPackerExt,\n goToDirectory,\n duplicatePanel,\n swapPanels,\n updateCurrentInfo\n};\nassign(DOM, {\n ..._dom_tree_mjs__WEBPACK_IMPORTED_MODULE_10__,\n ..._current_file_mjs__WEBPACK_IMPORTED_MODULE_9__,\n ..._cmd_mjs__WEBPACK_IMPORTED_MODULE_11__\n});\nconst CurrentInfo = {};\nDOM.Images = _images_mjs__WEBPACK_IMPORTED_MODULE_7__;\nDOM.load = _dom_load__WEBPACK_IMPORTED_MODULE_0__;\nDOM.Files = _dom_files__WEBPACK_IMPORTED_MODULE_1__;\nDOM.RESTful = _dom_rest__WEBPACK_IMPORTED_MODULE_6__;\nDOM.IO = _io_index_js__WEBPACK_IMPORTED_MODULE_12__;\nDOM.Storage = _dom_storage__WEBPACK_IMPORTED_MODULE_5__;\nDOM.Dialog = _dom_dialog__WEBPACK_IMPORTED_MODULE_2__;\nDOM.CurrentInfo = CurrentInfo;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DOM);\nDOM.uploadDirectory = _directory_mjs__WEBPACK_IMPORTED_MODULE_13__.uploadDirectory;\nDOM.Buffer = _buffer_mjs__WEBPACK_IMPORTED_MODULE_14__;\nDOM.Events = _dom_events__WEBPACK_IMPORTED_MODULE_3__;\nconst isString = a => typeof a === 'string';\nconst TabPanel = {\n 'js-left': null,\n 'js-right': null\n};\nfunction loadRemote(name, options, callback) {\n (0,_load_remote_mjs__WEBPACK_IMPORTED_MODULE_15__.loadRemote)(name, options, callback);\n return DOM;\n}\nfunction loadSocket(callback) {\n DOM.loadRemote('socket', {\n name: 'io'\n }, callback);\n return DOM;\n}\n\n/**\n * create new folder\n *\n */\nasync function promptNewDir() {\n await promptNew('directory');\n}\n\n/**\n * create new file\n *\n * @typeName\n * @type\n */\nasync function promptNewFile() {\n await promptNew('file');\n}\nasync function promptNew(typeName) {\n const {\n Dialog\n } = DOM;\n const dir = DOM.getCurrentDirPath();\n const msg = `New ${typeName}` || 'File';\n const getName = () => {\n const name = DOM.getCurrentName();\n if (name === '..') return '';\n return name;\n };\n const name = getName();\n const [cancel, currentName] = await Dialog.prompt(msg, name);\n if (cancel) return;\n const path = `${dir}${currentName}`;\n if (typeName === 'directory') await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.createDirectory(path);else await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.write(path);\n await CloudCmd.refresh({\n currentName\n });\n}\n\n/**\n * get current directory name\n */\nfunction getCurrentDirName() {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n}\n\n/**\n * get current directory path\n */\nfunction getParentDirPath(panel) {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path !== '/') return path.slice(0, index);\n return path;\n}\n\n/**\n * get not current directory path\n */\nfunction getNotCurrentDirPath() {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n}\n\n/*\n * unselect all files\n */\nfunction unselectFiles(files) {\n files = files || DOM.getSelectedFiles();\n Array.from(files).forEach(DOM.toggleSelectedFile);\n}\n\n/**\n * get all selected files or current when none selected\n *\n * @currentFile\n */\nfunction getActiveFiles() {\n const current = DOM.getCurrentFile();\n const files = DOM.getSelectedFiles();\n const name = DOM.getCurrentName(current);\n if (!files.length && name !== '..') return [current];\n return files;\n}\nfunction getCurrentDate(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n return DOM.getByDataName('js-date', current).textContent;\n}\n\n/**\n * get size\n * @currentFile\n */\nfunction getCurrentSize(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n\n /* если это папка - возвращаем слово dir вместо размера*/\n const size = DOM.getByDataName('js-size', current).textContent.replace(/^<|>$/g, '');\n return size;\n}\n\n/**\n * get size\n * @currentFile\n */\nasync function loadCurrentSize(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?size';\n const link = DOM.getCurrentPath(current);\n _images_mjs__WEBPACK_IMPORTED_MODULE_7__.show.load();\n if (name === '..') return;\n const [, size] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(link + query);\n DOM.setCurrentSize(size, current);\n _images_mjs__WEBPACK_IMPORTED_MODULE_7__.hide();\n return current;\n}\n\n/**\n * load hash\n * @callback\n * @currentFile\n */\nasync function loadCurrentHash(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?hash';\n const link = DOM.getCurrentPath(current);\n const [, data] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(link + query);\n return data;\n}\n\n/**\n * set size\n * @currentFile\n */\nfunction setCurrentSize(size, currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const sizeElement = DOM.getByDataName('js-size', current);\n sizeElement.textContent = size;\n}\n\n/**\n * @currentFile\n */\nfunction getCurrentMode(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const mode = DOM.getByDataName('js-mode', current);\n return mode.textContent;\n}\n\n/**\n * @currentFile\n */\nfunction getCurrentOwner(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const owner = DOM.getByDataName('js-owner', current);\n return owner.textContent;\n}\n\n/**\n * unified way to get current file content\n *\n * @param currentFile\n */\nasync function getCurrentData(currentFile) {\n const {\n Dialog\n } = DOM;\n const Info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const isDir = DOM.isCurrentIsDir(current);\n if (Info.name === '..') {\n Dialog.alert.noFiles();\n return [Error('No Files')];\n }\n if (isDir) return await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(path);\n const [hashNew, hash] = await DOM.checkStorageHash(path);\n if (!hashNew) return [Error(`Can't get hash of a file`)];\n if (hash === hashNew) return [null, await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.get(`${path}-data`)];\n const [e, data] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(path);\n if (e) return [e, null];\n const ONE_MEGABYTE = 1024 ** 2 * 1024;\n const {\n length\n } = data;\n if (hash && length < ONE_MEGABYTE) await DOM.saveDataToStorage(path, data, hashNew);\n return [null, data];\n}\n\n/**\n * unified way to get RefreshButton\n */\nfunction getRefreshButton(panel = DOM.getPanel()) {\n return DOM.getByDataName('js-refresh', panel);\n}\nfunction getAllFiles() {\n const panel = DOM.getPanel();\n const files = DOM.getFiles(panel);\n const name = DOM.getCurrentName(files[0]);\n const from = a => a === '..' ? 1 : 0;\n const i = from(name);\n return Array.from(files).slice(i);\n}\n\n/**\n * open dialog with expand selection\n */\nasync function expandSelection() {\n const msg = 'expand';\n const {\n files\n } = CurrentInfo;\n await (0,_select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__.selectByPattern)(msg, files);\n}\n\n/**\n * open dialog with shrink selection\n */\nasync function shrinkSelection() {\n const msg = 'shrink';\n const {\n files\n } = CurrentInfo;\n await (0,_select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__.selectByPattern)(msg, files);\n}\n\n/**\n * setting history wrapper\n */\nfunction setHistory(data, title, url) {\n const ret = globalThis.history;\n const {\n prefix\n } = CloudCmd;\n url = prefix + url;\n if (ret) history.pushState(data, title, url);\n return ret;\n}\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nfunction getCurrentLink(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const link = DOM.getByTag('a', current);\n return link[0];\n}\nfunction getFilenames(files) {\n if (!files) throw Error('AllFiles could not be empty');\n const first = files[0] || DOM.getCurrentFile();\n const name = DOM.getCurrentName(first);\n const allFiles = Array.from(files);\n if (name === '..') allFiles.shift();\n const names = allFiles.map(current => {\n return DOM.getCurrentName(current);\n });\n return names;\n}\n\n/**\n * check storage hash\n */\nasync function checkStorageHash(name) {\n const nameHash = `${name}-hash`;\n if (!isString(name)) throw Error('name should be a string!');\n const [loadHash, storeHash] = await Promise.all([DOM.loadCurrentHash(), _dom_storage__WEBPACK_IMPORTED_MODULE_5__.get(nameHash)]);\n return [loadHash, storeHash];\n}\n\n/**\n * save data to storage\n *\n * @param name\n * @param data\n * @param hash\n */\nasync function saveDataToStorage(name, data, hash) {\n const isDir = DOM.isCurrentIsDir();\n if (isDir) return;\n hash = hash || (await DOM.loadCurrentHash());\n const nameHash = `${name}-hash`;\n const nameData = `${name}-data`;\n await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.set(nameHash, hash);\n await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.set(nameData, data);\n return hash;\n}\nfunction getFM() {\n const {\n parentElement\n } = DOM.getPanel();\n return parentElement;\n}\nfunction getPanelPosition(panel) {\n panel = panel || DOM.getPanel();\n return panel.dataset.name.replace('js-', '');\n}\nfunction getCSSVar(name, {\n body = document.body\n} = {}) {\n const bodyStyle = getComputedStyle(body);\n return bodyStyle.getPropertyValue(`--${name}`);\n}\n\n/** function getting panel active, or passive\n * @param options = {active: true}\n */\nfunction getPanel(options) {\n let files;\n let panel;\n let isLeft;\n let dataName = 'js-';\n const current = DOM.getCurrentFile();\n if (!current) {\n panel = DOM.getByDataName('js-left');\n } else {\n files = current.parentElement;\n panel = files.parentElement;\n isLeft = panel.getAttribute('data-name') === 'js-left';\n }\n\n /* if {active : false} getting passive panel */\n if (options && !options.active) {\n dataName += isLeft ? 'right' : 'left';\n panel = DOM.getByDataName(dataName);\n }\n\n /* if two panels showed\n * then always work with passive\n * panel\n */\n if (globalThis.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH) panel = DOM.getByDataName('js-left');\n if (!panel) throw Error('can not find Active Panel!');\n return panel;\n}\nfunction getFiles(element) {\n const files = DOM.getByDataName('js-files', element);\n return files.children || [];\n}\n\n/**\n * shows panel right or left (or active)\n */\nfunction showPanel(active) {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n DOM.show(panel);\n return true;\n}\n\n/**\n * hides panel right or left (or active)\n */\nfunction hidePanel(active) {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n return DOM.hide(panel);\n}\n\n/**\n * remove child of element\n * @param child\n * @param element\n */\nfunction remove(child, element) {\n const parent = element || document.body;\n parent.removeChild(child);\n return DOM;\n}\n\n/**\n * remove current file from file table\n * @param current\n *\n */\nfunction deleteCurrent(current) {\n if (!current) DOM.getCurrentFile();\n const parent = current === null || current === void 0 ? void 0 : current.parentElement;\n const name = DOM.getCurrentName(current);\n if (current && name !== '..') {\n const next = current.nextSibling;\n const prev = current.previousSibling;\n DOM.setCurrentFile(next || prev);\n parent.removeChild(current);\n }\n}\n\n/**\n * remove selected files from file table\n * @Selected\n */\nfunction deleteSelected(selected) {\n selected = selected || DOM.getSelectedFiles();\n if (!selected) return;\n selected.map(DOM.deleteCurrent);\n}\n\n/**\n * rename current file\n *\n * @currentFile\n */\nfunction scrollIntoViewIfNeeded(element, center = false) {\n if (!element || !element.scrollIntoViewIfNeeded) return;\n element.scrollIntoViewIfNeeded(center);\n}\n\n/* scroll on one page */\nfunction scrollByPages(element, pPages) {\n const ret = (element === null || element === void 0 ? void 0 : element.scrollByPages) && pPages;\n if (ret) element.scrollByPages(pPages);\n return ret;\n}\nfunction changePanel() {\n const Info = CurrentInfo;\n let panel = DOM.getPanel();\n CloudCmd.emit('passive-dir', Info.dirPath);\n const panelPassive = DOM.getPanel({\n active: false\n });\n let name = DOM.getCurrentName();\n const filesPassive = DOM.getFiles(panelPassive);\n let dataName = panel.getAttribute('data-name');\n TabPanel[dataName] = name;\n panel = panelPassive;\n dataName = panel.getAttribute('data-name');\n name = TabPanel[dataName];\n let files;\n let current;\n if (name) {\n current = DOM.getCurrentByName(name, panel);\n if (current) files = current.parentElement;\n }\n if (!files || !files.parentElement) {\n current = DOM.getCurrentByName(name, panel);\n if (!current) [current] = filesPassive;\n }\n DOM.setCurrentFile(current, {\n history: true\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n return DOM;\n}\nfunction getPackerExt(type) {\n if (type === 'zip') return '.zip';\n return '.tar.gz';\n}\nasync function goToDirectory(overrides = {}) {\n const {\n Dialog\n } = DOM;\n const {\n prompt = Dialog.prompt,\n changeDir = CloudCmd.changeDir\n } = overrides;\n const msg = 'Go to directory:';\n const {\n dirPath\n } = CurrentInfo;\n const [cancel, path = dirPath] = await prompt(msg, dirPath);\n if (cancel) return;\n await changeDir(path);\n}\nasync function duplicatePanel() {\n const Info = CurrentInfo;\n const {\n isDir\n } = Info;\n const panel = Info.panelPassive;\n const noCurrent = !Info.isOnePanel;\n const getPath = isDir => {\n if (isDir) return Info.path;\n return Info.dirPath;\n };\n const path = getPath(isDir);\n await CloudCmd.changeDir(path, {\n panel,\n noCurrent\n });\n}\nasync function swapPanels() {\n const Info = CurrentInfo;\n const {\n panel,\n files,\n element,\n panelPassive\n } = Info;\n const path = DOM.getCurrentDirPath();\n const dirPathPassive = DOM.getNotCurrentDirPath();\n let currentIndex = files.indexOf(element);\n await CloudCmd.changeDir(path, {\n panel: panelPassive,\n noCurrent: true\n });\n await CloudCmd.changeDir(dirPathPassive, {\n panel\n });\n const length = Info.files.length - 1;\n if (currentIndex > length) currentIndex = length;\n const el = Info.files[currentIndex];\n DOM.setCurrentFile(el);\n}\nfunction updateCurrentInfo(currentFile) {\n const info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const files = current.parentElement;\n const panelPassive = DOM.getPanel({\n active: false\n });\n const filesPassive = DOM.getFiles(panelPassive);\n const name = DOM.getCurrentName(current);\n info.dir = DOM.getCurrentDirName();\n info.dirPath = DOM.getCurrentDirPath();\n info.parentDirPath = DOM.getParentDirPath();\n info.element = current;\n info.ext = (0,_common_util__WEBPACK_IMPORTED_MODULE_4__.getExt)(name);\n info.files = Array.from(files.children);\n info.filesPassive = Array.from(filesPassive);\n info.first = files.firstChild;\n info.getData = DOM.getCurrentData;\n info.last = files.lastChild;\n info.link = DOM.getCurrentLink(current);\n info.mode = DOM.getCurrentMode(current);\n info.name = name;\n info.path = DOM.getCurrentPath(current);\n info.panel = files.parentElement || DOM.getPanel();\n info.panelPassive = panelPassive;\n info.size = DOM.getCurrentSize(current);\n info.isDir = DOM.isCurrentIsDir();\n info.isSelected = DOM.isSelected(current);\n info.panelPosition = DOM.getPanel().dataset.name.replace('js-', '');\n info.isOnePanel = info.panel.getAttribute('data-name') === info.panelPassive.getAttribute('data-name');\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/index.mjs\n}");
150
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CurrentInfo: () => (/* binding */ CurrentInfo),\n/* harmony export */ changePanel: () => (/* binding */ changePanel),\n/* harmony export */ checkStorageHash: () => (/* binding */ checkStorageHash),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ deleteCurrent: () => (/* binding */ deleteCurrent),\n/* harmony export */ deleteSelected: () => (/* binding */ deleteSelected),\n/* harmony export */ duplicatePanel: () => (/* binding */ duplicatePanel),\n/* harmony export */ expandSelection: () => (/* binding */ expandSelection),\n/* harmony export */ getActiveFiles: () => (/* binding */ getActiveFiles),\n/* harmony export */ getAllFiles: () => (/* binding */ getAllFiles),\n/* harmony export */ getCSSVar: () => (/* binding */ getCSSVar),\n/* harmony export */ getCurrentData: () => (/* binding */ getCurrentData),\n/* harmony export */ getCurrentDate: () => (/* binding */ getCurrentDate),\n/* harmony export */ getCurrentDirName: () => (/* binding */ getCurrentDirName),\n/* harmony export */ getCurrentLink: () => (/* binding */ getCurrentLink),\n/* harmony export */ getCurrentMode: () => (/* binding */ getCurrentMode),\n/* harmony export */ getCurrentOwner: () => (/* binding */ getCurrentOwner),\n/* harmony export */ getCurrentSize: () => (/* binding */ getCurrentSize),\n/* harmony export */ getFM: () => (/* binding */ getFM),\n/* harmony export */ getFilenames: () => (/* binding */ getFilenames),\n/* harmony export */ getFiles: () => (/* binding */ getFiles),\n/* harmony export */ getNotCurrentDirPath: () => (/* binding */ getNotCurrentDirPath),\n/* harmony export */ getPackerExt: () => (/* binding */ getPackerExt),\n/* harmony export */ getPanel: () => (/* binding */ getPanel),\n/* harmony export */ getPanelPosition: () => (/* binding */ getPanelPosition),\n/* harmony export */ getParentDirPath: () => (/* binding */ getParentDirPath),\n/* harmony export */ getRefreshButton: () => (/* binding */ getRefreshButton),\n/* harmony export */ goToDirectory: () => (/* binding */ goToDirectory),\n/* harmony export */ hidePanel: () => (/* binding */ hidePanel),\n/* harmony export */ loadCurrentHash: () => (/* binding */ loadCurrentHash),\n/* harmony export */ loadCurrentSize: () => (/* binding */ loadCurrentSize),\n/* harmony export */ loadRemote: () => (/* binding */ loadRemote),\n/* harmony export */ loadSocket: () => (/* binding */ loadSocket),\n/* harmony export */ promptNewDir: () => (/* binding */ promptNewDir),\n/* harmony export */ promptNewFile: () => (/* binding */ promptNewFile),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ saveDataToStorage: () => (/* binding */ saveDataToStorage),\n/* harmony export */ scrollByPages: () => (/* binding */ scrollByPages),\n/* harmony export */ scrollIntoViewIfNeeded: () => (/* binding */ scrollIntoViewIfNeeded),\n/* harmony export */ setCurrentSize: () => (/* binding */ setCurrentSize),\n/* harmony export */ setHistory: () => (/* binding */ setHistory),\n/* harmony export */ showPanel: () => (/* binding */ showPanel),\n/* harmony export */ shrinkSelection: () => (/* binding */ shrinkSelection),\n/* harmony export */ swapPanels: () => (/* binding */ swapPanels),\n/* harmony export */ unselectFiles: () => (/* binding */ unselectFiles),\n/* harmony export */ updateCurrentInfo: () => (/* binding */ updateCurrentInfo)\n/* harmony export */ });\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _dom_storage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/storage */ \"./client/dom/storage.mjs\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _operations_rename_current_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./operations/rename-current.mjs */ \"./client/dom/operations/rename-current.mjs\");\n/* harmony import */ var _current_file_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./current-file.mjs */ \"./client/dom/current-file.mjs\");\n/* harmony import */ var _dom_tree_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./dom-tree.mjs */ \"./client/dom/dom-tree.mjs\");\n/* harmony import */ var _cmd_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./cmd.mjs */ \"./client/dom/cmd.mjs\");\n/* harmony import */ var _io_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./io/index.js */ \"./client/dom/io/index.js\");\n/* harmony import */ var _directory_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./directory.mjs */ \"./client/dom/directory.mjs\");\n/* harmony import */ var _buffer_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./buffer.mjs */ \"./client/dom/buffer.mjs\");\n/* harmony import */ var _load_remote_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./load-remote.mjs */ \"./client/dom/load-remote.mjs\");\n/* harmony import */ var _select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./select-by-pattern.mjs */ \"./client/dom/select-by-pattern.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n assign\n} = Object;\nconst DOM = {\n getCurrentDirName,\n getNotCurrentDirPath,\n getParentDirPath,\n loadRemote,\n loadSocket,\n promptNewDir,\n promptNewFile,\n unselectFiles,\n getActiveFiles,\n getCurrentDate,\n getCurrentSize,\n loadCurrentSize,\n loadCurrentHash,\n setCurrentSize,\n getCurrentMode,\n getCurrentOwner,\n getCurrentData,\n getRefreshButton,\n getAllFiles,\n expandSelection,\n shrinkSelection,\n setHistory,\n getCurrentLink,\n getFilenames,\n checkStorageHash,\n saveDataToStorage,\n getFM,\n getPanelPosition,\n getCSSVar,\n getPanel,\n getFiles,\n showPanel,\n hidePanel,\n remove,\n deleteCurrent,\n deleteSelected,\n renameCurrent: _operations_rename_current_mjs__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n scrollIntoViewIfNeeded,\n scrollByPages,\n changePanel,\n getPackerExt,\n goToDirectory,\n duplicatePanel,\n swapPanels,\n updateCurrentInfo\n};\nassign(DOM, {\n ..._dom_tree_mjs__WEBPACK_IMPORTED_MODULE_10__,\n ..._current_file_mjs__WEBPACK_IMPORTED_MODULE_9__,\n ..._cmd_mjs__WEBPACK_IMPORTED_MODULE_11__\n});\nconst CurrentInfo = {};\nDOM.Images = _dom_images__WEBPACK_IMPORTED_MODULE_7__;\nDOM.load = _dom_load__WEBPACK_IMPORTED_MODULE_0__;\nDOM.Files = _dom_files__WEBPACK_IMPORTED_MODULE_1__;\nDOM.RESTful = _dom_rest__WEBPACK_IMPORTED_MODULE_6__;\nDOM.IO = _io_index_js__WEBPACK_IMPORTED_MODULE_12__;\nDOM.Storage = _dom_storage__WEBPACK_IMPORTED_MODULE_5__;\nDOM.Dialog = _dom_dialog__WEBPACK_IMPORTED_MODULE_2__;\nDOM.CurrentInfo = CurrentInfo;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DOM);\nDOM.uploadDirectory = _directory_mjs__WEBPACK_IMPORTED_MODULE_13__.uploadDirectory;\nDOM.Buffer = _buffer_mjs__WEBPACK_IMPORTED_MODULE_14__;\nDOM.Events = _dom_events__WEBPACK_IMPORTED_MODULE_3__;\nconst isString = a => typeof a === 'string';\nconst TabPanel = {\n 'js-left': null,\n 'js-right': null\n};\nfunction loadRemote(name, options, callback) {\n (0,_load_remote_mjs__WEBPACK_IMPORTED_MODULE_15__.loadRemote)(name, options, callback);\n return DOM;\n}\nfunction loadSocket(callback) {\n DOM.loadRemote('socket', {\n name: 'io'\n }, callback);\n return DOM;\n}\n\n/**\n * create new folder\n *\n */\nasync function promptNewDir() {\n await promptNew('directory');\n}\n\n/**\n * create new file\n *\n * @typeName\n * @type\n */\nasync function promptNewFile() {\n await promptNew('file');\n}\nasync function promptNew(typeName) {\n const {\n Dialog\n } = DOM;\n const dir = DOM.getCurrentDirPath();\n const msg = `New ${typeName}` || 'File';\n const getName = () => {\n const name = DOM.getCurrentName();\n if (name === '..') return '';\n return name;\n };\n const name = getName();\n const [cancel, currentName] = await Dialog.prompt(msg, name);\n if (cancel) return;\n const path = `${dir}${currentName}`;\n if (typeName === 'directory') await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.createDirectory(path);else await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.write(path);\n await CloudCmd.refresh({\n currentName\n });\n}\n\n/**\n * get current directory name\n */\nfunction getCurrentDirName() {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n}\n\n/**\n * get current directory path\n */\nfunction getParentDirPath(panel) {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path !== '/') return path.slice(0, index);\n return path;\n}\n\n/**\n * get not current directory path\n */\nfunction getNotCurrentDirPath() {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n}\n\n/*\n * unselect all files\n */\nfunction unselectFiles(files) {\n files = files || DOM.getSelectedFiles();\n Array.from(files).forEach(DOM.toggleSelectedFile);\n}\n\n/**\n * get all selected files or current when none selected\n *\n * @currentFile\n */\nfunction getActiveFiles() {\n const current = DOM.getCurrentFile();\n const files = DOM.getSelectedFiles();\n const name = DOM.getCurrentName(current);\n if (!files.length && name !== '..') return [current];\n return files;\n}\nfunction getCurrentDate(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n return DOM.getByDataName('js-date', current).textContent;\n}\n\n/**\n * get size\n * @currentFile\n */\nfunction getCurrentSize(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n\n /* если это папка - возвращаем слово dir вместо размера*/\n const size = DOM.getByDataName('js-size', current).textContent.replace(/^<|>$/g, '');\n return size;\n}\n\n/**\n * get size\n * @currentFile\n */\nasync function loadCurrentSize(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?size';\n const link = DOM.getCurrentPath(current);\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.show.load();\n if (name === '..') return;\n const [, size] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(link + query);\n DOM.setCurrentSize(size, current);\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.hide();\n return current;\n}\n\n/**\n * load hash\n * @callback\n * @currentFile\n */\nasync function loadCurrentHash(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?hash';\n const link = DOM.getCurrentPath(current);\n const [, data] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(link + query);\n return data;\n}\n\n/**\n * set size\n * @currentFile\n */\nfunction setCurrentSize(size, currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const sizeElement = DOM.getByDataName('js-size', current);\n sizeElement.textContent = size;\n}\n\n/**\n * @currentFile\n */\nfunction getCurrentMode(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const mode = DOM.getByDataName('js-mode', current);\n return mode.textContent;\n}\n\n/**\n * @currentFile\n */\nfunction getCurrentOwner(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const owner = DOM.getByDataName('js-owner', current);\n return owner.textContent;\n}\n\n/**\n * unified way to get current file content\n *\n * @param currentFile\n */\nasync function getCurrentData(currentFile) {\n const {\n Dialog\n } = DOM;\n const Info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const isDir = DOM.isCurrentIsDir(current);\n if (Info.name === '..') {\n Dialog.alert.noFiles();\n return [Error('No Files')];\n }\n if (isDir) return await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(path);\n const [hashNew, hash] = await DOM.checkStorageHash(path);\n if (!hashNew) return [Error(`Can't get hash of a file`)];\n if (hash === hashNew) return [null, await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.get(`${path}-data`)];\n const [e, data] = await _dom_rest__WEBPACK_IMPORTED_MODULE_6__.read(path);\n if (e) return [e, null];\n const ONE_MEGABYTE = 1024 ** 2 * 1024;\n const {\n length\n } = data;\n if (hash && length < ONE_MEGABYTE) await DOM.saveDataToStorage(path, data, hashNew);\n return [null, data];\n}\n\n/**\n * unified way to get RefreshButton\n */\nfunction getRefreshButton(panel = DOM.getPanel()) {\n return DOM.getByDataName('js-refresh', panel);\n}\nfunction getAllFiles() {\n const panel = DOM.getPanel();\n const files = DOM.getFiles(panel);\n const name = DOM.getCurrentName(files[0]);\n const from = a => a === '..' ? 1 : 0;\n const i = from(name);\n return Array.from(files).slice(i);\n}\n\n/**\n * open dialog with expand selection\n */\nasync function expandSelection() {\n const msg = 'expand';\n const {\n files\n } = CurrentInfo;\n await (0,_select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__.selectByPattern)(msg, files);\n}\n\n/**\n * open dialog with shrink selection\n */\nasync function shrinkSelection() {\n const msg = 'shrink';\n const {\n files\n } = CurrentInfo;\n await (0,_select_by_pattern_mjs__WEBPACK_IMPORTED_MODULE_16__.selectByPattern)(msg, files);\n}\n\n/**\n * setting history wrapper\n */\nfunction setHistory(data, title, url) {\n const ret = globalThis.history;\n const {\n prefix\n } = CloudCmd;\n url = prefix + url;\n if (ret) history.pushState(data, title, url);\n return ret;\n}\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nfunction getCurrentLink(currentFile) {\n const current = currentFile || DOM.getCurrentFile();\n const link = DOM.getByTag('a', current);\n return link[0];\n}\nfunction getFilenames(files) {\n if (!files) throw Error('AllFiles could not be empty');\n const first = files[0] || DOM.getCurrentFile();\n const name = DOM.getCurrentName(first);\n const allFiles = Array.from(files);\n if (name === '..') allFiles.shift();\n const names = allFiles.map(current => {\n return DOM.getCurrentName(current);\n });\n return names;\n}\n\n/**\n * check storage hash\n */\nasync function checkStorageHash(name) {\n const nameHash = `${name}-hash`;\n if (!isString(name)) throw Error('name should be a string!');\n const [loadHash, storeHash] = await Promise.all([DOM.loadCurrentHash(), _dom_storage__WEBPACK_IMPORTED_MODULE_5__.get(nameHash)]);\n return [loadHash, storeHash];\n}\n\n/**\n * save data to storage\n *\n * @param name\n * @param data\n * @param hash\n */\nasync function saveDataToStorage(name, data, hash) {\n const isDir = DOM.isCurrentIsDir();\n if (isDir) return;\n hash = hash || (await DOM.loadCurrentHash());\n const nameHash = `${name}-hash`;\n const nameData = `${name}-data`;\n await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.set(nameHash, hash);\n await _dom_storage__WEBPACK_IMPORTED_MODULE_5__.set(nameData, data);\n return hash;\n}\nfunction getFM() {\n const {\n parentElement\n } = DOM.getPanel();\n return parentElement;\n}\nfunction getPanelPosition(panel) {\n panel = panel || DOM.getPanel();\n return panel.dataset.name.replace('js-', '');\n}\nfunction getCSSVar(name, {\n body = document.body\n} = {}) {\n const bodyStyle = getComputedStyle(body);\n return bodyStyle.getPropertyValue(`--${name}`);\n}\n\n/** function getting panel active, or passive\n * @param options = {active: true}\n */\nfunction getPanel(options) {\n let files;\n let panel;\n let isLeft;\n let dataName = 'js-';\n const current = DOM.getCurrentFile();\n if (!current) {\n panel = DOM.getByDataName('js-left');\n } else {\n files = current.parentElement;\n panel = files.parentElement;\n isLeft = panel.getAttribute('data-name') === 'js-left';\n }\n\n /* if {active : false} getting passive panel */\n if (options && !options.active) {\n dataName += isLeft ? 'right' : 'left';\n panel = DOM.getByDataName(dataName);\n }\n\n /* if two panels showed\n * then always work with passive\n * panel\n */\n if (globalThis.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH) panel = DOM.getByDataName('js-left');\n if (!panel) throw Error('can not find Active Panel!');\n return panel;\n}\nfunction getFiles(element) {\n const files = DOM.getByDataName('js-files', element);\n return files.children || [];\n}\n\n/**\n * shows panel right or left (or active)\n */\nfunction showPanel(active) {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n DOM.show(panel);\n return true;\n}\n\n/**\n * hides panel right or left (or active)\n */\nfunction hidePanel(active) {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n return DOM.hide(panel);\n}\n\n/**\n * remove child of element\n * @param child\n * @param element\n */\nfunction remove(child, element) {\n const parent = element || document.body;\n parent.removeChild(child);\n return DOM;\n}\n\n/**\n * remove current file from file table\n * @param current\n *\n */\nfunction deleteCurrent(current) {\n if (!current) DOM.getCurrentFile();\n const parent = current === null || current === void 0 ? void 0 : current.parentElement;\n const name = DOM.getCurrentName(current);\n if (current && name !== '..') {\n const next = current.nextSibling;\n const prev = current.previousSibling;\n DOM.setCurrentFile(next || prev);\n parent.removeChild(current);\n }\n}\n\n/**\n * remove selected files from file table\n * @Selected\n */\nfunction deleteSelected(selected) {\n selected = selected || DOM.getSelectedFiles();\n if (!selected) return;\n selected.map(DOM.deleteCurrent);\n}\n\n/**\n * rename current file\n *\n * @currentFile\n */\nfunction scrollIntoViewIfNeeded(element, center = false) {\n if (!element || !element.scrollIntoViewIfNeeded) return;\n element.scrollIntoViewIfNeeded(center);\n}\n\n/* scroll on one page */\nfunction scrollByPages(element, pPages) {\n const ret = (element === null || element === void 0 ? void 0 : element.scrollByPages) && pPages;\n if (ret) element.scrollByPages(pPages);\n return ret;\n}\nfunction changePanel() {\n const Info = CurrentInfo;\n let panel = DOM.getPanel();\n CloudCmd.emit('passive-dir', Info.dirPath);\n const panelPassive = DOM.getPanel({\n active: false\n });\n let name = DOM.getCurrentName();\n const filesPassive = DOM.getFiles(panelPassive);\n let dataName = panel.getAttribute('data-name');\n TabPanel[dataName] = name;\n panel = panelPassive;\n dataName = panel.getAttribute('data-name');\n name = TabPanel[dataName];\n let files;\n let current;\n if (name) {\n current = DOM.getCurrentByName(name, panel);\n if (current) files = current.parentElement;\n }\n if (!files || !files.parentElement) {\n current = DOM.getCurrentByName(name, panel);\n if (!current) [current] = filesPassive;\n }\n DOM.setCurrentFile(current, {\n history: true\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n return DOM;\n}\nfunction getPackerExt(type) {\n if (type === 'zip') return '.zip';\n return '.tar.gz';\n}\nasync function goToDirectory(overrides = {}) {\n const {\n Dialog\n } = DOM;\n const {\n prompt = Dialog.prompt,\n changeDir = CloudCmd.changeDir\n } = overrides;\n const msg = 'Go to directory:';\n const {\n dirPath\n } = CurrentInfo;\n const [cancel, path = dirPath] = await prompt(msg, dirPath);\n if (cancel) return;\n await changeDir(path);\n}\nasync function duplicatePanel() {\n const Info = CurrentInfo;\n const {\n isDir\n } = Info;\n const panel = Info.panelPassive;\n const noCurrent = !Info.isOnePanel;\n const getPath = isDir => {\n if (isDir) return Info.path;\n return Info.dirPath;\n };\n const path = getPath(isDir);\n await CloudCmd.changeDir(path, {\n panel,\n noCurrent\n });\n}\nasync function swapPanels() {\n const Info = CurrentInfo;\n const {\n panel,\n files,\n element,\n panelPassive\n } = Info;\n const path = DOM.getCurrentDirPath();\n const dirPathPassive = DOM.getNotCurrentDirPath();\n let currentIndex = files.indexOf(element);\n await CloudCmd.changeDir(path, {\n panel: panelPassive,\n noCurrent: true\n });\n await CloudCmd.changeDir(dirPathPassive, {\n panel\n });\n const length = Info.files.length - 1;\n if (currentIndex > length) currentIndex = length;\n const el = Info.files[currentIndex];\n DOM.setCurrentFile(el);\n}\nfunction updateCurrentInfo(currentFile) {\n const info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const files = current.parentElement;\n const panelPassive = DOM.getPanel({\n active: false\n });\n const filesPassive = DOM.getFiles(panelPassive);\n const name = DOM.getCurrentName(current);\n info.dir = DOM.getCurrentDirName();\n info.dirPath = DOM.getCurrentDirPath();\n info.parentDirPath = DOM.getParentDirPath();\n info.element = current;\n info.ext = (0,_common_util__WEBPACK_IMPORTED_MODULE_4__.getExt)(name);\n info.files = Array.from(files.children);\n info.filesPassive = Array.from(filesPassive);\n info.first = files.firstChild;\n info.getData = DOM.getCurrentData;\n info.last = files.lastChild;\n info.link = DOM.getCurrentLink(current);\n info.mode = DOM.getCurrentMode(current);\n info.name = name;\n info.path = DOM.getCurrentPath(current);\n info.panel = files.parentElement || DOM.getPanel();\n info.panelPassive = panelPassive;\n info.size = DOM.getCurrentSize(current);\n info.isDir = DOM.isCurrentIsDir();\n info.isSelected = DOM.isSelected(current);\n info.panelPosition = DOM.getPanel().dataset.name.replace('js-', '');\n info.isOnePanel = info.panel.getAttribute('data-name') === info.panelPassive.getAttribute('data-name');\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/index.mjs\n}");
151
151
 
152
152
  /***/ },
153
153
 
@@ -158,7 +158,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
158
158
  (module, __unused_webpack_exports, __webpack_require__) {
159
159
 
160
160
  "use strict";
161
- eval("{\n\nconst {\n FS\n} = __webpack_require__(/*! ../../../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\nconst _sendRequest = __webpack_require__(/*! ./send-request */ \"./client/dom/io/send-request.js\");\nconst imgPosition = {\n top: true\n};\nmodule.exports[\"delete\"] = async (url, data) => {\n return await _sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n imgPosition: {\n top: Boolean(data)\n }\n });\n};\nmodule.exports.patch = async (url, data) => {\n return await _sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n imgPosition\n });\n};\nmodule.exports.write = async (url, data) => {\n return await _sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n imgPosition\n });\n};\nmodule.exports.createDirectory = async (url, overrides = {}) => {\n const {\n sendRequest = _sendRequest\n } = overrides;\n return await sendRequest({\n method: 'PUT',\n url: `${FS}${url}?dir`,\n imgPosition\n });\n};\nmodule.exports.read = async (url, dataType = 'text') => {\n const notLog = !url.includes('?');\n return await _sendRequest({\n method: 'GET',\n url: FS + url,\n notLog,\n dataType\n });\n};\nmodule.exports.copy = async (from, to, names) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/copy',\n data: {\n from,\n to,\n names\n },\n imgPosition\n });\n};\nmodule.exports.pack = async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/pack',\n data\n });\n};\nmodule.exports.extract = async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/extract',\n data\n });\n};\nmodule.exports.move = async (from, to, names) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/move',\n data: {\n from,\n to,\n names\n },\n imgPosition\n });\n};\nmodule.exports.rename = async (from, to) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/rename',\n data: {\n from,\n to\n },\n imgPosition\n });\n};\nmodule.exports.Config = {\n read: async () => {\n return await _sendRequest({\n method: 'GET',\n url: '/config',\n imgPosition,\n notLog: true\n });\n },\n write: async data => {\n return await _sendRequest({\n method: 'PATCH',\n url: '/config',\n data,\n imgPosition\n });\n }\n};\nmodule.exports.Markdown = {\n read: async url => {\n return await _sendRequest({\n method: 'GET',\n url: `/markdown${url}`,\n imgPosition,\n notLog: true\n });\n },\n render: async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/markdown',\n data,\n imgPosition,\n notLog: true\n });\n }\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/io/index.js\n}");
161
+ eval("{\n\nconst {\n FS\n} = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\nconst _sendRequest = __webpack_require__(/*! ./send-request */ \"./client/dom/io/send-request.js\");\nconst imgPosition = {\n top: true\n};\nmodule.exports[\"delete\"] = async (url, data) => {\n return await _sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n imgPosition: {\n top: Boolean(data)\n }\n });\n};\nmodule.exports.patch = async (url, data) => {\n return await _sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n imgPosition\n });\n};\nmodule.exports.write = async (url, data) => {\n return await _sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n imgPosition\n });\n};\nmodule.exports.createDirectory = async (url, overrides = {}) => {\n const {\n sendRequest = _sendRequest\n } = overrides;\n return await sendRequest({\n method: 'PUT',\n url: `${FS}${url}?dir`,\n imgPosition\n });\n};\nmodule.exports.read = async (url, dataType = 'text') => {\n const notLog = !url.includes('?');\n return await _sendRequest({\n method: 'GET',\n url: FS + url,\n notLog,\n dataType\n });\n};\nmodule.exports.copy = async (from, to, names) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/copy',\n data: {\n from,\n to,\n names\n },\n imgPosition\n });\n};\nmodule.exports.pack = async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/pack',\n data\n });\n};\nmodule.exports.extract = async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/extract',\n data\n });\n};\nmodule.exports.move = async (from, to, names) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/move',\n data: {\n from,\n to,\n names\n },\n imgPosition\n });\n};\nmodule.exports.rename = async (from, to) => {\n return await _sendRequest({\n method: 'PUT',\n url: '/rename',\n data: {\n from,\n to\n },\n imgPosition\n });\n};\nmodule.exports.Config = {\n read: async () => {\n return await _sendRequest({\n method: 'GET',\n url: '/config',\n imgPosition,\n notLog: true\n });\n },\n write: async data => {\n return await _sendRequest({\n method: 'PATCH',\n url: '/config',\n data,\n imgPosition\n });\n }\n};\nmodule.exports.Markdown = {\n read: async url => {\n return await _sendRequest({\n method: 'GET',\n url: `/markdown${url}`,\n imgPosition,\n notLog: true\n });\n },\n render: async data => {\n return await _sendRequest({\n method: 'PUT',\n url: '/markdown',\n data,\n imgPosition,\n notLog: true\n });\n }\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/io/index.js\n}");
162
162
 
163
163
  /***/ },
164
164
 
@@ -169,7 +169,7 @@ eval("{\n\nconst {\n FS\n} = __webpack_require__(/*! ../../../common/cloudfunc.
169
169
  (module, __unused_webpack_exports, __webpack_require__) {
170
170
 
171
171
  "use strict";
172
- eval("{\n\n/* global CloudCmd */\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst Images = __webpack_require__(/*! ../images.mjs */ \"./client/dom/images.mjs\");\nconst load = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\nmodule.exports = promisify((params, callback) => {\n const p = params;\n const {\n prefixURL\n } = CloudCmd;\n p.url = prefixURL + p.url;\n p.url = encodeURI(p.url);\n p.url = replaceHash(p.url);\n load.ajax({\n method: p.method,\n url: p.url,\n data: p.data,\n dataType: p.dataType,\n error: jqXHR => {\n const response = jqXHR.responseText;\n const {\n statusText,\n status\n } = jqXHR;\n const text = status === 404 ? response : statusText;\n callback(Error(text));\n },\n success: data => {\n Images.hide();\n if (!p.notLog) CloudCmd.log(data);\n callback(null, data);\n }\n });\n});\nmodule.exports._replaceHash = replaceHash;\nfunction replaceHash(url) {\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n */\n return url.replace(/#/g, '%23');\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/io/send-request.js\n}");
172
+ eval("{\n\n/* global CloudCmd */\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst load = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\nmodule.exports = promisify((params, callback) => {\n const p = params;\n const {\n prefixURL\n } = CloudCmd;\n p.url = prefixURL + p.url;\n p.url = encodeURI(p.url);\n p.url = replaceHash(p.url);\n load.ajax({\n method: p.method,\n url: p.url,\n data: p.data,\n dataType: p.dataType,\n error: jqXHR => {\n const response = jqXHR.responseText;\n const {\n statusText,\n status\n } = jqXHR;\n const text = status === 404 ? response : statusText;\n callback(Error(text));\n },\n success: data => {\n Images.hide();\n if (!p.notLog) CloudCmd.log(data);\n callback(null, data);\n }\n });\n});\nmodule.exports._replaceHash = replaceHash;\nfunction replaceHash(url) {\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n */\n return url.replace(/#/g, '%23');\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/io/send-request.js\n}");
173
173
 
174
174
  /***/ },
175
175
 
@@ -191,7 +191,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
191
191
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
192
192
 
193
193
  "use strict";
194
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ajax: () => (/* binding */ ajax),\n/* harmony export */ getIdBySrc: () => (/* binding */ getIdBySrc),\n/* harmony export */ put: () => (/* binding */ put)\n/* harmony export */ });\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var jonny__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jonny */ \"./node_modules/jonny/lib/jonny.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var _images_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./images.mjs */ \"./client/dom/images.mjs\");\n\n\n\n\n\n\n/**\n * Function gets id by src\n * @param src\n *\n * Example: http://domain.com/1.js -> 1_js\n */\nfunction getIdBySrc(src) {\n const isStr = itype__WEBPACK_IMPORTED_MODULE_0__.string(src);\n if (!isStr) return;\n if (src.includes(':')) src += '-join';\n const num = src.lastIndexOf('/') + 1;\n const sub = src.substr(src, num);\n const id = src.replace(sub, '').replace(/\\./g, '-');\n return id;\n}\n\n/**\n * load file countent via ajax\n *\n * @param params\n */\nconst ajax = params => {\n const p = params;\n const isObject = itype__WEBPACK_IMPORTED_MODULE_0__.object(p.data);\n const isArray = itype__WEBPACK_IMPORTED_MODULE_0__.array(p.data);\n const isArrayBuf = itype__WEBPACK_IMPORTED_MODULE_0__(p.data) === 'arraybuffer';\n const type = p.type || p.method || 'GET';\n const {\n headers = {}\n } = p;\n const xhr = new XMLHttpRequest();\n xhr.open(type, p.url, true);\n for (const name of Object.keys(headers)) {\n const value = headers[name];\n xhr.setRequestHeader(name, value);\n }\n if (p.responseType) xhr.responseType = p.responseType;\n let data;\n if (!isArrayBuf && isObject || isArray) data = jonny__WEBPACK_IMPORTED_MODULE_1__.stringify(p.data);else ({\n data\n } = p);\n xhr.onreadystatechange = event => {\n const xhr = event.target;\n const OK = 200;\n if (xhr.readyState !== xhr.DONE) return;\n _images_mjs__WEBPACK_IMPORTED_MODULE_4__.clearProgress();\n const TYPE_JSON = 'application/json';\n const type = xhr.getResponseHeader('content-type');\n if (xhr.status !== OK) return execon__WEBPACK_IMPORTED_MODULE_3__(p.error, xhr);\n const notText = p.dataType !== 'text';\n const isContain = type.includes(TYPE_JSON);\n let data = xhr.response;\n if (type && isContain && notText) data = jonny__WEBPACK_IMPORTED_MODULE_1__.parse(xhr.response) || xhr.response;\n execon__WEBPACK_IMPORTED_MODULE_3__(p.success, data, xhr.statusText, xhr);\n };\n xhr.send(data);\n};\nconst put = (url, body) => {\n const emitter = emitify__WEBPACK_IMPORTED_MODULE_2__();\n const xhr = new XMLHttpRequest();\n url = encodeURI(url).replace(/#/g, '#');\n xhr.open('put', url, true);\n xhr.upload.onprogress = event => {\n if (!event.lengthComputable) return;\n const percent = event.loaded / event.total * 100;\n const count = Math.round(percent);\n emitter.emit('progress', count);\n };\n xhr.onreadystatechange = () => {\n const over = xhr.readyState === xhr.DONE;\n const OK = 200;\n if (!over) return;\n if (xhr.status === OK) {\n emitter.emit('progress', 100);\n return emitter.emit('end');\n }\n const error = Error(xhr.responseText);\n emitter.emit('error', error);\n };\n xhr.send(body);\n return emitter;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/load.mjs\n}");
194
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ajax: () => (/* binding */ ajax),\n/* harmony export */ getIdBySrc: () => (/* binding */ getIdBySrc),\n/* harmony export */ put: () => (/* binding */ put)\n/* harmony export */ });\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var jonny__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jonny */ \"./node_modules/jonny/lib/jonny.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n\n\n\n\n\n\n/**\n * Function gets id by src\n * @param src\n *\n * Example: http://domain.com/1.js -> 1_js\n */\nfunction getIdBySrc(src) {\n const isStr = itype__WEBPACK_IMPORTED_MODULE_0__.string(src);\n if (!isStr) return;\n if (src.includes(':')) src += '-join';\n const num = src.lastIndexOf('/') + 1;\n const sub = src.substr(src, num);\n const id = src.replace(sub, '').replace(/\\./g, '-');\n return id;\n}\n\n/**\n * load file countent via ajax\n *\n * @param params\n */\nconst ajax = params => {\n const p = params;\n const isObject = itype__WEBPACK_IMPORTED_MODULE_0__.object(p.data);\n const isArray = itype__WEBPACK_IMPORTED_MODULE_0__.array(p.data);\n const isArrayBuf = itype__WEBPACK_IMPORTED_MODULE_0__(p.data) === 'arraybuffer';\n const type = p.type || p.method || 'GET';\n const {\n headers = {}\n } = p;\n const xhr = new XMLHttpRequest();\n xhr.open(type, p.url, true);\n for (const name of Object.keys(headers)) {\n const value = headers[name];\n xhr.setRequestHeader(name, value);\n }\n if (p.responseType) xhr.responseType = p.responseType;\n let data;\n if (!isArrayBuf && isObject || isArray) data = jonny__WEBPACK_IMPORTED_MODULE_1__.stringify(p.data);else ({\n data\n } = p);\n xhr.onreadystatechange = event => {\n const xhr = event.target;\n const OK = 200;\n if (xhr.readyState !== xhr.DONE) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_4__.clearProgress();\n const TYPE_JSON = 'application/json';\n const type = xhr.getResponseHeader('content-type');\n if (xhr.status !== OK) return execon__WEBPACK_IMPORTED_MODULE_3__(p.error, xhr);\n const notText = p.dataType !== 'text';\n const isContain = type.includes(TYPE_JSON);\n let data = xhr.response;\n if (type && isContain && notText) data = jonny__WEBPACK_IMPORTED_MODULE_1__.parse(xhr.response) || xhr.response;\n execon__WEBPACK_IMPORTED_MODULE_3__(p.success, data, xhr.statusText, xhr);\n };\n xhr.send(data);\n};\nconst put = (url, body) => {\n const emitter = emitify__WEBPACK_IMPORTED_MODULE_2__();\n const xhr = new XMLHttpRequest();\n url = encodeURI(url).replace(/#/g, '#');\n xhr.open('put', url, true);\n xhr.upload.onprogress = event => {\n if (!event.lengthComputable) return;\n const percent = event.loaded / event.total * 100;\n const count = Math.round(percent);\n emitter.emit('progress', count);\n };\n xhr.onreadystatechange = () => {\n const over = xhr.readyState === xhr.DONE;\n const OK = 200;\n if (!over) return;\n if (xhr.status === OK) {\n emitter.emit('progress', 100);\n return emitter.emit('end');\n }\n const error = Error(xhr.responseText);\n emitter.emit('error', error);\n };\n xhr.send(body);\n return emitter;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/load.mjs\n}");
195
195
 
196
196
  /***/ },
197
197
 
@@ -213,7 +213,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
213
213
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
214
214
 
215
215
  "use strict";
216
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Config: () => (/* binding */ Config),\n/* harmony export */ Markdown: () => (/* binding */ Markdown),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ createDirectory: () => (/* binding */ createDirectory),\n/* harmony export */ extract: () => (/* binding */ extract),\n/* harmony export */ move: () => (/* binding */ move),\n/* harmony export */ pack: () => (/* binding */ pack),\n/* harmony export */ patch: () => (/* binding */ patch),\n/* harmony export */ read: () => (/* binding */ read),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ rename: () => (/* binding */ rename),\n/* harmony export */ write: () => (/* binding */ write)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _common_entity_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/entity.js */ \"./common/entity.js\");\n/* harmony import */ var _images_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./images.mjs */ \"./client/dom/images.mjs\");\n/* harmony import */ var _io_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./io/index.js */ \"./client/dom/io/index.js\");\n\n\n\n\n\nconst handleError = promise => async (...args) => {\n const [e, data] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(promise, ...args);\n if (!e) return [e, data];\n const encoded = (0,_common_entity_js__WEBPACK_IMPORTED_MODULE_2__.encode)(e.message);\n _images_mjs__WEBPACK_IMPORTED_MODULE_3__.show.error(encoded);\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert(encoded);\n return [e, data];\n};\nconst remove = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__[\"delete\"]);\nconst patch = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.patch);\nconst write = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.write);\nconst createDirectory = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.createDirectory);\nconst read = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.read);\nconst copy = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.copy);\nconst pack = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.pack);\nconst extract = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.extract);\nconst move = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.move);\nconst rename = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.rename);\nconst Config = {\n read: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Config.read),\n write: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Config.write)\n};\nconst Markdown = {\n read: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Markdown.read),\n render: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Markdown.render)\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/rest.mjs\n}");
216
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Config: () => (/* binding */ Config),\n/* harmony export */ Markdown: () => (/* binding */ Markdown),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ createDirectory: () => (/* binding */ createDirectory),\n/* harmony export */ extract: () => (/* binding */ extract),\n/* harmony export */ move: () => (/* binding */ move),\n/* harmony export */ pack: () => (/* binding */ pack),\n/* harmony export */ patch: () => (/* binding */ patch),\n/* harmony export */ read: () => (/* binding */ read),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ rename: () => (/* binding */ rename),\n/* harmony export */ write: () => (/* binding */ write)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n/* harmony import */ var _io_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./io/index.js */ \"./client/dom/io/index.js\");\n\n\n\n\n\nconst handleError = promise => async (...args) => {\n const [e, data] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(promise, ...args);\n if (!e) return [e, data];\n const encoded = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(e.message);\n _dom_images__WEBPACK_IMPORTED_MODULE_2__.show.error(encoded);\n _dom_dialog__WEBPACK_IMPORTED_MODULE_1__.alert(encoded);\n return [e, data];\n};\nconst remove = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__[\"delete\"]);\nconst patch = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.patch);\nconst write = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.write);\nconst createDirectory = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.createDirectory);\nconst read = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.read);\nconst copy = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.copy);\nconst pack = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.pack);\nconst extract = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.extract);\nconst move = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.move);\nconst rename = handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.rename);\nconst Config = {\n read: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Config.read),\n write: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Config.write)\n};\nconst Markdown = {\n read: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Markdown.read),\n render: handleError(_io_index_js__WEBPACK_IMPORTED_MODULE_4__.Markdown.render)\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/rest.mjs\n}");
217
217
 
218
218
  /***/ },
219
219
 
@@ -246,7 +246,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
246
246
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
247
247
 
248
248
  "use strict";
249
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ uploadFiles: () => (/* binding */ uploadFiles)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _images_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./images.mjs */ \"./client/dom/images.mjs\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _current_file_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./current-file.mjs */ \"./client/dom/current-file.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nconst loadFile = wraptile__WEBPACK_IMPORTED_MODULE_1__(_loadFile);\nconst onEnd = wraptile__WEBPACK_IMPORTED_MODULE_1__(_onEnd);\nconst uploadFiles = (dir, files) => {\n if (!files) {\n files = dir;\n dir = (0,_current_file_mjs__WEBPACK_IMPORTED_MODULE_6__.getCurrentDirPath)();\n }\n const n = files.length;\n if (!n) return;\n const array = Array.from(files);\n const {\n name\n } = files[0];\n (0,execon__WEBPACK_IMPORTED_MODULE_0__.eachSeries)(array, loadFile(dir, n), onEnd(name));\n};\nfunction _onEnd(currentName) {\n CloudCmd.refresh({\n currentName\n });\n}\nfunction _loadFile(dir, n, file, callback) {\n let i = 0;\n const {\n name\n } = file;\n const path = dir + name;\n const {\n prefixURL\n } = CloudCmd;\n const api = prefixURL + _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_5__.FS;\n const percent = (i, n, per = 100) => {\n return Math.round(i * per / n);\n };\n const step = n => 100 / n;\n ++i;\n _dom_load__WEBPACK_IMPORTED_MODULE_2__.put(api + path, file).on('error', showError).on('end', callback).on('progress', count => {\n const max = step(n);\n const value = (i - 1) * max + percent(count, 100, max);\n _images_mjs__WEBPACK_IMPORTED_MODULE_4__.show.load('top');\n _images_mjs__WEBPACK_IMPORTED_MODULE_4__.setProgress(Math.round(value));\n });\n}\nfunction showError({\n message\n}) {\n (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_3__.alert)(message);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/upload-files.mjs\n}");
249
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ uploadFiles: () => (/* binding */ uploadFiles)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _current_file_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./current-file.mjs */ \"./client/dom/current-file.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nconst loadFile = wraptile__WEBPACK_IMPORTED_MODULE_1__(_loadFile);\nconst onEnd = wraptile__WEBPACK_IMPORTED_MODULE_1__(_onEnd);\nconst uploadFiles = (dir, files) => {\n if (!files) {\n files = dir;\n dir = (0,_current_file_mjs__WEBPACK_IMPORTED_MODULE_6__.getCurrentDirPath)();\n }\n const n = files.length;\n if (!n) return;\n const array = Array.from(files);\n const {\n name\n } = files[0];\n (0,execon__WEBPACK_IMPORTED_MODULE_0__.eachSeries)(array, loadFile(dir, n), onEnd(name));\n};\nfunction _onEnd(currentName) {\n CloudCmd.refresh({\n currentName\n });\n}\nfunction _loadFile(dir, n, file, callback) {\n let i = 0;\n const {\n name\n } = file;\n const path = dir + name;\n const {\n prefixURL\n } = CloudCmd;\n const api = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_4__.FS;\n const percent = (i, n, per = 100) => {\n return Math.round(i * per / n);\n };\n const step = n => 100 / n;\n ++i;\n _dom_load__WEBPACK_IMPORTED_MODULE_2__.put(api + path, file).on('error', showError).on('end', callback).on('progress', count => {\n const max = step(n);\n const value = (i - 1) * max + percent(count, 100, max);\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.show.load('top');\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.setProgress(Math.round(value));\n });\n}\nfunction showError({\n message\n}) {\n (0,_dom_dialog__WEBPACK_IMPORTED_MODULE_3__.alert)(message);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/upload-files.mjs\n}");
250
250
 
251
251
  /***/ },
252
252
 
@@ -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 */ init: () => (/* binding */ init),\n/* harmony export */ initKeysPanel: () => (/* binding */ initKeysPanel),\n/* harmony export */ setOnPanel: () => (/* binding */ setOnPanel)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _dom_upload_files__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/upload-files */ \"./client/dom/upload-files.mjs\");\n/* harmony import */ var _get_range_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./get-range.mjs */ \"./client/listeners/get-range.mjs\");\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_7__.getRange)(indexFrom, indexTo, files);\n}\nfunction contextMenu() {\n const fm = DOM.getFM();\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addOnce('contextmenu', fm, event => {\n CloudCmd.Menu.show({\n x: event.clientX,\n y: event.clientY\n });\n });\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addContextMenu(fm, event => {\n CloudCmd.Menu.ENABLED || event.preventDefault();\n });\n}\nfunction dragndrop() {\n const panels = DOM.getByClassAll('panel');\n const select = ({\n target\n }) => {\n target.classList.add('selected-panel');\n };\n const unselect = ({\n target\n }) => {\n target.classList.remove('selected-panel');\n };\n const onDrop = event => {\n const {\n files,\n items\n } = event.dataTransfer;\n const {\n length: filesCount\n } = files;\n event.preventDefault();\n if (filesCount && (!items || !items.length || !items[0].webkitGetAsEntry)) return (0,_dom_upload_files__WEBPACK_IMPORTED_MODULE_6__.uploadFiles)(files);\n const isFile = item => item.kind === 'file';\n const dirFiles = Array.from(items).filter(isFile);\n if (dirFiles.length) return DOM.uploadDirectory(dirFiles);\n const {\n Operation\n } = CloudCmd;\n const operation = event.shiftKey ? 'move' : 'copy';\n return Operation.show(operation);\n };\n\n /**\n * In macOS Chrome dropEffect = 'none'\n * so drop do not firing up when try\n * to upload file from download bar\n */\n const onDragOver = event => {\n const {\n dataTransfer\n } = event;\n const {\n effectAllowed\n } = dataTransfer;\n if (/move|linkMove/.test(effectAllowed)) dataTransfer.dropEffect = 'move';else dataTransfer.dropEffect = 'copy';\n event.preventDefault();\n };\n for (const panel of panels) _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('dragover', panel, onDragOver).add('drop', panel, onDrop).add('dragenter', select).add(['dragleave', 'drop'], unselect);\n}\nfunction unload() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add(['unload', 'beforeunload'], event => {\n const {\n Key\n } = CloudCmd;\n const isBind = Key === null || Key === void 0 ? void 0 : Key.isBind();\n if (isBind) return;\n event.preventDefault();\n return 'Please make sure that you saved all work.';\n });\n}\nfunction pop() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('popstate', async ({\n state\n }) => {\n const path = (state || '').replace(_common_cloudfunc_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}");
381
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ initKeysPanel: () => (/* binding */ initKeysPanel),\n/* harmony export */ setOnPanel: () => (/* binding */ setOnPanel)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _dom_upload_files__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/upload-files */ \"./client/dom/upload-files.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _get_range_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./get-range.mjs */ \"./client/listeners/get-range.mjs\");\n/* harmony import */ var _get_index_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-index.mjs */ \"./client/listeners/get-index.mjs\");\n/* global DOM, CloudCmd */\n\n\n\n\n\n\n\n\n\n\nconst NBSP_REG = RegExp(String.fromCharCode(160), 'g');\nconst SPACE = ' ';\nconst init = async () => {\n contextMenu();\n dragndrop();\n unload();\n pop();\n resize();\n header();\n await config();\n};\nconst unselect = event => {\n const isMac = /Mac/.test(globalThis.navigator.platform);\n const {\n shiftKey,\n metaKey,\n ctrlKey\n } = event;\n if (shiftKey || isMac && metaKey || ctrlKey) return;\n DOM.unselectFiles();\n};\nconst execAll = currify__WEBPACK_IMPORTED_MODULE_2__((funcs, event) => {\n for (const fn of funcs) fn(event);\n});\nconst EventsFiles = {\n mousedown: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, setCurrentFileByEvent),\n click: execAll([onClick, execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotMobile, unselect)]),\n dragstart: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onDragStart),\n dblclick: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onDblClick),\n touchstart: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](execIfNotUL, onTouch)\n};\nlet EXT;\nfunction header() {\n const fm = DOM.getFM();\n const isDataset = el => el.dataset;\n const isPanel = el => {\n return /^js-(left|right)$/.test(el.dataset.name);\n };\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(fm, event => {\n const el = event.target;\n const parent = el.parentElement;\n if (parent.dataset.name !== 'js-fm-header') return;\n const name = (el.dataset.name || '').replace('js-', '');\n if (!/^(name|size|date)$/.test(name)) return;\n const panel = getPath(el).filter(isDataset).filter(isPanel).pop();\n CloudCmd.sortPanel(name, panel);\n });\n}\nfunction getPath(el, path = []) {\n if (!el) return path;\n return getPath(el.parentElement, path.concat(el));\n}\nasync function config() {\n const [, config] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_3__.tryToCatch)(DOM.Files.get, 'config');\n const type = config === null || config === void 0 ? void 0 : config.packer;\n EXT = DOM.getPackerExt(type);\n}\nconst initKeysPanel = () => {\n const keysElement = DOM.getById('js-keyspanel');\n if (!keysElement) return;\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(keysElement, event => {\n const {\n target\n } = event;\n const {\n id\n } = target;\n const operation = name => {\n const {\n Operation\n } = CloudCmd;\n return Operation.show.bind(null, name);\n };\n const clickFuncs = {\n 'f1': CloudCmd.Help.show,\n 'f2': CloudCmd.UserMenu.show,\n 'f3': CloudCmd.View.show,\n 'f4': CloudCmd.EditFile.show,\n 'f5': operation('copy'),\n 'f6': operation('move'),\n 'f7': DOM.promptNewDir,\n 'f8': operation('delete'),\n 'f9': () => {\n event.stopPropagation();\n CloudCmd.Menu.show();\n },\n 'f10': CloudCmd.Config.show,\n '~': CloudCmd.Konsole.show,\n 'shift~': CloudCmd.Terminal.show,\n 'contact': CloudCmd.Contact.show\n };\n execon__WEBPACK_IMPORTED_MODULE_0__(clickFuncs[id]);\n });\n};\nconst getPanel = side => {\n if (!itype__WEBPACK_IMPORTED_MODULE_1__.string(side)) return side;\n return DOM.getByDataName(`js-${side}`);\n};\nconst setOnPanel = side => {\n const panel = getPanel(side);\n const filesElement = DOM.getByDataName('js-files', panel);\n const pathElement = DOM.getByDataName('js-path', panel);\n\n /* ставим загрузку гифа на клик*/\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addClick(pathElement, getPathListener(panel));\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add(filesElement, EventsFiles);\n};\nfunction getPathListener(panel) {\n return onPathElementClick.bind(null, panel);\n}\nfunction isNoCurrent(panel) {\n const Info = DOM.CurrentInfo;\n const infoPanel = Info.panel;\n if (!infoPanel) return true;\n const namePanel = panel.getAttribute('data-name');\n const nameInfoPanel = infoPanel.getAttribute('data-name');\n return namePanel !== nameInfoPanel;\n}\nfunction decodePath(path) {\n const url = CloudCmd.HOST;\n const {\n prefix\n } = CloudCmd;\n const prefixReg = RegExp('^' + prefix + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__.FS);\n return decodeURI(path).replace(url, '').replace(prefixReg, '') // browser doesn't replace % -> %25% do it for him\n .replace('%%', '%25%').replace(NBSP_REG, SPACE) || '/';\n}\nasync function onPathElementClick(panel, event) {\n const Info = DOM.CurrentInfo;\n event.preventDefault();\n const element = event.target;\n const attr = element.getAttribute('data-name');\n const noCurrent = isNoCurrent(panel);\n if (attr === 'js-copy-path') return copyPath(element);\n if (attr === 'js-refresh') return CloudCmd.refresh({\n panel,\n noCurrent\n });\n if (attr !== 'js-path-link') return;\n const {\n href\n } = element;\n const path = decodePath(href);\n await CloudCmd.changeDir(path, {\n isRefresh: false,\n panel: noCurrent ? panel : Info.panel\n });\n}\nfunction copyPath(el) {\n _cloudcmd_clipboard__WEBPACK_IMPORTED_MODULE_4__.writeText(el.parentElement.title).then(CloudCmd.log).catch(CloudCmd.log);\n}\nfunction execIfNotMobile(callback, event) {\n const isMobile = DOM.getCSSVar('is-mobile');\n if (!isMobile) callback(event);\n}\nfunction execIfNotUL(callback, event) {\n const {\n target\n } = event;\n const {\n tagName\n } = target;\n if (tagName !== 'UL') callback(event);\n}\nfunction onClick(event) {\n event.preventDefault();\n changePanel(event.target);\n}\nfunction toggleSelect(key, files) {\n const isMac = /Mac/.test(globalThis.navigator.platform);\n if (!key) throw Error('key should not be undefined!');\n const [file] = files;\n if (isMac && key.meta) return DOM.toggleSelectedFile(file);\n if (key.shift) return files.map(DOM.selectFile);\n}\nfunction changePanel(element) {\n const Info = DOM.CurrentInfo;\n const {\n panel\n } = Info;\n const files = DOM.getByDataName('js-files', panel);\n const ul = getULElement(element);\n if (ul !== files) DOM.changePanel();\n}\nasync function onDblClick(event) {\n event.preventDefault();\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n const path = DOM.getCurrentPath(current);\n if (!isDir) return CloudCmd.View.show();\n await CloudCmd.changeDir(path);\n}\nasync function onTouch(event) {\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n if (!isDir) return;\n const isCurrent = DOM.isCurrentFile(current);\n if (!isCurrent) return;\n await CloudCmd.changeDir(DOM.getCurrentPath(current));\n}\n\n/*\n * download file from browser to desktop\n * in Chrome (HTML5)\n */\nfunction onDragStart(event) {\n const Info = DOM.CurrentInfo;\n const {\n prefixURL\n } = CloudCmd;\n const element = getLIElement(event.target);\n const {\n isDir\n } = Info;\n let link = DOM.getCurrentLink(element);\n let name = DOM.getCurrentName(element);\n\n /* if it's directory - adding json extension */\n if (isDir) {\n name += EXT;\n link = document.createElement('a');\n link.textContent = name;\n link.href = prefixURL + '/pack' + Info.path + EXT;\n }\n event.dataTransfer.setData('DownloadURL', 'application/octet-stream' + ':' + name + ':' + link);\n}\nfunction getLIElement(element) {\n if (!element) return element;\n while (element.tagName !== 'LI') element = element.parentElement;\n return element;\n}\nfunction getULElement(element) {\n while (element.tagName !== 'UL') element = element.parentElement;\n return element;\n}\nfunction setCurrentFileByEvent(event) {\n const Info = DOM.CurrentInfo;\n const BUTTON_LEFT = 0;\n const key = {\n alt: event.altKey,\n ctrl: event.ctrlKey,\n meta: event.metaKey,\n shift: event.shiftKey\n };\n const element = getLIElement(event.target);\n const fromName = Info.name;\n DOM.setCurrentFile(element);\n const toName = Info.name;\n let files = [];\n if (key.shift) files = getFilesRange(fromName, toName);else files.push(Info.element);\n if (event.button === BUTTON_LEFT) toggleSelect(key, files);\n}\nfunction getFilesRange(from, to) {\n const files = DOM.getAllFiles();\n const names = DOM.getFilenames(files);\n const getNameIndex = (0,_get_index_mjs__WEBPACK_IMPORTED_MODULE_9__.getIndex)(names);\n const indexFrom = getNameIndex(from);\n const indexTo = getNameIndex(to);\n return (0,_get_range_mjs__WEBPACK_IMPORTED_MODULE_8__.getRange)(indexFrom, indexTo, files);\n}\nfunction contextMenu() {\n const fm = DOM.getFM();\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addOnce('contextmenu', fm, event => {\n CloudCmd.Menu.show({\n x: event.clientX,\n y: event.clientY\n });\n });\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.addContextMenu(fm, event => {\n CloudCmd.Menu.ENABLED || event.preventDefault();\n });\n}\nfunction dragndrop() {\n const panels = DOM.getByClassAll('panel');\n const select = ({\n target\n }) => {\n target.classList.add('selected-panel');\n };\n const unselect = ({\n target\n }) => {\n target.classList.remove('selected-panel');\n };\n const onDrop = event => {\n const {\n files,\n items\n } = event.dataTransfer;\n const {\n length: filesCount\n } = files;\n event.preventDefault();\n if (filesCount && (!items || !items.length || !items[0].webkitGetAsEntry)) return (0,_dom_upload_files__WEBPACK_IMPORTED_MODULE_6__.uploadFiles)(files);\n const isFile = item => item.kind === 'file';\n const dirFiles = Array.from(items).filter(isFile);\n if (dirFiles.length) return DOM.uploadDirectory(dirFiles);\n const {\n Operation\n } = CloudCmd;\n const operation = event.shiftKey ? 'move' : 'copy';\n return Operation.show(operation);\n };\n\n /**\n * In macOS Chrome dropEffect = 'none'\n * so drop do not firing up when try\n * to upload file from download bar\n */\n const onDragOver = event => {\n const {\n dataTransfer\n } = event;\n const {\n effectAllowed\n } = dataTransfer;\n if (/move|linkMove/.test(effectAllowed)) dataTransfer.dropEffect = 'move';else dataTransfer.dropEffect = 'copy';\n event.preventDefault();\n };\n for (const panel of panels) _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('dragover', panel, onDragOver).add('drop', panel, onDrop).add('dragenter', select).add(['dragleave', 'drop'], unselect);\n}\nfunction unload() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add(['unload', 'beforeunload'], event => {\n const {\n Key\n } = CloudCmd;\n const isBind = Key === null || Key === void 0 ? void 0 : Key.isBind();\n if (isBind) return;\n event.preventDefault();\n return 'Please make sure that you saved all work.';\n });\n}\nfunction pop() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('popstate', async ({\n state\n }) => {\n const path = (state || '').replace(_common_cloudfunc__WEBPACK_IMPORTED_MODULE_7__.FS, '');\n if (!path) return CloudCmd.route(location.hash);\n const history = false;\n await CloudCmd.changeDir(path, {\n history\n });\n });\n}\nfunction resize() {\n _dom_events__WEBPACK_IMPORTED_MODULE_5__.add('resize', () => {\n const Info = DOM.CurrentInfo;\n const is = globalThis.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH;\n if (!is) return;\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return;\n const name = panel.getAttribute('data-name');\n const isLeft = name === 'js-left';\n if (isLeft) return;\n DOM.changePanel();\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/listeners/index.mjs\n}");
382
382
 
383
383
  /***/ },
384
384
 
@@ -400,18 +400,18 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
400
400
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
401
401
 
402
402
  "use strict";
403
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ saveFile: () => (/* binding */ saveFile),\n/* harmony export */ uploadFile: () => (/* binding */ uploadFile)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_images_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../dom/images.mjs */ \"./client/dom/images.mjs\");\n/* global CloudCmd, filepicker */\n\n\n\n\n\n\nconst {\n log\n} = CloudCmd;\nconst upload = currify__WEBPACK_IMPORTED_MODULE_1__(_upload);\nconst Name = 'Cloud';\nCloudCmd[Name] = {\n init,\n uploadFile,\n saveFile\n};\nasync function init() {\n const [modules] = await loadFiles();\n const {\n key\n } = modules.data.FilePicker;\n filepicker.setKey(key);\n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_5__.hide();\n}\nfunction uploadFile(filename, data) {\n const mimetype = '';\n filepicker.store(data, {\n mimetype,\n filename\n }, fpFile => {\n filepicker.exportFile(fpFile, log, log);\n });\n}\nfunction saveFile(callback) {\n filepicker.pick(upload(callback));\n}\nfunction _upload(callback, file) {\n const {\n url,\n filename\n } = file;\n const responseType = 'arraybuffer';\n const success = execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](callback, filename);\n (0,_dom_load__WEBPACK_IMPORTED_MODULE_3__.ajax)({\n url,\n responseType,\n success\n });\n}\nfunction loadFiles() {\n const js = '//api.filepicker.io/v2/filepicker.js';\n return Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_4__.get('modules'), load_js__WEBPACK_IMPORTED_MODULE_2__.js(js)]);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/cloud.mjs\n}");
403
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ saveFile: () => (/* binding */ saveFile),\n/* harmony export */ uploadFile: () => (/* binding */ uploadFile)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* global CloudCmd, filepicker */\n\n\n\n\n\n\nconst {\n log\n} = CloudCmd;\nconst upload = currify__WEBPACK_IMPORTED_MODULE_1__(_upload);\nconst Name = 'Cloud';\nCloudCmd[Name] = {\n init,\n uploadFile,\n saveFile\n};\nasync function init() {\n const [modules] = await loadFiles();\n const {\n key\n } = modules.data.FilePicker;\n filepicker.setKey(key);\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.hide();\n}\nfunction uploadFile(filename, data) {\n const mimetype = '';\n filepicker.store(data, {\n mimetype,\n filename\n }, fpFile => {\n filepicker.exportFile(fpFile, log, log);\n });\n}\nfunction saveFile(callback) {\n filepicker.pick(upload(callback));\n}\nfunction _upload(callback, file) {\n const {\n url,\n filename\n } = file;\n const responseType = 'arraybuffer';\n const success = execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](callback, filename);\n (0,_dom_load__WEBPACK_IMPORTED_MODULE_3__.ajax)({\n url,\n responseType,\n success\n });\n}\nfunction loadFiles() {\n const js = '//api.filepicker.io/v2/filepicker.js';\n return Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_4__.get('modules'), load_js__WEBPACK_IMPORTED_MODULE_2__.js(js)]);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/cloud.mjs\n}");
404
404
 
405
405
  /***/ },
406
406
 
407
- /***/ "./client/modules/command-line.js"
408
- /*!****************************************!*\
409
- !*** ./client/modules/command-line.js ***!
410
- \****************************************/
411
- (module, exports, __webpack_require__) {
407
+ /***/ "./client/modules/command-line.mjs"
408
+ /*!*****************************************!*\
409
+ !*** ./client/modules/command-line.mjs ***!
410
+ \*****************************************/
411
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
412
412
 
413
413
  "use strict";
414
- eval("{\n\n/* global CloudCmd */\nCloudCmd.CommandLine = exports;\nconst Dialog = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\nconst noop = () => {};\nmodule.exports.init = noop;\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nasync function show() {\n const [, cmd] = await Dialog.prompt('Command Line', '');\n const TERMINAL = '^(t|terminal)';\n if (RegExp(`${TERMINAL}$`).test(cmd)) return await CloudCmd.Terminal.show();\n if (RegExp(TERMINAL).test(cmd)) {\n const command = cmd.replace(RegExp(`${TERMINAL} `), '');\n const exitCode = await CloudCmd.TerminalRun.show({\n command: `bash -c '${command}'`\n });\n if (exitCode === -1) await Dialog.alert(`☝️ Looks like Terminal is disabled, start Cloud Coammnder with '--terminal' flag.`);\n return;\n }\n}\nfunction hide() {}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/command-line.js\n}");
414
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* global CloudCmd */\n\nconst init = () => {};\nCloudCmd.CommandLine = {\n init,\n show,\n hide\n};\nasync function show() {\n const [, cmd] = await _dom_dialog__WEBPACK_IMPORTED_MODULE_0__.prompt('Command Line', '');\n const TERMINAL = '^(t|terminal)';\n if (RegExp(`${TERMINAL}$`).test(cmd)) return await CloudCmd.Terminal.show();\n if (RegExp(TERMINAL).test(cmd)) {\n const command = cmd.replace(RegExp(`${TERMINAL} `), '');\n const exitCode = await CloudCmd.TerminalRun.show({\n command: `bash -c '${command}'`\n });\n if (exitCode === -1) await _dom_dialog__WEBPACK_IMPORTED_MODULE_0__.alert(`☝️ Looks like Terminal is disabled, start Cloud Coammnder with '--terminal' flag.`);\n return;\n }\n}\nfunction hide() {}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/command-line.mjs\n}");
415
415
 
416
416
  /***/ },
417
417
 
@@ -422,7 +422,7 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.CommandLine = exports;\nconst Dialog
422
422
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
423
423
 
424
424
  "use strict";
425
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var 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 _dom_files__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _css_config_css__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\n/* harmony import */ var _input_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./input.mjs */ \"./client/modules/config/input.mjs\");\n/* harmony import */ var _dom_images_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../dom/images.mjs */ \"./client/dom/images.mjs\");\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_12__.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__WEBPACK_IMPORTED_MODULE_9__.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__WEBPACK_IMPORTED_MODULE_9__.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_11__.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_11__.getName(el);\n const data = _input_mjs__WEBPACK_IMPORTED_MODULE_11__.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_11__.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_11__.getElementByName('username', Element);\n const elPassword = _input_mjs__WEBPACK_IMPORTED_MODULE_11__.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}");
425
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_config_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var squad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _input_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./input.mjs */ \"./client/modules/config/input.mjs\");\n/* global CloudCmd, DOM, io */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n Dialog,\n setTitle\n} = DOM;\nconst Name = 'Config';\nconst loadSocket = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_5__.promisify)(DOM.loadSocket);\nconst showLoad = () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load('top');\n};\nconst addKey = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.addKey(input, fn);\n return input;\n});\nconst addChange = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.add('change', input, fn);\n return input;\n});\nconst Config = {};\nlet Template;\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_7__.css;\nconst init = async () => {\n if (!CloudCmd.config('configDialog')) return;\n showLoad();\n const {\n DIR_DIST\n } = CloudCmd;\n [Template] = await Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_10__.get('config-tmpl'), loadSocket(), loadCSS(`${DIR_DIST}/config.css`), CloudCmd.View()]);\n initSocket();\n};\nconst {\n config,\n Key\n} = CloudCmd;\nlet Element;\nfunction getHost() {\n const {\n host,\n origin,\n protocol\n } = location;\n return origin || `${protocol}//${host}`;\n}\nfunction initSocket() {\n const href = getHost();\n const {\n prefixSocket,\n prefix\n } = CloudCmd;\n const ONE_MINUTE = 60 * 1000;\n const socket = io.connect(href + prefixSocket + '/config', {\n reconnectionAttempts: Infinity,\n reconnectionDelay: ONE_MINUTE,\n path: `${prefix}/socket.io`\n });\n const save = data => {\n onSave(data);\n socket.send(data);\n };\n authCheck(socket);\n socket.on('connect', () => {\n Config.save = save;\n });\n socket.on('message', onSave);\n socket.on('log', CloudCmd.log);\n socket.on('disconnect', () => {\n Config.save = saveHttp;\n });\n socket.on('err', Dialog.alert);\n}\nfunction authCheck(socket) {\n socket.emit('auth', config('username'), config('password'));\n socket.on('reject', wraptile__WEBPACK_IMPORTED_MODULE_3__(Dialog.alert, 'Wrong credentials!'));\n}\nConfig.save = saveHttp;\nasync function show() {\n if (!CloudCmd.config('configDialog')) return;\n await fillTemplate();\n}\nasync function fillTemplate() {\n const [error, config] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_6__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_10__.get, 'config');\n if (error) return Dialog.alert('Could not load config!');\n const {\n editor,\n menu,\n packer,\n columns,\n theme,\n configAuth,\n ...obj\n } = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.convert(config);\n obj[`${menu}-selected`] = 'selected';\n obj[`${editor}-selected`] = 'selected';\n obj[`${packer}-selected`] = 'selected';\n obj[`${columns}-selected`] = 'selected';\n obj[`${theme}-selected`] = 'selected';\n obj.configAuth = configAuth ? '' : 'hidden';\n const innerHTML = rendy__WEBPACK_IMPORTED_MODULE_1__(Template, obj);\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__('form', {\n className: 'config',\n innerHTML\n });\n const inputs = document.querySelectorAll('input, select', Element);\n const [inputFirst] = inputs;\n let afterShow;\n if (inputFirst) {\n onAuthChange(inputFirst.checked);\n afterShow = inputFirst.focus.bind(inputFirst);\n }\n const getTarget = ({\n target\n }) => target;\n const handleChange = squad__WEBPACK_IMPORTED_MODULE_4__(onChange, getTarget);\n Array.from(inputs).map(addKey(onKey)).map(addChange(handleChange));\n const autoSize = true;\n CloudCmd.View.show(Element, {\n autoSize,\n afterShow\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nasync function onChange(el) {\n const obj = {};\n const name = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.getName(el);\n const data = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.getValue(name, Element);\n if (name === 'name') onNameChange(data);else if (name === 'auth') onAuthChange(data);\n obj[name] = data;\n await Config.save(obj);\n}\nfunction onSave(obj) {\n for (const name of Object.keys(obj)) {\n const data = obj[name];\n CloudCmd._config(name, data);\n _input_mjs__WEBPACK_IMPORTED_MODULE_13__.setValue(name, data, Element);\n }\n}\nasync function saveHttp(obj) {\n const {\n RESTful\n } = DOM;\n const [e] = await RESTful.Config.write(obj);\n if (e) return;\n onSave(obj);\n}\nfunction onAuthChange(checked) {\n const elUsername = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.getElementByName('username', Element);\n const elPassword = _input_mjs__WEBPACK_IMPORTED_MODULE_13__.getElementByName('password', Element);\n elUsername.disabled = !checked;\n elPassword.disabled = !checked;\n}\nfunction onNameChange(name) {\n setTitle((0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.getTitle)({\n name\n }));\n}\nasync function onKey({\n keyCode,\n target\n}) {\n switch (keyCode) {\n case Key.ESC:\n return hide();\n case Key.ENTER:\n return await onChange(target);\n }\n}\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/config/index.mjs\n}");
426
426
 
427
427
  /***/ },
428
428
 
@@ -444,7 +444,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
444
444
  (module, exports, __webpack_require__) {
445
445
 
446
446
  "use strict";
447
- eval("{/* global CloudCmd */\n/* global DOM */\n\n\n\nCloudCmd.Contact = exports;\nconst olark = __webpack_require__(/*! @cloudcmd/olark */ \"./node_modules/@cloudcmd/olark/index.js\");\nconst Images = __webpack_require__(/*! ../dom/images.mjs */ \"./client/dom/images.mjs\");\nconst {\n Events\n} = DOM;\nconst {\n Key\n} = CloudCmd;\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nmodule.exports.init = () => {\n Events.addKey(onKey);\n olark.identify('6216-545-10-4223');\n olark('api.box.onExpand', show);\n olark('api.box.onShow', show);\n olark('api.box.onShrink', hide);\n};\nfunction show() {\n Key.unsetBind();\n Images.hide();\n olark('api.box.expand');\n}\nfunction hide() {\n Key.setBind();\n olark('api.box.hide');\n}\nfunction onKey({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/contact.js\n}");
447
+ eval("{/* global CloudCmd */\n/* global DOM */\n\n\n\nCloudCmd.Contact = exports;\nconst olark = __webpack_require__(/*! @cloudcmd/olark */ \"./node_modules/@cloudcmd/olark/index.js\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst {\n Events\n} = DOM;\nconst {\n Key\n} = CloudCmd;\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nmodule.exports.init = () => {\n Events.addKey(onKey);\n olark.identify('6216-545-10-4223');\n olark('api.box.onExpand', show);\n olark('api.box.onShow', show);\n olark('api.box.onShrink', hide);\n};\nfunction show() {\n Key.unsetBind();\n Images.hide();\n olark('api.box.expand');\n}\nfunction hide() {\n Key.setBind();\n olark('api.box.hide');\n}\nfunction onKey({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/contact.js\n}");
448
448
 
449
449
  /***/ },
450
450
 
@@ -492,14 +492,14 @@ eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"
492
492
 
493
493
  /***/ },
494
494
 
495
- /***/ "./client/modules/edit.js"
496
- /*!********************************!*\
497
- !*** ./client/modules/edit.js ***!
498
- \********************************/
499
- (module, exports, __webpack_require__) {
495
+ /***/ "./client/modules/edit.mjs"
496
+ /*!*********************************!*\
497
+ !*** ./client/modules/edit.mjs ***!
498
+ \*********************************/
499
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
500
500
 
501
501
  "use strict";
502
- eval("{/* global CloudCmd */\n\n\n\nconst montag = __webpack_require__(/*! montag */ \"./node_modules/montag/lib/montag.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.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst {\n MAX_FILE_SIZE: maxSize\n} = __webpack_require__(/*! ../../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\nconst {\n time,\n timeEnd\n} = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\nconst getEditor = () => editor;\nconst isFn = a => typeof a === 'function';\nconst loadJS = load.js;\nconst Name = 'Edit';\nCloudCmd[Name] = exports;\nconst EditorName = CloudCmd.config('editor');\nlet Loading = true;\nlet Element;\nlet editor;\nconst ConfigView = {\n afterShow: () => {\n editor.moveCursorTo(0, 0).focus();\n }\n};\nmodule.exports.init = async () => {\n const element = create();\n await CloudCmd.View();\n await loadFiles(element);\n};\nfunction create() {\n const element = createElement('div', {\n style: montag`\n width: 100%;\n height: 100%;\n font-family: \"Droid Sans Mono\";\n `,\n notAppend: true\n });\n Element = element;\n return element;\n}\nfunction checkFn(name, fn) {\n if (!isFn(fn)) throw Error(`${name} should be a function!`);\n}\nfunction initConfig(options = {}) {\n const config = {\n ...options,\n ...ConfigView\n };\n if (!options.afterShow) return config;\n checkFn('options.afterShow', options.afterShow);\n config.afterShow = () => {\n ConfigView.afterShow();\n options.afterShow();\n };\n return config;\n}\nmodule.exports.show = options => {\n if (Loading) return;\n CloudCmd.View.show(Element, initConfig(options));\n getEditor().setOptions({\n fontSize: 16\n });\n};\nmodule.exports.getEditor = getEditor;\nmodule.exports.getElement = () => Element;\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nconst loadFiles = async element => {\n const prefix = `${CloudCmd.prefix}/${EditorName}`;\n const socketPath = CloudCmd.prefix;\n const prefixSocket = `${CloudCmd.prefixSocket}/${EditorName}`;\n const url = `${prefix}/${EditorName}.js`;\n time(`${Name} load`);\n await loadJS(url);\n const word = promisify(window[EditorName]);\n const [ed] = await tryToCatch(word, element, {\n maxSize,\n prefix,\n prefixSocket,\n socketPath\n });\n timeEnd(`${Name} load`);\n editor = ed;\n Loading = false;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit.js\n}");
502
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getEditor: () => (/* binding */ getEditor),\n/* harmony export */ getElement: () => (/* binding */ getElement),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var montag__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! montag */ \"./node_modules/montag/lib/montag.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nfunction getEditor() {\n return editor;\n}\nconst isFn = a => typeof a === 'function';\nconst loadJS = load_js__WEBPACK_IMPORTED_MODULE_4__.js;\nconst Name = 'Edit';\nCloudCmd[Name] = {\n init,\n show,\n hide,\n getEditor,\n getElement\n};\nconst EditorName = CloudCmd.config('editor');\nlet Loading = true;\nlet Element;\nlet editor;\nconst ConfigView = {\n afterShow: () => {\n editor.moveCursorTo(0, 0).focus();\n }\n};\nasync function init() {\n const element = create();\n await CloudCmd.View();\n await loadFiles(element);\n}\nfunction create() {\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_3__('div', {\n style: montag__WEBPACK_IMPORTED_MODULE_0__`\n width: 100%;\n height: 100%;\n font-family: \"Droid Sans Mono\";\n `,\n notAppend: true\n });\n Element = element;\n return element;\n}\nfunction checkFn(name, fn) {\n if (!isFn(fn)) throw Error(`${name} should be a function!`);\n}\nfunction initConfig(options = {}) {\n const config = {\n ...options,\n ...ConfigView\n };\n if (!options.afterShow) return config;\n checkFn('options.afterShow', options.afterShow);\n config.afterShow = () => {\n ConfigView.afterShow();\n options.afterShow();\n };\n return config;\n}\nfunction show(options) {\n if (Loading) return;\n CloudCmd.View.show(Element, initConfig(options));\n getEditor().setOptions({\n fontSize: 16\n });\n}\nfunction getElement() {\n return Element;\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst loadFiles = async element => {\n const prefix = `${CloudCmd.prefix}/${EditorName}`;\n const socketPath = CloudCmd.prefix;\n const prefixSocket = `${CloudCmd.prefixSocket}/${EditorName}`;\n const url = `${prefix}/${EditorName}.js`;\n (0,_common_util__WEBPACK_IMPORTED_MODULE_6__.time)(`${Name} load`);\n await loadJS(url);\n const word = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_1__.promisify)(window[EditorName]);\n const [ed] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(word, element, {\n maxSize: _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__.MAX_FILE_SIZE,\n prefix,\n prefixSocket,\n socketPath\n });\n (0,_common_util__WEBPACK_IMPORTED_MODULE_6__.timeEnd)(`${Name} load`);\n editor = ed;\n Loading = false;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit.mjs\n}");
503
503
 
504
504
  /***/ },
505
505
 
@@ -510,18 +510,18 @@ eval("{/* global CloudCmd */\n\n\n\nconst montag = __webpack_require__(/*! monta
510
510
  (module, exports, __webpack_require__) {
511
511
 
512
512
  "use strict";
513
- eval("{\n\n/* global CloudCmd */\nCloudCmd.Help = exports;\nconst Images = __webpack_require__(/*! ../dom/images.mjs */ \"./client/dom/images.mjs\");\nmodule.exports.init = () => {\n Images.show.load('top');\n};\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nfunction show() {\n const positionLoad = 'top';\n const relative = true;\n CloudCmd.Markdown.show('/HELP.md', {\n positionLoad,\n relative\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/help.js\n}");
513
+ eval("{\n\n/* global CloudCmd */\nCloudCmd.Help = exports;\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nmodule.exports.init = () => {\n Images.show.load('top');\n};\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nfunction show() {\n const positionLoad = 'top';\n const relative = true;\n CloudCmd.Markdown.show('/HELP.md', {\n positionLoad,\n relative\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/help.js\n}");
514
514
 
515
515
  /***/ },
516
516
 
517
- /***/ "./client/modules/konsole.js"
518
- /*!***********************************!*\
519
- !*** ./client/modules/konsole.js ***!
520
- \***********************************/
521
- (module, exports, __webpack_require__) {
517
+ /***/ "./client/modules/konsole.mjs"
518
+ /*!************************************!*\
519
+ !*** ./client/modules/konsole.mjs ***!
520
+ \************************************/
521
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
522
522
 
523
523
  "use strict";
524
- eval("{\n\n/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global Console */\nCloudCmd.Konsole = exports;\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst loadJS = (__webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\").js);\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst Images = __webpack_require__(/*! ../dom/images.mjs */ \"./client/dom/images.mjs\");\nconst {\n Dialog,\n CurrentInfo: Info\n} = DOM;\nconst rmLastSlash = a => a.replace(/\\/$/, '') || '/';\nlet konsole;\nconst {\n config\n} = CloudCmd;\nconst cd = currify((fn, dir) => fn(`cd ${rmLastSlash(dir)}`));\nconst Name = 'Konsole';\nlet Element;\nlet Loaded;\nmodule.exports.init = async () => {\n if (!config('console')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await load();\n await create();\n};\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nmodule.exports.clear = () => {\n konsole.clear();\n};\nconst getPrefix = () => CloudCmd.prefix + '/console';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/console';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath.bind(DOM),\n PASSIVE_DIR: DOM.getNotCurrentDirPath.bind(DOM),\n CURRENT_NAME: DOM.getCurrentName.bind(DOM),\n CURRENT_PATH: () => Info.path\n});\nasync function onPath(path) {\n if (Info.dirPath === path) return;\n await CloudCmd.changeDir(path);\n}\nconst getDirPath = () => {\n if (config('syncConsolePath')) return Info.dirPath;\n};\nconst create = async () => {\n const options = {\n cwd: getDirPath(),\n env: getEnv(),\n prefix: getPrefix(),\n prefixSocket: getPrefixSocket(),\n socketPath: CloudCmd.prefix\n };\n Element = createElement('div', {\n className: 'console'\n });\n konsole = await Console(Element, options);\n konsole.on('connect', exec.with(authCheck, konsole));\n konsole.on('path', config.if('syncConsolePath', onPath));\n CloudCmd.on('active-dir', config.if('syncConsolePath', cd(konsole.handler)));\n konsole.addShortCuts({\n P: () => {\n const command = konsole.getPromptText();\n const path = DOM.getCurrentDirPath();\n konsole.setPromptText(command + path);\n }\n });\n};\nfunction authCheck(konsole) {\n konsole.emit('auth', config('username'), config('password'));\n konsole.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nmodule.exports.show = callback => {\n if (!Loaded) return;\n if (!config('console')) return;\n CloudCmd.View.show(Element, {\n afterShow: () => {\n konsole.focus();\n exec(callback);\n }\n });\n};\nconst load = async () => {\n Util.time(`${Name} load`);\n const prefix = getPrefix();\n const url = `${prefix}/console.js`;\n const [error] = await tryToCatch(loadJS, url);\n Loaded = true;\n Util.timeEnd(`${Name} load`);\n if (error) return Dialog.alert(error.message, {\n cancel: false\n });\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/konsole.js\n}");
524
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global Console */\n\n\n\n\n\n\nCloudCmd.Konsole = {\n init,\n show,\n hide\n};\nconst {\n Dialog,\n CurrentInfo: Info\n} = DOM;\nconst rmLastSlash = a => a.replace(/\\/$/, '') || '/';\nlet konsole;\nconst {\n config\n} = CloudCmd;\nconst cd = currify__WEBPACK_IMPORTED_MODULE_1__((fn, dir) => fn(`cd ${rmLastSlash(dir)}`));\nconst Name = 'Konsole';\nlet Element;\nlet Loaded;\nasync function init() {\n if (!config('console')) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_5__.show.load('top');\n await CloudCmd.View();\n await load();\n await create();\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst clear = () => {\n konsole.clear();\n};\nconst getPrefix = () => CloudCmd.prefix + '/console';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/console';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath.bind(DOM),\n PASSIVE_DIR: DOM.getNotCurrentDirPath.bind(DOM),\n CURRENT_NAME: DOM.getCurrentName.bind(DOM),\n CURRENT_PATH: () => Info.path\n});\nasync function onPath(path) {\n if (Info.dirPath === path) return;\n await CloudCmd.changeDir(path);\n}\nconst getDirPath = () => {\n if (config('syncConsolePath')) return Info.dirPath;\n};\nconst create = async () => {\n const options = {\n cwd: getDirPath(),\n env: getEnv(),\n prefix: getPrefix(),\n prefixSocket: getPrefixSocket(),\n socketPath: CloudCmd.prefix\n };\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__('div', {\n className: 'console'\n });\n konsole = await Console(Element, options);\n konsole.on('connect', execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](authCheck, konsole));\n konsole.on('path', config.if('syncConsolePath', onPath));\n CloudCmd.on('active-dir', config.if('syncConsolePath', cd(konsole.handler)));\n konsole.addShortCuts({\n P: () => {\n const command = konsole.getPromptText();\n const path = DOM.getCurrentDirPath();\n konsole.setPromptText(command + path);\n }\n });\n};\nfunction authCheck(konsole) {\n konsole.emit('auth', config('username'), config('password'));\n konsole.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction show(callback) {\n if (!Loaded) return;\n if (!config('console')) return;\n CloudCmd.View.show(Element, {\n afterShow: () => {\n konsole.focus();\n execon__WEBPACK_IMPORTED_MODULE_0__(callback);\n }\n });\n}\nconst load = async () => {\n Util.time(`${Name} load`);\n const prefix = getPrefix();\n const url = `${prefix}/console.js`;\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_3__.js, url);\n Loaded = true;\n Util.timeEnd(`${Name} load`);\n if (error) return Dialog.alert(error.message, {\n cancel: false\n });\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/konsole.mjs\n}");
525
525
 
526
526
  /***/ },
527
527
 
@@ -532,7 +532,7 @@ eval("{\n\n/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global
532
532
  (module, exports, __webpack_require__) {
533
533
 
534
534
  "use strict";
535
- eval("{\n\n/* global CloudCmd */\nCloudCmd.Markdown = exports;\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst Images = __webpack_require__(/*! ../dom/images.mjs */ \"./client/dom/images.mjs\");\nconst {\n Markdown\n} = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\nconst {\n alert\n} = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\nmodule.exports.init = async () => {\n Images.show.load('top');\n await CloudCmd.View();\n};\nmodule.exports.show = show;\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nasync function show(name, options = {}) {\n const {\n positionLoad,\n relative\n } = options;\n Images.show.load(positionLoad);\n if (relative) name += '?relative';\n const [error, innerHTML] = await Markdown.read(name);\n Images.hide();\n if (error) return alert(error.message, {\n cancel: false\n });\n const className = 'help';\n const div = createElement('div', {\n className,\n innerHTML\n });\n CloudCmd.View.show(div);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/markdown.js\n}");
535
+ eval("{\n\n/* global CloudCmd */\nCloudCmd.Markdown = exports;\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst {\n Markdown\n} = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\nconst {\n alert\n} = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\nmodule.exports.init = async () => {\n Images.show.load('top');\n await CloudCmd.View();\n};\nmodule.exports.show = show;\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nasync function show(name, options = {}) {\n const {\n positionLoad,\n relative\n } = options;\n Images.show.load(positionLoad);\n if (relative) name += '?relative';\n const [error, innerHTML] = await Markdown.read(name);\n Images.hide();\n if (error) return alert(error.message, {\n cancel: false\n });\n const className = 'help';\n const div = createElement('div', {\n className,\n innerHTML\n });\n CloudCmd.View.show(div);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/markdown.js\n}");
536
536
 
537
537
  /***/ },
538
538
 
@@ -554,7 +554,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
554
554
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
555
555
 
556
556
  "use strict";
557
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENABLED: () => (/* binding */ ENABLED),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\n/* harmony import */ var _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\nconst {\n config,\n Key\n} = CloudCmd;\nconst {\n Buffer,\n Events,\n Dialog,\n Images\n} = DOM;\nconst Info = DOM.CurrentInfo;\nconst alertNoFiles = Dialog.alert.noFiles;\nconst uploadTo = wraptile__WEBPACK_IMPORTED_MODULE_1__(_uploadTo);\nlet MenuShowedName;\nlet MenuContext;\nlet MenuContextFile;\nconst ENABLED = false;\nCloudCmd.Menu = {\n init,\n show,\n hide\n};\nasync function init() {\n const {\n isAuth,\n menuDataFile\n } = getFileMenuData();\n const fm = DOM.getFM();\n const menuData = getMenuData(isAuth);\n const options = getOptions({\n type: 'context'\n });\n const optionsFile = getOptions({\n type: 'file'\n });\n const {\n createCloudMenu\n } = await __webpack_require__.e(/*! import() */ \"cloudcmd.common\").then(__webpack_require__.bind(__webpack_require__, /*! ./cloudmenu.mjs */ \"./client/modules/menu/cloudmenu.mjs\"));\n const {\n name\n } = fm.dataset;\n MenuContext = await createCloudMenu(name, options, menuData);\n MenuContextFile = await createCloudMenu(name, optionsFile, menuDataFile);\n MenuContext.addContextMenuListener();\n MenuContextFile.addContextMenuListener();\n Events.addKey(listener);\n}\nfunction hide() {\n MenuContext.hide();\n MenuContextFile.hide();\n}\nfunction show(position) {\n const {\n x,\n y\n } = getPosition(position);\n MenuContext.show(x, y);\n MenuContextFile.show(x, y);\n Images.hide();\n}\nfunction getPosition(position) {\n if (position) return {\n x: position.x,\n y: position.y\n };\n return getCurrentPosition();\n}\nfunction getMenuNameByEl(el) {\n if (!el) return 'context';\n const name = DOM.getCurrentName(el);\n if (name === '..') return 'context';\n return 'contextFile';\n}\nfunction getOptions({\n type\n}) {\n let name;\n let func;\n if (type === 'context') {\n name = 'context';\n func = Key.unsetBind;\n } else if (type === 'file') {\n name = 'contextFile';\n }\n const options = {\n icon: true,\n infiniteScroll: false,\n beforeClose: Key.setBind,\n beforeHide: Key.setBind,\n beforeShow: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](beforeShow, func),\n beforeClick,\n name\n };\n return options;\n}\nfunction getMenuData(isAuth) {\n const menu = {\n 'Paste': Buffer.paste,\n 'New': {\n File: DOM.promptNewFile,\n Directory: DOM.promptNewDir\n },\n 'Upload': () => {\n CloudCmd.Upload.show();\n },\n 'Upload From Cloud': uploadFromCloud,\n 'Toggle File Selection': DOM.toggleSelectedFile,\n '(Un)Select All': DOM.toggleAllSelectedFiles\n };\n if (isAuth) menu['Log Out'] = CloudCmd.logOut;\n return menu;\n}\nfunction getFileMenuData() {\n const isAuth = CloudCmd.config('auth');\n const menuBottom = getMenuData(isAuth);\n const menuTop = {\n 'View': () => {\n CloudCmd.View.show();\n },\n 'Edit': () => {\n const name = config('vim') ? 'EditFileVim' : 'EditFile';\n CloudCmd[name].show();\n },\n 'Rename': () => {\n setTimeout(DOM.renameCurrent, 100);\n },\n 'Delete': () => {\n CloudCmd.Operation.show('delete');\n },\n 'Pack': () => {\n CloudCmd.Operation.show('pack');\n },\n 'Extract': () => {\n CloudCmd.Operation.show('extract');\n },\n 'Download': preDownload,\n 'Upload To Cloud': uploadTo('Cloud'),\n 'Cut': () => {\n isCurrent(Buffer.cut, alertNoFiles);\n },\n 'Copy': () => {\n isCurrent(Buffer.copy, alertNoFiles);\n }\n };\n const menuDataFile = {\n ...menuTop,\n ...menuBottom\n };\n return {\n isAuth,\n menuDataFile\n };\n}\nfunction isCurrent(yesFn, noFn) {\n if (Info.name !== '..') return yesFn();\n noFn();\n}\nfunction isPath(x, y) {\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return false;\n const el = document.elementFromPoint(x, y);\n const elements = panel.querySelectorAll('[data-name=\"js-path\"] *');\n return !~[].indexOf.call(elements, el);\n}\nfunction beforeShow(callback, params) {\n Key.unsetBind();\n const {\n name,\n position = {\n x: params.x,\n y: params.y\n }\n } = params;\n const {\n x,\n y\n } = position;\n const el = DOM.getCurrentByPosition({\n x,\n y\n });\n const menuName = getMenuNameByEl(el);\n let isShow = menuName !== 'contextFile';\n if (params.name === 'contextFile') isShow = !isShow;\n if (isShow) MenuShowedName = name;\n execon__WEBPACK_IMPORTED_MODULE_0__(callback);\n if (isShow) isShow = isPath(x, y);\n return isShow;\n}\nconst beforeClick = name => MenuShowedName !== name;\nasync function _uploadTo(nameModule) {\n const [error, data] = await Info.getData();\n if (error) return;\n const {\n name\n } = Info;\n CloudCmd.execFromModule(nameModule, 'uploadFile', name, data);\n CloudCmd.log(`Uploading to ${name}...`);\n}\nfunction uploadFromCloud() {\n Images.show.load('top');\n CloudCmd.execFromModule('Cloud', 'saveFile', async (currentName, data) => {\n const path = DOM.getCurrentDirPath() + currentName;\n const [e] = await _dom_rest__WEBPACK_IMPORTED_MODULE_4__.write(path, data);\n if (e) return;\n await CloudCmd.refresh({\n currentName\n });\n });\n}\nfunction preDownload() {\n download(config('packer'));\n}\nfunction download(type) {\n const TIME = 30 * 1000;\n const {\n prefixURL\n } = CloudCmd;\n const PACK = '/pack';\n const date = Date.now();\n const files = DOM.getActiveFiles();\n if (!files.length) return alertNoFiles();\n for (const file of files) {\n const selected = DOM.isSelected(file);\n const isDir = DOM.isCurrentIsDir(file);\n const path = DOM.getCurrentPath(file);\n CloudCmd.log(`downloading file ${path}...`);\n\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n * and all other characters, like \"%\"\n */\n const encodedPath = encodeURI(path).replace(/#/g, '#');\n const id = (0,_dom_load__WEBPACK_IMPORTED_MODULE_3__.getIdBySrc)(path);\n let src;\n if (isDir) src = prefixURL + PACK + encodedPath + DOM.getPackerExt(type);else src = prefixURL + _common_cloudfunc_mjs__WEBPACK_IMPORTED_MODULE_5__.FS + encodedPath + '?download';\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__('iframe', {\n id: id + '-' + date,\n async: false,\n className: 'hidden',\n src\n });\n const {\n body\n } = document;\n const removeChild = body.removeChild.bind(body, element);\n setTimeout(removeChild, TIME);\n if (selected) DOM.toggleSelectedFile(file);\n }\n}\nfunction getCurrentPosition() {\n const current = Info.element;\n const rect = current.getBoundingClientRect();\n const position = {\n x: Math.round(rect.left + rect.width / 3),\n y: Math.round(rect.top)\n };\n return position;\n}\nfunction listener(event) {\n const {\n F9,\n ESC\n } = Key;\n const key = event.keyCode;\n const isBind = Key.isBind();\n if (key === ESC) {\n Key.setBind();\n return hide();\n }\n if (isBind && key === F9) {\n const position = getCurrentPosition();\n MenuContext.show(position.x, position.y);\n event.preventDefault();\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/index.mjs\n}");
557
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENABLED: () => (/* binding */ ENABLED),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_load__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/load */ \"./client/dom/load.mjs\");\n/* harmony import */ var _dom_rest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #dom/rest */ \"./client/dom/rest.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\nconst {\n config,\n Key\n} = CloudCmd;\nconst {\n Buffer,\n Events,\n Dialog,\n Images\n} = DOM;\nconst Info = DOM.CurrentInfo;\nconst alertNoFiles = Dialog.alert.noFiles;\nconst uploadTo = wraptile__WEBPACK_IMPORTED_MODULE_1__(_uploadTo);\nlet MenuShowedName;\nlet MenuContext;\nlet MenuContextFile;\nconst ENABLED = false;\nCloudCmd.Menu = {\n init,\n show,\n hide\n};\nasync function init() {\n const {\n isAuth,\n menuDataFile\n } = getFileMenuData();\n const fm = DOM.getFM();\n const menuData = getMenuData(isAuth);\n const options = getOptions({\n type: 'context'\n });\n const optionsFile = getOptions({\n type: 'file'\n });\n const {\n createCloudMenu\n } = await __webpack_require__.e(/*! import() */ \"cloudcmd.common\").then(__webpack_require__.bind(__webpack_require__, /*! ./cloudmenu.mjs */ \"./client/modules/menu/cloudmenu.mjs\"));\n const {\n name\n } = fm.dataset;\n MenuContext = await createCloudMenu(name, options, menuData);\n MenuContextFile = await createCloudMenu(name, optionsFile, menuDataFile);\n MenuContext.addContextMenuListener();\n MenuContextFile.addContextMenuListener();\n Events.addKey(listener);\n}\nfunction hide() {\n MenuContext.hide();\n MenuContextFile.hide();\n}\nfunction show(position) {\n const {\n x,\n y\n } = getPosition(position);\n MenuContext.show(x, y);\n MenuContextFile.show(x, y);\n Images.hide();\n}\nfunction getPosition(position) {\n if (position) return {\n x: position.x,\n y: position.y\n };\n return getCurrentPosition();\n}\nfunction getMenuNameByEl(el) {\n if (!el) return 'context';\n const name = DOM.getCurrentName(el);\n if (name === '..') return 'context';\n return 'contextFile';\n}\nfunction getOptions({\n type\n}) {\n let name;\n let func;\n if (type === 'context') {\n name = 'context';\n func = Key.unsetBind;\n } else if (type === 'file') {\n name = 'contextFile';\n }\n const options = {\n icon: true,\n infiniteScroll: false,\n beforeClose: Key.setBind,\n beforeHide: Key.setBind,\n beforeShow: execon__WEBPACK_IMPORTED_MODULE_0__[\"with\"](beforeShow, func),\n beforeClick,\n name\n };\n return options;\n}\nfunction getMenuData(isAuth) {\n const menu = {\n 'Paste': Buffer.paste,\n 'New': {\n File: DOM.promptNewFile,\n Directory: DOM.promptNewDir\n },\n 'Upload': () => {\n CloudCmd.Upload.show();\n },\n 'Upload From Cloud': uploadFromCloud,\n 'Toggle File Selection': DOM.toggleSelectedFile,\n '(Un)Select All': DOM.toggleAllSelectedFiles\n };\n if (isAuth) menu['Log Out'] = CloudCmd.logOut;\n return menu;\n}\nfunction getFileMenuData() {\n const isAuth = CloudCmd.config('auth');\n const menuBottom = getMenuData(isAuth);\n const menuTop = {\n 'View': () => {\n CloudCmd.View.show();\n },\n 'Edit': () => {\n const name = config('vim') ? 'EditFileVim' : 'EditFile';\n CloudCmd[name].show();\n },\n 'Rename': () => {\n setTimeout(DOM.renameCurrent, 100);\n },\n 'Delete': () => {\n CloudCmd.Operation.show('delete');\n },\n 'Pack': () => {\n CloudCmd.Operation.show('pack');\n },\n 'Extract': () => {\n CloudCmd.Operation.show('extract');\n },\n 'Download': preDownload,\n 'Upload To Cloud': uploadTo('Cloud'),\n 'Cut': () => {\n isCurrent(Buffer.cut, alertNoFiles);\n },\n 'Copy': () => {\n isCurrent(Buffer.copy, alertNoFiles);\n }\n };\n const menuDataFile = {\n ...menuTop,\n ...menuBottom\n };\n return {\n isAuth,\n menuDataFile\n };\n}\nfunction isCurrent(yesFn, noFn) {\n if (Info.name !== '..') return yesFn();\n noFn();\n}\nfunction isPath(x, y) {\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return false;\n const el = document.elementFromPoint(x, y);\n const elements = panel.querySelectorAll('[data-name=\"js-path\"] *');\n return !~[].indexOf.call(elements, el);\n}\nfunction beforeShow(callback, params) {\n Key.unsetBind();\n const {\n name,\n position = {\n x: params.x,\n y: params.y\n }\n } = params;\n const {\n x,\n y\n } = position;\n const el = DOM.getCurrentByPosition({\n x,\n y\n });\n const menuName = getMenuNameByEl(el);\n let isShow = menuName !== 'contextFile';\n if (params.name === 'contextFile') isShow = !isShow;\n if (isShow) MenuShowedName = name;\n execon__WEBPACK_IMPORTED_MODULE_0__(callback);\n if (isShow) isShow = isPath(x, y);\n return isShow;\n}\nconst beforeClick = name => MenuShowedName !== name;\nasync function _uploadTo(nameModule) {\n const [error, data] = await Info.getData();\n if (error) return;\n const {\n name\n } = Info;\n CloudCmd.execFromModule(nameModule, 'uploadFile', name, data);\n CloudCmd.log(`Uploading to ${name}...`);\n}\nfunction uploadFromCloud() {\n Images.show.load('top');\n CloudCmd.execFromModule('Cloud', 'saveFile', async (currentName, data) => {\n const path = DOM.getCurrentDirPath() + currentName;\n const [e] = await _dom_rest__WEBPACK_IMPORTED_MODULE_4__.write(path, data);\n if (e) return;\n await CloudCmd.refresh({\n currentName\n });\n });\n}\nfunction preDownload() {\n download(config('packer'));\n}\nfunction download(type) {\n const TIME = 30 * 1000;\n const {\n prefixURL\n } = CloudCmd;\n const PACK = '/pack';\n const date = Date.now();\n const files = DOM.getActiveFiles();\n if (!files.length) return alertNoFiles();\n for (const file of files) {\n const selected = DOM.isSelected(file);\n const isDir = DOM.isCurrentIsDir(file);\n const path = DOM.getCurrentPath(file);\n CloudCmd.log(`downloading file ${path}...`);\n\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n * and all other characters, like \"%\"\n */\n const encodedPath = encodeURI(path).replace(/#/g, '#');\n const id = (0,_dom_load__WEBPACK_IMPORTED_MODULE_3__.getIdBySrc)(path);\n let src;\n if (isDir) src = prefixURL + PACK + encodedPath + DOM.getPackerExt(type);else src = prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_5__.FS + encodedPath + '?download';\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__('iframe', {\n id: id + '-' + date,\n async: false,\n className: 'hidden',\n src\n });\n const {\n body\n } = document;\n const removeChild = body.removeChild.bind(body, element);\n setTimeout(removeChild, TIME);\n if (selected) DOM.toggleSelectedFile(file);\n }\n}\nfunction getCurrentPosition() {\n const current = Info.element;\n const rect = current.getBoundingClientRect();\n const position = {\n x: Math.round(rect.left + rect.width / 3),\n y: Math.round(rect.top)\n };\n return position;\n}\nfunction listener(event) {\n const {\n F9,\n ESC\n } = Key;\n const key = event.keyCode;\n const isBind = Key.isBind();\n if (key === ESC) {\n Key.setBind();\n return hide();\n }\n if (isBind && key === F9) {\n const position = getCurrentPosition();\n MenuContext.show(position.x, position.y);\n event.preventDefault();\n }\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/index.mjs\n}");
558
558
 
559
559
  /***/ },
560
560
 
@@ -587,7 +587,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
587
587
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
588
588
 
589
589
  "use strict";
590
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _common_entity_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../common/entity.js */ \"./common/entity.js\");\n/* harmony import */ var _remove_extension_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./remove-extension.mjs */ \"./client/modules/operation/remove-extension.mjs\");\n/* harmony import */ var _set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./set-listeners.mjs */ \"./client/modules/operation/set-listeners.mjs\");\n/* harmony import */ var _get_next_current_name_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-next-current-name.mjs */ \"./client/modules/operation/get-next-current-name.mjs\");\n\n\n\n\n\n\n\n\n\n\nconst {\n DOM,\n CloudCmd\n} = globalThis;\nconst removeQuery = a => a.replace(/\\?.*/, '');\nconst Name = 'Operation';\nconst {\n config\n} = CloudCmd;\nconst {\n Dialog,\n Images\n} = DOM;\nconst authCheck = wraptile__WEBPACK_IMPORTED_MODULE_1__(_authCheck);\nconst Operation = {};\nlet Loaded;\nlet copyFn;\nlet moveFn;\nlet deleteFn;\nlet extractFn;\nlet packZipFn;\nlet packTarFn;\nconst Info = DOM.CurrentInfo;\nconst showLoad = Images.show.load.bind(null, 'top');\nconst processFiles = currify__WEBPACK_IMPORTED_MODULE_0__(_processFiles);\nconst noFilesCheck = () => {\n const {\n length\n } = DOM.getActiveFiles();\n const is = Boolean(!length);\n if (is) return Dialog.alert.noFiles();\n return is;\n};\nconst init = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_2__.promisify)(callback => {\n showLoad();\n execon__WEBPACK_IMPORTED_MODULE_3__.series([DOM.loadSocket, async callback => {\n if (config('dropbox')) return callback();\n const {\n prefix,\n prefixSocket\n } = CloudCmd;\n await loadAll();\n await initOperations(prefix, prefixSocket, callback);\n }, callback => {\n Loaded = true;\n Images.hide();\n callback();\n }], callback);\n});\nfunction _authCheck(spawn, ok) {\n const accept = wraptile__WEBPACK_IMPORTED_MODULE_1__(ok);\n const alertDialog = wraptile__WEBPACK_IMPORTED_MODULE_1__(Dialog.alert);\n spawn.on('accept', accept(spawn));\n spawn.on('reject', alertDialog('Wrong credentials!'));\n spawn.emit('auth', config('username'), config('password'));\n}\nconst onConnect = currify__WEBPACK_IMPORTED_MODULE_0__((fn, operator) => {\n setOperations(operator);\n fn();\n});\nasync function initOperations(prefix, socketPrefix, fn) {\n socketPrefix = `${socketPrefix}/fileop`;\n const operator = await globalThis.fileop({\n prefix,\n socketPrefix\n });\n operator.on('connect', authCheck(operator, onConnect(fn)));\n}\nfunction setOperations(operator) {\n packTarFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Tar';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.tar(from, to, names).then(listen);\n };\n packZipFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Zip';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.zip(from, to, names).then(listen);\n };\n deleteFn = (from, files, callback) => {\n from = removeQuery(from);\n const operation = 'Delete';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from\n });\n operator.remove(from, files).then(listen);\n };\n copyFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Copy';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n to,\n names\n });\n operator.copy(from, to, names).then(listen);\n };\n moveFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Move';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n to\n });\n operator.move(from, to, names).then(listen);\n };\n extractFn = ({\n from,\n to\n }, callback) => {\n const operation = 'Extract';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.extract(from, to).then(listen);\n };\n}\nfunction getPacker(type) {\n if (type === 'zip') return packZipFn;\n return packTarFn;\n}\nconst hide = () => {\n CloudCmd.View.hide();\n};\nconst show = (operation, data) => {\n if (!Loaded) return;\n if (operation === 'copy') return Operation.copy(data);\n if (operation === 'move') return Operation.move(data);\n if (operation === 'delete') return Operation.delete();\n if (operation === 'delete:silent') return Operation.deleteSilent();\n if (operation === 'pack') return Operation.pack();\n if (operation === 'extract') return Operation.extract();\n};\nOperation.copy = processFiles({\n type: 'copy'\n});\nOperation.move = processFiles({\n type: 'move'\n});\nOperation.delete = promptDelete;\nOperation.deleteSilent = deleteSilent;\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\nOperation.extract = () => {\n twopack('extract');\n};\n\n/**\n * prompt and delete current file or selected files\n *\n * @currentFile\n */\nasync function promptDelete() {\n if (noFilesCheck()) return;\n const msgAsk = 'Do you really want to delete the ';\n const msgSel = 'selected ';\n const files = DOM.getActiveFiles();\n const names = DOM.getFilenames(files);\n const n = names.length;\n let msg;\n if (n) {\n let name = '';\n for (let i = 0; i < 5 && i < n; i++) name += '\\n' + names[i];\n if (n >= 5) name += '\\n...';\n msg = msgAsk + msgSel + n + ' files/directories?\\n' + (0,_common_entity_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 = (0,_get_next_current_name_mjs__WEBPACK_IMPORTED_MODULE_9__.getNextCurrentName)(currentName, names, removedNames);\n deleteFn(path + query, removedNames, async () => {\n await CloudCmd.refresh();\n const names = Info.files.map(DOM.getCurrentName);\n const isCurrent = names.includes(currentName);\n const name = isCurrent ? currentName : nextCurrentName;\n DOM.setCurrentByName(name);\n });\n}\n\n/*\n * process files (copy or move)\n * @param data\n * @param operation\n */\nasync function _processFiles(options, data) {\n let selFiles;\n let files;\n let panel;\n let shouldAsk;\n let ok;\n let from = '';\n let to = '';\n let names = [];\n if (data) {\n ({\n from,\n to,\n names\n } = data);\n ({\n panel\n } = Info);\n } else {\n from = Info.dirPath;\n to = DOM.getNotCurrentDirPath();\n selFiles = DOM.getSelectedFiles();\n names = DOM.getFilenames(selFiles);\n data = {};\n shouldAsk = true;\n panel = Info.panelPassive;\n }\n if (!names.length) names.push(DOM.getCurrentName());\n const [name] = names;\n const sameName = DOM.getCurrentByName(name, panel);\n if (!data && noFilesCheck()) return;\n const {\n type\n } = options;\n const isCopy = type === 'copy';\n const option = isCopy ? 'confirmCopy' : 'confirmMove';\n const title = isCopy ? 'Copy' : 'Rename/Move';\n const operation = isCopy ? copyFn : moveFn;\n if (shouldAsk && config(option)) {\n const [cancel, newTo] = await prompt(title, to, names.map(_common_entity_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 = (0,_remove_extension_mjs__WEBPACK_IMPORTED_MODULE_7__.removeExtension)(currentName);\n break;\n case 'pack':\n op = getPacker(type);\n if (names.length > 1) currentName = Info.dir;\n currentName += DOM.getPackerExt(type);\n fileFrom = {\n from: dirPath,\n to: dirPath + currentName,\n names\n };\n break;\n }\n showLoad();\n op(fileFrom, error => {\n !error && CloudCmd.refresh({\n currentName\n });\n });\n}\nasync function prompt(msg, to, names) {\n const n = names.length;\n const [name] = names;\n msg += ' ';\n if (names.length > 1) msg += `${n} file(s)`;else msg += `\"${name}\"`;\n msg += ' to';\n return await Dialog.prompt(msg, to);\n}\nglobalThis.CloudCmd[Name] = {\n init,\n hide,\n show\n};\nasync function loadAll() {\n const {\n prefix\n } = globalThis.CloudCmd;\n const file = `${prefix}/fileop/fileop.js`;\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_4__.js, file);\n if (error) Dialog.alert(error.message);\n Loaded = true;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/index.mjs\n}");
590
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n/* harmony import */ var _remove_extension_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./remove-extension.mjs */ \"./client/modules/operation/remove-extension.mjs\");\n/* harmony import */ var _set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./set-listeners.mjs */ \"./client/modules/operation/set-listeners.mjs\");\n/* harmony import */ var _get_next_current_name_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-next-current-name.mjs */ \"./client/modules/operation/get-next-current-name.mjs\");\n\n\n\n\n\n\n\n\n\n\nconst {\n DOM,\n CloudCmd\n} = globalThis;\nconst removeQuery = a => a.replace(/\\?.*/, '');\nconst Name = 'Operation';\nconst {\n config\n} = CloudCmd;\nconst {\n Dialog,\n Images\n} = DOM;\nconst authCheck = wraptile__WEBPACK_IMPORTED_MODULE_1__(_authCheck);\nconst Operation = {};\nlet Loaded;\nlet copyFn;\nlet moveFn;\nlet deleteFn;\nlet extractFn;\nlet packZipFn;\nlet packTarFn;\nconst Info = DOM.CurrentInfo;\nconst showLoad = Images.show.load.bind(null, 'top');\nconst processFiles = currify__WEBPACK_IMPORTED_MODULE_0__(_processFiles);\nconst noFilesCheck = () => {\n const {\n length\n } = DOM.getActiveFiles();\n const is = Boolean(!length);\n if (is) return Dialog.alert.noFiles();\n return is;\n};\nconst init = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_2__.promisify)(callback => {\n showLoad();\n execon__WEBPACK_IMPORTED_MODULE_3__.series([DOM.loadSocket, async callback => {\n if (config('dropbox')) return callback();\n const {\n prefix,\n prefixSocket\n } = CloudCmd;\n await loadAll();\n await initOperations(prefix, prefixSocket, callback);\n }, callback => {\n Loaded = true;\n Images.hide();\n callback();\n }], callback);\n});\nfunction _authCheck(spawn, ok) {\n const accept = wraptile__WEBPACK_IMPORTED_MODULE_1__(ok);\n const alertDialog = wraptile__WEBPACK_IMPORTED_MODULE_1__(Dialog.alert);\n spawn.on('accept', accept(spawn));\n spawn.on('reject', alertDialog('Wrong credentials!'));\n spawn.emit('auth', config('username'), config('password'));\n}\nconst onConnect = currify__WEBPACK_IMPORTED_MODULE_0__((fn, operator) => {\n setOperations(operator);\n fn();\n});\nasync function initOperations(prefix, socketPrefix, fn) {\n socketPrefix = `${socketPrefix}/fileop`;\n const operator = await globalThis.fileop({\n prefix,\n socketPrefix\n });\n operator.on('connect', authCheck(operator, onConnect(fn)));\n}\nfunction setOperations(operator) {\n packTarFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Tar';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.tar(from, to, names).then(listen);\n };\n packZipFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Zip';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.zip(from, to, names).then(listen);\n };\n deleteFn = (from, files, callback) => {\n from = removeQuery(from);\n const operation = 'Delete';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from\n });\n operator.remove(from, files).then(listen);\n };\n copyFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Copy';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n to,\n names\n });\n operator.copy(from, to, names).then(listen);\n };\n moveFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Move';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n from,\n to\n });\n operator.move(from, to, names).then(listen);\n };\n extractFn = ({\n from,\n to\n }, callback) => {\n const operation = 'Extract';\n const listen = (0,_set_listeners_mjs__WEBPACK_IMPORTED_MODULE_8__.setListeners)({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.extract(from, to).then(listen);\n };\n}\nfunction getPacker(type) {\n if (type === 'zip') return packZipFn;\n return packTarFn;\n}\nconst hide = () => {\n CloudCmd.View.hide();\n};\nconst show = (operation, data) => {\n if (!Loaded) return;\n if (operation === 'copy') return Operation.copy(data);\n if (operation === 'move') return Operation.move(data);\n if (operation === 'delete') return Operation.delete();\n if (operation === 'delete:silent') return Operation.deleteSilent();\n if (operation === 'pack') return Operation.pack();\n if (operation === 'extract') return Operation.extract();\n};\nOperation.copy = processFiles({\n type: 'copy'\n});\nOperation.move = processFiles({\n type: 'move'\n});\nOperation.delete = promptDelete;\nOperation.deleteSilent = deleteSilent;\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\nOperation.extract = () => {\n twopack('extract');\n};\n\n/**\n * prompt and delete current file or selected files\n *\n * @currentFile\n */\nasync function promptDelete() {\n if (noFilesCheck()) return;\n const msgAsk = 'Do you really want to delete the ';\n const msgSel = 'selected ';\n const files = DOM.getActiveFiles();\n const names = DOM.getFilenames(files);\n const n = names.length;\n let msg;\n if (n) {\n let name = '';\n for (let i = 0; i < 5 && i < n; i++) name += '\\n' + names[i];\n if (n >= 5) name += '\\n...';\n msg = msgAsk + msgSel + n + ' files/directories?\\n' + (0,_common_entity__WEBPACK_IMPORTED_MODULE_6__.encode)(name);\n } else {\n const current = DOM.getCurrentFile();\n const isDir = DOM.isCurrentIsDir(current);\n const getType = isDir => isDir ? 'directory' : 'file';\n const type = getType(isDir) + ' ';\n const name = DOM.getCurrentName(current);\n msg = msgAsk + msgSel + type + name + '?';\n }\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n deleteSilent(files);\n}\n\n/**\n * delete current or selected files\n *\n * @files\n */\nfunction deleteSilent(files = DOM.getActiveFiles()) {\n const query = '?files';\n const path = Info.dirPath;\n if (noFilesCheck()) return;\n showLoad();\n const removedNames = DOM.getFilenames(files);\n const names = DOM.CurrentInfo.files.map(DOM.getCurrentName);\n const currentName = DOM.getCurrentName();\n const nextCurrentName = (0,_get_next_current_name_mjs__WEBPACK_IMPORTED_MODULE_9__.getNextCurrentName)(currentName, names, removedNames);\n deleteFn(path + query, removedNames, async () => {\n await CloudCmd.refresh();\n const names = Info.files.map(DOM.getCurrentName);\n const isCurrent = names.includes(currentName);\n const name = isCurrent ? currentName : nextCurrentName;\n DOM.setCurrentByName(name);\n });\n}\n\n/*\n * process files (copy or move)\n * @param data\n * @param operation\n */\nasync function _processFiles(options, data) {\n let selFiles;\n let files;\n let panel;\n let shouldAsk;\n let ok;\n let from = '';\n let to = '';\n let names = [];\n if (data) {\n ({\n from,\n to,\n names\n } = data);\n ({\n panel\n } = Info);\n } else {\n from = Info.dirPath;\n to = DOM.getNotCurrentDirPath();\n selFiles = DOM.getSelectedFiles();\n names = DOM.getFilenames(selFiles);\n data = {};\n shouldAsk = true;\n panel = Info.panelPassive;\n }\n if (!names.length) names.push(DOM.getCurrentName());\n const [name] = names;\n const sameName = DOM.getCurrentByName(name, panel);\n if (!data && noFilesCheck()) return;\n const {\n type\n } = options;\n const isCopy = type === 'copy';\n const option = isCopy ? 'confirmCopy' : 'confirmMove';\n const title = isCopy ? 'Copy' : 'Rename/Move';\n const operation = isCopy ? copyFn : moveFn;\n if (shouldAsk && config(option)) {\n const [cancel, newTo] = await prompt(title, to, names.map(_common_entity__WEBPACK_IMPORTED_MODULE_6__.encode));\n if (!cancel) ask(newTo);\n return;\n }\n ask(to);\n function ask(to) {\n ok = from !== to && to;\n if (ok && !shouldAsk || !sameName) return go();\n const str = `\"${name}\" already exist. Overwrite?`;\n const cancel = false;\n Dialog.confirm(str, {\n cancel\n }).then(go);\n function go() {\n showLoad();\n files = {\n from,\n to,\n names\n };\n operation(files, async () => {\n await DOM.Storage.remove(from);\n const {\n panel,\n panelPassive\n } = Info;\n if (!Info.isOnePanel) CloudCmd.refresh({\n panel: panelPassive,\n noCurrent: true\n });\n CloudCmd.refresh({\n panel\n });\n });\n }\n }\n}\nfunction checkEmpty(name, operation) {\n if (!operation) throw Error(`${name} could not be empty!`);\n}\nfunction twopack(operation, type) {\n let op;\n let fileFrom;\n let currentName = Info.name;\n const {\n path,\n dirPath\n } = Info;\n const activeFiles = DOM.getActiveFiles();\n const names = DOM.getFilenames(activeFiles);\n checkEmpty('operation', operation);\n if (!names.length) return Dialog.alert.noFiles();\n switch (operation) {\n case 'extract':\n op = extractFn;\n fileFrom = {\n from: path,\n to: dirPath\n };\n currentName = (0,_remove_extension_mjs__WEBPACK_IMPORTED_MODULE_7__.removeExtension)(currentName);\n break;\n case 'pack':\n op = getPacker(type);\n if (names.length > 1) currentName = Info.dir;\n currentName += DOM.getPackerExt(type);\n fileFrom = {\n from: dirPath,\n to: dirPath + currentName,\n names\n };\n break;\n }\n showLoad();\n op(fileFrom, error => {\n !error && CloudCmd.refresh({\n currentName\n });\n });\n}\nasync function prompt(msg, to, names) {\n const n = names.length;\n const [name] = names;\n msg += ' ';\n if (names.length > 1) msg += `${n} file(s)`;else msg += `\"${name}\"`;\n msg += ' to';\n return await Dialog.prompt(msg, to);\n}\nglobalThis.CloudCmd[Name] = {\n init,\n hide,\n show\n};\nasync function loadAll() {\n const {\n prefix\n } = globalThis.CloudCmd;\n const file = `${prefix}/fileop/fileop.js`;\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_4__.js, file);\n if (error) Dialog.alert(error.message);\n Loaded = true;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/operation/index.mjs\n}");
591
591
 
592
592
  /***/ },
593
593
 
@@ -631,7 +631,7 @@ eval("{\n\n__webpack_require__(/*! domtokenlist-shim */ \"./node_modules/domtoke
631
631
  (module, exports, __webpack_require__) {
632
632
 
633
633
  "use strict";
634
- eval("{\n\n/* global CloudCmd, gritty */\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.cjs\");\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst DOM = __webpack_require__(/*! ../dom/index.mjs */ \"./client/dom/index.mjs\");\nconst Images = __webpack_require__(/*! ../dom/images.mjs */ \"./client/dom/images.mjs\");\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = fullstore();\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await tryToCatch(load.parallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(globalThis.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n};\nmodule.exports.show = promisify((options = {}, fn) => {\n if (!Loaded) return fn(null, -1);\n if (!config('terminal')) return;\n create(options);\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n },\n afterClose: (/* exec.series args */\n ) => {\n fn(null, exitCodeStore());\n }\n });\n});\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n});\nfunction create(createOptions) {\n const {\n cwd = DOM.getCurrentDirPath(),\n command,\n autoClose,\n closeMessage = 'Press any key to close Terminal...'\n } = createOptions;\n const options = {\n cwd,\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono',\n command,\n autoRestart: false\n };\n let commandExit = false;\n const {\n socket,\n terminal\n } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (commandExit) hide();\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('exit', code => {\n exitCodeStore(code);\n if (autoClose) return hide();\n terminal.write(`\\n${closeMessage}`);\n commandExit = true;\n });\n Socket.on('connect', exec.with(authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/terminal-run.js\n}");
634
+ eval("{\n\n/* global CloudCmd, gritty */\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.cjs\");\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst DOM = __webpack_require__(/*! ../dom/index.mjs */ \"./client/dom/index.mjs\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = fullstore();\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await tryToCatch(load.parallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(globalThis.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n};\nmodule.exports.show = promisify((options = {}, fn) => {\n if (!Loaded) return fn(null, -1);\n if (!config('terminal')) return;\n create(options);\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n },\n afterClose: (/* exec.series args */\n ) => {\n fn(null, exitCodeStore());\n }\n });\n});\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n});\nfunction create(createOptions) {\n const {\n cwd = DOM.getCurrentDirPath(),\n command,\n autoClose,\n closeMessage = 'Press any key to close Terminal...'\n } = createOptions;\n const options = {\n cwd,\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono',\n command,\n autoRestart: false\n };\n let commandExit = false;\n const {\n socket,\n terminal\n } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (commandExit) hide();\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('exit', code => {\n exitCodeStore(code);\n if (autoClose) return hide();\n terminal.write(`\\n${closeMessage}`);\n commandExit = true;\n });\n Socket.on('connect', exec.with(authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/terminal-run.js\n}");
635
635
 
636
636
  /***/ },
637
637
 
@@ -642,7 +642,7 @@ eval("{\n\n/* global CloudCmd, gritty */\nconst {\n promisify\n} = __webpack_re
642
642
  (module, exports, __webpack_require__) {
643
643
 
644
644
  "use strict";
645
- eval("{\n\n/* global CloudCmd */\n/* global gritty */\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst DOM = __webpack_require__(/*! ../dom/index.mjs */ \"./client/dom/index.mjs\");\nconst Images = __webpack_require__(/*! ../dom/images.mjs */ \"./client/dom/images.mjs\");\nconst loadParallel = load.parallel;\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.Terminal = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await tryToCatch(loadParallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(globalThis.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n create();\n};\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n});\nfunction create() {\n const options = {\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono'\n };\n const {\n socket,\n terminal\n } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('connect', exec.with(authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction show() {\n if (!Loaded) return;\n if (!config('terminal')) return;\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n }\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/terminal.js\n}");
645
+ eval("{\n\n/* global CloudCmd */\n/* global gritty */\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst DOM = __webpack_require__(/*! ../dom/index.mjs */ \"./client/dom/index.mjs\");\nconst Images = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\nconst loadParallel = load.parallel;\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.Terminal = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await tryToCatch(loadParallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(globalThis.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n create();\n};\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n});\nfunction create() {\n const options = {\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono'\n };\n const {\n socket,\n terminal\n } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('connect', exec.with(authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction show() {\n if (!Loaded) return;\n if (!config('terminal')) return;\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n }\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/terminal.js\n}");
646
646
 
647
647
  /***/ },
648
648
 
@@ -653,7 +653,7 @@ eval("{\n\n/* global CloudCmd */\n/* global gritty */\nconst {\n tryToCatch\n}
653
653
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
654
654
 
655
655
  "use strict";
656
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_upload_files__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/upload-files */ \"./client/dom/upload-files.mjs\");\n/* harmony import */ var _dom_images_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../dom/images.mjs */ \"./client/dom/images.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\nCloudCmd.Upload = {\n init,\n show,\n hide\n};\nasync function init() {\n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_3__.show.load('top');\n await CloudCmd.View();\n}\nasync function show() {\n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_3__.show.load('top');\n const innerHTML = await _dom_files__WEBPACK_IMPORTED_MODULE_1__.get('upload');\n const autoSize = true;\n const el = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('div', {\n innerHTML\n });\n CloudCmd.View.show(el, {\n autoSize,\n afterShow\n });\n const fontFamily = ['\"Droid Sans Mono\"', '\"Ubuntu Mono\"', '\"Consolas\"', 'monospace'].join(', ');\n _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('style', {\n dataName: 'upload-css',\n innerText: `[data-name=js-upload-file-button] {\n font-family: ${fontFamily};\n font-size: 16px;\n margin: 10px 0 10px 0;\n }`\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nfunction afterShow() {\n const button = DOM.getByDataName('js-upload-file-button');\n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_3__.hide();\n DOM.Events.add('change', button, ({\n target\n }) => {\n const {\n files\n } = target;\n hide();\n (0,_dom_upload_files__WEBPACK_IMPORTED_MODULE_2__.uploadFiles)(files);\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/upload.mjs\n}");
656
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_upload_files__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #dom/upload-files */ \"./client/dom/upload-files.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\nCloudCmd.Upload = {\n init,\n show,\n hide\n};\nasync function init() {\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.show.load('top');\n await CloudCmd.View();\n}\nasync function show() {\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.show.load('top');\n const innerHTML = await _dom_files__WEBPACK_IMPORTED_MODULE_1__.get('upload');\n const autoSize = true;\n const el = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('div', {\n innerHTML\n });\n CloudCmd.View.show(el, {\n autoSize,\n afterShow\n });\n const fontFamily = ['\"Droid Sans Mono\"', '\"Ubuntu Mono\"', '\"Consolas\"', 'monospace'].join(', ');\n _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_0__('style', {\n dataName: 'upload-css',\n innerText: `[data-name=js-upload-file-button] {\n font-family: ${fontFamily};\n font-size: 16px;\n margin: 10px 0 10px 0;\n }`\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nfunction afterShow() {\n const button = DOM.getByDataName('js-upload-file-button');\n _dom_images__WEBPACK_IMPORTED_MODULE_3__.hide();\n DOM.Events.add('change', button, ({\n target\n }) => {\n const {\n files\n } = target;\n hide();\n (0,_dom_upload_files__WEBPACK_IMPORTED_MODULE_2__.uploadFiles)(files);\n });\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/upload.mjs\n}");
657
657
 
658
658
  /***/ },
659
659
 
@@ -675,7 +675,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
675
675
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
676
676
 
677
677
  "use strict";
678
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var 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 fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var try_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _babel_code_frame__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/code-frame */ \"./node_modules/@babel/code-frame/lib/index.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _css_user_menu_css__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../css/user-menu.css */ \"./css/user-menu.css\");\n/* harmony import */ var _dom_images_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../dom/images.mjs */ \"./client/dom/images.mjs\");\n/* harmony import */ var _get_user_menu_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./get-user-menu.mjs */ \"./client/modules/user-menu/get-user-menu.mjs\");\n/* harmony import */ var _navigate_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./navigate.mjs */ \"./client/modules/user-menu/navigate.mjs\");\n/* harmony import */ var _parse_error_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./parse-error.mjs */ \"./client/modules/user-menu/parse-error.mjs\");\n/* harmony import */ var _parse_user_menu_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./parse-user-menu.mjs */ \"./client/modules/user-menu/parse-user-menu.mjs\");\n/* harmony import */ var _run_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./run.mjs */ \"./client/modules/user-menu/run.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_3__.css;\nconst sourceStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__.fullstore)();\nconst Name = 'UserMenu';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst {\n Key\n} = CloudCmd;\nasync function init() {\n await Promise.all([loadCSS(`${CloudCmd.prefix}/dist/user-menu.css`), CloudCmd.View()]);\n}\nconst {\n CurrentInfo\n} = DOM;\nasync function show() {\n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_10__.show.load('top');\n const {\n dirPath\n } = CurrentInfo;\n const res = await fetch(`${CloudCmd.prefix}/api/v1/user-menu?dir=${dirPath}`);\n const source = await res.text();\n const [error, userMenu] = (0,try_catch__WEBPACK_IMPORTED_MODULE_5__.tryCatch)(_get_user_menu_mjs__WEBPACK_IMPORTED_MODULE_11__.getUserMenu, source);\n _dom_images_mjs__WEBPACK_IMPORTED_MODULE_10__.hide();\n if (error) return _dom_dialog__WEBPACK_IMPORTED_MODULE_8__.alert(getCodeFrame({\n error,\n source\n }));\n sourceStore(source);\n const {\n names,\n keys,\n items,\n settings\n } = (0,_parse_user_menu_mjs__WEBPACK_IMPORTED_MODULE_14__.parseUserMenu)(userMenu);\n if (settings.run) return (0,_run_mjs__WEBPACK_IMPORTED_MODULE_15__.runSelected)(settings.select, items, runUserMenu);\n const button = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__('button', {\n className: 'cloudcmd-user-menu-button',\n innerText: 'User Menu',\n notAppend: true\n });\n const select = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_4__('select', {\n className: 'cloudcmd-user-menu',\n innerHTML: fillTemplate(names),\n notAppend: true,\n size: 10\n });\n button.addEventListener('click', onButtonClick(userMenu, select));\n select.addEventListener('dblclick', onDblClick(userMenu));\n select.addEventListener('keydown', onKeyDown({\n keys,\n userMenu\n }));\n const afterShow = () => select.focus();\n const autoSize = true;\n CloudCmd.View.show([button, select], {\n autoSize,\n afterShow\n });\n}\nfunction fillTemplate(options) {\n const result = [];\n for (const option of options) result.push(`<option>${option}</option>`);\n return result.join('');\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst onDblClick = currify__WEBPACK_IMPORTED_MODULE_0__(async (items, e) => {\n const {\n value\n } = e.target;\n await runUserMenu(items[value]);\n});\nconst onButtonClick = wraptile__WEBPACK_IMPORTED_MODULE_1__(async (items, {\n value\n}) => {\n await runUserMenu(items[value]);\n});\nconst onKeyDown = currify__WEBPACK_IMPORTED_MODULE_0__(async ({\n keys,\n userMenu\n}, e) => {\n const {\n keyCode,\n target\n } = e;\n const keyName = e.key.toUpperCase();\n e.preventDefault();\n e.stopPropagation();\n let value;\n if (keyCode === Key.ESC) return hide();\n if (keyCode === Key.ENTER) value = userMenu[target.value];else if (keys[keyName]) value = keys[keyName];else return (0,_navigate_mjs__WEBPACK_IMPORTED_MODULE_12__.navigate)(target, e);\n await runUserMenu(value);\n});\nconst runUserMenu = async fn => {\n hide();\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_6__.tryToCatch)(fn, {\n DOM,\n CloudCmd,\n tryToCatch: try_to_catch__WEBPACK_IMPORTED_MODULE_6__.tryToCatch\n });\n if (!error) return;\n const source = sourceStore();\n return _dom_dialog__WEBPACK_IMPORTED_MODULE_8__.alert(getCodeFrame({\n error,\n source\n }));\n};\nfunction getCodeFrame({\n error,\n source\n}) {\n const {\n code\n } = error;\n if (!code || code === 'frame') return error.message;\n const [line, column] = (0,_parse_error_mjs__WEBPACK_IMPORTED_MODULE_13__.parseError)(error);\n const start = {\n line,\n column\n };\n const location = {\n start\n };\n const frame = (0,_babel_code_frame__WEBPACK_IMPORTED_MODULE_7__.codeFrameColumns)(source, location, {\n message: error.message,\n highlightCode: false\n });\n return `<pre>${frame}</pre>`;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/index.mjs\n}");
678
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_user_menu_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/user-menu.css */ \"./css/user-menu.css\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var try_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _babel_code_frame__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/code-frame */ \"./node_modules/@babel/code-frame/lib/index.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _get_user_menu_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./get-user-menu.mjs */ \"./client/modules/user-menu/get-user-menu.mjs\");\n/* harmony import */ var _navigate_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./navigate.mjs */ \"./client/modules/user-menu/navigate.mjs\");\n/* harmony import */ var _parse_error_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./parse-error.mjs */ \"./client/modules/user-menu/parse-error.mjs\");\n/* harmony import */ var _parse_user_menu_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./parse-user-menu.mjs */ \"./client/modules/user-menu/parse-user-menu.mjs\");\n/* harmony import */ var _run_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./run.mjs */ \"./client/modules/user-menu/run.mjs\");\n/* global CloudCmd, DOM */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_4__.css;\nconst sourceStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_3__.fullstore)();\nconst Name = 'UserMenu';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst {\n Key\n} = CloudCmd;\nasync function init() {\n await Promise.all([loadCSS(`${CloudCmd.prefix}/dist/user-menu.css`), CloudCmd.View()]);\n}\nconst {\n CurrentInfo\n} = DOM;\nasync function show() {\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load('top');\n const {\n dirPath\n } = CurrentInfo;\n const res = await fetch(`${CloudCmd.prefix}/api/v1/user-menu?dir=${dirPath}`);\n const source = await res.text();\n const [error, userMenu] = (0,try_catch__WEBPACK_IMPORTED_MODULE_6__.tryCatch)(_get_user_menu_mjs__WEBPACK_IMPORTED_MODULE_11__.getUserMenu, source);\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.hide();\n if (error) return _dom_dialog__WEBPACK_IMPORTED_MODULE_9__.alert(getCodeFrame({\n error,\n source\n }));\n sourceStore(source);\n const {\n names,\n keys,\n items,\n settings\n } = (0,_parse_user_menu_mjs__WEBPACK_IMPORTED_MODULE_14__.parseUserMenu)(userMenu);\n if (settings.run) return (0,_run_mjs__WEBPACK_IMPORTED_MODULE_15__.runSelected)(settings.select, items, runUserMenu);\n const button = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__('button', {\n className: 'cloudcmd-user-menu-button',\n innerText: 'User Menu',\n notAppend: true\n });\n const select = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__('select', {\n className: 'cloudcmd-user-menu',\n innerHTML: fillTemplate(names),\n notAppend: true,\n size: 10\n });\n button.addEventListener('click', onButtonClick(userMenu, select));\n select.addEventListener('dblclick', onDblClick(userMenu));\n select.addEventListener('keydown', onKeyDown({\n keys,\n userMenu\n }));\n const afterShow = () => select.focus();\n const autoSize = true;\n CloudCmd.View.show([button, select], {\n autoSize,\n afterShow\n });\n}\nfunction fillTemplate(options) {\n const result = [];\n for (const option of options) result.push(`<option>${option}</option>`);\n return result.join('');\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst onDblClick = currify__WEBPACK_IMPORTED_MODULE_1__(async (items, e) => {\n const {\n value\n } = e.target;\n await runUserMenu(items[value]);\n});\nconst onButtonClick = wraptile__WEBPACK_IMPORTED_MODULE_2__(async (items, {\n value\n}) => {\n await runUserMenu(items[value]);\n});\nconst onKeyDown = currify__WEBPACK_IMPORTED_MODULE_1__(async ({\n keys,\n userMenu\n}, e) => {\n const {\n keyCode,\n target\n } = e;\n const keyName = e.key.toUpperCase();\n e.preventDefault();\n e.stopPropagation();\n let value;\n if (keyCode === Key.ESC) return hide();\n if (keyCode === Key.ENTER) value = userMenu[target.value];else if (keys[keyName]) value = keys[keyName];else return (0,_navigate_mjs__WEBPACK_IMPORTED_MODULE_12__.navigate)(target, e);\n await runUserMenu(value);\n});\nconst runUserMenu = async fn => {\n hide();\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_7__.tryToCatch)(fn, {\n DOM,\n CloudCmd,\n tryToCatch: try_to_catch__WEBPACK_IMPORTED_MODULE_7__.tryToCatch\n });\n if (!error) return;\n const source = sourceStore();\n return _dom_dialog__WEBPACK_IMPORTED_MODULE_9__.alert(getCodeFrame({\n error,\n source\n }));\n};\nfunction getCodeFrame({\n error,\n source\n}) {\n const {\n code\n } = error;\n if (!code || code === 'frame') return error.message;\n const [line, column] = (0,_parse_error_mjs__WEBPACK_IMPORTED_MODULE_13__.parseError)(error);\n const start = {\n line,\n column\n };\n const location = {\n start\n };\n const frame = (0,_babel_code_frame__WEBPACK_IMPORTED_MODULE_8__.codeFrameColumns)(source, location, {\n message: error.message,\n highlightCode: false\n });\n return `<pre>${frame}</pre>`;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/index.mjs\n}");
679
679
 
680
680
  /***/ },
681
681
 
@@ -723,25 +723,25 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
723
723
 
724
724
  /***/ },
725
725
 
726
- /***/ "./client/modules/view/index.js"
727
- /*!**************************************!*\
728
- !*** ./client/modules/view/index.js ***!
729
- \**************************************/
730
- (module, __unused_webpack_exports, __webpack_require__) {
726
+ /***/ "./client/modules/view/index.mjs"
727
+ /*!***************************************!*\
728
+ !*** ./client/modules/view/index.mjs ***!
729
+ \***************************************/
730
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
731
731
 
732
732
  "use strict";
733
- eval("{/* global CloudCmd, DOM */\n\n\n\nconst CloudCmd = globalThis.CloudCmd || {};\nconst DOM = globalThis.DOM || {};\n__webpack_require__(/*! ../../../css/view.css */ \"./css/view.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 {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst _modal = __webpack_require__(/*! @cloudcmd/modal */ \"./node_modules/@cloudcmd/modal/lib/modal.js\");\nconst _createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst {\n time\n} = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\nconst {\n FS\n} = __webpack_require__(/*! ../../../common/cloudfunc.mjs */ \"./common/cloudfunc.mjs\");\nconst {\n isImage,\n isAudio,\n getType\n} = __webpack_require__(/*! ./types */ \"./client/modules/view/types.js\");\nconst Files = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\nconst Events = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\nconst Images = __webpack_require__(/*! ../../dom/images.mjs */ \"./client/dom/images.mjs\");\nconst {\n encode\n} = __webpack_require__(/*! ../../../common/entity */ \"./common/entity.js\");\nconst isString = a => typeof a === 'string';\nconst {\n assign\n} = Object;\nconst {\n isArray\n} = Array;\nconst lifo = currify((fn, el, cb, name) => fn(name, el, cb));\nconst series = wraptile((...a) => {\n for (const f of a) f();\n});\nconst isFn = a => typeof a === 'function';\nconst noop = () => {};\nconst addEvent = lifo(Events.add);\nconst loadCSS = load.css;\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nlet Loading = false;\nconst Name = 'View';\nCloudCmd[Name] = module.exports;\nconst Info = DOM.CurrentInfo;\nconst {\n Key\n} = CloudCmd;\nconst basename = a => a.split('/').pop();\nlet El;\nlet TemplateAudio;\nlet Overlay;\nconst Config = {\n beforeShow: () => {\n Images.hide();\n Key.unsetBind();\n },\n beforeClose: () => {\n Events.rmKey(listener);\n Key.setBind();\n },\n afterShow: () => {\n El.focus();\n },\n onOverlayClick,\n afterClose: noop,\n autoSize: false,\n helpers: {\n title: {}\n }\n};\nmodule.exports._Config = Config;\nmodule.exports.init = async () => {\n await loadAll();\n const events = ['click', 'contextmenu'];\n events.forEach(addEvent(Overlay, onOverlayClick));\n};\nasync function show(data, options = {}) {\n const prefixURL = CloudCmd.prefixURL + FS;\n if (Loading) return;\n if (!options || options.bindKeys !== false) Events.addKey(listener);\n El = _createElement('div', {\n className: 'view',\n notAppend: true\n });\n El.tabIndex = 0;\n if (data) {\n if (isArray(data)) El.append(...data);else El.append(data);\n _modal.open(El, initConfig(options));\n return;\n }\n Images.show.load();\n const path = prefixURL + Info.path;\n const type = options.raw ? '' : await getType(path);\n switch (type) {\n default:\n return await viewFile();\n case 'markdown':\n return await CloudCmd.Markdown.show(Info.path);\n case 'html':\n return viewHtml(path);\n case 'image':\n return viewImage(Info.path, prefixURL);\n case 'media':\n return await viewMedia(path);\n case 'pdf':\n return viewPDF(path);\n }\n}\nmodule.exports._createIframe = createIframe;\nfunction createIframe(src, overrides = {}) {\n const {\n createElement = _createElement\n } = overrides;\n const element = createElement('iframe', {\n src,\n width: '100%',\n height: '100%'\n });\n element.addEventListener('load', () => {\n element.contentWindow.addEventListener('keydown', listener);\n });\n return element;\n}\nmodule.exports._viewHtml = viewHtml;\nfunction viewHtml(src, overrides = {}) {\n const {\n modal = _modal\n } = overrides;\n modal.open(createIframe(src), Config);\n}\nfunction viewPDF(src) {\n const element = createIframe(src);\n const options = assign({}, Config);\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n _modal.open(element, options);\n}\nasync function viewMedia(path) {\n const [e, element] = await getMediaElement(path);\n if (e) return alert(e);\n const allConfig = {\n ...Config,\n ...{\n autoSize: true,\n afterShow: () => {\n element.querySelector('audio, video').focus();\n }\n }\n };\n _modal.open(element, allConfig);\n}\nasync function viewFile() {\n const [error, data] = await Info.getData();\n if (error) return Images.hide();\n const element = document.createTextNode(data);\n const options = Config;\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n El.append(element);\n _modal.open(El, options);\n}\nconst copy = a => assign({}, a);\nmodule.exports._initConfig = initConfig;\nfunction initConfig(options) {\n const config = copy(Config);\n if (!options) return config;\n const names = Object.keys(options);\n for (const name of names) {\n const isConfig = Boolean(config[name]);\n const item = options[name];\n if (!isFn(item) || !isConfig) {\n config[name] = options[name];\n continue;\n }\n const fn = config[name];\n config[name] = series(fn, item);\n }\n return config;\n}\nfunction hide() {\n _modal.close();\n}\nfunction viewImage(path, prefixURL) {\n const isSupportedImage = a => isImage(a) || a === path;\n const makeTitle = path => ({\n href: `${prefixURL}${path}`,\n title: encode(basename(path))\n });\n const names = Info.files.map(DOM.getCurrentPath).filter(isSupportedImage);\n const titles = names.map(makeTitle);\n const index = names.indexOf(Info.path);\n const imageConfig = {\n index,\n autoSize: true,\n arrows: true,\n keys: true,\n helpers: {\n title: {}\n }\n };\n const config = {\n ...Config,\n ...imageConfig\n };\n _modal.open(titles, config);\n}\nasync function getMediaElement(src) {\n check(src);\n const [error, template] = await tryToCatch(Files.get, 'view/media-tmpl');\n if (error) return [error];\n const {\n name\n } = Info;\n if (!TemplateAudio) TemplateAudio = template;\n const is = isAudio(name);\n const type = is ? 'audio' : 'video';\n const innerHTML = rendy(TemplateAudio, {\n src,\n type,\n name\n });\n const element = _createElement('div', {\n innerHTML\n });\n return [null, element];\n}\nfunction check(src) {\n if (!isString(src)) throw Error('src should be a string!');\n}\nasync function loadAll() {\n const {\n DIR_DIST\n } = CloudCmd;\n time(`${Name} load`);\n Loading = true;\n await loadCSS(`${DIR_DIST}/view.css`);\n Loading = false;\n}\nfunction onOverlayClick(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n setCurrentByPosition(position);\n}\nfunction setCurrentByPosition(position) {\n const element = DOM.getCurrentByPosition(position);\n if (!element) return;\n const {\n files,\n filesPassive\n } = Info;\n const isFiles = files.includes(element);\n const isFilesPassive = filesPassive.includes(element);\n if (!isFiles && !isFilesPassive) return;\n const isCurrent = DOM.isCurrentFile(element);\n if (isCurrent) return;\n DOM.setCurrentFile(element);\n}\nfunction listener({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/index.js\n}");
733
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _Config: () => (/* binding */ _Config),\n/* harmony export */ _createIframe: () => (/* binding */ _createIframe),\n/* harmony export */ _initConfig: () => (/* binding */ _initConfig),\n/* harmony export */ _viewHtml: () => (/* binding */ _viewHtml),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_view_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #css/view.css */ \"./css/view.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @cloudcmd/modal */ \"./node_modules/@cloudcmd/modal/lib/modal.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! #common/util */ \"./common/util.mjs\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.mjs\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.mjs\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.mjs\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.mjs\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n/* harmony import */ var _types_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./types.mjs */ \"./client/modules/view/types.mjs\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst CloudCmd = globalThis.CloudCmd || {};\nconst DOM = globalThis.DOM || {};\nconst isString = a => typeof a === 'string';\nconst {\n assign\n} = Object;\nconst {\n isArray\n} = Array;\nconst lifo = currify__WEBPACK_IMPORTED_MODULE_2__((fn, el, cb, name) => fn(name, el, cb));\nconst series = wraptile__WEBPACK_IMPORTED_MODULE_3__((...a) => {\n for (const f of a) f();\n});\nconst isFn = a => typeof a === 'function';\nconst noop = () => {};\nconst addEvent = lifo(_dom_events__WEBPACK_IMPORTED_MODULE_10__.add);\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_5__.css;\nlet Loading = false;\nconst Name = 'View';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Key\n} = CloudCmd;\nconst basename = a => a.split('/').pop();\nlet El;\nlet TemplateAudio;\nlet Overlay;\nconst Config = {\n beforeShow: () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n Key.unsetBind();\n },\n beforeClose: () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_10__.rmKey(listener);\n Key.setBind();\n },\n afterShow: () => {\n El.focus();\n },\n onOverlayClick,\n afterClose: noop,\n autoSize: false,\n helpers: {\n title: {}\n }\n};\nconst _Config = Config;\nasync function init() {\n await loadAll();\n const events = ['click', 'contextmenu'];\n events.forEach(addEvent(Overlay, onOverlayClick));\n}\nasync function show(data, options = {}) {\n const prefixURL = CloudCmd.prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.FS;\n if (Loading) return;\n if (!options || options.bindKeys !== false) _dom_events__WEBPACK_IMPORTED_MODULE_10__.addKey(listener);\n El = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n className: 'view',\n notAppend: true\n });\n El.tabIndex = 0;\n if (data) {\n if (isArray(data)) El.append(...data);else El.append(data);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, initConfig(options));\n return;\n }\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load();\n const path = prefixURL + Info.path;\n const type = options.raw ? '' : await (0,_types_mjs__WEBPACK_IMPORTED_MODULE_14__.getType)(path);\n switch (type) {\n default:\n return await viewFile();\n case 'markdown':\n return await CloudCmd.Markdown.show(Info.path);\n case 'html':\n return viewHtml(path);\n case 'image':\n return viewImage(Info.path, prefixURL);\n case 'media':\n return await viewMedia(path);\n case 'pdf':\n return viewPDF(path);\n }\n}\nconst _createIframe = createIframe;\nfunction createIframe(src, overrides = {}) {\n const {\n createElement = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__\n } = overrides;\n const element = createElement('iframe', {\n src,\n width: '100%',\n height: '100%'\n });\n element.addEventListener('load', () => {\n element.contentWindow.addEventListener('keydown', listener);\n });\n return element;\n}\nconst _viewHtml = viewHtml;\nfunction viewHtml(src, overrides = {}) {\n const {\n modal = _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__\n } = overrides;\n modal.open(createIframe(src), Config);\n}\nfunction viewPDF(src) {\n const element = createIframe(src);\n const options = assign({}, Config);\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, options);\n}\nasync function viewMedia(path) {\n const [e, element] = await getMediaElement(path);\n if (e) return alert(e);\n const allConfig = {\n ...Config,\n ...{\n autoSize: true,\n afterShow: () => {\n element.querySelector('audio, video').focus();\n }\n }\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, allConfig);\n}\nasync function viewFile() {\n const [error, data] = await Info.getData();\n if (error) return _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n const element = document.createTextNode(data);\n const options = Config;\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n El.append(element);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, options);\n}\nconst copy = a => assign({}, a);\nconst _initConfig = initConfig;\nfunction initConfig(options) {\n const config = copy(Config);\n if (!options) return config;\n const names = Object.keys(options);\n for (const name of names) {\n const isConfig = Boolean(config[name]);\n const item = options[name];\n if (!isFn(item) || !isConfig) {\n config[name] = options[name];\n continue;\n }\n const fn = config[name];\n config[name] = series(fn, item);\n }\n return config;\n}\nfunction hide() {\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.close();\n}\nfunction viewImage(path, prefixURL) {\n const isSupportedImage = a => (0,_types_mjs__WEBPACK_IMPORTED_MODULE_14__.isImage)(a) || a === path;\n const makeTitle = path => ({\n href: `${prefixURL}${path}`,\n title: (0,_common_entity__WEBPACK_IMPORTED_MODULE_13__.encode)(basename(path))\n });\n const names = Info.files.map(DOM.getCurrentPath).filter(isSupportedImage);\n const titles = names.map(makeTitle);\n const index = names.indexOf(Info.path);\n const imageConfig = {\n index,\n autoSize: true,\n arrows: true,\n keys: true,\n helpers: {\n title: {}\n }\n };\n const config = {\n ...Config,\n ...imageConfig\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(titles, config);\n}\nasync function getMediaElement(src) {\n check(src);\n const [error, template] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_9__.get, 'view/media-tmpl');\n if (error) return [error];\n const {\n name\n } = Info;\n if (!TemplateAudio) TemplateAudio = template;\n const is = (0,_types_mjs__WEBPACK_IMPORTED_MODULE_14__.isAudio)(name);\n const type = is ? 'audio' : 'video';\n const innerHTML = rendy__WEBPACK_IMPORTED_MODULE_1__(TemplateAudio, {\n src,\n type,\n name\n });\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n innerHTML\n });\n return [null, element];\n}\nfunction check(src) {\n if (!isString(src)) throw Error('src should be a string!');\n}\nasync function loadAll() {\n const {\n DIR_DIST\n } = CloudCmd;\n (0,_common_util__WEBPACK_IMPORTED_MODULE_8__.time)(`${Name} load`);\n Loading = true;\n await loadCSS(`${DIR_DIST}/view.css`);\n Loading = false;\n}\nfunction onOverlayClick(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n setCurrentByPosition(position);\n}\nfunction setCurrentByPosition(position) {\n const element = DOM.getCurrentByPosition(position);\n if (!element) return;\n const {\n files,\n filesPassive\n } = Info;\n const isFiles = files.includes(element);\n const isFilesPassive = filesPassive.includes(element);\n if (!isFiles && !isFilesPassive) return;\n const isCurrent = DOM.isCurrentFile(element);\n if (isCurrent) return;\n DOM.setCurrentFile(element);\n}\nfunction listener({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/index.mjs\n}");
734
734
 
735
735
  /***/ },
736
736
 
737
- /***/ "./client/modules/view/types.js"
738
- /*!**************************************!*\
739
- !*** ./client/modules/view/types.js ***!
740
- \**************************************/
741
- (module, __unused_webpack_exports, __webpack_require__) {
737
+ /***/ "./client/modules/view/types.mjs"
738
+ /*!***************************************!*\
739
+ !*** ./client/modules/view/types.mjs ***!
740
+ \***************************************/
741
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
742
742
 
743
743
  "use strict";
744
- eval("{\n\nconst {\n extname\n} = __webpack_require__(/*! node:path */ \"./node_modules/path-browserify/index.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isAudio = name => /\\.(mp3|ogg|m4a)$/i.test(name);\nconst testRegExp = currify((name, reg) => reg.test(name));\nconst getRegExp = ext => RegExp(`\\\\.${ext}$`, 'i');\nconst isPDF = a => /\\.pdf$/i.test(a);\nconst isHTML = a => a.endsWith('.html');\nconst isMarkdown = a => /.\\.md$/.test(a);\nmodule.exports.getType = async path => {\n const ext = extname(path);\n if (!ext) path = await detectType(path);\n if (isPDF(path)) return 'pdf';\n if (isImage(path)) return 'image';\n if (isMedia(path)) return 'media';\n if (isHTML(path)) return 'html';\n if (isMarkdown(path)) return 'markdown';\n};\nmodule.exports.isImage = isImage;\nfunction isImage(name) {\n const images = ['jp(e|g|eg)', 'gif', 'png', 'bmp', 'webp', 'svg', 'ico'];\n return images.map(getRegExp).some(testRegExp(name));\n}\nfunction isMedia(name) {\n return isAudio(name) || isVideo(name);\n}\nmodule.exports.isAudio = isAudio;\nfunction isVideo(name) {\n return /\\.(mp4|avi|webm)$/i.test(name);\n}\nmodule.exports._detectType = detectType;\nasync function detectType(path) {\n const {\n headers\n } = await fetch(path, {\n method: 'HEAD'\n });\n for (const [name, value] of headers) {\n if (name === 'content-type') return `.${value.split('/').pop()}`;\n }\n return '';\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/types.js\n}");
744
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _detectType: () => (/* binding */ _detectType),\n/* harmony export */ getType: () => (/* binding */ getType),\n/* harmony export */ isAudio: () => (/* binding */ isAudio),\n/* harmony export */ isImage: () => (/* binding */ isImage)\n/* harmony export */ });\n/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:path */ \"./node_modules/path-browserify/index.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\nconst isAudio = name => /\\.(mp3|ogg|m4a)$/i.test(name);\nconst testRegExp = currify__WEBPACK_IMPORTED_MODULE_1__((name, reg) => reg.test(name));\nconst getRegExp = ext => RegExp(`\\\\.${ext}$`, 'i');\nconst isPDF = a => /\\.pdf$/i.test(a);\nconst isHTML = a => a.endsWith('.html');\nconst isMarkdown = a => /.\\.md$/.test(a);\nconst getType = async path => {\n const ext = (0,node_path__WEBPACK_IMPORTED_MODULE_0__.extname)(path);\n if (!ext) path = await detectType(path);\n if (isPDF(path)) return 'pdf';\n if (isImage(path)) return 'image';\n if (isMedia(path)) return 'media';\n if (isHTML(path)) return 'html';\n if (isMarkdown(path)) return 'markdown';\n};\nfunction isImage(name) {\n const images = ['jp(e|g|eg)', 'gif', 'png', 'bmp', 'webp', 'svg', 'ico'];\n return images.map(getRegExp).some(testRegExp(name));\n}\nfunction isMedia(name) {\n return isAudio(name) || isVideo(name);\n}\nfunction isVideo(name) {\n return /\\.(mp4|avi|webm)$/i.test(name);\n}\nconst _detectType = detectType;\nasync function detectType(path) {\n const {\n headers\n } = await fetch(path, {\n method: 'HEAD'\n });\n for (const [name, value] of headers) {\n if (name === 'content-type') return `.${value.split('/').pop()}`;\n }\n return '';\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/types.mjs\n}");
745
745
 
746
746
  /***/ },
747
747
 
@@ -774,18 +774,18 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
774
774
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
775
775
 
776
776
  "use strict";
777
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FS: () => (/* binding */ FS),\n/* harmony export */ MAX_FILE_SIZE: () => (/* binding */ MAX_FILE_SIZE),\n/* harmony export */ _getDataName: () => (/* binding */ _getDataName),\n/* harmony export */ _getSize: () => (/* binding */ _getSize),\n/* harmony export */ apiURL: () => (/* binding */ apiURL),\n/* harmony export */ buildFromJSON: () => (/* binding */ buildFromJSON),\n/* harmony export */ formatMsg: () => (/* binding */ formatMsg),\n/* harmony export */ getDotDot: () => (/* binding */ getDotDot),\n/* harmony export */ getHeaderField: () => (/* binding */ getHeaderField),\n/* harmony export */ getPathLink: () => (/* binding */ getPathLink),\n/* harmony export */ getTitle: () => (/* binding */ getTitle)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _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}");
777
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FS: () => (/* binding */ FS),\n/* harmony export */ MAX_FILE_SIZE: () => (/* binding */ MAX_FILE_SIZE),\n/* harmony export */ _getDataName: () => (/* binding */ _getDataName),\n/* harmony export */ _getSize: () => (/* binding */ _getSize),\n/* harmony export */ apiURL: () => (/* binding */ apiURL),\n/* harmony export */ buildFromJSON: () => (/* binding */ buildFromJSON),\n/* harmony export */ formatMsg: () => (/* binding */ formatMsg),\n/* harmony export */ getDotDot: () => (/* binding */ getDotDot),\n/* harmony export */ getHeaderField: () => (/* binding */ getHeaderField),\n/* harmony export */ getPathLink: () => (/* binding */ getPathLink),\n/* harmony export */ getTitle: () => (/* binding */ getTitle)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.mjs\");\n\n\n\n\nconst getHeaderField = currify__WEBPACK_IMPORTED_MODULE_1__(_getHeaderField);\n\n/* КОНСТАНТЫ (общие для клиента и сервера)*/\n/* название программы */\nconst NAME = 'Cloud Commander';\nconst FS = '/fs';\nconst Path = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\nPath('/');\nconst filterOutDotFiles = ({\n showDotFiles\n}) => ({\n name\n}) => {\n if (showDotFiles) return true;\n return !name.startsWith('.');\n};\nconst apiURL = '/api/v1';\nconst MAX_FILE_SIZE = 500 * 1024;\nconst formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n if (name) name = `(\"${name}\")`;\n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nconst getTitle = options => {\n options = options || {};\n const {\n path = Path(),\n name\n } = options;\n const array = [name || NAME, path];\n return array.filter(Boolean).join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url) throw Error('url could not be empty!');\n if (!template) throw Error('template could not be empty!');\n const names = url.split('/').slice(1, -1);\n const allNames = ['/', ...names];\n const lines = [];\n const n = allNames.length;\n let path = '/';\n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n if (i) path += `${name}/`;\n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n const slash = i ? '/' : '';\n lines.push(rendy__WEBPACK_IMPORTED_MODULE_0__(template, {\n path,\n name,\n slash,\n prefix\n }));\n }\n return lines.join('');\n}\nfunction _getDataName(name) {\n const encoded = btoa(encodeURI(name));\n return `data-name=\"js-file-${encoded}\" `;\n}\n\n/**\n * Функция строит таблицу файлв из JSON-информации о файлах\n * @param params - информация о файлах\n *\n */\nconst buildFromJSON = params => {\n const {\n prefix,\n template,\n sort = 'name',\n order = 'asc',\n showDotFiles\n } = params;\n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n const path = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(json.path);\n const {\n files\n } = json;\n\n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n let fileTable = rendy__WEBPACK_IMPORTED_MODULE_0__(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath\n });\n const owner = 'owner';\n const mode = 'mode';\n const getFieldName = getHeaderField(sort, order);\n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n const header = rendy__WEBPACK_IMPORTED_MODULE_0__(templateFile, {\n tag: 'div',\n attribute: 'data-name=\"js-fm-header\" ',\n className: 'fm-header',\n type: '',\n name,\n size,\n date,\n owner,\n mode\n });\n\n /* сохраняем путь */\n Path(path);\n fileTable += `${header}<ul data-name=\"js-files\" class=\"files\">`;\n\n /* Если мы не в корне */\n if (path !== '/') {\n const dotDot = getDotDot(path);\n const link = prefix + FS + dotDot;\n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(template.link, {\n link,\n title: '..',\n name: '..'\n });\n const dataName = _getDataName('..');\n const attribute = `draggable=\"true\" ${dataName}`;\n\n /* Сохраняем путь к каталогу верхнего уровня*/\n fileTable += rendy__WEBPACK_IMPORTED_MODULE_0__(template.file, {\n tag: 'li',\n attribute,\n className: '',\n type: 'directory',\n name: linkResult,\n size: '&lt;dir&gt;',\n date: '--.--.----',\n owner: '.',\n mode: '--- --- ---'\n });\n }\n fileTable += files.filter(filterOutDotFiles({\n showDotFiles\n })).map(updateField).map(file => {\n const name = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(file.name);\n const link = prefix + FS + path + name;\n const {\n type,\n mode,\n date,\n owner,\n size\n } = file;\n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(templateLink, {\n link,\n title: name,\n name,\n attribute: getAttribute(file.type)\n });\n const dataName = _getDataName(file.name);\n const attribute = `draggable=\"true\" ${dataName}`;\n return rendy__WEBPACK_IMPORTED_MODULE_0__(templateFile, {\n tag: 'li',\n attribute,\n className: '',\n type,\n name: linkResult,\n size,\n date,\n owner,\n mode\n });\n }).join('');\n fileTable += '</ul>';\n return fileTable;\n};\nconst updateField = file => ({\n ...file,\n date: file.date || '--.--.----',\n owner: file.owner || 'root',\n size: getSize(file)\n});\nfunction getAttribute(type) {\n if (type === 'directory') return '';\n return 'target=\"_blank\" ';\n}\nconst _getSize = getSize;\nfunction getSize({\n size,\n type\n}) {\n if (type === 'directory') return '&lt;dir&gt;';\n if (/link/.test(type)) return '&lt;link&gt;';\n return size;\n}\nfunction _getHeaderField(sort, order, name) {\n const arrow = order === 'asc' ? '↑' : '↓';\n if (sort !== name) return name;\n if (sort === 'name' && order === 'asc') return name;\n return `${name}${arrow}`;\n}\nfunction getDotDot(path) {\n // убираем последний слеш и каталог в котором мы сейчас находимся\n const lastSlash = path.substr(path, path.lastIndexOf('/'));\n const dotDot = lastSlash.substr(lastSlash, lastSlash.lastIndexOf('/'));\n if (!dotDot) return '/';\n return dotDot;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/cloudfunc.mjs\n}");
778
778
 
779
779
  /***/ },
780
780
 
781
- /***/ "./common/entity.js"
782
- /*!**************************!*\
783
- !*** ./common/entity.js ***!
784
- \**************************/
785
- (module) {
781
+ /***/ "./common/entity.mjs"
782
+ /*!***************************!*\
783
+ !*** ./common/entity.mjs ***!
784
+ \***************************/
785
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
786
786
 
787
787
  "use strict";
788
- eval("{\n\nconst Entities = {\n // '&nbsp;': ' ',\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"'\n};\nconst keys = Object.keys(Entities);\nmodule.exports.encode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(char, 'g');\n str = str.replace(reg, code);\n }\n return str;\n};\nmodule.exports.decode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(code, 'g');\n str = str.replace(reg, char);\n }\n return str;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/entity.js\n}");
788
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\nconst Entities = {\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"'\n};\nconst keys = Object.keys(Entities);\nconst encode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(char, 'g');\n str = str.replace(reg, code);\n }\n return str;\n};\nconst decode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(code, 'g');\n str = str.replace(reg, char);\n }\n return str;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/entity.mjs\n}");
789
789
 
790
790
  /***/ },
791
791
 
@@ -1973,21 +1973,10 @@ eval("{__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-ext
1973
1973
  /*!*************************************************!*\
1974
1974
  !*** ./node_modules/smalltalk/lib/smalltalk.js ***!
1975
1975
  \*************************************************/
1976
- (module, __unused_webpack_exports, __webpack_require__) {
1977
-
1978
- "use strict";
1979
- eval("{\n\n__webpack_require__(/*! ../css/smalltalk.css */ \"./node_modules/smalltalk/css/smalltalk.css\");\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst store = __webpack_require__(/*! fullstore */ \"./node_modules/smalltalk/node_modules/fullstore/lib/fullstore.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n\nconst isBool = (a) => typeof a === 'boolean';\n\nconst keyDown = currify(keyDown_);\n\nconst BUTTON_OK = {\n ok: 'OK',\n};\n\nconst BUTTON_OK_CANCEL = {\n ok: 'OK',\n cancel: 'Cancel',\n};\n\nconst zIndex = store(100);\n\nmodule.exports.alert = (title, msg, options) => {\n const buttons = getButtons(options) || BUTTON_OK;\n return showDialog(title, msg, '', buttons, options);\n};\n\nmodule.exports.prompt = (title, msg, value = '', options) => {\n const type = getType(options);\n const val = String(value).replace(/\"/g, '&quot;');\n \n const valueStr = `<input type=\"${type}\" value=\"${val}\" data-name=\"js-input\">`;\n const buttons = getButtons(options) || BUTTON_OK_CANCEL;\n \n return showDialog(title, msg, valueStr, buttons, options);\n};\n\nmodule.exports.confirm = (title, msg, options) => {\n const buttons = getButtons(options) || BUTTON_OK_CANCEL;\n \n return showDialog(title, msg, '', buttons, options);\n};\n\nmodule.exports.progress = (title, message, options) => {\n const valueStr = `\n <progress value=\"0\" data-name=\"js-progress\" class=\"progress\" max=\"100\"></progress>\n <span data-name=\"js-counter\">0%</span>\n `;\n \n const buttons = {\n cancel: 'Abort',\n };\n \n const promise = showDialog(title, message, valueStr, buttons, options);\n const {ok, dialog} = promise;\n const resolve = ok();\n \n for (const el of find(dialog, ['cancel'])) {\n el.focus();\n }\n \n Object.assign(promise, {\n setProgress(count) {\n const [elProgress] = find(dialog, ['progress']);\n const [elCounter] = find(dialog, ['counter']);\n \n elProgress.value = count;\n elCounter.textContent = `${count}%`;\n \n if (count === 100) {\n remove(dialog);\n resolve();\n }\n },\n \n remove() {\n remove(dialog);\n },\n });\n \n return promise;\n};\n\nfunction getButtons(options = {}) {\n const {buttons} = options;\n \n if (!buttons)\n return null;\n \n return buttons;\n}\n\nfunction getType(options = {}) {\n const {type} = options;\n \n if (type === 'password')\n return 'password';\n \n return 'text';\n}\n\nfunction getTemplate(title, msg, value, buttons) {\n const encodedMsg = msg.replace(/\\n/g, '<br>');\n \n return `<div class=\"page\">\n <div data-name=\"js-close\" class=\"close-button\"></div>\n <header>${title}</header>\n <div class=\"content-area\">${encodedMsg}${value}</div>\n <div class=\"action-area\">\n <div class=\"button-strip\">\n ${parseButtons(buttons)}\n </div>\n </div>\n </div>`;\n}\n\nfunction parseButtons(buttons) {\n const names = Object.keys(buttons);\n const parse = currify((buttons, name, i) => `<button\n tabindex=${i}\n data-name=\"js-${name.toLowerCase()}\">\n ${buttons[name]}\n </button>`);\n \n return names\n .map(parse(buttons))\n .join('');\n}\n\nfunction showDialog(title, msg, value, buttons, options) {\n const ok = store();\n const cancel = store();\n \n const closeButtons = [\n 'cancel',\n 'close',\n 'ok',\n ];\n \n const promise = new Promise((resolve, reject) => {\n const noCancel = options && isBool(options.cancel) && !options.cancel;\n const empty = () => {};\n const rejectError = () => reject(Error());\n \n ok(resolve);\n cancel(noCancel ? empty : rejectError);\n });\n \n const innerHTML = getTemplate(title, msg, value, buttons);\n \n const dialog = createElement('div', {\n innerHTML,\n className: 'smalltalk',\n style: `z-index: ${zIndex(zIndex() + 1)}`,\n });\n \n for (const el of find(dialog, ['ok', 'input']))\n el.focus();\n \n for (const el of find(dialog, ['input'])) {\n el.setSelectionRange(0, value.length);\n }\n \n addListenerAll('click', dialog, closeButtons, (event) => {\n closeDialog(event.target, dialog, ok(), cancel());\n });\n \n for (const event of ['click', 'contextmenu'])\n dialog.addEventListener(event, (e) => {\n e.stopPropagation();\n \n for (const el of find(dialog, ['ok', 'input']))\n el.focus();\n });\n \n dialog.addEventListener('keydown', keyDown(dialog, ok(), cancel()));\n \n return Object.assign(promise, {\n dialog,\n ok,\n });\n}\n\nfunction keyDown_(dialog, ok, cancel, event) {\n const KEY = {\n ENTER: 13,\n ESC: 27,\n TAB: 9,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n };\n \n const {keyCode} = event;\n const el = event.target;\n \n const namesAll = [\n 'ok',\n 'cancel',\n 'input',\n ];\n const names = find(dialog, namesAll).map(getDataName);\n \n switch(keyCode) {\n case KEY.ENTER:\n closeDialog(el, dialog, ok, cancel);\n event.preventDefault();\n break;\n \n case KEY.ESC:\n remove(dialog);\n cancel();\n break;\n \n case KEY.TAB:\n if (event.shiftKey)\n tab(dialog, names);\n \n tab(dialog, names);\n event.preventDefault();\n break;\n \n default:\n [\n 'left',\n 'right',\n 'up',\n 'down',\n ]\n .filter((name) => keyCode === KEY[name.toUpperCase()])\n .forEach(() => {\n changeButtonFocus(dialog, names);\n });\n \n break;\n }\n \n event.stopPropagation();\n}\n\nfunction getDataName(el) {\n return el\n .getAttribute('data-name')\n .replace('js-', '');\n}\n\nconst getName = (activeName) => {\n if (activeName === 'cancel')\n return 'ok';\n \n return 'cancel';\n};\n\nfunction changeButtonFocus(dialog, names) {\n const active = document.activeElement;\n const activeName = getDataName(active);\n const isButton = /ok|cancel/.test(activeName);\n const count = names.length - 1;\n \n if (activeName === 'input' || !count || !isButton)\n return;\n \n const name = getName(activeName);\n \n for (const el of find(dialog, [name])) {\n el.focus();\n }\n}\n\nconst getIndex = (count, index) => {\n if (index === count)\n return 0;\n \n return index + 1;\n};\n\nfunction tab(dialog, names) {\n const active = document.activeElement;\n const activeName = getDataName(active);\n const count = names.length - 1;\n \n const activeIndex = names.indexOf(activeName);\n const index = getIndex(count, activeIndex);\n \n const name = names[index];\n \n for (const el of find(dialog, [name]))\n el.focus();\n}\n\nfunction closeDialog(el, dialog, ok, cancel) {\n const name = el\n .getAttribute('data-name')\n .replace('js-', '');\n \n if (/close|cancel/.test(name)) {\n cancel();\n remove(dialog);\n \n return;\n }\n \n let value = null;\n \n for (const el of find(dialog, ['input'])) {\n value = el.value;\n }\n \n ok(value);\n remove(dialog);\n}\n\nconst query = currify((element, name) => element.querySelector(`[data-name=\"js-${name}\"]`));\n\nfunction find(element, names) {\n const elements = names\n .map(query(element))\n .filter(Boolean);\n \n return elements;\n}\n\nfunction addListenerAll(event, parent, elements, fn) {\n for (const el of find(parent, elements)) {\n el.addEventListener(event, fn);\n }\n}\n\nfunction remove(dialog) {\n const {parentElement} = dialog;\n \n if (parentElement)\n parentElement.removeChild(dialog);\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/smalltalk/lib/smalltalk.js\n}");
1980
-
1981
- /***/ },
1982
-
1983
- /***/ "./node_modules/smalltalk/node_modules/fullstore/lib/fullstore.js"
1984
- /*!************************************************************************!*\
1985
- !*** ./node_modules/smalltalk/node_modules/fullstore/lib/fullstore.js ***!
1986
- \************************************************************************/
1987
- (module) {
1976
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1988
1977
 
1989
1978
  "use strict";
1990
- eval("{\n\nmodule.exports = (value) => {\n const data = {\n value,\n };\n \n return (...args) => {\n const [value] = args;\n \n if (!args.length)\n return data.value;\n \n data.value = value;\n \n return value;\n };\n};\n\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/smalltalk/node_modules/fullstore/lib/fullstore.js\n}");
1979
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alert: () => (/* binding */ alert),\n/* harmony export */ confirm: () => (/* binding */ confirm),\n/* harmony export */ progress: () => (/* binding */ progress),\n/* harmony export */ prompt: () => (/* binding */ prompt)\n/* harmony export */ });\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _css_smalltalk_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../css/smalltalk.css */ \"./node_modules/smalltalk/css/smalltalk.css\");\n\n\n\n\n\nconst isBool = (a) => typeof a === 'boolean';\n\nconst keyDown = currify__WEBPACK_IMPORTED_MODULE_0__(keyDown_);\n\nconst BUTTON_OK = {\n ok: 'OK',\n};\n\nconst BUTTON_OK_CANCEL = {\n ok: 'OK',\n cancel: 'Cancel',\n};\n\nconst zIndex = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(100);\n\nconst alert = (title, msg, options) => {\n const buttons = getButtons(options) || BUTTON_OK;\n return showDialog(title, msg, '', buttons, options);\n};\n\nconst prompt = (title, msg, value = '', options) => {\n const type = getType(options);\n const val = String(value).replace(/\"/g, '&quot;');\n \n const valueStr = `<input type=\"${type}\" value=\"${val}\" data-name=\"js-input\">`;\n const buttons = getButtons(options) || BUTTON_OK_CANCEL;\n \n return showDialog(title, msg, valueStr, buttons, options);\n};\n\nconst confirm = (title, msg, options) => {\n const buttons = getButtons(options) || BUTTON_OK_CANCEL;\n \n return showDialog(title, msg, '', buttons, options);\n};\n\nconst progress = (title, message, options) => {\n const valueStr = `\n <progress value=\"0\" data-name=\"js-progress\" class=\"progress\" max=\"100\"></progress>\n <span data-name=\"js-counter\">0%</span>\n `;\n \n const buttons = {\n cancel: 'Abort',\n };\n \n const promise = showDialog(title, message, valueStr, buttons, options);\n const {ok, dialog} = promise;\n const resolve = ok();\n \n for (const el of find(dialog, ['cancel'])) {\n el.focus();\n }\n \n Object.assign(promise, {\n setProgress(count) {\n const [elProgress] = find(dialog, ['progress']);\n const [elCounter] = find(dialog, ['counter']);\n \n elProgress.value = count;\n elCounter.textContent = `${count}%`;\n \n if (count === 100) {\n remove(dialog);\n resolve();\n }\n },\n \n remove() {\n remove(dialog);\n },\n });\n \n return promise;\n};\n\nfunction getButtons(options = {}) {\n const {buttons} = options;\n \n if (!buttons)\n return null;\n \n return buttons;\n}\n\nfunction getType(options = {}) {\n const {type} = options;\n \n if (type === 'password')\n return 'password';\n \n return 'text';\n}\n\nfunction getTemplate(title, msg, value, buttons) {\n const encodedMsg = msg.replace(/\\n/g, '<br>');\n \n return `<div class=\"page\">\n <div data-name=\"js-close\" class=\"close-button\"></div>\n <header>${title}</header>\n <div class=\"content-area\">${encodedMsg}${value}</div>\n <div class=\"action-area\">\n <div class=\"button-strip\">\n ${parseButtons(buttons)}\n </div>\n </div>\n </div>`;\n}\n\nfunction parseButtons(buttons) {\n const names = Object.keys(buttons);\n const parse = currify__WEBPACK_IMPORTED_MODULE_0__((buttons, name, i) => `<button\n tabindex=${i}\n data-name=\"js-${name.toLowerCase()}\">\n ${buttons[name]}\n </button>`);\n \n return names\n .map(parse(buttons))\n .join('');\n}\n\nfunction showDialog(title, msg, value, buttons, options) {\n const ok = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n const cancel = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n \n const closeButtons = [\n 'cancel',\n 'close',\n 'ok',\n ];\n \n const promise = new Promise((resolve, reject) => {\n const noCancel = options && isBool(options.cancel) && !options.cancel;\n const empty = () => {};\n const rejectError = () => reject(Error());\n \n ok(resolve);\n cancel(noCancel ? empty : rejectError);\n });\n \n const innerHTML = getTemplate(title, msg, value, buttons);\n \n const dialog = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_2__('div', {\n innerHTML,\n className: 'smalltalk',\n style: `z-index: ${zIndex(zIndex() + 1)}`,\n });\n \n for (const el of find(dialog, ['ok', 'input']))\n el.focus();\n \n for (const el of find(dialog, ['input'])) {\n el.setSelectionRange(0, value.length);\n }\n \n addListenerAll('click', dialog, closeButtons, (event) => {\n closeDialog(event.target, dialog, ok(), cancel());\n });\n \n for (const event of ['click', 'contextmenu'])\n dialog.addEventListener(event, (e) => {\n e.stopPropagation();\n \n for (const el of find(dialog, ['ok', 'input']))\n el.focus();\n });\n \n dialog.addEventListener('keydown', keyDown(dialog, ok(), cancel()));\n \n return Object.assign(promise, {\n dialog,\n ok,\n });\n}\n\nfunction keyDown_(dialog, ok, cancel, event) {\n const KEY = {\n ENTER: 13,\n ESC: 27,\n TAB: 9,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n };\n \n const {keyCode} = event;\n const el = event.target;\n \n const namesAll = [\n 'ok',\n 'cancel',\n 'input',\n ];\n \n const names = find(dialog, namesAll).map(getDataName);\n \n switch(keyCode) {\n case KEY.ENTER:\n closeDialog(el, dialog, ok, cancel);\n event.preventDefault();\n break;\n \n case KEY.ESC:\n remove(dialog);\n cancel();\n break;\n \n case KEY.TAB:\n if (event.shiftKey)\n tab(dialog, names);\n \n tab(dialog, names);\n event.preventDefault();\n break;\n \n default:\n [\n 'left',\n 'right',\n 'up',\n 'down',\n ]\n .filter((name) => keyCode === KEY[name.toUpperCase()])\n .forEach(() => {\n changeButtonFocus(dialog, names);\n });\n \n break;\n }\n \n event.stopPropagation();\n}\n\nfunction getDataName(el) {\n return el\n .getAttribute('data-name')\n .replace('js-', '');\n}\n\nconst getName = (activeName) => {\n if (activeName === 'cancel')\n return 'ok';\n \n return 'cancel';\n};\n\nfunction changeButtonFocus(dialog, names) {\n const active = document.activeElement;\n const activeName = getDataName(active);\n const isButton = /ok|cancel/.test(activeName);\n const count = names.length - 1;\n \n if (activeName === 'input' || !count || !isButton)\n return;\n \n const name = getName(activeName);\n \n for (const el of find(dialog, [name])) {\n el.focus();\n }\n}\n\nconst getIndex = (count, index) => {\n if (index === count)\n return 0;\n \n return index + 1;\n};\n\nfunction tab(dialog, names) {\n const active = document.activeElement;\n const activeName = getDataName(active);\n const count = names.length - 1;\n \n const activeIndex = names.indexOf(activeName);\n const index = getIndex(count, activeIndex);\n \n const name = names[index];\n \n for (const el of find(dialog, [name]))\n el.focus();\n}\n\nfunction closeDialog(el, dialog, ok, cancel) {\n const name = el\n .getAttribute('data-name')\n .replace('js-', '');\n \n if (/close|cancel/.test(name)) {\n cancel();\n remove(dialog);\n \n return;\n }\n \n let value = null;\n \n for (const el of find(dialog, ['input'])) {\n ({value} = el);\n }\n \n ok(value);\n remove(dialog);\n}\n\nconst query = currify__WEBPACK_IMPORTED_MODULE_0__((element, name) => element.querySelector(`[data-name=\"js-${name}\"]`));\n\nfunction find(element, names) {\n const elements = names\n .map(query(element))\n .filter(Boolean);\n \n return elements;\n}\n\nfunction addListenerAll(event, parent, elements, fn) {\n for (const el of find(parent, elements)) {\n el.addEventListener(event, fn);\n }\n}\n\nfunction remove(dialog) {\n const {parentElement} = dialog;\n \n if (parentElement)\n parentElement.removeChild(dialog);\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/smalltalk/lib/smalltalk.js\n}");
1991
1980
 
1992
1981
  /***/ },
1993
1982